[HarfBuzz] feature "execution" order
Behdad Esfahbod
behdad at behdad.org
Mon Oct 13 17:00:24 PDT 2014
Hi Bob,
I'm copy/pasting some stuff I wrote a while back in another thread. In
general, look for add_gsub_pause in harfbuzz source code and you get to the
place you need.
By default, these features are enabled:
static hb_tag_t common_features[] = {
HB_TAG('c','c','m','p'),
HB_TAG('l','i','g','a'),
HB_TAG('l','o','c','l'),
HB_TAG('m','a','r','k'),
HB_TAG('m','k','m','k'),
HB_TAG('r','l','i','g'),
};
static hb_tag_t horizontal_features[] = {
HB_TAG('c','a','l','t'),
HB_TAG('c','l','i','g'),
HB_TAG('c','u','r','s'),
HB_TAG('k','e','r','n'),
HB_TAG('r','c','l','t'),
};
static hb_tag_t vertical_features[] = {
HB_TAG('v','e','r','t'),
};
plus ltra / ltrm for left-to-right, and rtla / rtlm for right-to-left text.
In addition to these, individual shapers can add features, and possibly
disable some. Here's what happens currently:
- Arabic shaper enables init / medi / fina / isol, fore respective forms,
plus med2 / fin2 / fin3 for Syriac only,
- Hangul shaper enables ljmo / vjmo / tjmo for respective jamos,
- Tibetan shaper enables abvs / blws / abvm / blwm,
- Indic shaper DISABLES liga, and enables these:
indic_features[] =
{
/*
* Basic features.
* These features are applied in order, one at a time, after
initial_reordering.
*/
{HB_TAG('n','u','k','t'), F_GLOBAL},
{HB_TAG('a','k','h','n'), F_GLOBAL},
{HB_TAG('r','p','h','f'), F_NONE},
{HB_TAG('r','k','r','f'), F_GLOBAL},
{HB_TAG('p','r','e','f'), F_NONE},
{HB_TAG('b','l','w','f'), F_NONE},
{HB_TAG('a','b','v','f'), F_NONE},
{HB_TAG('h','a','l','f'), F_NONE},
{HB_TAG('p','s','t','f'), F_NONE},
{HB_TAG('v','a','t','u'), F_GLOBAL},
{HB_TAG('c','j','c','t'), F_GLOBAL},
{HB_TAG('c','f','a','r'), F_NONE},
/*
* Other features.
* These features are applied all at once, after final_reordering.
* Default Bengali font in Windows for example has intermixed
* lookups for init,pres,abvs,blws features.
*/
{HB_TAG('i','n','i','t'), F_NONE},
{HB_TAG('p','r','e','s'), F_GLOBAL},
{HB_TAG('a','b','v','s'), F_GLOBAL},
{HB_TAG('b','l','w','s'), F_GLOBAL},
{HB_TAG('p','s','t','s'), F_GLOBAL},
{HB_TAG('h','a','l','n'), F_GLOBAL},
/* Positioning features, though we don't care about the types. */
{HB_TAG('d','i','s','t'), F_GLOBAL},
{HB_TAG('a','b','v','m'), F_GLOBAL},
{HB_TAG('b','l','w','m'), F_GLOBAL},
};
- Myanmar shaper DISABLES liga and enables these:
static const hb_tag_t
basic_features[] =
{
/*
* Basic features.
* These features are applied in order, one at a time, after
initial_reordering.
*/
HB_TAG('r','p','h','f'),
HB_TAG('p','r','e','f'),
HB_TAG('b','l','w','f'),
HB_TAG('p','s','t','f'),
};
static const hb_tag_t
other_features[] =
{
/*
* Other features.
* These features are applied all at once, after final_reordering.
*/
HB_TAG('p','r','e','s'),
HB_TAG('a','b','v','s'),
HB_TAG('b','l','w','s'),
HB_TAG('p','s','t','s'),
/* Positioning features, though we don't care about the types. */
HB_TAG('d','i','s','t'),
/* Pre-release version of Windows 8 Myanmar font had abvm,blwm
* features. The released Windows 8 version of the font (as well
* as the released spec) used 'mark' instead. The Windows 8
* shaper however didn't apply 'mark' but did apply 'mkmk'.
* Perhaps it applied abvm/blwm. This was fixed in a Windows 8
* update, so now it applies mark/mkmk. We are guessing that
* it still applies abvm/blwm too.
*/
HB_TAG('a','b','v','m'),
HB_TAG('b','l','w','m'),
};
- South-East Asian shaper DISABLES liga and enables these:
basic_features[] =
{
/*
* Basic features.
* These features are applied in order, one at a time, after
initial_reordering.
*/
HB_TAG('p','r','e','f'),
HB_TAG('a','b','v','f'),
HB_TAG('b','l','w','f'),
HB_TAG('p','s','t','f'),
};
static const hb_tag_t
other_features[] =
{
/*
* Other features.
* These features are applied all at once, after final_reordering.
*/
HB_TAG('p','r','e','s'),
HB_TAG('a','b','v','s'),
HB_TAG('b','l','w','s'),
HB_TAG('p','s','t','s'),
/* Positioning features, though we don't care about the types. */
HB_TAG('d','i','s','t'),
};
On 14-10-13 03:01 PM, Bob Hallissy wrote:
> I apologize in advance if this information is already available -- please just
> point me to it if so. Or, if it is straightforward to deduce this from the
> source code, I'm happy to try that -- but I took a brief look and wasn't
> successful so I'll need some coaching.
>
> As we are aware, Uniscribe makes multiple passes over the text, more-or-less
> one pass per feature. In the Arabic spec
> <http://www.microsoft.com/typography/OpenTypeDev/arabic/intro.htm>, for
> example, Microsoft says:
>> All OTL processing is divided into a set of predefined /features/(described
>> and illustrated in the Features section of this document). Each feature is
>> applied, one by one, to the appropriate glyphs in the syllable and OTLS
>> processes them. Uniscribe makes as many calls to the OTL Services as there
>> are features.
> and:
>> Regardless of the model an application chooses for supporting layout of
>> complex scripts, Uniscribe requires a fixed order for executing features
>> within a run of text to consistently obtain the proper basic form. This is
>> achieved by calling features one-by-one in the standard order listed below.
> and finally the list of features, in order: ccmp, isol, fina, medi, init,
> rlig, calt, liga, dlig, cswh, mset, curs, kern, mark, and mkmk.
>
> (This is, of course, not what the OT spec says should be done, but that is
> water under the bridge and we are stuck with Uniscribe compatibility)
>
> What I'd like to know is what is the equivalent sequence for Harfbuzz?
> Presumably Harfbuzz implements additional features (clig, locl, rtla, rtlm and
> salt come to mind) and it would be helpful to know where they fall in the
> sequence. Also, where do things like Stylistic Sets (ssxx) and Character
> Variants (cvxx) fall in this list?
>
> (And while this post is about Arabic, presumably other scripts have similar
> needs).
>
> Thanks for any help you can provide,
>
> Bob
>
>
>
>
>
> _______________________________________________
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/harfbuzz
>
--
behdad
http://behdad.org/
More information about the HarfBuzz
mailing list