[HarfBuzz] Zero-width joiner has width
Behdad Esfahbod
behdad.esfahbod at gmail.com
Sat Aug 8 08:31:51 PDT 2015
On 15-08-08 04:50 PM, Simon Cozens wrote:
> On 08/08/2015 15:25, Behdad Esfahbod wrote:
>>> Ok, that makes sense. And yes, I was ignoring the advance for glyphs and instead using Freetype to return the glyph width. I think I stole that bit of code from xetex. :-)
>>
>> Really?
>
> It may not be totally true. I don't know if XeTeX ignores the advance
> data - it probably doesn't - but I certainly stole the glyph bounds
> measurement code from XeTeXFontInst::getGlyphBounds.
Why do you need the bounds BTW?
Use hb_font_get_glyph_extents() instead, let me know if it doesn't help.
> However, when I replace SILE's glyph width measurement code with
> 'glyph_pos[j].x_advance / 64.0' instead of getting the glyph advance out
> of Freetype, I get slightly different output.
Need details.
> With Harfbuzz's x_advance, a Gentium letter "m" at 10pt measures as
> 8.03125pt wide; using the width information from Freetype, I get
> 8.0322265625pt. I can't account for the discrepancy and I don't know who
> is right.
The 'm' has advance of 1645 units in a 2048-unit font. At 10pt, that means:
>>> 1645 / 2048. * 10
8.0322265625
So we're losing something on the way. How do you setup the font scale? Show
me the code.
In general, for something like Sile, you probably want to shape text at the
upem size to have on precision loss whatsoever.
b
More information about the HarfBuzz
mailing list