[cff] Set `linear{Hori,Vert}Advance' for embedded bitmaps also. * src/cff/cffgload.c (cff_slot_load): Implement it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
diff --git a/ChangeLog b/ChangeLog
index a22cc88..f7a96a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 84847fd..e3958ba 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -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 );