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.
This commit is contained in:
Werner Lemberg 2013-06-03 12:41:58 +02:00
parent f9cceeb4e3
commit 2429dc3d7c
9 changed files with 141 additions and 21 deletions

View File

@ -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.

View File

@ -749,6 +749,25 @@ FT_BEGIN_HEADER
#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** 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 */
/*************************************************************************/
/*************************************************************************/
/**** ****/

View File

@ -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

View File

@ -749,6 +749,25 @@ FT_BEGIN_HEADER
#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** 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
/*************************************************************************/
/*************************************************************************/
/**** ****/

View File

@ -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).

View File

@ -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;
}

View File

@ -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,23 +489,25 @@
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 )
{
point->x = x >> 16;
point->y = y >> 16;
}
else
#endif
{
/* cf2_decoder_parse_charstrings uses 16.16 coordinates */
point->x = x >> 10;
point->y = y >> 10;
}
else
{
point->x = x >> 16;
point->y = y >> 16;
}
*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,19 +2832,26 @@
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 )
if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
error = cff_decoder_parse_charstrings( &decoder,
charstring,
charstring_len );
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 ) ||
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 ) )
{
/* XXX to be implemented */
}
}
cff_free_glyph_data( face, &charstring, charstring_len );

View File

@ -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,

View File

@ -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;