Add CFF_CONFIG_OPTION_OLD_ENGINE configuration option. This controls whether the old FreeType CFF engine gets compiled into FreeType. It is now disabled by default. * devel/ftoption.h, include/freetype/config/ftoption.h (CFF_CONFIG_OPTION_OLD_ENGINE): New macro. * src/cff/cffdrivr.c (cff_property_set), src/cff/cffgload.c (CFF_Operator, cff_argument_counts, cff_builder_add_point, cff_operator_seac, cff_decoder_parse_charstrings, cff_slot_load), src/cff/cffgload.h, src/cff/cffobjs.c (cff_driver_init): Use CFF_CONFIG_OPTION_OLD_ENGINE to guard the affected code. * docs/CHANGES: Updated.
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 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
diff --git a/ChangeLog b/ChangeLog
index 85e9d40..d10c8f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2013-06-03 Werner Lemberg <wl@gnu.org>
+
+ Add CFF_CONFIG_OPTION_OLD_ENGINE configuration option.
+
+ This controls whether the old FreeType CFF engine gets compiled into
+ FreeType. It is now disabled by default.
+
+ * devel/ftoption.h, include/freetype/config/ftoption.h
+ (CFF_CONFIG_OPTION_OLD_ENGINE): New macro.
+
+ * src/cff/cffdrivr.c (cff_property_set), src/cff/cffgload.c
+ (CFF_Operator, cff_argument_counts, cff_builder_add_point,
+ cff_operator_seac, cff_decoder_parse_charstrings, cff_slot_load),
+ src/cff/cffgload.h, src/cff/cffobjs.c (cff_driver_init): Use
+ CFF_CONFIG_OPTION_OLD_ENGINE to guard the affected code.
+
+ * docs/CHANGES: Updated.
+
2013-06-02 Werner Lemberg <wl@gnu.org>
Fix PNG library handling.
diff --git a/devel/ftoption.h b/devel/ftoption.h
index 0696018..ccb2321 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -752,6 +752,25 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/**** ****/
+ /**** C F F D R I V E R C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */
+ /* engine gets compiled into FreeType. If defined, it is possible to */
+ /* switch between the two engines using the `hinting-engine' property of */
+ /* the cff driver module. */
+ /* */
+/* #define CFF_CONFIG_OPTION_OLD_ENGINE */
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
/**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
diff --git a/docs/CHANGES b/docs/CHANGES
index 2636796..4b6d523 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -21,11 +21,42 @@ CHANGES BETWEEN 2.4.12 and 2.5
Note that color bitmaps are converted to grayscale if client
didn't ask for color.
+ - As announced in the previous release, the old FreeType CFF
+ engine is now disabled by default. It can be conditionally
+ compiled by defining the configuration macro
+ CFF_CONFIG_OPTION_OLD_ENGINE.
+
- As announced in the previous release, all code related to macro
FT_CONFIG_OPTION_OLD_INTERNALS has been removed, thus becoming
obsolete.
+ II. MISCELLANEOUS
+
+ - The property API (`FT_Property_Get' and `FT_Property_Set') is
+ now declared as stable.
+
+ - `ftview' has been updated to support color embedded bitmaps; it
+ can be toggled on and off with key `c'.
+
+ - It is now possible to control the version of the TrueType
+ hinting engine using the new `interpreter-version' property of
+ the `truetype' module: Versions 35 and 38 (the default) are
+ supported, which roughly corresponds to disable and enable
+ subpixel hinting support, respectively.
+
+ In both `ftview' and `ftdiff', switching between the two
+ versions can be done with key `H'. In the `ftbench' demo
+ program, command line option `-H' has been extended to activate
+ the non-default interpreter version.
+
+ - Another round of TrueType subpixel hinting fixes.
+
+ - The `apinames' tool can now create an import file for NetWare.
+
+ - 64bit compilation of the new CFF engine was buggy.
+
+
======================================================================
CHANGES BETWEEN 2.4.11 and 2.4.12
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index d2254bb..d162780 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -752,6 +752,25 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/**** ****/
+ /**** C F F D R I V E R C O N F I G U R A T I O N ****/
+ /**** ****/
+ /*************************************************************************/
+ /*************************************************************************/
+
+
+ /*************************************************************************/
+ /* */
+ /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */
+ /* engine gets compiled into FreeType. If defined, it is possible to */
+ /* switch between the two engines using the `hinting-engine' property of */
+ /* the cff driver module. */
+ /* */
+#define CFF_CONFIG_OPTION_OLD_ENGINE
+
+
+ /*************************************************************************/
+ /*************************************************************************/
+ /**** ****/
/**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
diff --git a/include/freetype/ftcffdrv.h b/include/freetype/ftcffdrv.h
index 07ae54d..ccbcbcc 100644
--- a/include/freetype/ftcffdrv.h
+++ b/include/freetype/ftcffdrv.h
@@ -61,11 +61,12 @@ FT_BEGIN_HEADER
*
* @description:
* Thanks to Adobe, which contributed a new hinting (and parsing)
- * engine, an application can select between `freetype' and `adobe'.
+ * engine, an application can select between `freetype' and `adobe' if
+ * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration
+ * macro isn't defined, `hinting-engine' does nothing.
*
- * Right now, the default engine is `freetype'. However, this will
- * change: After a certain time of intensive testing it is planned to
- * make `adobe' the default due to its superior rendering results.
+ * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is
+ * defined, and `adobe' otherwise.
*
* The following example code demonstrates how to select Adobe's hinting
* engine (omitting the error handling).
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 0bbbed0..c8ca96b 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -38,6 +38,7 @@
#include FT_SERVICE_XFREE86_NAME_H
#include FT_SERVICE_GLYPH_DICT_H
#include FT_SERVICE_PROPERTIES_H
+#include FT_CFF_DRIVER_H
/*************************************************************************/
@@ -590,7 +591,12 @@
FT_UInt* hinting_engine = (FT_UInt*)value;
- driver->hinting_engine = *hinting_engine;
+#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
+ if ( *hinting_engine != FT_CFF_HINTING_ADOBE )
+ error = FT_ERR( Unimplemented_Feature );
+ else
+#endif
+ driver->hinting_engine = *hinting_engine;
return error;
}
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 4b6f417..1904ca0 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -41,6 +41,8 @@
#define FT_COMPONENT trace_cffgload
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+
typedef enum CFF_Operator_
{
cff_op_unknown = 0,
@@ -211,6 +213,8 @@
2 /* setcurrentpoint */
};
+#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
+
/*************************************************************************/
/*************************************************************************/
@@ -485,22 +489,24 @@
if ( builder->load_points )
{
- CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
-
FT_Vector* point = outline->points + outline->n_points;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+ CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
- if ( driver->hinting_engine == FT_CFF_HINTING_ADOBE )
+
+ if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
{
- /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
- point->x = x >> 10;
- point->y = y >> 10;
+ point->x = x >> 16;
+ point->y = y >> 16;
}
else
+#endif
{
- point->x = x >> 16;
- point->y = y >> 16;
+ /* cf2_decoder_parse_charstrings uses 16.16 coordinates */
+ point->x = x >> 10;
+ point->y = y >> 10;
}
*control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
}
@@ -722,6 +728,8 @@
}
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
+
static FT_Error
cff_operator_seac( CFF_Decoder* decoder,
FT_Pos asb,
@@ -2518,6 +2526,8 @@
return FT_THROW( Stack_Overflow );
}
+#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
+
/*************************************************************************/
/*************************************************************************/
@@ -2794,7 +2804,10 @@
glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; /* by default */
{
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face );
+#endif
+
FT_Byte* charstring;
FT_ULong charstring_len;
@@ -2819,20 +2832,27 @@
if ( error )
goto Glyph_Build_Finished;
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
/* choose which CFF renderer to use */
- if ( driver->hinting_engine == FT_CFF_HINTING_ADOBE )
- error = cf2_decoder_parse_charstrings( &decoder,
+ if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
+ error = cff_decoder_parse_charstrings( &decoder,
charstring,
charstring_len );
-
- /* Adobe's engine uses 16.16 numbers everywhere; */
- /* as a consequence, glyphs larger than 2000ppem get rejected */
- if ( FT_ERR_EQ( error, Glyph_Too_Big ) ||
- driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
- error = cff_decoder_parse_charstrings( &decoder,
+ else
+#endif
+ {
+ error = cf2_decoder_parse_charstrings( &decoder,
charstring,
charstring_len );
+ /* Adobe's engine uses 16.16 numbers everywhere; */
+ /* as a consequence, glyphs larger than 2000ppem get rejected */
+ if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
+ {
+ /* XXX to be implemented */
+ }
+ }
+
cff_free_glyph_data( face, &charstring, charstring_len );
if ( error )
diff --git a/src/cff/cffgload.h b/src/cff/cffgload.h
index 11b389e..41df7db 100644
--- a/src/cff/cffgload.h
+++ b/src/cff/cffgload.h
@@ -218,10 +218,12 @@ FT_BEGIN_HEADER
#endif /* 0 */
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
FT_LOCAL( FT_Error )
cff_decoder_parse_charstrings( CFF_Decoder* decoder,
FT_Byte* charstring_base,
FT_ULong charstring_len );
+#endif
FT_LOCAL( FT_Error )
cff_slot_load( CFF_GlyphSlot glyph,
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index ebcf189..90a9a33 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -1056,7 +1056,11 @@
/* set default property values */
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
driver->hinting_engine = FT_CFF_HINTING_FREETYPE;
+#else
+ driver->hinting_engine = FT_CFF_HINTING_ADOBE;
+#endif
driver->no_stem_darkening = FALSE;
return FT_Err_Ok;