[HarfBuzz] Getting glyph information using Harfbuzz API

Deepak Jois deepak.jois at gmail.com
Wed May 24 03:45:35 UTC 2017

I am using Harfbuzz to layout text using LuaTeX[1]. As part of that, I need
to provide LuaTeX with some information about all the glyphs in the font.
Strictly speaking, this is more of a job for an Opentype parsing library
than a shaping library like Harfbuzz.

However, Khaled Hosny mentioned that I might be able to get the information
I need from Harfbuzz itself. It seems the functionality I need should be
somewhere in hb-font.h or hb-ot-layout.h I am looking at the API and it is
not immediately obvious how I can do the following things with Harfbuzz:

1. Get a list of all the glyph ids in the font

2. Get a list of character to glyph mapping, i.e. the contents of the cmap

3 I suppose if I have (1) above I can get a hb_glyph_extents_t for each
glyph. I am not sure how to convert it to a value that makes sense to
LuaTeX which requires a width, depth and height.

4. How does (3) above work for OpenType fonts with PostScript outlines
which apparently do not store the character depth and height in the file. I
know LuaTeX’s internal fontloader (based on FontForge) does some
calculations to find the bounding box for each glyph. Can Harfbuzz do that
too? Is that what this issue[2] talks about?

[1]: https://github.com/deepakjois/luatex-harfbuzz
[2]: https://github.com/behdad/harfbuzz/issues/249
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20170524/198cd263/attachment.html>

More information about the HarfBuzz mailing list