Bug 215636 - java/openjdk8: Add fontconfig support
Summary: java/openjdk8: Add fontconfig support
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Greg Lewis
URL: https://reviews.freebsd.org/D13169
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-28 18:26 UTC by Dmitri Goutnik
Modified: 2020-07-10 22:03 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (java)


Attachments
patch file (10.76 KB, patch)
2016-12-28 18:26 UTC, Dmitri Goutnik
no flags Details | Diff
Gogland-GoMono14-no-patch.png (146.55 KB, image/png)
2016-12-28 18:28 UTC, Dmitri Goutnik
no flags Details
Gogland-GoMono14-with-patch.png (168.58 KB, image/png)
2016-12-28 18:28 UTC, Dmitri Goutnik
no flags Details
PyCharm-DejaVuSansMono14-no-patch.png (149.06 KB, image/png)
2016-12-28 18:29 UTC, Dmitri Goutnik
no flags Details
PyCharm-DejaVuSansMono14-with-patch.png (193.41 KB, image/png)
2016-12-28 18:29 UTC, Dmitri Goutnik
no flags Details
PyCharm-LiberationMono14-no-patch.png (156.81 KB, image/png)
2016-12-28 18:30 UTC, Dmitri Goutnik
no flags Details
PyCharm-LiberationMono14-with-patch.png (199.14 KB, image/png)
2016-12-28 18:30 UTC, Dmitri Goutnik
no flags Details
PyCharm-UbuntuMono14-no-patch.png (144.80 KB, image/png)
2016-12-28 18:30 UTC, Dmitri Goutnik
no flags Details
PyCharm-UbuntuMono14-with-patch.png (189.12 KB, image/png)
2016-12-28 18:31 UTC, Dmitri Goutnik
no flags Details
updated patch file (10.76 KB, patch)
2017-01-08 21:53 UTC, Dmitri Goutnik
no flags Details | Diff
openjdk8-8.112.16_4.patch (17.25 KB, patch)
2017-01-20 18:15 UTC, Dmitri Goutnik
no flags Details | Diff
openjdk8-8.121.13_1.patch (17.24 KB, patch)
2017-02-13 20:07 UTC, Dmitri Goutnik
no flags Details | Diff
patch file (17.71 KB, patch)
2017-11-20 16:48 UTC, Dmitri Goutnik
no flags Details | Diff
patch file (17.67 KB, patch)
2017-12-28 14:22 UTC, Dmitri Goutnik
dmgk: maintainer-approval? (java)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitri Goutnik freebsd_committer 2016-12-28 18:26:12 UTC
Created attachment 178350 [details]
patch file

Attached patch adds optional (unchecked by default) support for fontconfig in OpenJDK FreeType scaler. This allows scaler to obtain per-family FreeType rendering and loading flags from fontconfig instead of relying on OpenJDK heuristics, which noticeably improves font rendering in Java appications.

Patch code is based on original OpenJDK Infinality patches from [1] (now gone) and Fedora 21 [2].

Also attached are rendering examples with and w/o fontconfig patch:

Gogland-GoMono14-no-patch.png: JetBrains Gogland, Go Mono 14pt, no fontconfig patch
Gogland-GoMono14-with-patch.png: JetBrains Gogland, Go Mono 14pt, with fontconfig patch

PyCharm-DejaVuSansMono14-no-patch.png: JetBrains PyCharm, DejaVu Sans Mono 14pt, no patch
PyCharm-DejaVuSansMono14-with-patch.png: JetBrains PyCharm, DejaVu Sans Mono 14pt, with fontconfig patch, "slight" hinting

PyCharm-LiberationMono14-no-patch.png: JetBrains PyCharm, Liberation Mono 14pt, no patch
PyCharm-LiberationMono14-with-patch.png: JetBrains PyCharm, Liberation Mono 14pt, with fontconfig patch, "slight" hinting

PyCharm-UbuntuMono14-no-patch.png: JetBrains PyCharm, Ubuntu Mono 14pt, no patch
PyCharm-UbuntuMono14-with-patch.png: JetBrains PyCharm, Ubuntu Mono 14pt, with fontconfig patch, "slight" hinting

poudriere testport: OK on 11.0-RELEASE-p6 amd64/i386

--
[1] http://www.infinality.net/forum/viewtopic.php?f=2&t=80#p395
[2] https://github.com/smerrill/fedora-21-openjdk8-infinality/blob/master/SOURCES/005_enable-infinality.patch
Comment 1 Dmitri Goutnik freebsd_committer 2016-12-28 18:28:05 UTC
Created attachment 178351 [details]
Gogland-GoMono14-no-patch.png
Comment 2 Dmitri Goutnik freebsd_committer 2016-12-28 18:28:42 UTC
Created attachment 178352 [details]
Gogland-GoMono14-with-patch.png
Comment 3 Dmitri Goutnik freebsd_committer 2016-12-28 18:29:10 UTC
Created attachment 178353 [details]
PyCharm-DejaVuSansMono14-no-patch.png
Comment 4 Dmitri Goutnik freebsd_committer 2016-12-28 18:29:37 UTC
Created attachment 178354 [details]
PyCharm-DejaVuSansMono14-with-patch.png
Comment 5 Dmitri Goutnik freebsd_committer 2016-12-28 18:30:00 UTC
Created attachment 178355 [details]
PyCharm-LiberationMono14-no-patch.png
Comment 6 Dmitri Goutnik freebsd_committer 2016-12-28 18:30:28 UTC
Created attachment 178356 [details]
PyCharm-LiberationMono14-with-patch.png
Comment 7 Dmitri Goutnik freebsd_committer 2016-12-28 18:30:51 UTC
Created attachment 178357 [details]
PyCharm-UbuntuMono14-no-patch.png
Comment 8 Dmitri Goutnik freebsd_committer 2016-12-28 18:31:13 UTC
Created attachment 178358 [details]
PyCharm-UbuntuMono14-with-patch.png
Comment 9 Dmitri Goutnik freebsd_committer 2017-01-08 21:53:34 UTC
Created attachment 178637 [details]
updated patch file

Updated PORTREVISION.
Comment 10 Dmitri Goutnik freebsd_committer 2017-01-20 18:15:41 UTC
Created attachment 179154 [details]
openjdk8-8.112.16_4.patch

- avoid double-patching of freetypeScaler.c by using separate patch files for FONTCONFIG ON/OFF configurations

- updated PORTREVISION
Comment 11 Dmitri Goutnik freebsd_committer 2017-02-13 20:07:56 UTC
Created attachment 179959 [details]
openjdk8-8.121.13_1.patch

- updated for openjdk8-8.121.13
Comment 12 Dmitri Goutnik freebsd_committer 2017-11-20 16:48:00 UTC
Created attachment 188141 [details]
patch file

* Update for openjdk8-8.152.16

Differential: https://reviews.freebsd.org/D13169

QA: poudriere testport OK (11a, 10i)
Comment 13 Dmitri Goutnik freebsd_committer 2017-12-28 14:22:00 UTC
Created attachment 189163 [details]
patch file

* Update for openjdk8-8.152.16_2

QA: poudriere testport OK (11a, 10i)
Comment 14 Matthias Gamsjager 2018-01-02 10:12:18 UTC
Thanks for keeping this patch up to date! 
Finally I am able to use my Jetbrain IDE without getting an head ache from the bad font rendering.
Comment 15 Greg Lewis freebsd_committer 2018-02-28 07:21:11 UTC
I like the idea of this overall, although I don't like that it means maintaining yet more patches that need to be merged for most updates (or so it seems).

I'll at least do some test builds and some diff comparisons.
Comment 16 Matthias Gamsjager 2018-02-28 07:55:18 UTC
(In reply to Greg Lewis from comment #15)

I wonder if this patch will be needed in the upcoming openJDK9 and 10 versions
Comment 17 Dmitri Goutnik freebsd_committer 2018-02-28 13:26:28 UTC
(In reply to Greg Lewis from comment #15)
Thanks for looking into this. I don't think I had to change freetypeScaler patches between OpenJDK versions, most changes were to the Makefile patch. In any case, I'm willing to maintain/support this further if needed.
Comment 18 commit-hook freebsd_committer 2018-03-04 00:56:58 UTC
A commit references this bug:

Author: glewis
Date: Sun Mar  4 00:56:32 UTC 2018
New revision: 463545
URL: https://svnweb.freebsd.org/changeset/ports/463545

Log:
  . Add a FONTCONFIG option which allows scaler to obtain per-family FreeType
    rendering and loading and may noticeably improves font rendering in Java
    appications

  PR:		215636
  Submitted by:	Dmitri Goutnik <dg@syrec.org>

Changes:
  head/java/openjdk8/Makefile
  head/java/openjdk8/files/fontconfig.patch
Comment 19 Greg Lewis freebsd_committer 2018-03-04 01:20:53 UTC
I've committed a version of this.  I shrunk the Makefile patch and combined the different file patches into one while factoring out the existing freetypeScaler.c changes.

Let me know if it works ok.
Comment 20 Dmitri Goutnik freebsd_committer 2018-03-04 02:38:33 UTC
Looks good to me after brief testing FONTCONFIG on/off with CLion and GoLand.
Comment 21 Greg Lewis freebsd_committer 2018-03-04 04:18:05 UTC
Thanks, I'll go ahead and resolve this then.
Comment 22 Dmitri Goutnik freebsd_committer 2018-03-04 17:47:26 UTC
Thanks for merging!