fixed another small bug. The metrics were not computed correctly..
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
diff --git a/src/type1z/t1gload.c b/src/type1z/t1gload.c
index 52cd514..200ed35 100644
--- a/src/type1z/t1gload.c
+++ b/src/type1z/t1gload.c
@@ -1302,23 +1302,6 @@
FT_BBox cbox;
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
- FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
-
- /* grid fit the bounding box if necessary */
- if (hinting)
- {
- cbox.xMin &= -64;
- cbox.yMin &= -64;
- cbox.xMax = ( cbox.xMax+63 ) & -64;
- cbox.yMax = ( cbox.yMax+63 ) & -64;
- }
-
- metrics->width = cbox.xMax - cbox.xMin;
- metrics->height = cbox.yMax - cbox.yMin;
-
- metrics->horiBearingX = cbox.xMin;
- metrics->horiBearingY = cbox.yMax;
-
/* copy the _unscaled_ advance width */
metrics->horiAdvance = decoder.builder.advance.x;
@@ -1330,7 +1313,7 @@
glyph->root.format = ft_glyph_format_outline;
glyph->root.outline.flags &= ft_outline_owner;
- if ( size->root.metrics.y_ppem < 24 )
+ if ( size && size->root.metrics.y_ppem < 24 )
glyph->root.outline.flags |= ft_outline_high_precision;
glyph->root.outline.flags |= ft_outline_reverse_fill;
@@ -1356,19 +1339,34 @@
vec->x = FT_MulFix( vec->x, x_scale );
vec->y = FT_MulFix( vec->y, y_scale );
}
-
+
+ FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
+
/* Then scale the metrics */
- metrics->width = FT_MulFix( metrics->width, x_scale );
- metrics->height = FT_MulFix( metrics->height, y_scale );
-
- metrics->horiBearingX = FT_MulFix( metrics->horiBearingX, x_scale );
- metrics->horiBearingY = FT_MulFix( metrics->horiBearingY, y_scale );
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale );
metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale );
metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, x_scale );
}
+
+ /* compute the other metrics */
+ FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
+
+ /* grid fit the bounding box if necessary */
+ if (hinting)
+ {
+ cbox.xMin &= -64;
+ cbox.yMin &= -64;
+ cbox.xMax = ( cbox.xMax+63 ) & -64;
+ cbox.yMax = ( cbox.yMax+63 ) & -64;
+ }
+
+ metrics->width = cbox.xMax - cbox.xMin;
+ metrics->height = cbox.yMax - cbox.yMin;
+
+ metrics->horiBearingX = cbox.xMin;
+ metrics->horiBearingY = cbox.yMax;
}
}
return error;