[HarfBuzz] glyph_func expected behavior for variationSelector?

Koji Ishii kojiishi at gmail.com
Mon Jun 1 19:35:29 PDT 2015


On Fri, May 29, 2015 at 11:35 PM, Jonathan Kew <jfkthame at gmail.com> wrote:
> On 29/5/15 15:16, Koji Ishii wrote:
>>
>> Sorry if this was asked before, I'm new to this list (and to harfbuzz
>> too), please accept my apologies if so.
>>
>> When a variation selector is in the source, such as:
>>    U+0030 U+FE0E
>> glyph_func receives U+FE0E as variationSelector argument.
>>
>> What is the expected behavior for the glyph_func if it cannot find the
>> variant glyph?
>>
>>  From my observation, if glyph_func returns false, harfbuzz returns 2
>> glyphs for the above string. So I'm guessing that when the specified
>> variant does not exist, glyph_func should fallback to the base glyph
>> and returns true if the base glyph exists.
>>
>> Could someone confirm whether my understanding above is correct or not?
>
>
> As I understand it, if a variation selector is passed to the glyph_func, it
> should return true only if the <char, selector> pair is explicitly handled.
>
> Otherwise, it should return false; harfbuzz will call the glyph_func again
> for the base character alone, and then separately for the variation
> selector. This means it is possible for a font to implement variation
> selector support via an OpenType lookup (ligating pairs of <base glyph, VS
> glyph>, for example) if desired, instead of via cmap format 14.
>
> If -- as is likely, if it's not supported by the font -- the variation
> selector maps to .notdef at this stage, it will then be hidden by later
> harfbuzz code that makes default-ignorables invisible.

I see, thank you so much Jonathan. I was seeing two glyphs in my unit
tests and was wondering, but missed the point that it will be hidden
by the later stages.

/koji


More information about the HarfBuzz mailing list