[cff] Set `linear{Hori,Vert}Advance' for embedded bitmaps also.

* src/cff/cffgload.c (cff_slot_load): Implement it.
This commit is contained in:
Werner Lemberg 2013-03-08 21:23:45 +01:00
parent 2ba18ba1ce
commit 2d88254046
2 changed files with 52 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2013-03-08 Werner Lemberg <wl@gnu.org>
[cff] Set `linear{Hori,Vert}Advance' for embedded bitmaps also.
* src/cff/cffgload.c (cff_slot_load): Implement it.
2013-02-23 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Fix commit ab02d9e8.

View File

@ -2653,6 +2653,11 @@
if ( !error )
{
FT_Bool has_vertical_info;
FT_UShort advance;
FT_Short dummy;
glyph->root.outline.n_points = 0;
glyph->root.outline.n_contours = 0;
@ -2679,6 +2684,46 @@
glyph->root.bitmap_left = metrics.horiBearingX;
glyph->root.bitmap_top = metrics.horiBearingY;
}
/* compute linear advance widths */
( (SFNT_Service)face->sfnt )->get_metrics( face, 0,
glyph_index,
&dummy,
&advance );
glyph->root.linearHoriAdvance = advance;
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
has_vertical_info = FT_BOOL(
face->vertical_info &&
face->vertical.number_Of_VMetrics > 0 &&
face->vertical.long_metrics );
#else
has_vertical_info = FT_BOOL(
face->vertical_info &&
face->vertical.number_Of_VMetrics > 0 );
#endif
/* get the vertical metrics from the vtmx table if we have one */
if ( has_vertical_info )
{
( (SFNT_Service)face->sfnt )->get_metrics( face, 1,
glyph_index,
&dummy,
&advance );
glyph->root.linearVertAdvance = advance;
}
else
{
/* make up vertical ones */
if ( face->os2.version != 0xFFFFU )
glyph->root.linearVertAdvance = (FT_Pos)
( face->os2.sTypoAscender - face->os2.sTypoDescender );
else
glyph->root.linearVertAdvance = (FT_Pos)
( face->horizontal.Ascender - face->horizontal.Descender );
}
return error;
}
}
@ -2700,6 +2745,7 @@
FT_Byte fd_index = cff_fd_select_get( &cff->fd_select,
glyph_index );
if ( fd_index >= cff->num_subfonts )
fd_index = (FT_Byte)( cff->num_subfonts - 1 );