[HarfBuzz] Helvetica.dfont & BitStream Vera Sans Mono problems
behdad at behdad.org
Thu Jul 7 21:13:25 PDT 2011
Sorry for the late reply. Comments inline.
On 07/04/11 06:05, Sebastien Metrot wrote:
> I'm seeing strange bugs in my toolkit after converting my font layout engine
> to harfbuzz-ng shaping. While most fonts work alright, some have wrong X axis
> density as you can see on this (rather big)
> screenshot: http://meeloo.net/~meeloo/nui_harfbuzz.png
> At least two fonts have problems: Helvetica.dfont (from Mac OSX Snow Leopard),
> Meiryo.ttf (from OSX too) and the the open source Vera Sans Mono from bitstream.
> As you can see on the screenshot, all sizes of Vera Sans Mono don't show the
> same problem, as the 8pt version looks alright.
> My toolkit uses harfbuzz + freetype2 with the harfbuzz provided freetype glue
> code. The unicode callbacks are implemented via a mix of custom code (for
> script detection) and ucdata (for code point features).
A general point: please don't use the hb_ namespace for your own code. Ie,
hb_nui_get_unicode_funcs() would be better named nui_hb_get_unicode_funcs()...
Also, what's ucdata exactly? I couldn't find a definitive answer. Seems like
many projects include it. Maybe we can provide glue for it in hb itself.
Also, please don't include hb-private.h. That's not a public header. You
should allocate your hb_unicode_funcs_t at runtime and cache it.
> You can have a look at the code
> here https://github.com/meeloo/nui3/tree/utf8/src/Font . I call harfbuzz only
> in one
> function: https://github.com/meeloo/nui3/blob/utf8/src/Font/nuiFontBase.cpp#L2114
BTW, since I changed the hb_font to include a reference to the face, you are
not using hb_face anymore, so you can remove that variable.
> Before using harfbuzz I was using a very naive algorithm (that is just using
> glyph advances) but I was not having these problems (but I couldn't handle
> complex scripts either ;-) ).
> I would like to know if this is a bug on my part (most likely) or a problem in
> the shaping algorithm.
I can't tell, from a quick look at the code. My main guess is that you are
setting font size after shaping and before showing. But that's a wild guess.
> Thank you very much if you've read this far.
> Sébastien Métrot
> libnui author
More information about the HarfBuzz