[HarfBuzz] Ligatures and color changes

Khaled Hosny khaledhosny at eglug.org
Tue May 21 09:56:21 PDT 2013


On Tue, Feb 19, 2013 at 05:53:04PM -0500, Behdad Esfahbod wrote:
> On 02/19/2013 05:47 PM, Khaled Hosny wrote:
> > On Tue, Feb 19, 2013 at 05:34:40PM -0500, Behdad Esfahbod wrote:
> >> As for *where* to cut the ligature, here's what you need:
> >>
> >>   * Count the number of cursor positions *inside* the ligature.  For the "fi"
> >> ligature it's one.  And we have one cursor position before the ligature, so in
> >> this case we need to cut it in two pieces,
> >>
> >>   * The common heuristic then is to cut the advance width of the ligature
> >> (well, cluster really) into two equal pieces.  If you want to be fancy, you
> >> can call hb_ot_layout_get_ligature_carets(), and if the number of carets
> >> matches what you expect (1 in this case I believe?), you can use the returned
> >> caret positions instead of equally dividing the ligature.  I haven't seen
> >> anyone implementing this though, as it gives very marginal improvements over
> >> the heuristic.
> > 
> > It can make quite some different with some Arabic ligatures, but few
> > fonts implement it because few (no?) engines support it :)
> 
> Correct.  Maybe you can give me a font... ;)

OK, here is one :)
https://github.com/khaledhosny/sahl-naskh

> Note that BTW, a similar issue exists when kerning text.  Most fonts implement
> kerning by adjusting the advance width of the first glyph.  What this means
> however is that for a pair like "Te", if the e moves way under the T,
> essentially we will get a very narrow selection width for the "T", and
> unchanged width for the "e".  That's less than ideal.
> 
> In HarfBuzz we split the kerning half-and-half for old-style TrueType kern
> pairs.  But don't do something like that for GPOS kerning since, well, with
> GPOS the font designer has full control on what to do.  Maybe we should do the
> same for GPOS kerning tables that only have adjustment for the first glyph and
> not the second?  Donno.  May be a nice improvement.  What do others think?

I think it would be a good idea, that is the majority of LTR kerning
anyway.

Regards,
Khaled



More information about the HarfBuzz mailing list