[HarfBuzz] How to get hb_face_t and hb_font_t without Freetype?
Ebrahim Byagowi
ebraminio at gmail.com
Fri May 24 16:59:39 UTC 2019
> OK, this brings me to another question: what should I in general pass as
the 2nd argument of hb_face_create? Suppose I'm using a TTF or OTF font
file, should I always pass zero as the 2nd argument? What is the semantics
of that argument?
0 in ttf and otf and the index you like when you have .otc, .ttc or .dfont
and you like to reference the other faces in the file.
> If you mean the 'destroy" argument of hb_blob_create, then AFAIU this is
called only to destroy user_data, and I don't have user_data,
user_data is whatever you like to pass to your destroy callback whenever is
called, possibly the very memory returned from malloc when destory function
is free
> But now you seem to say I shouldn't?
Yes, I think now I understand what you want is to pass destroy as soon you
have another reference from it.
> Still, the questions about memory management for hb_face_t and about the
semantics of the hb_memory_mode_t enum values are left unanswered.
About the former, it is just some ref counting technique, nothing weird,
the latter, it indicated how should use think about the allocated memory,
IIUC if you are not changing the blob after giving to harfbuzz just use the
common used one.
> AFAIU, you are saying that if hb_face_get_glyph_count returns zero, the
face is empty and shouldn't be used, is that right?
Yes
> Does this mean I should use the factor of 64 in my code as well? Or does
that value depend on some properties of the font?
It is some factor you are choosing, if you are using floats, just divide it
by the 64, it is not font some properties, however there is an `upem`, the
scale font is in, you can use that and that is the default setting also.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20190524/562ca268/attachment-0001.html>
More information about the HarfBuzz
mailing list