diff --git a/ChangeLog b/ChangeLog index 9e9c7bbc7..255181387 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-09-26 Hin-Tak Leung + + Add new FT_LOAD_COMPUTE_METRICS load flag. + + * include/freetype/freetype.h (FT_LOAD_COMPUTE_METRICS): New macro. + * src/truetype/ttgload.c (compute_glyph_metrics): Usage. + 2015-09-26 Werner Lemberg * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Add cast. diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 68aa2699d..ceb15918c 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2743,6 +2743,16 @@ FT_BEGIN_HEADER * bitmaps transparently. Those bitmaps will be in the * @FT_PIXEL_MODE_GRAY format. * + * FT_LOAD_COMPUTE_METRICS :: + * This flag sets computing glyph metrics without the use of bundled + * metrics tables (for example, the `hdmx' table in TrueType fonts). + * Well-behaving fonts have optimized bundled metrics and these should + * be used. This flag is mainly used by font validating or font + * editing applications, which need to ignore, verify, or edit those + * tables. + * + * Currently, this flag is only implemented for TrueType fonts. + * * FT_LOAD_CROP_BITMAP :: * Ignored. Deprecated. * @@ -2788,6 +2798,7 @@ FT_BEGIN_HEADER #define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) /* Bits 16..19 are used by `FT_LOAD_TARGET_' */ #define FT_LOAD_COLOR ( 1L << 20 ) +#define FT_LOAD_COMPUTE_METRICS ( 1L << 21 ) /* */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index a322d316e..a792ad44a 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1936,8 +1936,10 @@ glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; /* adjust advance width to the value contained in the hdmx table */ - if ( !face->postscript.isFixedPitch && - IS_HINTED( loader->load_flags ) ) + /* unless FT_LOAD_COMPUTE_METRICS is set */ + if ( !face->postscript.isFixedPitch && + IS_HINTED( loader->load_flags ) && + !( loader->load_flags & FT_LOAD_COMPUTE_METRICS ) ) { FT_Byte* widthp;