On 6 December 2016 at 05:39, Simon Cozens <[email protected]> wrote: > > 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.
So x_advance and y_advance are given in pixels, whereas x_offset and y_offset are in points? Because I didn't multiply the advance values with my DPI either, and the result looks okay. And even so, the -105 px figure sounds wrong as well: The q character is only 10 pixels wide, moving back 105 pixels would put the combining dot 95 pixels in front of the q. _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
