HarfBuzz - Is there a way to get max lookahead / backtrack Glyph Count of a specific font?

301 Views Asked by At

We are working on a text editing program that handles the OpenType using HarfBuzz. While user is typing we are doing a re-analysis of a text after typing, using HarfBuzz, so we will get the correct GSUB and so.

We wish to analyze the less text as we can.

We trying to find how to get information about a specific font with HarfBuzz, about the maximum length of lookahead or backtrack that are defined in the different lookups of this font in the OpenType table.

Is there a way to get 'lookaheadGlyphCount' and 'backtrackGlyphCount' using HarfBuzz.

See Microsoft Documentation on LookupType 6 and LookupType 8

EDIT :

For more further clarification see this issue on TypeDrawers - Here.

1

There are 1 best solutions below

0
On

Is there a way to get 'lookaheadGlyphCount' and 'backtrackGlyphCount' using HarfBuzz.

Not using current HarfBuzz public APIs.

HarfBuzz parses the table and uses that information but doesn't expose it for a reason. You can write your own parser using HarfBuzz private APIs but I have talked to Behdad and there is a reason to not expose it which probably is its unreliability or something.

I should add also this is very specific detail of a font, GSUB/GPOS is not the only way fonts are built, there are fonts without those and AAT morx/kerx fonts have different story so my suggestion is to seek for other caching solution.

Firefox, old layout engine of Chrome, and Minikin are using word-caching approach, https://github.com/linebender/skribo/issues/6 you maybe also can go for something similar, or, cache each paragraph separately apparently like LayoutNG of Chrome.