[CHG] FreeType updated to version 2.4.9

This commit is contained in:
Crayon2000 2012-03-10 19:55:12 +00:00
parent 65f1c09927
commit 1ba41c22c4
166 changed files with 2390 additions and 1685 deletions

View file

@ -122,6 +122,7 @@ ifdef check_platform
# #
is_unix := $(strip $(wildcard /sbin/init) \ is_unix := $(strip $(wildcard /sbin/init) \
$(wildcard /usr/sbin/init) \ $(wildcard /usr/sbin/init) \
$(wildcard /dev/null) \
$(wildcard /hurd/auth)) $(wildcard /hurd/auth))
ifneq ($(is_unix),) ifneq ($(is_unix),)

View file

@ -120,8 +120,7 @@ FT_BEGIN_HEADER
/* This is the only necessary change, so it is defined here instead */ /* This is the only necessary change, so it is defined here instead */
/* providing a new configuration file. */ /* providing a new configuration file. */
/* */ /* */
#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \ #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
( defined( __MWERKS__ ) && defined( macintosh ) )
/* no Carbon frameworks for 64bit 10.4.x */ /* no Carbon frameworks for 64bit 10.4.x */
/* AvailabilityMacros.h is available since Mac OS X 10.2, */ /* AvailabilityMacros.h is available since Mac OS X 10.2, */
/* so guess the system version by maximum errno before inclusion */ /* so guess the system version by maximum errno before inclusion */
@ -131,9 +130,7 @@ FT_BEGIN_HEADER
#endif #endif
#if defined( __LP64__ ) && \ #if defined( __LP64__ ) && \
( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
#define DARWIN_NO_CARBON 1 #undef FT_MACINTOSH
#else
#define FT_MACINTOSH 1
#endif #endif
#elif defined( __SC__ ) || defined( __MRC__ ) #elif defined( __SC__ ) || defined( __MRC__ )

View file

@ -0,0 +1,32 @@
/*
* This file registers the FreeType modules compiled into the library.
*
* If you use GNU make, this file IS NOT USED! Instead, it is created in
* the objects directory (normally `<topdir>/objs/') based on information
* from `<topdir>/modules.cfg'.
*
* Please read `docs/INSTALL.ANY' and `docs/CUSTOMIZE' how to compile
* FreeType without GNU make.
*
*/
FT_USE_MODULE( FT_Module_Class, autofit_module_class )
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t1_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t1cid_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, pfr_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, t42_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, winfnt_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, pcf_driver_class )
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcd_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_lcdv_renderer_class )
FT_USE_MODULE( FT_Driver_ClassRec, bdf_driver_class )
/* EOF */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType high-level API and common types (specification only). */ /* FreeType high-level API and common types (specification only). */
/* */ /* */
/* Copyright 1996-2011 by */ /* Copyright 1996-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -958,8 +958,8 @@ FT_BEGIN_HEADER
FT_ListRec sizes_list; FT_ListRec sizes_list;
FT_Generic autohint; FT_Generic autohint; /* face-specific auto-hinter data */
void* extensions; void* extensions; /* unused */
FT_Face_Internal internal; FT_Face_Internal internal;
@ -1668,6 +1668,9 @@ FT_BEGIN_HEADER
/* use @FT_New_Library instead, followed by a call to */ /* use @FT_New_Library instead, followed by a call to */
/* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */
/* */ /* */
/* For multi-threading applications each thread should have its own */
/* FT_Library object. */
/* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Init_FreeType( FT_Library *alibrary ); FT_Init_FreeType( FT_Library *alibrary );
@ -1953,6 +1956,10 @@ FT_BEGIN_HEADER
/* Each new face object created with this function also owns a */ /* Each new face object created with this function also owns a */
/* default @FT_Size object, accessible as `face->size'. */ /* default @FT_Size object, accessible as `face->size'. */
/* */ /* */
/* One @FT_Library instance can have multiple face objects, this is, */
/* @FT_Open_Face and its siblings can be called multiple times using */
/* the same `library' argument. */
/* */
/* See the discussion of reference counters in the description of */ /* See the discussion of reference counters in the description of */
/* @FT_Reference_Face. */ /* @FT_Reference_Face. */
/* */ /* */
@ -2445,6 +2452,11 @@ FT_BEGIN_HEADER
* during glyph loading. This is mostly used to detect broken glyphs * during glyph loading. This is mostly used to detect broken glyphs
* in fonts. By default, FreeType tries to handle broken fonts also. * in fonts. By default, FreeType tries to handle broken fonts also.
* *
* In particular, errors from the TrueType bytecode engine are not
* passed to the application if this flag is not set; this might
* result in partially hinted or distorted glyphs in case a glyph's
* bytecode is buggy.
*
* FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ::
* Ignored. Deprecated. * Ignored. Deprecated.
* *
@ -2497,26 +2509,26 @@ FT_BEGIN_HEADER
* *
*/ */
#define FT_LOAD_DEFAULT 0x0 #define FT_LOAD_DEFAULT 0x0
#define FT_LOAD_NO_SCALE 0x1 #define FT_LOAD_NO_SCALE ( 1L << 0 )
#define FT_LOAD_NO_HINTING 0x2 #define FT_LOAD_NO_HINTING ( 1L << 1 )
#define FT_LOAD_RENDER 0x4 #define FT_LOAD_RENDER ( 1L << 2 )
#define FT_LOAD_NO_BITMAP 0x8 #define FT_LOAD_NO_BITMAP ( 1L << 3 )
#define FT_LOAD_VERTICAL_LAYOUT 0x10 #define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
#define FT_LOAD_FORCE_AUTOHINT 0x20 #define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
#define FT_LOAD_CROP_BITMAP 0x40 #define FT_LOAD_CROP_BITMAP ( 1L << 6 )
#define FT_LOAD_PEDANTIC 0x80 #define FT_LOAD_PEDANTIC ( 1L << 7 )
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200 #define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
#define FT_LOAD_NO_RECURSE 0x400 #define FT_LOAD_NO_RECURSE ( 1L << 10 )
#define FT_LOAD_IGNORE_TRANSFORM 0x800 #define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
#define FT_LOAD_MONOCHROME 0x1000 #define FT_LOAD_MONOCHROME ( 1L << 12 )
#define FT_LOAD_LINEAR_DESIGN 0x2000 #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
#define FT_LOAD_NO_AUTOHINT 0x8000U #define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
/* */ /* */
/* used internally only by certain font drivers! */ /* used internally only by certain font drivers! */
#define FT_LOAD_ADVANCE_ONLY 0x100 #define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
#define FT_LOAD_SBITS_ONLY 0x4000 #define FT_LOAD_SBITS_ONLY ( 1L << 14 )
/************************************************************************** /**************************************************************************
@ -2869,14 +2881,26 @@ FT_BEGIN_HEADER
/* */ /* */
/* point_size :: The point size in 16.16 fractional points. */ /* point_size :: The point size in 16.16 fractional points. */
/* */ /* */
/* degree :: The degree of tightness. */ /* degree :: The degree of tightness. Increasingly negative */
/* values represent tighter track kerning, while */
/* increasingly positive values represent looser track */
/* kerning. Value zero means no track kerning. */
/* */ /* */
/* <Output> */ /* <Output> */
/* akerning :: The kerning in 16.16 fractional points. */ /* akerning :: The kerning in 16.16 fractional points, to be */
/* uniformly applied between all glyphs. */
/* */ /* */
/* <Return> */ /* <Return> */
/* FreeType error code. 0~means success. */ /* FreeType error code. 0~means success. */
/* */ /* */
/* <Note> */
/* Currently, only the Type~1 font driver supports track kerning, */
/* using data from AFM files (if attached with @FT_Attach_File or */
/* @FT_Attach_Stream). */
/* */
/* Only very few AFM files come with track kerning data; please refer */
/* to the Adobe's AFM specification for more details. */
/* */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Get_Track_Kerning( FT_Face face, FT_Get_Track_Kerning( FT_Face face,
FT_Fixed point_size, FT_Fixed point_size,
@ -3810,7 +3834,7 @@ FT_BEGIN_HEADER
*/ */
#define FREETYPE_MAJOR 2 #define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 4 #define FREETYPE_MINOR 4
#define FREETYPE_PATCH 8 #define FREETYPE_PATCH 9
/*************************************************************************/ /*************************************************************************/

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType error codes (specification). */ /* FreeType error codes (specification). */
/* */ /* */
/* Copyright 2002, 2004, 2006, 2007, 2010 by */ /* Copyright 2002, 2004, 2006, 2007, 2010-2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -54,6 +54,8 @@
"broken offset within table" ) "broken offset within table" )
FT_ERRORDEF_( Array_Too_Large, 0x0A, \ FT_ERRORDEF_( Array_Too_Large, 0x0A, \
"array allocation size too large" ) "array allocation size too large" )
FT_ERRORDEF_( Missing_Module, 0x0B, \
"missing module" )
/* glyph/character errors */ /* glyph/character errors */

View file

@ -192,12 +192,13 @@
#undef FT_NOERRORDEF_ #undef FT_NOERRORDEF_
#undef FT_NEED_EXTERN_C #undef FT_NEED_EXTERN_C
#undef FT_ERR_CONCAT
#undef FT_ERR_BASE #undef FT_ERR_BASE
/* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */
#ifndef FT_KEEP_ERR_PREFIX #ifndef FT_KEEP_ERR_PREFIX
#undef FT_ERR_PREFIX #undef FT_ERR_PREFIX
#else
#undef FT_KEEP_ERR_PREFIX
#endif #endif
#endif /* __FTERRORS_H__ */ #endif /* __FTERRORS_H__ */

View file

@ -62,12 +62,12 @@
* It is up to the client to decide what to do. * It is up to the client to decide what to do.
* *
* FT_GASP_DO_GRIDFIT :: * FT_GASP_DO_GRIDFIT ::
* Grid-fitting and hinting should be performed at the specified ppem. * Grid-fitting and hinting should be performed at the specified ppem.
* This *really* means TrueType bytecode interpretation. If this bit * This *really* means TrueType bytecode interpretation. If this bit
* is not set, no hinting gets applied. * is not set, no hinting gets applied.
* *
* FT_GASP_DO_GRAY :: * FT_GASP_DO_GRAY ::
* Anti-aliased rendering should be performed at the specified ppem. * Anti-aliased rendering should be performed at the specified ppem.
* If not set, do monochrome rendering. * If not set, do monochrome rendering.
* *
* FT_GASP_SYMMETRIC_SMOOTHING :: * FT_GASP_SYMMETRIC_SMOOTHING ::

View file

@ -85,25 +85,25 @@ FT_BEGIN_HEADER
* miter limit is exceeded. The outer edges of the strokes * miter limit is exceeded. The outer edges of the strokes
* for the two segments are extended until they meet at an * for the two segments are extended until they meet at an
* angle. If the segments meet at too sharp an angle (such * angle. If the segments meet at too sharp an angle (such
* that the miter would extend from the intersection of the * that the miter would extend from the intersection of the
* segments a distance greater than the product of the miter * segments a distance greater than the product of the miter
* limit value and the border radius), then a bevel join (see * limit value and the border radius), then a bevel join (see
* above) is used instead. This prevents long spikes being * above) is used instead. This prevents long spikes being
* created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter * created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter
* line join as used in PostScript and PDF. * line join as used in PostScript and PDF.
* *
* FT_STROKER_LINEJOIN_MITER_VARIABLE :: * FT_STROKER_LINEJOIN_MITER_VARIABLE ::
* FT_STROKER_LINEJOIN_MITER :: * FT_STROKER_LINEJOIN_MITER ::
* Used to render mitered line joins, with variable bevels if * Used to render mitered line joins, with variable bevels if
* the miter limit is exceeded. The intersection of the * the miter limit is exceeded. The intersection of the
* strokes is clipped at a line perpendicular to the bisector * strokes is clipped at a line perpendicular to the bisector
* of the angle between the strokes, at the distance from the * of the angle between the strokes, at the distance from the
* intersection of the segments equal to the product of the * intersection of the segments equal to the product of the
* miter limit value and the border radius. This prevents * miter limit value and the border radius. This prevents
* long spikes being created. * long spikes being created.
* FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line
* join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias
* for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for
* backwards compatibility. * backwards compatibility.
*/ */
typedef enum FT_Stroker_LineJoin_ typedef enum FT_Stroker_LineJoin_

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType simple types definitions (specification only). */ /* FreeType simple types definitions (specification only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 by */ /* Copyright 1996-2002, 2004, 2006-2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -434,7 +434,7 @@ FT_BEGIN_HEADER
/* variety of FreeType core objects. For example, a text layout API */ /* variety of FreeType core objects. For example, a text layout API */
/* might want to associate a glyph cache to a given size object. */ /* might want to associate a glyph cache to a given size object. */
/* */ /* */
/* Most FreeType object contains a `generic' field, of type */ /* Some FreeType object contains a `generic' field, of type */
/* FT_Generic, which usage is left to client applications and font */ /* FT_Generic, which usage is left to client applications and font */
/* servers. */ /* servers. */
/* */ /* */

View file

@ -206,7 +206,7 @@ FT_BEGIN_HEADER
reset_face_, get_global_hints_, done_global_hints_, load_glyph_ \ reset_face_, get_global_hints_, done_global_hints_, load_glyph_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \ #define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \
done_global_hints_, load_glyph_) \ done_global_hints_, load_glyph_) \
@ -219,9 +219,9 @@ FT_BEGIN_HEADER
clazz->get_global_hints = get_global_hints_; \ clazz->get_global_hints = get_global_hints_; \
clazz->done_global_hints = done_global_hints_; \ clazz->done_global_hints = done_global_hints_; \
clazz->load_glyph = load_glyph_; \ clazz->load_glyph = load_glyph_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
FT_END_HEADER FT_END_HEADER

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType font driver interface (specification). */ /* FreeType font driver interface (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2006, 2008 by */ /* Copyright 1996-2003, 2006, 2008, 2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -162,10 +162,9 @@ FT_BEGIN_HEADER
/* starting at `first'. The `vertical' flag must */ /* starting at `first'. The `vertical' flag must */
/* be set to get vertical advance heights. The */ /* be set to get vertical advance heights. The */
/* `advances' buffer is caller-allocated. */ /* `advances' buffer is caller-allocated. */
/* Currently not implemented. The idea of this */ /* The idea of this function is to be able to */
/* function is to be able to perform */ /* perform device-independent text layout without */
/* device-independent text layout without loading */ /* loading a single glyph image. */
/* a single glyph image. */
/* */ /* */
/* request_size :: A handle to a function used to request the new */ /* request_size :: A handle to a function used to request the new */
/* character size. Can be set to 0 if the */ /* character size. Can be set to 0 if the */
@ -268,7 +267,9 @@ FT_BEGIN_HEADER
/* and initialize any additional global data, like module specific */ /* and initialize any additional global data, like module specific */
/* interface, and put them in the global pic container defined in */ /* interface, and put them in the global pic container defined in */
/* ftpic.h. if you don't need them just implement the functions as */ /* ftpic.h. if you don't need them just implement the functions as */
/* empty to resolve the link error. */ /* empty to resolve the link error. Also the pic_init and pic_free */
/* functions should be declared in pic.h, to be referred by driver */
/* definition calling FT_DEFINE_DRIVER() in following. */
/* */ /* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */ /* allocated in the global scope (or the scope where the macro */
@ -285,7 +286,7 @@ FT_BEGIN_HEADER
#define FT_DECLARE_DRIVER(class_) \ #define FT_DECLARE_DRIVER(class_) \
FT_CALLBACK_TABLE \ FT_CALLBACK_TABLE \
const FT_Driver_ClassRec class_; const FT_Driver_ClassRec class_;
#define FT_DEFINE_DRIVER(class_, \ #define FT_DEFINE_DRIVER(class_, \
flags_, size_, name_, version_, requires_, \ flags_, size_, name_, version_, requires_, \
@ -327,7 +328,7 @@ FT_BEGIN_HEADER
select_size_ \ select_size_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \
@ -348,8 +349,6 @@ FT_BEGIN_HEADER
old_set_char_sizes_, old_set_pixel_sizes_, \ old_set_char_sizes_, old_set_pixel_sizes_, \
load_glyph_, get_kerning_, attach_file_, \ load_glyph_, get_kerning_, attach_file_, \
get_advances_, request_size_, select_size_ ) \ get_advances_, request_size_, select_size_ ) \
void class_##_pic_free( FT_Library library ); \
FT_Error class_##_pic_init( FT_Library library ); \
\ \
void \ void \
FT_Destroy_Class_##class_( FT_Library library, \ FT_Destroy_Class_##class_( FT_Library library, \
@ -409,7 +408,7 @@ FT_BEGIN_HEADER
\ \
*output_class = (FT_Module_Class*)clazz; \ *output_class = (FT_Module_Class*)clazz; \
return FT_Err_Ok; \ return FT_Err_Ok; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType private base classes (specification). */ /* The FreeType private base classes (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by */ /* Copyright 1996-2006, 2008, 2010, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -243,7 +243,7 @@ FT_BEGIN_HEADER
clazz->variant_list = variant_list_; \ clazz->variant_list = variant_list_; \
clazz->charvariant_list = charvariant_list_; \ clazz->charvariant_list = charvariant_list_; \
clazz->variantchar_list = variantchar_list_; \ clazz->variantchar_list = variantchar_list_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* create a new charmap and add it to charmap->face */ /* create a new charmap and add it to charmap->face */
@ -436,19 +436,16 @@ FT_BEGIN_HEADER
/* */ /* */
/* memory :: A handle to the memory manager. */ /* memory :: A handle to the memory manager. */
/* */ /* */
/* generic :: A generic structure for user-level extensibility (?). */
/* */
typedef struct FT_ModuleRec_ typedef struct FT_ModuleRec_
{ {
FT_Module_Class* clazz; FT_Module_Class* clazz;
FT_Library library; FT_Library library;
FT_Memory memory; FT_Memory memory;
FT_Generic generic;
} FT_ModuleRec; } FT_ModuleRec;
/* typecast an object to a FT_Module */ /* typecast an object to an FT_Module */
#define FT_MODULE( x ) ((FT_Module)( x )) #define FT_MODULE( x ) ((FT_Module)( x ))
#define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz
#define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library
@ -711,10 +708,6 @@ FT_BEGIN_HEADER
/* faces_list :: The list of faces currently opened by this */ /* faces_list :: The list of faces currently opened by this */
/* driver. */ /* driver. */
/* */ /* */
/* extensions :: A typeless pointer to the driver's extensions */
/* registry, if they are supported through the */
/* configuration macro FT_CONFIG_OPTION_EXTENSIONS. */
/* */
/* glyph_loader :: The glyph loader for all faces managed by this */ /* glyph_loader :: The glyph loader for all faces managed by this */
/* driver. This object isn't defined for unscalable */ /* driver. This object isn't defined for unscalable */
/* formats. */ /* formats. */
@ -723,10 +716,7 @@ FT_BEGIN_HEADER
{ {
FT_ModuleRec root; FT_ModuleRec root;
FT_Driver_Class clazz; FT_Driver_Class clazz;
FT_ListRec faces_list; FT_ListRec faces_list;
void* extensions;
FT_GlyphLoader glyph_loader; FT_GlyphLoader glyph_loader;
} FT_DriverRec; } FT_DriverRec;
@ -776,9 +766,6 @@ FT_BEGIN_HEADER
/* memory :: The library's memory object. Manages memory */ /* memory :: The library's memory object. Manages memory */
/* allocation. */ /* allocation. */
/* */ /* */
/* generic :: Client data variable. Used to extend the */
/* Library class by higher levels and clients. */
/* */
/* version_major :: The major version number of the library. */ /* version_major :: The major version number of the library. */
/* */ /* */
/* version_minor :: The minor version number of the library. */ /* version_minor :: The minor version number of the library. */
@ -838,8 +825,6 @@ FT_BEGIN_HEADER
{ {
FT_Memory memory; /* library's memory manager */ FT_Memory memory; /* library's memory manager */
FT_Generic generic;
FT_Int version_major; FT_Int version_major;
FT_Int version_minor; FT_Int version_minor;
FT_Int version_patch; FT_Int version_patch;
@ -976,7 +961,7 @@ FT_BEGIN_HEADER
move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_ \ move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ #define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \
cubic_to_, shift_, delta_) \ cubic_to_, shift_, delta_) \
@ -990,9 +975,9 @@ FT_BEGIN_HEADER
clazz->shift = shift_; \ clazz->shift = shift_; \
clazz->delta = delta_; \ clazz->delta = delta_; \
return FT_Err_Ok; \ return FT_Err_Ok; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -1018,7 +1003,7 @@ FT_BEGIN_HEADER
raster_set_mode_, raster_render_, raster_done_ \ raster_set_mode_, raster_render_, raster_done_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ #define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \
raster_reset_, raster_set_mode_, raster_render_, raster_done_) \ raster_reset_, raster_set_mode_, raster_render_, raster_done_) \
@ -1031,9 +1016,9 @@ FT_BEGIN_HEADER
clazz->raster_set_mode = raster_set_mode_; \ clazz->raster_set_mode = raster_set_mode_; \
clazz->raster_render = raster_render_; \ clazz->raster_render = raster_render_; \
clazz->raster_done = raster_done_; \ clazz->raster_done = raster_done_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -1072,7 +1057,7 @@ FT_BEGIN_HEADER
size_, format_, init_, done_, copy_, transform_, bbox_, prepare_ \ size_, format_, init_, done_, copy_, transform_, bbox_, prepare_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ #define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \
transform_, bbox_, prepare_) \ transform_, bbox_, prepare_) \
@ -1087,9 +1072,9 @@ FT_BEGIN_HEADER
clazz->glyph_transform = transform_; \ clazz->glyph_transform = transform_; \
clazz->glyph_bbox = bbox_; \ clazz->glyph_bbox = bbox_; \
clazz->glyph_prepare = prepare_; \ clazz->glyph_prepare = prepare_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -1119,7 +1104,9 @@ FT_BEGIN_HEADER
/* and initialize any additional global data, like module specific */ /* and initialize any additional global data, like module specific */
/* interface, and put them in the global pic container defined in */ /* interface, and put them in the global pic container defined in */
/* ftpic.h. if you don't need them just implement the functions as */ /* ftpic.h. if you don't need them just implement the functions as */
/* empty to resolve the link error. */ /* empty to resolve the link error. Also the pic_init and pic_free */
/* functions should be declared in pic.h, to be referred by renderer */
/* definition calling FT_DEFINE_RENDERER() in following. */
/* */ /* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */ /* allocated in the global scope (or the scope where the macro */
@ -1150,7 +1137,7 @@ FT_BEGIN_HEADER
raster_class_ \ raster_class_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DECLARE_RENDERER(class_) FT_DECLARE_MODULE(class_) #define FT_DECLARE_RENDERER(class_) FT_DECLARE_MODULE(class_)
@ -1159,8 +1146,6 @@ FT_BEGIN_HEADER
interface_, init_, done_, get_interface_, \ interface_, init_, done_, get_interface_, \
glyph_format_, render_glyph_, transform_glyph_, \ glyph_format_, render_glyph_, transform_glyph_, \
get_glyph_cbox_, set_mode_, raster_class_ ) \ get_glyph_cbox_, set_mode_, raster_class_ ) \
void class_##_pic_free( FT_Library library ); \
FT_Error class_##_pic_init( FT_Library library ); \
\ \
void \ void \
FT_Destroy_Class_##class_( FT_Library library, \ FT_Destroy_Class_##class_( FT_Library library, \
@ -1205,11 +1190,11 @@ FT_BEGIN_HEADER
\ \
*output_class = (FT_Module_Class*)clazz; \ *output_class = (FT_Module_Class*)clazz; \
return FT_Err_Ok; \ return FT_Err_Ok; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -1290,7 +1275,9 @@ FT_BEGIN_HEADER
/* and initialize any additional global data, like module specific */ /* and initialize any additional global data, like module specific */
/* interface, and put them in the global pic container defined in */ /* interface, and put them in the global pic container defined in */
/* ftpic.h. if you don't need them just implement the functions as */ /* ftpic.h. if you don't need them just implement the functions as */
/* empty to resolve the link error. */ /* empty to resolve the link error. Also the pic_init and pic_free */
/* functions should be declared in pic.h, to be referred by module */
/* definition calling FT_DEFINE_MODULE() in following. */
/* */ /* */
/* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */
/* allocated in the global scope (or the scope where the macro */ /* allocated in the global scope (or the scope where the macro */
@ -1367,12 +1354,10 @@ FT_BEGIN_HEADER
\ \
clazz->root.module_init = init_; \ clazz->root.module_init = init_; \
clazz->root.module_done = done_; \ clazz->root.module_done = done_; \
clazz->root.get_interface = get_interface_; clazz->root.get_interface = get_interface_;
#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ #define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \
interface_, init_, done_, get_interface_) \ interface_, init_, done_, get_interface_) \
void class_##_pic_free( FT_Library library ); \
FT_Error class_##_pic_init( FT_Library library ); \
\ \
void \ void \
FT_Destroy_Class_##class_( FT_Library library, \ FT_Destroy_Class_##class_( FT_Library library, \
@ -1415,7 +1400,7 @@ FT_BEGIN_HEADER
\ \
*output_class = clazz; \ *output_class = clazz; \
return FT_Err_Ok; \ return FT_Err_Ok; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */

View file

@ -26,7 +26,7 @@
#ifndef __FTPIC_H__ #ifndef __FTPIC_H__
#define __FTPIC_H__ #define __FTPIC_H__
FT_BEGIN_HEADER FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
@ -36,14 +36,14 @@ FT_BEGIN_HEADER
/* pic containers for base */ /* pic containers for base */
void* base; void* base;
/* pic containers for modules */ /* pic containers for modules */
void* autofit; void* autofit;
void* cff; void* cff;
void* pshinter; void* pshinter;
void* psnames; void* psnames;
void* raster; void* raster;
void* sfnt; void* sfnt;
void* smooth; void* smooth;
void* truetype; void* truetype;
} FT_PIC_Container; } FT_PIC_Container;
/* Initialize the various function tables, structs, etc. stored in the container. */ /* Initialize the various function tables, structs, etc. stored in the container. */

View file

@ -48,6 +48,57 @@ FT_BEGIN_HEADER
} FT_RFork_Ref; } FT_RFork_Ref;
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
typedef FT_Error
(*ft_raccess_guess_func)( FT_Library library,
FT_Stream stream,
char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
typedef enum FT_RFork_Rule_ {
FT_RFork_Rule_invalid = -2,
FT_RFork_Rule_uknown, /* -1 */
FT_RFork_Rule_apple_double,
FT_RFork_Rule_apple_single,
FT_RFork_Rule_darwin_ufs_export,
FT_RFork_Rule_darwin_newvfs,
FT_RFork_Rule_darwin_hfsplus,
FT_RFork_Rule_vfat,
FT_RFork_Rule_linux_cap,
FT_RFork_Rule_linux_double,
FT_RFork_Rule_linux_netatalk
} FT_RFork_Rule;
/* For fast translation between rule index and rule type,
* the macros FT_RFORK_xxx should be kept consistent with
* the raccess_guess_funcs table
*/
typedef struct ft_raccess_guess_rec_ {
ft_raccess_guess_func func;
FT_RFork_Rule type;
} ft_raccess_guess_rec;
#ifndef FT_CONFIG_OPTION_PIC
/* this array is a storage in non-PIC mode, so ; is needed in END */
#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
const type name[] = {
#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
{ raccess_guess_##func_suffix, FT_RFork_Rule_##type_suffix },
#define CONST_FT_RFORK_RULE_ARRAY_END };
#else /* FT_CONFIG_OPTION_PIC */
/* this array is a function in PIC mode, so no ; is needed in END */
#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \
void FT_Init_##name ( type* storage ) { \
type *local = storage; \
int i = 0;
#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \
local[i].func = raccess_guess_##func_suffix; \
local[i].type = FT_RFork_Rule_##type_suffix; \
i++;
#define CONST_FT_RFORK_RULE_ARRAY_END }
#endif /* FT_CONFIG_OPTION_PIC */
#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */
/*************************************************************************/ /*************************************************************************/
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType services (specification only). */ /* The FreeType services (specification only). */
/* */ /* */
/* Copyright 2003, 2004, 2005, 2006, 2007 by */ /* Copyright 2003-2007, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -163,298 +163,366 @@ FT_BEGIN_HEADER
typedef const FT_ServiceDescRec* FT_ServiceDesc; typedef const FT_ServiceDescRec* FT_ServiceDesc;
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Macro> */ /* <Macro> */
/* FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6 */ /* FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6 */
/* */ /* */
/* <Description> */ /* <Description> */
/* Used to initialize an array of FT_ServiceDescRec structs. */ /* Used to initialize an array of FT_ServiceDescRec structures. */
/* */ /* */
/* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ /* When FT_CONFIG_OPTION_PIC is defined a `create' function needs to */
/* to called with a pointer where the allocated array is returned. */ /* be called with a pointer to return an allocated array. As soon as */
/* And when it is no longer needed a Destroy function needs */ /* it is no longer needed, a `destroy' function needs to be called to */
/* to be called to release that allocation. */ /* release that allocation. */
/* */ /* */
/* These functions should be manyally called from the pic_init and */ /* These functions should be manually called from the `pic_init' and */
/* pic_free functions of your module (see FT_DEFINE_MODULE) */ /* `pic_free' functions of your module (see FT_DEFINE_MODULE). */
/* */ /* */
/* When FT_CONFIG_OPTION_PIC is not defined the array will be */ /* When FT_CONFIG_OPTION_PIC is not defined the array will be */
/* allocated in the global scope (or the scope where the macro */ /* allocated in the global scope (or the scope where the macro is */
/* is used). */ /* used). */
/* */ /* */
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1) \ #define FT_DEFINE_SERVICEDESCREC1( class_, \
static const FT_ServiceDescRec class_[] = \ serv_id_1, serv_data_1 ) \
{ \ static const FT_ServiceDescRec class_[] = \
{serv_id_1, serv_data_1}, \ { \
{NULL, NULL} \ { serv_id_1, serv_data_1 }, \
}; { NULL, NULL } \
#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1, \
serv_id_2, serv_data_2) \
static const FT_ServiceDescRec class_[] = \
{ \
{serv_id_1, serv_data_1}, \
{serv_id_2, serv_data_2}, \
{NULL, NULL} \
};
#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, serv_id_3, serv_data_3) \
static const FT_ServiceDescRec class_[] = \
{ \
{serv_id_1, serv_data_1}, \
{serv_id_2, serv_data_2}, \
{serv_id_3, serv_data_3}, \
{NULL, NULL} \
};
#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, serv_id_3, serv_data_3, \
serv_id_4, serv_data_4) \
static const FT_ServiceDescRec class_[] = \
{ \
{serv_id_1, serv_data_1}, \
{serv_id_2, serv_data_2}, \
{serv_id_3, serv_data_3}, \
{serv_id_4, serv_data_4}, \
{NULL, NULL} \
};
#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, serv_id_5, serv_data_5) \
static const FT_ServiceDescRec class_[] = \
{ \
{serv_id_1, serv_data_1}, \
{serv_id_2, serv_data_2}, \
{serv_id_3, serv_data_3}, \
{serv_id_4, serv_data_4}, \
{serv_id_5, serv_data_5}, \
{NULL, NULL} \
};
#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, serv_id_5, serv_data_5, \
serv_id_6, serv_data_6) \
static const FT_ServiceDescRec class_[] = \
{ \
{serv_id_1, serv_data_1}, \
{serv_id_2, serv_data_2}, \
{serv_id_3, serv_data_3}, \
{serv_id_4, serv_data_4}, \
{serv_id_5, serv_data_5}, \
{serv_id_6, serv_data_6}, \
{NULL, NULL} \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_SERVICEDESCREC2( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2 ) \
static const FT_ServiceDescRec class_[] = \
{ \
{ serv_id_1, serv_data_1 }, \
{ serv_id_2, serv_data_2 }, \
{ NULL, NULL } \
};
#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1) \ #define FT_DEFINE_SERVICEDESCREC3( class_, \
void \ serv_id_1, serv_data_1, \
FT_Destroy_Class_##class_( FT_Library library, \ serv_id_2, serv_data_2, \
FT_ServiceDescRec* clazz ) \ serv_id_3, serv_data_3 ) \
{ \ static const FT_ServiceDescRec class_[] = \
FT_Memory memory = library->memory; \ { \
if ( clazz ) \ { serv_id_1, serv_data_1 }, \
FT_FREE( clazz ); \ { serv_id_2, serv_data_2 }, \
} \ { serv_id_3, serv_data_3 }, \
\ { NULL, NULL } \
FT_Error \ };
FT_Create_Class_##class_( FT_Library library, \
FT_ServiceDescRec** output_class) \
{ \
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
if ( FT_ALLOC( clazz, sizeof(*clazz)*2 ) ) \
return error; \
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = NULL; \
clazz[1].serv_data = NULL; \
*output_class = clazz; \
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1, \ #define FT_DEFINE_SERVICEDESCREC4( class_, \
serv_id_2, serv_data_2) \ serv_id_1, serv_data_1, \
void \ serv_id_2, serv_data_2, \
FT_Destroy_Class_##class_( FT_Library library, \ serv_id_3, serv_data_3, \
FT_ServiceDescRec* clazz ) \ serv_id_4, serv_data_4 ) \
{ \ static const FT_ServiceDescRec class_[] = \
FT_Memory memory = library->memory; \ { \
if ( clazz ) \ { serv_id_1, serv_data_1 }, \
FT_FREE( clazz ); \ { serv_id_2, serv_data_2 }, \
} \ { serv_id_3, serv_data_3 }, \
\ { serv_id_4, serv_data_4 }, \
FT_Error \ { NULL, NULL } \
FT_Create_Class_##class_( FT_Library library, \ };
FT_ServiceDescRec** output_class) \
{ \
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
if ( FT_ALLOC( clazz, sizeof(*clazz)*3 ) ) \
return error; \
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = NULL; \
clazz[2].serv_data = NULL; \
*output_class = clazz; \
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1, \ #define FT_DEFINE_SERVICEDESCREC5( class_, \
serv_id_2, serv_data_2, serv_id_3, serv_data_3) \ serv_id_1, serv_data_1, \
void \ serv_id_2, serv_data_2, \
FT_Destroy_Class_##class_( FT_Library library, \ serv_id_3, serv_data_3, \
FT_ServiceDescRec* clazz ) \ serv_id_4, serv_data_4, \
{ \ serv_id_5, serv_data_5 ) \
FT_Memory memory = library->memory; \ static const FT_ServiceDescRec class_[] = \
if ( clazz ) \ { \
FT_FREE( clazz ); \ { serv_id_1, serv_data_1 }, \
} \ { serv_id_2, serv_data_2 }, \
\ { serv_id_3, serv_data_3 }, \
FT_Error \ { serv_id_4, serv_data_4 }, \
FT_Create_Class_##class_( FT_Library library, \ { serv_id_5, serv_data_5 }, \
FT_ServiceDescRec** output_class) \ { NULL, NULL } \
{ \ };
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
if ( FT_ALLOC( clazz, sizeof(*clazz)*4 ) ) \
return error; \
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = NULL; \
clazz[3].serv_data = NULL; \
*output_class = clazz; \
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1, \ #define FT_DEFINE_SERVICEDESCREC6( class_, \
serv_id_2, serv_data_2, serv_id_3, serv_data_3, \ serv_id_1, serv_data_1, \
serv_id_4, serv_data_4) \ serv_id_2, serv_data_2, \
void \ serv_id_3, serv_data_3, \
FT_Destroy_Class_##class_( FT_Library library, \ serv_id_4, serv_data_4, \
FT_ServiceDescRec* clazz ) \ serv_id_5, serv_data_5, \
{ \ serv_id_6, serv_data_6 ) \
FT_Memory memory = library->memory; \ static const FT_ServiceDescRec class_[] = \
if ( clazz ) \ { \
FT_FREE( clazz ); \ { serv_id_1, serv_data_1 }, \
} \ { serv_id_2, serv_data_2 }, \
\ { serv_id_3, serv_data_3 }, \
FT_Error \ { serv_id_4, serv_data_4 }, \
FT_Create_Class_##class_( FT_Library library, \ { serv_id_5, serv_data_5 }, \
FT_ServiceDescRec** output_class) \ { serv_id_6, serv_data_6 }, \
{ \ { NULL, NULL } \
FT_ServiceDescRec* clazz; \ };
FT_Error error; \
FT_Memory memory = library->memory; \
\
if ( FT_ALLOC( clazz, sizeof(*clazz)*5 ) ) \
return error; \
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = NULL; \
clazz[4].serv_data = NULL; \
*output_class = clazz; \
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1, \ #else /* FT_CONFIG_OPTION_PIC */
serv_id_2, serv_data_2, serv_id_3, serv_data_3, serv_id_4, \
serv_data_4, serv_id_5, serv_data_5) \ #define FT_DEFINE_SERVICEDESCREC1( class_, \
void \ serv_id_1, serv_data_1 ) \
FT_Destroy_Class_##class_( FT_Library library, \ void \
FT_ServiceDescRec* clazz ) \ FT_Destroy_Class_ ## class_( FT_Library library, \
{ \ FT_ServiceDescRec* clazz ) \
FT_Memory memory = library->memory; \ { \
if ( clazz ) \ FT_Memory memory = library->memory; \
FT_FREE( clazz ); \ \
} \ \
\ if ( clazz ) \
FT_Error \ FT_FREE( clazz ); \
FT_Create_Class_##class_( FT_Library library, \ } \
FT_ServiceDescRec** output_class) \ \
{ \ FT_Error \
FT_ServiceDescRec* clazz; \ FT_Create_Class_ ## class_( FT_Library library, \
FT_Error error; \ FT_ServiceDescRec** output_class ) \
FT_Memory memory = library->memory; \ { \
\ FT_ServiceDescRec* clazz; \
if ( FT_ALLOC( clazz, sizeof(*clazz)*6 ) ) \ FT_Error error; \
return error; \ FT_Memory memory = library->memory; \
clazz[0].serv_id = serv_id_1; \ \
clazz[0].serv_data = serv_data_1; \ \
clazz[1].serv_id = serv_id_2; \ if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 2 ) ) \
clazz[1].serv_data = serv_data_2; \ return error; \
clazz[2].serv_id = serv_id_3; \ \
clazz[2].serv_data = serv_data_3; \ clazz[0].serv_id = serv_id_1; \
clazz[3].serv_id = serv_id_4; \ clazz[0].serv_data = serv_data_1; \
clazz[3].serv_data = serv_data_4; \ clazz[1].serv_id = NULL; \
clazz[4].serv_id = serv_id_5; \ clazz[1].serv_data = NULL; \
clazz[4].serv_data = serv_data_5; \ \
clazz[5].serv_id = NULL; \ *output_class = clazz; \
clazz[5].serv_data = NULL; \ \
*output_class = clazz; \ return FT_Err_Ok; \
return FT_Err_Ok; \ }
}
#define FT_DEFINE_SERVICEDESCREC2( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 3 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = NULL; \
clazz[2].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC3( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 4 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = NULL; \
clazz[3].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC4( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 5 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = NULL; \
clazz[4].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC5( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class ) \
{ \
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 6 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = serv_id_5; \
clazz[4].serv_data = serv_data_5; \
clazz[5].serv_id = NULL; \
clazz[5].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
#define FT_DEFINE_SERVICEDESCREC6( class_, \
serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, \
serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, \
serv_id_5, serv_data_5, \
serv_id_6, serv_data_6 ) \
void \
FT_Destroy_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
\
\
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_ ## class_( FT_Library library, \
FT_ServiceDescRec** output_class) \
{ \
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
\
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 7 ) ) \
return error; \
\
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = serv_id_5; \
clazz[4].serv_data = serv_data_5; \
clazz[5].serv_id = serv_id_6; \
clazz[5].serv_data = serv_data_6; \
clazz[6].serv_id = NULL; \
clazz[6].serv_data = NULL; \
\
*output_class = clazz; \
\
return FT_Err_Ok; \
}
#endif /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1, \
serv_id_2, serv_data_2, serv_id_3, serv_data_3, \
serv_id_4, serv_data_4, serv_id_5, serv_data_5, \
serv_id_6, serv_data_6) \
void \
FT_Destroy_Class_##class_( FT_Library library, \
FT_ServiceDescRec* clazz ) \
{ \
FT_Memory memory = library->memory; \
if ( clazz ) \
FT_FREE( clazz ); \
} \
\
FT_Error \
FT_Create_Class_##class_( FT_Library library, \
FT_ServiceDescRec** output_class) \
{ \
FT_ServiceDescRec* clazz; \
FT_Error error; \
FT_Memory memory = library->memory; \
\
if ( FT_ALLOC( clazz, sizeof(*clazz)*7 ) ) \
return error; \
clazz[0].serv_id = serv_id_1; \
clazz[0].serv_data = serv_data_1; \
clazz[1].serv_id = serv_id_2; \
clazz[1].serv_data = serv_data_2; \
clazz[2].serv_id = serv_id_3; \
clazz[2].serv_data = serv_data_3; \
clazz[3].serv_id = serv_id_4; \
clazz[3].serv_data = serv_data_4; \
clazz[4].serv_id = serv_id_5; \
clazz[4].serv_data = serv_data_5; \
clazz[5].serv_id = serv_id_6; \
clazz[5].serv_data = serv_data_6; \
clazz[6].serv_id = NULL; \
clazz[6].serv_data = NULL; \
*output_class = clazz; \
return FT_Err_Ok; \
}
#endif /* FT_CONFIG_OPTION_PIC */
/* /*
* Parse a list of FT_ServiceDescRec descriptors and look for * Parse a list of FT_ServiceDescRec descriptors and look for

View file

@ -1,56 +0,0 @@
/* pcftypes.h
FreeType font driver for pcf fonts
Copyright (C) 2000, 2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef __PCFTYPES_H__
#define __PCFTYPES_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
typedef struct PCF_Public_FaceRec_
{
FT_FaceRec root;
FT_StreamRec gzip_stream;
FT_Stream gzip_source;
char* charset_encoding;
char* charset_registry;
} PCF_Public_FaceRec, *PCF_Public_Face;
FT_END_HEADER
#endif /* __PCFTYPES_H__ */
/* END */

View file

@ -688,7 +688,7 @@ FT_BEGIN_HEADER
get_globals_funcs_, get_t1_funcs_, get_t2_funcs_ \ get_globals_funcs_, get_t1_funcs_, get_t2_funcs_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \ #define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \
get_t1_funcs_, get_t2_funcs_) \ get_t1_funcs_, get_t2_funcs_) \
@ -700,9 +700,9 @@ FT_BEGIN_HEADER
clazz->get_globals_funcs = get_globals_funcs_; \ clazz->get_globals_funcs = get_globals_funcs_; \
clazz->get_t1_funcs = get_t1_funcs_; \ clazz->get_t1_funcs = get_t1_funcs_; \
clazz->get_t2_funcs = get_t2_funcs_; \ clazz->get_t2_funcs = get_t2_funcs_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
FT_END_HEADER FT_END_HEADER

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType BDF services (specification). */ /* The FreeType BDF services (specification). */
/* */ /* */
/* Copyright 2003 by */ /* Copyright 2003, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -45,25 +45,30 @@ FT_BEGIN_HEADER
FT_BDF_GetPropertyFunc get_property; FT_BDF_GetPropertyFunc get_property;
}; };
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \ #define FT_DEFINE_SERVICE_BDFRec( class_, \
static const FT_Service_BDFRec class_ = \ get_charset_id_, \
get_property_ ) \
static const FT_Service_BDFRec class_ = \
{ \ { \
get_charset_id_, get_property_ \ get_charset_id_, get_property_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \ #define FT_DEFINE_SERVICE_BDFRec( class_, \
get_charset_id_, \
get_property_ ) \
void \ void \
FT_Init_Class_##class_( FT_Service_BDFRec* clazz ) \ FT_Init_Class_ ## class_( FT_Service_BDFRec* clazz ) \
{ \ { \
clazz->get_charset_id = get_charset_id_; \ clazz->get_charset_id = get_charset_id_; \
clazz->get_property = get_property_; \ clazz->get_property = get_property_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType CID font services (specification). */ /* The FreeType CID font services (specification). */
/* */ /* */
/* Copyright 2007, 2009 by Derek Clegg, Michael Toftdal. */ /* Copyright 2007, 2009, 2012 by Derek Clegg, Michael Toftdal. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
@ -46,30 +46,36 @@ FT_BEGIN_HEADER
FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index; FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index;
}; };
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_, \ #define FT_DEFINE_SERVICE_CIDREC( class_, \
get_is_cid_, get_cid_from_glyph_index_ ) \ get_ros_, \
static const FT_Service_CIDRec class_ = \ get_is_cid_, \
{ \ get_cid_from_glyph_index_ ) \
get_ros_, get_is_cid_, get_cid_from_glyph_index_ \ static const FT_Service_CIDRec class_ = \
{ \
get_ros_, get_is_cid_, get_cid_from_glyph_index_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_, \ #define FT_DEFINE_SERVICE_CIDREC( class_, \
get_is_cid_, get_cid_from_glyph_index_ ) \ get_ros_, \
void \ get_is_cid_, \
FT_Init_Class_##class_( FT_Library library, \ get_cid_from_glyph_index_ ) \
FT_Service_CIDRec* clazz) \ void \
{ \ FT_Init_Class_ ## class_( FT_Library library, \
FT_UNUSED(library); \ FT_Service_CIDRec* clazz ) \
clazz->get_ros = get_ros_; \ { \
clazz->get_is_cid = get_is_cid_; \ FT_UNUSED( library ); \
clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \ \
} clazz->get_ros = get_ros_; \
clazz->get_is_cid = get_is_cid_; \
clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \
}
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType glyph dictionary services (specification). */ /* The FreeType glyph dictionary services (specification). */
/* */ /* */
/* Copyright 2003 by */ /* Copyright 2003, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -51,27 +51,33 @@ FT_BEGIN_HEADER
FT_GlyphDict_NameIndexFunc name_index; /* optional */ FT_GlyphDict_NameIndexFunc name_index; /* optional */
}; };
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \ #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
static const FT_Service_GlyphDictRec class_ = \ get_name_, \
name_index_) \
static const FT_Service_GlyphDictRec class_ = \
{ \ { \
get_name_, name_index_ \ get_name_, name_index_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \ #define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \
get_name_, \
name_index_) \
void \ void \
FT_Init_Class_##class_( FT_Library library, \ FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_GlyphDictRec* clazz) \ FT_Service_GlyphDictRec* clazz ) \
{ \ { \
FT_UNUSED(library); \ FT_UNUSED( library ); \
clazz->get_name = get_name_; \ \
clazz->get_name = get_name_; \
clazz->name_index = name_index_; \ clazz->name_index = name_index_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType Multiple Masters and GX var services (specification). */ /* The FreeType Multiple Masters and GX var services (specification). */
/* */ /* */
/* Copyright 2003, 2004 by */ /* Copyright 2003, 2004, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -68,30 +68,39 @@ FT_BEGIN_HEADER
FT_Set_Var_Design_Func set_var_design; FT_Set_Var_Design_Func set_var_design;
}; };
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_, \ #define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
set_mm_blend_, get_mm_var_, set_var_design_) \ get_mm_, \
static const FT_Service_MultiMastersRec class_ = \ set_mm_design_, \
{ \ set_mm_blend_, \
get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_ \ get_mm_var_, \
set_var_design_ ) \
static const FT_Service_MultiMastersRec class_ = \
{ \
get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_, \ #define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \
set_mm_blend_, get_mm_var_, set_var_design_) \ get_mm_, \
void \ set_mm_design_, \
FT_Init_Class_##class_( FT_Service_MultiMastersRec* clazz ) \ set_mm_blend_, \
{ \ get_mm_var_, \
clazz->get_mm = get_mm_; \ set_var_design_ ) \
clazz->set_mm_design = set_mm_design_; \ void \
clazz->set_mm_blend = set_mm_blend_; \ FT_Init_Class_ ## class_( FT_Service_MultiMastersRec* clazz ) \
clazz->get_mm_var = get_mm_var_; \ { \
clazz->set_var_design = set_var_design_; \ clazz->get_mm = get_mm_; \
} clazz->set_mm_design = set_mm_design_; \
clazz->set_mm_blend = set_mm_blend_; \
clazz->get_mm_var = get_mm_var_; \
clazz->set_var_design = set_var_design_; \
}
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType PostScript name services (specification). */ /* The FreeType PostScript name services (specification). */
/* */ /* */
/* Copyright 2003, 2007 by */ /* Copyright 2003, 2007, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -46,26 +46,28 @@ FT_BEGIN_HEADER
FT_PsName_GetFunc get_ps_font_name; FT_PsName_GetFunc get_ps_font_name;
}; };
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \ #define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \
static const FT_Service_PsFontNameRec class_ = \ static const FT_Service_PsFontNameRec class_ = \
{ \ { \
get_ps_font_name_ \ get_ps_font_name_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \ #define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \
void \ void \
FT_Init_Class_##class_( FT_Library library, \ FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_PsFontNameRec* clazz) \ FT_Service_PsFontNameRec* clazz ) \
{ \ { \
FT_UNUSED(library); \ FT_UNUSED( library ); \
clazz->get_ps_font_name = get_ps_font_name_; \ \
} clazz->get_ps_font_name = get_ps_font_name_; \
}
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType PostScript charmap service (specification). */ /* The FreeType PostScript charmap service (specification). */
/* */ /* */
/* Copyright 2003, 2006 by */ /* Copyright 2003, 2006, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -120,37 +120,50 @@ FT_BEGIN_HEADER
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_PSCMAPSREC(class_, unicode_value_, unicodes_init_, \ #define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
unicodes_char_index_, unicodes_char_next_, macintosh_name_, \ unicode_value_, \
adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_) \ unicodes_init_, \
static const FT_Service_PsCMapsRec class_ = \ unicodes_char_index_, \
{ \ unicodes_char_next_, \
unicode_value_, unicodes_init_, \ macintosh_name_, \
unicodes_char_index_, unicodes_char_next_, macintosh_name_, \ adobe_std_strings_, \
adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \ adobe_std_encoding_, \
adobe_expert_encoding_ ) \
static const FT_Service_PsCMapsRec class_ = \
{ \
unicode_value_, unicodes_init_, \
unicodes_char_index_, unicodes_char_next_, macintosh_name_, \
adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_PSCMAPSREC(class_, unicode_value_, unicodes_init_, \ #define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \
unicodes_char_index_, unicodes_char_next_, macintosh_name_, \ unicode_value_, \
adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_) \ unicodes_init_, \
void \ unicodes_char_index_, \
FT_Init_Class_##class_( FT_Library library, \ unicodes_char_next_, \
FT_Service_PsCMapsRec* clazz) \ macintosh_name_, \
{ \ adobe_std_strings_, \
FT_UNUSED(library); \ adobe_std_encoding_, \
clazz->unicode_value = unicode_value_; \ adobe_expert_encoding_ ) \
clazz->unicodes_init = unicodes_init_; \ void \
clazz->unicodes_char_index = unicodes_char_index_; \ FT_Init_Class_ ## class_( FT_Library library, \
clazz->unicodes_char_next = unicodes_char_next_; \ FT_Service_PsCMapsRec* clazz ) \
clazz->macintosh_name = macintosh_name_; \ { \
clazz->adobe_std_strings = adobe_std_strings_; \ FT_UNUSED( library ); \
clazz->adobe_std_encoding = adobe_std_encoding_; \ \
clazz->adobe_expert_encoding = adobe_expert_encoding_; \ clazz->unicode_value = unicode_value_; \
} clazz->unicodes_init = unicodes_init_; \
clazz->unicodes_char_index = unicodes_char_index_; \
clazz->unicodes_char_next = unicodes_char_next_; \
clazz->macintosh_name = macintosh_name_; \
clazz->adobe_std_strings = adobe_std_strings_; \
clazz->adobe_std_encoding = adobe_std_encoding_; \
clazz->adobe_expert_encoding = adobe_expert_encoding_; \
}
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType PostScript info service (specification). */ /* The FreeType PostScript info service (specification). */
/* */ /* */
/* Copyright 2003, 2004, 2009, 2011 by */ /* Copyright 2003, 2004, 2009, 2011, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -38,7 +38,7 @@ FT_BEGIN_HEADER
PS_FontExtraRec* afont_extra ); PS_FontExtraRec* afont_extra );
typedef FT_Int typedef FT_Int
(*PS_HasGlyphNamesFunc)( FT_Face face ); (*PS_HasGlyphNamesFunc)( FT_Face face );
typedef FT_Error typedef FT_Error
(*PS_GetFontPrivateFunc)( FT_Face face, (*PS_GetFontPrivateFunc)( FT_Face face,
@ -61,35 +61,43 @@ FT_BEGIN_HEADER
PS_GetFontValueFunc ps_get_font_value; PS_GetFontValueFunc ps_get_font_value;
}; };
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_, \ #define FT_DEFINE_SERVICE_PSINFOREC( class_, \
ps_get_font_extra_, has_glyph_names_, get_font_private_, \ get_font_info_, \
get_font_value_) \ ps_get_font_extra_, \
static const FT_Service_PsInfoRec class_ = \ has_glyph_names_, \
get_font_private_, \
get_font_value_ ) \
static const FT_Service_PsInfoRec class_ = \
{ \ { \
get_font_info_, ps_get_font_extra_, has_glyph_names_, \ get_font_info_, ps_get_font_extra_, has_glyph_names_, \
get_font_private_, get_font_value_ \ get_font_private_, get_font_value_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_, \ #define FT_DEFINE_SERVICE_PSINFOREC( class_, \
ps_get_font_extra_, has_glyph_names_, get_font_private_, \ get_font_info_, \
get_font_value_) \ ps_get_font_extra_, \
has_glyph_names_, \
get_font_private_, \
get_font_value_ ) \
void \ void \
FT_Init_Class_##class_( FT_Library library, \ FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_PsInfoRec* clazz) \ FT_Service_PsInfoRec* clazz ) \
{ \ { \
FT_UNUSED(library); \ FT_UNUSED( library ); \
clazz->ps_get_font_info = get_font_info_; \ \
clazz->ps_get_font_extra = ps_get_font_extra_; \ clazz->ps_get_font_info = get_font_info_; \
clazz->ps_has_glyph_names = has_glyph_names_; \ clazz->ps_get_font_extra = ps_get_font_extra_; \
clazz->ps_has_glyph_names = has_glyph_names_; \
clazz->ps_get_font_private = get_font_private_; \ clazz->ps_get_font_private = get_font_private_; \
clazz->ps_get_font_value = get_font_value_; \ clazz->ps_get_font_value = get_font_value_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType SFNT table loading service (specification). */ /* The FreeType SFNT table loading service (specification). */
/* */ /* */
/* Copyright 2003, 2004 by */ /* Copyright 2003, 2004, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -69,26 +69,27 @@ FT_BEGIN_HEADER
FT_SFNT_TableInfoFunc table_info; FT_SFNT_TableInfoFunc table_info;
}; };
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \ #define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \
static const FT_Service_SFNT_TableRec class_ = \ static const FT_Service_SFNT_TableRec class_ = \
{ \ { \
load_, get_, info_ \ load_, get_, info_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \ #define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \
void \ void \
FT_Init_Class_##class_( FT_Service_SFNT_TableRec* clazz ) \ FT_Init_Class_ ## class_( FT_Service_SFNT_TableRec* clazz ) \
{ \ { \
clazz->load_table = load_; \ clazz->load_table = load_; \
clazz->get_table = get_; \ clazz->get_table = get_; \
clazz->table_info = info_; \ clazz->table_info = info_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -7,7 +7,7 @@
/* Copyright 2003 by */ /* Copyright 2003 by */
/* Masatake YAMATO, Redhat K.K. */ /* Masatake YAMATO, Redhat K.K. */
/* */ /* */
/* Copyright 2003, 2008 by */ /* Copyright 2003, 2008, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -31,7 +31,7 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
#define FT_SERVICE_ID_TT_CMAP "tt-cmaps" #define FT_SERVICE_ID_TT_CMAP "tt-cmaps"
/*************************************************************************/ /*************************************************************************/
@ -58,8 +58,8 @@ FT_BEGIN_HEADER
/* */ /* */
typedef struct TT_CMapInfo_ typedef struct TT_CMapInfo_
{ {
FT_ULong language; FT_ULong language;
FT_Long format; FT_Long format;
} TT_CMapInfo; } TT_CMapInfo;
@ -76,24 +76,25 @@ FT_BEGIN_HEADER
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \ #define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \
static const FT_Service_TTCMapsRec class_ = \ static const FT_Service_TTCMapsRec class_ = \
{ \ { \
get_cmap_info_ \ get_cmap_info_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \ #define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \
void \ void \
FT_Init_Class_##class_( FT_Library library, \ FT_Init_Class_ ## class_( FT_Library library, \
FT_Service_TTCMapsRec* clazz) \ FT_Service_TTCMapsRec* clazz ) \
{ \ { \
FT_UNUSED(library); \ FT_UNUSED( library ); \
clazz->get_cmap_info = get_cmap_info_; \ \
} clazz->get_cmap_info = get_cmap_info_; \
}
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType TrueType glyph service. */ /* The FreeType TrueType glyph service. */
/* */ /* */
/* Copyright 2007 by David Turner. */ /* Copyright 2007, 2009, 2012 by David Turner. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
@ -24,7 +24,7 @@
FT_BEGIN_HEADER FT_BEGIN_HEADER
#define FT_SERVICE_ID_TT_GLYF "tt-glyf" #define FT_SERVICE_ID_TT_GLYF "tt-glyf"
typedef FT_ULong typedef FT_ULong
@ -37,24 +37,25 @@ FT_BEGIN_HEADER
TT_Glyf_GetLocationFunc get_location; TT_Glyf_GetLocationFunc get_location;
}; };
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ ) \ #define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
static const FT_Service_TTGlyfRec class_ = \ static const FT_Service_TTGlyfRec class_ = \
{ \ { \
get_location_ \ get_location_ \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ ) \ #define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \
void \ void \
FT_Init_Class_##class_( FT_Service_TTGlyfRec* clazz ) \ FT_Init_Class_ ## class_( FT_Service_TTGlyfRec* clazz ) \
{ \ { \
clazz->get_location = get_location_; \ clazz->get_location = get_location_; \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -757,12 +757,12 @@ FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \ #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \
a, a,
#else #else
#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a)
#endif #endif
#define FT_INTERNAL(a) \ #define FT_INTERNAL(a) \
a, a,
#define FT_DEFINE_SFNT_INTERFACE(class_, \ #define FT_DEFINE_SFNT_INTERFACE(class_, \
goto_table_, init_face_, load_face_, done_face_, get_interface_, \ goto_table_, init_face_, load_face_, done_face_, get_interface_, \
@ -819,7 +819,7 @@ FT_BEGIN_HEADER
FT_INTERNAL(get_metrics_) \ FT_INTERNAL(get_metrics_) \
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \ #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \
@ -885,9 +885,9 @@ FT_BEGIN_HEADER
FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \ FT_INTERNAL(set_sbit_strike,set_sbit_strike_) \
FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \ FT_INTERNAL(load_strike_metrics,load_strike_metrics_) \
FT_INTERNAL(get_metrics,get_metrics_) \ FT_INTERNAL(get_metrics,get_metrics_) \
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
FT_END_HEADER FT_END_HEADER

View file

@ -1401,7 +1401,7 @@ FT_BEGIN_HEADER
FT_Byte* vert_metrics; FT_Byte* vert_metrics;
FT_ULong vert_metrics_size; FT_ULong vert_metrics_size;
FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */ FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */
FT_Byte* glyph_locations; FT_Byte* glyph_locations;
FT_Byte* hdmx_table; FT_Byte* hdmx_table;

View file

@ -570,7 +570,7 @@ FT_BEGIN_HEADER
PS_DICT_NOTICE, /* FT_String* */ PS_DICT_NOTICE, /* FT_String* */
PS_DICT_FULL_NAME, /* FT_String* */ PS_DICT_FULL_NAME, /* FT_String* */
PS_DICT_FAMILY_NAME, /* FT_String* */ PS_DICT_FAMILY_NAME, /* FT_String* */
PS_DICT_WEIGHT, /* FT_String */ PS_DICT_WEIGHT, /* FT_String* */
PS_DICT_IS_FIXED_PITCH, /* FT_Bool */ PS_DICT_IS_FIXED_PITCH, /* FT_Bool */
PS_DICT_UNDERLINE_POSITION, /* FT_Short */ PS_DICT_UNDERLINE_POSITION, /* FT_Short */
PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */ PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */

View file

@ -1,6 +1,6 @@
# modules.cfg # modules.cfg
# #
# Copyright 2005, 2006, 2007, 2009, 2010 by # Copyright 2005-2007, 2009-2011 by
# David Turner, Robert Wilhelm, and Werner Lemberg. # David Turner, Robert Wilhelm, and Werner Lemberg.
# #
# This file is part of the FreeType project, and may only be used, modified, # This file is part of the FreeType project, and may only be used, modified,
@ -54,7 +54,7 @@ FONT_MODULES += pfr
# PostScript Type 42 font driver. # PostScript Type 42 font driver.
# #
# This driver needs the `truetype' module. # This driver needs the `truetype' and `psaux' modules.
FONT_MODULES += type42 FONT_MODULES += type42
# Windows FONT/FNT font driver. See optional extension ftwinfnt.c below # Windows FONT/FNT font driver. See optional extension ftwinfnt.c below

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Auto-fitter hinting routines for CJK script (body). */ /* Auto-fitter hinting routines for CJK script (body). */
/* */ /* */
/* Copyright 2006-2011 by */ /* Copyright 2006-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -1610,7 +1610,7 @@
goto Exit; goto Exit;
} }
offset = cur_len % 64; offset = cur_len & 63;
if ( offset < 32 ) if ( offset < 32 )
{ {
@ -2225,11 +2225,11 @@
}; };
AF_DEFINE_SCRIPT_CLASS(af_cjk_script_class, AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class,
AF_SCRIPT_CJK, AF_SCRIPT_CJK,
af_cjk_uniranges, af_cjk_uniranges,
sizeof( AF_CJKMetricsRec ), sizeof ( AF_CJKMetricsRec ),
(AF_Script_InitMetricsFunc) af_cjk_metrics_init, (AF_Script_InitMetricsFunc) af_cjk_metrics_init,
(AF_Script_ScaleMetricsFunc)af_cjk_metrics_scale, (AF_Script_ScaleMetricsFunc)af_cjk_metrics_scale,
@ -2247,11 +2247,11 @@
}; };
AF_DEFINE_SCRIPT_CLASS(af_cjk_script_class, AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class,
AF_SCRIPT_CJK, AF_SCRIPT_CJK,
af_cjk_uniranges, af_cjk_uniranges,
sizeof( AF_CJKMetricsRec ), sizeof ( AF_CJKMetricsRec ),
(AF_Script_InitMetricsFunc) NULL, (AF_Script_InitMetricsFunc) NULL,
(AF_Script_ScaleMetricsFunc)NULL, (AF_Script_ScaleMetricsFunc)NULL,

View file

@ -47,7 +47,7 @@
AF_SCRIPT_NONE, AF_SCRIPT_NONE,
NULL, NULL,
sizeof( AF_ScriptMetricsRec ), sizeof ( AF_ScriptMetricsRec ),
(AF_Script_InitMetricsFunc) NULL, (AF_Script_InitMetricsFunc) NULL,
(AF_Script_ScaleMetricsFunc)NULL, (AF_Script_ScaleMetricsFunc)NULL,

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Autofitter error codes (specification only). */ /* Autofitter error codes (specification only). */
/* */ /* */
/* Copyright 2005 by */ /* Copyright 2005, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -30,6 +30,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX AF_Err_ #define FT_ERR_PREFIX AF_Err_
#define FT_ERR_BASE FT_Mod_Err_Autofit #define FT_ERR_BASE FT_Mod_Err_Autofit

View file

@ -43,7 +43,7 @@
#endif #endif
&af_latin_script_class, &af_latin_script_class,
&af_cjk_script_class, &af_cjk_script_class,
&af_indic_script_class, &af_indic_script_class,
NULL /* do not remove */ NULL /* do not remove */
}; };

View file

@ -113,11 +113,11 @@
}; };
AF_DEFINE_SCRIPT_CLASS(af_indic_script_class, AF_DEFINE_SCRIPT_CLASS( af_indic_script_class,
AF_SCRIPT_INDIC, AF_SCRIPT_INDIC,
af_indic_uniranges, af_indic_uniranges,
sizeof( AF_CJKMetricsRec ), sizeof ( AF_CJKMetricsRec ),
(AF_Script_InitMetricsFunc) af_indic_metrics_init, (AF_Script_InitMetricsFunc) af_indic_metrics_init,
(AF_Script_ScaleMetricsFunc)af_indic_metrics_scale, (AF_Script_ScaleMetricsFunc)af_indic_metrics_scale,
@ -135,11 +135,11 @@
}; };
AF_DEFINE_SCRIPT_CLASS(af_indic_script_class, AF_DEFINE_SCRIPT_CLASS( af_indic_script_class,
AF_SCRIPT_INDIC, AF_SCRIPT_INDIC,
af_indic_uniranges, af_indic_uniranges,
sizeof( AF_CJKMetricsRec ), sizeof ( AF_CJKMetricsRec ),
(AF_Script_InitMetricsFunc) NULL, (AF_Script_InitMetricsFunc) NULL,
(AF_Script_ScaleMetricsFunc)NULL, (AF_Script_ScaleMetricsFunc)NULL,

View file

@ -2341,11 +2341,11 @@
}; };
AF_DEFINE_SCRIPT_CLASS(af_latin_script_class, AF_DEFINE_SCRIPT_CLASS( af_latin_script_class,
AF_SCRIPT_LATIN, AF_SCRIPT_LATIN,
af_latin_uniranges, af_latin_uniranges,
sizeof( AF_LatinMetricsRec ), sizeof ( AF_LatinMetricsRec ),
(AF_Script_InitMetricsFunc) af_latin_metrics_init, (AF_Script_InitMetricsFunc) af_latin_metrics_init,
(AF_Script_ScaleMetricsFunc)af_latin_metrics_scale, (AF_Script_ScaleMetricsFunc)af_latin_metrics_scale,

View file

@ -133,7 +133,7 @@
dist = -dist; dist = -dist;
if ( num_widths < AF_LATIN_MAX_WIDTHS ) if ( num_widths < AF_LATIN_MAX_WIDTHS )
axis->widths[ num_widths++ ].org = dist; axis->widths[num_widths++].org = dist;
} }
} }
@ -1359,10 +1359,10 @@
af_latin2_hints_compute_blue_edges( AF_GlyphHints hints, af_latin2_hints_compute_blue_edges( AF_GlyphHints hints,
AF_LatinMetrics metrics ) AF_LatinMetrics metrics )
{ {
AF_AxisHints axis = &hints->axis[ AF_DIMENSION_VERT ]; AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT];
AF_Edge edge = axis->edges; AF_Edge edge = axis->edges;
AF_Edge edge_limit = edge + axis->num_edges; AF_Edge edge_limit = edge + axis->num_edges;
AF_LatinAxis latin = &metrics->axis[ AF_DIMENSION_VERT ]; AF_LatinAxis latin = &metrics->axis[AF_DIMENSION_VERT];
FT_Fixed scale = latin->scale; FT_Fixed scale = latin->scale;
FT_Pos best_dist0; /* initial threshold */ FT_Pos best_dist0; /* initial threshold */
@ -2356,11 +2356,11 @@
}; };
AF_DEFINE_SCRIPT_CLASS(af_latin2_script_class, AF_DEFINE_SCRIPT_CLASS( af_latin2_script_class,
AF_SCRIPT_LATIN2, AF_SCRIPT_LATIN2,
af_latin2_uniranges, af_latin2_uniranges,
sizeof( AF_LatinMetricsRec ), sizeof ( AF_LatinMetricsRec ),
(AF_Script_InitMetricsFunc) af_latin2_metrics_init, (AF_Script_InitMetricsFunc) af_latin2_metrics_init,
(AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale, (AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale,

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Auto-fitter glyph loading routines (body). */ /* Auto-fitter glyph loading routines (body). */
/* */ /* */
/* Copyright 2003-2009, 2011 by */ /* Copyright 2003-2009, 2011-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -433,9 +433,10 @@
slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
x_scale ); x_scale );
#else #else
if ( FT_IS_FIXED_WIDTH( slot->face ) || if ( scaler->render_mode != FT_RENDER_MODE_LIGHT &&
( af_face_globals_is_digit( loader->globals, glyph_index ) && ( FT_IS_FIXED_WIDTH( slot->face ) ||
metrics->digits_have_same_width ) ) ( af_face_globals_is_digit( loader->globals, glyph_index ) &&
metrics->digits_have_same_width ) ) )
{ {
slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
metrics->scaler.x_scale ); metrics->scaler.x_scale );
@ -465,7 +466,13 @@
if ( error ) if ( error )
goto Exit; goto Exit;
slot->outline = internal->loader->base.outline; /* reassign all outline fields except flags to protect them */
slot->outline.n_contours = internal->loader->base.outline.n_contours;
slot->outline.n_points = internal->loader->base.outline.n_points;
slot->outline.points = internal->loader->base.outline.points;
slot->outline.tags = internal->loader->base.outline.tags;
slot->outline.contours = internal->loader->base.outline.contours;
slot->format = FT_GLYPH_FORMAT_OUTLINE; slot->format = FT_GLYPH_FORMAT_OUTLINE;
} }
@ -480,7 +487,7 @@
af_loader_load_glyph( AF_Loader loader, af_loader_load_glyph( AF_Loader loader,
FT_Face face, FT_Face face,
FT_UInt gindex, FT_UInt gindex,
FT_UInt32 load_flags ) FT_Int32 load_flags )
{ {
FT_Error error; FT_Error error;
FT_Size size = face->size; FT_Size size = face->size;

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Auto-fitter glyph loading routines (specification). */ /* Auto-fitter glyph loading routines (specification). */
/* */ /* */
/* Copyright 2003-2005, 2011 by */ /* Copyright 2003-2005, 2011-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -60,7 +60,7 @@ FT_BEGIN_HEADER
af_loader_load_glyph( AF_Loader loader, af_loader_load_glyph( AF_Loader loader,
FT_Face face, FT_Face face,
FT_UInt gindex, FT_UInt gindex,
FT_UInt32 load_flags ); FT_Int32 load_flags );
/* */ /* */

View file

@ -20,16 +20,20 @@
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include "afpic.h" #include "afpic.h"
#include "aferrors.h"
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
/* forward declaration of PIC init functions from afmodule.c */ /* forward declaration of PIC init functions from afmodule.c */
void FT_Init_Class_af_autofitter_service( FT_Library, void FT_Init_Class_af_autofitter_service(
FT_AutoHinter_ServiceRec* ); FT_Library library,
FT_AutoHinter_ServiceRec* clazz );
/* forward declaration of PIC init functions from script classes */ /* forward declaration of PIC init functions from script classes */
#include "aflatin.h" #include "aflatin.h"
#ifdef FT_OPTION_AUTOFIT2
#include "aflatin2.h" #include "aflatin2.h"
#endif
#include "afcjk.h" #include "afcjk.h"
#include "afdummy.h" #include "afdummy.h"
#include "afindic.h" #include "afindic.h"
@ -73,7 +77,7 @@
&container->af_script_classes_rec[ss]; &container->af_script_classes_rec[ss];
} }
container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL; container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL;
/* add call to initialization function when you add new scripts */ /* add call to initialization function when you add new scripts */
ss = 0; ss = 0;
FT_Init_Class_af_dummy_script_class( FT_Init_Class_af_dummy_script_class(

View file

@ -19,7 +19,7 @@
#ifndef __AFPIC_H__ #ifndef __AFPIC_H__
#define __AFPIC_H__ #define __AFPIC_H__
FT_BEGIN_HEADER FT_BEGIN_HEADER
#include FT_INTERNAL_PIC_H #include FT_INTERNAL_PIC_H
@ -38,9 +38,9 @@ FT_BEGIN_HEADER
#ifdef FT_OPTION_AUTOFIT2 #ifdef FT_OPTION_AUTOFIT2
#define AF_SCRIPT_CLASSES_COUNT 6 #define AF_SCRIPT_CLASSES_COUNT 6
#else #else
#define AF_SCRIPT_CLASSES_COUNT 5 #define AF_SCRIPT_CLASSES_COUNT 5
#endif #endif
#define AF_SCRIPT_CLASSES_REC_COUNT ( AF_SCRIPT_CLASSES_COUNT - 1 ) #define AF_SCRIPT_CLASSES_REC_COUNT ( AF_SCRIPT_CLASSES_COUNT - 1 )
typedef struct AFModulePIC_ typedef struct AFModulePIC_
{ {
@ -57,6 +57,13 @@ FT_BEGIN_HEADER
#define AF_AF_AUTOFITTER_SERVICE_GET \ #define AF_AF_AUTOFITTER_SERVICE_GET \
( GET_PIC( library )->af_autofitter_service ) ( GET_PIC( library )->af_autofitter_service )
/* see afpic.c for the implementation */
void
autofit_module_class_pic_free( FT_Library library );
FT_Error
autofit_module_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -231,7 +231,7 @@ extern void* _af_debug_hints;
AF_SCRIPT_NONE = 0, AF_SCRIPT_NONE = 0,
AF_SCRIPT_LATIN = 1, AF_SCRIPT_LATIN = 1,
AF_SCRIPT_CJK = 2, AF_SCRIPT_CJK = 2,
AF_SCRIPT_INDIC = 3, AF_SCRIPT_INDIC = 3,
#ifdef FT_OPTION_AUTOFIT2 #ifdef FT_OPTION_AUTOFIT2
AF_SCRIPT_LATIN2, AF_SCRIPT_LATIN2,
#endif #endif

View file

@ -352,7 +352,7 @@
{ {
FT_Fixed best_scale = warper->best_scale; FT_Fixed best_scale = warper->best_scale;
FT_Pos best_delta = warper->best_delta; FT_Pos best_delta = warper->best_delta;
hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale ) hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale )
+ best_delta; + best_delta;

View file

@ -24,18 +24,24 @@
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
/* forward declaration of PIC init functions from ftglyph.c */ /* forward declaration of PIC init functions from ftglyph.c */
void FT_Init_Class_ft_outline_glyph_class(FT_Glyph_Class*); void FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz );
void FT_Init_Class_ft_bitmap_glyph_class(FT_Glyph_Class*); void FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz );
/* forward declaration of PIC init function from ftrfork.c (not modularized) */
void FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec* record );
/* forward declaration of PIC init functions from ftinit.c */ /* forward declaration of PIC init functions from ftinit.c */
FT_Error ft_create_default_module_classes(FT_Library); FT_Error
void ft_destroy_default_module_classes(FT_Library); ft_create_default_module_classes( FT_Library library );
void void
ft_base_pic_free( FT_Library library ) ft_destroy_default_module_classes( FT_Library library );
void
ft_base_pic_free( FT_Library library )
{ {
FT_PIC_Container* pic_container = &library->pic_container; FT_PIC_Container* pic_container = &library->pic_container;
FT_Memory memory = library->memory; FT_Memory memory = library->memory;
if ( pic_container->base ) if ( pic_container->base )
{ {
/* Destroy default module classes (in case FT_Add_Default_Modules was used) */ /* Destroy default module classes (in case FT_Add_Default_Modules was used) */
@ -48,17 +54,17 @@
FT_Error FT_Error
ft_base_pic_init( FT_Library library ) ft_base_pic_init( FT_Library library )
{ {
FT_PIC_Container* pic_container = &library->pic_container; FT_PIC_Container* pic_container = &library->pic_container;
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
BasePIC* container; BasePIC* container;
FT_Memory memory = library->memory; FT_Memory memory = library->memory;
/* allocate pointer, clear and set global container pointer */ /* allocate pointer, clear and set global container pointer */
if ( FT_ALLOC ( container, sizeof ( *container ) ) ) if ( FT_ALLOC ( container, sizeof ( *container ) ) )
return error; return error;
FT_MEM_SET( container, 0, sizeof(*container) ); FT_MEM_SET( container, 0, sizeof ( *container ) );
pic_container->base = container; pic_container->base = container;
/* initialize default modules list and pointers */ /* initialize default modules list and pointers */
@ -67,12 +73,16 @@
goto Exit; goto Exit;
/* initialize pointer table - this is how the module usually expects this data */ /* initialize pointer table - this is how the module usually expects this data */
FT_Init_Class_ft_outline_glyph_class(&container->ft_outline_glyph_class); FT_Init_Class_ft_outline_glyph_class(
FT_Init_Class_ft_bitmap_glyph_class(&container->ft_bitmap_glyph_class); &container->ft_outline_glyph_class );
FT_Init_Class_ft_bitmap_glyph_class(
&container->ft_bitmap_glyph_class );
FT_Init_Table_raccess_guess_table(
(ft_raccess_guess_rec*)&container->ft_raccess_guess_table);
Exit: Exit:
if(error) if( error )
ft_base_pic_free(library); ft_base_pic_free( library );
return error; return error;
} }

View file

@ -19,7 +19,7 @@
#ifndef __BASEPIC_H__ #ifndef __BASEPIC_H__
#define __BASEPIC_H__ #define __BASEPIC_H__
FT_BEGIN_HEADER FT_BEGIN_HEADER
#include FT_INTERNAL_PIC_H #include FT_INTERNAL_PIC_H
@ -28,28 +28,43 @@ FT_BEGIN_HEADER
#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class #define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class
#define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class #define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class
#define FT_DEFAULT_MODULES_GET ft_default_modules #define FT_DEFAULT_MODULES_GET ft_default_modules
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table
#endif
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#include FT_GLYPH_H #include FT_GLYPH_H
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
#include FT_INTERNAL_RFORK_H
#endif
typedef struct BasePIC_ typedef struct BasePIC_
{ {
FT_Module_Class** default_module_classes; FT_Module_Class** default_module_classes;
FT_Glyph_Class ft_outline_glyph_class; FT_Glyph_Class ft_outline_glyph_class;
FT_Glyph_Class ft_bitmap_glyph_class; FT_Glyph_Class ft_bitmap_glyph_class;
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES];
#endif
} BasePIC; } BasePIC;
#define GET_PIC(lib) ((BasePIC*)((lib)->pic_container.base)) #define GET_PIC(lib) ((BasePIC*)((lib)->pic_container.base))
#define FT_OUTLINE_GLYPH_CLASS_GET (&GET_PIC(library)->ft_outline_glyph_class) #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_BITMAP_GLYPH_CLASS_GET (&GET_PIC(library)->ft_bitmap_glyph_class)
#define FT_DEFAULT_MODULES_GET (GET_PIC(library)->default_module_classes) #define FT_DEFAULT_MODULES_GET (GET_PIC(library)->default_module_classes)
#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
#define FT_RACCESS_GUESS_TABLE_GET (GET_PIC(library)->ft_raccess_guess_table)
#endif
/* see basepic.c for the implementation. */
void void
ft_base_pic_free( FT_Library library ); ft_base_pic_free( FT_Library library );
FT_Error FT_Error
ft_base_pic_init( FT_Library library ); ft_base_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Quick computation of advance widths (body). */ /* Quick computation of advance widths (body). */
/* */ /* */
/* Copyright 2008, 2009 by */ /* Copyright 2008, 2009, 2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -129,7 +129,7 @@
{ {
error = func( face, start, count, flags, padvances ); error = func( face, start, count, flags, padvances );
if ( !error ) if ( !error )
goto Exit; return _ft_face_scale_advances( face, padvances, count, flags );
if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) )
return error; return error;
@ -147,16 +147,13 @@
if ( error ) if ( error )
break; break;
/* scale from 26.6 to 16.16 */
padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT )
? face->glyph->advance.y ? face->glyph->advance.y << 10
: face->glyph->advance.x; : face->glyph->advance.x << 10;
} }
if ( error ) return error;
return error;
Exit:
return _ft_face_scale_advances( face, padvances, count, flags );
} }

View file

@ -34,7 +34,7 @@
#include "fttrigon.c" #include "fttrigon.c"
#include "ftutil.c" #include "ftutil.c"
#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON ) #ifdef FT_MACINTOSH
#include "ftmac.c" #include "ftmac.c"
#endif #endif

View file

@ -49,15 +49,15 @@ FT_BEGIN_HEADER
FT_Face *aface ); FT_Face *aface );
#if defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \ #if defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \
( !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) ) !defined( FT_MACINTOSH )
/* Mac OS X/Darwin kernel often changes recommended method to access */ /* Mac OS X/Darwin kernel often changes recommended method to access */
/* the resource fork and older methods makes the kernel issue the */ /* the resource fork and older methods makes the kernel issue the */
/* warning of deprecated method. To calm it down, the methods based */ /* warning of deprecated method. To calm it down, the methods based */
/* on Darwin VFS should be grouped and skip the rest methods after */ /* on Darwin VFS should be grouped and skip the rest methods after */
/* the case the resource is opened but found to lack a font in it. */ /* the case the resource is opened but found to lack a font in it. */
FT_LOCAL( FT_Bool ) FT_LOCAL( FT_Bool )
raccess_rule_by_darwin_vfs( FT_UInt rule_index ); ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index );
#endif #endif

View file

@ -231,7 +231,7 @@
if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) || if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) ||
( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) ) ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6; xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6;
ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6; ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6;

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Arithmetic computations (body). */ /* Arithmetic computations (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ /* Copyright 1996-2006, 2008, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -307,7 +307,7 @@
q <<= 1; q <<= 1;
r |= lo >> 31; r |= lo >> 31;
if ( r >= (FT_UInt32)y ) if ( r >= y )
{ {
r -= y; r -= y;
q |= 1; q |= 1;
@ -373,7 +373,7 @@
if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 ) if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 )
a = ( a * b + ( c >> 1 ) ) / c; a = ( a * b + ( c >> 1 ) ) / c;
else if ( c > 0 ) else if ( (FT_Int32)c > 0 )
{ {
FT_Int64 temp, temp2; FT_Int64 temp, temp2;
@ -412,7 +412,7 @@
if ( a <= 46340L && b <= 46340L && c > 0 ) if ( a <= 46340L && b <= 46340L && c > 0 )
a = a * b / c; a = a * b / c;
else if ( c > 0 ) else if ( (FT_Int32)c > 0 )
{ {
FT_Int64 temp; FT_Int64 temp;
@ -464,7 +464,7 @@
* Unfortunately, it doesn't work (at least not portably). * Unfortunately, it doesn't work (at least not portably).
* *
* It makes the assumption that right-shift on a negative signed value * It makes the assumption that right-shift on a negative signed value
* fills the leftmost bits by copying the sign bit. This is wrong. * fills the leftmost bits by copying the sign bit. This is wrong.
* According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206, * According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206,
* the result of right-shift of a negative signed value is * the result of right-shift of a negative signed value is
* implementation-defined. At least one implementation fills the * implementation-defined. At least one implementation fills the
@ -544,7 +544,7 @@
s = (FT_Int32)a; a = FT_ABS( a ); s = (FT_Int32)a; a = FT_ABS( a );
s ^= (FT_Int32)b; b = FT_ABS( b ); s ^= (FT_Int32)b; b = FT_ABS( b );
if ( b == 0 ) if ( (FT_UInt32)b == 0 )
{ {
/* check for division by 0 */ /* check for division by 0 */
q = (FT_UInt32)0x7FFFFFFFL; q = (FT_UInt32)0x7FFFFFFFL;
@ -552,15 +552,16 @@
else if ( ( a >> 16 ) == 0 ) else if ( ( a >> 16 ) == 0 )
{ {
/* compute result directly */ /* compute result directly */
q = (FT_UInt32)( (a << 16) + (b >> 1) ) / (FT_UInt32)b; q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b;
} }
else else
{ {
/* we need more bits; we have to do it by hand */ /* we need more bits; we have to do it by hand */
FT_Int64 temp, temp2; FT_Int64 temp, temp2;
temp.hi = (FT_Int32) (a >> 16);
temp.lo = (FT_UInt32)(a << 16); temp.hi = (FT_Int32) ( a >> 16 );
temp.lo = (FT_UInt32)( a << 16 );
temp2.hi = 0; temp2.hi = 0;
temp2.lo = (FT_UInt32)( b >> 1 ); temp2.lo = (FT_UInt32)( b >> 1 );
FT_Add64( &temp, &temp2, &temp ); FT_Add64( &temp, &temp2, &temp );

View file

@ -254,7 +254,7 @@
} }
FT_DEFINE_GLYPH( ft_outline_glyph_class, FT_DEFINE_GLYPH( ft_outline_glyph_class,
sizeof ( FT_OutlineGlyphRec ), sizeof ( FT_OutlineGlyphRec ),
FT_GLYPH_FORMAT_OUTLINE, FT_GLYPH_FORMAT_OUTLINE,
@ -512,42 +512,42 @@
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
FT_Glyph glyph; FT_Glyph glyph;
FT_BitmapGlyph bitmap = NULL; FT_BitmapGlyph bitmap = NULL;
const FT_Glyph_Class* clazz; const FT_Glyph_Class* clazz;
#ifdef FT_CONFIG_OPTION_PIC /* FT_BITMAP_GLYPH_CLASS_GET derefers `library' in PIC mode */
FT_Library library = FT_GLYPH( glyph )->library; FT_Library library;
#endif
/* check argument */ /* check argument */
if ( !the_glyph ) if ( !the_glyph )
goto Bad; goto Bad;
/* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
/* then calling FT_Render_Glyph_Internal() */
glyph = *the_glyph; glyph = *the_glyph;
if ( !glyph ) if ( !glyph )
goto Bad; goto Bad;
clazz = glyph->clazz; clazz = glyph->clazz;
library = glyph->library;
if ( !library || !clazz )
goto Bad;
/* when called with a bitmap glyph, do nothing and return successfully */ /* when called with a bitmap glyph, do nothing and return successfully */
if ( clazz == FT_BITMAP_GLYPH_CLASS_GET ) if ( clazz == FT_BITMAP_GLYPH_CLASS_GET )
goto Exit; goto Exit;
if ( !clazz || !clazz->glyph_prepare ) if ( !clazz->glyph_prepare )
goto Bad; goto Bad;
/* we render the glyph into a glyph bitmap using a `dummy' glyph slot */
/* then calling FT_Render_Glyph_Internal() */
FT_MEM_ZERO( &dummy, sizeof ( dummy ) ); FT_MEM_ZERO( &dummy, sizeof ( dummy ) );
FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) ); FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) );
dummy.internal = &dummy_internal; dummy.internal = &dummy_internal;
dummy.library = glyph->library; dummy.library = library;
dummy.format = clazz->glyph_format; dummy.format = clazz->glyph_format;
/* create result bitmap glyph */ /* create result bitmap glyph */
error = ft_new_glyph( glyph->library, FT_BITMAP_GLYPH_CLASS_GET, error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET,
(FT_Glyph*)(void*)&bitmap ); (FT_Glyph*)(void*)&bitmap );
if ( error ) if ( error )
goto Exit; goto Exit;

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType initialization layer (body). */ /* FreeType initialization layer (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2005, 2007, 2009 by */ /* Copyright 1996-2001, 2002, 2005, 2007, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -54,8 +54,10 @@
#undef FT_COMPONENT #undef FT_COMPONENT
#define FT_COMPONENT trace_init #define FT_COMPONENT trace_init
#ifndef FT_CONFIG_OPTION_PIC #ifndef FT_CONFIG_OPTION_PIC
#undef FT_USE_MODULE #undef FT_USE_MODULE
#ifdef __cplusplus #ifdef __cplusplus
#define FT_USE_MODULE( type, x ) extern "C" const type x; #define FT_USE_MODULE( type, x ) extern "C" const type x;
@ -63,10 +65,8 @@
#define FT_USE_MODULE( type, x ) extern const type x; #define FT_USE_MODULE( type, x ) extern const type x;
#endif #endif
#include FT_CONFIG_MODULES_H #include FT_CONFIG_MODULES_H
#undef FT_USE_MODULE #undef FT_USE_MODULE
#define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x), #define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x),
@ -77,8 +77,10 @@
0 0
}; };
#else /* FT_CONFIG_OPTION_PIC */ #else /* FT_CONFIG_OPTION_PIC */
#ifdef __cplusplus #ifdef __cplusplus
#define FT_EXTERNC extern "C" #define FT_EXTERNC extern "C"
#else #else
@ -87,16 +89,19 @@
/* declare the module's class creation/destruction functions */ /* declare the module's class creation/destruction functions */
#undef FT_USE_MODULE #undef FT_USE_MODULE
#define FT_USE_MODULE( type, x ) \ #define FT_USE_MODULE( type, x ) \
FT_EXTERNC FT_Error FT_Create_Class_##x( FT_Library library, FT_Module_Class** output_class ); \ FT_EXTERNC FT_Error \
FT_EXTERNC void FT_Destroy_Class_##x( FT_Library library, FT_Module_Class* clazz ); FT_Create_Class_ ## x( FT_Library library, \
FT_Module_Class* *output_class ); \
FT_EXTERNC void \
FT_Destroy_Class_ ## x( FT_Library library, \
FT_Module_Class* clazz );
#include FT_CONFIG_MODULES_H #include FT_CONFIG_MODULES_H
/* count all module classes */ /* count all module classes */
#undef FT_USE_MODULE #undef FT_USE_MODULE
#define FT_USE_MODULE( type, x ) MODULE_CLASS_##x, #define FT_USE_MODULE( type, x ) MODULE_CLASS_ ## x,
enum enum
{ {
@ -104,26 +109,31 @@
FT_NUM_MODULE_CLASSES FT_NUM_MODULE_CLASSES
}; };
/* destroy all module classes */ /* destroy all module classes */
#undef FT_USE_MODULE #undef FT_USE_MODULE
#define FT_USE_MODULE( type, x ) \ #define FT_USE_MODULE( type, x ) \
if ( classes[i] ) { FT_Destroy_Class_##x(library, classes[i]); } \ if ( classes[i] ) \
i++; \ { \
FT_Destroy_Class_ ## x( library, classes[i] ); \
} \
i++;
FT_BASE_DEF( void ) FT_BASE_DEF( void )
ft_destroy_default_module_classes( FT_Library library ) ft_destroy_default_module_classes( FT_Library library )
{ {
FT_Module_Class** classes; FT_Module_Class* *classes;
FT_Memory memory; FT_Memory memory;
FT_UInt i; FT_UInt i;
BasePIC* pic_container = (BasePIC*)library->pic_container.base; BasePIC* pic_container = (BasePIC*)library->pic_container.base;
if ( !pic_container->default_module_classes ) if ( !pic_container->default_module_classes )
return; return;
memory = library->memory; memory = library->memory;
classes = pic_container->default_module_classes; classes = pic_container->default_module_classes;
i = 0; i = 0;
#include FT_CONFIG_MODULES_H #include FT_CONFIG_MODULES_H
@ -131,30 +141,37 @@
pic_container->default_module_classes = 0; pic_container->default_module_classes = 0;
} }
/* initialize all module classes and the pointer table */ /* initialize all module classes and the pointer table */
#undef FT_USE_MODULE #undef FT_USE_MODULE
#define FT_USE_MODULE( type, x ) \ #define FT_USE_MODULE( type, x ) \
error = FT_Create_Class_##x(library, &clazz); \ error = FT_Create_Class_ ## x( library, &clazz ); \
if (error) goto Exit; \ if ( error ) \
goto Exit; \
classes[i++] = clazz; classes[i++] = clazz;
FT_BASE_DEF( FT_Error ) FT_BASE_DEF( FT_Error )
ft_create_default_module_classes( FT_Library library ) ft_create_default_module_classes( FT_Library library )
{ {
FT_Error error; FT_Error error;
FT_Memory memory; FT_Memory memory;
FT_Module_Class** classes; FT_Module_Class* *classes;
FT_Module_Class* clazz; FT_Module_Class* clazz;
FT_UInt i; FT_UInt i;
BasePIC* pic_container = (BasePIC*)library->pic_container.base; BasePIC* pic_container = (BasePIC*)library->pic_container.base;
memory = library->memory;
memory = library->memory;
pic_container->default_module_classes = 0; pic_container->default_module_classes = 0;
if ( FT_ALLOC(classes, sizeof(FT_Module_Class*) * (FT_NUM_MODULE_CLASSES + 1) ) ) if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) *
( FT_NUM_MODULE_CLASSES + 1 ) ) )
return error; return error;
/* initialize all pointers to 0, especially the last one */ /* initialize all pointers to 0, especially the last one */
for (i = 0; i < FT_NUM_MODULE_CLASSES; i++) for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ )
classes[i] = 0; classes[i] = 0;
classes[FT_NUM_MODULE_CLASSES] = 0; classes[FT_NUM_MODULE_CLASSES] = 0;
@ -162,16 +179,19 @@
#include FT_CONFIG_MODULES_H #include FT_CONFIG_MODULES_H
Exit: Exit:
if (error) ft_destroy_default_module_classes( library ); if ( error )
else pic_container->default_module_classes = classes; ft_destroy_default_module_classes( library );
else
pic_container->default_module_classes = classes;
return error; return error;
} }
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* documentation is in ftmodapi.h */ /* documentation is in ftmodapi.h */
FT_EXPORT_DEF( void ) FT_EXPORT_DEF( void )
@ -181,9 +201,18 @@ Exit:
const FT_Module_Class* const* cur; const FT_Module_Class* const* cur;
/* test for valid `library' delayed to FT_Add_Module() */ /* FT_DEFAULT_MODULES_GET dereferences `library' in PIC mode */
#ifdef FT_CONFIG_OPTION_PIC
if ( !library )
return;
#endif
cur = FT_DEFAULT_MODULES_GET; /* GCC 4.6 warns the type difference:
* FT_Module_Class** != const FT_Module_Class* const*
*/
cur = (const FT_Module_Class* const*)FT_DEFAULT_MODULES_GET;
/* test for valid `library' delayed to FT_Add_Module() */
while ( *cur ) while ( *cur )
{ {
error = FT_Add_Module( library, *cur ); error = FT_Add_Module( library, *cur );

View file

@ -119,6 +119,8 @@
#endif #endif
#ifdef FT_MACINTOSH
/* This function is deprecated because FSSpec is deprecated in Mac OS X */ /* This function is deprecated because FSSpec is deprecated in Mac OS X */
FT_EXPORT_DEF( FT_Error ) FT_EXPORT_DEF( FT_Error )
FT_GetFile_From_Mac_Name( const char* fontName, FT_GetFile_From_Mac_Name( const char* fontName,
@ -144,7 +146,7 @@
{ {
#if defined( MAC_OS_X_VERSION_10_5 ) && \ #if defined( MAC_OS_X_VERSION_10_5 ) && \
( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
OSStatus err; OSStatus err;
err = ATSFontGetFileReference( ats_font_id, ats_font_ref ); err = ATSFontGetFileReference( ats_font_id, ats_font_ref );
@ -1053,5 +1055,7 @@
#endif #endif
} }
#endif /* FT_MACINTOSH */
/* END */ /* END */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* The FreeType private base classes (body). */ /* The FreeType private base classes (body). */
/* */ /* */
/* Copyright 1996-2011 by */ /* Copyright 1996-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -445,6 +445,10 @@
else else
prev->next = cur->next; prev->next = cur->next;
/* finalize client-specific data */
if ( slot->generic.finalizer )
slot->generic.finalizer( slot );
ft_glyphslot_done( slot ); ft_glyphslot_done( slot );
FT_FREE( slot ); FT_FREE( slot );
break; break;
@ -1187,7 +1191,7 @@
/* there's a Mac-specific extended implementation of FT_New_Face() */ /* there's a Mac-specific extended implementation of FT_New_Face() */
/* in src/base/ftmac.c */ /* in src/base/ftmac.c */
#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) #ifndef FT_MACINTOSH
/* documentation is in freetype.h */ /* documentation is in freetype.h */
@ -1211,7 +1215,7 @@
return FT_Open_Face( library, &args, face_index, aface ); return FT_Open_Face( library, &args, face_index, aface );
} }
#endif /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */ #endif
/* documentation is in freetype.h */ /* documentation is in freetype.h */
@ -1520,7 +1524,7 @@
} }
#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) #ifndef FT_MACINTOSH
/* The resource header says we've got resource_cnt `POST' (type1) */ /* The resource header says we've got resource_cnt `POST' (type1) */
/* resources in this file. They all need to be coalesced into */ /* resources in this file. They all need to be coalesced into */
@ -1875,7 +1879,7 @@
for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) for ( i = 0; i < FT_RACCESS_N_RULES; i++ )
{ {
is_darwin_vfs = raccess_rule_by_darwin_vfs( i ); is_darwin_vfs = ft_raccess_rule_by_darwin_vfs( library, i );
if ( is_darwin_vfs && vfs_rfork_has_no_font ) if ( is_darwin_vfs && vfs_rfork_has_no_font )
{ {
FT_TRACE3(( "Skip rule %d: darwin vfs resource fork" FT_TRACE3(( "Skip rule %d: darwin vfs resource fork"
@ -4085,10 +4089,10 @@
/* all child faces. */ /* all child faces. */
/* */ /* */
/* <InOut> */ /* <InOut> */
/* module :: A handle to the target driver object. */ /* module :: A handle to the target driver object. */
/* */ /* */
/* <Note> */ /* <Note> */
/* The driver _must_ be LOCKED! */ /* The driver _must_ be LOCKED! */
/* */ /* */
static void static void
Destroy_Module( FT_Module module ) Destroy_Module( FT_Module module )
@ -4098,10 +4102,6 @@
FT_Library library = module->library; FT_Library library = module->library;
/* finalize client-data - before anything else */
if ( module->generic.finalizer )
module->generic.finalizer( module );
if ( library && library->auto_hinter == module ) if ( library && library->auto_hinter == module )
library->auto_hinter = 0; library->auto_hinter = 0;
@ -4318,6 +4318,7 @@
FT_Module* cur = library->modules; FT_Module* cur = library->modules;
FT_Module* limit = cur + library->num_modules; FT_Module* limit = cur + library->num_modules;
for ( ; cur < limit; cur++ ) for ( ; cur < limit; cur++ )
{ {
if ( cur[0] != module ) if ( cur[0] != module )
@ -4511,10 +4512,6 @@
memory = library->memory; memory = library->memory;
/* Discard client-data */
if ( library->generic.finalizer )
library->generic.finalizer( library );
/* /*
* Close all faces in the library. If we don't do this, we can have * Close all faces in the library. If we don't do this, we can have
* some subtle memory leaks. * some subtle memory leaks.

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType outline management (body). */ /* FreeType outline management (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ /* Copyright 1996-2008, 2010, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -771,7 +771,7 @@
return 1; return 1;
} }
return ( n % 2 ); return n & 1;
} }

View file

@ -26,15 +26,15 @@
/* documentation is in ftpic.h */ /* documentation is in ftpic.h */
FT_BASE_DEF( FT_Error ) FT_BASE_DEF( FT_Error )
ft_pic_container_init( FT_Library library ) ft_pic_container_init( FT_Library library )
{ {
FT_PIC_Container* pic_container = &library->pic_container; FT_PIC_Container* pic_container = &library->pic_container;
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
FT_MEM_SET( pic_container, 0, sizeof(*pic_container) ); FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) );
error = ft_base_pic_init( library ); error = ft_base_pic_init( library );
if(error) if ( error )
return error; return error;
return FT_Err_Ok; return FT_Err_Ok;
@ -43,7 +43,7 @@
/* Destroy the contents of the container. */ /* Destroy the contents of the container. */
FT_BASE_DEF( void ) FT_BASE_DEF( void )
ft_pic_container_destroy( FT_Library library ) ft_pic_container_destroy( FT_Library library )
{ {
ft_base_pic_free( library ); ft_base_pic_free( library );
} }

View file

@ -28,7 +28,7 @@
#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_RFORK_H #include FT_INTERNAL_RFORK_H
#include "basepic.h"
#undef FT_COMPONENT #undef FT_COMPONENT
#define FT_COMPONENT trace_raccess #define FT_COMPONENT trace_raccess
@ -253,14 +253,6 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
typedef FT_Error
(*raccess_guess_func)( FT_Library library,
FT_Stream stream,
char *base_file_name,
char **result_file_name,
FT_Long *result_offset );
static FT_Error static FT_Error
raccess_guess_apple_double( FT_Library library, raccess_guess_apple_double( FT_Library library,
FT_Stream stream, FT_Stream stream,
@ -325,6 +317,20 @@
FT_Long *result_offset ); FT_Long *result_offset );
CONST_FT_RFORK_RULE_ARRAY_BEGIN(ft_raccess_guess_table,
ft_raccess_guess_rec)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_double, apple_double)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_single, apple_single)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_ufs_export, darwin_ufs_export)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_newvfs, darwin_newvfs)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_hfsplus, darwin_hfsplus)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(vfat, vfat)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_cap, linux_cap)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_double, linux_double)
CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_netatalk, linux_netatalk)
CONST_FT_RFORK_RULE_ARRAY_END
/*************************************************************************/ /*************************************************************************/
/**** ****/ /**** ****/
/**** Helper functions ****/ /**** Helper functions ****/
@ -348,43 +354,6 @@
const char *original_name, const char *original_name,
const char *insertion ); const char *insertion );
typedef enum FT_RFork_Rule_ {
FT_RFork_Rule_invalid = -2,
FT_RFork_Rule_uknown, /* -1 */
FT_RFork_Rule_apple_double,
FT_RFork_Rule_apple_single,
FT_RFork_Rule_darwin_ufs_export,
FT_RFork_Rule_darwin_newvfs,
FT_RFork_Rule_darwin_hfsplus,
FT_RFork_Rule_vfat,
FT_RFork_Rule_linux_cap,
FT_RFork_Rule_linux_double,
FT_RFork_Rule_linux_netatalk
} FT_RFork_Rule;
/* For fast translation between rule index and rule type,
* the macros FT_RFORK_xxx should be kept consistent with
* the raccess_guess_funcs table
*/
typedef struct raccess_guess_rec_ {
raccess_guess_func func;
FT_RFork_Rule type;
} raccess_guess_rec;
static raccess_guess_rec raccess_guess_table[FT_RACCESS_N_RULES] =
{
{ raccess_guess_apple_double, FT_RFork_Rule_apple_double, },
{ raccess_guess_apple_single, FT_RFork_Rule_apple_single, },
{ raccess_guess_darwin_ufs_export, FT_RFork_Rule_darwin_ufs_export, },
{ raccess_guess_darwin_newvfs, FT_RFork_Rule_darwin_newvfs, },
{ raccess_guess_darwin_hfsplus, FT_RFork_Rule_darwin_hfsplus, },
{ raccess_guess_vfat, FT_RFork_Rule_vfat, },
{ raccess_guess_linux_cap, FT_RFork_Rule_linux_cap, },
{ raccess_guess_linux_double, FT_RFork_Rule_linux_double, },
{ raccess_guess_linux_netatalk, FT_RFork_Rule_linux_netatalk, },
};
FT_BASE_DEF( void ) FT_BASE_DEF( void )
FT_Raccess_Guess( FT_Library library, FT_Raccess_Guess( FT_Library library,
FT_Stream stream, FT_Stream stream,
@ -407,7 +376,7 @@
if ( errors[i] ) if ( errors[i] )
continue ; continue ;
errors[i] = (raccess_guess_table[i].func)( library, errors[i] = (FT_RACCESS_GUESS_TABLE_GET[i].func)( library,
stream, base_name, stream, base_name,
&(new_names[i]), &(new_names[i]),
&(offsets[i]) ); &(offsets[i]) );
@ -417,21 +386,28 @@
} }
#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) #ifndef FT_MACINTOSH
static FT_RFork_Rule static FT_RFork_Rule
raccess_get_rule_type_from_rule_index( FT_UInt rule_index ) raccess_get_rule_type_from_rule_index( FT_Library library,
FT_UInt rule_index )
{ {
FT_UNUSED( library );
if ( rule_index >= FT_RACCESS_N_RULES ) if ( rule_index >= FT_RACCESS_N_RULES )
return FT_RFork_Rule_invalid; return FT_RFork_Rule_invalid;
return raccess_guess_table[rule_index].type; return FT_RACCESS_GUESS_TABLE_GET[rule_index].type;
} }
/*
* For this function, refer ftbase.h.
*/
FT_LOCAL_DEF( FT_Bool ) FT_LOCAL_DEF( FT_Bool )
raccess_rule_by_darwin_vfs( FT_UInt rule_index ) ft_raccess_rule_by_darwin_vfs( FT_Library library,
FT_UInt rule_index )
{ {
switch( raccess_get_rule_type_from_rule_index( rule_index ) ) switch( raccess_get_rule_type_from_rule_index( library, rule_index ) )
{ {
case FT_RFork_Rule_darwin_newvfs: case FT_RFork_Rule_darwin_newvfs:
case FT_RFork_Rule_darwin_hfsplus: case FT_RFork_Rule_darwin_hfsplus:

View file

@ -1,6 +1,6 @@
/* /*
* Copyright 2000 Computing Research Labs, New Mexico State University * Copyright 2000 Computing Research Labs, New Mexico State University
* Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli * Copyright 2001-2004, 2011 Francesco Zappa Nardelli
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@ -226,8 +226,10 @@ FT_BEGIN_HEADER
void* internal; /* Internal data for the font. */ void* internal; /* Internal data for the font. */
unsigned long nmod[2048]; /* Bitmap indicating modified glyphs. */ /* The size of the next two arrays must be in sync with the */
unsigned long umod[2048]; /* Bitmap indicating modified */ /* size of the `have' array in the `bdf_parse_t' structure. */
unsigned long nmod[34816]; /* Bitmap indicating modified glyphs. */
unsigned long umod[34816]; /* Bitmap indicating modified */
/* unencoded glyphs. */ /* unencoded glyphs. */
unsigned short modified; /* Boolean indicating font modified. */ unsigned short modified; /* Boolean indicating font modified. */
unsigned short bpp; /* Bits per pixel. */ unsigned short bpp; /* Bits per pixel. */

View file

@ -2,7 +2,7 @@
FreeType font driver for bdf files FreeType font driver for bdf files
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by Copyright (C) 2001-2008, 2011 by
Francesco Zappa Nardelli Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
@ -30,7 +30,7 @@ THE SOFTWARE.
#include FT_INTERNAL_STREAM_H #include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_BDF_H #include FT_BDF_H
#include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_IDS_H
#include FT_SERVICE_BDF_H #include FT_SERVICE_BDF_H
#include FT_SERVICE_XFREE86_NAME_H #include FT_SERVICE_XFREE86_NAME_H
@ -332,8 +332,6 @@ THE SOFTWARE.
FT_FREE( bdfface->available_sizes ); FT_FREE( bdfface->available_sizes );
FT_FREE( face->bdffont ); FT_FREE( face->bdffont );
FT_TRACE4(( "BDF_Face_Done: done face\n" ));
} }
@ -356,6 +354,8 @@ THE SOFTWARE.
FT_UNUSED( face_index ); FT_UNUSED( face_index );
FT_TRACE2(( "BDF driver\n" ));
if ( FT_STREAM_SEEK( 0 ) ) if ( FT_STREAM_SEEK( 0 ) )
goto Exit; goto Exit;
@ -367,7 +367,7 @@ THE SOFTWARE.
error = bdf_load_font( stream, memory, &options, &font ); error = bdf_load_font( stream, memory, &options, &font );
if ( error == BDF_Err_Missing_Startfont_Field ) if ( error == BDF_Err_Missing_Startfont_Field )
{ {
FT_TRACE2(( "[not a valid BDF file]\n" )); FT_TRACE2(( " not a BDF file\n" ));
goto Fail; goto Fail;
} }
else if ( error ) else if ( error )
@ -379,10 +379,10 @@ THE SOFTWARE.
bdf_property_t* prop = NULL; bdf_property_t* prop = NULL;
FT_TRACE4(( "number of glyphs: %d (%d)\n", FT_TRACE4(( " number of glyphs: allocated %d (used %d)\n",
font->glyphs_size, font->glyphs_size,
font->glyphs_used )); font->glyphs_used ));
FT_TRACE4(( "number of unencoded glyphs: %d (%d)\n", FT_TRACE4(( " number of unencoded glyphs: allocated %d (used %d)\n",
font->unencoded_size, font->unencoded_size,
font->unencoded_used )); font->unencoded_used ));
@ -482,7 +482,7 @@ THE SOFTWARE.
for ( n = 0; n < font->glyphs_size; n++ ) for ( n = 0; n < font->glyphs_size; n++ )
{ {
(face->en_table[n]).enc = cur[n].encoding; (face->en_table[n]).enc = cur[n].encoding;
FT_TRACE4(( "idx %d, val 0x%lX\n", n, cur[n].encoding )); FT_TRACE4(( " idx %d, val 0x%lX\n", n, cur[n].encoding ));
(face->en_table[n]).glyph = (FT_Short)n; (face->en_table[n]).glyph = (FT_Short)n;
if ( cur[n].encoding == font->default_char ) if ( cur[n].encoding == font->default_char )
@ -490,7 +490,8 @@ THE SOFTWARE.
if ( n < FT_UINT_MAX ) if ( n < FT_UINT_MAX )
face->default_glyph = (FT_UInt)n; face->default_glyph = (FT_UInt)n;
else else
FT_TRACE1(( "idx %d is too large for this system\n", n )); FT_TRACE1(( "BDF_Face_Init:"
" idx %d is too large for this system\n", n ));
} }
} }
} }
@ -761,8 +762,8 @@ THE SOFTWARE.
case BDF_INTEGER: case BDF_INTEGER:
if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) ) if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
{ {
FT_TRACE1(( "bdf_get_bdf_property: " )); FT_TRACE1(( "bdf_get_bdf_property:"
FT_TRACE1(( "too large integer 0x%x is truncated\n" )); " too large integer 0x%x is truncated\n" ));
} }
aproperty->type = BDF_PROPERTY_TYPE_INTEGER; aproperty->type = BDF_PROPERTY_TYPE_INTEGER;
aproperty->u.integer = (FT_Int32)prop->value.l; aproperty->u.integer = (FT_Int32)prop->value.l;
@ -771,8 +772,8 @@ THE SOFTWARE.
case BDF_CARDINAL: case BDF_CARDINAL:
if ( prop->value.ul > 0xFFFFFFFFUL ) if ( prop->value.ul > 0xFFFFFFFFUL )
{ {
FT_TRACE1(( "bdf_get_bdf_property: " )); FT_TRACE1(( "bdf_get_bdf_property:"
FT_TRACE1(( "too large cardinal 0x%x is truncated\n" )); " too large cardinal 0x%x is truncated\n" ));
} }
aproperty->type = BDF_PROPERTY_TYPE_CARDINAL; aproperty->type = BDF_PROPERTY_TYPE_CARDINAL;
aproperty->u.cardinal = (FT_UInt32)prop->value.ul; aproperty->u.cardinal = (FT_UInt32)prop->value.ul;
@ -847,9 +848,9 @@ THE SOFTWARE.
0, 0,
(FT_Module_Constructor)0, 0, /* FT_Module_Constructor */
(FT_Module_Destructor) 0, 0, /* FT_Module_Destructor */
(FT_Module_Requester) bdf_driver_requester bdf_driver_requester
}, },
sizeof ( BDF_FaceRec ), sizeof ( BDF_FaceRec ),
@ -869,9 +870,9 @@ THE SOFTWARE.
#endif #endif
BDF_Glyph_Load, BDF_Glyph_Load,
0, /* FT_Face_GetKerningFunc */ 0, /* FT_Face_GetKerningFunc */
0, /* FT_Face_AttachFunc */ 0, /* FT_Face_AttachFunc */
0, /* FT_Face_GetAdvancesFunc */ 0, /* FT_Face_GetAdvancesFunc */
BDF_Size_Request, BDF_Size_Request,
BDF_Size_Select BDF_Size_Select

View file

@ -38,7 +38,7 @@ FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
#error "this module does not support PIC yet" #error "this module does not support PIC yet"
#endif #endif
typedef struct BDF_encoding_el_ typedef struct BDF_encoding_el_

View file

@ -1,5 +1,5 @@
/* /*
* Copyright 2001, 2002 Francesco Zappa Nardelli * Copyright 2001, 2002, 2012 Francesco Zappa Nardelli
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@ -33,6 +33,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX BDF_Err_ #define FT_ERR_PREFIX BDF_Err_
#define FT_ERR_BASE FT_Mod_Err_BDF #define FT_ERR_BASE FT_Mod_Err_BDF

View file

@ -1,6 +1,6 @@
/* /*
* Copyright 2000 Computing Research Labs, New Mexico State University * Copyright 2000 Computing Research Labs, New Mexico State University
* Copyright 2001-2011 * Copyright 2001-2012
* Francesco Zappa Nardelli * Francesco Zappa Nardelli
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
@ -169,6 +169,43 @@
sizeof ( _bdf_properties[0] ); sizeof ( _bdf_properties[0] );
/* Auto correction messages. */
#define ACMSG1 "FONT_ASCENT property missing. " \
"Added `FONT_ASCENT %hd'.\n"
#define ACMSG2 "FONT_DESCENT property missing. " \
"Added `FONT_DESCENT %hd'.\n"
#define ACMSG3 "Font width != actual width. Old: %hd New: %hd.\n"
#define ACMSG4 "Font left bearing != actual left bearing. " \
"Old: %hd New: %hd.\n"
#define ACMSG5 "Font ascent != actual ascent. Old: %hd New: %hd.\n"
#define ACMSG6 "Font descent != actual descent. Old: %hd New: %hd.\n"
#define ACMSG7 "Font height != actual height. Old: %hd New: %hd.\n"
#define ACMSG8 "Glyph scalable width (SWIDTH) adjustments made.\n"
#define ACMSG9 "SWIDTH field missing at line %ld. Set automatically.\n"
#define ACMSG10 "DWIDTH field missing at line %ld. Set to glyph width.\n"
#define ACMSG11 "SIZE bits per pixel field adjusted to %hd.\n"
#define ACMSG12 "Duplicate encoding %ld (%s) changed to unencoded.\n"
#define ACMSG13 "Glyph %ld extra rows removed.\n"
#define ACMSG14 "Glyph %ld extra columns removed.\n"
#define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n"
#define ACMSG16 "Glyph %ld missing columns padded with zero bits.\n"
/* Error messages. */
#define ERRMSG1 "[line %ld] Missing `%s' line.\n"
#define ERRMSG2 "[line %ld] Font header corrupted or missing fields.\n"
#define ERRMSG3 "[line %ld] Font glyphs corrupted or missing fields.\n"
#define ERRMSG4 "[line %ld] BBX too big.\n"
#define ERRMSG5 "[line %ld] `%s' value too big.\n"
#define ERRMSG6 "[line %ld] Input line too long.\n"
#define ERRMSG7 "[line %ld] Font name too long.\n"
#define ERRMSG8 "[line %ld] Invalid `%s' value.\n"
#define ERRMSG9 "[line %ld] Invalid keyword.\n"
/* Debug messages. */
#define DBGMSG1 " [%6ld] %s" /* no \n */
#define DBGMSG2 " (0x%lX)\n"
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* Hash table utilities for the properties. */ /* Hash table utilities for the properties. */
@ -377,7 +414,8 @@
bdf_font_t* font; bdf_font_t* font;
bdf_options_t* opts; bdf_options_t* opts;
unsigned long have[2048]; unsigned long have[34816]; /* must be in sync with `nmod' and `umod' */
/* arrays from `bdf_font_t' structure */
_bdf_list_t list; _bdf_list_t list;
FT_Memory memory; FT_Memory memory;
@ -424,7 +462,7 @@
if ( num_items > list->size ) if ( num_items > list->size )
{ {
unsigned long oldsize = list->size; /* same as _bdf_list_t.size */ unsigned long oldsize = list->size; /* same as _bdf_list_t.size */
unsigned long newsize = oldsize + ( oldsize >> 1 ) + 4; unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5;
unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) ); unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) );
FT_Memory memory = list->memory; FT_Memory memory = list->memory;
@ -507,6 +545,10 @@
} }
/* The code below ensures that we have at least 4 + 1 `field' */
/* elements in `list' (which are possibly NULL) so that we */
/* don't have to check the number of fields in most cases. */
static FT_Error static FT_Error
_bdf_list_split( _bdf_list_t* list, _bdf_list_split( _bdf_list_t* list,
char* separators, char* separators,
@ -521,6 +563,13 @@
/* Initialize the list. */ /* Initialize the list. */
list->used = 0; list->used = 0;
if ( list->size )
{
list->field[0] = (char*)empty;
list->field[1] = (char*)empty;
list->field[2] = (char*)empty;
list->field[3] = (char*)empty;
}
/* If the line is empty, then simply return. */ /* If the line is empty, then simply return. */
if ( linelen == 0 || line[0] == 0 ) if ( linelen == 0 || line[0] == 0 )
@ -687,6 +736,7 @@
if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */ if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */
{ {
FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno ));
error = BDF_Err_Invalid_Argument; error = BDF_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -1079,33 +1129,6 @@
#define _BDF_GLYPH_HEIGHT_CHECK 0x80000000UL #define _BDF_GLYPH_HEIGHT_CHECK 0x80000000UL
/* Auto correction messages. */
#define ACMSG1 "FONT_ASCENT property missing. " \
"Added \"FONT_ASCENT %hd\".\n"
#define ACMSG2 "FONT_DESCENT property missing. " \
"Added \"FONT_DESCENT %hd\".\n"
#define ACMSG3 "Font width != actual width. Old: %hd New: %hd.\n"
#define ACMSG4 "Font left bearing != actual left bearing. " \
"Old: %hd New: %hd.\n"
#define ACMSG5 "Font ascent != actual ascent. Old: %hd New: %hd.\n"
#define ACMSG6 "Font descent != actual descent. Old: %hd New: %hd.\n"
#define ACMSG7 "Font height != actual height. Old: %hd New: %hd.\n"
#define ACMSG8 "Glyph scalable width (SWIDTH) adjustments made.\n"
#define ACMSG9 "SWIDTH field missing at line %ld. Set automatically.\n"
#define ACMSG10 "DWIDTH field missing at line %ld. Set to glyph width.\n"
#define ACMSG11 "SIZE bits per pixel field adjusted to %hd.\n"
#define ACMSG12 "Duplicate encoding %ld (%s) changed to unencoded.\n"
#define ACMSG13 "Glyph %ld extra rows removed.\n"
#define ACMSG14 "Glyph %ld extra columns removed.\n"
#define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n"
/* Error messages. */
#define ERRMSG1 "[line %ld] Missing \"%s\" line.\n"
#define ERRMSG2 "[line %ld] Font header corrupted or missing fields.\n"
#define ERRMSG3 "[line %ld] Font glyphs corrupted or missing fields.\n"
#define ERRMSG4 "[line %ld] BBX too big.\n"
static FT_Error static FT_Error
_bdf_add_comment( bdf_font_t* font, _bdf_add_comment( bdf_font_t* font,
char* comment, char* comment,
@ -1137,7 +1160,8 @@
/* default specified in the options. */ /* default specified in the options. */
static FT_Error static FT_Error
_bdf_set_default_spacing( bdf_font_t* font, _bdf_set_default_spacing( bdf_font_t* font,
bdf_options_t* opts ) bdf_options_t* opts,
unsigned long lineno )
{ {
size_t len; size_t len;
char name[256]; char name[256];
@ -1162,6 +1186,7 @@
/* Limit ourselves to 256 characters in the font name. */ /* Limit ourselves to 256 characters in the font name. */
if ( len >= 256 ) if ( len >= 256 )
{ {
FT_ERROR(( "_bdf_set_default_spacing: " ERRMSG7, lineno ));
error = BDF_Err_Invalid_Argument; error = BDF_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -1241,7 +1266,8 @@
ep = line + linelen; ep = line + linelen;
/* Trim the leading whitespace if it exists. */ /* Trim the leading whitespace if it exists. */
*sp++ = 0; if ( *sp )
*sp++ = 0;
while ( *sp && while ( *sp &&
( *sp == ' ' || *sp == '\t' ) ) ( *sp == ' ' || *sp == '\t' ) )
sp++; sp++;
@ -1265,9 +1291,10 @@
static FT_Error static FT_Error
_bdf_add_property( bdf_font_t* font, _bdf_add_property( bdf_font_t* font,
char* name, char* name,
char* value ) char* value,
unsigned long lineno )
{ {
size_t propid; size_t propid;
hashnode hn; hashnode hn;
@ -1405,6 +1432,7 @@
{ {
if ( !fp->value.atom ) if ( !fp->value.atom )
{ {
FT_ERROR(( "_bdf_add_property: " ERRMSG8, lineno, "SPACING" ));
error = BDF_Err_Invalid_File_Format; error = BDF_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -1493,8 +1521,9 @@
/* Limit ourselves to 1,114,112 glyphs in the font (this is the */ /* Limit ourselves to 1,114,112 glyphs in the font (this is the */
/* number of code points available in Unicode). */ /* number of code points available in Unicode). */
if ( p->cnt >= 1114112UL ) if ( p->cnt >= 0x110000UL )
{ {
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "CHARS" ));
error = BDF_Err_Invalid_Argument; error = BDF_Err_Invalid_Argument;
goto Exit; goto Exit;
} }
@ -1554,6 +1583,7 @@
if ( !s ) if ( !s )
{ {
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG8, lineno, "STARTCHAR" ));
error = BDF_Err_Invalid_File_Format; error = BDF_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -1565,6 +1595,8 @@
p->flags |= _BDF_GLYPH; p->flags |= _BDF_GLYPH;
FT_TRACE4(( DBGMSG1, lineno, s ));
goto Exit; goto Exit;
} }
@ -1585,11 +1617,23 @@
p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 ); p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 );
/* Check that the encoding is in the range [0,65536] because */ /* Normalize negative encoding values. The specification only */
/* otherwise p->have (a bitmap with static size) overflows. */ /* allows -1, but we can be more generous here. */
if ( p->glyph_enc < -1 )
p->glyph_enc = -1;
/* Check for alternative encoding format. */
if ( p->glyph_enc == -1 && p->list.used > 2 )
p->glyph_enc = _bdf_atol( p->list.field[2], 0, 10 );
FT_TRACE4(( DBGMSG2, p->glyph_enc ));
/* Check that the encoding is in the Unicode range because */
/* otherwise p->have (a bitmap with static size) overflows. */
if ( p->glyph_enc > 0 && if ( p->glyph_enc > 0 &&
(size_t)p->glyph_enc >= sizeof ( p->have ) * 8 ) (size_t)p->glyph_enc >= sizeof ( p->have ) * 8 )
{ {
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "ENCODING" ));
error = BDF_Err_Invalid_File_Format; error = BDF_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -1702,19 +1746,32 @@
for ( i = 0; i < nibbles; i++ ) for ( i = 0; i < nibbles; i++ )
{ {
c = line[i]; c = line[i];
if ( !isdigok( hdigits, c ) )
break;
*bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );
if ( i + 1 < nibbles && ( i & 1 ) ) if ( i + 1 < nibbles && ( i & 1 ) )
*++bp = 0; *++bp = 0;
} }
/* If any line has not enough columns, */
/* indicate they have been padded with zero bits. */
if ( i < nibbles &&
!( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
{
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding ));
p->flags |= _BDF_GLYPH_WIDTH_CHECK;
font->modified = 1;
}
/* Remove possible garbage at the right. */ /* Remove possible garbage at the right. */
mask_index = ( glyph->bbx.width * p->font->bpp ) & 7; mask_index = ( glyph->bbx.width * p->font->bpp ) & 7;
if ( glyph->bbx.width ) if ( glyph->bbx.width )
*bp &= nibble_mask[mask_index]; *bp &= nibble_mask[mask_index];
/* If any line has extra columns, indicate they have been removed. */ /* If any line has extra columns, indicate they have been removed. */
if ( ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) && if ( i == nibbles &&
!( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) isdigok( hdigits, line[nibbles] ) &&
!( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
{ {
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding ));
p->flags |= _BDF_GLYPH_WIDTH_CHECK; p->flags |= _BDF_GLYPH_WIDTH_CHECK;
@ -1729,12 +1786,7 @@
if ( ft_memcmp( line, "SWIDTH", 6 ) == 0 ) if ( ft_memcmp( line, "SWIDTH", 6 ) == 0 )
{ {
if ( !( p->flags & _BDF_ENCODING ) ) if ( !( p->flags & _BDF_ENCODING ) )
{ goto Missing_Encoding;
/* Missing ENCODING field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" ));
error = BDF_Err_Missing_Encoding_Field;
goto Exit;
}
error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error ) if ( error )
@ -1749,6 +1801,9 @@
/* Expect the DWIDTH (scalable width) field next. */ /* Expect the DWIDTH (scalable width) field next. */
if ( ft_memcmp( line, "DWIDTH", 6 ) == 0 ) if ( ft_memcmp( line, "DWIDTH", 6 ) == 0 )
{ {
if ( !( p->flags & _BDF_ENCODING ) )
goto Missing_Encoding;
error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error ) if ( error )
goto Exit; goto Exit;
@ -1774,6 +1829,9 @@
/* Expect the BBX field next. */ /* Expect the BBX field next. */
if ( ft_memcmp( line, "BBX", 3 ) == 0 ) if ( ft_memcmp( line, "BBX", 3 ) == 0 )
{ {
if ( !( p->flags & _BDF_ENCODING ) )
goto Missing_Encoding;
error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); error = _bdf_list_split( &p->list, (char *)" +", line, linelen );
if ( error ) if ( error )
goto Exit; goto Exit;
@ -1851,10 +1909,10 @@
} }
/* Allocate enough space for the bitmap. */ /* Allocate enough space for the bitmap. */
glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3; glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3;
bitmap_size = glyph->bpr * glyph->bbx.height; bitmap_size = glyph->bpr * glyph->bbx.height;
if ( bitmap_size > 0xFFFFU ) if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU )
{ {
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno )); FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno ));
error = BDF_Err_Bbx_Too_Big; error = BDF_Err_Bbx_Too_Big;
@ -1872,7 +1930,14 @@
goto Exit; goto Exit;
} }
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG9, lineno ));
error = BDF_Err_Invalid_File_Format; error = BDF_Err_Invalid_File_Format;
goto Exit;
Missing_Encoding:
/* Missing ENCODING field. */
FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" ));
error = BDF_Err_Missing_Encoding_Field;
Exit: Exit:
if ( error && ( p->flags & _BDF_GLYPH ) ) if ( error && ( p->flags & _BDF_GLYPH ) )
@ -1917,7 +1982,8 @@
{ {
p->font->font_ascent = p->font->bbx.ascent; p->font->font_ascent = p->font->bbx.ascent;
ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); ft_sprintf( nbuf, "%hd", p->font->bbx.ascent );
error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", nbuf ); error = _bdf_add_property( p->font, (char *)"FONT_ASCENT",
nbuf, lineno );
if ( error ) if ( error )
goto Exit; goto Exit;
@ -1929,7 +1995,8 @@
{ {
p->font->font_descent = p->font->bbx.descent; p->font->font_descent = p->font->bbx.descent;
ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); ft_sprintf( nbuf, "%hd", p->font->bbx.descent );
error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", nbuf ); error = _bdf_add_property( p->font, (char *)"FONT_DESCENT",
nbuf, lineno );
if ( error ) if ( error )
goto Exit; goto Exit;
@ -1955,13 +2022,13 @@
value += 7; value += 7;
if ( *value ) if ( *value )
*value++ = 0; *value++ = 0;
error = _bdf_add_property( p->font, name, value ); error = _bdf_add_property( p->font, name, value, lineno );
if ( error ) if ( error )
goto Exit; goto Exit;
} }
else if ( _bdf_is_atom( line, linelen, &name, &value, p->font ) ) else if ( _bdf_is_atom( line, linelen, &name, &value, p->font ) )
{ {
error = _bdf_add_property( p->font, name, value ); error = _bdf_add_property( p->font, name, value, lineno );
if ( error ) if ( error )
goto Exit; goto Exit;
} }
@ -1975,7 +2042,7 @@
_bdf_list_shift( &p->list, 1 ); _bdf_list_shift( &p->list, 1 );
value = _bdf_list_join( &p->list, ' ', &vlen ); value = _bdf_list_join( &p->list, ' ', &vlen );
error = _bdf_add_property( p->font, name, value ); error = _bdf_add_property( p->font, name, value, lineno );
if ( error ) if ( error )
goto Exit; goto Exit;
} }
@ -2041,7 +2108,8 @@
if ( ft_memcmp( line, "STARTFONT", 9 ) != 0 ) if ( ft_memcmp( line, "STARTFONT", 9 ) != 0 )
{ {
/* No STARTFONT field is a good indication of a problem. */ /* we don't emit an error message since this code gets */
/* explicitly caught one level higher */
error = BDF_Err_Missing_Startfont_Field; error = BDF_Err_Missing_Startfont_Field;
goto Exit; goto Exit;
} }
@ -2154,6 +2222,7 @@
if ( !s ) if ( !s )
{ {
FT_ERROR(( "_bdf_parse_start: " ERRMSG8, lineno, "FONT" ));
error = BDF_Err_Invalid_File_Format; error = BDF_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
@ -2167,7 +2236,7 @@
/* If the font name is an XLFD name, set the spacing to the one in */ /* If the font name is an XLFD name, set the spacing to the one in */
/* the font name. If there is no spacing fall back on the default. */ /* the font name. If there is no spacing fall back on the default. */
error = _bdf_set_default_spacing( p->font, p->opts ); error = _bdf_set_default_spacing( p->font, p->opts, lineno );
if ( error ) if ( error )
goto Exit; goto Exit;
@ -2248,14 +2317,16 @@
/* for compiling fonts. */ /* for compiling fonts. */
p->font->font_ascent = p->font->bbx.ascent; p->font->font_ascent = p->font->bbx.ascent;
ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); ft_sprintf( nbuf, "%hd", p->font->bbx.ascent );
error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", nbuf ); error = _bdf_add_property( p->font, (char *)"FONT_ASCENT",
nbuf, lineno );
if ( error ) if ( error )
goto Exit; goto Exit;
FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent )); FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent ));
p->font->font_descent = p->font->bbx.descent; p->font->font_descent = p->font->bbx.descent;
ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); ft_sprintf( nbuf, "%hd", p->font->bbx.descent );
error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", nbuf ); error = _bdf_add_property( p->font, (char *)"FONT_DESCENT",
nbuf, lineno );
if ( error ) if ( error )
goto Exit; goto Exit;
FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent )); FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent ));
@ -2269,6 +2340,7 @@
goto Exit; goto Exit;
} }
FT_ERROR(( "_bdf_parse_start: " ERRMSG9, lineno ));
error = BDF_Err_Invalid_File_Format; error = BDF_Err_Invalid_File_Format;
Exit: Exit:
@ -2381,22 +2453,20 @@
if ( p->flags & _BDF_START ) if ( p->flags & _BDF_START )
{ {
/* The ENDFONT field was never reached or did not exist. */
if ( !( p->flags & _BDF_GLYPHS ) )
{ {
/* The ENDFONT field was never reached or did not exist. */ /* Error happened while parsing header. */
if ( !( p->flags & _BDF_GLYPHS ) ) FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno ));
{ error = BDF_Err_Corrupted_Font_Header;
/* Error happened while parsing header. */ goto Exit;
FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno )); }
error = BDF_Err_Corrupted_Font_Header; else
goto Exit; {
} /* Error happened when parsing glyphs. */
else FT_ERROR(( "bdf_load_font: " ERRMSG3, lineno ));
{ error = BDF_Err_Corrupted_Font_Glyphs;
/* Error happened when parsing glyphs. */ goto Exit;
FT_ERROR(( "bdf_load_font: " ERRMSG3, lineno ));
error = BDF_Err_Corrupted_Font_Glyphs;
goto Exit;
}
} }
} }

View file

@ -8,7 +8,7 @@
/* parse compressed PCF fonts, as found with many X11 server */ /* parse compressed PCF fonts, as found with many X11 server */
/* distributions. */ /* distributions. */
/* */ /* */
/* Copyright 2010 by */ /* Copyright 2010, 2012 by */
/* Joel Klinghed. */ /* Joel Klinghed. */
/* */ /* */
/* Based on src/gzip/ftgzip.c, Copyright 2002 - 2010 by */ /* Based on src/gzip/ftgzip.c, Copyright 2002 - 2010 by */
@ -35,6 +35,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX Bzip2_Err_ #define FT_ERR_PREFIX Bzip2_Err_
#define FT_ERR_BASE FT_Mod_Err_Bzip2 #define FT_ERR_BASE FT_Mod_Err_Bzip2

View file

@ -467,7 +467,7 @@
} }
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
/* yet another backwards-legacy structure */ /* yet another backwards-legacy structure */
@ -608,7 +608,7 @@
const FTC_SFamilyClassRec ftc_basic_sbit_family_class = const FTC_SFamilyClassRec ftc_basic_sbit_family_class =
{ {
{ {
sizeof( FTC_BasicFamilyRec ), sizeof ( FTC_BasicFamilyRec ),
ftc_basic_family_compare, ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_init,
0, /* FTC_MruNode_ResetFunc */ 0, /* FTC_MruNode_ResetFunc */

View file

@ -320,7 +320,7 @@
/* /*
* If cmap_index is greater than the maximum number of cachable * If cmap_index is greater than the maximum number of cachable
* charmaps, we assume the request is from a legacy rogue client * charmaps, we assume the request is from a legacy rogue client
* using old internal header. See include/config/ftoption.h. * using old internal header. See include/config/ftoption.h.
*/ */
if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change ) if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change )

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Caching sub-system error codes (specification only). */ /* Caching sub-system error codes (specification only). */
/* */ /* */
/* Copyright 2001 by */ /* Copyright 2001, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -30,6 +30,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX FTC_Err_ #define FT_ERR_PREFIX FTC_Err_
#define FT_ERR_BASE FT_Mod_Err_Cache #define FT_ERR_BASE FT_Mod_Err_Cache

View file

@ -28,7 +28,7 @@
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
#error "cache system does not support PIC yet" #error "cache system does not support PIC yet"
#endif #endif
#undef FT_COMPONENT #undef FT_COMPONENT

View file

@ -4,7 +4,7 @@
/* */ /* */
/* OpenType font driver implementation (body). */ /* OpenType font driver implementation (body). */
/* */ /* */
/* Copyright 1996-2011 by */ /* Copyright 1996-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -125,7 +125,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* Load_Glyph */ /* cff_glyph_load */
/* */ /* */
/* <Description> */ /* <Description> */
/* A driver method used to load a glyph within a given glyph slot. */ /* A driver method used to load a glyph within a given glyph slot. */
@ -149,10 +149,10 @@
/* FreeType error code. 0 means success. */ /* FreeType error code. 0 means success. */
/* */ /* */
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
Load_Glyph( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ cff_glyph_load( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */
FT_Size cffsize, /* CFF_Size */ FT_Size cffsize, /* CFF_Size */
FT_UInt glyph_index, FT_UInt glyph_index,
FT_Int32 load_flags ) FT_Int32 load_flags )
{ {
FT_Error error; FT_Error error;
CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot;
@ -203,7 +203,7 @@
for ( nn = 0; nn < count; nn++ ) for ( nn = 0; nn < count; nn++ )
{ {
error = Load_Glyph( slot, face->size, start + nn, flags ); error = cff_glyph_load( slot, face->size, start + nn, flags );
if ( error ) if ( error )
break; break;
@ -239,7 +239,7 @@
" cannot get glyph name from CFF & CEF fonts\n" " cannot get glyph name from CFF & CEF fonts\n"
" " " "
" without the `PSNames' module\n" )); " without the `PSNames' module\n" ));
error = CFF_Err_Unknown_File_Format; error = CFF_Err_Missing_Module;
goto Exit; goto Exit;
} }
@ -466,7 +466,7 @@
dict->cid_registry ); dict->cid_registry );
*registry = cff->registry; *registry = cff->registry;
} }
if ( ordering ) if ( ordering )
{ {
if ( cff->ordering == NULL ) if ( cff->ordering == NULL )
@ -489,7 +489,7 @@
*supplement = (FT_Int)dict->cid_supplement; *supplement = (FT_Int)dict->cid_supplement;
} }
} }
Fail: Fail:
return error; return error;
} }
@ -599,19 +599,35 @@
cff_get_interface( FT_Module driver, /* CFF_Driver */ cff_get_interface( FT_Module driver, /* CFF_Driver */
const char* module_interface ) const char* module_interface )
{ {
FT_Library library;
FT_Module sfnt; FT_Module sfnt;
FT_Module_Interface result; FT_Module_Interface result;
result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface ); /* FT_CFF_SERVICES_GET derefers `library' in PIC mode */
if ( result != NULL ) #ifdef FT_CONFIG_OPTION_PIC
return result;
if ( !driver ) if ( !driver )
return NULL; return NULL;
library = driver->library;
if ( !library )
return NULL;
#endif
result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface );
if ( result != NULL )
return result;
/* `driver' is not yet evaluated in non-PIC mode */
#ifndef FT_CONFIG_OPTION_PIC
if ( !driver )
return NULL;
library = driver->library;
if ( !library )
return NULL;
#endif
/* we pass our request to the `sfnt' module */ /* we pass our request to the `sfnt' module */
sfnt = FT_Get_Module( driver->library, "sfnt" ); sfnt = FT_Get_Module( library, "sfnt" );
return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0; return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
} }
@ -625,12 +641,13 @@
#define CFF_SIZE_SELECT 0 #define CFF_SIZE_SELECT 0
#endif #endif
FT_DEFINE_DRIVER(cff_driver_class, FT_DEFINE_DRIVER( cff_driver_class,
FT_MODULE_FONT_DRIVER | FT_MODULE_FONT_DRIVER |
FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_SCALABLE |
FT_MODULE_DRIVER_HAS_HINTER, FT_MODULE_DRIVER_HAS_HINTER,
sizeof( CFF_DriverRec ), sizeof ( CFF_DriverRec ),
"cff", "cff",
0x10000L, 0x10000L,
0x20000L, 0x20000L,
@ -642,9 +659,9 @@
cff_get_interface, cff_get_interface,
/* now the specific driver fields */ /* now the specific driver fields */
sizeof( TT_FaceRec ), sizeof ( TT_FaceRec ),
sizeof( CFF_SizeRec ), sizeof ( CFF_SizeRec ),
sizeof( CFF_GlyphSlotRec ), sizeof ( CFF_GlyphSlotRec ),
cff_face_init, cff_face_init,
cff_face_done, cff_face_done,
@ -653,14 +670,14 @@
cff_slot_init, cff_slot_init,
cff_slot_done, cff_slot_done,
ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
Load_Glyph, cff_glyph_load,
cff_get_kerning, cff_get_kerning,
0, /* FT_Face_AttachFunc */ 0, /* FT_Face_AttachFunc */
cff_get_advances, /* FT_Face_GetAdvancesFunc */ cff_get_advances,
cff_size_request, cff_size_request,

View file

@ -4,7 +4,7 @@
/* */ /* */
/* CFF error codes (specification only). */ /* CFF error codes (specification only). */
/* */ /* */
/* Copyright 2001 by */ /* Copyright 2001, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -29,6 +29,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX CFF_Err_ #define FT_ERR_PREFIX CFF_Err_
#define FT_ERR_BASE FT_Mod_Err_CFF #define FT_ERR_BASE FT_Mod_Err_CFF

View file

@ -4,7 +4,7 @@
/* */ /* */
/* OpenType Glyph Loader (body). */ /* OpenType Glyph Loader (body). */
/* */ /* */
/* Copyright 1996-2011 by */ /* Copyright 1996-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -1513,11 +1513,9 @@
goto Stack_Underflow; goto Stack_Underflow;
/* if num_args isn't of the form 4n or 4n+1, */ /* if num_args isn't of the form 4n or 4n+1, */
/* we reduce it to 4n+1 */ /* we enforce it by clearing the second bit */
nargs = num_args - num_args % 4; nargs = num_args & ~2;
if ( num_args - nargs > 0 )
nargs += 1;
if ( cff_builder_start_point( builder, x, y ) ) if ( cff_builder_start_point( builder, x, y ) )
goto Fail; goto Fail;
@ -1560,11 +1558,9 @@
goto Stack_Underflow; goto Stack_Underflow;
/* if num_args isn't of the form 4n or 4n+1, */ /* if num_args isn't of the form 4n or 4n+1, */
/* we reduce it to 4n+1 */ /* we enforce it by clearing the second bit */
nargs = num_args - num_args % 4; nargs = num_args & ~2;
if ( num_args - nargs > 0 )
nargs += 1;
if ( cff_builder_start_point( builder, x, y ) ) if ( cff_builder_start_point( builder, x, y ) )
goto Fail; goto Fail;
@ -1612,11 +1608,9 @@
goto Stack_Underflow; goto Stack_Underflow;
/* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */
/* we reduce it to the largest one which fits */ /* we enforce it by clearing the second bit */
nargs = num_args - num_args % 4; nargs = num_args & ~2;
if ( num_args - nargs > 0 )
nargs += 1;
args -= nargs; args -= nargs;
if ( check_points( builder, ( nargs / 4 ) * 3 ) ) if ( check_points( builder, ( nargs / 4 ) * 3 ) )
@ -1963,6 +1957,7 @@
/* Save glyph width so that the subglyphs don't overwrite it. */ /* Save glyph width so that the subglyphs don't overwrite it. */
FT_Pos glyph_width = decoder->glyph_width; FT_Pos glyph_width = decoder->glyph_width;
error = cff_operator_seac( decoder, error = cff_operator_seac( decoder,
0L, args[-4], args[-3], 0L, args[-4], args[-3],
(FT_Int)( args[-2] >> 16 ), (FT_Int)( args[-2] >> 16 ),
@ -2705,7 +2700,7 @@
FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, FT_Byte fd_index = cff_fd_select_get( &cff->fd_select,
glyph_index ); glyph_index );
if ( fd_index >= cff->num_subfonts ) if ( fd_index >= cff->num_subfonts )
fd_index = (FT_Byte)( cff->num_subfonts - 1 ); fd_index = (FT_Byte)( cff->num_subfonts - 1 );
top_upm = cff->top_font.font_dict.units_per_em; top_upm = cff->top_font.font_dict.units_per_em;
@ -2961,7 +2956,7 @@
if ( has_vertical_info ) if ( has_vertical_info )
metrics->vertBearingX = metrics->horiBearingX - metrics->vertBearingX = metrics->horiBearingX -
metrics->horiAdvance / 2; metrics->horiAdvance / 2;
else else
{ {
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
ft_synthesize_vertical_metrics( metrics, ft_synthesize_vertical_metrics( metrics,

View file

@ -1458,7 +1458,7 @@
font->header_size < 4 || font->header_size < 4 ||
font->absolute_offsize > 4 ) font->absolute_offsize > 4 )
{ {
FT_TRACE2(( "[not a CFF font header]\n" )); FT_TRACE2(( " not a CFF font header\n" ));
error = CFF_Err_Unknown_File_Format; error = CFF_Err_Unknown_File_Format;
goto Exit; goto Exit;
} }
@ -1576,7 +1576,7 @@
if ( dict->charstrings_offset == 0 ) if ( dict->charstrings_offset == 0 )
{ {
FT_ERROR(( "cff_font_load: no charstrings offset\n" )); FT_ERROR(( "cff_font_load: no charstrings offset\n" ));
error = CFF_Err_Unknown_File_Format; error = CFF_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }

View file

@ -60,7 +60,7 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error ) FT_LOCAL( FT_Error )
cff_font_load( FT_Library library, cff_font_load( FT_Library library,
FT_Stream stream, FT_Stream stream,
FT_Int face_index, FT_Int face_index,
CFF_Font font, CFF_Font font,

View file

@ -4,7 +4,7 @@
/* */ /* */
/* OpenType objects manager (body). */ /* OpenType objects manager (body). */
/* */ /* */
/* Copyright 1996-2011 by */ /* Copyright 1996-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -403,7 +403,7 @@
FT_Int32 idx = 0; FT_Int32 idx = 0;
FT_Int32 length = strlen( name ) + 1; FT_Int32 length = strlen( name ) + 1;
FT_Bool continue_search = 1; FT_Bool continue_search = 1;
while ( continue_search ) while ( continue_search )
{ {
@ -494,13 +494,19 @@
sfnt = (SFNT_Service)FT_Get_Module_Interface( sfnt = (SFNT_Service)FT_Get_Module_Interface(
library, "sfnt" ); library, "sfnt" );
if ( !sfnt ) if ( !sfnt )
goto Bad_Format; {
FT_ERROR(( "cff_face_init: cannot access `sfnt' module\n" ));
error = CFF_Err_Missing_Module;
goto Exit;
}
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
pshinter = (PSHinter_Service)FT_Get_Module_Interface( pshinter = (PSHinter_Service)FT_Get_Module_Interface(
library, "pshinter" ); library, "pshinter" );
FT_TRACE2(( "CFF driver\n" ));
/* create input stream from resource */ /* create input stream from resource */
if ( FT_STREAM_SEEK( 0 ) ) if ( FT_STREAM_SEEK( 0 ) )
goto Exit; goto Exit;
@ -511,8 +517,9 @@
{ {
if ( face->format_tag != TTAG_OTTO ) /* `OTTO'; OpenType/CFF font */ if ( face->format_tag != TTAG_OTTO ) /* `OTTO'; OpenType/CFF font */
{ {
FT_TRACE2(( "[not a valid OpenType/CFF font]\n" )); FT_TRACE2(( " not an OpenType/CFF font\n" ));
goto Bad_Format; error = CFF_Err_Unknown_File_Format;
goto Exit;
} }
/* if we are performing a simple font format check, exit immediately */ /* if we are performing a simple font format check, exit immediately */
@ -604,7 +611,8 @@
" cannot open CFF & CEF fonts\n" " cannot open CFF & CEF fonts\n"
" " " "
" without the `PSNames' module\n" )); " without the `PSNames' module\n" ));
goto Bad_Format; error = CFF_Err_Missing_Module;
goto Exit;
} }
#ifdef FT_DEBUG_LEVEL_TRACE #ifdef FT_DEBUG_LEVEL_TRACE
@ -772,7 +780,7 @@
char* family_name = NULL; char* family_name = NULL;
remove_subset_prefix( cffface->family_name ); remove_subset_prefix( cffface->family_name );
if ( dict->family_name ) if ( dict->family_name )
{ {
@ -819,7 +827,7 @@
style_name = cff_strcpy( memory, fullp ); style_name = cff_strcpy( memory, fullp );
/* remove the style part from the family name (if present) */ /* remove the style part from the family name (if present) */
remove_style( cffface->family_name, style_name ); remove_style( cffface->family_name, style_name );
} }
break; break;
} }
@ -847,22 +855,22 @@
/* */ /* */
/* Compute face flags. */ /* Compute face flags. */
/* */ /* */
flags = (FT_UInt32)( FT_FACE_FLAG_SCALABLE | /* scalable outlines */ flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */
FT_FACE_FLAG_HORIZONTAL | /* horizontal data */ FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
FT_FACE_FLAG_HINTER ); /* has native hinter */ FT_FACE_FLAG_HINTER; /* has native hinter */
if ( sfnt_format ) if ( sfnt_format )
flags |= (FT_UInt32)FT_FACE_FLAG_SFNT; flags |= FT_FACE_FLAG_SFNT;
/* fixed width font? */ /* fixed width font? */
if ( dict->is_fixed_pitch ) if ( dict->is_fixed_pitch )
flags |= (FT_UInt32)FT_FACE_FLAG_FIXED_WIDTH; flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */ /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
#if 0 #if 0
/* kerning available? */ /* kerning available? */
if ( face->kern_pairs ) if ( face->kern_pairs )
flags |= (FT_UInt32)FT_FACE_FLAG_KERNING; flags |= FT_FACE_FLAG_KERNING;
#endif #endif
cffface->face_flags = flags; cffface->face_flags = flags;
@ -1014,10 +1022,6 @@
Exit: Exit:
return error; return error;
Bad_Format:
error = CFF_Err_Unknown_File_Format;
goto Exit;
} }

View file

@ -19,40 +19,78 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include "cffcmap.h"
#include "cffpic.h" #include "cffpic.h"
#include "cfferrs.h"
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
/* forward declaration of PIC init functions from cffdrivr.c */ /* forward declaration of PIC init functions from cffdrivr.c */
FT_Error FT_Create_Class_cff_services( FT_Library, FT_ServiceDescRec**); FT_Error
void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*); FT_Create_Class_cff_services(
void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*); FT_Library library,
void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*); FT_ServiceDescRec** output_class );
void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*);
void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*);
void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*);
/* forward declaration of PIC init functions from cffparse.c */
FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**);
void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*);
/* forward declaration of PIC init functions from cffcmap.c */
void FT_Init_Class_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*);
void FT_Init_Class_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*);
void void
cff_driver_class_pic_free( FT_Library library ) FT_Destroy_Class_cff_services(
FT_Library library,
FT_ServiceDescRec* clazz );
void
FT_Init_Class_cff_service_ps_info(
FT_Library library,
FT_Service_PsInfoRec* clazz );
void
FT_Init_Class_cff_service_glyph_dict(
FT_Library library,
FT_Service_GlyphDictRec* clazz );
void
FT_Init_Class_cff_service_ps_name(
FT_Library library,
FT_Service_PsFontNameRec* clazz );
void
FT_Init_Class_cff_service_get_cmap_info(
FT_Library library,
FT_Service_TTCMapsRec* clazz );
void
FT_Init_Class_cff_service_cid_info(
FT_Library library,
FT_Service_CIDRec* clazz );
/* forward declaration of PIC init functions from cffparse.c */
FT_Error
FT_Create_Class_cff_field_handlers(
FT_Library library,
CFF_Field_Handler** output_class );
void
FT_Destroy_Class_cff_field_handlers(
FT_Library library,
CFF_Field_Handler* clazz );
void
cff_driver_class_pic_free( FT_Library library )
{ {
FT_PIC_Container* pic_container = &library->pic_container; FT_PIC_Container* pic_container = &library->pic_container;
FT_Memory memory = library->memory; FT_Memory memory = library->memory;
if ( pic_container->cff ) if ( pic_container->cff )
{ {
CffModulePIC* container = (CffModulePIC*)pic_container->cff; CffModulePIC* container = ( CffModulePIC* )pic_container->cff;
if(container->cff_services)
FT_Destroy_Class_cff_services(library, container->cff_services);
if ( container->cff_services )
FT_Destroy_Class_cff_services( library,
container->cff_services );
container->cff_services = NULL; container->cff_services = NULL;
if(container->cff_field_handlers) if ( container->cff_field_handlers )
FT_Destroy_Class_cff_field_handlers(library, 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 ); FT_FREE( container );
pic_container->cff = NULL; pic_container->cff = NULL;
@ -76,22 +114,31 @@
pic_container->cff = container; pic_container->cff = container;
/* initialize pointer table - this is how the module usually expects this data */ /* initialize pointer table - this is how the module usually expects this data */
error = FT_Create_Class_cff_services(library, &container->cff_services); error = FT_Create_Class_cff_services( library,
if(error) &container->cff_services );
if ( error )
goto Exit; goto Exit;
error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers); error = FT_Create_Class_cff_field_handlers(
if(error) library, &container->cff_field_handlers );
if ( error )
goto Exit; goto Exit;
FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info); FT_Init_Class_cff_service_ps_info(
FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict); library, &container->cff_service_ps_info );
FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name); FT_Init_Class_cff_service_glyph_dict(
FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info); library, &container->cff_service_glyph_dict );
FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info); FT_Init_Class_cff_service_ps_name(
FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec); library, &container->cff_service_ps_name );
FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec); 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 );
Exit: Exit:
if(error) if ( error )
cff_driver_class_pic_free(library); cff_driver_class_pic_free( library );
return error; return error;
} }

View file

@ -19,7 +19,7 @@
#ifndef __CFFPIC_H__ #ifndef __CFFPIC_H__
#define __CFFPIC_H__ #define __CFFPIC_H__
FT_BEGIN_HEADER FT_BEGIN_HEADER
#include FT_INTERNAL_PIC_H #include FT_INTERNAL_PIC_H
@ -68,6 +68,13 @@ FT_BEGIN_HEADER
#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET (GET_PIC(library)->cff_cmap_unicode_class_rec) #define FT_CFF_CMAP_UNICODE_CLASS_REC_GET (GET_PIC(library)->cff_cmap_unicode_class_rec)
#define FT_CFF_FIELD_HANDLERS_GET (GET_PIC(library)->cff_field_handlers) #define FT_CFF_FIELD_HANDLERS_GET (GET_PIC(library)->cff_field_handlers)
/* see cffpic.c for the implementation */
void
cff_driver_class_pic_free( FT_Library library );
FT_Error
cff_driver_class_pic_init( FT_Library library );
#endif /* FT_CONFIG_OPTION_PIC */ #endif /* FT_CONFIG_OPTION_PIC */
/* */ /* */

View file

@ -269,7 +269,7 @@ FT_BEGIN_HEADER
/* since version 2.3.6 */ /* since version 2.3.6 */
FT_String* registry; FT_String* registry;
FT_String* ordering; FT_String* ordering;
} CFF_FontRec, *CFF_Font; } CFF_FontRec, *CFF_Font;

View file

@ -4,7 +4,7 @@
/* */ /* */
/* CID error codes (specification only). */ /* CID error codes (specification only). */
/* */ /* */
/* Copyright 2001 by */ /* Copyright 2001, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -29,6 +29,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX CID_Err_ #define FT_ERR_PREFIX CID_Err_
#define FT_ERR_BASE FT_Mod_Err_CID #define FT_ERR_BASE FT_Mod_Err_CID

View file

@ -426,7 +426,7 @@
metrics->horiBearingX = cbox.xMin; metrics->horiBearingX = cbox.xMin;
metrics->horiBearingY = cbox.yMax; metrics->horiBearingY = cbox.yMax;
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
{ {
/* make up vertical ones */ /* make up vertical ones */
ft_synthesize_vertical_metrics( metrics, ft_synthesize_vertical_metrics( metrics,

View file

@ -4,7 +4,7 @@
/* */ /* */
/* CID-keyed Type1 font loader (body). */ /* CID-keyed Type1 font loader (body). */
/* */ /* */
/* Copyright 1996-2006, 2009, 2011 by */ /* Copyright 1996-2006, 2009, 2011-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -147,8 +147,8 @@
FT_CALLBACK_DEF( FT_Error ) FT_CALLBACK_DEF( FT_Error )
parse_font_matrix( CID_Face face, cid_parse_font_matrix( CID_Face face,
CID_Parser* parser ) CID_Parser* parser )
{ {
FT_Matrix* matrix; FT_Matrix* matrix;
FT_Vector* offset; FT_Vector* offset;
@ -268,7 +268,7 @@
#include "cidtoken.h" #include "cidtoken.h"
T1_FIELD_CALLBACK( "FDArray", parse_fd_array, 0 ) T1_FIELD_CALLBACK( "FDArray", parse_fd_array, 0 )
T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix, 0 ) T1_FIELD_CALLBACK( "FontMatrix", cid_parse_font_matrix, 0 )
T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 ) T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
{ 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 } { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
@ -513,8 +513,8 @@
static void static void
t1_init_loader( CID_Loader* loader, cid_init_loader( CID_Loader* loader,
CID_Face face ) CID_Face face )
{ {
FT_UNUSED( face ); FT_UNUSED( face );
@ -522,8 +522,8 @@
} }
static void static void
t1_done_loader( CID_Loader* loader ) cid_done_loader( CID_Loader* loader )
{ {
CID_Parser* parser = &loader->parser; CID_Parser* parser = &loader->parser;
@ -641,7 +641,7 @@
FT_Error error; FT_Error error;
t1_init_loader( &loader, face ); cid_init_loader( &loader, face );
parser = &loader.parser; parser = &loader.parser;
error = cid_parser_new( parser, face->root.stream, face->root.memory, error = cid_parser_new( parser, face->root.stream, face->root.memory,
@ -682,7 +682,7 @@
error = cid_read_subrs( face ); error = cid_read_subrs( face );
Exit: Exit:
t1_done_loader( &loader ); cid_done_loader( &loader );
return error; return error;
} }

View file

@ -4,7 +4,7 @@
/* */ /* */
/* CID objects manager (body). */ /* CID objects manager (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by */ /* Copyright 1996-2006, 2008, 2010-2011 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -299,6 +299,13 @@
psaux = (PSAux_Service)FT_Get_Module_Interface( psaux = (PSAux_Service)FT_Get_Module_Interface(
FT_FACE_LIBRARY( face ), "psaux" ); FT_FACE_LIBRARY( face ), "psaux" );
if ( !psaux )
{
FT_ERROR(( "cid_face_init: cannot access `psaux' module\n" ));
error = CID_Err_Missing_Module;
goto Exit;
}
face->psaux = psaux; face->psaux = psaux;
} }
@ -311,6 +318,8 @@
face->pshinter = pshinter; face->pshinter = pshinter;
} }
FT_TRACE2(( "CID driver\n" ));
/* open the tokenizer; this will also check the font format */ /* open the tokenizer; this will also check the font format */
if ( FT_STREAM_SEEK( 0 ) ) if ( FT_STREAM_SEEK( 0 ) )
goto Exit; goto Exit;

View file

@ -73,7 +73,7 @@
if ( ft_strncmp( (char *)stream->cursor, if ( ft_strncmp( (char *)stream->cursor,
"%!PS-Adobe-3.0 Resource-CIDFont", 31 ) ) "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )
{ {
FT_TRACE2(( "[not a valid CID-keyed font]\n" )); FT_TRACE2(( " not a CID-keyed font\n" ));
error = CID_Err_Unknown_File_Format; error = CID_Err_Unknown_File_Format;
} }
@ -99,7 +99,7 @@
if ( stream_len == 0 ) if ( stream_len == 0 )
{ {
FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" )); FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" ));
error = CID_Err_Unknown_File_Format; error = CID_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }

View file

@ -111,13 +111,13 @@
if ( registry ) if ( registry )
*registry = cid->registry; *registry = cid->registry;
if ( ordering ) if ( ordering )
*ordering = cid->ordering; *ordering = cid->ordering;
if ( supplement ) if ( supplement )
*supplement = cid->supplement; *supplement = cid->supplement;
return CID_Err_Ok; return CID_Err_Ok;
} }
@ -196,7 +196,7 @@
FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_SCALABLE |
FT_MODULE_DRIVER_HAS_HINTER, FT_MODULE_DRIVER_HAS_HINTER,
sizeof( FT_DriverRec ), sizeof ( FT_DriverRec ),
"t1cid", /* module name */ "t1cid", /* module name */
0x10000L, /* version 1.0 of driver */ 0x10000L, /* version 1.0 of driver */
0x20000L, /* requires FreeType 2.0 */ 0x20000L, /* requires FreeType 2.0 */
@ -209,9 +209,9 @@
}, },
/* then the other font drivers fields */ /* then the other font drivers fields */
sizeof( CID_FaceRec ), sizeof ( CID_FaceRec ),
sizeof( CID_SizeRec ), sizeof ( CID_SizeRec ),
sizeof( CID_GlyphSlotRec ), sizeof ( CID_GlyphSlotRec ),
cid_face_init, cid_face_init,
cid_face_done, cid_face_done,

View file

@ -28,7 +28,7 @@ FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
#error "this module does not support PIC yet" #error "this module does not support PIC yet"
#endif #endif
FT_CALLBACK_TABLE FT_CALLBACK_TABLE

View file

@ -1334,7 +1334,7 @@
l[1] = stateArray_length_p; l[1] = stateArray_length_p;
l[2] = entryTable_length_p; l[2] = entryTable_length_p;
gxv_set_length_by_ulong_offset( o, l, buff, 4, table_size, valid ); gxv_set_length_by_ulong_offset( o, l, buff, 3, table_size, valid );
} }
@ -1704,9 +1704,9 @@
const FT_String* name, const FT_String* name,
GXV_odtect_Range odtect ) GXV_odtect_Range odtect )
{ {
odtect->range[ odtect->nRanges ].start = start; odtect->range[odtect->nRanges].start = start;
odtect->range[ odtect->nRanges ].length = length; odtect->range[odtect->nRanges].length = length;
odtect->range[ odtect->nRanges ].name = (FT_String*)name; odtect->range[odtect->nRanges].name = (FT_String*)name;
odtect->nRanges++; odtect->nRanges++;
} }

View file

@ -4,7 +4,8 @@
/* */ /* */
/* TrueTypeGX/AAT common tables validation (specification). */ /* TrueTypeGX/AAT common tables validation (specification). */
/* */ /* */
/* Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* Copyright 2004, 2005, 2012 */
/* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -316,7 +317,7 @@ FT_BEGIN_HEADER
#define GXV_32BIT_ALIGNMENT_VALIDATE( a ) \ #define GXV_32BIT_ALIGNMENT_VALIDATE( a ) \
FT_BEGIN_STMNT \ FT_BEGIN_STMNT \
{ \ { \
if ( 0 != ( (a) % 4 ) ) \ if ( (a) & 3 ) \
FT_INVALID_OFFSET ; \ FT_INVALID_OFFSET ; \
} \ } \
FT_END_STMNT FT_END_STMNT

View file

@ -4,7 +4,8 @@
/* */ /* */
/* TrueTypeGX/AAT validation module error codes (specification only). */ /* TrueTypeGX/AAT validation module error codes (specification only). */
/* */ /* */
/* Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* Copyright 2004, 2005, 2012 */
/* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -38,6 +39,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX GXV_Err_ #define FT_ERR_PREFIX GXV_Err_
#define FT_ERR_BASE FT_Mod_Err_GXV #define FT_ERR_BASE FT_Mod_Err_GXV

View file

@ -4,7 +4,7 @@
/* */ /* */
/* TrueTypeGX/AAT feat table validation (body). */ /* TrueTypeGX/AAT feat table validation (body). */
/* */ /* */
/* Copyright 2004, 2005, 2008 by */ /* Copyright 2004, 2005, 2008, 2012 by */
/* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
@ -176,7 +176,7 @@
setting = FT_NEXT_USHORT( p ); setting = FT_NEXT_USHORT( p );
/* If we have exclusive setting, the setting should be odd. */ /* If we have exclusive setting, the setting should be odd. */
if ( exclusive && ( setting % 2 ) == 0 ) if ( exclusive && ( setting & 1 ) == 0 )
FT_INVALID_DATA; FT_INVALID_DATA;
gxv_feat_name_index_validate( p, limit, valid ); gxv_feat_name_index_validate( p, limit, valid );

View file

@ -269,7 +269,7 @@
const FT_Module_Class gxv_module_class = const FT_Module_Class gxv_module_class =
{ {
0, 0,
sizeof( FT_ModuleRec ), sizeof ( FT_ModuleRec ),
"gxvalid", "gxvalid",
0x10000L, 0x10000L,
0x20000L, 0x20000L,

View file

@ -36,7 +36,7 @@ FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
#error "this module does not support PIC yet" #error "this module does not support PIC yet"
#endif #endif
FT_EXPORT_VAR( const FT_Module_Class ) gxv_module_class; FT_EXPORT_VAR( const FT_Module_Class ) gxv_module_class;

View file

@ -233,7 +233,7 @@
/* XXX: check range? */ /* XXX: check range? */
offset = (FT_UShort)( base_value_p->u + offset = (FT_UShort)( base_value_p->u +
relative_gindex * sizeof( FT_UShort ) ); relative_gindex * sizeof ( FT_UShort ) );
p = valid->lookuptbl_head + offset; p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit; limit = lookuptbl_limit;

View file

@ -8,7 +8,7 @@
/* parse compressed PCF fonts, as found with many X11 server */ /* parse compressed PCF fonts, as found with many X11 server */
/* distributions. */ /* distributions. */
/* */ /* */
/* Copyright 2002-2006, 2009-2011 by */ /* Copyright 2002-2006, 2009-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -32,6 +32,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX Gzip_Err_ #define FT_ERR_PREFIX Gzip_Err_
#define FT_ERR_BASE FT_Mod_Err_Gzip #define FT_ERR_BASE FT_Mod_Err_Gzip
@ -42,7 +43,7 @@
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
#error "gzip code does not support PIC yet" #error "gzip code does not support PIC yet"
#endif #endif
#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB

View file

@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */ /* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */ /* distributions. */
/* */ /* */
/* Copyright 2004, 2005, 2006, 2009, 2010 by */ /* Copyright 2004-2006, 2009, 2010, 2012 by */
/* Albert Chin-A-Young. */ /* Albert Chin-A-Young. */
/* */ /* */
/* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */ /* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */
@ -34,6 +34,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX LZW_Err_ #define FT_ERR_PREFIX LZW_Err_
#define FT_ERR_BASE FT_Mod_Err_LZW #define FT_ERR_BASE FT_Mod_Err_LZW
@ -44,7 +45,7 @@
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
#error "lzw code does not support PIC yet" #error "lzw code does not support PIC yet"
#endif #endif
#include "ftzopen.h" #include "ftzopen.h"

View file

@ -4,7 +4,7 @@
/* */ /* */
/* OpenType validation module error codes (specification only). */ /* OpenType validation module error codes (specification only). */
/* */ /* */
/* Copyright 2004, 2005 by */ /* Copyright 2004, 2005, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -30,6 +30,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX OTV_Err_ #define FT_ERR_PREFIX OTV_Err_
#define FT_ERR_BASE FT_Mod_Err_OTvalid #define FT_ERR_BASE FT_Mod_Err_OTvalid

View file

@ -266,7 +266,7 @@
const FT_Module_Class otv_module_class = const FT_Module_Class otv_module_class =
{ {
0, 0,
sizeof( FT_ModuleRec ), sizeof ( FT_ModuleRec ),
"otvalid", "otvalid",
0x10000L, 0x10000L,
0x20000L, 0x20000L,

View file

@ -29,7 +29,7 @@ FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
#error "this module does not support PIC yet" #error "this module does not support PIC yet"
#endif #endif
FT_EXPORT_VAR( const FT_Module_Class ) otv_module_class; FT_EXPORT_VAR( const FT_Module_Class ) otv_module_class;

View file

@ -2,8 +2,7 @@
FreeType font driver for pcf files FreeType font driver for pcf files
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, Copyright (C) 2000-2004, 2006-2011 by
2010 by
Francesco Zappa Nardelli Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
@ -36,7 +35,7 @@ THE SOFTWARE.
#include FT_BZIP2_H #include FT_BZIP2_H
#include FT_ERRORS_H #include FT_ERRORS_H
#include FT_BDF_H #include FT_BDF_H
#include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_IDS_H
#include "pcf.h" #include "pcf.h"
#include "pcfdrivr.h" #include "pcfdrivr.h"
@ -248,8 +247,6 @@ THE SOFTWARE.
FT_FREE( face->charset_encoding ); FT_FREE( face->charset_encoding );
FT_FREE( face->charset_registry ); FT_FREE( face->charset_registry );
FT_TRACE4(( "PCF_Face_Done: done face\n" ));
/* close compressed stream if any */ /* close compressed stream if any */
if ( pcfface->stream == &face->comp_stream ) if ( pcfface->stream == &face->comp_stream )
{ {
@ -274,6 +271,8 @@ THE SOFTWARE.
FT_UNUSED( face_index ); FT_UNUSED( face_index );
FT_TRACE2(( "PCF driver\n" ));
error = pcf_load_font( stream, face ); error = pcf_load_font( stream, face );
if ( error ) if ( error )
{ {
@ -405,7 +404,7 @@ THE SOFTWARE.
return error; return error;
Fail: Fail:
FT_TRACE2(( "[not a valid PCF file]\n" )); FT_TRACE2(( " not a PCF file\n" ));
PCF_Face_Done( pcfface ); PCF_Face_Done( pcfface );
error = PCF_Err_Unknown_File_Format; /* error */ error = PCF_Err_Unknown_File_Format; /* error */
goto Exit; goto Exit;
@ -684,8 +683,8 @@ THE SOFTWARE.
0, 0,
0, 0, /* FT_Module_Constructor */
0, 0, /* FT_Module_Destructor */
pcf_driver_requester pcf_driver_requester
}, },

View file

@ -35,7 +35,7 @@ FT_BEGIN_HEADER
#ifdef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_PIC
#error "this module does not support PIC yet" #error "this module does not support PIC yet"
#endif #endif
FT_EXPORT_VAR( const FT_Driver_ClassRec ) pcf_driver_class; FT_EXPORT_VAR( const FT_Driver_ClassRec ) pcf_driver_class;

View file

@ -4,7 +4,7 @@
/* */ /* */
/* PCF error codes (specification only). */ /* PCF error codes (specification only). */
/* */ /* */
/* Copyright 2001 by */ /* Copyright 2001, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -29,6 +29,7 @@
#undef __FTERRORS_H__ #undef __FTERRORS_H__
#undef FT_ERR_PREFIX
#define FT_ERR_PREFIX PCF_Err_ #define FT_ERR_PREFIX PCF_Err_
#define FT_ERR_BASE FT_Mod_Err_PCF #define FT_ERR_BASE FT_Mod_Err_PCF

View file

@ -2,8 +2,7 @@
FreeType font driver for pcf fonts FreeType font driver for pcf fonts
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, Copyright 2000-2010, 2012 by
2010 by
Francesco Zappa Nardelli Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
@ -496,7 +495,8 @@ THE SOFTWARE.
goto Bail; goto Bail;
} }
if ( FT_NEW_ARRAY( strings, string_size ) ) /* allocate one more byte so that we have a final null byte */
if ( FT_NEW_ARRAY( strings, string_size + 1 ) )
goto Bail; goto Bail;
error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size ); error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size );

Some files were not shown because too many files have changed in this diff Show more