> I discovered there was an issue when I tried using a test font I created
> with the following as one of its lookups (in ttx format):
> <Lookup index="1">
>         <LookupType value="1"/>
>         <LookupFlag value="0"/>
>         <!-- SubTableCount=1 -->
>         <SingleSubst index="0">
>           <Substitution in="j" out="i"/>
>           <Substitution in="zero" out="one"/>
>         </SingleSubst>
>       </Lookup>
> 
> There is one lookup here, but 2 substitutions.  My program needs to
> iterate through each substitution individually, but the function
> hb_ot_layout_lookup_collect_glyphs only returns 2 unordered sets
> representing all the input and output characters for this lookup.
> How can I get one substitution at a time?

Indeed, you can't use use `hb_ot_layout_lookup_collect_glyphs` for
that.  However, given that you actually want to map input character
codes to output glyph indices, what about using
`hb_ot_shape_glyphs_closure` on single input characters, iterating
over the auto-hinter 'styles'?  If you get a single output glyph,
everything's fine.  If you get more than a single output glyph this
essentially means that two or more lookups have been applied in
succession, but you only have to take care of the glyph that is part
of the 'style'.

Note that this is untested on my side – I was just searching in the
HarfBuzz API.

Behdad, if you have a better idea, please chime in :-)


    Werner

Reply via email to