[HarfBuzz] Default hb_font_t scale

Behdad Esfahbod behdad at behdad.org
Wed Sep 30 03:29:04 PDT 2015


Since there's been no objections, I'll go ahead and make this change.

On 15-09-02 09:12 AM, Behdad Esfahbod wrote:
> Right now default scale is 0,0 when a new font is created.  Should I change
> that to upem,upem?  That sounds like a more useful default.
> 
> Specifically, this pattern is becoming more common:
> 
> parent_font = hb_font_create (face);
> hb_ot_font_set_funcs (parent_font);
> 
> font = hb_font_create_sub_font (parent_font);
> hb_font_set_funcs(font, custom_funcs...);
> 
> hb_font_set_scale(font, ...);
> 
> 
> This way custom funcs can provide only a few (say, hinted h_advance) function
> and everything else comes from parent_font.  For size-related things (like
> glyph_extents()) that do come from parent_font, they are scaled properly to
> match the scale of the new font, but that will only work if the scale of
> parent_font is NOT zero, otherwise the extents will be converted to a scale of
> zero (ie, they all become zero), then go through a division by zero!
> 
> Changing the default scale addresses that, and plus, make "shape at font
> units" the default behavior.
> 
> Objections?
> 
> Cheers,
> 

-- 
behdad
http://behdad.org/


More information about the HarfBuzz mailing list