Bug 1257496

Summary: Fonts are not antialiased in java applications
Product: [Fedora] Fedora Reporter: Jonathan Haas <jonha87>
Component: fontconfigAssignee: Mario Torre <neugens>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: ahughes, dbhole, fonts-bugs, i18n-bugs, jerboaa, jonha87, jvanek, msrb, neugens, omajid, pnemade, sgehwolf, tagoh
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-12 09:04:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Simple C test case none

Description Jonathan Haas 2015-08-27 08:13:45 UTC
Description of problem:

Bug 568640 seems to have reappeared in F22


How reproducible: always


Steps to Reproduce:
$ sudo dnf install java-1.8.0-openjdk-devel # Not sure if needed to reproduce
$ sudo dnf install josm
$ josm

Actual results:

Fonts are pixelated

Expected results:

Fonts are antialiased

Additional info:

running
export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on"
before starting josm makes the fonts look nice.

Comment 1 Mario Torre 2015-08-28 11:00:53 UTC
I cannot reproduce the error, on a fresh install of Fedora 22 fonts are rendered correctly.

Even after fully updating the system fonts still look ok.

Can you please specify your full package list?

Comment 2 Jonathan Haas 2015-08-28 11:26:59 UTC
Sorry, I should have said, that I'm using KDE Plasma instead of the default Gnome 3 desktop. I'm not aware of any other relevant packages I installed. How do I get a full package list?

If necessary I will install F22 into a virtual machine to create exact steps to reproduce.

Comment 3 Severin Gehwolf 2015-08-28 12:33:49 UTC
(In reply to Mario Torre from comment #1)
> I cannot reproduce the error, on a fresh install of Fedora 22 fonts are
> rendered correctly.

Since I've run into a similar problem recently here is a fairly simple way to reproduce using mock and the fonts demo:

$ mock -r fedora-rawhide-x86_64 --init
$ mock -r fedora-rawhide-x86_64 --install java-1.8.0-openjdk-demo
$ mock -r fedora-rawhide-x86_64 --shell 'DISPLAY=:0 java -jar /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.60-13.b27.fc24.x86_64/demo/jfc/Font2DTest/Font2DTest.jar'

This is for fedora-rawhide, of course, but it should work with F22 just as well. s/fedora-rawhide-x86_64/fedora-22-x86_64/ in that case.

Comment 4 Mario Torre 2015-08-28 12:56:57 UTC
I don't think this is not a Java bug.

There's a setting in the KDE desktop control panel:

System Settings->Fonts->Use Antialiasing->Enabled

This will make the font antialised again.

The default setting is "System", which for FontConfig means non antialiased, I can demonstrate this with a simple C program.

Comment 5 Mario Torre 2015-08-28 12:58:12 UTC
Created attachment 1067982 [details]
Simple C test case

Comment 6 Mario Torre 2015-08-28 12:59:40 UTC
(In reply to Mario Torre from comment #4)
> I don't think this is not a Java bug.

Ehm, obviously I mean: I don't think this is a Java bug.

I'll close the bug for now, but you can reopen it against FontConfig if you think is a genuine bug.

Comment 7 Jonathan Haas 2015-08-28 14:39:25 UTC
(In reply to Mario Torre from comment #4)
> I don't think this is not a Java bug.
> 
> There's a setting in the KDE desktop control panel:
> 
> System Settings->Fonts->Use Antialiasing->Enabled
> 
> This will make the font antialised again.

Thank you, that worked.

I don't really know what FontConfig does, so I'm not reopening straight away, but I think it's clearly a bug that you have to explicitly change that setting to make Java applications look nice. I see the following possible fixes:

- KDE should set antialiasing to "On" instead of "System", by default (if that makes sense) (KDE issue?)

- I don't know how "System" antialiasing is supposed to be interpreted. KDE obviously thinks it's supposed to mean on and Java thinks it's supposed to mean off. One of them is probably wrong!? (Java issue?)

- Java should not read the FontConfig setting in case it doesn't make sense and use a better mechanism to determine if antialiasing should be used. Maybe just default to on, because who wants it to be off, really? (Java issue?)

- FontConfig itself should use reasonable defaults, interpret "System" consitently, or whatever (FontConfig issue?)

As I said, I'm not sure what the correct solution is here, and i would be glad if you (or anyone else with more experience in this area) could reopen it under the correct component. 

If you don't then I will be reopening it as a FontConfig issue as you suggested in a few days.

Comment 8 Mario Torre 2015-09-07 12:00:42 UTC
(In reply to J. Haas from comment #7)
> (In reply to Mario Torre from comment #4)
> > I don't think this is not a Java bug.
> > 
> > There's a setting in the KDE desktop control panel:
> > 
> > System Settings->Fonts->Use Antialiasing->Enabled
> > 
> > This will make the font antialised again.
> 
> Thank you, that worked.
> 
> I don't really know what FontConfig does, so I'm not reopening straight
> away, but I think it's clearly a bug that you have to explicitly change that
> setting to make Java applications look nice. I see the following possible
> fixes:

I don't think this is a bug, perhaps it could be a RFE to let Java/FontConfig query KDE font settings, or perhaps revert to AA fonts by default, I don't know, but the way it works currently it's by design.

Comment 9 Jonathan Haas 2015-09-07 18:16:00 UTC
> I don't know, but the way it works currently it's by design.

Sorry, but then the design is stupid. Why would you want to have pixelated fonts by default? Reopening this under fontconfig for now, as you suggested.

I don't care if this is fixed by changing the default fontconfig setting, by improving Java font settings detection or whatever. And I have no real idea how this works.

I'm just a simple Java software developer and I would like to have proper font rendering on Fedora by default. I think this wish is reasonable.

Comment 10 Akira TAGOH 2015-09-08 03:26:55 UTC
the assumption of the testing code looks wrong. fontconfig doesn't explicitly set antialias so far. which means it is up to the application how they behaves against it. for instance, in Pango, they prefer antialiased font if no explicit value is set to 'antialias'. i.e. if FcPatternGet*() doesn't return FcResultMatch. as well as KDE I guess since I don't get any complaint about it.

I'm not sure why Java prefer non-antialiased font by default. why don't you change the behavior like others?

Comment 11 Mario Torre 2016-01-12 09:04:48 UTC
(In reply to Akira TAGOH from comment #10)

> I'm not sure why Java prefer non-antialiased font by default. why don't you
> change the behavior like others?

For compatibility reasons, it is also a better default for connections over SSH. I will speak with the AWT developers and see what they think about changing this default, but I will close this bug for now since, well, it's not exactly a bug.