ref: f19e46f3bae4a8b652d39298cc9f42c9f27bdbeb
parent: f0760ca6e8196399d21147117cf407bf467b080e
author: Ken Sharp <[email protected]>
date: Wed Jan 27 05:04:50 EST 2010
Fix Savannah bug #28678. * src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c (cid_load_glyph): Handle vertical metrics correctly. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Handle vertical metrics correctly. (T1_Load_Glyph): Don't synthesize vertical metrics.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-01-27 Ken Sharp <[email protected]>
+
+ Fix Savannah bug #28678.
+
+ * src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c
+ (cid_load_glyph): Handle vertical metrics correctly.
+
+ * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Handle
+ vertical metrics correctly.
+ (T1_Load_Glyph): Don't synthesize vertical metrics.
+
2010-01-14 Werner Lemberg <[email protected]>
Make FT_Set_Transform work if no renderer is available.
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -315,7 +315,7 @@
/* contain no glyph data, but supply it via a callback function. */
/* This is required by clients supporting document formats which */
/* supply font data incrementally as the document is parsed, such */
- /* as the Ghostscript interpreter for the PostScript language. */
+ /* as the Ghostscript interpreter for the PostScript language. */
/* */
#define FT_CONFIG_OPTION_INCREMENTAL
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -4,7 +4,8 @@
/* */
/* OpenType Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
+/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -694,7 +695,7 @@
data.length = length;
face->root.internal->incremental_interface->funcs->free_glyph_data(
- face->root.internal->incremental_interface->object,&data );
+ face->root.internal->incremental_interface->object, &data );
}
else
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -2771,15 +2772,29 @@
metrics.bearing_x = decoder.builder.left_bearing.x;
- metrics.bearing_y = decoder.builder.left_bearing.y;
+ metrics.bearing_y = 0;
metrics.advance = decoder.builder.advance.x;
+
error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics );
+
decoder.builder.left_bearing.x = metrics.bearing_x;
- decoder.builder.left_bearing.y = metrics.bearing_y;
decoder.builder.advance.x = metrics.advance;
- decoder.builder.advance.y = 0;
+
+ if ( !error )
+ {
+ metrics.bearing_x = 0;
+ metrics.bearing_y = decoder.builder.left_bearing.y;
+ metrics.advance = decoder.builder.advance.y;
+
+ error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
+ face->root.internal->incremental_interface->object,
+ glyph_index, TRUE, &metrics );
+
+ decoder.builder.left_bearing.y = metrics.bearing_y;
+ decoder.builder.advance.y = metrics.advance;
+ }
}
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -4,7 +4,7 @@
/* */
/* CID-keyed Type1 Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -173,7 +173,7 @@
metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
- metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
+ metrics.bearing_y = 0;
metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
error = inc->funcs->get_glyph_metrics( inc->object,
@@ -180,9 +180,20 @@
glyph_index, FALSE, &metrics );
decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
- decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
- decoder->builder.advance.y = 0;
+
+ if ( !error )
+ {
+ metrics.bearing_x = 0;
+ metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
+ metrics.advance = FIXED_TO_INT( decoder->builder.advance.y );
+
+ error = inc->funcs->get_glyph_metrics( inc->object,
+ glyph_index, TRUE, &metrics );
+
+ decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
+ decoder->builder.advance.y = INT_TO_FIXED( metrics.advance );
+ }
}
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -103,7 +103,7 @@
metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
- metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
+ metrics.bearing_y = 0;
metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
error = inc->funcs->get_glyph_metrics( inc->object,
@@ -110,9 +110,20 @@
glyph_index, FALSE, &metrics );
decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
- decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
- decoder->builder.advance.y = 0;
+
+ if ( !error )
+ {
+ metrics.bearing_x = 0;
+ metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y );
+ metrics.advance = FIXED_TO_INT( decoder->builder.advance.y );
+
+ error = inc->funcs->get_glyph_metrics( inc->object,
+ glyph_index, TRUE, &metrics );
+
+ decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y );
+ decoder->builder.advance.y = INT_TO_FIXED( metrics.advance );
+ }
}
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
@@ -401,10 +412,17 @@
FIXED_TO_INT( decoder.builder.advance.x );
glyph->root.internal->glyph_transformed = 0;
+#if 0
/* make up vertical ones */
metrics->vertAdvance = ( face->type1.font_bbox.yMax -
face->type1.font_bbox.yMin ) >> 16;
glyph->root.linearVertAdvance = metrics->vertAdvance;
+#else
+ metrics->vertAdvance =
+ FIXED_TO_INT( decoder.builder.advance.y );
+ glyph->root.linearVertAdvance =
+ FIXED_TO_INT( decoder.builder.advance.y );
+#endif
glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;