[HarfBuzz] Better handling variation selectors
Behdad Esfahbod
behdad at behdad.org
Thu Jun 13 16:06:12 PDT 2013
Some progress, but there's more to do. From the commit I just pushed out:
commit 79d1007a501fd63c0ba4d51038c513e6b8b94740
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Thu Jun 13 19:01:07 2013 -0400
If variation selector is not consumed by cmap, pass it on to GSUB
This changes the semantics of get_glyph() callback and expect that
callbacks return false if the requested variant is not available, and
then we will call them back with variation_selector=0 and will retain
the glyph for the selector in the glyph stream.
Apparently most Mongolian fonts implement the Mongolian Variation
Selectors using GSUB, not cmap.
https://bugs.freedesktop.org/show_bug.cgi?id=65258
Note that this doesn't fix the Mongolian shaping yet, because the way
that's implemented is that the, say, 'init' feature ligates the letter
and the variation-selector. However, since currently the variation
selector doesn't have the 'init' mask on, it will not be matched...
I'm not quite sure how to address this. Previously we only used to match the
feature mask on the first glyph in a ligature / sequence. We changed that two
hackfests ago.
behdad
On 13-06-06 06:00 PM, Behdad Esfahbod wrote:
> On 13-04-20 05:49 AM, Jonathan Kew wrote:
>>
>> The remaining question is what to do about a VS that was part of a valid
>> sequence, but the font being used didn't handle it.
>
> So, apparently Mongolian fonts in the wild implement the Mongolian Variation
> Selectors using GSUB, not cmap. [1]
>
> So, we either need to keep the "unused" variation selectors in the glyph
> stream, or remove the Mongolian ones from the cmap processing.
>
> Fixing this the way I like would require a change to the get_glyph() callback
> API. Right now we have:
>
> typedef hb_bool_t
> (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
> hb_codepoint_t unicode,
> hb_codepoint_t variation_selector,
> hb_codepoint_t *glyph,
> void *user_data);
>
> Now ideally I would have wanted to split that in two:
>
> bool get_glyph (unicode)
>
> and
>
> bool get_glyph_variant (unicode, selector)
>
> but I'm afraid it's too late to make such a change. Instead, I propose that
> we just change the semantics of the existing call and expect that callbacks
> return false if the requested variant is not available, and then we will call
> them back with variation_selector=0 and will retain the glyph for the selector
> in the glyph stream.
>
> Makes sense?
>
>
> [1] https://bugs.freedesktop.org/show_bug.cgi?id=65258
>
--
behdad
http://behdad.org/
More information about the HarfBuzz
mailing list