[HarfBuzz] Skipping Control for Attaching Marks using OpenType
richard.wordingham at ntlworld.com
Sat Jun 1 15:50:27 PDT 2013
I have been experimenting with some unusual mark attachments and was
surprised to come across restrictions on the skipping controls in the
look-up flags for mark to base (GPOS lookup type 4), mark to ligature
(GPOS lookup type 5) and mark to mark (GPOS lookup type 6) attachments.
The following restrictions on the flags are imposed by HarfBuzz (well,
Version 0.9.14 at least), all in file hb-ot-layout-gpos-table, with
contraventions in the lookup table simply having no effect:
Mark-to-base: All intervening marks are skipped, but no intervening
bases or ligatures. (Skipping bases would result in the lookup having
Mark-to-ligature: All intervening marks are skipped, but no intervening
bases or ligatures. (Skipping ligatures would result in the lookup
having no effect.)
Mark-to-mark: Intervening marks of all but a specific attachment type
may be ignored, but not marks in general (which would result in the
lookup having no effect) or bases and ligatures.
HarfBuzz also has the restriction on mark-to-mark positioning that the
two marks must not be associated with different components of the same
ligature. This restriction makes very good sense.
Are these standard restrictions, or are they just a feature of
The restrictions on mark-to-base and mark-to-ligature prevent a simple
rule for, say, attaching the first mark above at one point and the
second mark above at another point. I have no evidence that this is a
The ban on mark-to-mark positioning skipping base glyphs is causing me a
problem. My idea was to handle words like Northern Thai ᩁᩘᩈᩦ <RA, MAI
KANG LAI, HIGH SA, SIGN II> as follows:
1) Syllabify and reorder as <RA>, <HIGH SA, MAI KANG LAI, SIGN II> (or
better still, <RA, ghost of MAI KANG LAI>, <HIGH SA, MAI KANG LAI, SIGN
2) If the reordering rules will not generate the ghost, use a
font-dependent (for this appears to be for just one school of writing)
GSUB rule to generate the ghost, whose glyph will be blank.
3) Use a contextual position lookup to invoke a mark-to-mark lookup to
position the MAI KANG LAI on its ghost.
To achieve that with HarfBuzz, I need to replace
skippy_iter.set_lookup_props (c->lookup_props & ~LookupFlag::IgnoreFlags)
skippy_iter.set_lookup_props (c->lookup_props & ~LookupFlag::IgnoreMarks);
With this change, mark to mark positioning can then skip base glyphs if
If one chooses to treat the glyph of U+1A63 TAI THAM VOWEL SIGN AA as a
base glyph, similar problems arise when rendering <SIGN AA, MAI KANG>
in the same fashion as U+0E33 THAI CHARACTER SARA AM, but I can
envisage work-arounds for the problem.
The same-component rule for marks on a ligature might then cause
similar complications with the handling of Tai Tham <NA, TONE-2, SIGN
AA, MAI KANG> 'water', for the glyphs of TONE-2 and MAI KANG will both be marks
above on the NAA ligature. (I haven't checked whether HarfBuzz will
consider NAA a ligature if the GDEF table does not identify it as one.
It have not seen it behave as a ligature - one cannot tell whether a
mark belongs to the NA part or the AA part just by looking.)
More information about the HarfBuzz