diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index b689d93cb..12a103b0c 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -27,7 +27,6 @@ #include #include #include /* for SFNT_Load_Table_Func */ -#include /* for PS_Driver */ #include #include @@ -978,34 +977,22 @@ if ( ( load_flags & FT_LOAD_FORCE_AUTOHINT ) || !FT_DRIVER_HAS_HINTER( driver ) ) autohint = TRUE; - else - { - FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); - FT_Bool is_light_type1; - TT_Face ttface = (TT_Face)face; + else if ( FT_LOAD_TARGET_MODE( load_flags ) == FT_RENDER_MODE_LIGHT && + !FT_DRIVER_HINTS_LIGHTLY( driver ) ) + autohint = TRUE; - /* only the new Adobe engine (for both CFF and Type 1) is `light'; */ - /* we use `strstr' to catch both `Type 1' and `CID Type 1' */ - is_light_type1 = - ft_strstr( FT_Get_Font_Format( face ), "Type 1" ) != NULL && - ((PS_Driver)driver)->hinting_engine == FT_HINTING_ADOBE; - - /* the check for `num_locations' assures that we actually */ - /* test for instructions in a TTF and not in a CFF-based OTF */ - /* */ - /* we check the size of the `fpgm' and `prep' tables, too -- */ - /* the assumption is that there don't exist real TTFs where */ - /* both `fpgm' and `prep' tables are missing */ - if ( ( mode == FT_RENDER_MODE_LIGHT && - ( !FT_DRIVER_HINTS_LIGHTLY( driver ) && - !is_light_type1 ) ) || - ( FT_IS_SFNT( face ) && - ttface->num_locations && - ttface->font_program_size == 0 && - ttface->cvt_program_size <= 7 ) ) - autohint = TRUE; - } + /* the check for `num_locations' assures that we actually */ + /* test for instructions in a TTF and not in a CFF-based OTF */ + /* */ + /* we check the size of the `fpgm' and `prep' tables, too -- */ + /* the assumption is that there don't exist real TTFs where */ + /* both `fpgm' and `prep' tables are missing */ + else if ( FT_IS_SFNT( face ) && + ((TT_Face)face)->num_locations && + ((TT_Face)face)->font_program_size == 0 && + ((TT_Face)face)->cvt_program_size <= 7 ) + autohint = TRUE; } if ( autohint ) diff --git a/src/base/ftpsprop.c b/src/base/ftpsprop.c index 37a6cee6c..083b243cf 100644 --- a/src/base/ftpsprop.c +++ b/src/base/ftpsprop.c @@ -166,6 +166,12 @@ error = FT_ERR( Unimplemented_Feature ); } + /* set the light hinting flags accordingly */ + if ( driver->hinting_engine == FT_HINTING_ADOBE ) + module->clazz->module_flags |= FT_MODULE_DRIVER_HINTS_LIGHTLY; + else if ( driver->hinting_engine == FT_HINTING_FREETYPE ) + module->clazz->module_flags &= ~FT_MODULE_DRIVER_HINTS_LIGHTLY; + return error; } diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index f432c9e4a..0bb81e84f 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -1182,10 +1182,9 @@ FT_DEFINE_DRIVER( cff_driver_class, - FT_MODULE_FONT_DRIVER | - FT_MODULE_DRIVER_SCALABLE | - FT_MODULE_DRIVER_HAS_HINTER | - FT_MODULE_DRIVER_HINTS_LIGHTLY, + FT_MODULE_FONT_DRIVER | + FT_MODULE_DRIVER_SCALABLE | + FT_MODULE_DRIVER_HAS_HINTER, sizeof ( PS_DriverRec ), "cff", diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 78f1e1dcb..812002c18 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -1138,7 +1138,8 @@ /* set default property values, cf. `ftcffdrv.h' */ - driver->hinting_engine = FT_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; + module->clazz->module_flags |= FT_MODULE_DRIVER_HINTS_LIGHTLY; driver->no_stem_darkening = TRUE; diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 8d337c411..7f2d76cfc 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -492,7 +492,8 @@ /* set default property values, cf. `ftt1drv.h' */ - driver->hinting_engine = FT_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; + module->clazz->module_flags |= FT_MODULE_DRIVER_HINTS_LIGHTLY; driver->no_stem_darkening = TRUE; diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 4be8a5c00..c9a01fe19 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -236,6 +236,7 @@ FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, + sizeof ( PS_DriverRec ), "t1cid", /* module name */ diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index b1b27c31f..950e09015 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -604,7 +604,8 @@ /* set default property values, cf. `ftt1drv.h' */ - driver->hinting_engine = FT_HINTING_ADOBE; + driver->hinting_engine = FT_HINTING_ADOBE; + module->clazz->module_flags |= FT_MODULE_DRIVER_HINTS_LIGHTLY; driver->no_stem_darkening = TRUE;