[HarfBuzz] What the correct way to set font size with FreeType?

Khaled Hosny khaledhosny at eglug.org
Wed Mar 6 00:52:02 PST 2013

On Wed, Mar 06, 2013 at 03:21:49AM -0500, Behdad Esfahbod wrote:
> On 13-03-02 01:50 PM, Khaled Hosny wrote:
> > Hi all,
> > 
> > So far I have been calling FT_Set_Char_Size() with point size * 46
> > before hb_ft_font_create(), but today I had a problem with Hiragino
> > Mincho Pro (and other Mac Japanese fonts) returning huge glyph advances,
> > after a bit of debugging I found that adding FT_LOAD_NO_BITMAP to
> > load_flags in hb_ft_get_glyph_h_advance() fixes the issue, but since
> > hb-view does not have a problem I think I'm doing something wrong here.
> > Any insights?
> For bitmap-only fonts, FT_Set_Char_Size() fails if the font is bitmap-only and
> the size requested does not match any of the bitmap strike sizes in the font.
>  Maybe that's the issue?  Or are you suggesting that the font is NOT bitmap-only?

It seems the issue I'm seeing is a FreeType bug with CFF fonts that have
embedded bitmaps:

If I remove the FT_LOAD_NO_HINTING flag or added FT_LOAD_NO_BITMAP I get
the correct advances. FT_LOAD_NO_BITMAP should be fine for my use case
since we don't support bitmap fonts anyway, but I'm not sure if it is OK
for the general case (FreeType doc says the flag is ignored for bitmap
only fonts, but what effect does it have on fonts with embedded


More information about the HarfBuzz mailing list