bold font rendeing in Java is broken in Cosmic with OpenJDK 11

Bug #1799014 reported by Václav Haisman on 2018-10-21
This bug affects 3 people
Affects Status Importance Assigned to Milestone
openjdk-11 (Debian)
Fix Released
openjdk-lts (Ubuntu)
Tiago Stürmer Daitx

Bug Description

Since update to Cosmic, I see that bold fonts in Java have broken rendering. See attached 400% scaled PNG for illustration. The 'r' in bold rendering of "Hello World" shows basically a vertical line from the end of the hook end. I am not entirely sure this is freetype issue but some sources ( suggest there is a bug in the 2.8.1 version that Cosmic seems to install (libfreetype6/cosmic,now 2.8.1-2ubuntu2 amd64 [installed]).

Václav Haisman (vzeman79) wrote :
tags: added: cosmic
affects: openjdk-lts (Ubuntu) → openjdk
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in freetype (Ubuntu):
status: New → Confirmed
Václav Haisman (vzeman79) wrote :

Here is a small test application that shows the issue.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

affects: openjdk → openjdk-lts (Ubuntu)
Changed in openjdk-lts (Ubuntu):
status: New → Confirmed
Thorsten Glaser (mirabilos) wrote :

The testcase needs the “package test;” in the first line removed / commented-out, then it works.

This works in 11.0.1+13-2 on Debian sid, as a new data point.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openjdk-lts (Ubuntu):
status: New → Confirmed

The bug has been fixed in Debian just by removing a patch:

 openjdk-11 (11~28-3) unstable; urgency=medium
   * Drop the jdk-freetypeScaler-crash patch. Closes: #905718.

Changed in openjdk-11 (Debian):
status: Unknown → Fix Released
Sebastien Bacher (seb128) wrote :

@Laurent, that changes is supposed to be in the cosmic version of the package though

"openjdk-lts (11~28-3ubuntu1) cosmic; urgency=medium

  * Sync packages with 11~28-3."

The debian bug also states that updating openjdk didn't fix the issue but updating other gtk pacakges did (without specific on which one could have fixed the issue)

> updating other gtk pacakges did [fix the issue]


I confirm that on my Debian sid+experimental system, fonts look OK in openjdk-11.

I tried to investigate the problem in Ubuntu cosmic by first trying to determine which fonts are used by the JRE. I used this command:

  cat /proc/$(pidof java)/maps | grep font

and only found files from /var/cache/fontconfig/ and no actual font files.
Other applications have files from /usr/share/fonts/, but not the JRE.
Without this I do not know where to look further :<...

md_5 (md-5) wrote :

Yeah its still an issue with 11.0.1+13-2ubuntu1, and also the upstream release

freetype has been causing such issues in the last year or so....

md_5 (md-5) wrote :

Stealing libfreetype6 2.9.1-3 from Debian and installing it make the rendering passable again.
Not subjectively 100% as good as Java 8, but fine enough to get used to.

Matthias Bläsing (mblaesing) wrote :

I still see font distortions on ubuntu cosmic:

openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment (build 11.0.1+13-Ubuntu-2ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.1+13-Ubuntu-2ubuntu1, mixed mode, sharing)

There is a matching upstream issue for this:

In the comments for that issue, a second (fixed) issue is referenced:

The fix for that issue was merged to the jdk 12 and jdk branches:

I build the jdk branch and found the issue fixed. I also rebuild the ubuntu package with the above mentioned patch included (only the change in freetypeScaler.c, not the new test) and also found, that this fixes my problem.

I don't know the plans for java in ubuntu regarding LTS releases and patch backports, but it would be great if you could include the patch. For the record: I did not write that patch, it is the referenced changeset above, modified to be applied while building the ubuntu package.

The attachment "font-fix.diff" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
tags: added: rls-cc-incoming
Changed in openjdk-lts (Ubuntu):
assignee: nobody → Tiago Stürmer Daitx (tdaitx)
Matthias Klose (doko) wrote :

fixed in 11.0.2 in disco.

Changed in openjdk-lts (Ubuntu):
status: Confirmed → Fix Released
Sebastien Bacher (seb128) wrote :

> fixed in 11.0.2 in disco.

no, it's not

openjdk-lts-11.0.2+9$ grep 'int renderFlags =' * -r
src/java.desktop/share/native/libfontmanager/freetypeScaler.c: int renderFlags = FT_LOAD_RENDER, target;

see if the fix was included it should be FT_LOAD_DEFAULT

Changed in openjdk-lts (Ubuntu):
status: Fix Released → New
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package openjdk-lts - 11.0.2+9-3ubuntu1

openjdk-lts (11.0.2+9-3ubuntu1) disco; urgency=medium

  * Sync packages with 11.0.2+9-3:
    - Fix Zero on sparc64 (Adrian Glaubitz). Closes: #920315.
    - Link zero on alpha with --no-relax (Michael Cree). Addresses: #920161.
    - Don't run the tests on alpha, causing build failure.
    - jhsdb isn't built on alpha.
    - Backport the fix for 8214002 (cannot use italic font style if the font
      has embedded bitmap). LP: #1799014.
  * Sync packages with 11.0.2+9-2:
    - Fix file permissions for autopkg tests.

 -- Matthias Klose <email address hidden> Thu, 24 Jan 2019 15:14:20 +0100

Changed in openjdk-lts (Ubuntu):
status: New → Fix Released
Changed in freetype (Ubuntu):
status: Confirmed → Invalid
Changed in freetype (Ubuntu Bionic):
status: New → Invalid
Changed in freetype (Ubuntu Cosmic):
status: New → Invalid
no longer affects: freetype (Ubuntu)
no longer affects: freetype (Ubuntu Bionic)
no longer affects: freetype (Ubuntu Cosmic)
Changed in openjdk-lts (Ubuntu):
importance: Undecided → Medium
Changed in openjdk-lts (Ubuntu Bionic):
importance: Undecided → Medium
Changed in openjdk-lts (Ubuntu Cosmic):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.