3

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.

5
  • 1
    I'm a little confused... why offer a bounty on SO instead of just asking your question to the people who actually maintain harfbuzz? SO is here for you when you've exhausted your options, and posting to github.com/harfbuzz/harfbuzz/issues is definitely an option that's always available to you. Sep 17, 2019 at 1:31
  • @Mike'Pomax'Kamermans - as a new user around it is possible that I open this issue not in the right place. Though it seems like on GitHub it is more about maintaining HarfBuzz, or BUG report. I thought that here on SO, cause of the TAG 'HarfBuzz' - it is the right place for asking 'How To'. Sep 17, 2019 at 5:39
  • 2
    Remember that what you're also running into is a lack of documentation: you want to know how to do something pretty specific and technical, but apparently the harfbuzz documentation didn't mention whether this was possible: every single user of harfbuzz would probably benefit from the information that you need being added to the documentation, so even if it's not a bug, you should absolutely ask questions like these for open source projects. Their answer can be used to improve the documentation so that others don't have to ask the same question in the future. Sep 17, 2019 at 14:38
  • 2
    Followed by your advice my colleague posted an issue about that: github.com/harfbuzz/harfbuzz/issues/1977 Sep 20, 2019 at 6:59
  • nice! That should get you quite a lot of good comments and help. Sep 20, 2019 at 17:29

1 Answer 1

4
+50

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.