In function T2_Load_Glyph, added code so that the font transform is applied.
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
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index 8cdff6c..a934821 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -1930,6 +1930,8 @@
FT_Bool hinting;
CFF_Font* cff = (CFF_Font*)face->extra.data;
+ FT_Matrix font_matrix;
+ FT_Vector font_offset;
if ( load_flags & FT_LOAD_NO_RECURSE )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
@@ -1975,17 +1977,26 @@
T2_Done_Builder( &decoder.builder );
}
+ font_matrix = cff->top_font.font_dict.font_matrix;
+ font_offset = cff->top_font.font_dict.font_offset;
+
/* Now, set the metrics -- this is rather simple, as */
/* the left side bearing is the xMin, and the top side */
/* bearing the yMax. */
if ( !error )
{
+
/* for composite glyphs, return only left side bearing and */
/* advance width */
- if ( glyph->root.format == ft_glyph_format_composite )
+ if ( load_flags & FT_LOAD_NO_RECURSE )
{
+ FT_Slot_Internal internal = glyph->root.internal;
+
glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
glyph->root.metrics.horiAdvance = decoder.glyph_width;
+ internal->glyph_matrix = font_matrix;
+ internal->glyph_delta = font_offset;
+ internal->glyph_transformed = 1;
}
else
{
@@ -1996,6 +2007,7 @@
/* copy the _unscaled_ advance width */
metrics->horiAdvance = decoder.glyph_width;
glyph->root.linearHoriAdvance = decoder.glyph_width;
+ glyph->root.internal->glyph_transformed = 0;
/* make up vertical metrics */
metrics->vertBearingX = 0;
@@ -2012,6 +2024,13 @@
glyph->root.outline.flags |= ft_outline_reverse_fill;
+ /* apply the font matrix */
+ FT_Outline_Transform( &glyph->root.outline, &font_matrix );
+
+ FT_Outline_Translate( &glyph->root.outline,
+ font_offset.x,
+ font_offset.y );
+
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
/* scale the outline and the metrics */
@@ -2039,11 +2058,6 @@
metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale );
}
-#if 0
- /* apply the font matrix */
- FT_Outline_Transform( &glyph->root.outline, cff->font_matrix );
-#endif
-
/* compute the other metrics */
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );