Correct hmtx LSB calculation for CFF glyphs?

Behdad Esfahbod behdad at behdad.org
Sun Aug 30 19:33:51 CEST 2015


On 15-08-26 12:54 AM, Adam Twardoch (List) wrote:
> I have a question regarding the correct calculation of the hmtx LSB (left sidebearing) entry for fonts with CFF glyphs. 
> 
> Let's assume that we have a glyph that does not have points on horizontal extrema. Let's also differentiate between the bbox (the box of extrema coordinates made out of all on- and off-curve points of a glyph) and the inkbox (the box of extrema coordinates made out of the real Bezier curves plotted by the points). 
> 
> In example A, all points have integer coordinates. So the glyph's bbox left extrema is at x=30, while the inkbox left extrema is at 31.09: 
> https://www.dropbox.com/s/5vtr5fazt0dsjxn/150826-CFF-hmtx.PNG?dl=0
> 
> In example B, points have fractional coordinates. The glyph's boox left extrema is at x=29.61 while the inkbox left extrema is still at 31.09: 
> https://www.dropbox.com/s/jv4of26s9yevw2v/150826-CFF-hmtx2.PNG?dl=0
> 
> What would be the correct value that should be written into the "hmtx" LSB field for both examples? 

For TrueType fonts, the lsb recorded in hmtx table is significant, because
changing it will move the glyph drawing.  Ie, the drawn outline is that
specified in glyf table, shifted horizontally by (lsb-minX) where lsb is from
hmtx table and minX is from glyf table.  Most font design tools don't need
this extra level of freedom and just set lsb=minX such that no shift happens.
 minX in glyf table is computed as minimum of control box, that's the most
common interpretation of the glyf table spec.

For CFF fonts, no such shift happens.  The value recorded in lsb of the hmtx
table is simply unused for all purposes, so it certainly does NOT matter what
computation or rounding method is used.

Cheers,

-- 
behdad
http://behdad.org/



More information about the mpeg-otspec mailing list