ref: 7734a1f720b185a3b0b6fe3b009202c58e0b5f18
parent: 613ea866747502f26b7cb3ffba0a77b6893eaf74
author: Werner Lemberg <[email protected]>
date: Wed Oct 5 11:18:29 EDT 2005
Add FT_FACE_FLAG_HINTER to indicate that a specific font driver has a hinting engine of its own. * include/freetype/freetype.h (FT_FACE_FLAG_HINTER): New macro. * src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c (cid_face_init), src/truetype/ttobjs.c (tt_face_init) [TT_CONFIG_OPTION_BYTECODE_INTERPRETER], src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c (T42_Face_Init) [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Update face flags. * docs/CHANGES: Document it.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-09-05 Werner Lemberg <[email protected]>
+
+ Add FT_FACE_FLAG_HINTER to indicate that a specific font driver has
+ a hinting engine of its own.
+
+ * include/freetype/freetype.h (FT_FACE_FLAG_HINTER): New macro.
+
+ * src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c
+ (cid_face_init), src/truetype/ttobjs.c (tt_face_init)
+ [TT_CONFIG_OPTION_BYTECODE_INTERPRETER], src/type1/t1objs.c
+ (T1_Face_Init), src/type42/t42objs.c (T42_Face_Init)
+ [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Update face flags.
+
+ * docs/CHANGES: Document it.
+
2005-09-27 Werner Lemberg <[email protected]>
* builds/unix/freetype2.m4: Add license exception so that the file
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -33,6 +33,13 @@
III. MISCELLANEOUS
+ - A new face flag `FT_FACE_FLAG_HINTER' has been added which is
+ set if the font's driver has a hinting engine of its own. This
+ makes it possible to check at run-time whether the TrueType
+ bytecode interpreter has been activated. An example use is to
+ enable the interpretation of the `gasp' table only if native
+ TrueType hinting is available.
+
- The demo programs `ftview' and `ftstring' have been rewritten
for better readability.
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -120,6 +120,7 @@
/* FT_FACE_FLAG_GLYPH_NAMES */
/* FT_FACE_FLAG_EXTERNAL_STREAM */
/* FT_FACE_FLAG_FAST_GLYPHS */
+ /* FT_FACE_FLAG_HINTER */
/* */
/* FT_STYLE_FLAG_BOLD */
/* FT_STYLE_FLAG_ITALIC */
@@ -1061,6 +1062,12 @@
/* provided by the client application and should not be destroyed */
/* when @FT_Done_Face is called. Don't read or test this flag. */
/* */
+ /* FT_FACE_FLAG_HINTER :: */
+ /* Set if the font driver has a hinting machine of its own. For */
+ /* example, with TrueType fonts, it makes sense to use data from */
+ /* the SFNT `gasp' table only if the native TrueType hinting engine */
+ /* (with the bytecode interpreter) is available and active. */
+ /* */
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
#define FT_FACE_FLAG_FIXED_WIDTH ( 1L << 2 )
@@ -1072,6 +1079,7 @@
#define FT_FACE_FLAG_MULTIPLE_MASTERS ( 1L << 8 )
#define FT_FACE_FLAG_GLYPH_NAMES ( 1L << 9 )
#define FT_FACE_FLAG_EXTERNAL_STREAM ( 1L << 10 )
+#define FT_FACE_FLAG_HINTER ( 1L << 11 )
/* */
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -636,8 +636,9 @@
/* */
/* Compute face flags. */
/* */
- flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
- FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
+ flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
+ FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
+ FT_FACE_FLAG_HINTER; /* has native hinter */
if ( sfnt_format )
flags |= FT_FACE_FLAG_SFNT;
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -362,9 +362,9 @@
cidface->num_charmaps = 0;
cidface->face_index = face_index;
- cidface->face_flags = FT_FACE_FLAG_SCALABLE;
-
- cidface->face_flags |= FT_FACE_FLAG_HORIZONTAL;
+ cidface->face_flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
+ FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
+ FT_FACE_FLAG_HINTER; /* has native hinter */
if ( info->is_fixed_pitch )
cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -536,9 +536,11 @@
/* Compute face flags. */
/* */
if ( has_outline == TRUE )
- flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */
+ flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */
- flags |= FT_FACE_FLAG_SFNT | /* SFNT file format */
+ /* The sfnt driver only supports bitmap fonts natively, thus we */
+ /* don't set FT_FACE_FLAG_HINTER. */
+ flags |= FT_FACE_FLAG_SFNT | /* SFNT file format */
FT_FACE_FLAG_HORIZONTAL; /* horizontal data */
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -203,7 +203,11 @@
goto Bad_Format;
}
- /* If we are performing a simple font format check, exit immediately */
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+ face->root.face_flags |= FT_FACE_FLAG_HINTER;
+#endif
+
+ /* If we are performing a simple font format check, exit immediately. */
if ( face_index < 0 )
return TT_Err_Ok;
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 objects manager (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004 by */
+/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -329,9 +329,10 @@
root->num_glyphs = type1->num_glyphs;
root->face_index = face_index;
- root->face_flags = FT_FACE_FLAG_SCALABLE;
- root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
- root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
+ root->face_flags = FT_FACE_FLAG_SCALABLE |
+ FT_FACE_FLAG_HORIZONTAL |
+ FT_FACE_FLAG_GLYPH_NAMES |
+ FT_FACE_FLAG_HINTER;
if ( info->is_fixed_pitch )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -202,12 +202,16 @@
root->num_charmaps = 0;
root->face_index = face_index;
- root->face_flags = FT_FACE_FLAG_SCALABLE;
- root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
- root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
+ root->face_flags = FT_FACE_FLAG_SCALABLE |
+ FT_FACE_FLAG_HORIZONTAL |
+ FT_FACE_FLAG_GLYPH_NAMES;
if ( info->is_fixed_pitch )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
+
+#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+ root->face_flags |= FT_FACE_FLAG_HINTER;
+#endif
/* XXX: TODO -- add kerning with .afm support */