[HarfBuzz] List OpenType features

Nikolay Sivov bunglehead at gmail.com
Wed Nov 18 14:42:14 PST 2015


On 19.11.2015 0:45, Edu García wrote:
> It worked, as expected :).
>
> However, I'm getting some curious results, and I'm not sure if it's
> because of my C rustiness or the fact that I'm running Harfbuzz with
> Emscripten, but just in case, I'll ask:
>
> With this simple code:
>
> unsigned int count = 80;
> hb_tag_t myResult[count];
> hb_ot_layout_table_get_feature_tags(hb_font_get_face(hb_font),
> HB_OT_TAG_GSUB, 0, &count, myResult);
>
> ...I'm getting exactly 11 copies of every tag inside the myResult array
> (so positions 0-10 contain "aalt", positions 11-21 contain "c2sc", etc).
>
> Is this expected, a bug (I'm using 1.0.6) or am I doing something
> glaringly wrong there?
>
> Thanks, and sorry for the annoying questions :)

My guess would be that it returns duplicates because features are not on 
their own in opentype, they are tied to script/language pair. So font 
can define a set of features separately for each script/language pair. I 
think FeatureCount field of FeatureList table contains total feature 
count, so if you have ligatures defined for several languages for 
example you'll get as many 'liga' features. That's probably what you 
see. Take a look at [1], specifically Table organization section.

[1] https://www.microsoft.com/typography/otspec/chapter2.htm

>
> On Thu, Nov 19, 2015 at 7:13 AM, Edu García <arcnorj at gmail.com
> <mailto:arcnorj at gmail.com>> wrote:
>
>     Thank you both, that's very helpful!
>
>     I'll give it a try later, and maybe open a PR to add doc to them
>     (the lack of docs is a bit problematic for a project this complex)
>
>     On Nov 18, 2015 11:43 PM, "Adam Twardoch (List)"
>     <list.adam at twardoch.com <mailto:list.adam at twardoch.com>> wrote:
>
>
>          > On 18 Nov 2015, at 13:40, Nikolay Sivov <bunglehead at gmail.com
>         <mailto:bunglehead at gmail.com>> wrote:
>          >
>          > On 18.11.2015 15:27, Edu García wrote:
>          >> Thank you!
>          >>
>          >> That's the one I suspected. However, as its second
>         parameter, it wants a
>          >> "hb_tag_t table_tag". What is that table tag, and how do I
>         get it?
>          >
>          > There's only two possible tags you can use in this case -
>         HB_OT_TAG_GSUB and HB_OT_TAG_GPOS.
>
>         Yes, giving HB_OT_TAG_GSUB will get you the list of substitution
>         features in the font and HB_OT_TAG_GPOS will give you the list
>         of positioning features. GSUB features are always applied before
>         GPOS features. It's possible that the same feature is defined in
>         both tables, then the GSUB portion of the feature will be
>         applied first, GPOS later.
>
>         A.
>
>



More information about the HarfBuzz mailing list