diff --git a/ChangeLog b/ChangeLog index 38d2b428e..6f8aa549c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,18 @@ +2007-06-10 David Turner + + * 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 - * 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 8a433b326..dc96f37da 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 aa99b944a..e52e39f90 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3368,6 +3368,31 @@ FT_BEGIN_HEADER FT_Int *aminor, FT_Int *apatch ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_Face_CheckTrueTypePatents */ + /* */ + /* */ + /* 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* */ + /* */ + /* */ + /* face :: a face handle */ + /* */ + /* */ + /* 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 2666a8746..ed3e3f0a7 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 #define FT_SERVICE_WINFNT_H #define FT_SERVICE_XFREE86_NAME_H +#define FT_SERVICE_TRUETYPE_GLYF_H /* */ diff --git a/include/freetype/internal/services/svttglyf.h b/include/freetype/internal/services/svttglyf.h new file mode 100644 index 000000000..a91e9ee14 --- /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 747a9976c..2311aad9b 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 6f92d4a28..aeffe388e 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 e1b3d7e8f..43fc1fed8 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 } };