Bug 215636

Summary: java/openjdk8: Add fontconfig support
Product: Ports & Packages Reporter: Dmitri Goutnik <dmgk>
Component: Individual Port(s)Assignee: Greg Lewis <glewis>
Status: Closed FIXED    
Severity: Affects Some People CC: glewis, java, mgamsjager, swills, tgyurci
Priority: --- Flags: bugzilla: maintainer-feedback? (java)
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://reviews.freebsd.org/D13169
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247238
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247901
Attachments:
Description Flags
patch file
none
Gogland-GoMono14-no-patch.png
none
Gogland-GoMono14-with-patch.png
none
PyCharm-DejaVuSansMono14-no-patch.png
none
PyCharm-DejaVuSansMono14-with-patch.png
none
PyCharm-LiberationMono14-no-patch.png
none
PyCharm-LiberationMono14-with-patch.png
none
PyCharm-UbuntuMono14-no-patch.png
none
PyCharm-UbuntuMono14-with-patch.png
none
updated patch file
none
openjdk8-8.112.16_4.patch
none
openjdk8-8.121.13_1.patch
none
patch file
none
patch file dmgk: maintainer-approval? (java)

Description Dmitri Goutnik freebsd_committer freebsd_triage 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 freebsd_triage 2016-12-28 18:28:05 UTC
Created attachment 178351 [details]
Gogland-GoMono14-no-patch.png
Comment 2 Dmitri Goutnik freebsd_committer freebsd_triage 2016-12-28 18:28:42 UTC
Created attachment 178352 [details]
Gogland-GoMono14-with-patch.png
Comment 3 Dmitri Goutnik freebsd_committer freebsd_triage 2016-12-28 18:29:10 UTC
Created attachment 178353 [details]
PyCharm-DejaVuSansMono14-no-patch.png
Comment 4 Dmitri Goutnik freebsd_committer freebsd_triage 2016-12-28 18:29:37 UTC
Created attachment 178354 [details]
PyCharm-DejaVuSansMono14-with-patch.png
Comment 5 Dmitri Goutnik freebsd_committer freebsd_triage 2016-12-28 18:30:00 UTC
Created attachment 178355 [details]
PyCharm-LiberationMono14-no-patch.png
Comment 6 Dmitri Goutnik freebsd_committer freebsd_triage 2016-12-28 18:30:28 UTC
Created attachment 178356 [details]
PyCharm-LiberationMono14-with-patch.png
Comment 7 Dmitri Goutnik freebsd_committer freebsd_triage 2016-12-28 18:30:51 UTC
Created attachment 178357 [details]
PyCharm-UbuntuMono14-no-patch.png
Comment 8 Dmitri Goutnik freebsd_committer freebsd_triage 2016-12-28 18:31:13 UTC
Created attachment 178358 [details]
PyCharm-UbuntuMono14-with-patch.png
Comment 9 Dmitri Goutnik freebsd_committer freebsd_triage 2017-01-08 21:53:34 UTC
Created attachment 178637 [details]
updated patch file

Updated PORTREVISION.
Comment 10 Dmitri Goutnik freebsd_committer freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 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 freebsd_triage 2018-03-04 04:18:05 UTC
Thanks, I'll go ahead and resolve this then.
Comment 22 Dmitri Goutnik freebsd_committer freebsd_triage 2018-03-04 17:47:26 UTC
Thanks for merging!