On Wed, 1 Feb 2023 23:06:50 GMT, Nikita Gubarkov <[email protected]> wrote:

>> Well, what I did find so far:
>> * Segoe UI Emoji does have `FE0F` UVS (colored selector), but no `FE0E` 
>> (monochrome).
>> * Segoe UI Symbol doesn't have any UVS.
>> 
>> So fonts alone will not guide us to a correct glyph.
>> However, we can ignore COLR table and render base glyphs from Segoe UI Emoji 
>> to achieve monochrome effect, so we actually can have both mono/color inside 
>> Segoe UI Emoji alone (but we would still have to determine whether to use 
>> mono or color ourselves).
>> But these base glyphs are not the same as in Segoe UI Symbol and I can 
>> clearly see that every Windows app which respect variation selectors, 
>> renders monochrome ones using Segoe UI Symbol, not base glyphs from Segoe UI 
>> Emoji.
>> 
>> I will try to investigate this further, but so far it looks to me like to 
>> support variation selectors the way native apps do, we need to use some kind 
>> of hardcoded tables, like those exclusion ranges, because:
>> 1. We don't know whether character must be draw mono/colored by default, 
>> fonts doesn't tell us, only CLDR does.
>> 2. Even if we somehow know the default variant, looking for `FE0F` selector 
>> will lead us to to Segoe UI Emoji, but `FE0E` - nowhere.
>> 
>> Ideas?
>
> So I restored the original idea.
> 1. Place Symbol into main font sequences to preceed the Emoji and be able to 
> have exclusion ranges
> 2. Exclude everything that should be colored by default
> 3. One more hack in composite mapper - ignore exclude ranges when variation 
> selector is specified
> 
> Results:
> * No selector, default mono: will be handled by Symbol
> * No selector, default color: skip Symbol because excluded, handle by Emoji
> * FE0F (color): skip Symbol because it doesn't define mapping for this 
> selector, handle by Emoji
> * FE0E (mono): skip Symbol & Emoji & remaining fonts because they don't 
> define this selector. No glyph found, so try again without selector, but 
> ignoring exclusion ranges - handle by Symbol

The best idea that came to my mind so far is to insert proxy "emoji" mapper 
into fallback sequence, which will handle default variations and stuff and then 
forward calls to real mono/color mapper. And this logic can also be reused in 
other OSes. What do you think?

-------------

PR: https://git.openjdk.org/jdk/pull/4798

Reply via email to