* include/freetype/config/ftoption.h: clarify documentation regarding unpatented hinting * include/freetype/freetype.h, src/base/ftpatent.c, src/truetype/ttdriver.c, include/freetype/internal/services/svttglyf.h, modules.cfg,: include/freetype/internal/ftserv.h,: Fonts without a cmap must be handled correctly by FreeType (anything Adding the FT_Face_CheckTrueTypePatents API to FT_FREETYPE_H, it is implemented by the optional src/base/ftpatent.c
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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
diff --git a/ChangeLog b/ChangeLog
index 38d2b42..6f8aa54 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,18 @@
+2007-06-10 David Turner <david@freetype.org>
+
+ * include/freetype/config/ftoption.h: clarify documentation regarding
+ unpatented hinting
+
+ * include/freetype/freetype.h, src/base/ftpatent.c, src/truetype/ttdriver.c,
+ include/freetype/internal/services/svttglyf.h, modules.cfg,:
+ include/freetype/internal/ftserv.h,:
+ Fonts without a cmap must be handled correctly by FreeType (anything
+ Adding the FT_Face_CheckTrueTypePatents API to FT_FREETYPE_H, it is
+ implemented by the optional src/base/ftpatent.c
+
2007-06-08 Werner Lemberg <wl@gnu.org>
- * src/sfnt/sfobjs.c (sfnt_load_face): Undo change from 2007-04-28.
+ * src/sfnt/sfobjs.c (sfnt_load_face): Undo change from 2007-04-28.
Fonts without a cmap must be handled correctly by FreeType (anything
else would be a bug).
@@ -399,7 +411,7 @@
computation.
* src/autofit/afloader.c (af_loader_load_g): In the case of
- monospaced fonts, always set `rsb_delta' and `lsb_delta' to 0.
+ monospaced fonts, always set `rsb_delta' and `lsb_delta' to 0.
Otherwise code that uses them will most certainly ruin the fixed
advance property.
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 8a433b3..dc96f37 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -463,12 +463,26 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
- /* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to */
- /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented */
- /* work-around hinting system. Note that for the moment, the algorithm */
- /* is only used when selected at runtime through the parameter tag */
- /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */
- /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally activated. */
+ /* The TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you */
+ /* have defined TT_CONFIG_OPTION_BYTECODE_INTERPRETER. If not, it will */
+ /* compile a special work-around TrueType bytecode interpreter that */
+ /* doesn't implement any of the patented opcodes/algorithms. */
+ /* */
+ /* this is only useful for a small number of font files (mostly Asian) */
+ /* that require bytecode interpretation to properly load glyphs. For all */
+ /* other fonts, this will produce unpleasant results. */
+ /* */
+ /* for this reason, the unpatented interpreter is never used by to load */
+ /* glyphs from TrueType fonts, unless one of the following happens: */
+ /* */
+ /* - the unpatented interpreter is explicitely activated by the */
+ /* user through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */
+ /* when opening the FT_Face */
+ /* */
+ /* - FreeType detects that the FT_Face corresponds to one of the */
+ /* 'trick' fonts (e.g. Mingliu) it knows about. The font engine */
+ /* contains a hard-coded list of font names and other matching */
+ /* parameters. */
/* */
#define TT_CONFIG_OPTION_UNPATENTED_HINTING
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index aa99b94..e52e39f 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -3368,6 +3368,31 @@ FT_BEGIN_HEADER
FT_Int *aminor,
FT_Int *apatch );
+
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Face_CheckTrueTypePatents */
+ /* */
+ /* <Description> */
+ /* Parses the whole content of a TrueType font file and returns */
+ /* true if it uses any of the patented opcodes. this is only useful */
+ /* if you want to be able to use the unpatented hinter with */
+ /* fonts that do *not* use these opcodes. */
+ /* */
+ /* note that this function parses *all* glyph instructions in the */
+ /* font file, and may be *slow* */
+ /* */
+ /* <Input> */
+ /* face :: a face handle */
+ /* */
+ /* <Return> */
+ /* TRUE if this is a TrueType font that uses one of the patented */
+ /* opcodes. FALSE otherwise */
+ /* */
+ FT_EXPORT( FT_Bool )
+ FT_Face_CheckTrueTypePatents( FT_Face face );
+
/* */
diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h
index 2666a87..ed3e3f0 100644
--- a/include/freetype/internal/ftserv.h
+++ b/include/freetype/internal/ftserv.h
@@ -315,6 +315,7 @@ FT_BEGIN_HEADER
#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h>
+#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
/* */
diff --git a/include/freetype/internal/services/svttglyf.h b/include/freetype/internal/services/svttglyf.h
new file mode 100644
index 0000000..a91e9ee
--- /dev/null
+++ b/include/freetype/internal/services/svttglyf.h
@@ -0,0 +1,48 @@
+/***************************************************************************/
+/* */
+/* svsttglyf.h */
+/* */
+/* The FreeType TrueType glyph service. */
+/* */
+/* Copyright 2007 by David Turner. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+#ifndef __SVTTGLYF_H__
+#define __SVTTGLYF_H__
+
+#include FT_INTERNAL_SERVICE_H
+#include FT_TRUETYPE_TABLES_H
+
+
+FT_BEGIN_HEADER
+
+
+#define FT_SERVICE_ID_TT_GLYF "tt-glyf"
+
+
+ typedef FT_ULong
+ (*TT_Glyf_GetLocationFunc)( FT_Face face,
+ FT_UInt gindex,
+ FT_ULong *psize );
+
+ FT_DEFINE_SERVICE( TTGlyf )
+ {
+ TT_Glyf_GetLocationFunc get_location;
+ };
+
+ /* */
+
+
+FT_END_HEADER
+
+#endif /* __SVTTCMAP_H__ */
+
+
+/* END */
diff --git a/modules.cfg b/modules.cfg
index 747a997..2311aad 100644
--- a/modules.cfg
+++ b/modules.cfg
@@ -220,6 +220,11 @@ BASE_EXTENSIONS += ftlcdfil.c
# See include/freetype/ftgasp.h for the API.
BASE_EXTENSIONS += ftgasp.c
+# Support for FT_Face_CheckTrueTypePatents
+#
+# See include/freetype.h for the API.
+BASE_EXTENSIONS += ftpatent.c
+
####
#### The components `ftsystem.c' (for memory allocation and stream I/O
#### management) and `ftdebug.c' (for emitting debug messages to the user)
diff --git a/src/base/Jamfile b/src/base/Jamfile
index 6f92d4a..aeffe38 100644
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -34,7 +34,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ;
local _sources = system init glyph mm bdf
bbox debug xf86 type1 pfr
stroke winfnt otval bitmap synth
- gxval lcdfil gasp
+ gxval lcdfil gasp patent
;
Library $(FT2_LIB) : ft$(_sources).c ;
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index e1b3d7e..43fc1fe 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -29,9 +29,11 @@
#endif
#include FT_SERVICE_TRUETYPE_ENGINE_H
+#include FT_SERVICE_TRUETYPE_GLYF_H
#include "ttdriver.h"
#include "ttgload.h"
+#include "ttpload.h"
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include "ttgxvar.h"
@@ -313,6 +315,11 @@
#endif /* TT_USE_BYTECODE_INTERPRETER */
};
+ static const FT_Service_TTGlyfRec tt_service_truetype_glyf =
+ {
+ (TT_Glyf_GetLocationFunc) tt_face_get_location
+ };
+
static const FT_ServiceDescRec tt_services[] =
{
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE },
@@ -320,6 +327,7 @@
{ FT_SERVICE_ID_MULTI_MASTERS, &tt_service_gx_multi_masters },
#endif
{ FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine },
+ { FT_SERVICE_ID_TT_GLYF, &tt_service_truetype_glyf },
{ NULL, NULL }
};