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.
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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
diff --git a/ChangeLog b/ChangeLog
index ae13bf6..0d80490 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-01-27 Ken Sharp <ken.sharp@artifex.com>
+
+ 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 <wl@gnu.org>
Make FT_Set_Transform work if no renderer is available.
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 64515b9..9643242 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -315,7 +315,7 @@ FT_BEGIN_HEADER
/* 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
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 8f64060..d598f84 100644
--- 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 */
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 2700a41..6c81721 100644
--- 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,16 +173,27 @@
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,
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 */
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 481e5af..f23936f 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -103,16 +103,27 @@
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,
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;