* 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
This commit is contained in:
David Turner 2007-06-10 20:51:04 +00:00
parent 33db39e292
commit 84c6f88117
8 changed files with 122 additions and 9 deletions

View File

@ -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> 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 Fonts without a cmap must be handled correctly by FreeType (anything
else would be a bug). else would be a bug).
@ -399,7 +411,7 @@
computation. computation.
* src/autofit/afloader.c (af_loader_load_g): In the case of * 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 Otherwise code that uses them will most certainly ruin the fixed
advance property. advance property.

View File

@ -463,12 +463,26 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to */ /* The TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you */
/* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented */ /* have defined TT_CONFIG_OPTION_BYTECODE_INTERPRETER. If not, it will */
/* work-around hinting system. Note that for the moment, the algorithm */ /* compile a special work-around TrueType bytecode interpreter that */
/* is only used when selected at runtime through the parameter tag */ /* doesn't implement any of the patented opcodes/algorithms. */
/* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */ /* */
/* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally activated. */ /* 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 #define TT_CONFIG_OPTION_UNPATENTED_HINTING

View File

@ -3368,6 +3368,31 @@ FT_BEGIN_HEADER
FT_Int *aminor, FT_Int *aminor,
FT_Int *apatch ); 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 );
/* */ /* */

View File

@ -315,6 +315,7 @@ FT_BEGIN_HEADER
#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h> #define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.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_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h>
#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
/* */ /* */

View File

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

View File

@ -220,6 +220,11 @@ BASE_EXTENSIONS += ftlcdfil.c
# See include/freetype/ftgasp.h for the API. # See include/freetype/ftgasp.h for the API.
BASE_EXTENSIONS += ftgasp.c 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 #### The components `ftsystem.c' (for memory allocation and stream I/O
#### management) and `ftdebug.c' (for emitting debug messages to the user) #### management) and `ftdebug.c' (for emitting debug messages to the user)

View File

@ -34,7 +34,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) base ;
local _sources = system init glyph mm bdf local _sources = system init glyph mm bdf
bbox debug xf86 type1 pfr bbox debug xf86 type1 pfr
stroke winfnt otval bitmap synth stroke winfnt otval bitmap synth
gxval lcdfil gasp gxval lcdfil gasp patent
; ;
Library $(FT2_LIB) : ft$(_sources).c ; Library $(FT2_LIB) : ft$(_sources).c ;

View File

@ -29,9 +29,11 @@
#endif #endif
#include FT_SERVICE_TRUETYPE_ENGINE_H #include FT_SERVICE_TRUETYPE_ENGINE_H
#include FT_SERVICE_TRUETYPE_GLYF_H
#include "ttdriver.h" #include "ttdriver.h"
#include "ttgload.h" #include "ttgload.h"
#include "ttpload.h"
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
#include "ttgxvar.h" #include "ttgxvar.h"
@ -313,6 +315,11 @@
#endif /* TT_USE_BYTECODE_INTERPRETER */ #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[] = static const FT_ServiceDescRec tt_services[] =
{ {
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE }, { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE },
@ -320,6 +327,7 @@
{ FT_SERVICE_ID_MULTI_MASTERS, &tt_service_gx_multi_masters }, { FT_SERVICE_ID_MULTI_MASTERS, &tt_service_gx_multi_masters },
#endif #endif
{ FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine }, { FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine },
{ FT_SERVICE_ID_TT_GLYF, &tt_service_truetype_glyf },
{ NULL, NULL } { NULL, NULL }
}; };