From a0bbc06404bbfc90621db9c2e7904d39779d569f Mon Sep 17 00:00:00 2001 From: David Turner Date: Tue, 7 Apr 2009 00:30:45 +0200 Subject: Formatting + small cleanup of recent PIC changes. Replace FT_PIC_Container => FT_PicTableRec, introduce FT_PicTable as pointer to FT_PicTableRec, etc... --- ChangeLog | 31 ++ include/freetype/config/ftoption.h | 708 ------------------------------------- include/freetype/internal/ftobjs.h | 4 +- include/freetype/internal/ftpic.h | 44 ++- src/autofit/afpic.c | 29 +- src/autofit/afpic.h | 2 +- src/base/basepic.c | 25 +- src/base/basepic.h | 2 +- src/base/ftinit.c | 14 +- src/base/ftobjs.c | 6 +- src/base/ftpic.c | 10 +- src/cff/cffpic.c | 51 ++- src/cff/cffpic.h | 2 +- src/pshinter/pshpic.c | 28 +- src/pshinter/pshpic.h | 2 +- src/psnames/pspic.c | 41 ++- src/psnames/pspic.h | 2 +- src/raster/rastpic.c | 33 +- src/raster/rastpic.h | 2 +- src/sfnt/sfntpic.c | 45 ++- src/sfnt/sfntpic.h | 2 +- src/smooth/ftspic.c | 32 +- src/smooth/ftspic.h | 2 +- src/truetype/ttpic.c | 33 +- src/truetype/ttpic.h | 2 +- 25 files changed, 270 insertions(+), 882 deletions(-) delete mode 100644 include/freetype/config/ftoption.h diff --git a/ChangeLog b/ChangeLog index 6480246d8..b1013a199 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2009-04-07 David Turner + + Formatting + small cleanup of PIC changes + + * include/freetype/config/ftoption.h + * include/freetype/internal/ftobjs.h + * include/freetype/internal/ftpic.h + * src/autofit/afpic.c + * src/autofit/afpic.h + * src/base/basepic.c + * src/base/basepic.h + * src/base/ftinit.c + * src/base/ftobjs.c + * src/base/ftpic.c + * src/cff/cffpic.c + * src/cff/cffpic.h + * src/pshinter/pshpic.c + * src/pshinter/pshpic.h + * src/psnames/pspic.c + * src/psnames/pspic.h + * src/raster/rastpic.c + * src/raster/rastpic.h + * src/sfnt/sfntpic.c + * src/sfnt/sfntpic.h + * src/smooth/ftspic.c + * src/smooth/ftspic.h + * src/truetype/ttpic.c + * src/truetype/ttpic.h + + + 2009-04-05 Oran Agra Add #error to modules and files that do not support PIC yet. diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h deleted file mode 100644 index 759b3a3b3..000000000 --- a/include/freetype/config/ftoption.h +++ /dev/null @@ -1,708 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftoption.h */ -/* */ -/* User-selectable configuration macros (specification only). */ -/* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* 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 __FTOPTION_H__ -#define __FTOPTION_H__ - - -#include - - -FT_BEGIN_HEADER - - /*************************************************************************/ - /* */ - /* USER-SELECTABLE CONFIGURATION MACROS */ - /* */ - /* This file contains the default configuration macro definitions for */ - /* a standard build of the FreeType library. There are three ways to */ - /* use this file to build project-specific versions of the library: */ - /* */ - /* - You can modify this file by hand, but this is not recommended in */ - /* cases where you would like to build several versions of the */ - /* library from a single source directory. */ - /* */ - /* - You can put a copy of this file in your build directory, more */ - /* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */ - /* is the name of a directory that is included _before_ the FreeType */ - /* include path during compilation. */ - /* */ - /* The default FreeType Makefiles and Jamfiles use the build */ - /* directory `builds/' by default, but you can easily change */ - /* that for your own projects. */ - /* */ - /* - Copy the file to `$BUILD/ft2build.h' and modify it */ - /* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */ - /* locate this file during the build. For example, */ - /* */ - /* #define FT_CONFIG_OPTIONS_H */ - /* #include */ - /* */ - /* will use `$BUILD/myftoptions.h' instead of this file for macro */ - /* definitions. */ - /* */ - /* Note also that you can similarly pre-define the macro */ - /* FT_CONFIG_MODULES_H used to locate the file listing of the modules */ - /* that are statically linked to the library at compile time. By */ - /* default, this file is . */ - /* */ - /* We highly recommend using the third method whenever possible. */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Uncomment the line below if you want to activate sub-pixel rendering */ - /* (a.k.a. LCD rendering, or ClearType) in this build of the library. */ - /* */ - /* Note that this feature is covered by several Microsoft patents */ - /* and should not be activated in any default build of the library. */ - /* */ - /* This macro has no impact on the FreeType API, only on its */ - /* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */ - /* FT_Render_Glyph still generates a bitmap that is 3 times larger than */ - /* the original size; the difference will be that each triplet of */ - /* subpixels has R=G=B. */ - /* */ - /* This is done to allow FreeType clients to run unmodified, forcing */ - /* them to display normal gray-level anti-aliased glyphs. */ - /* */ -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - - - /*************************************************************************/ - /* */ - /* Many compilers provide a non-ANSI 64-bit data type that can be used */ - /* by FreeType to speed up some computations. However, this will create */ - /* some problems when compiling the library in strict ANSI mode. */ - /* */ - /* For this reason, the use of 64-bit integers is normally disabled when */ - /* the __STDC__ macro is defined. You can however disable this by */ - /* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */ - /* */ - /* For most compilers, this will only create compilation warnings when */ - /* building the library. */ - /* */ - /* ObNote: The compiler-specific 64-bit integers are detected in the */ - /* file `ftconfig.h' either statically or through the */ - /* `configure' script on supported platforms. */ - /* */ -#undef FT_CONFIG_OPTION_FORCE_INT64 - - - /*************************************************************************/ - /* */ - /* If this macro is defined, do not try to use an assembler version of */ - /* performance-critical functions (e.g. FT_MulFix). You should only do */ - /* that to verify that the assembler function works properly, or to */ - /* execute benchmark tests of the various implementations. */ -/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */ - - - /*************************************************************************/ - /* */ - /* If this macro is defined, try to use an inlined assembler version of */ - /* the `FT_MulFix' function, which is a `hotspot' when loading and */ - /* hinting glyphs, and which should be executed as fast as possible. */ - /* */ - /* Note that if your compiler or CPU is not supported, this will default */ - /* to the standard and portable implementation found in `ftcalc.c'. */ - /* */ -#define FT_CONFIG_OPTION_INLINE_MULFIX - - - /*************************************************************************/ - /* */ - /* LZW-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `compress' program. This is mostly used to parse many of the PCF */ - /* files that come with various X11 distributions. The implementation */ - /* uses NetBSD's `zopen' to partially uncompress the file on the fly */ - /* (see src/lzw/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. */ - /* */ -#define FT_CONFIG_OPTION_USE_LZW - - - /*************************************************************************/ - /* */ - /* Gzip-compressed file support. */ - /* */ - /* FreeType now handles font files that have been compressed with the */ - /* `gzip' program. This is mostly used to parse many of the PCF files */ - /* that come with XFree86. The implementation uses `zlib' to */ - /* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */ - /* */ - /* Define this macro if you want to enable this `feature'. See also */ - /* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */ - /* */ -#define FT_CONFIG_OPTION_USE_ZLIB - - - /*************************************************************************/ - /* */ - /* ZLib library selection */ - /* */ - /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ - /* It allows FreeType's `ftgzip' component to link to the system's */ - /* installation of the ZLib library. This is useful on systems like */ - /* Unix or VMS where it generally is already available. */ - /* */ - /* If you let it undefined, the component will use its own copy */ - /* of the zlib sources instead. These have been modified to be */ - /* included directly within the component and *not* export external */ - /* function names. This allows you to link any program with FreeType */ - /* _and_ ZLib without linking conflicts. */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ - - - /*************************************************************************/ - /* */ - /* DLL export compilation */ - /* */ - /* When compiling FreeType as a DLL, some systems/compilers need a */ - /* special keyword in front OR after the return type of function */ - /* declarations. */ - /* */ - /* Two macros are used within the FreeType source code to define */ - /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */ - /* */ - /* FT_EXPORT( return_type ) */ - /* */ - /* is used in a function declaration, as in */ - /* */ - /* FT_EXPORT( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ); */ - /* */ - /* */ - /* FT_EXPORT_DEF( return_type ) */ - /* */ - /* is used in a function definition, as in */ - /* */ - /* FT_EXPORT_DEF( FT_Error ) */ - /* FT_Init_FreeType( FT_Library* alibrary ) */ - /* { */ - /* ... some code ... */ - /* return FT_Err_Ok; */ - /* } */ - /* */ - /* You can provide your own implementation of FT_EXPORT and */ - /* FT_EXPORT_DEF here if you want. If you leave them undefined, they */ - /* will be later automatically defined as `extern return_type' to */ - /* allow normal compilation. */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_EXPORT(x) extern x */ -/* #define FT_EXPORT_DEF(x) x */ - - - /*************************************************************************/ - /* */ - /* Glyph Postscript Names handling */ - /* */ - /* By default, FreeType 2 is compiled with the `psnames' module. This */ - /* module is in charge of converting a glyph name string into a */ - /* Unicode value, or return a Macintosh standard glyph name for the */ - /* use with the TrueType `post' table. */ - /* */ - /* Undefine this macro if you do not want `psnames' compiled in your */ - /* build of FreeType. This has the following effects: */ - /* */ - /* - The TrueType driver will provide its own set of glyph names, */ - /* if you build it to support postscript names in the TrueType */ - /* `post' table. */ - /* */ - /* - The Type 1 driver will not be able to synthesize a Unicode */ - /* charmap out of the glyphs found in the fonts. */ - /* */ - /* You would normally undefine this configuration macro when building */ - /* a version of FreeType that doesn't contain a Type 1 or CFF driver. */ - /* */ -#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES - - - /*************************************************************************/ - /* */ - /* Postscript Names to Unicode Values support */ - /* */ - /* By default, FreeType 2 is built with the `PSNames' module compiled */ - /* in. Among other things, the module is used to convert a glyph name */ - /* into a Unicode value. This is especially useful in order to */ - /* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */ - /* through a big table named the `Adobe Glyph List' (AGL). */ - /* */ - /* Undefine this macro if you do not want the Adobe Glyph List */ - /* compiled in your `PSNames' module. The Type 1 driver will not be */ - /* able to synthesize a Unicode charmap out of the glyphs found in the */ - /* fonts. */ - /* */ -#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - - - /*************************************************************************/ - /* */ - /* Support for Mac fonts */ - /* */ - /* Define this macro if you want support for outline fonts in Mac */ - /* format (mac dfont, mac resource, macbinary containing a mac */ - /* resource) on non-Mac platforms. */ - /* */ - /* Note that the `FOND' resource isn't checked. */ - /* */ -#define FT_CONFIG_OPTION_MAC_FONTS - - - /*************************************************************************/ - /* */ - /* Guessing methods to access embedded resource forks */ - /* */ - /* Enable extra Mac fonts support on non-Mac platforms (e.g. */ - /* GNU/Linux). */ - /* */ - /* Resource forks which include fonts data are stored sometimes in */ - /* locations which users or developers don't expected. In some cases, */ - /* resource forks start with some offset from the head of a file. In */ - /* other cases, the actual resource fork is stored in file different */ - /* from what the user specifies. If this option is activated, */ - /* FreeType tries to guess whether such offsets or different file */ - /* names must be used. */ - /* */ - /* Note that normal, direct access of resource forks is controlled via */ - /* the FT_CONFIG_OPTION_MAC_FONTS option. */ - /* */ -#ifdef FT_CONFIG_OPTION_MAC_FONTS -#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#endif - - - /*************************************************************************/ - /* */ - /* Allow the use of FT_Incremental_Interface to load typefaces that */ - /* contain no glyph data, but supply it via a callback function. */ - /* This allows FreeType to be used with the PostScript language, using */ - /* the GhostScript interpreter. */ - /* */ -/* #define FT_CONFIG_OPTION_INCREMENTAL */ - - - /*************************************************************************/ - /* */ - /* The size in bytes of the render pool used by the scan-line converter */ - /* to do all of its work. */ - /* */ - /* This must be greater than 4KByte if you use FreeType to rasterize */ - /* glyphs; otherwise, you may set it to zero to avoid unnecessary */ - /* allocation of the render pool. */ - /* */ -#define FT_RENDER_POOL_SIZE 16384L - - - /*************************************************************************/ - /* */ - /* FT_MAX_MODULES */ - /* */ - /* The maximum number of modules that can be registered in a single */ - /* FreeType library object. 32 is the default. */ - /* */ -#define FT_MAX_MODULES 32 - - - /*************************************************************************/ - /* */ - /* Debug level */ - /* */ - /* FreeType can be compiled in debug or trace mode. In debug mode, */ - /* errors are reported through the `ftdebug' component. In trace */ - /* mode, additional messages are sent to the standard output during */ - /* execution. */ - /* */ - /* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */ - /* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */ - /* */ - /* Don't define any of these macros to compile in `release' mode! */ - /* */ - /* Do not #undef these macros here since the build system might define */ - /* them for certain configurations only. */ - /* */ -/* #define FT_DEBUG_LEVEL_ERROR */ -/* #define FT_DEBUG_LEVEL_TRACE */ - - - /*************************************************************************/ - /* */ - /* Memory Debugging */ - /* */ - /* FreeType now comes with an integrated memory debugger that is */ - /* capable of detecting simple errors like memory leaks or double */ - /* deletes. To compile it within your build of the library, you */ - /* should define FT_DEBUG_MEMORY here. */ - /* */ - /* Note that the memory debugger is only activated at runtime when */ - /* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */ - /* */ - /* Do not #undef this macro here since the build system might define */ - /* it for certain configurations only. */ - /* */ -/* #define FT_DEBUG_MEMORY */ - - - /*************************************************************************/ - /* */ - /* Module errors */ - /* */ - /* If this macro is set (which is _not_ the default), the higher byte */ - /* of an error code gives the module in which the error has occurred, */ - /* while the lower byte is the real error code. */ - /* */ - /* Setting this macro makes sense for debugging purposes only, since */ - /* it would break source compatibility of certain programs that use */ - /* FreeType 2. */ - /* */ - /* More details can be found in the files ftmoderr.h and fterrors.h. */ - /* */ -#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS - - - /*************************************************************************/ - /* */ - /* Position Independent Code */ - /* */ - /* If this macro is set (which is _not_ the default), FreeType2 will */ - /* avoid creating constants that require address fixups. Instead the */ - /* constants will be moved into a struct and additional intialization */ - /* code will be used. */ - /* */ - /* Setting this macro is needed for systems that prohibit address */ - /* fixups, such as BREW. */ - /* */ -/* #define FT_CONFIG_OPTION_PIC */ - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** S F N T D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */ - /* embedded bitmaps in all formats using the SFNT module (namely */ - /* TrueType & OpenType). */ - /* */ -#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */ - /* load and enumerate the glyph Postscript names in a TrueType or */ - /* OpenType file. */ - /* */ - /* Note that when you do not compile the `PSNames' module by undefining */ - /* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */ - /* contain additional code used to read the PS Names table from a font. */ - /* */ - /* (By default, the module uses `PSNames' to extract glyph names.) */ - /* */ -#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */ - /* access the internal name table in a SFNT-based format like TrueType */ - /* or OpenType. The name table contains various strings used to */ - /* describe the font, like family name, copyright, version, etc. It */ - /* does not contain any glyph name though. */ - /* */ - /* Accessing SFNT names is done through the functions declared in */ - /* `freetype/ftsnames.h'. */ - /* */ -#define TT_CONFIG_OPTION_SFNT_NAMES - - - /*************************************************************************/ - /* */ - /* TrueType CMap support */ - /* */ - /* Here you can fine-tune which TrueType CMap table format shall be */ - /* supported. */ -#define TT_CONFIG_CMAP_FORMAT_0 -#define TT_CONFIG_CMAP_FORMAT_2 -#define TT_CONFIG_CMAP_FORMAT_4 -#define TT_CONFIG_CMAP_FORMAT_6 -#define TT_CONFIG_CMAP_FORMAT_8 -#define TT_CONFIG_CMAP_FORMAT_10 -#define TT_CONFIG_CMAP_FORMAT_12 -#define TT_CONFIG_CMAP_FORMAT_13 -#define TT_CONFIG_CMAP_FORMAT_14 - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */ - /* a bytecode interpreter in the TrueType driver. Note that there are */ - /* important patent issues related to the use of the interpreter. */ - /* */ - /* By undefining this, you will only compile the code necessary to load */ - /* TrueType glyphs without hinting. */ - /* */ - /* Do not #undef this macro here, since the build system might */ - /* define it for certain configurations only. */ - /* */ -/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ - - - /*************************************************************************/ - /* */ - /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ - /* of the TrueType bytecode interpreter is used that doesn't implement */ - /* any of the patented opcodes and algorithms. Note that the */ - /* TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you define */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, either define */ - /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */ - /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */ - /* */ - /* This macro is only useful for a small number of font files (mostly */ - /* for Asian scripts) that require bytecode interpretation to properly */ - /* load glyphs. For all other fonts, this produces unpleasant results, */ - /* thus the unpatented interpreter is never used to load glyphs from */ - /* TrueType fonts unless one of the following two options is used. */ - /* */ - /* - The unpatented interpreter is explicitly 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 (see function `tt_face_init' in file */ - /* `src/truetype/ttobjs.c'). */ - /* */ - /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */ - /* */ - /* { */ - /* FT_Parameter parameter; */ - /* FT_Open_Args open_args; */ - /* */ - /* */ - /* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */ - /* */ - /* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */ - /* open_args.pathname = my_font_pathname; */ - /* open_args.num_params = 1; */ - /* open_args.params = ¶meter; */ - /* */ - /* error = FT_Open_Face( library, &open_args, index, &face ); */ - /* ... */ - /* } */ - /* */ -#define TT_CONFIG_OPTION_UNPATENTED_HINTING - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */ - /* bytecode interpreter with a huge switch statement, rather than a call */ - /* table. This results in smaller and faster code for a number of */ - /* architectures. */ - /* */ - /* Note however that on some compiler/processor combinations, undefining */ - /* this macro will generate faster, though larger, code. */ - /* */ -#define TT_CONFIG_OPTION_INTERPRETER_SWITCH - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ - /* TrueType glyph loader to use Apple's definition of how to handle */ - /* component offsets in composite glyphs. */ - /* */ - /* Apple and MS disagree on the default behavior of component offsets */ - /* in composites. Apple says that they should be scaled by the scaling */ - /* factors in the transformation matrix (roughly, it's more complex) */ - /* while MS says they should not. OpenType defines two bits in the */ - /* composite flags array which can be used to disambiguate, but old */ - /* fonts will not have them. */ - /* */ - /* http://partners.adobe.com/asn/developer/opentype/glyf.html */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ - /* */ -#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ - /* support for Apple's distortable font technology (fvar, gvar, cvar, */ - /* and avar tables). This has many similarities to Type 1 Multiple */ - /* Masters support. */ - /* */ -#define TT_CONFIG_OPTION_GX_VAR_SUPPORT - - - /*************************************************************************/ - /* */ - /* Define TT_CONFIG_OPTION_BDF if you want to include support for */ - /* an embedded `BDF ' table within SFNT-based bitmap formats. */ - /* */ -#define TT_CONFIG_OPTION_BDF - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ - /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ - /* required. */ - /* */ -#define T1_MAX_DICT_DEPTH 5 - - - /*************************************************************************/ - /* */ - /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ - /* calls during glyph loading. */ - /* */ -#define T1_MAX_SUBRS_CALLS 16 - - - /*************************************************************************/ - /* */ - /* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */ - /* minimum of 16 is required. */ - /* */ - /* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */ - /* */ -#define T1_MAX_CHARSTRINGS_OPERANDS 256 - - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of `t1afm', which is in charge of reading Type 1 AFM */ - /* files into an existing face. Note that if set, the T1 driver will be */ - /* unable to produce kerning distances. */ - /* */ -#undef T1_CONFIG_OPTION_NO_AFM - - - /*************************************************************************/ - /* */ - /* Define this configuration macro if you want to prevent the */ - /* compilation of the Multiple Masters font support in the Type 1 */ - /* driver. */ - /* */ -#undef T1_CONFIG_OPTION_NO_MM_SUPPORT - - - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* Compile autofit module with CJK (Chinese, Japanese, Korean) script */ - /* support. */ - /* */ -#define AF_CONFIG_OPTION_CJK - - /*************************************************************************/ - /* */ - /* Compile autofit module with Indic script support. */ - /* */ -#define AF_CONFIG_OPTION_INDIC - - /* */ - - - /* - * Define this variable if you want to keep the layout of internal - * structures that was used prior to FreeType 2.2. This also compiles in - * a few obsolete functions to avoid linking problems on typical Unix - * distributions. - * - * For embedded systems or building a new distribution from scratch, it - * is recommended to disable the macro since it reduces the library's code - * size and activates a few memory-saving optimizations as well. - */ -#define FT_CONFIG_OPTION_OLD_INTERNALS - - - /* - * This macro is defined if either unpatented or native TrueType - * hinting is requested by the definitions above. - */ -#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER -#define TT_USE_BYTECODE_INTERPRETER -#undef TT_CONFIG_OPTION_UNPATENTED_HINTING -#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING -#define TT_USE_BYTECODE_INTERPRETER -#endif - -FT_END_HEADER - - -#endif /* __FTOPTION_H__ */ - - -/* END */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 574cf5829..5b59eb536 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -805,7 +805,7 @@ FT_BEGIN_HEADER /* */ /* debug_hooks :: XXX */ /* */ - /* pic_container :: Contains global structs and tables, instead */ + /* pic_table :: Contains global structs and tables, instead */ /* of defining them globallly. */ /* */ @@ -840,7 +840,7 @@ FT_BEGIN_HEADER #endif #ifdef FT_CONFIG_OPTION_PIC - FT_PIC_Container pic_container; + FT_PicTableRec pic_table; #endif } FT_LibraryRec; diff --git a/include/freetype/internal/ftpic.h b/include/freetype/internal/ftpic.h index 1b31957d7..8c441d6b6 100644 --- a/include/freetype/internal/ftpic.h +++ b/include/freetype/internal/ftpic.h @@ -26,34 +26,44 @@ #ifndef __FTPIC_H__ #define __FTPIC_H__ - + FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC - typedef struct FT_PIC_Container_ + /* When FT_CONFIG_OPTION_PIC is defined, the FT_PicTable + * is used to hold all constant structures that normally + * contain pointers in the normal build of FreeType. + * + * Note that the table itself only contains un-typed pointers + * to base or module-specific data, which will be allocated + * on the heap when the corresponding code is initialized. + */ + typedef struct FT_PicTableRec_ { /* pic containers for base */ - void* base; + void* base; + /* pic containers for modules */ - void* autofit; - void* cff; - void* pshinter; - void* psnames; - void* raster; - void* sfnt; - void* smooth; - void* truetype; - } FT_PIC_Container; - - /* Initialize the various function tables, structs, etc. stored in the container. */ + void* autofit; + void* cff; + void* pshinter; + void* psnames; + void* raster; + void* sfnt; + void* smooth; + void* truetype; + + } FT_PicTableRec, *FT_PicTable; + + /* Initialize the PIC table's base */ FT_BASE( FT_Error ) - ft_pic_container_init( FT_Library library ); + ft_library_pic_init( FT_Library library ); - /* Destroy the contents of the container. */ + /* Destroy the contents of the PIC table. */ FT_BASE( void ) - ft_pic_container_destroy( FT_Library library ); + ft_library_pic_done( FT_Library library ); #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c index 76822c301..3129a9322 100644 --- a/src/autofit/afpic.c +++ b/src/autofit/afpic.c @@ -36,29 +36,32 @@ void autofit_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->autofit ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + + if ( pic_table->autofit ) { - FT_FREE( pic_container->autofit ); - pic_container->autofit = NULL; + FT_FREE( pic_table->autofit ); + pic_table->autofit = NULL; } } + FT_Error autofit_module_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_UInt ss; - FT_Error error = FT_Err_Ok; + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + FT_UInt ss; + FT_Error error = FT_Err_Ok; AFModulePIC* container; - FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->autofit = container; + + pic_table->autofit = container; /* initialize pointer table - this is how the module usually expects this data */ for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ ) @@ -66,7 +69,7 @@ container->af_script_classes[ss] = &container->af_script_classes_rec[ss]; } container->af_script_classes[AF_SCRIPT_CLASSES_COUNT-1] = NULL; - + /* add call to initialization function when you add new scripts */ ss = 0; FT_Init_Class_af_dummy_script_class(&container->af_script_classes_rec[ss++]); diff --git a/src/autofit/afpic.h b/src/autofit/afpic.h index 80e62d39a..7c546bb11 100644 --- a/src/autofit/afpic.h +++ b/src/autofit/afpic.h @@ -48,7 +48,7 @@ FT_BEGIN_HEADER FT_AutoHinter_ServiceRec af_autofitter_service; } AFModulePIC; -#define GET_PIC(lib) ((AFModulePIC*)((lib)->pic_container.autofit)) +#define GET_PIC(lib) ((AFModulePIC*)((lib)->pic_table.autofit)) #define AF_SCRIPT_CLASSES_GET (GET_PIC(FT_FACE_LIBRARY(globals->face))->af_script_classes) #define AF_AF_AUTOFITTER_SERVICE_GET (GET_PIC(library)->af_autofitter_service) diff --git a/src/base/basepic.c b/src/base/basepic.c index c0bccb695..0aa0e8d59 100644 --- a/src/base/basepic.c +++ b/src/base/basepic.c @@ -34,15 +34,17 @@ void ft_base_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->base ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + + if ( pic_table->base ) { /* Destroy default module classes (in case FT_Add_Default_Modules was used) */ ft_destroy_default_module_classes( library ); - FT_FREE( pic_container->base ); - pic_container->base = NULL; + FT_FREE( pic_table->base ); + pic_table->base = NULL; } } @@ -50,16 +52,16 @@ FT_Error ft_base_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; + FT_PicTable pic_table = &library->pic_table; + FT_Error error = FT_Err_Ok; + FT_Memory memory = library->memory; BasePIC* container; - FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW ( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->base = container; + + pic_table->base = container; /* initialize default modules list and pointers */ error = ft_create_default_module_classes( library ); @@ -73,6 +75,7 @@ Exit: if(error) ft_base_pic_free(library); + return error; } diff --git a/src/base/basepic.h b/src/base/basepic.h index bb1774576..e9eb68cff 100644 --- a/src/base/basepic.h +++ b/src/base/basepic.h @@ -40,7 +40,7 @@ FT_BEGIN_HEADER FT_Glyph_Class ft_bitmap_glyph_class; } BasePIC; -#define GET_PIC(lib) ((BasePIC*)((lib)->pic_container.base)) +#define GET_PIC(lib) ((BasePIC*)((lib)->pic_table.base)) #define FT_OUTLINE_GLYPH_CLASS_GET (&GET_PIC(library)->ft_outline_glyph_class) #define FT_BITMAP_GLYPH_CLASS_GET (&GET_PIC(library)->ft_bitmap_glyph_class) #define FT_DEFAULT_MODULES_GET (GET_PIC(library)->default_module_classes) diff --git a/src/base/ftinit.c b/src/base/ftinit.c index 4be75b668..13b2a8243 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -115,19 +115,19 @@ FT_Module_Class** classes; FT_Memory memory; FT_UInt i; - BasePIC* pic_container = library->pic_container.base; + BasePIC* pic_table = library->pic_table.base; - if ( !pic_container->default_module_classes ) + if ( !pic_table->default_module_classes ) return; memory = library->memory; - classes = pic_container->default_module_classes; + classes = pic_table->default_module_classes; i = 0; #include FT_CONFIG_MODULES_H FT_FREE( classes ); - pic_container->default_module_classes = 0; + pic_table->default_module_classes = 0; } /* initialize all module classes and the pointer table */ @@ -145,10 +145,10 @@ FT_Module_Class** classes; FT_Module_Class* clazz; FT_UInt i; - BasePIC* pic_container = library->pic_container.base; + BasePIC* pic_table = library->pic_table.base; memory = library->memory; - pic_container->default_module_classes = 0; + pic_table->default_module_classes = 0; if ( FT_ALLOC(classes, sizeof(FT_Module_Class*) * (FT_NUM_MODULE_CLASSES + 1) ) ) return error; @@ -163,7 +163,7 @@ Exit: if (error) ft_destroy_default_module_classes( library ); - else pic_container->default_module_classes = classes; + else pic_table->default_module_classes = classes; return error; } diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 613deef19..cdbc40de8 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4125,7 +4125,7 @@ #ifdef FT_CONFIG_OPTION_PIC /* initialize position independent code containers */ - error = ft_pic_container_init( library ); + error = ft_library_pic_init( library ); if ( error ) goto Fail; #endif @@ -4144,7 +4144,7 @@ Fail: #ifdef FT_CONFIG_OPTION_PIC - ft_pic_container_destroy( library ); + ft_library_done_pic( library ); #endif FT_FREE( library ); return error; @@ -4264,7 +4264,7 @@ #ifdef FT_CONFIG_OPTION_PIC /* Destroy pic container contents */ - ft_pic_container_destroy( library ); + ft_library_pic_done( library ); #endif FT_FREE( library ); diff --git a/src/base/ftpic.c b/src/base/ftpic.c index d5271a972..ba07ae5f4 100644 --- a/src/base/ftpic.c +++ b/src/base/ftpic.c @@ -26,12 +26,12 @@ /* documentation is in ftpic.h */ FT_BASE_DEF( FT_Error ) - ft_pic_container_init( FT_Library library ) + ft_library_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; + FT_PicTable pic_table = &library->pic_table; + FT_Error error = FT_Err_Ok; - FT_MEM_SET( pic_container, 0, sizeof(*pic_container) ); + FT_ZERO(pic_table); error = ft_base_pic_init( library ); if(error) @@ -43,7 +43,7 @@ /* Destroy the contents of the container. */ FT_BASE_DEF( void ) - ft_pic_container_destroy( FT_Library library ) + ft_library_pic_done( FT_Library library ) { ft_base_pic_free( library ); } diff --git a/src/cff/cffpic.c b/src/cff/cffpic.c index 568956d6a..4c7b2ff66 100644 --- a/src/cff/cffpic.c +++ b/src/cff/cffpic.c @@ -43,53 +43,66 @@ void cff_driver_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->cff ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + if ( pic_table->cff ) { - CffModulePIC* container = (CffModulePIC*)pic_container->cff; + CffModulePIC* container = (CffModulePIC*)pic_table->cff; + + if(container->cff_services) FT_Destroy_Class_cff_services(library, container->cff_services); + container->cff_services = NULL; if(container->cff_field_handlers) + { FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers); - container->cff_field_handlers = NULL; + container->cff_field_handlers = NULL; + } FT_FREE( container ); - pic_container->cff = NULL; + pic_table->cff = NULL; } } FT_Error cff_driver_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - CffModulePIC* container; - FT_Memory memory = library->memory; + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + FT_Error error = FT_Err_Ok; + CffModulePIC* container; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW ( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->cff = container; + + pic_table->cff = container; /* initialize pointer table - this is how the module usually expects this data */ error = FT_Create_Class_cff_services(library, &container->cff_services); if(error) goto Exit; + error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers); if(error) goto Exit; - FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info); - FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict); - FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name); + + FT_Init_Class_cff_service_ps_info (library, &container->cff_service_ps_info); + FT_Init_Class_cff_service_glyph_dict (library, &container->cff_service_glyph_dict); + FT_Init_Class_cff_service_ps_name (library, &container->cff_service_ps_name); + FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info); - FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info); - FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec); - FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec); + FT_Init_Class_cff_service_cid_info (library, &container->cff_service_cid_info); + + FT_Init_Class_cff_cmap_encoding_class_rec (library, + &container->cff_cmap_encoding_class_rec); + FT_Init_Class_cff_cmap_unicode_class_rec (library, + &container->cff_cmap_unicode_class_rec); Exit: if(error) cff_driver_class_pic_free(library); + return error; } diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h index e29d06813..cfdac8525 100644 --- a/src/cff/cffpic.h +++ b/src/cff/cffpic.h @@ -57,7 +57,7 @@ FT_BEGIN_HEADER FT_CMap_ClassRec cff_cmap_unicode_class_rec; } CffModulePIC; -#define GET_PIC(lib) ((CffModulePIC*)((lib)->pic_container.cff)) +#define GET_PIC(lib) ((CffModulePIC*)((lib)->pic_table.cff)) #define FT_CFF_SERVICE_PS_INFO_GET (GET_PIC(library)->cff_service_ps_info) #define FT_CFF_SERVICE_GLYPH_DICT_GET (GET_PIC(library)->cff_service_glyph_dict) #define FT_CFF_SERVICE_PS_NAME_GET (GET_PIC(library)->cff_service_ps_name) diff --git a/src/pshinter/pshpic.c b/src/pshinter/pshpic.c index 51a087988..ad6d02855 100644 --- a/src/pshinter/pshpic.c +++ b/src/pshinter/pshpic.c @@ -29,39 +29,41 @@ void pshinter_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->pshinter ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + if ( pic_table->pshinter ) { - FT_FREE( pic_container->pshinter ); - pic_container->pshinter = NULL; + FT_FREE( pic_table->pshinter ); + pic_table->pshinter = NULL; } } + FT_Error pshinter_module_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; + FT_PicTable pic_table = &library->pic_table; + FT_Error error = FT_Err_Ok; + FT_Memory memory = library->memory; PSHinterPIC* container; - FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW ( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->pshinter = container; - + + pic_table->pshinter = container; + /* add call to initialization function when you add new scripts */ FT_Init_Class_pshinter_interface(library, &container->pshinter_interface); /*Exit:*/ if(error) pshinter_module_class_pic_free(library); + return error; } - #endif /* FT_CONFIG_OPTION_PIC */ /* END */ diff --git a/src/pshinter/pshpic.h b/src/pshinter/pshpic.h index 3555d8e85..f45dccb17 100644 --- a/src/pshinter/pshpic.h +++ b/src/pshinter/pshpic.h @@ -37,7 +37,7 @@ FT_BEGIN_HEADER PSHinter_Interface pshinter_interface; } PSHinterPIC; -#define GET_PIC(lib) ((PSHinterPIC*)((lib)->pic_container.autofit)) +#define GET_PIC(lib) ((PSHinterPIC*)((lib)->pic_table.autofit)) #define FTPSHINTER_INTERFACE_GET (GET_PIC(library)->pshinter_interface) diff --git a/src/psnames/pspic.c b/src/psnames/pspic.c index ed7dadda3..73ae3dd9d 100644 --- a/src/psnames/pspic.c +++ b/src/psnames/pspic.c @@ -24,49 +24,58 @@ #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from psmodule.c */ - FT_Error FT_Create_Class_pscmaps_services( FT_Library, FT_ServiceDescRec**); - void FT_Destroy_Class_pscmaps_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_pscmaps_interface( FT_Library, FT_Service_PsCMapsRec*); + FT_Error FT_Create_Class_pscmaps_services ( FT_Library, FT_ServiceDescRec** ); + void FT_Destroy_Class_pscmaps_services( FT_Library, FT_ServiceDescRec* ); + void FT_Init_Class_pscmaps_interface ( FT_Library, FT_Service_PsCMapsRec* ); void psnames_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->psnames ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + + if ( pic_table->psnames ) { - PSModulePIC* container = (PSModulePIC*)pic_container->psnames; + PSModulePIC* container = (PSModulePIC*)pic_table->psnames; + + if(container->pscmaps_services) FT_Destroy_Class_pscmaps_services(library, container->pscmaps_services); + container->pscmaps_services = NULL; FT_FREE( container ); - pic_container->psnames = NULL; + + pic_table->psnames = NULL; } } + FT_Error psnames_module_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - PSModulePIC* container; - FT_Memory memory = library->memory; + FT_PicTable pic_table = &library->pic_table; + FT_Error error = FT_Err_Ok; + FT_Memory memory = library->memory; + PSModulePIC* container; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW ( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->psnames = container; + + pic_table->psnames = container; /* initialize pointer table - this is how the module usually expects this data */ error = FT_Create_Class_pscmaps_services(library, &container->pscmaps_services); if(error) goto Exit; + FT_Init_Class_pscmaps_interface(library, &container->pscmaps_interface); - + Exit: if(error) psnames_module_class_pic_free(library); + return error; } diff --git a/src/psnames/pspic.h b/src/psnames/pspic.h index 75a14fdcb..48ca5b9a4 100644 --- a/src/psnames/pspic.h +++ b/src/psnames/pspic.h @@ -38,7 +38,7 @@ FT_BEGIN_HEADER FT_Service_PsCMapsRec pscmaps_interface; } PSModulePIC; -#define GET_PIC(lib) ((PSModulePIC*)((lib)->pic_container.psnames)) +#define GET_PIC(lib) ((PSModulePIC*)((lib)->pic_table.psnames)) #define FT_PSCMAPS_SERVICES_GET (GET_PIC(library)->pscmaps_services) #define FT_PSCMAPS_INTERFACE_GET (GET_PIC(library)->pscmaps_interface) diff --git a/src/raster/rastpic.c b/src/raster/rastpic.c index 3c264877b..29ecf4209 100644 --- a/src/raster/rastpic.c +++ b/src/raster/rastpic.c @@ -29,15 +29,18 @@ void ft_raster1_renderer_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->raster ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + if ( pic_table->raster ) { - RasterPIC* container = (RasterPIC*)pic_container->raster; + RasterPIC* container = (RasterPIC*)pic_table->raster; + if(--container->ref_count) return; + FT_FREE( container ); - pic_container->raster = NULL; + pic_table->raster = NULL; } } @@ -45,24 +48,24 @@ FT_Error ft_raster1_renderer_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - RasterPIC* container; - FT_Memory memory = library->memory; + FT_PicTable pic_table = &library->pic_table; + FT_Error error = FT_Err_Ok; + FT_Memory memory = library->memory; + RasterPIC* container; /* since this function also serve raster5 renderer, it implements reference counting */ - if(pic_container->raster) + if(pic_table->raster) { - ((RasterPIC*)pic_container->raster)->ref_count++; + ((RasterPIC*)pic_table->raster)->ref_count++; return error; } /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW ( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->raster = container; + + pic_table->raster = container; container->ref_count = 1; /* initialize pointer table - this is how the module usually expects this data */ @@ -70,6 +73,7 @@ /*Exit:*/ if(error) ft_raster1_renderer_class_pic_free(library); + return error; } @@ -78,6 +82,7 @@ { return ft_raster1_renderer_class_pic_init(library); } + void ft_raster5_renderer_class_pic_free(FT_Library library) { ft_raster1_renderer_class_pic_free(library); diff --git a/src/raster/rastpic.h b/src/raster/rastpic.h index dcd82b8ca..0f4d7bd11 100644 --- a/src/raster/rastpic.h +++ b/src/raster/rastpic.h @@ -35,7 +35,7 @@ FT_BEGIN_HEADER FT_Raster_Funcs ft_standard_raster; } RasterPIC; -#define GET_PIC(lib) ((RasterPIC*)((lib)->pic_container.raster)) +#define GET_PIC(lib) ((RasterPIC*)((lib)->pic_table.raster)) #define FT_STANDARD_RASTER_GET (GET_PIC(library)->ft_standard_raster) #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/sfnt/sfntpic.c b/src/sfnt/sfntpic.c index fd3cf4e92..681bff183 100644 --- a/src/sfnt/sfntpic.c +++ b/src/sfnt/sfntpic.c @@ -40,19 +40,24 @@ void sfnt_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->sfnt ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + if ( pic_table->sfnt ) { - sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt; + sfntModulePIC* container = (sfntModulePIC*)pic_table->sfnt; + if(container->sfnt_services) FT_Destroy_Class_sfnt_services(library, container->sfnt_services); + container->sfnt_services = NULL; if(container->tt_cmap_classes) + { FT_Destroy_Class_tt_cmap_classes(library, container->tt_cmap_classes); - container->tt_cmap_classes = NULL; + container->tt_cmap_classes = NULL; + } FT_FREE( container ); - pic_container->sfnt = NULL; + pic_table->sfnt = NULL; } } @@ -60,36 +65,40 @@ FT_Error sfnt_module_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - sfntModulePIC* container; - FT_Memory memory = library->memory; + FT_PicTable pic_table = &library->pic_table; + FT_Error error = FT_Err_Ok; + FT_Memory memory = library->memory; + sfntModulePIC* container; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW ( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->sfnt = container; + + pic_table->sfnt = container; /* initialize pointer table - this is how the module usually expects this data */ error = FT_Create_Class_sfnt_services(library, &container->sfnt_services); - if(error) + if(error) goto Exit; + error = FT_Create_Class_tt_cmap_classes(library, &container->tt_cmap_classes); - if(error) + if(error) goto Exit; - FT_Init_Class_sfnt_service_glyph_dict(library, &container->sfnt_service_glyph_dict); - FT_Init_Class_sfnt_service_ps_name(library, &container->sfnt_service_ps_name); + + FT_Init_Class_sfnt_service_glyph_dict (library, &container->sfnt_service_glyph_dict); + FT_Init_Class_sfnt_service_ps_name (library, &container->sfnt_service_ps_name); FT_Init_Class_tt_service_get_cmap_info(library, &container->tt_service_get_cmap_info); + FT_Init_Class_sfnt_service_sfnt_table(&container->sfnt_service_sfnt_table); #ifdef TT_CONFIG_OPTION_BDF - FT_Init_Class_sfnt_service_bdf(&container->sfnt_service_bdf); + FT_Init_Class_sfnt_service_bdf (&container->sfnt_service_bdf); #endif FT_Init_Class_sfnt_interface(library, &container->sfnt_interface); Exit: if(error) sfnt_module_class_pic_free(library); + return error; } diff --git a/src/sfnt/sfntpic.h b/src/sfnt/sfntpic.h index 6943b4250..b8e5e9fff 100644 --- a/src/sfnt/sfntpic.h +++ b/src/sfnt/sfntpic.h @@ -65,7 +65,7 @@ typedef struct sfntModulePIC_ SFNT_Interface sfnt_interface; } sfntModulePIC; -#define GET_PIC(lib) ((sfntModulePIC*)((lib)->pic_container.sfnt)) +#define GET_PIC(lib) ((sfntModulePIC*)((lib)->pic_table.sfnt)) #define FT_SFNT_SERVICES_GET (GET_PIC(library)->sfnt_services) #define FT_SFNT_SERVICE_GLYPH_DICT_GET (GET_PIC(library)->sfnt_service_glyph_dict) #define FT_SFNT_SERVICE_PS_NAME_GET (GET_PIC(library)->sfnt_service_ps_name) diff --git a/src/smooth/ftspic.c b/src/smooth/ftspic.c index aa547fceb..7b417351e 100644 --- a/src/smooth/ftspic.c +++ b/src/smooth/ftspic.c @@ -29,15 +29,18 @@ void ft_smooth_renderer_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->smooth ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + if ( pic_table->smooth ) { - SmoothPIC* container = (SmoothPIC*)pic_container->smooth; + SmoothPIC* container = (SmoothPIC*)pic_table->smooth; + if(--container->ref_count) return; + FT_FREE( container ); - pic_container->smooth = NULL; + pic_table->smooth = NULL; } } @@ -45,24 +48,24 @@ FT_Error ft_smooth_renderer_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - SmoothPIC* container; - FT_Memory memory = library->memory; + FT_PicTable pic_table = &library->pic_table; + FT_Error error = FT_Err_Ok; + FT_Memory memory = library->memory; + SmoothPIC* container; /* since this function also serve smooth_lcd and smooth_lcdv renderers, it implements reference counting */ - if(pic_container->smooth) + if(pic_table->smooth) { - ((SmoothPIC*)pic_container->smooth)->ref_count++; + ((SmoothPIC*)pic_table->smooth)->ref_count++; return error; } /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW ( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->smooth = container; + + pic_table->smooth = container; container->ref_count = 1; /* initialize pointer table - this is how the module usually expects this data */ @@ -70,6 +73,7 @@ /*Exit:*/ if(error) ft_smooth_renderer_class_pic_free(library); + return error; } diff --git a/src/smooth/ftspic.h b/src/smooth/ftspic.h index c7e0ce9d8..b892e211c 100644 --- a/src/smooth/ftspic.h +++ b/src/smooth/ftspic.h @@ -35,7 +35,7 @@ FT_BEGIN_HEADER FT_Raster_Funcs ft_grays_raster; } SmoothPIC; -#define GET_PIC(lib) ((SmoothPIC*)((lib)->pic_container.smooth)) +#define GET_PIC(lib) ((SmoothPIC*)((lib)->pic_table.smooth)) #define FT_GRAYS_RASTER_GET (GET_PIC(library)->ft_grays_raster) #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/truetype/ttpic.c b/src/truetype/ttpic.c index 27ec4a1d5..b09ca109e 100644 --- a/src/truetype/ttpic.c +++ b/src/truetype/ttpic.c @@ -32,32 +32,37 @@ void tt_driver_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; - if ( pic_container->truetype ) + FT_PicTable pic_table = &library->pic_table; + FT_Memory memory = library->memory; + + if ( pic_table->truetype ) { - TTModulePIC* container = (TTModulePIC*)pic_container->truetype; + TTModulePIC* container = (TTModulePIC*)pic_table->truetype; + if(container->tt_services) + { FT_Destroy_Class_tt_services(library, container->tt_services); - container->tt_services = NULL; + container->tt_services = NULL; + } FT_FREE( container ); - pic_container->truetype = NULL; + pic_table->truetype = NULL; } } + FT_Error tt_driver_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - TTModulePIC* container; - FT_Memory memory = library->memory; + FT_PicTable pic_table = &library->pic_table; + FT_Error error = FT_Err_Ok; + FT_Memory memory = library->memory; + TTModulePIC* container; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_NEW ( container ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); - pic_container->truetype = container; + + pic_table->truetype = container; /* initialize pointer table - this is how the module usually expects this data */ error = FT_Create_Class_tt_services(library, &container->tt_services); @@ -67,9 +72,11 @@ FT_Init_Class_tt_service_gx_multi_masters(&container->tt_service_gx_multi_masters); #endif FT_Init_Class_tt_service_truetype_glyf(&container->tt_service_truetype_glyf); + Exit: if(error) tt_driver_class_pic_free(library); + return error; } diff --git a/src/truetype/ttpic.h b/src/truetype/ttpic.h index 84de0fee9..c7aa97767 100644 --- a/src/truetype/ttpic.h +++ b/src/truetype/ttpic.h @@ -42,7 +42,7 @@ FT_BEGIN_HEADER FT_Service_TTGlyfRec tt_service_truetype_glyf; } TTModulePIC; -#define GET_PIC(lib) ((TTModulePIC*)((lib)->pic_container.truetype)) +#define GET_PIC(lib) ((TTModulePIC*)((lib)->pic_table.truetype)) #define FT_TT_SERVICES_GET (GET_PIC(library)->tt_services) #define FT_TT_SERVICE_GX_MULTI_MASTERS_GET (GET_PIC(library)->tt_service_gx_multi_masters) #define FT_TT_SERVICE_TRUETYPE_GLYF_GET (GET_PIC(library)->tt_service_truetype_glyf) -- cgit v1.2.1