Bug 1257496 - Fonts are not antialiased in java applications
Fonts are not antialiased in java applications
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: fontconfig (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Mario Torre
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-27 04:13 EDT by J. Haas
Modified: 2016-01-12 04:04 EST (History)
13 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-01-12 04:04:48 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Simple C test case (452 bytes, text/x-csrc)
2015-08-28 08:58 EDT, Mario Torre
no flags Details

  None (edit)
Description J. Haas 2015-08-27 04:13:45 EDT
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 07:00:53 EDT
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 J. Haas 2015-08-28 07:26:59 EDT
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 08:33:49 EDT
(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 08:56:57 EDT
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 08:58:12 EDT
Created attachment 1067982 [details]
Simple C test case
Comment 6 Mario Torre 2015-08-28 08:59:40 EDT
(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 J. Haas 2015-08-28 10:39:25 EDT
(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 08:00:42 EDT
(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 J. Haas 2015-09-07 14:16:00 EDT
> 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-07 23:26:55 EDT
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 04:04:48 EST
(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.

Note You need to log in before you can comment on or make changes to this bug.