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.
This commit is contained in:
Hin-Tak Leung 2015-09-26 14:51:30 +02:00 committed by Werner Lemberg
parent d57f227121
commit 265ade8e80
3 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2015-09-26 Hin-Tak Leung <htl10@users.sourceforge.net>
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 <wl@gnu.org>
* src/base/ftobjs.c (Mac_Read_sfnt_Resource): Add cast.

View File

@ -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 )
/* */

View File

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