RFR: 8290866: Apple Color Emoji turns gray after JavaFX version 18
Andy Goryachev
angorya at openjdk.org
Fri Feb 24 16:49:16 UTC 2023
On Thu, 23 Feb 2023 20:43:29 GMT, Phil Race <prr at openjdk.org> wrote:
> This fix properly supports colour rendering of Emoji on macOS
>
>
> On other platforms the Emoji will be rendered as ordinary greyscale glyphs - if there is font
> support for the requested code point.
>
> A simple manual test is provided which uses a Text node, Label control
> and editable TextField control.
>
> Some highlights of the code
> - To determine if it is a color emoji glyph probe the 'sbix' font table which is what is used by Apple
> - Text runs now break at an Emoji glyph
> - The Emoji is retrieved as an BGRA image - ie 4 channel including alpha
> - It was necessary to retrieve the Emoji glyph bounds via a different CoreText API since
> the bounds that were being retrieved were wrong for the Emoji image - causing clipping
> - It was necessary to retrieve the Emoji code point advance via a CoreText API since
> the HMTX metrics were very wrong - causing overlapping glyphs
> - drawString checks if it is an Emoji run and redirects to a new drawColorGlyph method
> which draws the image as a texture
> - All 3 rendering pipelines have this support and have been verified on all 3 desktop platforms
I see color emojis and no clipping of color emojis, so this is a major improvement.
I see some clipping of the emoji flag sequence characters, for example \ud83c\uddfa\ud83c\udde6 when moving from the primary retina (scale=2) to secondary external (scale=1) monitor:
retina:
<img width="483" alt="Screenshot 2023-02-24 at 08 38 51" src="https://user-images.githubusercontent.com/107069028/221237097-19fe3c8d-2a1f-41bd-a0b8-2cff63adab06.png">
secondary:

On a side note, it seems FX does not currently support rendering of flag emoji sequences such as 🇺🇦
\ud83c\uddfa\ud83c\udde6
is this something we ought to be supporting?
-------------
PR: https://git.openjdk.org/jfx/pull/1047
More information about the openjfx-dev
mailing list