Hey Lorant, let me give a try to answer your questions. I'm not an expert on HarfBuzz or OpenType by any means, so YMMV.
On 10/02/2012 10:51 PM, Lóránt Pintér wrote: > * *How should I find out if a glyph returned by hb_shape() is a > ligature?* I found some static functions in hb-ot-layout-private.hh > like is_a_ligature(), but these are not C externs, so I cannot > access them from JavaScript. Is there some other way supported by > HarfBuzz, or shall I re-implement these functions in JS by > inspecting the glyph_info_t struct? > As far as I can see (in the OpenType specification) you should either check the glyph class or the ligature caret coverage table. The hb_ot_layout_get_ligature_carets() function does a check against the coverage table. It should return 0 if a glyph is not a ligature, and a value greater than zero otherwise. > * *How can I find internal x_advance positions inside a ligature?* The > GDEF table should contain information about this. Does HarfBuzz > expose it in any way? A ligature is a single glyph. There is no such thing as an "internal" advance. > * *How should I find out if a character was split into multiple > glyphs?* I guess the "cluster" field of a glyph_info_t is about > this, right? If I have a blown-up character, how can I find the > caret positions that I should use? Yup, the "cluster" value basically specifies the index of the codepoint in the shaped text the glyph belongs to. Well, more or less, as far as I understand. There's a function for determining caret positions, hb_ot_layout_get_ligature_carets(). I haven't used it yet, but it looks easy to use. Just pass the glyph index and a small array, and it will be filled with caret positions. > * *Can HarfBuzz handle the Apple "kern," "morx" etc. tables?* If not, > is it safe to use FontForge to convert these fonts to use OpenType's > GPOS/GSUB etc.? This is not very > encouraging: http://fontforge.org/gposgsub.html Both TrueType (fallback) and OpenType kerning are supported. The only caveat is that you can't disable TrueType kerning (yet), it is always enabled. > * *Which features are turned on by default?* I can see that ligatures > and kerning are turned on for my simple Latin text, and I can > successfully turn them off by supplying features "-kern" and > "-liga," but I'm still curious what the defaults are. Well, "reasonable defaults" are used that work well with most scripts and fonts. See hb-ot-shape.cc. > * *When kerning is applied, I get funny x_advances.* This might be an > error on my side, but currently when a pair of glyphs is kerned, the > first character get's an x_advance that seems to have something like > "42949017" subtracted from it. Because ligature substitution works > perfectly, I assume GSUB table parsing works fine, so I don't see > why GPOS would fail. Any pointers here? > No idea. I am using Freetype to implement the font callbacks, and advances are fine, both for TrueType and OpenType kerning. Fallback kerning calls into the font functions, I can imagine that it might break things if the callbacks aren't implemented correctly. Best regards Grigori _______________________________________________ HarfBuzz mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/harfbuzz
