[HarfBuzz] List OpenType features

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


On 19.11.2015 1:49, Edu García wrote:
> Also, I realize that I can use the function you provided in your last
> email to query per language, but that doesn't change the fact that the
> first function (which should return everything AFAIK) is a bit confusing
> to use (or gives potentially incorrect results) :)

It basically follows font format I think. If you want to list it all 
properly to see whole picture, you need to:

- hb_ot_layout_table_get_script_tags() to get all scripts for this font;
- for each script index get all languages supported for this script with 
hb_ot_layout_script_get_language_tags();
- at this point it's two dimensional - (script index, language index), 
now get feature set for this pair with 
hb_ot_layout_language_get_feature_tags().

Obviously you don't need harfbuzz if you only need to list those and not 
do actual text processing, font file data structures are pretty 
straightforward.

>
> On Thu, Nov 19, 2015 at 9:47 AM, Edu García <arcnorj at gmail.com
> <mailto:arcnorj at gmail.com>> wrote:
>
>     I see, that's very interesting to know. I'll read that blogpost,
>     although it seems that using that method alone won't tell me what
>     features are aligned with what languages? Even if order is
>     guaranteed, after fiddling a bit I got 11 duplicates for all
>     features except for one of them (I got 7 for that one). But unless
>     Harfbuzz leaves holes there (I don't see them...) I don't know if
>     the first 7 languages contain that feature, or the last 7 ones,
>     etc... Hope you understand what I mean.

That's because not every feature has to be present for each 
script/language. For example for 'latn' script you can have different 
ligature set depending on actual language.

>
>     In any case, I'll read that blogpost, maybe I'm not getting the full
>     extent of what you mean :).
>
>     And no, I don't know what I'm looking for, I'm just trying to list
>     the features for every font I load (to display them to the user) but
>     I didn't know they're paired with the language, so I might need to
>     change my approach :).
>
>     Thanks again!
>
>     On Thu, Nov 19, 2015 at 9:43 AM, Nikolay Sivov <bunglehead at gmail.com
>     <mailto:bunglehead at gmail.com>> wrote:
>
>         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 :)
>
>
>         And if you know what you're looking for specifically, you case
>         use hb_ot_layout_language_get_feature_tags().
>
>
>



More information about the HarfBuzz mailing list