[HarfBuzz] Better handling variation selectors

Behdad Esfahbod behdad at behdad.org
Thu Jun 6 15:00:21 PDT 2013

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)


  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


More information about the HarfBuzz mailing list