On 30.11.2015 20:33, Deepak Jois wrote:
I am trying to build a Lua interface to Harfbuzz that I can hopefully
use with LuaTeX some day. I have got something working after taking
inspiration from the harfbuzz-tutorial code[2], and the Lua
bindings[3] in Simon Cozen’s SILE package. What I have works for the
basic cases, but I had a few questions about some API functions that I
wanted to clarify here.

For reference, here[1] is the code I am referring to. My questions are:

* Why are there two different ways to create font-like objects? There
is hb_face_create/hb_font_create (used in SILE) and hb_ft_font_create
(used in harfbuzz-tutorial). Any guidelienes on what one should use?

It depends on what you want, and prototypes are self explanatory - hb_face_create() uses blob, hb_ft_font_create() uses FT_Face, so it's meant to be used together with freetype library.

* Are there any helper methods to create font blobs from files?
Currently the code just slurps the file contents (in Lua) and then
passes it on as a char * to the C code.

hb_blob_create() ? I don't think there's any api that will read a file for you, so you have to read it yourself.


* I don’t fully understand the concept of font indexes. I guess it’s
something meant to disambiguate fonts in font-collections. However,
what about the case when a single file contains a single font? I am
using 0 as the font-index for those cases. Is that fine?

Exactly, it's only meaningful for collections. 0 is what should be use in other cases.


* What does the call hb_ot_font_set_funcs(hb_font) do?

...


* I suppose the way to get glyph names is to use
hb_font_get_glyph_name(…). However that does not work in my code,
although hb-shape seems to report the glyph names correctly. All I get
are empty strings. Any clues as to what I might be doing wrong.

It depends on backend, from the looks of it, names are only returned for freetype-based font objects.


*  Why does the harfbuzz-tutorial code divide the values by 64 before
printing it out or sending it to the Cairo drawing API. I am guessing
it has something to do with DPI values of output display devices but I
don’t fully understand it. Is that an arbitrary choice, or the most
commonly used value?

I don't know about this specific tutorial, but it sounds like fixed point value conversion.


Thanks
Deepak

[1]: 
https://github.com/deepakjois/luatex-harfbuzz-shaper/blob/master/luaharfbuzz.c#L19

[2]: https://github.com/behdad/harfbuzz-tutorial

[3]: https://github.com/simoncozens/sile/blob/master/src/justenoughharfbuzz.c
_______________________________________________
HarfBuzz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/harfbuzz


_______________________________________________
HarfBuzz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/harfbuzz

Reply via email to