<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi Deepak,<br></div><div class="gmail_quote"><br>On Tue, May 23, 2017 at 8:45 PM, Deepak Jois <span dir="ltr"><<a href="mailto:deepak.jois@gmail.com" target="_blank">deepak.jois@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.<div><br></div><div>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: </div><div><br></div><div>1. Get a list of all the glyph ids in the font</div></div></blockquote><div><br></div><div>That would be 0..hb_face_get_glyph_count(face)-1<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>2. Get a list of character to glyph mapping, i.e. the contents of the cmap table.</div></div></blockquote><div><br></div><div>We don't expose this yet.  You can get the mapping from Unicode char to glyph using hb_font_get_nominal_glyph().  What's missing is a way to get set of Unicode characters.  I like to add that, just hasn't happened yet.  I'll see what I can do...<br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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.</div></div></blockquote><div><br></div><div>Right.  Simon Cozens also wanted this for Sile... Problem is, in the TeX model, the depth and height are "logical" boundaries, not glyph ink extents.  Those numbers do not exist in OpenType.  For width, you want advance width.  For depth and height, you really are on your own IMO.  Glyph extents are a bad fallback.<br><br></div><div>For really well-constructed fonts that have vertical metrics, taking vertical origin height and vertical advance probably give you better numbers, but it's hard to know when fonts are really well-constructed.<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>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?<br></div></div></blockquote><div><br></div><div>Yes, exactly.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>[1]: <a href="https://github.com/deepakjois/luatex-harfbuzz" target="_blank">https://github.com/deepakjois/<wbr>luatex-harfbuzz</a><br></div></div><div>[2]: <a href="https://github.com/behdad/harfbuzz/issues/249" target="_blank">https://github.com/<wbr>behdad/harfbuzz/issues/249</a></div></div>
<br>______________________________<wbr>_________________<br>
HarfBuzz mailing list<br>
<a href="mailto:HarfBuzz@lists.freedesktop.org">HarfBuzz@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/harfbuzz" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/harfbuzz</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">behdad<br><a href="http://behdad.org/" target="_blank">http://behdad.org/</a></div>
</div></div>