[HarfBuzz] Different results when shaping sub-sections of text

Khaled Hosny khaledhosny at eglug.org
Tue Oct 6 14:45:06 PDT 2015


On Tue, Oct 06, 2015 at 08:08:00PM +0100, Jamie Dale wrote:
> I suspect that the first shape has used some ligatures, and the second
> shape was unable to do that due to being unable to combine the glyphs (I
> have previously seen this with the "fi" ligature in English).
> 
> If both of these forms are considered acceptable, then I'm happy enough,

Shaping parts of text separately is generally a bad idea as you lose any
OpenType interaction between these parts, so you only do it when it is
absolutely necessary (e.g. due to font change). Though your second image
is still barely legible, it loses all the contextual substitutions
specified in the font and gives a very suboptimal result, but it can
make the text illegible in many other cases, for example when shaping
"لا". I expect Indic scripts to suffer more legibility-wise.

The proper way it to identify rich-text attributes that shouldn’t break
shaping (color, underline, overline, etc.) and apply them after shaping,
using cluster values to do the reverse glyph to character index mapping
(while at it, use HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS so that
you get more finer cluster mapping).

Regards,
Khaled


More information about the HarfBuzz mailing list