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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
diff --git a/ChangeLog b/ChangeLog
index 8122dbd..4d2d98d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-09-05 Werner Lemberg <wl@gnu.org>
+
+ 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 <wl@gnu.org>
* builds/unix/freetype2.m4: Add license exception so that the file
diff --git a/docs/CHANGES b/docs/CHANGES
index cfca7d9..0a9f352 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -33,6 +33,13 @@ LATEST CHANGES BETWEEN 2.2.0 and 2.1.10
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.
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index b1a357c..586e170 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -120,6 +120,7 @@ FT_BEGIN_HEADER
/* 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 @@ FT_BEGIN_HEADER
/* 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 @@ FT_BEGIN_HEADER
#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 )
/* */
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 8522c1f..19ea482 100644
--- 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;
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 3fb47bc..efeb47e 100644
--- 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;
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 9e84662..bb6752a 100644
--- 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
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index b61d50c..e73efb6 100644
--- 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;
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 519fa08..0e56590 100644
--- 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;
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index d51a91c..814ad90 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -202,13 +202,17 @@
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 */
/* get style name -- be careful, some broken fonts only */