1707 |
FT_Outline_Translate( &glyph->outline, -loader->pp1.x, 0 ); |
FT_Outline_Translate( &glyph->outline, -loader->pp1.x, 0 ); |
1708 |
|
|
1709 |
FT_Outline_Get_CBox( &glyph->outline, &bbox ); |
FT_Outline_Get_CBox( &glyph->outline, &bbox ); |
|
|
|
|
if ( IS_HINTED( loader->load_flags ) ) |
|
|
{ |
|
|
/* grid-fit the bounding box */ |
|
|
bbox.xMin = FT_PIX_FLOOR( bbox.xMin ); |
|
|
bbox.yMin = FT_PIX_FLOOR( bbox.yMin ); |
|
|
bbox.xMax = FT_PIX_CEIL( bbox.xMax ); |
|
|
bbox.yMax = FT_PIX_CEIL( bbox.yMax ); |
|
|
} |
|
1710 |
} |
} |
1711 |
else |
else |
1712 |
bbox = loader->bbox; |
bbox = loader->bbox; |
1735 |
glyph->metrics.horiBearingY = bbox.yMax; |
glyph->metrics.horiBearingY = bbox.yMax; |
1736 |
glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; |
glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; |
1737 |
|
|
|
/* don't forget to hint the advance when we need to */ |
|
|
if ( IS_HINTED( loader->load_flags ) ) |
|
|
glyph->metrics.horiAdvance = FT_PIX_ROUND( glyph->metrics.horiAdvance ); |
|
|
|
|
1738 |
/* Now take care of vertical metrics. In the case where there is */ |
/* Now take care of vertical metrics. In the case where there is */ |
1739 |
/* no vertical information within the font (relatively common), make */ |
/* no vertical information within the font (relatively common), make */ |
1740 |
/* up some metrics by `hand'... */ |
/* up some metrics by `hand'... */ |
1844 |
/* */ |
/* */ |
1845 |
left = ( bbox.xMin - bbox.xMax ) / 2; |
left = ( bbox.xMin - bbox.xMax ) / 2; |
1846 |
|
|
|
/* grid-fit them if necessary */ |
|
|
if ( IS_HINTED( loader->load_flags ) ) |
|
|
{ |
|
|
left = FT_PIX_FLOOR( left ); |
|
|
/* top should be floor'ed */ |
|
|
top = FT_PIX_FLOOR( top ); |
|
|
advance = FT_PIX_ROUND( advance ); |
|
|
} |
|
|
|
|
1847 |
glyph->metrics.vertBearingX = left; |
glyph->metrics.vertBearingX = left; |
1848 |
glyph->metrics.vertBearingY = top; |
glyph->metrics.vertBearingY = top; |
1849 |
glyph->metrics.vertAdvance = advance; |
glyph->metrics.vertAdvance = advance; |
1866 |
glyph->metrics.width = bbox.xMax - bbox.xMin; |
glyph->metrics.width = bbox.xMax - bbox.xMin; |
1867 |
glyph->metrics.height = bbox.yMax - bbox.yMin; |
glyph->metrics.height = bbox.yMax - bbox.yMin; |
1868 |
|
|
1869 |
|
if ( IS_HINTED( loader->load_flags ) ) |
1870 |
|
ft_glyphslot_grid_fit_metrics( glyph ); |
1871 |
|
|
1872 |
return 0; |
return 0; |
1873 |
} |
} |
1874 |
|
|