[HarfBuzz] x_offset too small for a combining character

Simon Cozens simon at simon-cozens.org
Tue Dec 6 04:39:54 UTC 2016


On 05/12/2016 13:56, Ondřej Majerech wrote:
> So the question is, what am I doing wrong in my program that makes
> HarfBuzz report such low x_offset values?

There's a couple of things here.

The first is:

>     std::cout << name_buffer << ": "
>               << "x_advance = " << (positions[i].x_advance / 64)
>               << ", y_advance = " << (positions[i].y_advance / 64)

you're using integer math here. 64.0 will give you more precise answers:

q: x_advance = 10.1562, y_advance = 0, x_offset = 0, y_offset = 0
dotbelowcomb: x_advance = 0, y_advance = 0, x_offset = -1.09375,
y_offset = -3.34375
uni0307: x_advance = 0, y_advance = 0, x_offset = -1.28125, y_offset = 0

But you're also confusing pixels and points. If you're really working at
a resolution of 96 pixels per inch, as you say here:

>   FT_Set_Char_Size(face, 12 << 6, 12 << 6, 96, 96);

Then your dotbelowcomb needs to be adjusted by -1.09375 * 96 = -105 pixels.




More information about the HarfBuzz mailing list