Discussion:
Text rendering on Mojave (macOS)
Kirill Grouchnikov
2018-11-28 15:47:28 UTC
Permalink
I've sent this one a couple of days ago, and looks like it fell through the
moderation cracks since it had an image attached to it. So sending this
again...

So I spent some time today looking into font rendering on the latest macOS
10.14 (Mojave), I came across https://news.ycombinator.com/item?id=17476873
that says that it has removed the subpixel anti-aliasing setting. There's a
new one under "General" named "Use font smoothing when available".

When that setting is on (which is by default), font rendering in Swing with
the recommended awt.font.desktophints system property is too heavy. Looking
at how
https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.kt
is doing it (lines 399-420) it appears that they are setting
KEY_TEXT_ANTIALIASING to VALUE_TEXT_ANTIALIAS_OFF, and doing that in Swing
results in font rendering that is consistent with native apps.

Then I looked at how JavaFX font rendering looks like with locally built
https://github.com/gluonhq/gluon-samples/tree/master/fifty-states

No matter if that new platform setting is off or on, all the texts look
halo'd - zoom in on
Loading Image...
and see all those pink / light blue pixels around glyphs.

Am I running the demo wrong?
Laurent Bourgès
2018-11-28 16:31:15 UTC
Permalink
Hi,

It remembers me that recently (within 2 months), somebody proposed 2 patchs
to enable freetype LCDFilter for awt & javafx.

Both patches are integrated in jdk12 & jfx 12 ... probably a backport to
jdk11u & jfx11u is in progress...

Please test latest version, first.

My 2 cents,
Laurent

Le mer. 28 nov. 2018 à 16:49, Kirill Grouchnikov <
Post by Kirill Grouchnikov
I've sent this one a couple of days ago, and looks like it fell through the
moderation cracks since it had an image attached to it. So sending this
again...
So I spent some time today looking into font rendering on the latest macOS
10.14 (Mojave), I came across
https://news.ycombinator.com/item?id=17476873
that says that it has removed the subpixel anti-aliasing setting. There's a
new one under "General" named "Use font smoothing when available".
When that setting is on (which is by default), font rendering in Swing with
the recommended awt.font.desktophints system property is too heavy. Looking
at how
https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.kt
is doing it (lines 399-420) it appears that they are setting
KEY_TEXT_ANTIALIASING to VALUE_TEXT_ANTIALIAS_OFF, and doing that in Swing
results in font rendering that is consistent with native apps.
Then I looked at how JavaFX font rendering looks like with locally built
https://github.com/gluonhq/gluon-samples/tree/master/fifty-states
No matter if that new platform setting is off or on, all the texts look
halo'd - zoom in on
https://www.pushing-pixels.org/wp-content/uploads/2018/11/javafx-mojave.png
and see all those pink / light blue pixels around glyphs.
Am I running the demo wrong?
Phil Race
2018-11-28 17:02:42 UTC
Permalink
freetype is not used at all by FX on Mac and is used by JDK *only*
for dynamically loaded fonts including Type 1 fonts. All platform fonts
are rendered via the platform renderer by both toolkits.

So the freetype filter isn't relevant here.

It is possible that along with removing sub-pixel AA as a user-settable
option,
Apple stopped caring so much about filtering the sub-pixel text and removed
some setting that said how by much to reduce the fringing.

I can quite believe that Apple's position is that 1) ios doesn't support it,
2) hidpi displays are all they ship today, 3) LCD complicates caches +
pipelines
although we've all managed to make it work for many years ...

I suppose we'll have to look at matching what they are doing but as many
folks on that thread noted it is a quality loss on non-retina displays -
there's
a reason sub-pixel text was introduced and it doesn't go away until ALL
displays are hi-dpi. So if there's a way that keeps it for lo-res
displays I think
we'd want to do that even if Apple don't.

-phil.
Post by Laurent Bourgès
Hi,
It remembers me that recently (within 2 months), somebody proposed 2 patchs
to enable freetype LCDFilter for awt & javafx.
Both patches are integrated in jdk12 & jfx 12 ... probably a backport to
jdk11u & jfx11u is in progress...
Please test latest version, first.
My 2 cents,
Laurent
Le mer. 28 nov. 2018 à 16:49, Kirill Grouchnikov <
Post by Kirill Grouchnikov
I've sent this one a couple of days ago, and looks like it fell through the
moderation cracks since it had an image attached to it. So sending this
again...
So I spent some time today looking into font rendering on the latest macOS
10.14 (Mojave), I came across
https://news.ycombinator.com/item?id=17476873
that says that it has removed the subpixel anti-aliasing setting. There's a
new one under "General" named "Use font smoothing when available".
When that setting is on (which is by default), font rendering in Swing with
the recommended awt.font.desktophints system property is too heavy. Looking
at how
https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/ide/ui/UISettings.kt
is doing it (lines 399-420) it appears that they are setting
KEY_TEXT_ANTIALIASING to VALUE_TEXT_ANTIALIAS_OFF, and doing that in Swing
results in font rendering that is consistent with native apps.
Then I looked at how JavaFX font rendering looks like with locally built
https://github.com/gluonhq/gluon-samples/tree/master/fifty-states
No matter if that new platform setting is off or on, all the texts look
halo'd - zoom in on
https://www.pushing-pixels.org/wp-content/uploads/2018/11/javafx-mojave.png
and see all those pink / light blue pixels around glyphs.
Am I running the demo wrong?
John Neffenger
2018-11-28 19:16:07 UTC
Permalink
Post by Kirill Grouchnikov
No matter if that new platform setting is off or on, all the texts look
halo'd - zoom in on
https://www.pushing-pixels.org/wp-content/uploads/2018/11/javafx-mojave.png
and see all those pink / light blue pixels around glyphs.
The text in that image, when magnified, looks just like the unfiltered
sub-pixel anti-aliasing we fixed for JavaFX on Linux. See the section
called "Actual Result" here:

https://github.com/javafxports/openjdk-jfx/issues/229

There are more samples under "ClearType Methods Enabled" here:

https://github.com/jgneff/openjdk-freetype/wiki/OpenJFX-FreeType-Tests#cleartype-methods-enabled

I'll check whether I see the same thing after I upgrade my Mac to
Mojave. I'm currently still on macOS High Sierra.

John

Loading...