[HarfBuzz] Inter-glyph spacing

Martin Hosken mhosken at gmail.com
Sat Sep 13 00:22:24 PDT 2014


Dear Simon,

>        if (FT_Set_Char_Size(uds->ft_face,f->pointSize * 64.0, 0, 0, 0))
>          return 0;
> 

> 	What also confuses me is that the result is very font-specific. SIL fonts are 
> squashed. Times and Optima render perfectly: Pango and Harfbuzz equivalent. 
> Adobe Garamond Pro and Caslon Pro are horrible, with some very strange 
> inter-glyph spacing; in particular there is too much space after every letter 
> "a", and too little after an "s".

I think I have what the problem is. I'm not sure what the best solution is.

The SIL fonts have horizontal device metrics, and you are basically getting back hinted positioning, due to it thinking you are working on a 1dpi screen or somesuch. This gives you hinted positioning that looks really funny in a pdf.

The key code inside hb-ft.cc is:

  hb_font_set_scale (font,
                     (int) (((uint64_t) ft_face->size->metrics.x_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16),
                     (int) (((uint64_t) ft_face->size->metrics.y_scale * (uint64_t) ft_face->units_per_EM + (1<<15)) >> 16));

since it is the scale that is passed to graphite make_font as the ppem value. Off the top of my head, I'm not sure how you could set an appropriate metrics.x_scale to get the rendering you want at an appropriate ppem that gets scaled back to points for you.

I'm wondering if using the font scale rather than the font ppem is the right answer in the graphite integration code. Anyone got any thoughts?

Yours,
Martin


More information about the HarfBuzz mailing list