diff --git a/Jamrules b/Jamrules index 0b63980dcd..ffd0bd85a5 100644 --- a/Jamrules +++ b/Jamrules @@ -2227,12 +2227,14 @@ FT2_LIB = freetype ; FT2_COMPONENTS ?= gzip # support for gzip-compressed files. autohint # auto-hinter + autofit base # base component (public APIs) bdf # BDF font driver cache # cache sub-system cff # CFF/CEF font driver cid # Postscript CID-keyed font driver lzw # LZW routines + otvalid pcf # PCF font driver pfr # PFR/TrueDoc font driver psaux # Common Postscript routines module diff --git a/headers/libs/freetype2/freetype/cache/ftccache.h b/headers/libs/freetype2/freetype/cache/ftccache.h index 7c7688dba2..f2e10281b3 100644 --- a/headers/libs/freetype2/freetype/cache/ftccache.h +++ b/headers/libs/freetype2/freetype/cache/ftccache.h @@ -4,7 +4,7 @@ /* */ /* FreeType internal cache interface (specification). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -248,7 +248,8 @@ FT_BEGIN_HEADER error = FTC_Cache_NewNode( _cache, _hash, query, &_node ); \ \ _Ok: \ - *(FTC_Node*)&(node) = _node; \ + _pnode = (FTC_Node*)(void*)&(node); \ + *_pnode = _node; \ FT_END_STMNT #else /* !FTC_INLINE */ @@ -261,6 +262,52 @@ FT_BEGIN_HEADER #endif /* !FTC_INLINE */ + + /* + * This macro, together with FTC_CACHE_TRYLOOP_END, defines a retry + * loop to flush the cache repeatedly in case of memory overflows. + * + * It is used when creating a new cache node, or within a lookup + * that needs to allocate data (e.g., the sbit cache lookup). + * + * Example: + * + * { + * FTC_CACHE_TRYLOOP( cache ) + * error = load_data( ... ); + * FTC_CACHE_TRYLOOP_END() + * } + * + */ +#define FTC_CACHE_TRYLOOP( cache ) \ + { \ + FTC_Manager _try_manager = FTC_CACHE( cache )->manager; \ + FT_UInt _try_count = 4; \ + \ + \ + for (;;) \ + { \ + FT_UInt _try_done; + + +#define FTC_CACHE_TRYLOOP_END() \ + if ( !error || error != FT_Err_Out_Of_Memory ) \ + break; \ + \ + _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \ + if ( _try_done == 0 ) \ + break; \ + \ + if ( _try_done == _try_count ) \ + { \ + _try_count *= 2; \ + if ( _try_count < _try_done || \ + _try_count > _try_manager->num_nodes ) \ + _try_count = _try_manager->num_nodes; \ + } \ + } \ + } + /* */ FT_END_HEADER diff --git a/headers/libs/freetype2/freetype/cache/ftcglyph.h b/headers/libs/freetype2/freetype/cache/ftcglyph.h index be237f934a..3f8301a514 100644 --- a/headers/libs/freetype2/freetype/cache/ftcglyph.h +++ b/headers/libs/freetype2/freetype/cache/ftcglyph.h @@ -238,7 +238,7 @@ FT_BEGIN_HEADER #define FTC_CACHE__GCACHE_CLASS( x ) \ FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class ) #define FTC_CACHE__FAMILY_CLASS( x ) \ - ((FTC_MruListClass) FTC_CACHE__GCACHE_CLASS(x)->family_class) + ( (FTC_MruListClass)FTC_CACHE__GCACHE_CLASS( x )->family_class ) /* convenience function; use it instead of FTC_Manager_Register_Cache */ @@ -255,6 +255,14 @@ FT_BEGIN_HEADER FTC_Node *anode ); + /* */ + + +#define FTC_FAMILY_FREE( family, cache ) \ + FTC_MruList_Remove( &FTC_GCACHE((cache))->families, \ + (FTC_MruNode)(family) ) + + #ifdef FTC_INLINE #define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \ @@ -270,7 +278,17 @@ FT_BEGIN_HEADER FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare, \ _gquery->family, error ); \ if ( !error ) \ + { \ + FTC_Family _gqfamily = _gquery->family; \ + \ + \ + _gqfamily->num_nodes++; \ + \ FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ); \ + \ + if ( --_gqfamily->num_nodes == 0 ) \ + FTC_FAMILY_FREE( _gqfamily, _gcache ); \ + } \ FT_END_STMNT /* */ diff --git a/headers/libs/freetype2/freetype/cache/ftcmru.h b/headers/libs/freetype2/freetype/cache/ftcmru.h index 9556f58e75..ac1a1a92e4 100644 --- a/headers/libs/freetype2/freetype/cache/ftcmru.h +++ b/headers/libs/freetype2/freetype/cache/ftcmru.h @@ -4,7 +4,7 @@ /* */ /* Simple MRU list-cache (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2004 by */ +/* Copyright 2000-2001, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -86,7 +86,7 @@ FT_BEGIN_HEADER typedef struct FTC_MruListClassRec_ const * FTC_MruListClass; - typedef FT_Int + typedef FT_Bool (*FTC_MruNode_CompareFunc)( FTC_MruNode node, FT_Pointer key ); @@ -154,7 +154,7 @@ FT_BEGIN_HEADER FTC_MruList_Lookup( FTC_MruList list, FT_Pointer key, FTC_MruNode *pnode ); - + FT_EXPORT( void ) FTC_MruList_Remove( FTC_MruList list, @@ -172,34 +172,35 @@ FT_BEGIN_HEADER FT_BEGIN_STMNT \ FTC_MruNode* _pfirst = &(list)->nodes; \ FTC_MruNode_CompareFunc _compare = (FTC_MruNode_CompareFunc)(compare); \ - FTC_MruNode _first, _node; \ - \ - \ - error = 0; \ - _first = *(_pfirst); \ - _node = NULL; \ - \ - if ( _first ) \ - { \ - _node = _first; \ - do \ - { \ - if ( _compare( _node, (key) ) ) \ - { \ - if ( _node != _first ) \ - FTC_MruNode_Up( _pfirst, _node ); \ - \ - *(FTC_MruNode*)&(node) = _node; \ - goto _MruOk; \ - } \ - _node = _node->next; \ - \ - } while ( _node != _first) ; \ - } \ - \ - error = FTC_MruList_New( (list), (key), (FTC_MruNode*)&(node) ); \ - _MruOk: \ - ; \ + FTC_MruNode _first, _node, *_pnode; \ + \ + \ + error = 0; \ + _first = *(_pfirst); \ + _node = NULL; \ + \ + if ( _first ) \ + { \ + _node = _first; \ + do \ + { \ + if ( _compare( _node, (key) ) ) \ + { \ + if ( _node != _first ) \ + FTC_MruNode_Up( _pfirst, _node ); \ + \ + _pnode = (FTC_MruNode*)(void*)&(node); \ + *_pnode = _node; \ + goto _MruOk; \ + } \ + _node = _node->next; \ + \ + } while ( _node != _first) ; \ + } \ + \ + error = FTC_MruList_New( (list), (key), (FTC_MruNode*)(void*)&(node) ); \ + _MruOk: \ + ; \ FT_END_STMNT #define FTC_MRULIST_LOOKUP( list, key, node, error ) \ @@ -208,7 +209,7 @@ FT_BEGIN_HEADER #else /* !FTC_INLINE */ #define FTC_MRULIST_LOOKUP( list, key, node, error ) \ - error = FTC_MruList_Lookup( (list), (key), (FTC_MruNode*)&(node) ) + error = FTC_MruList_Lookup( (list), (key), (FTC_MruNode*)&(node) ) #endif /* !FTC_INLINE */ diff --git a/headers/libs/freetype2/freetype/config/ftconfig.h b/headers/libs/freetype2/freetype/config/ftconfig.h index 4bd8cf6174..e878efba18 100644 --- a/headers/libs/freetype2/freetype/config/ftconfig.h +++ b/headers/libs/freetype2/freetype/config/ftconfig.h @@ -72,20 +72,23 @@ FT_BEGIN_HEADER /* The size of an `int' type. */ -#if FT_UINT_MAX == 0xFFFFFFFFUL -#define FT_SIZEOF_INT (32 / FT_CHAR_BIT) -#elif FT_UINT_MAX == 0xFFFFU +#if FT_UINT_MAX == 0xFFFFUL #define FT_SIZEOF_INT (16 / FT_CHAR_BIT) -#elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU +#elif FT_UINT_MAX == 0xFFFFFFFFUL +#define FT_SIZEOF_INT (32 / FT_CHAR_BIT) +#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL #define FT_SIZEOF_INT (64 / FT_CHAR_BIT) #else #error "Unsupported size of `int' type!" #endif - /* The size of a `long' type. */ -#if FT_ULONG_MAX == 0xFFFFFFFFUL + /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ + /* DM642) is recognized but avoided. */ +#if FT_ULONG_MAX == 0xFFFFFFFFUL #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) -#elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU +#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL +#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) +#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) #else #error "Unsupported size of `long' type!" diff --git a/headers/libs/freetype2/freetype/config/ftheader.h b/headers/libs/freetype2/freetype/config/ftheader.h index b996a7a6fb..a6df10d2ad 100644 --- a/headers/libs/freetype2/freetype/config/ftheader.h +++ b/headers/libs/freetype2/freetype/config/ftheader.h @@ -18,6 +18,7 @@ #ifndef __FT_HEADER_H__ #define __FT_HEADER_H__ + /*@***********************************************************************/ /* */ /* */ @@ -92,6 +93,7 @@ /* */ /*************************************************************************/ + /* configuration files */ /*************************************************************************/ @@ -362,6 +364,7 @@ /* */ #define FT_BDF_H + /*************************************************************************/ /* */ /* @macro: */ @@ -410,6 +413,18 @@ #define FT_GLYPH_H + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_BITMAP_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the API of the optional bitmap conversion component. */ + /* */ +#define FT_BITMAP_H + + /*************************************************************************/ /* */ /* @macro: */ @@ -529,6 +544,20 @@ /* */ #define FT_SFNT_NAMES_H + + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_OPENTYPE_VALIDATE_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* the optional FreeType 2 API used to validate OpenType tables */ + /* (BASE, GDEF, GPOS, GSUB, JSTF). */ + /* */ +#define FT_OPENTYPE_VALIDATE_H + + /* */ #define FT_TRIGONOMETRY_H diff --git a/headers/libs/freetype2/freetype/config/ftmodule.h b/headers/libs/freetype2/freetype/config/ftmodule.h index d0e6f16a3c..b8f67bb048 100644 --- a/headers/libs/freetype2/freetype/config/ftmodule.h +++ b/headers/libs/freetype2/freetype/config/ftmodule.h @@ -1,8 +1,12 @@ -FT_USE_MODULE(autohint_module_class) +FT_USE_MODULE(autofit_module_class) +FT_USE_MODULE(tt_driver_class) +FT_USE_MODULE(t1_driver_class) FT_USE_MODULE(cff_driver_class) FT_USE_MODULE(t1cid_driver_class) +FT_USE_MODULE(pfr_driver_class) +FT_USE_MODULE(t42_driver_class) +FT_USE_MODULE(winfnt_driver_class) FT_USE_MODULE(pcf_driver_class) -FT_USE_MODULE(bdf_driver_class) FT_USE_MODULE(psaux_module_class) FT_USE_MODULE(psnames_module_class) FT_USE_MODULE(pshinter_module_class) @@ -11,9 +15,5 @@ FT_USE_MODULE(sfnt_module_class) FT_USE_MODULE(ft_smooth_renderer_class) FT_USE_MODULE(ft_smooth_lcd_renderer_class) FT_USE_MODULE(ft_smooth_lcdv_renderer_class) -FT_USE_MODULE(tt_driver_class) -FT_USE_MODULE(t1_driver_class) -FT_USE_MODULE(t42_driver_class) -FT_USE_MODULE(pfr_driver_class) -FT_USE_MODULE(winfnt_driver_class) - +FT_USE_MODULE(otv_module_class) +FT_USE_MODULE(bdf_driver_class) diff --git a/headers/libs/freetype2/freetype/config/ftoption.h b/headers/libs/freetype2/freetype/config/ftoption.h index a527ec12d1..42579ad832 100644 --- a/headers/libs/freetype2/freetype/config/ftoption.h +++ b/headers/libs/freetype2/freetype/config/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -436,7 +436,7 @@ FT_BEGIN_HEADER /* Do not #undef this macro here, since the build system might */ /* define it for certain configurations only. */ /* */ -/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ +/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ /*************************************************************************/ @@ -446,7 +446,7 @@ FT_BEGIN_HEADER /* work-around hinting system. Note that for the moment, the algorithm */ /* is only used when selected at runtime through the parameter tag */ /* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */ - /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally actived */ + /* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally activated. */ /* */ #define TT_CONFIG_OPTION_UNPATENTED_HINTING @@ -483,6 +483,16 @@ FT_BEGIN_HEADER #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED + /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ + /* support for Apple's distortable font technology (fvar, gvar, cvar, */ + /* and avar tables). This has many similarities to Type 1 Multiple */ + /* Masters support. */ + /* */ +#define TT_CONFIG_OPTION_GX_VAR_SUPPORT + + /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -540,23 +550,11 @@ FT_BEGIN_HEADER /* */ /* - * The FT_CONFIG_OPTION_CHESTER_XXXX macros are used to toggle some recent - * improvements to the auto-hinter contributed by David Chester. They will - * most likely disappear completely in the next release. For now, you - * should always keep them defined. + * This temporary macro is used to control various optimizations for + * reducing the heap footprint of memory-mapped TrueType files. * */ -#define FT_CONFIG_OPTION_CHESTER_HINTS - -#ifdef FT_CONFIG_OPTION_CHESTER_HINTS - -#define FT_CONFIG_CHESTER_SMALL_F -#define FT_CONFIG_CHESTER_ASCENDER -#define FT_CONFIG_CHESTER_SERIF -#define FT_CONFIG_CHESTER_STEM -#define FT_CONFIG_CHESTER_BLUE_SCALE - -#endif /* FT_CONFIG_OPTION_CHESTER_HINTS */ +/* #define FT_OPTIMIZE_MEMORY */ FT_END_HEADER diff --git a/headers/libs/freetype2/freetype/config/ftstdlib.h b/headers/libs/freetype2/freetype/config/ftstdlib.h index 297d6f0175..4b9b398b25 100644 --- a/headers/libs/freetype2/freetype/config/ftstdlib.h +++ b/headers/libs/freetype2/freetype/config/ftstdlib.h @@ -33,6 +33,11 @@ #define __FTSTDLIB_H__ +#include + +#define ft_ptrdiff_t ptrdiff_t + + /**********************************************************************/ /* */ /* integer limits */ @@ -61,6 +66,7 @@ #include #define FT_UINT_MAX UINT_MAX +#define FT_INT_MAX INT_MAX #define FT_ULONG_MAX ULONG_MAX diff --git a/headers/libs/freetype2/freetype/freetype.h b/headers/libs/freetype2/freetype/freetype.h index 6acf166119..7b2a96c385 100644 --- a/headers/libs/freetype2/freetype/freetype.h +++ b/headers/libs/freetype2/freetype/freetype.h @@ -4,7 +4,7 @@ /* */ /* FreeType high-level API and common types (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -44,7 +44,7 @@ /* */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 1 -#define FREETYPE_PATCH 8 +#define FREETYPE_PATCH 10 #include @@ -172,6 +172,7 @@ FT_BEGIN_HEADER /* FT_CharMapRec */ /* FT_Select_Charmap */ /* FT_Set_Charmap */ + /* FT_Get_Charmap_Index */ /* */ /*************************************************************************/ @@ -188,34 +189,42 @@ FT_BEGIN_HEADER /* instead. */ /* */ /* */ - /* width :: The glyph's width. */ + /* width :: */ + /* The glyph's width. */ /* */ - /* height :: The glyph's height. */ + /* height :: */ + /* The glyph's height. */ /* */ - /* horiBearingX :: Horizontal left side bearing. */ + /* horiBearingX :: */ + /* Left side bearing for horizontal layout. */ /* */ - /* horiBearingY :: Horizontal top side bearing. */ + /* horiBearingY :: */ + /* Top side bearing for horizontal layout. */ /* */ - /* horiAdvance :: Horizontal advance width. */ + /* horiAdvance :: */ + /* Advance width for horizontal layout. */ /* */ - /* vertBearingX :: Vertical left side bearing. */ + /* vertBearingX :: */ + /* Left side bearing for vertical layout. */ /* */ - /* vertBearingY :: Vertical top side bearing. */ + /* vertBearingY :: */ + /* Top side bearing for vertical layout. */ /* */ - /* vertAdvance :: Vertical advance height. */ + /* vertAdvance :: */ + /* Advance height for vertical layout. */ /* */ typedef struct FT_Glyph_Metrics_ { - FT_Pos width; /* glyph width */ - FT_Pos height; /* glyph height */ + FT_Pos width; + FT_Pos height; - FT_Pos horiBearingX; /* left side bearing in horizontal layouts */ - FT_Pos horiBearingY; /* top side bearing in horizontal layouts */ - FT_Pos horiAdvance; /* advance width for horizontal layout */ + FT_Pos horiBearingX; + FT_Pos horiBearingY; + FT_Pos horiAdvance; - FT_Pos vertBearingX; /* left side bearing in vertical layouts */ - FT_Pos vertBearingY; /* top side bearing in vertical layouts */ - FT_Pos vertAdvance; /* advance height for vertical layout */ + FT_Pos vertBearingX; + FT_Pos vertBearingY; + FT_Pos vertAdvance; } FT_Glyph_Metrics; @@ -249,6 +258,7 @@ FT_BEGIN_HEADER /* x_ppem :: The horizontal ppem value (in 26.6 fractional format). */ /* */ /* y_ppem :: The vertical ppem value (in 26.6 fractional format). */ + /* Usually, this is the `nominal' pixel height of the font. */ /* */ /* */ /* The values in this structure are taken from the bitmap font. If */ @@ -262,10 +272,10 @@ FT_BEGIN_HEADER /* where `size' is in points. */ /* */ /* Windows FNT: */ - /* The `size', `x_ppem', and `y_ppem' parameters are not reliable: */ - /* There exist fonts (e.g. app850.fon) which have a wrong size for */ - /* some subfonts; since FNT files don't contain ppem but dpi values */ - /* the computed x_ppem and y_ppem numbers are thus wrong also. */ + /* The `size' parameter is not reliable: There exist fonts (e.g., */ + /* app850.fon) which have a wrong size for some subfonts; x_ppem */ + /* and y_ppem are thus set equal to pixel width and height given in */ + /* in the Windows FNT header. */ /* */ /* TrueType embedded bitmaps: */ /* `size', `width', and `height' values are not contained in the */ @@ -1459,6 +1469,14 @@ FT_BEGIN_HEADER /* Note that the app will need to know about the */ /* image format. */ /* */ + /* lsb_delta :: The difference between hinted and unhinted */ + /* left side bearing while autohinting is */ + /* active. Zero otherwise. */ + /* */ + /* rsb_delta :: The difference between hinted and unhinted */ + /* right side bearing while autohinting is */ + /* active. Zero otherwise. */ + /* */ /* */ /* If @FT_Load_Glyph is called with default flags (see */ /* @FT_LOAD_DEFAULT) the glyph image is loaded in the glyph slot in */ @@ -1478,6 +1496,34 @@ FT_BEGIN_HEADER /* position (e.g. coordinates [0,0] on the baseline). Of course, */ /* `slot->format' is also changed to `FT_GLYPH_FORMAT_BITMAP' . */ /* */ + /* */ + /* Here a small pseudo code fragment which shows how to use */ + /* `lsb_delta' and `rsb_delta': */ + /* */ + /* { */ + /* FT_Pos origin_x = 0; */ + /* FT_Pos prev_rsb_delta = 0; */ + /* */ + /* */ + /* for all glyphs do */ + /* */ + /* */ + /* */ + /* */ + /* if ( prev_rsb_delta - face->glyph->lsb_delta >= 32 ) */ + /* origin_x -= 64; */ + /* else if ( prev_rsb_delta - face->glyph->lsb_delta < -32 ) */ + /* origin_x += 64; */ + /* */ + /* prev_rsb_delta = face->glyph->rsb_delta; */ + /* */ + /* */ + /* */ + /* origin_x += face->glyph->advance.x; */ + /* endfor */ + /* } */ + /* */ typedef struct FT_GlyphSlotRec_ { FT_Library library; @@ -1505,6 +1551,9 @@ FT_BEGIN_HEADER void* control_data; long control_len; + FT_Pos lsb_delta; + FT_Pos rsb_delta; + void* other; FT_Slot_Internal internal; @@ -1863,8 +1912,8 @@ FT_BEGIN_HEADER /* @FT_Open_Face can be used to determine and/or check the font */ /* format of a given font resource. If the `face_index' field is */ /* negative, the function will _not_ return any face handle in */ - /* `*face'; the return value is 0 if the font format is recognized, */ - /* or non-zero otherwise. */ + /* `*aface'; the function's return value is 0 if the font format is */ + /* recognized, or non-zero otherwise. */ /* */ FT_EXPORT( FT_Error ) FT_Open_Face( FT_Library library, @@ -1992,8 +2041,9 @@ FT_BEGIN_HEADER /* FreeType error code. 0 means success. */ /* */ /* */ - /* When dealing with fixed-size faces (i.e., non-scalable formats), */ - /* @FT_Set_Pixel_Sizes provides a more convenient interface. */ + /* For BDF and PCF formats, this function uses the `PIXEL_SIZE' */ + /* property of the bitmap font; the `char_width' parameter is */ + /* ignored. */ /* */ FT_EXPORT( FT_Error ) FT_Set_Char_Size( FT_Face face, @@ -2046,6 +2096,9 @@ FT_BEGIN_HEADER /* which contain a single bitmap strike only (BDF, PCF, FNT) ignore */ /* `pixel_width'. */ /* */ + /* For BDF and PCF formats, this function uses the sum of the */ + /* `FONT_ASCENT' and `FONT_DESCENT' properties of the bitmap font. */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Pixel_Sizes( FT_Face face, FT_UInt pixel_width, @@ -2223,9 +2276,11 @@ FT_BEGIN_HEADER * * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: * Indicates that the glyph loader should ignore the global advance - * width defined in the font. As far as we know, this is only used by - * the X-TrueType font server, in order to deal correctly with the - * incorrect metrics contained in DynaLab's TrueType CJK fonts. + * width defined in the font. For historical reasons (to support + * buggy CJK fonts), FreeType uses the value of the `advanceWidthMax' + * field in the `htmx' table for all glyphs if the font is monospaced. + * Activating this flags makes FreeType use the metric values given in + * the `htmx' table. * * FT_LOAD_NO_RECURSE :: * This flag is only used internally. It merely indicates that the @@ -2315,8 +2370,8 @@ FT_BEGIN_HEADER /* */ /* */ /* A function used to set the transformation that is applied to glyph */ - /* images just before they are converted to bitmaps in a glyph slot */ - /* when @FT_Render_Glyph is called. */ + /* images when they are loaded into a glyph slot through */ + /* @FT_Load_Glyph. */ /* */ /* */ /* face :: A handle to the source face object. */ @@ -2530,9 +2585,9 @@ FT_BEGIN_HEADER /* kerning vector. */ /* */ /* */ - /* akerning :: The kerning vector. This is in font units for */ - /* scalable formats, and in pixels for fixed-sizes */ - /* formats. */ + /* akerning :: The kerning vector. This is either in font units */ + /* or in pixels (26.6 format) for scalable formats, */ + /* and in pixels for fixed-sizes formats. */ /* */ /* */ /* FreeType error code. 0 means success. */ @@ -2601,13 +2656,13 @@ FT_BEGIN_HEADER /* */ /* */ /* Retrieves the ASCII Postscript name of a given face, if available. */ - /* This should only work with Postscript and TrueType fonts. */ + /* This only works with Postscript and TrueType fonts. */ /* */ /* */ /* face :: A handle to the source face object. */ /* */ /* */ - /* A pointer to the face's Postscript name. NULL if un-available. */ + /* A pointer to the face's Postscript name. NULL if unavailable. */ /* */ /* */ /* The returned pointer is owned by the face and will be destroyed */ @@ -2672,6 +2727,25 @@ FT_BEGIN_HEADER FT_CharMap charmap ); + /*************************************************************************/ + /* */ + /* @function: */ + /* FT_Get_Charmap_Index */ + /* */ + /* @description: */ + /* Retrieve index of a given charmap. */ + /* */ + /* @input: */ + /* charmap :: A handle to a charmap. */ + /* */ + /* @return: */ + /* The index into the array of character maps within the face to */ + /* which `charmap' belongs. */ + /* */ + FT_EXPORT( FT_Int ) + FT_Get_Charmap_Index( FT_CharMap charmap ); + + /*************************************************************************/ /* */ /* */ @@ -2815,7 +2889,7 @@ FT_BEGIN_HEADER /* Computations */ /* */ /* */ - /* Crunching fixed numbers and vectors */ + /* Crunching fixed numbers and vectors. */ /* */ /* */ /* This section contains various functions used to perform */ @@ -3000,8 +3074,8 @@ FT_BEGIN_HEADER /* The result is undefined if either `vector' or `matrix' is invalid. */ /* */ FT_EXPORT( void ) - FT_Vector_Transform( FT_Vector* vec, - FT_Matrix* matrix ); + FT_Vector_Transform( FT_Vector* vec, + const FT_Matrix* matrix ); /* */ diff --git a/headers/libs/freetype2/freetype/ftbdf.h b/headers/libs/freetype2/freetype/ftbdf.h index aa411440d9..493bca5115 100644 --- a/headers/libs/freetype2/freetype/ftbdf.h +++ b/headers/libs/freetype2/freetype/ftbdf.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (specification). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,13 +38,13 @@ FT_BEGIN_HEADER /* bdf_fonts */ /* */ /* */ - /* BDF Fonts */ + /* BDF Files */ /* */ /* <Abstract> */ - /* BDF-specific APIs */ + /* BDF specific API. */ /* */ /* <Description> */ - /* This section contains the declaration of BDF-specific functions. */ + /* This section contains the declaration of BDF specific functions. */ /* */ /*************************************************************************/ diff --git a/headers/libs/freetype2/freetype/ftbitmap.h b/headers/libs/freetype2/freetype/ftbitmap.h new file mode 100644 index 0000000000..319dd08694 --- /dev/null +++ b/headers/libs/freetype2/freetype/ftbitmap.h @@ -0,0 +1,206 @@ +/***************************************************************************/ +/* */ +/* ftbitmap.h */ +/* */ +/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */ +/* bitmaps into 8bpp format (specification). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTBITMAP_H__ +#define __FTBITMAP_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* bitmap_handling */ + /* */ + /* <Title> */ + /* Bitmap Handling */ + /* */ + /* <Abstract> */ + /* Handling FT_Bitmap objects. */ + /* */ + /* <Description> */ + /* This section contains functions for converting FT_Bitmap objects. */ + /* */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_New */ + /* */ + /* <Description> */ + /* Initialize a pointer to an FT_Bitmap structure. */ + /* */ + /* <InOut> */ + /* abitmap :: A pointer to the bitmap structure. */ + /* */ + FT_EXPORT( void ) + FT_Bitmap_New( FT_Bitmap *abitmap ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_Copy */ + /* */ + /* <Description> */ + /* Copies an bitmap into another one. */ + /* */ + /* <Input> */ + /* library :: A handle to a library object. */ + /* */ + /* source :: A handle to the source bitmap. */ + /* */ + /* <Output> */ + /* target :: A handle to the target bitmap. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Copy( FT_Library library, + const FT_Bitmap *source, + FT_Bitmap *target); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_Embolden */ + /* */ + /* <Description> */ + /* Embolden a bitmap. The new bitmap will be about `xStrength' */ + /* pixels wider and `yStrength' pixels higher. The left and bottom */ + /* borders are kept unchanged. */ + /* */ + /* <Input> */ + /* library :: A handle to a library object. */ + /* */ + /* xStrength :: How strong the glyph is emboldened horizontally. */ + /* Expressed in 26.6 pixel format. */ + /* */ + /* yStrength :: How strong the glyph is emboldened vertically. */ + /* Expressed in 26.6 pixel format. */ + /* */ + /* <InOut> */ + /* bitmap :: A handle to the target bitmap. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The current implementation restricts `xStrength' to be less than */ + /* or equal to 8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */ + /* */ + /* Don't embolden the bitmap owned by a @FT_GlyphSlot directly! Call */ + /* @FT_Bitmap_Copy to get a copy and work on the copy instead. */ + /* */ + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Embolden( FT_Library library, + FT_Bitmap* bitmap, + FT_Pos xStrength, + FT_Pos yStrength ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_Convert */ + /* */ + /* <Description> */ + /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a */ + /* bitmap object with depth 8bpp, making the number of used bytes per */ + /* line (a.k.a. the `pitch') a multiple of `alignment'. */ + /* */ + /* <Input> */ + /* library :: A handle to a library object. */ + /* */ + /* source :: The source bitmap. */ + /* */ + /* alignment :: The pitch of the bitmap is a multiple of this */ + /* parameter. Common values are 1, 2, or 4. */ + /* */ + /* <Output> */ + /* target :: The target bitmap. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* It is possible to call @FT_Bitmap_Convert multiple times without */ + /* calling @FT_Bitmap_Done (the memory is simply reallocated). */ + /* */ + /* Use @FT_Bitmap_Done to finally remove the bitmap object. */ + /* */ + /* The `library' argument is taken to have access to FreeType's */ + /* memory handling functions. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Convert( FT_Library library, + const FT_Bitmap *source, + FT_Bitmap *target, + FT_Int alignment ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Bitmap_Done */ + /* */ + /* <Description> */ + /* Destroy a bitmap object created with @FT_Bitmap_New. */ + /* */ + /* <Input> */ + /* library :: A handle to a library object. */ + /* */ + /* bitmap :: The bitmap object to be freed. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* The `library' argument is taken to have access to FreeType's */ + /* memory handling functions. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Bitmap_Done( FT_Library library, + FT_Bitmap *bitmap ); + + + /* */ + + +FT_END_HEADER + +#endif /* __FTBITMAP_H__ */ + + +/* END */ diff --git a/headers/libs/freetype2/freetype/ftcache.h b/headers/libs/freetype2/freetype/ftcache.h index c6dc14aeca..985641c1b4 100644 --- a/headers/libs/freetype2/freetype/ftcache.h +++ b/headers/libs/freetype2/freetype/ftcache.h @@ -55,7 +55,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* This section describes the FreeType 2 cache sub-system which is */ - /* stile in beta. */ + /* still in beta. */ /* */ /* <Order> */ /* FTC_Manager */ @@ -63,11 +63,13 @@ FT_BEGIN_HEADER /* FTC_Face_Requester */ /* */ /* FTC_Manager_New */ + /* FTC_Manager_Reset */ + /* FTC_Manager_Done */ /* FTC_Manager_LookupFace */ /* FTC_Manager_LookupSize */ + /* FTC_Manager_RemoveFaceID */ /* */ /* FTC_Node */ - /* FTC_Node_Ref */ /* FTC_Node_Unref */ /* */ /* FTC_Font */ @@ -80,13 +82,9 @@ FT_BEGIN_HEADER /* FTC_SBitCache_New */ /* FTC_SBitCache_Lookup */ /* */ - /* */ - /* FTC_Image_Desc */ - /* FTC_Image_Cache */ - /* FTC_Image_Cache_Lookup */ - /* */ - /* FTC_SBit_Cache */ - /* FTC_SBit_Cache_Lookup */ + /* FTC_CMapCache */ + /* FTC_CMapCache_New */ + /* FTC_CMapCache_Lookup */ /* */ /*************************************************************************/ @@ -502,11 +500,6 @@ FT_BEGIN_HEADER FTC_CMapCache *acache ); - /* retrieve the index of a given charmap */ - FT_EXPORT( FT_Int ) - FT_Get_CharMap_Index( FT_CharMap charmap ); - - /*************************************************************************/ /* */ /* @function: */ @@ -519,9 +512,9 @@ FT_BEGIN_HEADER /* @input: */ /* cache :: A charmap cache handle. */ /* */ - /* face_id :: source face id */ + /* face_id :: The source face ID. */ /* */ - /* cmap_index :: index of charmap in source face */ + /* cmap_index :: The index of the charmap in the source face. */ /* */ /* char_code :: The character code (in the corresponding charmap). */ /* */ diff --git a/headers/libs/freetype2/freetype/ftchapters.h b/headers/libs/freetype2/freetype/ftchapters.h index c134ec122a..781160bd2c 100644 --- a/headers/libs/freetype2/freetype/ftchapters.h +++ b/headers/libs/freetype2/freetype/ftchapters.h @@ -1,3 +1,11 @@ +/***************************************************************************/ +/* */ +/* This file defines the structure of the FreeType reference. */ +/* It is used by the python script which generates the HTML files. */ +/* */ +/***************************************************************************/ + + /***************************************************************************/ /* */ /* <Chapter> */ @@ -31,6 +39,8 @@ /* sfnt_names */ /* bdf_fonts */ /* pfr_fonts */ +/* winfnt_fonts */ +/* ot_validation */ /* */ /***************************************************************************/ @@ -61,9 +71,12 @@ /* computations */ /* list_processing */ /* outline_processing */ +/* bitmap_handling */ /* raster */ +/* glyph_stroker */ /* system_interface */ /* module_management */ +/* gzip */ +/* lzw */ /* */ /***************************************************************************/ - diff --git a/headers/libs/freetype2/freetype/fterrors.h b/headers/libs/freetype2/freetype/fterrors.h index 1def4f9ce9..6a2bed02a4 100644 --- a/headers/libs/freetype2/freetype/fterrors.h +++ b/headers/libs/freetype2/freetype/fterrors.h @@ -4,7 +4,7 @@ /* */ /* FreeType error code handling (specification). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,17 +25,12 @@ /* I - Error Formats */ /* ----------------- */ /* */ - /* Since release 2.1, the error constants have changed. The lower */ - /* byte of the error value gives the "generic" error code, while the */ - /* higher byte indicates in which module the error occurred. */ - /* */ - /* You can use the macro FT_ERROR_BASE(x) macro to extract the generic */ - /* error code from an FT_Error value. */ - /* */ /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ - /* undefined in ftoption.h in order to make the higher byte always */ - /* zero, in case you need to be compatible with previous versions of */ - /* FreeType 2. */ + /* defined in ftoption.h in order to make the higher byte indicate */ + /* the module where the error has happened (this is not compatible */ + /* with standard builds of FreeType 2). You can then use the macro */ + /* FT_ERROR_BASE macro to extract the generic error code from an */ + /* FT_Error value. */ /* */ /* */ /* II - Error Message strings */ @@ -158,7 +153,7 @@ #define FT_ERRORDEF_( e, v, s ) \ FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) - /* this is only used for FT_Err_Ok, which must be 0! */ + /* this is only used for <module>_Err_Ok, which must be 0! */ #define FT_NOERRORDEF_( e, v, s ) \ FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) @@ -168,7 +163,7 @@ #endif - /* no include the error codes */ + /* now include the error codes */ #include FT_ERROR_DEFINITIONS_H @@ -197,9 +192,13 @@ #undef FT_NOERRORDEF_ #undef FT_NEED_EXTERN_C -#undef FT_ERR_PREFIX -#undef FT_ERR_BASE #undef FT_ERR_CONCAT +#undef FT_ERR_BASE + + /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ +#ifndef FT_KEEP_ERR_PREFIX +#undef FT_ERR_PREFIX +#endif #endif /* __FTERRORS_H__ */ diff --git a/headers/libs/freetype2/freetype/ftgzip.h b/headers/libs/freetype2/freetype/ftgzip.h index 5d7228bb49..ded96bec6d 100644 --- a/headers/libs/freetype2/freetype/ftgzip.h +++ b/headers/libs/freetype2/freetype/ftgzip.h @@ -4,7 +4,7 @@ /* */ /* Gzip-compressed stream support. */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -40,7 +40,7 @@ FT_BEGIN_HEADER /* GZIP Streams */ /* */ /* <Abstract> */ - /* Using gzip-compressed font files */ + /* Using gzip-compressed font files. */ /* */ /* <Description> */ /* This section contains the declaration of Gzip-specific functions. */ diff --git a/headers/libs/freetype2/freetype/ftimage.h b/headers/libs/freetype2/freetype/ftimage.h index 4682a4cada..e92ace3a18 100644 --- a/headers/libs/freetype2/freetype/ftimage.h +++ b/headers/libs/freetype2/freetype/ftimage.h @@ -5,7 +5,7 @@ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -264,25 +264,19 @@ FT_BEGIN_HEADER /* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */ /* See @FT_Pixel_Mode for possible values. */ /* */ - /* palette_mode :: This field is only used with paletted pixel modes; */ - /* it indicates how the palette is stored. */ + /* palette_mode :: This field is intended for paletted pixel modes; */ + /* it indicates how the palette is stored. Not */ + /* used currently. */ /* */ - /* palette :: A typeless pointer to the bitmap palette; only */ - /* used for paletted pixel modes. */ + /* palette :: A typeless pointer to the bitmap palette; this */ + /* field is intended for paletted pixel modes. Not */ + /* used currently. */ /* */ /* <Note> */ - /* For now, the only pixel mode supported by FreeType are mono and */ + /* For now, the only pixel modes supported by FreeType are mono and */ /* grays. However, drivers might be added in the future to support */ /* more `colorful' options. */ /* */ - /* When using pixel modes pal2, pal4 and pal8 with a void `palette' */ - /* field, a gray pixmap with respectively 4, 16, and 256 levels of */ - /* gray is assumed. This, in order to be compatible with some */ - /* embedded bitmap formats defined in the TrueType specification. */ - /* */ - /* Note that no font was found presenting such embedded bitmaps, so */ - /* this is currently completely unhandled by the library. */ - /* */ typedef struct FT_Bitmap_ { int rows; @@ -772,7 +766,7 @@ FT_BEGIN_HEADER /* raster */ /* */ /* <Title> */ - /* Scanline converter */ + /* Scanline Converter */ /* */ /* <Abstract> */ /* How vectorial outlines are converted into bitmaps and pixmaps. */ @@ -1036,8 +1030,8 @@ FT_BEGIN_HEADER /* */ typedef struct FT_Raster_Params_ { - FT_Bitmap* target; - void* source; + const FT_Bitmap* target; + const void* source; int flags; FT_SpanFunc gray_spans; FT_SpanFunc black_spans; diff --git a/headers/libs/freetype2/freetype/ftlzw.h b/headers/libs/freetype2/freetype/ftlzw.h index a0a042ea07..2ebd500809 100644 --- a/headers/libs/freetype2/freetype/ftlzw.h +++ b/headers/libs/freetype2/freetype/ftlzw.h @@ -40,7 +40,7 @@ FT_BEGIN_HEADER /* LZW Streams */ /* */ /* <Abstract> */ - /* Using LZW-compressed font files */ + /* Using LZW-compressed font files. */ /* */ /* <Description> */ /* This section contains the declaration of LZW-specific functions. */ diff --git a/headers/libs/freetype2/freetype/ftmac.h b/headers/libs/freetype2/freetype/ftmac.h index 78ed779478..4ebf716eb7 100644 --- a/headers/libs/freetype2/freetype/ftmac.h +++ b/headers/libs/freetype2/freetype/ftmac.h @@ -41,7 +41,7 @@ FT_BEGIN_HEADER /* mac_specific */ /* */ /* <Title> */ - /* Mac-Specific Interface */ + /* Mac Specific Interface */ /* */ /* <Abstract> */ /* Only available on the Macintosh. */ diff --git a/headers/libs/freetype2/freetype/ftmm.h b/headers/libs/freetype2/freetype/ftmm.h index 7f565bef94..525b5c08eb 100644 --- a/headers/libs/freetype2/freetype/ftmm.h +++ b/headers/libs/freetype2/freetype/ftmm.h @@ -4,7 +4,7 @@ /* */ /* FreeType Multiple Master font interface (specification). */ /* */ -/* Copyright 1996-2001 by */ +/* Copyright 1996-2001, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -43,6 +43,12 @@ FT_BEGIN_HEADER /* Master fonts, i.e. the selection of specific design instances by */ /* setting design axis coordinates. */ /* */ + /* George Williams has extended this interface to make it work with */ + /* both Type 1 Multiple Masters fonts, and GX distortable (var) */ + /* fonts. Some of these routines only work with MM fonts, others */ + /* will work with both types. They are similar enough that a */ + /* consistent interface makes sense. */ + /* */ /*************************************************************************/ @@ -55,6 +61,8 @@ FT_BEGIN_HEADER /* A simple structure used to model a given axis in design space for */ /* Multiple Masters fonts. */ /* */ + /* This structure can't be used for GX var fonts. */ + /* */ /* <Fields> */ /* name :: The axis's name. */ /* */ @@ -80,6 +88,8 @@ FT_BEGIN_HEADER /* A structure used to model the axes and space of a Multiple Masters */ /* font. */ /* */ + /* This structure can't be used for GX var fonts. */ + /* */ /* <Fields> */ /* num_axis :: Number of axes. Cannot exceed 4. */ /* */ @@ -98,8 +108,119 @@ FT_BEGIN_HEADER } FT_Multi_Master; + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Var_Axis */ + /* */ + /* <Description> */ + /* A simple structure used to model a given axis in design space for */ + /* Multiple Masters and GX var fonts. */ + /* */ + /* <Fields> */ + /* name :: The axis's name. */ + /* Not always meaningful for GX. */ + /* */ + /* minimum :: The axis's minimum design coordinate. */ + /* */ + /* def :: The axis's default design coordinate. */ + /* FreeType computes meaningful default values for MM; it */ + /* is then an integer value, not in 16.16 format. */ + /* */ + /* maximum :: The axis's maximum design coordinate. */ + /* */ + /* tag :: The axis's tag (the GX equivalent to `name'). */ + /* FreeType provides default values for MM if possible. */ + /* */ + /* strid :: The entry in `name' table (another GX version of */ + /* `name'). */ + /* Not meaningful for MM. */ + /* */ + typedef struct FT_Var_Axis_ + { + FT_String* name; + + FT_Fixed minimum; + FT_Fixed def; + FT_Fixed maximum; + + FT_ULong tag; + FT_UInt strid; + + } FT_Var_Axis; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_Var_Named_Style */ + /* */ + /* <Description> */ + /* A simple structure used to model a named style in a GX var font. */ + /* */ + /* This structure can't be used for MM fonts. */ + /* */ + /* <Fields> */ + /* coords :: The design coordinates for this style. */ + /* This is an array with one entry for each axis. */ + /* */ + /* strid :: The entry in `name' table identifying this style. */ + /* */ + typedef struct FT_Var_Named_Style_ + { + FT_Fixed* coords; + FT_UInt strid; + + } FT_Var_Named_Style; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* FT_MM_Var */ + /* */ + /* <Description> */ + /* A structure used to model the axes and space of a Multiple Masters */ + /* or GX var distortable font. */ + /* */ + /* Some fields are specific to one format and not to the other. */ + /* */ + /* <Fields> */ + /* num_axis :: The number of axes. The maximum value is 4 for */ + /* MM; no limit in GX. */ + /* */ + /* num_designs :: The number of designs; should be normally */ + /* 2^num_axis for MM fonts. Not meaningful for GX */ + /* (where every glyph could have a different */ + /* number of designs). */ + /* */ + /* num_namedstyles :: The number of named styles; only meaningful for */ + /* GX which allows certain design coordinates to */ + /* have a string ID (in the `name' table) */ + /* associated with them. The font can tell the */ + /* user that, for example, Weight=1.5 is `Bold'. */ + /* */ + /* axis :: A table of axis descriptors. */ + /* GX fonts contain slightly more data than MM. */ + /* */ + /* namedstyles :: A table of named styles. */ + /* Only meaningful with GX. */ + /* */ + typedef struct FT_MM_Var_ + { + FT_UInt num_axis; + FT_UInt num_designs; + FT_UInt num_namedstyles; + FT_Var_Axis* axis; + FT_Var_Named_Style* namedstyle; + + } FT_MM_Var; + + /* */ + /*************************************************************************/ /* */ /* <Function> */ @@ -108,6 +229,8 @@ FT_BEGIN_HEADER /* <Description> */ /* Retrieves the Multiple Master descriptor of a given font. */ /* */ + /* This function can't be used with GX fonts. */ + /* */ /* <Input> */ /* face :: A handle to the source face. */ /* */ @@ -122,6 +245,30 @@ FT_BEGIN_HEADER FT_Multi_Master *amaster ); + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Get_MM_Var */ + /* */ + /* <Description> */ + /* Retrieves the Multiple Master/GX var descriptor of a given font. */ + /* */ + /* <Input> */ + /* face :: A handle to the source face. */ + /* */ + /* <Output> */ + /* amaster :: The Multiple Masters descriptor. */ + /* Allocates a data structure, which the user must free */ + /* (a single call to FT_FREE will do it). */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Get_MM_Var( FT_Face face, + FT_MM_Var* *amaster ); + + /*************************************************************************/ /* */ /* <Function> */ @@ -131,6 +278,8 @@ FT_BEGIN_HEADER /* For Multiple Masters fonts, choose an interpolated font design */ /* through design coordinates. */ /* */ + /* This function can't be used with GX fonts. */ + /* */ /* <InOut> */ /* face :: A handle to the source face. */ /* */ @@ -149,14 +298,41 @@ FT_BEGIN_HEADER FT_Long* coords ); + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Var_Design_Coordinates */ + /* */ + /* <Description> */ + /* For Multiple Master or GX Var fonts, choose an interpolated font */ + /* design through design coordinates. */ + /* */ + /* <InOut> */ + /* face :: A handle to the source face. */ + /* */ + /* <Input> */ + /* num_coords :: The number of design coordinates (must be equal to */ + /* the number of axes in the font). */ + /* */ + /* coords :: An array of design coordinates. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Var_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + /*************************************************************************/ /* */ /* <Function> */ /* FT_Set_MM_Blend_Coordinates */ /* */ /* <Description> */ - /* For Multiple Masters fonts, choose an interpolated font design */ - /* through normalized blend coordinates. */ + /* For Multiple Masters and GX var fonts, choose an interpolated font */ + /* design through normalized blend coordinates. */ /* */ /* <InOut> */ /* face :: A handle to the source face. */ @@ -177,6 +353,20 @@ FT_BEGIN_HEADER FT_Fixed* coords ); + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Set_Var_Blend_Coordinates */ + /* */ + /* <Description> */ + /* This is another name of @FT_Set_MM_Blend_Coordinates. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Set_Var_Blend_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + /* */ diff --git a/headers/libs/freetype2/freetype/ftmoderr.h b/headers/libs/freetype2/freetype/ftmoderr.h index d190167fa7..b0115dd0dd 100644 --- a/headers/libs/freetype2/freetype/ftmoderr.h +++ b/headers/libs/freetype2/freetype/ftmoderr.h @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001, 2002, 2003, 2004 by */ +/* Copyright 2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,8 +23,8 @@ /* The lower byte gives the error code, the higher byte gives the */ /* module. The base module has error offset 0. For example, the error */ /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ - /* `TT_Err_Invalid_File_Format' has value 0x1003, the error */ - /* `T1_Err_Invalid_File_Format' has value 0x1103, etc. */ + /* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ + /* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ /* */ /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ /* to make the higher byte always zero (disabling the module error */ @@ -103,25 +103,26 @@ FT_MODERRDEF( Base, 0x000, "base module" ) - FT_MODERRDEF( Autohint, 0x100, "autohinter module" ) + FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) FT_MODERRDEF( BDF, 0x200, "BDF module" ) FT_MODERRDEF( Cache, 0x300, "cache module" ) FT_MODERRDEF( CFF, 0x400, "CFF module" ) FT_MODERRDEF( CID, 0x500, "CID module" ) FT_MODERRDEF( Gzip, 0x600, "Gzip module" ) FT_MODERRDEF( LZW, 0x700, "LZW module" ) - FT_MODERRDEF( PCF, 0x800, "PCF module" ) - FT_MODERRDEF( PFR, 0x900, "PFR module" ) - FT_MODERRDEF( PSaux, 0xA00, "PS auxiliary module" ) - FT_MODERRDEF( PShinter, 0xB00, "PS hinter module" ) - FT_MODERRDEF( PSnames, 0xC00, "PS names module" ) - FT_MODERRDEF( Raster, 0xD00, "raster module" ) - FT_MODERRDEF( SFNT, 0xE00, "SFNT module" ) - FT_MODERRDEF( Smooth, 0xF00, "smooth raster module" ) - FT_MODERRDEF( TrueType, 0x1000, "TrueType module" ) - FT_MODERRDEF( Type1, 0x1100, "Type 1 module" ) - FT_MODERRDEF( Type42, 0x1200, "Type 42 module" ) - FT_MODERRDEF( Winfonts, 0x1300, "Windows FON/FNT module" ) + FT_MODERRDEF( OTvalid, 0x800, "OpenType validation module" ) + FT_MODERRDEF( PCF, 0x900, "PCF module" ) + FT_MODERRDEF( PFR, 0xA00, "PFR module" ) + FT_MODERRDEF( PSaux, 0xB00, "PS auxiliary module" ) + FT_MODERRDEF( PShinter, 0xC00, "PS hinter module" ) + FT_MODERRDEF( PSnames, 0xD00, "PS names module" ) + FT_MODERRDEF( Raster, 0xE00, "raster module" ) + FT_MODERRDEF( SFNT, 0xF00, "SFNT module" ) + FT_MODERRDEF( Smooth, 0x1000, "smooth raster module" ) + FT_MODERRDEF( TrueType, 0x1100, "TrueType module" ) + FT_MODERRDEF( Type1, 0x1200, "Type 1 module" ) + FT_MODERRDEF( Type42, 0x1300, "Type 42 module" ) + FT_MODERRDEF( Winfonts, 0x1400, "Windows FON/FNT module" ) #ifdef FT_MODERR_END_LIST diff --git a/headers/libs/freetype2/freetype/ftotval.h b/headers/libs/freetype2/freetype/ftotval.h new file mode 100644 index 0000000000..a8de58af9d --- /dev/null +++ b/headers/libs/freetype2/freetype/ftotval.h @@ -0,0 +1,170 @@ +/***************************************************************************/ +/* */ +/* ftotval.h */ +/* */ +/* FreeType API for validating OpenType tables (specification). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* */ +/* Warning: This module might be moved to a different library in the */ +/* future to avoid a tight dependency between FreeType and the */ +/* OpenType specification. */ +/* */ +/* */ +/***************************************************************************/ + + +#ifndef __FTOTVAL_H__ +#define __FTOTVAL_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Section> */ + /* ot_validation */ + /* */ + /* <Title> */ + /* OpenType Validation */ + /* */ + /* <Abstract> */ + /* An API to validate OpenType tables. */ + /* */ + /* <Description> */ + /* This section contains the declaration of functions to validate */ + /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF). */ + /* */ + /*************************************************************************/ + + + /********************************************************************** + * + * @enum: + * FT_VALIDATE_XXX + * + * @description: + * A list of bit-field constants used with @FT_OpenType_Validate to + * indicate which OpenType tables should be validated. + * + * @values: + * FT_VALIDATE_BASE :: + * Validate BASE table. + * + * FT_VALIDATE_GDEF :: + * Validate GDEF table. + * + * FT_VALIDATE_GPOS :: + * Validate GPOS table. + * + * FT_VALIDATE_GSUB :: + * Validate GSUB table. + * + * FT_VALIDATE_JSTF :: + * Validate JSTF table. + * + * FT_VALIDATE_OT :: + * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF). + * + */ +#define FT_VALIDATE_BASE 0x0100 +#define FT_VALIDATE_GDEF 0x0200 +#define FT_VALIDATE_GPOS 0x0400 +#define FT_VALIDATE_GSUB 0x0800 +#define FT_VALIDATE_JSTF 0x1000 + +#define FT_VALIDATE_OT FT_VALIDATE_BASE | \ + FT_VALIDATE_GDEF | \ + FT_VALIDATE_GPOS | \ + FT_VALIDATE_GSUB | \ + FT_VALIDATE_JSTF + + /* */ + + /********************************************************************** + * + * @function: + * FT_OpenType_Validate + * + * @description: + * Validate various OpenType tables to assure that all offsets and + * indices are valid. The idea is that a higher-level library which + * actually does the text layout can access those tables without + * error checking (which can be quite time consuming). + * + * @input: + * face :: + * A handle to the input face. + * + * validation_flags :: + * A bit field which specifies the tables to be validated. See + * @FT_VALIDATE_XXX for possible values. + * + * @output: + * BASE_table :: + * A pointer to the BASE table. + * + * GDEF_table :: + * A pointer to the GDEF table. + * + * GPOS_table :: + * A pointer to the GPOS table. + * + * GSUB_table :: + * A pointer to the GSUB table. + * + * JSTF_table :: + * A pointer to the JSTF table. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * This function only works with OpenType fonts, returning an error + * otherwise. + * + * After use, the application should deallocate the five tables with + * `free'. A NULL value indicates that the table either doesn't exist + * in the font, or the application hasn't asked for validation. + */ + FT_EXPORT( FT_Error ) + FT_OpenType_Validate( FT_Face face, + FT_UInt validation_flags, + FT_Bytes *BASE_table, + FT_Bytes *GDEF_table, + FT_Bytes *GPOS_table, + FT_Bytes *GSUB_table, + FT_Bytes *JSTF_table ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTOTVAL_H__ */ + + +/* END */ diff --git a/headers/libs/freetype2/freetype/ftoutln.h b/headers/libs/freetype2/freetype/ftoutln.h index 79ed35b597..76ad60a61f 100644 --- a/headers/libs/freetype2/freetype/ftoutln.h +++ b/headers/libs/freetype2/freetype/ftoutln.h @@ -5,7 +5,7 @@ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -58,6 +58,7 @@ FT_BEGIN_HEADER /* FT_Outline_Copy */ /* FT_Outline_Translate */ /* FT_Outline_Transform */ + /* FT_Outline_Embolden */ /* FT_Outline_Reverse */ /* FT_Outline_Check */ /* */ @@ -229,8 +230,8 @@ FT_BEGIN_HEADER /* acbox :: The outline's control box. */ /* */ FT_EXPORT( void ) - FT_Outline_Get_CBox( FT_Outline* outline, - FT_BBox *acbox ); + FT_Outline_Get_CBox( const FT_Outline* outline, + FT_BBox *acbox ); /*************************************************************************/ @@ -250,9 +251,9 @@ FT_BEGIN_HEADER /* yOffset :: The vertical offset. */ /* */ FT_EXPORT( void ) - FT_Outline_Translate( FT_Outline* outline, - FT_Pos xOffset, - FT_Pos yOffset ); + FT_Outline_Translate( const FT_Outline* outline, + FT_Pos xOffset, + FT_Pos yOffset ); /*************************************************************************/ @@ -275,8 +276,8 @@ FT_BEGIN_HEADER /* FreeType error code. 0 means success. */ /* */ FT_EXPORT( FT_Error ) - FT_Outline_Copy( FT_Outline* source, - FT_Outline *target ); + FT_Outline_Copy( const FT_Outline* source, + FT_Outline *target ); /*************************************************************************/ @@ -299,8 +300,33 @@ FT_BEGIN_HEADER /* outline's points. */ /* */ FT_EXPORT( void ) - FT_Outline_Transform( FT_Outline* outline, - FT_Matrix* matrix ); + FT_Outline_Transform( const FT_Outline* outline, + const FT_Matrix* matrix ); + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_Outline_Embolden */ + /* */ + /* <Description> */ + /* Emboldens an outline. The new outline will be at most 4 times */ + /* `strength' pixels wider and higher. You may think of the left and */ + /* bottom borders as unchanged. */ + /* */ + /* <InOut> */ + /* outline :: A handle to the target outline. */ + /* */ + /* <Input> */ + /* strength :: How strong the glyph is emboldened. Expressed in */ + /* 26.6 pixel format. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT_DEF( FT_Error ) + FT_Outline_Embolden( FT_Outline* outline, + FT_Pos strength ); /*************************************************************************/ @@ -353,9 +379,9 @@ FT_BEGIN_HEADER /* It will use the raster correponding to the default glyph format. */ /* */ FT_EXPORT( FT_Error ) - FT_Outline_Get_Bitmap( FT_Library library, - FT_Outline* outline, - FT_Bitmap *abitmap ); + FT_Outline_Get_Bitmap( FT_Library library, + FT_Outline* outline, + const FT_Bitmap *abitmap ); /*************************************************************************/ diff --git a/headers/libs/freetype2/freetype/ftpfr.h b/headers/libs/freetype2/freetype/ftpfr.h index c9a5675445..2481659528 100644 --- a/headers/libs/freetype2/freetype/ftpfr.h +++ b/headers/libs/freetype2/freetype/ftpfr.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (specification only). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -41,7 +41,7 @@ FT_BEGIN_HEADER /* PFR Fonts */ /* */ /* <Abstract> */ - /* PFR/TrueDoc specific APIs */ + /* PFR/TrueDoc specific API. */ /* */ /* <Description> */ /* This section contains the declaration of PFR-specific functions. */ @@ -166,7 +166,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* __FTBDF_H__ */ +#endif /* __FTPFR_H__ */ /* END */ diff --git a/headers/libs/freetype2/freetype/ftrender.h b/headers/libs/freetype2/freetype/ftrender.h index db3ca94dd7..21b051fc7c 100644 --- a/headers/libs/freetype2/freetype/ftrender.h +++ b/headers/libs/freetype2/freetype/ftrender.h @@ -4,7 +4,7 @@ /* */ /* FreeType renderer modules public interface (specification). */ /* */ -/* Copyright 1996-2001 by */ +/* Copyright 1996-2001, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ diff --git a/headers/libs/freetype2/freetype/ftsizes.h b/headers/libs/freetype2/freetype/ftsizes.h index f0ec915997..9abd94bc43 100644 --- a/headers/libs/freetype2/freetype/ftsizes.h +++ b/headers/libs/freetype2/freetype/ftsizes.h @@ -4,7 +4,7 @@ /* */ /* FreeType size objects management (specification). */ /* */ -/* Copyright 1996-2001, 2003 by */ +/* Copyright 1996-2001, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -48,10 +48,10 @@ FT_BEGIN_HEADER /* sizes_management */ /* */ /* <Title> */ - /* Size management */ + /* Size Management */ /* */ /* <Abstract> */ - /* Managing multiple sizes per face */ + /* Managing multiple sizes per face. */ /* */ /* <Description> */ /* When creating a new face object (e.g. with @FT_New_Face), an */ diff --git a/headers/libs/freetype2/freetype/ftstroke.h b/headers/libs/freetype2/freetype/ftstroke.h index a3052e858e..c6c96deed5 100644 --- a/headers/libs/freetype2/freetype/ftstroke.h +++ b/headers/libs/freetype2/freetype/ftstroke.h @@ -23,9 +23,33 @@ #include FT_OUTLINE_H #include FT_GLYPH_H + FT_BEGIN_HEADER - /*@************************************************************* + + /************************************************************************ + * + * <Section> + * glyph_stroker + * + * <Title> + * Glyph Stroker + * + * <Abstract> + * Generating bordered and stroked glyphs. + * + * <Description> + * This component generates stroked outlines of a given vectorial + * glyph. It also allows you to retrieve the `outside' and/or the + * `inside' borders of the stroke. + * + * This can be useful to generate `bordered' glyph, i.e., glyphs + * displayed with a coloured (and anti-aliased) border around their + * shape. + */ + + + /************************************************************** * * @type: * FT_Stroker @@ -36,7 +60,7 @@ FT_BEGIN_HEADER typedef struct FT_StrokerRec_* FT_Stroker; - /*@************************************************************* + /************************************************************** * * @enum: * FT_Stroker_LineJoin @@ -69,7 +93,7 @@ FT_BEGIN_HEADER } FT_Stroker_LineJoin; - /*@************************************************************* + /************************************************************** * * @enum: * FT_Stroker_LineCap diff --git a/headers/libs/freetype2/freetype/fttypes.h b/headers/libs/freetype2/freetype/fttypes.h index 2782f74d58..7727ebb556 100644 --- a/headers/libs/freetype2/freetype/fttypes.h +++ b/headers/libs/freetype2/freetype/fttypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType simple types definitions (specification only). */ /* */ -/* Copyright 1996-2001 by */ +/* Copyright 1996-2001, 2002, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -49,6 +49,7 @@ FT_BEGIN_HEADER /* */ /* <Order> */ /* FT_Byte */ + /* FT_Bytes */ /* FT_Char */ /* FT_Int */ /* FT_UInt */ @@ -60,6 +61,7 @@ FT_BEGIN_HEADER /* FT_Offset */ /* FT_PtrDist */ /* FT_String */ + /* FT_Tag */ /* FT_Error */ /* FT_Fixed */ /* FT_Pointer */ @@ -143,6 +145,28 @@ FT_BEGIN_HEADER typedef unsigned char FT_Byte; + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Bytes */ + /* */ + /* <Description> */ + /* A typedef for constant memory areas. */ + /* */ + typedef const FT_Byte* FT_Bytes; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Tag */ + /* */ + /* <Description> */ + /* A typedef for 32bit tags (as used in the SFNT format). */ + /* */ + typedef FT_UInt32 FT_Tag; + + /*************************************************************************/ /* */ /* <Type> */ @@ -184,7 +208,7 @@ FT_BEGIN_HEADER /* <Description> */ /* A typedef for the int type. */ /* */ - typedef int FT_Int; + typedef signed int FT_Int; /*************************************************************************/ @@ -301,7 +325,7 @@ FT_BEGIN_HEADER /* largest _signed_ integer type used to express the distance */ /* between two pointers. */ /* */ - typedef size_t FT_PtrDist; + typedef ft_ptrdiff_t FT_PtrDist; /*************************************************************************/ diff --git a/headers/libs/freetype2/freetype/ftwinfnt.h b/headers/libs/freetype2/freetype/ftwinfnt.h index a19a12d972..355b7e9042 100644 --- a/headers/libs/freetype2/freetype/ftwinfnt.h +++ b/headers/libs/freetype2/freetype/ftwinfnt.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing Windows fnt-specific data. */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,10 +38,10 @@ FT_BEGIN_HEADER /* winfnt_fonts */ /* */ /* <Title> */ - /* Window FNT Fonts */ + /* Window FNT Files */ /* */ /* <Abstract> */ - /* Windows FNT specific APIs */ + /* Windows FNT specific API. */ /* */ /* <Description> */ /* This section contains the declaration of Windows FNT specific */ diff --git a/headers/libs/freetype2/freetype/internal/ftcalc.h b/headers/libs/freetype2/freetype/internal/ftcalc.h index 7866c46273..0df502c755 100644 --- a/headers/libs/freetype2/freetype/internal/ftcalc.h +++ b/headers/libs/freetype2/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,6 +27,23 @@ FT_BEGIN_HEADER + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_FixedSqrt */ + /* */ + /* <Description> */ + /* Computes the square root of a 16.16 fixed point value. */ + /* */ + /* <Input> */ + /* x :: The value to compute the root for. */ + /* */ + /* <Return> */ + /* The result of `sqrt(x)'. */ + /* */ + /* <Note> */ + /* This function is not very fast. */ + /* */ FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x ); diff --git a/headers/libs/freetype2/freetype/internal/ftmemory.h b/headers/libs/freetype2/freetype/internal/ftmemory.h index 63f37aff7c..d93a077974 100644 --- a/headers/libs/freetype2/freetype/internal/ftmemory.h +++ b/headers/libs/freetype2/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ /* */ /* The FreeType memory management macros (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004 by */ +/* Copyright 1996-2001, 2002, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -43,6 +43,7 @@ FT_BEGIN_HEADER ( ( error = (expression) ) != 0 ) + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -64,6 +65,13 @@ FT_BEGIN_HEADER const char* file_name, FT_Long line_no ); + FT_BASE( FT_Error ) + FT_QAlloc_Debug( FT_Memory memory, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); + FT_BASE( FT_Error ) FT_Realloc_Debug( FT_Memory memory, FT_Long current, @@ -72,6 +80,14 @@ FT_BEGIN_HEADER const char* file_name, FT_Long line_no ); + FT_BASE( FT_Error ) + FT_QRealloc_Debug( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ); + FT_BASE( void ) FT_Free_Debug( FT_Memory memory, FT_Pointer block, @@ -109,6 +125,34 @@ FT_BEGIN_HEADER void* *P ); + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_QAlloc */ + /* */ + /* <Description> */ + /* Allocates a new block of memory. The returned area is *not* */ + /* zero-filled, making allocation quicker. */ + /* */ + /* <Input> */ + /* memory :: A handle to a given `memory object' which handles */ + /* allocation. */ + /* */ + /* size :: The size in bytes of the block to allocate. */ + /* */ + /* <Output> */ + /* P :: A pointer to the fresh new block. It should be set to */ + /* NULL if `size' is 0, or in case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_BASE( FT_Error ) + FT_QAlloc( FT_Memory memory, + FT_Long size, + void* *p ); + + /*************************************************************************/ /* */ /* <Function> */ @@ -116,7 +160,8 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* Reallocates a block of memory pointed to by `*P' to `Size' bytes */ - /* from the heap, possibly changing `*P'. */ + /* from the heap, possibly changing `*P'. The returned area is */ + /* zero-filled. */ /* */ /* <Input> */ /* memory :: A handle to a given `memory object' which handles */ @@ -144,6 +189,42 @@ FT_BEGIN_HEADER void* *P ); + /*************************************************************************/ + /* */ + /* <Function> */ + /* FT_QRealloc */ + /* */ + /* <Description> */ + /* Reallocates a block of memory pointed to by `*P' to `Size' bytes */ + /* from the heap, possibly changing `*P'. The returned area is *not* */ + /* zero-filled, making reallocation quicker. */ + /* */ + /* <Input> */ + /* memory :: A handle to a given `memory object' which handles */ + /* reallocation. */ + /* */ + /* current :: The current block size in bytes. */ + /* */ + /* size :: The new block size in bytes. */ + /* */ + /* <InOut> */ + /* P :: A pointer to the fresh new block. It should be set to */ + /* NULL if `size' is 0, or in case of error. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* <Note> */ + /* All callers of FT_Realloc() _must_ provide the current block size */ + /* as well as the new one. */ + /* */ + FT_BASE( FT_Error ) + FT_QRealloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *p ); + + /*************************************************************************/ /* */ /* <Function> */ @@ -180,11 +261,24 @@ FT_BEGIN_HEADER #define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) ) -#define FT_ARRAY_COPY( dest, source, count ) \ - FT_MEM_COPY( dest, source, (count) * sizeof( *(dest) ) ) +#define FT_ARRAY_ZERO( dest, count ) \ + FT_MEM_ZERO( dest, (count) * sizeof ( *(dest) ) ) -#define FT_ARRAY_MOVE( dest, source, count ) \ - FT_MEM_MOVE( dest, source, (count) * sizeof( *(dest) ) ) +#define FT_ARRAY_COPY( dest, source, count ) \ + FT_MEM_COPY( dest, source, (count) * sizeof ( *(dest) ) ) + +#define FT_ARRAY_MOVE( dest, source, count ) \ + FT_MEM_MOVE( dest, source, (count) * sizeof ( *(dest) ) ) + + + /* + * Return the maximum number of adressable elements in an array. + * We limit ourselves to INT_MAX, rather than UINT_MAX, to avoid + * any problems. + */ +#define FT_ARRAY_MAX( ptr ) ( FT_INT_MAX / sizeof ( *(ptr) ) ) + +#define FT_ARRAY_CHECK( ptr, count ) ( (count) <= FT_ARRAY_MAX( ptr ) ) /*************************************************************************/ @@ -196,30 +290,53 @@ FT_BEGIN_HEADER #ifdef FT_DEBUG_MEMORY -#define FT_MEM_ALLOC( _pointer_, _size_ ) \ - FT_Alloc_Debug( memory, _size_, \ - (void**)&(_pointer_), __FILE__, __LINE__ ) +#define FT_MEM_ALLOC( _pointer_, _size_ ) \ + FT_Alloc_Debug( memory, _size_, \ + (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) -#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ - FT_Realloc_Debug( memory, _current_, _size_, \ - (void**)&(_pointer_), __FILE__, __LINE__ ) +#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ + FT_Realloc_Debug( memory, _current_, _size_, \ + (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) -#define FT_MEM_FREE( _pointer_ ) \ - FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ ) +#define FT_MEM_QALLOC( _pointer_, _size_ ) \ + FT_QAlloc_Debug( memory, _size_, \ + (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) + +#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ + FT_QRealloc_Debug( memory, _current_, _size_, \ + (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) + +#define FT_MEM_FREE( _pointer_ ) \ + FT_Free_Debug( memory, (void**)(void*)&(_pointer_), \ + __FILE__, __LINE__ ) #else /* !FT_DEBUG_MEMORY */ -#define FT_MEM_ALLOC( _pointer_, _size_ ) \ - FT_Alloc( memory, _size_, (void**)&(_pointer_) ) +#define FT_MEM_ALLOC( _pointer_, _size_ ) \ + FT_Alloc( memory, _size_, \ + (void**)(void*)&(_pointer_) ) -#define FT_MEM_FREE( _pointer_ ) \ - FT_Free( memory, (void**)&(_pointer_) ) +#define FT_MEM_FREE( _pointer_ ) \ + FT_Free( memory, \ + (void**)(void*)&(_pointer_) ) -#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ - FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) ) +#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ + FT_Realloc( memory, _current_, _size_, \ + (void**)(void*)&(_pointer_) ) +#define FT_MEM_QALLOC( _pointer_, _size_ ) \ + FT_QAlloc( memory, _size_, \ + (void**)(void*)&(_pointer_) ) + +#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ + FT_QRealloc( memory, _current_, _size_, \ + (void**)(void*)&(_pointer_) ) #endif /* !FT_DEBUG_MEMORY */ @@ -230,7 +347,7 @@ FT_BEGIN_HEADER /* _typed_ in order to automatically compute array element sizes. */ /* */ -#define FT_MEM_NEW( _pointer_ ) \ +#define FT_MEM_NEW( _pointer_ ) \ FT_MEM_ALLOC( _pointer_, sizeof ( *(_pointer_) ) ) #define FT_MEM_NEW_ARRAY( _pointer_, _count_ ) \ @@ -240,6 +357,16 @@ FT_BEGIN_HEADER FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( *(_pointer_) ), \ (_new_) * sizeof ( *(_pointer_) ) ) +#define FT_MEM_QNEW( _pointer_ ) \ + FT_MEM_QALLOC( _pointer_, sizeof ( *(_pointer_) ) ) + +#define FT_MEM_QNEW_ARRAY( _pointer_, _count_ ) \ + FT_MEM_QALLOC( _pointer_, (_count_) * sizeof ( *(_pointer_) ) ) + +#define FT_MEM_QRENEW_ARRAY( _pointer_, _old_, _new_ ) \ + FT_MEM_QREALLOC( _pointer_, (_old_) * sizeof ( *(_pointer_) ), \ + (_new_) * sizeof ( *(_pointer_) ) ) + /*************************************************************************/ /* */ @@ -267,26 +394,45 @@ FT_BEGIN_HEADER #define FT_REALLOC( _pointer_, _current_, _size_ ) \ FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, _current_, _size_ ) ) +#define FT_QALLOC( _pointer_, _size_ ) \ + FT_SET_ERROR( FT_MEM_QALLOC( _pointer_, _size_ ) ) + +#define FT_QREALLOC( _pointer_, _current_, _size_ ) \ + FT_SET_ERROR( FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) ) + + #define FT_FREE( _pointer_ ) \ FT_MEM_FREE( _pointer_ ) -#define FT_NEW( _pointer_ ) \ - FT_SET_ERROR( FT_MEM_NEW( _pointer_ ) ) -#define FT_NEW_ARRAY( _pointer_, _count_ ) \ - FT_SET_ERROR( FT_MEM_NEW_ARRAY( _pointer_, _count_ ) ) +#define FT_NEW( _pointer_ ) \ + FT_ALLOC( _pointer_, sizeof ( *(_pointer_) ) ) -#define FT_RENEW_ARRAY( _pointer_, _old_, _new_ ) \ - FT_SET_ERROR( FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) ) +#define FT_NEW_ARRAY( _pointer_, _count_ ) \ + FT_ALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_count_) ) -#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ - FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, \ - (_count_) * sizeof ( _type_ ) ) ) +#define FT_RENEW_ARRAY( _pointer_, _old_, _new_ ) \ + FT_REALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_old_), \ + sizeof ( *(_pointer_) ) * (_new_) ) + +#define FT_QNEW( _pointer_ ) \ + FT_QALLOC( _pointer_, sizeof ( *(_pointer_) ) ) + +#define FT_QNEW_ARRAY( _pointer_, _count_ ) \ + FT_QALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_count_) ) + +#define FT_QRENEW_ARRAY( _pointer_, _old_, _new_ ) \ + FT_QREALLOC( _pointer_, sizeof ( *(_pointer_) ) * (_old_), \ + sizeof ( *(_pointer_) ) * (_new_) ) + + +#define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ + FT_ALLOC( _pointer_, (_count_) * sizeof ( _type_ ) ) + +#define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \ + FT_REALLOC( _pointer, (_old_) * sizeof ( _type_ ), \ + (_new_) * sizeof ( _type_ ) ) -#define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \ - FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, \ - (_old_) * sizeof ( _type_ ), \ - (_new_) * sizeof ( _type_ ) ) ) /* */ diff --git a/headers/libs/freetype2/freetype/internal/ftobjs.h b/headers/libs/freetype2/freetype/internal/ftobjs.h index 3a28119af1..e8e3ee79a9 100644 --- a/headers/libs/freetype2/freetype/internal/ftobjs.h +++ b/headers/libs/freetype2/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,7 +27,6 @@ #define __FTOBJS_H__ #include <ft2build.h> -#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */ #include FT_RENDER_H #include FT_SIZES_H #include FT_INTERNAL_MEMORY_H @@ -81,109 +80,12 @@ FT_BEGIN_HEADER #define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 ) - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** V A L I D A T I O N ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - - /* handle to a validation object */ - typedef struct FT_ValidatorRec_* FT_Validator; - - - /*************************************************************************/ - /* */ - /* There are three distinct validation levels defined here: */ - /* */ - /* FT_VALIDATE_DEFAULT :: */ - /* A table that passes this validation level can be used reliably by */ - /* FreeType. It generally means that all offsets have been checked to */ - /* prevent out-of-bound reads, array counts are correct, etc. */ - /* */ - /* FT_VALIDATE_TIGHT :: */ - /* A table that passes this validation level can be used reliably and */ - /* doesn't contain invalid data. For example, a charmap table that */ - /* returns invalid glyph indices will not pass, even though it can */ - /* be used with FreeType in default mode (the library will simply */ - /* return an error later when trying to load the glyph). */ - /* */ - /* It also check that fields that must be a multiple of 2, 4, or 8 */ - /* don't have incorrect values, etc. */ - /* */ - /* FT_VALIDATE_PARANOID :: */ - /* Only for font debugging. Checks that a table follows the */ - /* specification by 100%. Very few fonts will be able to pass this */ - /* level anyway but it can be useful for certain tools like font */ - /* editors/converters. */ - /* */ - typedef enum FT_ValidationLevel_ - { - FT_VALIDATE_DEFAULT = 0, - FT_VALIDATE_TIGHT, - FT_VALIDATE_PARANOID - - } FT_ValidationLevel; - - - /* validator structure */ - typedef struct FT_ValidatorRec_ - { - const FT_Byte* base; /* address of table in memory */ - const FT_Byte* limit; /* `base' + sizeof(table) in memory */ - FT_ValidationLevel level; /* validation level */ - FT_Error error; /* error returned. 0 means success */ - - ft_jmp_buf jump_buffer; /* used for exception handling */ - - } FT_ValidatorRec; - - -#define FT_VALIDATOR( x ) ((FT_Validator)( x )) - - - FT_BASE( void ) - ft_validator_init( FT_Validator valid, - const FT_Byte* base, - const FT_Byte* limit, - FT_ValidationLevel level ); - - FT_BASE( FT_Int ) - ft_validator_run( FT_Validator valid ); - - /* Sets the error field in a validator, then calls `longjmp' to return */ - /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */ - /* error checks within the validation routines. */ - /* */ - FT_BASE( void ) - ft_validator_error( FT_Validator valid, - FT_Error error ); - - - /* Calls ft_validate_error. Assumes that the `valid' local variable */ - /* holds a pointer to the current validator object. */ - /* */ -#define FT_INVALID( _error ) ft_validator_error( valid, _error ) - - /* called when a broken table is detected */ -#define FT_INVALID_TOO_SHORT FT_INVALID( FT_Err_Invalid_Table ) - - /* called when an invalid offset is detected */ -#define FT_INVALID_OFFSET FT_INVALID( FT_Err_Invalid_Offset ) - - /* called when an invalid format/value is detected */ -#define FT_INVALID_FORMAT FT_INVALID( FT_Err_Invalid_Table ) - - /* called when an invalid glyph index is detected */ -#define FT_INVALID_GLYPH_ID FT_INVALID( FT_Err_Invalid_Glyph_Index ) - - /* called when an invalid field value is detected */ -#define FT_INVALID_DATA FT_INVALID( FT_Err_Invalid_Table ) + /* + * Return the highest power of 2 that is <= value; this correspond to + * the highest bit in a given 32-bit value. + */ + FT_BASE( FT_UInt32 ) + ft_highpow2( FT_UInt32 value ); /*************************************************************************/ @@ -257,7 +159,7 @@ FT_BEGIN_HEADER FT_CharMap charmap, FT_CMap *acmap ); - /* destroy a charmap (don't remove it from face's list though) */ + /* destroy a charmap and remove it from face's list */ FT_BASE( void ) FT_CMap_Done( FT_CMap cmap ); diff --git a/headers/libs/freetype2/freetype/internal/ftserv.h b/headers/libs/freetype2/freetype/internal/ftserv.h index e5ed8895b3..0850f5605b 100644 --- a/headers/libs/freetype2/freetype/internal/ftserv.h +++ b/headers/libs/freetype2/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services (specification only). */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -34,6 +34,13 @@ FT_BEGIN_HEADER +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + + /* we disable the warning `conditional expression is constant' here */ + /* in order to compile cleanly with the maximum level of warnings */ +#pragma warning( disable : 4127 ) + +#endif /* _MSC_VER */ /* * @macro: @@ -57,18 +64,33 @@ FT_BEGIN_HEADER * A variable that receives the service pointer. Will be NULL * if not found. */ +#ifdef __cplusplus + #define FT_FACE_FIND_SERVICE( face, ptr, id ) \ FT_BEGIN_STMNT \ - FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \ - /* the strange cast is to allow C++ compilation */ \ - FT_Pointer* Pptr = (FT_Pointer*) &(ptr); \ + FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ + FT_Pointer _tmp_ = NULL; \ + FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \ \ \ - *Pptr = NULL; \ if ( module->clazz->get_interface ) \ - *Pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \ + _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \ + *_pptr_ = _tmp_; \ FT_END_STMNT +#else /* !C++ */ + +#define FT_FACE_FIND_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ + FT_Pointer _tmp_ = NULL; \ + \ + if ( module->clazz->get_interface ) \ + _tmp_ = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \ + ptr = _tmp_; \ + FT_END_STMNT + +#endif /* !C++ */ /* * @macro: @@ -92,16 +114,33 @@ FT_BEGIN_HEADER * A variable that receives the service pointer. Will be NULL * if not found. */ +#ifdef __cplusplus + #define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \ FT_BEGIN_STMNT \ - FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \ - /* the strange cast is to allow C++ compilation */ \ - FT_Pointer* Pptr = (FT_Pointer*) &(ptr); \ + FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ + FT_Pointer _tmp_; \ + FT_Pointer* _pptr_ = (FT_Pointer*)&(ptr); \ \ \ - *Pptr = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ + _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ + *_pptr_ = _tmp_; \ FT_END_STMNT +#else /* !C++ */ + +#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Module module = FT_MODULE( FT_FACE( face )->driver ); \ + FT_Pointer _tmp_; \ + \ + \ + _tmp_ = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \ + ptr = _tmp_; \ + FT_END_STMNT + +#endif /* !C++ */ + /*************************************************************************/ /*************************************************************************/ @@ -199,27 +238,50 @@ FT_BEGIN_HEADER * ptr :: * A variable receiving the service data. NULL if not available. */ -#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \ - FT_BEGIN_STMNT \ - /* the strange cast is to allow C++ compilation */ \ - FT_Pointer* pptr = (FT_Pointer*)&(ptr); \ - FT_Pointer svc; \ - \ - \ - svc = FT_FACE(face)->internal->services. service_ ## id ; \ - if ( svc == FT_SERVICE_UNAVAILABLE ) \ - svc = NULL; \ - else if ( svc == NULL ) \ - { \ - FT_FACE_FIND_SERVICE( face, svc, id ); \ - \ - FT_FACE(face)->internal->services. service_ ## id = \ - (FT_Pointer)( svc != NULL ? svc \ - : FT_SERVICE_UNAVAILABLE ); \ - } \ - *pptr = svc; \ +#ifdef __cplusplus + +#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Pointer svc; \ + FT_Pointer* Pptr = (FT_Pointer*)&(ptr); \ + \ + \ + svc = FT_FACE( face )->internal->services. service_ ## id; \ + if ( svc == FT_SERVICE_UNAVAILABLE ) \ + svc = NULL; \ + else if ( svc == NULL ) \ + { \ + FT_FACE_FIND_SERVICE( face, svc, id ); \ + \ + FT_FACE( face )->internal->services. service_ ## id = \ + (FT_Pointer)( svc != NULL ? svc \ + : FT_SERVICE_UNAVAILABLE ); \ + } \ + *Pptr = svc; \ FT_END_STMNT +#else /* !C++ */ + +#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \ + FT_BEGIN_STMNT \ + FT_Pointer svc; \ + \ + \ + svc = FT_FACE( face )->internal->services. service_ ## id; \ + if ( svc == FT_SERVICE_UNAVAILABLE ) \ + svc = NULL; \ + else if ( svc == NULL ) \ + { \ + FT_FACE_FIND_SERVICE( face, svc, id ); \ + \ + FT_FACE( face )->internal->services. service_ ## id = \ + (FT_Pointer)( svc != NULL ? svc \ + : FT_SERVICE_UNAVAILABLE ); \ + } \ + ptr = svc; \ + FT_END_STMNT + +#endif /* !C++ */ /* * A macro used to define new service structure types. @@ -238,17 +300,18 @@ FT_BEGIN_HEADER * The header files containing the services. */ -#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h> -#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h> -#define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h> -#define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h> -#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h> -#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h> -#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h> -#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h> -#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h> -#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h> -#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h> +#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h> +#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h> +#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h> +#define FT_SERVICE_OPENTYPE_VALIDATE_H <freetype/internal/services/svotval.h> +#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h> +#define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h> +#define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h> +#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h> +#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h> +#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h> +#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h> +#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h> /* */ diff --git a/headers/libs/freetype2/freetype/internal/ftstream.h b/headers/libs/freetype2/freetype/internal/ftstream.h index 87576fd0e9..1fa9db4559 100644 --- a/headers/libs/freetype2/freetype/internal/ftstream.h +++ b/headers/libs/freetype2/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ /* */ /* Stream handling (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004 by */ +/* Copyright 1996-2001, 2002, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -269,6 +269,25 @@ FT_BEGIN_HEADER /* */ /* Each GET_xxxx() macro uses an implicit `stream' variable. */ /* */ +#if 0 +#define FT_GET_MACRO( type ) FT_NEXT_ ## type ( stream->cursor ) + +#define FT_GET_CHAR() FT_GET_MACRO( CHAR ) +#define FT_GET_BYTE() FT_GET_MACRO( BYTE ) +#define FT_GET_SHORT() FT_GET_MACRO( SHORT ) +#define FT_GET_USHORT() FT_GET_MACRO( USHORT ) +#define FT_GET_OFF3() FT_GET_MACRO( OFF3 ) +#define FT_GET_UOFF3() FT_GET_MACRO( UOFF3 ) +#define FT_GET_LONG() FT_GET_MACRO( LONG ) +#define FT_GET_ULONG() FT_GET_MACRO( ULONG ) +#define FT_GET_TAG4() FT_GET_MACRO( ULONG ) + +#define FT_GET_SHORT_LE() FT_GET_MACRO( SHORT_LE ) +#define FT_GET_USHORT_LE() FT_GET_MACRO( USHORT_LE ) +#define FT_GET_LONG_LE() FT_GET_MACRO( LONG_LE ) +#define FT_GET_ULONG_LE() FT_GET_MACRO( ULONG_LE ) + +#else #define FT_GET_MACRO( func, type ) ( (type)func( stream ) ) #define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char ) @@ -285,6 +304,7 @@ FT_BEGIN_HEADER #define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort ) #define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long ) #define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong ) +#endif #define FT_READ_MACRO( func, type, var ) \ ( var = (type)func( stream, &error ), \ @@ -323,7 +343,7 @@ FT_BEGIN_HEADER /* free a stream */ FT_BASE( void ) - FT_Stream_Free( FT_Stream stream, + FT_Stream_Free( FT_Stream stream, FT_Int external ); /* initialize a stream for reading in-memory data */ @@ -365,6 +385,13 @@ FT_BEGIN_HEADER FT_Byte* buffer, FT_ULong count ); + /* try to read bytes at the end of a stream; return number of bytes */ + /* really available */ + FT_BASE( FT_ULong ) + FT_Stream_TryRead( FT_Stream stream, + FT_Byte* buffer, + FT_ULong count ); + /* Enter a frame of `count' consecutive bytes in a stream. Returns an */ /* error if the frame could not be read/accessed. The caller can use */ /* the FT_Stream_Get_XXX functions to retrieve frame data without */ diff --git a/headers/libs/freetype2/freetype/internal/fttrace.h b/headers/libs/freetype2/freetype/internal/fttrace.h index dffe9cfee9..1267e167f6 100644 --- a/headers/libs/freetype2/freetype/internal/fttrace.h +++ b/headers/libs/freetype2/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ /* */ /* Tracing handling (specification only). */ /* */ -/* Copyright 2002, 2004 by */ +/* Copyright 2002, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -37,24 +37,26 @@ FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */ FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */ FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */ -/* Cache sub-system */ + /* Cache sub-system */ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ -/* SFNT driver components */ + /* SFNT driver components */ FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */ FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */ +FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */ FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */ FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */ FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */ -/* TrueType driver components */ + /* TrueType driver components */ FT_TRACE_DEF( ttdriver ) /* TT font driver (ttdriver.c) */ FT_TRACE_DEF( ttgload ) /* TT glyph loader (ttgload.c) */ FT_TRACE_DEF( ttinterp ) /* bytecode interpreter (ttinterp.c) */ FT_TRACE_DEF( ttobjs ) /* TT objects manager (ttobjs.c) */ FT_TRACE_DEF( ttpload ) /* TT data/program loader (ttpload.c) */ +FT_TRACE_DEF( ttgxvar ) /* TrueType GX var handler (ttgxvar.c) */ -/* Type 1 driver components */ + /* Type 1 driver components */ FT_TRACE_DEF( t1driver ) FT_TRACE_DEF( t1gload ) FT_TRACE_DEF( t1hint ) @@ -62,26 +64,26 @@ FT_TRACE_DEF( t1load ) FT_TRACE_DEF( t1objs ) FT_TRACE_DEF( t1parse ) -/* PostScript helper module `psaux' */ + /* PostScript helper module `psaux' */ FT_TRACE_DEF( t1decode ) FT_TRACE_DEF( psobjs ) -/* PostScript hinting module `pshinter' */ + /* PostScript hinting module `pshinter' */ FT_TRACE_DEF( pshrec ) FT_TRACE_DEF( pshalgo1 ) FT_TRACE_DEF( pshalgo2 ) -/* Type 2 driver components */ + /* Type 2 driver components */ FT_TRACE_DEF( cffdriver ) FT_TRACE_DEF( cffgload ) FT_TRACE_DEF( cffload ) FT_TRACE_DEF( cffobjs ) FT_TRACE_DEF( cffparse ) -/* Type 42 driver component */ + /* Type 42 driver component */ FT_TRACE_DEF( t42 ) -/* CID driver components */ + /* CID driver components */ FT_TRACE_DEF( cidafm ) FT_TRACE_DEF( ciddriver ) FT_TRACE_DEF( cidgload ) @@ -89,19 +91,28 @@ FT_TRACE_DEF( cidload ) FT_TRACE_DEF( cidobjs ) FT_TRACE_DEF( cidparse ) -/* Windows fonts component */ + /* Windows font component */ FT_TRACE_DEF( winfnt ) -/* PCF fonts components */ + /* PCF font components */ FT_TRACE_DEF( pcfdriver ) FT_TRACE_DEF( pcfread ) -/* BDF fonts component */ + /* BDF font components */ FT_TRACE_DEF( bdfdriver ) FT_TRACE_DEF( bdflib ) -/* PFR fonts component */ + /* PFR font component */ FT_TRACE_DEF( pfr ) + /* OpenType validation components */ +FT_TRACE_DEF( otvmodule ) +FT_TRACE_DEF( otvcommon ) +FT_TRACE_DEF( otvbase ) +FT_TRACE_DEF( otvgdef ) +FT_TRACE_DEF( otvgpos ) +FT_TRACE_DEF( otvgsub ) +FT_TRACE_DEF( otvjstf ) + /* END */ diff --git a/headers/libs/freetype2/freetype/internal/ftvalid.h b/headers/libs/freetype2/freetype/internal/ftvalid.h new file mode 100644 index 0000000000..d52ff2f3b2 --- /dev/null +++ b/headers/libs/freetype2/freetype/internal/ftvalid.h @@ -0,0 +1,148 @@ +/***************************************************************************/ +/* */ +/* ftvalid.h */ +/* */ +/* FreeType validation support (specification). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __FTVALID_H__ +#define __FTVALID_H__ + +#include <ft2build.h> +#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */ + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ + /**** ****/ + /**** V A L I D A T I O N ****/ + /**** ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + /* handle to a validation object */ + typedef struct FT_ValidatorRec_* FT_Validator; + + + /*************************************************************************/ + /* */ + /* There are three distinct validation levels defined here: */ + /* */ + /* FT_VALIDATE_DEFAULT :: */ + /* A table that passes this validation level can be used reliably by */ + /* FreeType. It generally means that all offsets have been checked to */ + /* prevent out-of-bound reads, that array counts are correct, etc. */ + /* */ + /* FT_VALIDATE_TIGHT :: */ + /* A table that passes this validation level can be used reliably and */ + /* doesn't contain invalid data. For example, a charmap table that */ + /* returns invalid glyph indices will not pass, even though it can */ + /* be used with FreeType in default mode (the library will simply */ + /* return an error later when trying to load the glyph). */ + /* */ + /* It also checks that fields which must be a multiple of 2, 4, or 8, */ + /* don't have incorrect values, etc. */ + /* */ + /* FT_VALIDATE_PARANOID :: */ + /* Only for font debugging. Checks that a table follows the */ + /* specification by 100%. Very few fonts will be able to pass this */ + /* level anyway but it can be useful for certain tools like font */ + /* editors/converters. */ + /* */ + typedef enum FT_ValidationLevel_ + { + FT_VALIDATE_DEFAULT = 0, + FT_VALIDATE_TIGHT, + FT_VALIDATE_PARANOID + + } FT_ValidationLevel; + + + /* validator structure */ + typedef struct FT_ValidatorRec_ + { + const FT_Byte* base; /* address of table in memory */ + const FT_Byte* limit; /* `base' + sizeof(table) in memory */ + FT_ValidationLevel level; /* validation level */ + FT_Error error; /* error returned. 0 means success */ + + ft_jmp_buf jump_buffer; /* used for exception handling */ + + } FT_ValidatorRec; + + +#define FT_VALIDATOR( x ) ((FT_Validator)( x )) + + + FT_BASE( void ) + ft_validator_init( FT_Validator valid, + const FT_Byte* base, + const FT_Byte* limit, + FT_ValidationLevel level ); + + FT_BASE( FT_Int ) + ft_validator_run( FT_Validator valid ); + + /* Sets the error field in a validator, then calls `longjmp' to return */ + /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */ + /* error checks within the validation routines. */ + /* */ + FT_BASE( void ) + ft_validator_error( FT_Validator valid, + FT_Error error ); + + + /* Calls ft_validate_error. Assumes that the `valid' local variable */ + /* holds a pointer to the current validator object. */ + /* */ + /* Use preprocessor prescan to pass FT_ERR_PREFIX. */ + /* */ +#define FT_INVALID( _prefix, _error ) FT_INVALID_( _prefix, _error ) +#define FT_INVALID_( _prefix, _error ) \ + ft_validator_error( valid, _prefix ## _error ) + + /* called when a broken table is detected */ +#define FT_INVALID_TOO_SHORT \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) + + /* called when an invalid offset is detected */ +#define FT_INVALID_OFFSET \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Offset ) + + /* called when an invalid format/value is detected */ +#define FT_INVALID_FORMAT \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) + + /* called when an invalid glyph index is detected */ +#define FT_INVALID_GLYPH_ID \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Glyph_Index ) + + /* called when an invalid field value is detected */ +#define FT_INVALID_DATA \ + FT_INVALID( FT_ERR_PREFIX, Invalid_Table ) + + +FT_END_HEADER + +#endif /* __FTVALID_H__ */ + + +/* END */ diff --git a/headers/libs/freetype2/freetype/internal/internal.h b/headers/libs/freetype2/freetype/internal/internal.h index 1e5ac44d54..27d5dc585d 100644 --- a/headers/libs/freetype2/freetype/internal/internal.h +++ b/headers/libs/freetype2/freetype/internal/internal.h @@ -35,6 +35,7 @@ #define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h> #define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h> #define FT_INTERNAL_RFORK_H <freetype/internal/ftrfork.h> +#define FT_INTERNAL_VALIDATE_H <freetype/internal/ftvalid.h> #define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h> #define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h> diff --git a/headers/libs/freetype2/freetype/internal/psaux.h b/headers/libs/freetype2/freetype/internal/psaux.h index 8d419be087..cf1abf4c9c 100644 --- a/headers/libs/freetype2/freetype/internal/psaux.h +++ b/headers/libs/freetype2/freetype/internal/psaux.h @@ -5,7 +5,7 @@ /* Auxiliary functions and data structures related to PostScript fonts */ /* (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -478,6 +478,17 @@ FT_BEGIN_HEADER } T1_Builder_FuncsRec; + /* an enumeration type to handle charstring parsing states */ + typedef enum T1_ParseState_ + { + T1_Parse_Start, + T1_Parse_Have_Width, + T1_Parse_Have_Moveto, + T1_Parse_Have_Path + + } T1_ParseState; + + /*************************************************************************/ /* */ /* <Structure> */ @@ -519,15 +530,13 @@ FT_BEGIN_HEADER /* */ /* bbox :: Unused. */ /* */ - /* path_begun :: A flag which indicates that a new path has begun. */ + /* parse_state :: An enumeration which controls the charstring */ + /* parsing state. */ /* */ /* load_points :: If this flag is not set, no points are loaded. */ /* */ /* no_recurse :: Set but not used. */ /* */ - /* error :: An error code that is only used to report memory */ - /* allocation problems. */ - /* */ /* metrics_only :: A boolean indicating that we only want to compute */ /* the metrics of a given glyph, not load all of its */ /* points. */ @@ -555,12 +564,11 @@ FT_BEGIN_HEADER FT_Vector advance; FT_BBox bbox; /* bounding box */ - FT_Bool path_begun; + T1_ParseState parse_state; FT_Bool load_points; FT_Bool no_recurse; FT_Bool shift; - FT_Error error; /* only used for memory errors */ FT_Bool metrics_only; void* hints_funcs; /* hinter-specific */ diff --git a/headers/libs/freetype2/freetype/internal/services/svmm.h b/headers/libs/freetype2/freetype/internal/services/svmm.h index 926975ce88..8a99ec4b1a 100644 --- a/headers/libs/freetype2/freetype/internal/services/svmm.h +++ b/headers/libs/freetype2/freetype/internal/services/svmm.h @@ -2,9 +2,9 @@ /* */ /* svmm.h */ /* */ -/* The FreeType Multiple Masters services (specification). */ +/* The FreeType Multiple Masters and GX var services (specification). */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -39,11 +39,20 @@ FT_BEGIN_HEADER (*FT_Get_MM_Func)( FT_Face face, FT_Multi_Master* master ); + typedef FT_Error + (*FT_Get_MM_Var_Func)( FT_Face face, + FT_MM_Var* *master ); + typedef FT_Error (*FT_Set_MM_Design_Func)( FT_Face face, FT_UInt num_coords, FT_Long* coords ); + typedef FT_Error + (*FT_Set_Var_Design_Func)( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + typedef FT_Error (*FT_Set_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, @@ -52,9 +61,11 @@ FT_BEGIN_HEADER FT_DEFINE_SERVICE( MultiMasters ) { - FT_Get_MM_Func get_mm; - FT_Set_MM_Design_Func set_mm_design; - FT_Set_MM_Blend_Func set_mm_blend; + FT_Get_MM_Func get_mm; + FT_Set_MM_Design_Func set_mm_design; + FT_Set_MM_Blend_Func set_mm_blend; + FT_Get_MM_Var_Func get_mm_var; + FT_Set_Var_Design_Func set_var_design; }; /* */ diff --git a/headers/libs/freetype2/freetype/internal/services/svotval.h b/headers/libs/freetype2/freetype/internal/services/svotval.h new file mode 100644 index 0000000000..fbe45d0ddf --- /dev/null +++ b/headers/libs/freetype2/freetype/internal/services/svotval.h @@ -0,0 +1,53 @@ +/***************************************************************************/ +/* */ +/* svotval.h */ +/* */ +/* The FreeType OpenType validation service (specification). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __SVOTVAL_H__ +#define __SVOTVAL_H__ + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_OPENTYPE_VALIDATE "opentype-validate" + + + typedef FT_Error + (*otv_validate_func)( FT_Face face, + FT_UInt ot_flags, + FT_Bytes *base, + FT_Bytes *gdef, + FT_Bytes *gpos, + FT_Bytes *gsub, + FT_Bytes *jstf ); + + + FT_DEFINE_SERVICE( OTvalidate ) + { + otv_validate_func validate; + }; + + /* */ + + +FT_END_HEADER + + +#endif /* __SVOTVAL_H__ */ + + +/* END */ diff --git a/headers/libs/freetype2/freetype/internal/services/svpsinfo.h b/headers/libs/freetype2/freetype/internal/services/svpsinfo.h index 73c02cdb73..63f5db9c19 100644 --- a/headers/libs/freetype2/freetype/internal/services/svpsinfo.h +++ b/headers/libs/freetype2/freetype/internal/services/svpsinfo.h @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript info service (specification). */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -36,11 +36,16 @@ FT_BEGIN_HEADER typedef FT_Int (*PS_HasGlyphNamesFunc)( FT_Face face ); + typedef FT_Error + (*PS_GetFontPrivateFunc)( FT_Face face, + PS_PrivateRec* afont_private ); + FT_DEFINE_SERVICE( PsInfo ) { - PS_GetFontInfoFunc ps_get_font_info; - PS_HasGlyphNamesFunc ps_has_glyph_names; + PS_GetFontInfoFunc ps_get_font_info; + PS_HasGlyphNamesFunc ps_has_glyph_names; + PS_GetFontPrivateFunc ps_get_font_private; }; /* */ diff --git a/headers/libs/freetype2/freetype/internal/services/svsfnt.h b/headers/libs/freetype2/freetype/internal/services/svsfnt.h index 06a5b1c23d..87346c6d00 100644 --- a/headers/libs/freetype2/freetype/internal/services/svsfnt.h +++ b/headers/libs/freetype2/freetype/internal/services/svsfnt.h @@ -2,9 +2,9 @@ /* */ /* svsfnt.h */ /* */ -/* The FreeType PostScript name services (specification). */ +/* The FreeType SFNT table loading service (specification). */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -50,11 +50,22 @@ FT_BEGIN_HEADER (*FT_SFNT_TableGetFunc)( FT_Face face, FT_Sfnt_Tag tag ); - + + /* + * Used to implement FT_Sfnt_Table_Info(). + */ + typedef FT_Error + (*FT_SFNT_TableInfoFunc)( FT_Face face, + FT_UInt idx, + FT_ULong *tag, + FT_ULong *length ); + + FT_DEFINE_SERVICE( SFNT_Table ) { FT_SFNT_TableLoadFunc load_table; FT_SFNT_TableGetFunc get_table; + FT_SFNT_TableInfoFunc table_info; }; /* */ diff --git a/headers/libs/freetype2/freetype/internal/sfnt.h b/headers/libs/freetype2/freetype/internal/sfnt.h index 9a23b1f829..7b582630b7 100644 --- a/headers/libs/freetype2/freetype/internal/sfnt.h +++ b/headers/libs/freetype2/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -478,6 +478,27 @@ FT_BEGIN_HEADER (*TT_Free_Table_Func)( TT_Face face ); + /* + * @functype: + * TT_Face_GetKerningFunc + * + * @description: + * Return the horizontal kerning value between two glyphs. + * + * @input: + * face :: A handle to the source face object. + * left_glyph :: The left glyph index. + * right_glyph :: The right glyph index. + * + * @return: + * The kerning value in font units. + */ + typedef FT_Int + (*TT_Face_GetKerningFunc)( TT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph ); + + /*************************************************************************/ /* */ /* <Struct> */ @@ -534,6 +555,9 @@ FT_BEGIN_HEADER TT_Load_SBit_Image_Func load_sbit_image; TT_Free_Table_Func free_sbits; + /* see `ttkern.h' */ + TT_Face_GetKerningFunc get_kerning; + /* see `ttpost.h' */ TT_Get_PS_Name_Func get_psname; TT_Free_Table_Func free_psnames; diff --git a/headers/libs/freetype2/freetype/internal/tttypes.h b/headers/libs/freetype2/freetype/internal/tttypes.h index 02db8b4fc8..7f8335f829 100644 --- a/headers/libs/freetype2/freetype/internal/tttypes.h +++ b/headers/libs/freetype2/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,6 +25,10 @@ #include FT_TRUETYPE_TABLES_H #include FT_INTERNAL_OBJECTS_H +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#endif + FT_BEGIN_HEADER @@ -307,6 +311,8 @@ FT_BEGIN_HEADER } TT_GaspRec; +#ifndef FT_OPTIMIZE_MEMORY + /*************************************************************************/ /* */ /* <Struct> */ @@ -383,6 +389,8 @@ FT_BEGIN_HEADER } TT_Kern0_PairRec, *TT_Kern0_Pair; +#endif /* !OPTIMIZE_MEMORY */ + /*************************************************************************/ /*************************************************************************/ @@ -818,6 +826,24 @@ FT_BEGIN_HEADER } TT_Post_NamesRec, *TT_Post_Names; + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ + /*** GX VARIATION TABLE SUPPORT ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + typedef struct GX_BlendRec_ *GX_Blend; +#endif + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1110,6 +1136,9 @@ FT_BEGIN_HEADER /* glyph data within the `glyf' table. */ /* Ignored for Type 2 font faces. */ /* */ + /* glyf_len :: The length of the `glyf' table. Needed */ + /* for malformed `loca' tables. */ + /* */ /* font_program_size :: Size in bytecodes of the face's font */ /* program. 0 if none defined. Ignored for */ /* Type 2 fonts. */ @@ -1152,8 +1181,18 @@ FT_BEGIN_HEADER /* unpatented_hinting :: If true, use only unpatented methods in */ /* the bytecode interpreter. */ /* */ + /* doblend :: A boolean which is set if the font should */ + /* be blended (this is for GX var). */ + /* */ + /* blend :: Contains the data needed to control GX */ + /* variation tables (rather like Multiple */ + /* Master data). */ + /* */ /* extra :: Reserved for third-party font drivers. */ /* */ + /* postscript_name :: The PS name of the font. Used by the */ + /* postscript name service. */ + /* */ typedef struct TT_FaceRec_ { FT_FaceRec root; @@ -1166,12 +1205,20 @@ FT_BEGIN_HEADER TT_Header header; /* TrueType header table */ TT_HoriHeader horizontal; /* TrueType horizontal header */ +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* horz_metrics; + FT_ULong horz_metrics_size; +#endif TT_MaxProfile max_profile; FT_ULong max_components; FT_Bool vertical_info; TT_VertHeader vertical; /* TT Vertical header, if present */ +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* vert_metrics; + FT_ULong vert_metrics_size; +#endif FT_UShort num_names; /* number of name records */ TT_NameTableRec name_table; /* name table */ @@ -1206,7 +1253,15 @@ FT_BEGIN_HEADER /***********************************************************************/ /* horizontal device metrics */ +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* hdmx_table; + FT_ULong hdmx_table_size; + FT_UInt hdmx_record_count; + FT_ULong hdmx_record_size; + FT_Byte* hdmx_record_sizes; +#else TT_HdmxRec hdmx; +#endif /* grid-fitting and scaling table */ TT_GaspRec gasp; /* the `gasp' table */ @@ -1215,8 +1270,14 @@ FT_BEGIN_HEADER TT_PCLT pclt; /* embedded bitmaps support */ +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* sbit_table; + FT_ULong sbit_table_size; + FT_UInt sbit_num_strikes; +#else FT_ULong num_sbit_strikes; TT_SBit_Strike sbit_strikes; +#endif FT_ULong num_sbit_scales; TT_SBit_Scale sbit_scales; @@ -1232,8 +1293,15 @@ FT_BEGIN_HEADER /***********************************************************************/ /* the glyph locations */ +#ifdef FT_OPTIMIZE_MEMORY + FT_UInt num_locations; + FT_Byte* glyph_locations; +#else FT_UShort num_locations; FT_Long* glyph_locations; +#endif + + FT_ULong glyf_len; /* the font program, if any */ FT_ULong font_program_size; @@ -1247,10 +1315,18 @@ FT_BEGIN_HEADER FT_ULong cvt_size; FT_Short* cvt; +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* kern_table; + FT_ULong kern_table_size; + FT_UInt num_kern_tables; + FT_UInt32 kern_avail_bits; + FT_UInt32 kern_order_bits; +#else /* the format 0 kerning table, if any */ FT_Int num_kern_pairs; FT_Int kern_table_index; TT_Kern0_Pair kern_pairs; +#endif /* A pointer to the bytecode interpreter to use. This is also */ /* used to hook the debugger for the `ttdebug' utility. */ @@ -1261,6 +1337,11 @@ FT_BEGIN_HEADER FT_Bool unpatented_hinting; #endif +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_Bool doblend; + GX_Blend blend; +#endif + /***********************************************************************/ /* */ /* Other tables or fields. This is used by derivative formats like */ diff --git a/headers/libs/freetype2/freetype/t1tables.h b/headers/libs/freetype2/freetype/t1tables.h index 1b89c5f511..5ae12b8268 100644 --- a/headers/libs/freetype2/freetype/t1tables.h +++ b/headers/libs/freetype2/freetype/t1tables.h @@ -226,7 +226,7 @@ FT_BEGIN_HEADER typedef struct PS_DesignMap_ { FT_Byte num_points; - FT_Fixed* design_points; + FT_Long* design_points; FT_Fixed* blend_points; } PS_DesignMapRec, *PS_DesignMap; @@ -387,6 +387,38 @@ FT_BEGIN_HEADER FT_Get_PS_Font_Info( FT_Face face, PS_FontInfoRec *afont_info ); + + /************************************************************************ + * + * @function: + * FT_Get_PS_Font_Private + * + * @description: + * Retrieve the @PS_PrivateRec structure corresponding to a given + * Postscript font. + * + * @input: + * face :: + * Postscript face handle. + * + * @output: + * afont_private :: + * Output private dictionary structure pointer. + * + * @return: + * FreeType error code. 0 means success. + * + * @note: + * The string pointers within the font info structure are owned by + * the face and don't need to be freed by the caller. + * + * If the font's format is not Postscript-based, this function will + * return the FT_Err_Invalid_Argument error code. + */ + FT_EXPORT( FT_Error ) + FT_Get_PS_Font_Private( FT_Face face, + PS_PrivateRec *afont_private ); + /* */ diff --git a/headers/libs/freetype2/freetype/ttnameid.h b/headers/libs/freetype2/freetype/ttnameid.h index 848374fe22..2e7f110855 100644 --- a/headers/libs/freetype2/freetype/ttnameid.h +++ b/headers/libs/freetype2/freetype/ttnameid.h @@ -4,7 +4,7 @@ /* */ /* TrueType name ID definitions (specification only). */ /* */ -/* Copyright 1996-2002, 2003 by */ +/* Copyright 1996-2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -443,15 +443,23 @@ FT_BEGIN_HEADER /* of the TTF `name' table if the `platform' identifier code is */ /* TT_PLATFORM_MICROSOFT. */ /* */ - /* The canonical source for the MS assigned LCID's used to be at */ + /* The canonical source for the MS assigned LCID's (seems to) be at */ + /* */ + /* http://www.microsoft.com/globaldev/reference/lcid-all.mspx */ + /* */ + /* It used to be at various places, among them */ /* */ /* http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt */ - /* */ - /* Now (2002-11-15), the Microsoft site directs to */ - /* */ /* http://www.microsoft.com/globaldev/reference/loclanghome.asp */ /* http://support.microsoft.com/support/kb/articles/Q224/8/04.ASP */ + /* http://msdn.microsoft.com/library/en-us/passport25/ */ + /* NET_Passport_VBScript_Documentation/Single_Sign_In/ */ + /* Advanced_Single_Sign_In/Localization_and_LCIDs.asp */ /* */ + /* Hopefully, it seems now that the Globaldev site prevails... */ + /* (updated by Antoine, 2004-02-17) */ + +#define TT_MS_LANGID_ARABIC_GENERAL 0x0001 #define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401 #define TT_MS_LANGID_ARABIC_IRAQ 0x0801 #define TT_MS_LANGID_ARABIC_EGYPT 0x0c01 @@ -470,18 +478,23 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_ARABIC_QATAR 0x4001 #define TT_MS_LANGID_BULGARIAN_BULGARIA 0x0402 #define TT_MS_LANGID_CATALAN_SPAIN 0x0403 +#define TT_MS_LANGID_CHINESE_GENERAL 0x0004 #define TT_MS_LANGID_CHINESE_TAIWAN 0x0404 #define TT_MS_LANGID_CHINESE_PRC 0x0804 #define TT_MS_LANGID_CHINESE_HONG_KONG 0x0c04 #define TT_MS_LANGID_CHINESE_SINGAPORE 0x1004 -#if 1 /* this used to be this value (and it still is in many places) */ +#if 1 /* this looks like the correct value */ #define TT_MS_LANGID_CHINESE_MACAU 0x1404 #else /* but beware, Microsoft may change its mind... the most recent Word reference has the following: */ #define TT_MS_LANGID_CHINESE_MACAU TT_MS_LANGID_CHINESE_HONG_KONG #endif +#if 0 /* used only with .NET "cultures"; commented out */ +#define TT_MS_LANGID_CHINESE_TRADITIONAL 0x7C04 +#endif + #define TT_MS_LANGID_CZECH_CZECH_REPUBLIC 0x0405 #define TT_MS_LANGID_DANISH_DENMARK 0x0406 #define TT_MS_LANGID_GERMAN_GERMANY 0x0407 @@ -490,6 +503,13 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_GERMAN_LUXEMBOURG 0x1007 #define TT_MS_LANGID_GERMAN_LIECHTENSTEI 0x1407 #define TT_MS_LANGID_GREEK_GREECE 0x0408 + + /* don't ask what this one means... It is commented out currently. */ +#if 0 +#define TT_MS_LANGID_GREEK_GREECE2 0x2008 +#endif + +#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009 #define TT_MS_LANGID_ENGLISH_UNITED_STATES 0x0409 #define TT_MS_LANGID_ENGLISH_UNITED_KINGDOM 0x0809 #define TT_MS_LANGID_ENGLISH_AUSTRALIA 0x0c09 @@ -503,6 +523,11 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_ENGLISH_TRINIDAD 0x2c09 #define TT_MS_LANGID_ENGLISH_ZIMBABWE 0x3009 #define TT_MS_LANGID_ENGLISH_PHILIPPINES 0x3409 +#define TT_MS_LANGID_ENGLISH_INDONESIA 0x3809 +#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3c09 +#define TT_MS_LANGID_ENGLISH_INDIA 0x4009 +#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409 +#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809 #define TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT 0x040a #define TT_MS_LANGID_SPANISH_MEXICO 0x080a #define TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT 0x0c0a @@ -523,6 +548,10 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_SPANISH_HONDURAS 0x480a #define TT_MS_LANGID_SPANISH_NICARAGUA 0x4c0a #define TT_MS_LANGID_SPANISH_PUERTO_RICO 0x500a +#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a + /* The following ID blatantly violate MS specs by using a */ + /* sublanguage > 0x1F. */ +#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40aU #define TT_MS_LANGID_FINNISH_FINLAND 0x040b #define TT_MS_LANGID_FRENCH_FRANCE 0x040c #define TT_MS_LANGID_FRENCH_BELGIUM 0x080c @@ -530,6 +559,19 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_FRENCH_SWITZERLAND 0x100c #define TT_MS_LANGID_FRENCH_LUXEMBOURG 0x140c #define TT_MS_LANGID_FRENCH_MONACO 0x180c +#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1c0c +#define TT_MS_LANGID_FRENCH_REUNION 0x200c +#define TT_MS_LANGID_FRENCH_CONGO 0x240c + /* which was formerly: */ +#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO +#define TT_MS_LANGID_FRENCH_SENEGAL 0x280c +#define TT_MS_LANGID_FRENCH_CAMEROON 0x2c0c +#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300c +#define TT_MS_LANGID_FRENCH_MALI 0x340c +#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c +#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c + /* and another violation of the spec (see 0xE40aU) */ +#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40cU #define TT_MS_LANGID_HEBREW_ISRAEL 0x040d #define TT_MS_LANGID_HUNGARIAN_HUNGARY 0x040e #define TT_MS_LANGID_ICELANDIC_ICELAND 0x040f @@ -553,6 +595,18 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_CROATIAN_CROATIA 0x041a #define TT_MS_LANGID_SERBIAN_SERBIA_LATIN 0x081a #define TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC 0x0c1a + +#if 0 /* this used to be this value, but it looks like we were wrong */ +#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x101a +#else /* current sources say */ +#define TT_MS_LANGID_CROATIAN_BOSNIA_HERZEGOVINA 0x101a +#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x141a + /* and XPsp2 Platform SDK added (2004-07-26) */ + /* Names are shortened to be signifiant within 40 chars. */ +#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_LATIN 0x181a +#define TT_MS_LANGID_SERBIAN_BOSNIA_HERZ_CYRILLIC 0x181a +#endif + #define TT_MS_LANGID_SLOVAK_SLOVAKIA 0x041b #define TT_MS_LANGID_ALBANIAN_ALBANIA 0x041c #define TT_MS_LANGID_SWEDISH_SWEDEN 0x041d @@ -560,6 +614,7 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_THAI_THAILAND 0x041e #define TT_MS_LANGID_TURKISH_TURKEY 0x041f #define TT_MS_LANGID_URDU_PAKISTAN 0x0420 +#define TT_MS_LANGID_URDU_INDIA 0x0820 #define TT_MS_LANGID_INDONESIAN_INDONESIA 0x0421 #define TT_MS_LANGID_UKRAINIAN_UKRAINE 0x0422 #define TT_MS_LANGID_BELARUSIAN_BELARUS 0x0423 @@ -568,11 +623,7 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_LATVIAN_LATVIA 0x0426 #define TT_MS_LANGID_LITHUANIAN_LITHUANIA 0x0427 #define TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA 0x0827 - -#if 0 /* this seems to be an error that have been dropped */ -#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0428 -#endif - +#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428 #define TT_MS_LANGID_FARSI_IRAN 0x0429 #define TT_MS_LANGID_VIETNAMESE_VIET_NAM 0x042a #define TT_MS_LANGID_ARMENIAN_ARMENIA 0x042b @@ -592,6 +643,17 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS 0x0438 #define TT_MS_LANGID_HINDI_INDIA 0x0439 #define TT_MS_LANGID_MALTESE_MALTA 0x043a + /* Added by XPsp2 Platform SDK (2004-07-26) */ +#define TT_MS_LANGID_SAMI_NORTHERN_NORWAY 0x043b +#define TT_MS_LANGID_SAMI_NORTHERN_SWEDEN 0x083b +#define TT_MS_LANGID_SAMI_NORTHERN_FINLAND 0x0C3b +#define TT_MS_LANGID_SAMI_LULE_NORWAY 0x103b +#define TT_MS_LANGID_SAMI_LULE_SWEDEN 0x143b +#define TT_MS_LANGID_SAMI_SOUTHERN_NORWAY 0x183b +#define TT_MS_LANGID_SAMI_SOUTHERN_SWEDEN 0x1C3b +#define TT_MS_LANGID_SAMI_SKOLT_FINLAND 0x203b +#define TT_MS_LANGID_SAMI_INARI_FINLAND 0x243b + /* ... and we also keep our old identifier... */ #define TT_MS_LANGID_SAAMI_LAPONIA 0x043b #if 0 /* this seems to be a previous invertion */ @@ -602,15 +664,24 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_IRISH_GAELIC_IRELAND 0x043c #endif +#define TT_MS_LANGID_YIDDISH_GERMANY 0x043d #define TT_MS_LANGID_MALAY_MALAYSIA 0x043e #define TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM 0x083e #define TT_MS_LANGID_KAZAK_KAZAKSTAN 0x043f +#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN /* Cyrillic*/ 0x0440 + /* alias declared in Windows 2000 */ +#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \ + TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN + #define TT_MS_LANGID_SWAHILI_KENYA 0x0441 +#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442 #define TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN 0x0443 #define TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC 0x0843 #define TT_MS_LANGID_TATAR_TATARSTAN 0x0444 #define TT_MS_LANGID_BENGALI_INDIA 0x0445 +#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845 #define TT_MS_LANGID_PUNJABI_INDIA 0x0446 +#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846 #define TT_MS_LANGID_GUJARATI_INDIA 0x0447 #define TT_MS_LANGID_ORIYA_INDIA 0x0448 #define TT_MS_LANGID_TAMIL_INDIA 0x0449 @@ -620,107 +691,72 @@ FT_BEGIN_HEADER #define TT_MS_LANGID_ASSAMESE_INDIA 0x044d #define TT_MS_LANGID_MARATHI_INDIA 0x044e #define TT_MS_LANGID_SANSKRIT_INDIA 0x044f -#define TT_MS_LANGID_KONKANI_INDIA 0x0457 - - /* new as of 2001-01-01 */ -#define TT_MS_LANGID_ARABIC_GENERAL 0x0001 -#define TT_MS_LANGID_CHINESE_GENERAL 0x0004 -#define TT_MS_LANGID_ENGLISH_GENERAL 0x0009 -#define TT_MS_LANGID_FRENCH_WEST_INDIES 0x1c0c -#define TT_MS_LANGID_FRENCH_REUNION 0x200c -#define TT_MS_LANGID_FRENCH_CONGO 0x240c - /* which was formerly: */ -#define TT_MS_LANGID_FRENCH_ZAIRE TT_MS_LANGID_FRENCH_CONGO - -#define TT_MS_LANGID_FRENCH_SENEGAL 0x280c -#define TT_MS_LANGID_FRENCH_CAMEROON 0x2c0c -#define TT_MS_LANGID_FRENCH_COTE_D_IVOIRE 0x300c -#define TT_MS_LANGID_FRENCH_MALI 0x340c -#define TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA 0x101a -#define TT_MS_LANGID_URDU_INDIA 0x0820 -#define TT_MS_LANGID_TAJIK_TAJIKISTAN 0x0428 -#define TT_MS_LANGID_YIDDISH_GERMANY 0x043d -#define TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN 0x0440 - /* alias declared in Windows 2000 */ -#define TT_MS_LANGID_KIRGHIZ_KIRGHIZ_REPUBLIC \ - TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN - -#define TT_MS_LANGID_TURKMEN_TURKMENISTAN 0x0442 #define TT_MS_LANGID_MONGOLIAN_MONGOLIA /* Cyrillic */ 0x0450 - - /* the following seems to be inconsistent; - here is the current "official" way: */ -#define TT_MS_LANGID_TIBETAN_BHUTAN 0x0451 - /* and here is what is used by Passport SDK */ +#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850 #define TT_MS_LANGID_TIBETAN_CHINA 0x0451 #define TT_MS_LANGID_DZONGHKA_BHUTAN 0x0851 - /* end of inconsistency */ + +#if 0 + /* the following used to be defined */ +#define TT_MS_LANGID_TIBETAN_BHUTAN 0x0451 + /* ... but it was changed; */ +#else + /* So we will continue to #define it, but with the correct value */ +#define TT_MS_LANGID_TIBETAN_BHUTAN TT_MS_LANGID_DZONGHKA_BHUTAN +#endif #define TT_MS_LANGID_WELSH_WALES 0x0452 #define TT_MS_LANGID_KHMER_CAMBODIA 0x0453 #define TT_MS_LANGID_LAO_LAOS 0x0454 #define TT_MS_LANGID_BURMESE_MYANMAR 0x0455 #define TT_MS_LANGID_GALICIAN_SPAIN 0x0456 -#define TT_MS_LANGID_MANIPURI_INDIA 0x0458 -#define TT_MS_LANGID_SINDHI_INDIA 0x0459 - /* the following one is only encountered in Microsoft RTF specification */ -#define TT_MS_LANGID_KASHMIRI_PAKISTAN 0x0460 - /* the following one is not in the Passport list, looks like an omission */ -#define TT_MS_LANGID_KASHMIRI_INDIA 0x0860 -#define TT_MS_LANGID_NEPALI_NEPAL 0x0461 -#define TT_MS_LANGID_NEPALI_INDIA 0x0861 -#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462 - - /* new as of 2001-03-01 (from Office Xp) */ -#define TT_MS_LANGID_ENGLISH_HONG_KONG 0x3c09 -#define TT_MS_LANGID_ENGLISH_INDIA 0x4009 -#define TT_MS_LANGID_ENGLISH_MALAYSIA 0x4409 -#define TT_MS_LANGID_ENGLISH_SINGAPORE 0x4809 +#define TT_MS_LANGID_KONKANI_INDIA 0x0457 +#define TT_MS_LANGID_MANIPURI_INDIA /* Bengali */ 0x0458 +#define TT_MS_LANGID_SINDHI_INDIA /* Arabic */ 0x0459 +#define TT_MS_LANGID_SINDHI_PAKISTAN 0x0859 + /* Missing a LCID for Sindhi in Devanagari script */ #define TT_MS_LANGID_SYRIAC_SYRIA 0x045a #define TT_MS_LANGID_SINHALESE_SRI_LANKA 0x045b #define TT_MS_LANGID_CHEROKEE_UNITED_STATES 0x045c #define TT_MS_LANGID_INUKTITUT_CANADA 0x045d #define TT_MS_LANGID_AMHARIC_ETHIOPIA 0x045e -#define TT_MS_LANGID_TAMAZIGHT_MOROCCO 0x045f +#define TT_MS_LANGID_TAMAZIGHT_MOROCCO /* Arabic */ 0x045f #define TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN 0x085f + /* Missing a LCID for Tifinagh script */ +#define TT_MS_LANGID_KASHMIRI_PAKISTAN /* Arabic */ 0x0460 + /* Spelled this way by XPsp2 Platform SDK (2004-07-26) */ + /* script is yet unclear... might be Arabic, Nagari or Sharada */ +#define TT_MS_LANGID_KASHMIRI_SASIA 0x0860 + /* ... and aliased (by MS) for compatibility reasons. */ +#define TT_MS_LANGID_KASHMIRI_INDIA TT_MS_LANGID_KASHMIRI_SASIA +#define TT_MS_LANGID_NEPALI_NEPAL 0x0461 +#define TT_MS_LANGID_NEPALI_INDIA 0x0861 +#define TT_MS_LANGID_FRISIAN_NETHERLANDS 0x0462 #define TT_MS_LANGID_PASHTO_AFGHANISTAN 0x0463 #define TT_MS_LANGID_FILIPINO_PHILIPPINES 0x0464 #define TT_MS_LANGID_DHIVEHI_MALDIVES 0x0465 /* alias declared in Windows 2000 */ #define TT_MS_LANGID_DIVEHI_MALDIVES TT_MS_LANGID_DHIVEHI_MALDIVES - /* for language codes from 0x0466 to 0x0471 see below */ -#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472 -#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473 -#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873 - /* also spelled in the `Passport SDK' list as: */ -#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA - - /* New additions from Windows Xp/Passport SDK 2001-11-10. */ - - /* don't ask what this one means... It is commented out currently. */ -#if 0 -#define TT_MS_LANGID_GREEK_GREECE2 0x2008 -#endif - -#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a - /* The following two IDs blatantly violate MS specs by using a */ - /* sublanguage > 0x1F. */ -#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40aU -#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40cU - -#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c -#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c -#define TT_MS_LANGID_BENGALI_BANGLADESH 0x0845 -#define TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN 0x0846 -#define TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN 0x0850 #define TT_MS_LANGID_EDO_NIGERIA 0x0466 #define TT_MS_LANGID_FULFULDE_NIGERIA 0x0467 #define TT_MS_LANGID_HAUSA_NIGERIA 0x0468 #define TT_MS_LANGID_IBIBIO_NIGERIA 0x0469 #define TT_MS_LANGID_YORUBA_NIGERIA 0x046a - /* language codes from 0x046b to 0x046f are (still) unknown. */ +#define TT_MS_LANGID_QUECHUA_BOLIVIA 0x046b +#define TT_MS_LANGID_QUECHUA_ECUADOR 0x086b +#define TT_MS_LANGID_QUECHUA_PERU 0x0c6b +#define TT_MS_LANGID_SEPEDI_SOUTH_AFRICA 0x046c + /* Also spelled by XPsp2 Platform SDK (2004-07-26) */ +#define TT_MS_LANGID_SOTHO_SOUTHERN_SOUTH_AFRICA \ + TT_MS_LANGID_SEPEDI_SOUTH_AFRICA + /* language codes 0x046d, 0x046e and 0x046f are (still) unknown. */ #define TT_MS_LANGID_IGBO_NIGERIA 0x0470 #define TT_MS_LANGID_KANURI_NIGERIA 0x0471 +#define TT_MS_LANGID_OROMO_ETHIOPIA 0x0472 +#define TT_MS_LANGID_TIGRIGNA_ETHIOPIA 0x0473 +#define TT_MS_LANGID_TIGRIGNA_ERYTHREA 0x0873 + /* also spelled in the `Passport SDK' list as: */ +#define TT_MS_LANGID_TIGRIGNA_ERYTREA TT_MS_LANGID_TIGRIGNA_ERYTHREA #define TT_MS_LANGID_GUARANI_PARAGUAY 0x0474 #define TT_MS_LANGID_HAWAIIAN_UNITED_STATES 0x0475 #define TT_MS_LANGID_LATIN 0x0476 @@ -730,6 +766,13 @@ FT_BEGIN_HEADER /* studying). */ #define TT_MS_LANGID_YI_CHINA 0x0478 #define TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES 0x0479 + /* language codes from 0x047a to 0x047f are (still) unknown. */ +#define TT_MS_LANGID_UIGHUR_CHINA 0x0480 +#define TT_MS_LANGID_MAORI_NEW_ZEALAND 0x0481 + +#if 0 /* not deemed useful for fonts */ +#define TT_MS_LANGID_HUMAN_INTERFACE_DEVICE 0x04ff +#endif /*************************************************************************/ diff --git a/headers/libs/freetype2/freetype/tttables.h b/headers/libs/freetype2/freetype/tttables.h index 22247913ef..051c1eaf6f 100644 --- a/headers/libs/freetype2/freetype/tttables.h +++ b/headers/libs/freetype2/freetype/tttables.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -42,7 +42,7 @@ FT_BEGIN_HEADER /* TrueType Tables */ /* */ /* <Abstract> */ - /* TrueType-specific table types and functions. */ + /* TrueType specific table types and functions. */ /* */ /* <Description> */ /* This section contains the definition of TrueType-specific tables */ @@ -516,12 +516,11 @@ FT_BEGIN_HEADER /* maxSizeOfInstructions :: The maximum number of TrueType opcodes */ /* used for glyph hinting. */ /* */ - /* maxComponentElements :: An obscure value related to composite */ - /* glyphs definitions. */ + /* maxComponentElements :: The maximum number of simple (i.e., non- */ + /* composite) glyphs in a composite glyph. */ /* */ - /* maxComponentDepth :: An obscure value related to composite */ - /* glyphs definitions. Probably the maximum */ - /* number of simple glyphs in a composite. */ + /* maxComponentDepth :: The maximum nesting depth of composite */ + /* glyphs. */ /* */ /* <Note> */ /* This structure is only used during font loading. */ @@ -652,7 +651,7 @@ FT_BEGIN_HEADER * buffer = malloc( length ); * if ( buffer == NULL ) { ... not enough memory ... } * - * error = FT_Load_Sfnt_Table( face,tag, 0, buffer, &length ); + * error = FT_Load_Sfnt_Table( face, tag, 0, buffer, &length ); * if ( error ) { ... could not load table ... } * } */ @@ -664,6 +663,43 @@ FT_BEGIN_HEADER FT_ULong* length ); + /************************************************************************** + * + * <Function> + * FT_Sfnt_Table_Info + * + * <Description> + * Returns information on an SFNT table. + * + * <Input> + * face :: + * A handle to the source face. + * + * table_index :: + * The index of an SFNT table. The function returns + * FT_Err_Table_Missing for an invalid value. + * + * <Output> + * tag :: + * The name tag of the SFNT table. + * + * length :: + * The length of the SFNT table. + * + * <Return> + * FreeType error code. 0 means success. + * + * <Note> + * SFNT tables with length zero are treated as missing by Windows. + * + */ + FT_EXPORT( FT_Error ) + FT_Sfnt_Table_Info( FT_Face face, + FT_UInt table_index, + FT_ULong *tag, + FT_ULong *length ); + + /*************************************************************************/ /* */ /* <Function> */ diff --git a/headers/libs/freetype2/freetype/tttags.h b/headers/libs/freetype2/freetype/tttags.h index ac64758b10..9fee71bf81 100644 --- a/headers/libs/freetype2/freetype/tttags.h +++ b/headers/libs/freetype2/freetype/tttags.h @@ -2,9 +2,9 @@ /* */ /* tttags.h */ /* */ -/* Tags for TrueType tables (specification only). */ +/* Tags for TrueType and OpenType tables (specification only). */ /* */ -/* Copyright 1996-2001 by */ +/* Copyright 1996-2001, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,31 +33,38 @@ FT_BEGIN_HEADER -#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) -#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) -#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) -#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) -#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) +#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) +#define TTAG_BASE FT_MAKE_TAG( 'B', 'A', 'S', 'E' ) #define TTAG_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) +#define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) #define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) +#define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) +#define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) +#define TTAG_cvar FT_MAKE_TAG( 'c', 'v', 'a', 'r' ) +#define TTAG_cvt FT_MAKE_TAG( 'c', 'v', 't', ' ' ) +#define TTAG_DSIG FT_MAKE_TAG( 'D', 'S', 'I', 'G' ) #define TTAG_EBDT FT_MAKE_TAG( 'E', 'B', 'D', 'T' ) #define TTAG_EBLC FT_MAKE_TAG( 'E', 'B', 'L', 'C' ) #define TTAG_EBSC FT_MAKE_TAG( 'E', 'B', 'S', 'C' ) #define TTAG_fpgm FT_MAKE_TAG( 'f', 'p', 'g', 'm' ) #define TTAG_fvar FT_MAKE_TAG( 'f', 'v', 'a', 'r' ) #define TTAG_gasp FT_MAKE_TAG( 'g', 'a', 's', 'p' ) +#define TTAG_GDEF FT_MAKE_TAG( 'G', 'D', 'E', 'F' ) #define TTAG_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) +#define TTAG_GPOS FT_MAKE_TAG( 'G', 'P', 'O', 'S' ) #define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) +#define TTAG_gvar FT_MAKE_TAG( 'g', 'v', 'a', 'r' ) #define TTAG_hdmx FT_MAKE_TAG( 'h', 'd', 'm', 'x' ) #define TTAG_head FT_MAKE_TAG( 'h', 'e', 'a', 'd' ) #define TTAG_hhea FT_MAKE_TAG( 'h', 'h', 'e', 'a' ) #define TTAG_hmtx FT_MAKE_TAG( 'h', 'm', 't', 'x' ) +#define TTAG_JSTF FT_MAKE_TAG( 'J', 'S', 'T', 'F' ) #define TTAG_kern FT_MAKE_TAG( 'k', 'e', 'r', 'n' ) #define TTAG_loca FT_MAKE_TAG( 'l', 'o', 'c', 'a' ) #define TTAG_LTSH FT_MAKE_TAG( 'L', 'T', 'S', 'H' ) #define TTAG_maxp FT_MAKE_TAG( 'm', 'a', 'x', 'p' ) -#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) #define TTAG_MMFX FT_MAKE_TAG( 'M', 'M', 'F', 'X' ) +#define TTAG_MMSD FT_MAKE_TAG( 'M', 'M', 'S', 'D' ) #define TTAG_name FT_MAKE_TAG( 'n', 'a', 'm', 'e' ) #define TTAG_OS2 FT_MAKE_TAG( 'O', 'S', '/', '2' ) #define TTAG_OTTO FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) diff --git a/src/libs/freetype2/autofit/Jamfile b/src/libs/freetype2/autofit/Jamfile index e0bc1ab429..ce4f6d8d51 100644 --- a/src/libs/freetype2/autofit/Jamfile +++ b/src/libs/freetype2/autofit/Jamfile @@ -10,7 +10,7 @@ UseFreeTypeHeaders ; if $(FT2_MULTI) { - _sources = autofit afmodule afloader aflatin afhints afglobal afdummy afangles ; + _sources = afangles afglobal afhints aflatin afloader afmodule afdummy ; } else { diff --git a/src/libs/freetype2/autofit/afangles.c b/src/libs/freetype2/autofit/afangles.c index 10a8cff257..7411be72f3 100644 --- a/src/libs/freetype2/autofit/afangles.c +++ b/src/libs/freetype2/autofit/afangles.c @@ -1,8 +1,76 @@ +/***************************************************************************/ +/* */ +/* afangles.c */ +/* */ +/* Routines used to compute vector angles with limited accuracy */ +/* and very high speed. It also contains sorting routines (body). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #include "aftypes.h" + +/* + * a python script used to generate the following table + * + +import sys, math + +units = 256 +scale = units/math.pi +comma = "" + +print "" +print "table of arctan( 1/2^n ) for PI = " + repr( units / 65536.0 ) + " units" + +r = [-1] + range( 32 ) + +for n in r: + if n >= 0: + x = 1.0 / ( 2.0 ** n ) # tangent value + else: + x = 2.0 ** ( -n ) + + angle = math.atan( x ) # arctangent + angle2 = angle * scale # arctangent in FT_Angle units + + # determine which integer value for angle gives the best tangent + lo = int( angle2 ) + hi = lo + 1 + tlo = math.tan( lo / scale ) + thi = math.tan( hi / scale ) + + errlo = abs( tlo - x ) + errhi = abs( thi - x ) + + angle2 = hi + if errlo < errhi: + angle2 = lo + + if angle2 <= 0: + break + + sys.stdout.write( comma + repr( int( angle2 ) ) ) + comma = ", " + +* +* end of python script +*/ + + /* this table was generated for AF_ANGLE_PI = 256 */ #define AF_ANGLE_MAX_ITERS 8 -#define AF_TRIG_MAX_ITERS 9 +#define AF_TRIG_MAX_ITERS 8 static const FT_Fixed af_angle_arctan_table[9] = @@ -69,11 +137,11 @@ { x = -x; y = -y; - theta = 2 * AF_ANGLE_PI2; + theta = AF_ANGLE_PI; } if ( y > 0 ) - theta = - theta; + theta = -theta; arctanptr = af_angle_arctan_table; @@ -115,18 +183,20 @@ } } while ( ++i < AF_TRIG_MAX_ITERS ); +#if 0 /* round theta */ if ( theta >= 0 ) - theta = FT_PAD_ROUND( theta, 4 ); + theta = FT_PAD_ROUND( theta, 2 ); else - theta = - FT_PAD_ROUND( theta, 4 ); + theta = -FT_PAD_ROUND( -theta, 2 ); +#endif vec->x = x; vec->y = theta; } - /* documentation is in fttrigon.h */ + /* cf. documentation in fttrigon.h */ FT_LOCAL_DEF( AF_Angle ) af_angle_atan( FT_Fixed dx, @@ -147,13 +217,13 @@ } - FT_LOCAL_DEF( AF_Angle ) af_angle_diff( AF_Angle angle1, AF_Angle angle2 ) { AF_Angle delta = angle2 - angle1; + delta %= AF_ANGLE_2PI; if ( delta < 0 ) delta += AF_ANGLE_2PI; @@ -165,12 +235,9 @@ } - /* well, this needs to be somewhere, right :-) - */ - FT_LOCAL_DEF( void ) - af_sort_pos( FT_UInt count, - FT_Pos* table ) + af_sort_pos( FT_UInt count, + FT_Pos* table ) { FT_UInt i, j; FT_Pos swap; @@ -212,3 +279,47 @@ } } } + + +#ifdef TEST + +#include <stdio.h> +#include <math.h> + +int main( void ) +{ + int angle; + int dist; + + + for ( dist = 100; dist < 1000; dist++ ) + { + for ( angle = AF_ANGLE_PI; angle < AF_ANGLE_2PI * 4; angle++ ) + { + double a = ( angle * 3.1415926535 ) / ( 1.0 * AF_ANGLE_PI ); + int dx, dy, angle1, angle2, delta; + + + dx = dist * cos( a ); + dy = dist * sin( a ); + + angle1 = ( ( atan2( dy, dx ) * AF_ANGLE_PI ) / 3.1415926535 ); + angle2 = af_angle_atan( dx, dy ); + delta = ( angle2 - angle1 ) % AF_ANGLE_2PI; + if ( delta < 0 ) + delta = -delta; + + if ( delta >= 2 ) + { + printf( "dist:%4d angle:%4d => (%4d,%4d) angle1:%4d angle2:%4d\n", + dist, angle, dx, dy, angle1, angle2 ); + } + } + } + return 0; +} + +#endif /* TEST */ + + +/* END */ diff --git a/src/libs/freetype2/autofit/afangles.h b/src/libs/freetype2/autofit/afangles.h new file mode 100644 index 0000000000..f33f9e108e --- /dev/null +++ b/src/libs/freetype2/autofit/afangles.h @@ -0,0 +1,7 @@ +/* + * afangles.h + * + * This is a dummy file, used to please the build system. It is never + * included by the auto-fitter sources. + * + */ diff --git a/src/libs/freetype2/autofit/afdummy.c b/src/libs/freetype2/autofit/afdummy.c index bae5f70a32..ed96e96410 100644 --- a/src/libs/freetype2/autofit/afdummy.c +++ b/src/libs/freetype2/autofit/afdummy.c @@ -1,35 +1,62 @@ +/***************************************************************************/ +/* */ +/* afdummy.c */ +/* */ +/* Auto-fitter dummy routines to be used if no hinting should be */ +/* performed (body). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #include "afdummy.h" +#include "afhints.h" static FT_Error af_dummy_hints_init( AF_GlyphHints hints, - FT_Outline* outline, AF_ScriptMetrics metrics ) { - return af_glyph_hints_reset( hints, - &metrics->scaler, - metrics, - outline ); + af_glyph_hints_rescale( hints, + metrics ); + return 0; } + static FT_Error af_dummy_hints_apply( AF_GlyphHints hints, FT_Outline* outline ) { - af_glyph_hints_save( hints, outline ); + FT_UNUSED( hints ); + FT_UNUSED( outline ); + + return 0; } - FT_LOCAL_DEF( const AF_ScriptClassRec ) af_dummy_script_class = + FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec + af_dummy_script_class = { AF_SCRIPT_NONE, NULL, sizeof( AF_ScriptMetricsRec ), - (AF_Script_InitMetricsFunc) NULL, - (AF_Script_ScaleMetricsFunc) NULL, - (AF_Script_DoneMetricsFunc) NULL, - (AF_Script_InitHintsFunc) af_dummy_hints_init, - (AF_Script_ApplyHintsFunc) af_dummy_hints_apply + (AF_Script_InitMetricsFunc) NULL, + (AF_Script_ScaleMetricsFunc)NULL, + (AF_Script_DoneMetricsFunc) NULL, + + (AF_Script_InitHintsFunc) af_dummy_hints_init, + (AF_Script_ApplyHintsFunc) af_dummy_hints_apply }; + + +/* END */ diff --git a/src/libs/freetype2/autofit/afdummy.h b/src/libs/freetype2/autofit/afdummy.h index f4594c0f9f..2a5faf8f85 100644 --- a/src/libs/freetype2/autofit/afdummy.h +++ b/src/libs/freetype2/autofit/afdummy.h @@ -1,18 +1,43 @@ +/***************************************************************************/ +/* */ +/* afdummy.h */ +/* */ +/* Auto-fitter dummy routines to be used if no hinting should be */ +/* performed (specification). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #ifndef __AFDUMMY_H__ #define __AFDUMMY_H__ #include "aftypes.h" + FT_BEGIN_HEADER - /* a dummy script metrics class used when no hinting should - * be performed. This is the default for non-latin glyphs ! + /* A dummy script metrics class used when no hinting should + * be performed. This is the default for non-latin glyphs! */ - FT_LOCAL( const AF_ScriptClassRec ) af_dummy_script_class; + FT_CALLBACK_TABLE const AF_ScriptClassRec + af_dummy_script_class; /* */ FT_END_HEADER + #endif /* __AFDUMMY_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/autofit/aferrors.h b/src/libs/freetype2/autofit/aferrors.h new file mode 100644 index 0000000000..c2ed5fe2ab --- /dev/null +++ b/src/libs/freetype2/autofit/aferrors.h @@ -0,0 +1,40 @@ +/***************************************************************************/ +/* */ +/* aferrors.h */ +/* */ +/* Autofitter error codes (specification only). */ +/* */ +/* Copyright 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This file is used to define the Autofitter error enumeration */ + /* constants. */ + /* */ + /*************************************************************************/ + +#ifndef __AFERRORS_H__ +#define __AFERRORS_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERR_PREFIX AF_Err_ +#define FT_ERR_BASE FT_Mod_Err_Autofit + +#include FT_ERRORS_H + +#endif /* __AFERRORS_H__ */ + +/* END */ diff --git a/src/libs/freetype2/autofit/afglobal.c b/src/libs/freetype2/autofit/afglobal.c index cadc803473..e28673bb73 100644 --- a/src/libs/freetype2/autofit/afglobal.c +++ b/src/libs/freetype2/autofit/afglobal.c @@ -1,52 +1,71 @@ +/***************************************************************************/ +/* */ +/* afglobal.c */ +/* */ +/* Auto-fitter routines to compute global hinting values (body). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #include "afglobal.h" #include "afdummy.h" #include "aflatin.h" +#include "aferrors.h" - /* populate this list when you add new scripts - */ - static AF_ScriptClass const af_script_classes[] = + + /* populate this list when you add new scripts */ + static AF_ScriptClass const af_script_classes[] = { - & af_dummy_script_class, - & af_latin_script_class, + &af_dummy_script_class, + &af_latin_script_class, NULL /* do not remove */ }; -#define AF_SCRIPT_LIST_DEFAULT 0 /* index of default script in 'af_script_classes' */ -#define AF_SCRIPT_LIST_NONE 255 /* indicates an uncovered glyph */ + /* index of default script in `af_script_classes' */ +#define AF_SCRIPT_LIST_DEFAULT 1 + /* indicates an uncovered glyph */ +#define AF_SCRIPT_LIST_NONE 255 - /* - * note that glyph_scripts[] is used to map each glyph into - * an index into the 'af_script_classes' array. - * - */ - typedef struct AF_FaceGlobalsRec_ + + /* + * Note that glyph_scripts[] is used to map each glyph into + * an index into the `af_script_classes' array. + * + */ + typedef struct AF_FaceGlobalsRec_ { - FT_Face face; - FT_UInt glyph_count; /* same as face->num_glyphs */ - FT_Byte* glyph_scripts; + FT_Face face; + FT_UInt glyph_count; /* same as face->num_glyphs */ + FT_Byte* glyph_scripts; - AF_ScriptMetrics metrics[ AF_SCRIPT_MAX ]; + AF_ScriptMetrics metrics[AF_SCRIPT_MAX]; } AF_FaceGlobalsRec; + /* Compute the script index of each glyph within a given face. */ - - /* this function is used to compute the script index of each glyph - * within a given face - */ static FT_Error af_face_globals_compute_script_coverage( AF_FaceGlobals globals ) { - FT_Error error = 0; + FT_Error error = AF_Err_Ok; FT_Face face = globals->face; FT_CharMap old_charmap = face->charmap; FT_Byte* gscripts = globals->glyph_scripts; FT_UInt ss; - /* the value 255 means "uncovered glyph" - */ + + /* the value 255 means `uncovered glyph' */ FT_MEM_SET( globals->glyph_scripts, AF_SCRIPT_LIST_NONE, globals->glyph_count ); @@ -54,39 +73,43 @@ error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); if ( error ) { - /* ignore this error, we'll simply use Latin as the standard - * script. XXX: Shouldn't we rather disable hinting ?? + /* + * Ignore this error; we simply use Latin as the standard + * script. XXX: Shouldn't we rather disable hinting? */ - error = 0; + error = AF_Err_Ok; goto Exit; } - /* scan each script in a Unicode charmap - */ + /* scan each script in a Unicode charmap */ for ( ss = 0; af_script_classes[ss]; ss++ ) { AF_ScriptClass clazz = af_script_classes[ss]; AF_Script_UniRange range; + if ( clazz->script_uni_ranges == NULL ) continue; - /* scan all unicode points in the range, and set the corresponding - * glyph script index - */ + /* + * Scan all unicode points in the range and set the corresponding + * glyph script index. + */ for ( range = clazz->script_uni_ranges; range->first != 0; range++ ) { FT_ULong charcode = range->first; FT_UInt gindex; + gindex = FT_Get_Char_Index( face, charcode ); - if ( gindex != 0 && - gindex < globals->glyph_count && - gscripts[ gindex ] == AF_SCRIPT_LIST_NONE ) + if ( gindex != 0 && + gindex < globals->glyph_count && + gscripts[gindex] == AF_SCRIPT_LIST_NONE ) { - gscripts[ gindex ] = (FT_Byte) ss; + gscripts[gindex] = (FT_Byte)ss; } + for (;;) { charcode = FT_Get_Next_Char( face, charcode, &gindex ); @@ -94,26 +117,28 @@ if ( gindex == 0 || charcode > range->last ) break; - if ( gindex < globals->glyph_count && - gscripts[ gindex ] == AF_SCRIPT_LIST_NONE ) + if ( gindex < globals->glyph_count && + gscripts[gindex] == AF_SCRIPT_LIST_NONE ) { - gscripts[ gindex ] = (FT_Byte) ss; + gscripts[gindex] = (FT_Byte)ss; } } } } Exit: - /* by default, all uncovered glyphs are set to the latin script - * XXX: shouldnt' we disable hinting or do something similar ? - */ + /* + * By default, all uncovered glyphs are set to the latin script. + * XXX: Shouldnt' we disable hinting or do something similar? + */ { FT_UInt nn; + for ( nn = 0; nn < globals->glyph_count; nn++ ) { - if ( gscripts[ nn ] == AF_SCRIPT_LIST_NONE ) - gscripts[ nn ] = AF_SCRIPT_LIST_DEFAULT; + if ( gscripts[nn] == AF_SCRIPT_LIST_NONE ) + gscripts[nn] = AF_SCRIPT_LIST_DEFAULT; } } @@ -122,7 +147,6 @@ } - FT_LOCAL_DEF( FT_Error ) af_face_globals_new( FT_Face face, AF_FaceGlobals *aglobals ) @@ -131,14 +155,15 @@ FT_Memory memory; AF_FaceGlobals globals; + memory = face->memory; - if ( !FT_ALLOC( globals, sizeof(*globals) + - face->num_glyphs*sizeof(FT_Byte) ) ) + if ( !FT_ALLOC( globals, sizeof ( *globals ) + + face->num_glyphs * sizeof ( FT_Byte ) ) ) { globals->face = face; globals->glyph_count = face->num_glyphs; - globals->glyph_scripts = (FT_Byte*)( globals+1 ); + globals->glyph_scripts = (FT_Byte*)( globals + 1 ); error = af_face_globals_compute_script_coverage( globals ); if ( error ) @@ -161,12 +186,14 @@ FT_Memory memory = globals->face->memory; FT_UInt nn; + for ( nn = 0; nn < AF_SCRIPT_MAX; nn++ ) { if ( globals->metrics[nn] ) { AF_ScriptClass clazz = af_script_classes[nn]; + FT_ASSERT( globals->metrics[nn]->clazz == clazz ); if ( clazz->script_metrics_done ) @@ -177,8 +204,9 @@ } globals->glyph_count = 0; - globals->glyph_scripts = NULL; /* no need to free this one !! */ + globals->glyph_scripts = NULL; /* no need to free this one! */ globals->face = NULL; + FT_FREE( globals ); } } @@ -190,25 +218,26 @@ AF_ScriptMetrics *ametrics ) { AF_ScriptMetrics metrics = NULL; - FT_UInt index; + FT_UInt gidx; AF_ScriptClass clazz; - FT_Error error = 0; + FT_Error error = AF_Err_Ok; + if ( gindex >= globals->glyph_count ) { - error = FT_Err_Invalid_Argument; + error = AF_Err_Invalid_Argument; goto Exit; } - index = globals->glyph_scripts[ gindex ]; - clazz = af_script_classes[ index ]; - metrics = globals->metrics[ clazz->script ]; + gidx = globals->glyph_scripts[gindex]; + clazz = af_script_classes[gidx]; + metrics = globals->metrics[clazz->script]; if ( metrics == NULL ) { - /* create the global metrics object when needed - */ + /* create the global metrics object when needed */ FT_Memory memory = globals->face->memory; + if ( FT_ALLOC( metrics, clazz->script_metrics_size ) ) goto Exit; @@ -227,10 +256,14 @@ } } - globals->metrics[ clazz->script ] = metrics; + globals->metrics[clazz->script] = metrics; } Exit: *ametrics = metrics; + return error; } + + +/* END */ diff --git a/src/libs/freetype2/autofit/afglobal.h b/src/libs/freetype2/autofit/afglobal.h index 64f35c3fff..95a92512d5 100644 --- a/src/libs/freetype2/autofit/afglobal.h +++ b/src/libs/freetype2/autofit/afglobal.h @@ -1,24 +1,45 @@ +/***************************************************************************/ +/* */ +/* afglobal.h */ +/* */ +/* Auto-fitter routines to compute global hinting values */ +/* (specification). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #ifndef __AF_GLOBAL_H__ #define __AF_GLOBAL_H__ + #include "aftypes.h" + FT_BEGIN_HEADER - /**************************************************************************/ - /**************************************************************************/ - /***** *****/ - /***** F A C E G L O B A L S *****/ - /***** *****/ - /**************************************************************************/ - /**************************************************************************/ + + /************************************************************************/ + /************************************************************************/ + /***** *****/ + /***** F A C E G L O B A L S *****/ + /***** *****/ + /************************************************************************/ + /************************************************************************/ - /* - * models the global hints data for a given face, decomposed into - * script-specific items.. - * - */ + /* + * model the global hints data for a given face, decomposed into + * script-specific items + */ typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; @@ -36,6 +57,10 @@ FT_BEGIN_HEADER /* */ + FT_END_HEADER #endif /* __AF_GLOBALS_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/autofit/afhints.c b/src/libs/freetype2/autofit/afhints.c index d0dca1526f..a3095ee216 100644 --- a/src/libs/freetype2/autofit/afhints.c +++ b/src/libs/freetype2/autofit/afhints.c @@ -1,25 +1,154 @@ +/***************************************************************************/ +/* */ +/* afhints.c */ +/* */ +/* Auto-fitter hinting routines (body). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #include "afhints.h" +#include "aferrors.h" + + + FT_LOCAL_DEF( FT_Error ) + af_axis_hints_new_segment( AF_AxisHints axis, + FT_Memory memory, + AF_Segment *asegment ) + { + FT_Error error = AF_Err_Ok; + AF_Segment segment = NULL; + + + if ( axis->num_segments >= axis->max_segments ) + { + FT_Int old_max = axis->max_segments; + FT_Int new_max = old_max; + FT_Int big_max = FT_INT_MAX / sizeof ( *segment ); + + + if ( old_max >= big_max ) + { + error = AF_Err_Out_Of_Memory; + goto Exit; + } + + new_max += ( new_max >> 2 ) + 4; + if ( new_max < old_max || new_max > big_max ) + new_max = big_max; + + if ( FT_RENEW_ARRAY( axis->segments, old_max, new_max ) ) + goto Exit; + + axis->max_segments = new_max; + } + + segment = axis->segments + axis->num_segments++; + FT_ZERO( segment ); + + Exit: + *asegment = segment; + return error; + } + + + FT_LOCAL( FT_Error ) + af_axis_hints_new_edge( AF_AxisHints axis, + FT_Int fpos, + FT_Memory memory, + AF_Edge *aedge ) + { + FT_Error error = AF_Err_Ok; + AF_Edge edge = NULL; + AF_Edge edges; + + + if ( axis->num_edges >= axis->max_edges ) + { + FT_Int old_max = axis->max_edges; + FT_Int new_max = old_max; + FT_Int big_max = FT_INT_MAX / sizeof ( *edge ); + + + if ( old_max >= big_max ) + { + error = AF_Err_Out_Of_Memory; + goto Exit; + } + + new_max += ( new_max >> 2 ) + 4; + if ( new_max < old_max || new_max > big_max ) + new_max = big_max; + + if ( FT_RENEW_ARRAY( axis->edges, old_max, new_max ) ) + goto Exit; + + axis->max_edges = new_max; + } + + edges = axis->edges; + edge = edges + axis->num_edges; + + while ( edge > edges && edge[-1].fpos > fpos ) + { + edge[0] = edge[-1]; + edge--; + } + + axis->num_edges++; + + FT_ZERO( edge ); + edge->fpos = (FT_Short)fpos; + + Exit: + *aedge = edge; + return error; + } + #ifdef AF_DEBUG #include <stdio.h> - static const char* af_dir_str( AF_Direction dir ) + static const char* + af_dir_str( AF_Direction dir ) { const char* result; - switch (dir) + + switch ( dir ) { - case AF_DIR_UP: result = "up"; break; - case AF_DIR_DOWN: result = "down"; break; - case AF_DIR_LEFT: result = "left"; break; - case AF_DIR_RIGHT: result = "right"; break; - default: result = "none"; + case AF_DIR_UP: + result = "up"; + break; + case AF_DIR_DOWN: + result = "down"; + break; + case AF_DIR_LEFT: + result = "left"; + break; + case AF_DIR_RIGHT: + result = "right"; + break; + default: + result = "none"; } + return result; } -#define AF_INDEX_NUM(ptr,base) ( (ptr) ? ((ptr)-(base)) : -1 ) + +#define AF_INDEX_NUM( ptr, base ) ( (ptr) ? ( (ptr) - (base) ) : -1 ) + void af_glyph_hints_dump_points( AF_GlyphHints hints ) @@ -28,11 +157,15 @@ AF_Point limit = points + hints->num_points; AF_Point point; + printf( "Table of points:\n" ); - printf( " [ index | xorg | yorg | xscale | yscale | xfit | yfit | flags ]\n" ); + printf( " [ index | xorg | yorg | xscale | yscale " + "| xfit | yfit | flags ]\n" ); + for ( point = points; point < limit; point++ ) { - printf( " [ %5d | %5d | %5d | %-5.2f | %-5.2f | %-5.2f | %-5.2f | %c%c%c%c%c%c ]\n", + printf( " [ %5d | %5d | %5d | %-5.2f | %-5.2f " + "| %-5.2f | %-5.2f | %c%c%c%c%c%c ]\n", point - points, point->fx, point->fy, @@ -40,28 +173,28 @@ point->oy/64.0, point->x/64.0, point->y/64.0, - (point->flags & AF_FLAG_WEAK_INTERPOLATION) ? 'w' : ' ', - (point->flags & AF_FLAG_INFLECTION) ? 'i' : ' ', - (point->flags & AF_FLAG_EXTREMA_X) ? '<' : ' ', - (point->flags & AF_FLAG_EXTREMA_Y) ? 'v' : ' ', - (point->flags & AF_FLAG_ROUND_X) ? '(' : ' ', - (point->flags & AF_FLAG_ROUND_Y) ? 'u' : ' ' - ); + ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' ', + ( point->flags & AF_FLAG_INFLECTION ) ? 'i' : ' ', + ( point->flags & AF_FLAG_EXTREMA_X ) ? '<' : ' ', + ( point->flags & AF_FLAG_EXTREMA_Y ) ? 'v' : ' ', + ( point->flags & AF_FLAG_ROUND_X ) ? '(' : ' ', + ( point->flags & AF_FLAG_ROUND_Y ) ? 'u' : ' '); } printf( "\n" ); } - /* A function used to dump the array of linked segments */ + /* A function to dump the array of linked segments. */ void af_glyph_hints_dump_segments( AF_GlyphHints hints ) { - AF_Point points = hints->points; - FT_Int dimension; + AF_Point points = hints->points; + FT_Int dimension; + for ( dimension = 1; dimension >= 0; dimension-- ) { - AF_AxisHints axis = &hints->axis[dimension]; + AF_AxisHints axis = &hints->axis[dimension]; AF_Segment segments = axis->segments; AF_Segment limit = segments + axis->num_segments; AF_Segment seg; @@ -92,18 +225,21 @@ void af_glyph_hints_dump_edges( AF_GlyphHints hints ) { - FT_Int dimension; + FT_Int dimension; + for ( dimension = 1; dimension >= 0; dimension-- ) { - AF_AxisHints axis = &hints->axis[ dimension ]; + AF_AxisHints axis = &hints->axis[dimension]; AF_Edge edges = axis->edges; AF_Edge limit = edges + axis->num_edges; AF_Edge edge; - /* note: AF_DIMENSION_HORZ corresponds to _vertical_ edges - * since they have constant X coordinate - */ + + /* + * note: AF_DIMENSION_HORZ corresponds to _vertical_ edges + * since they have constant a X coordinate. + */ printf ( "Table of %s edges:\n", dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" ); printf ( " [ index | pos | dir | link |" @@ -111,7 +247,8 @@ for ( edge = edges; edge < limit; edge++ ) { - printf ( " [ %5d | %4d | %5s | %4d | %5d | %c | %5.2f | %5.2f ]\n", + printf ( " [ %5d | %4d | %5s | %4d |" + " %5d | %c | %5.2f | %5.2f ]\n", edge - edges, (int)edge->fpos, af_dir_str( edge->dir ), @@ -121,13 +258,10 @@ edge->opos / 64.0, edge->pos / 64.0 ); } - printf( "\n" ); } } - - #endif /* AF_DEBUG */ @@ -171,15 +305,15 @@ /* do each contour separately */ for ( ; contour < contour_limit; contour++ ) { - AF_Point point = contour[0]; - AF_Point first = point; - AF_Point start = point; - AF_Point end = point; - AF_Point before; - AF_Point after; - AF_Angle angle_in, angle_seg, angle_out; - AF_Angle diff_in, diff_out; - FT_Int finished = 0; + AF_Point point = contour[0]; + AF_Point first = point; + AF_Point start = point; + AF_Point end = point; + AF_Point before; + AF_Point after; + AF_Angle angle_in, angle_seg, angle_out; + AF_Angle diff_in, diff_out; + FT_Int finished = 0; /* compute first segment in contour */ @@ -268,7 +402,6 @@ } - FT_LOCAL_DEF( void ) af_glyph_hints_init( AF_GlyphHints hints, FT_Memory memory ) @@ -278,26 +411,31 @@ } - FT_LOCAL_DEF( void ) af_glyph_hints_done( AF_GlyphHints hints ) { if ( hints && hints->memory ) { - FT_Memory memory = hints->memory; - AF_Dimension dim; + FT_Memory memory = hints->memory; + int dim; - /* note that we don't need to free the segment and edge - * buffers, since they're really within the hints->points array - */ - for ( dim = 0; dim < 2; dim++ ) + + /* + * note that we don't need to free the segment and edge + * buffers, since they are really within the hints->points array + */ + for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { - AF_AxisHints axis = &hints->axis[ dim ]; + AF_AxisHints axis = &hints->axis[dim]; + axis->num_segments = 0; + axis->max_segments = 0; + FT_FREE( axis->segments ); + axis->num_edges = 0; - axis->segments = NULL; - axis->edges = NULL; + axis->max_edges = 0; + FT_FREE( axis->edges ); } FT_FREE( hints->contours ); @@ -313,42 +451,44 @@ } + FT_LOCAL_DEF( void ) + af_glyph_hints_rescale( AF_GlyphHints hints, + AF_ScriptMetrics metrics ) + { + hints->metrics = metrics; + } + FT_LOCAL_DEF( FT_Error ) - af_glyph_hints_reset( AF_GlyphHints hints, - AF_Scaler scaler, - AF_ScriptMetrics metrics, - FT_Outline* outline ) + af_glyph_hints_reload( AF_GlyphHints hints, + FT_Outline* outline ) { - FT_Error error = FT_Err_Ok; - AF_Point points; - FT_UInt old_max, new_max; - FT_Fixed x_scale = scaler->x_scale; - FT_Fixed y_scale = scaler->y_scale; - FT_Pos x_delta = scaler->x_delta; - FT_Pos y_delta = scaler->y_delta; - FT_Memory memory = hints->memory; + FT_Error error = AF_Err_Ok; + AF_Point points; + FT_UInt old_max, new_max; + AF_Scaler scaler = &hints->metrics->scaler; + FT_Fixed x_scale = hints->x_scale; + FT_Fixed y_scale = hints->y_scale; + FT_Pos x_delta = hints->x_delta; + FT_Pos y_delta = hints->y_delta; + FT_Memory memory = hints->memory; - hints->metrics = metrics; hints->scaler_flags = scaler->flags; - hints->other_flags = 0; - - hints->num_points = 0; - hints->num_contours = 0; + hints->num_points = 0; + hints->num_contours = 0; hints->axis[0].num_segments = 0; hints->axis[0].num_edges = 0; hints->axis[1].num_segments = 0; hints->axis[1].num_edges = 0; - /* first of all, reallocate the contours array when necessary - */ - new_max = (FT_UInt) outline->n_contours; + /* first of all, reallocate the contours array when necessary */ + new_max = (FT_UInt)outline->n_contours; old_max = hints->max_contours; if ( new_max > old_max ) { - new_max = (new_max + 3) & ~3; + new_max = ( new_max + 3 ) & ~3; if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) ) goto Exit; @@ -356,78 +496,37 @@ hints->max_contours = new_max; } - /* then, reallocate the points, segments & edges arrays if needed -- - * note that we reserved two additional point positions, used to - * hint metrics appropriately - */ + /* + * then reallocate the points arrays if necessary -- + * note that we reserve two additional point positions, used to + * hint metrics appropriately + */ new_max = (FT_UInt)( outline->n_points + 2 ); old_max = hints->max_points; if ( new_max > old_max ) { - FT_Byte* items; - FT_ULong off1, off2, off3; - - /* we store in a single buffer the following arrays: - * - * - an array of N AF_PointRec items - * - an array of 2*N AF_SegmentRec items - * - an array of 2*N AF_EdgeRec items - * - */ - new_max = ( new_max + 2 + 7 ) & ~7; -#define OFF_PAD2(x,y) (((x)+(y)-1) & ~((y)-1)) -#define OFF_PADX(x,y) ((((x)+(y)-1)/(y))*(y)) -#define OFF_PAD(x,y) ( ((y) & ((y)-1)) ? OFF_PADX(x,y) : OFF_PAD2(x,y) ) - -#undef OFF_INCREMENT -#define OFF_INCREMENT( _off, _type, _count ) \ - ( OFF_PAD( _off, sizeof(_type) ) + (_count)*sizeof(_type)) - - off1 = OFF_INCREMENT( 0, AF_PointRec, new_max ); - off2 = OFF_INCREMENT( off1, AF_SegmentRec, new_max*2 ); - off3 = OFF_INCREMENT( off2, AF_EdgeRec, new_max*2 ); - - FT_FREE( hints->points ); - - if ( FT_ALLOC( items, off3 ) ) - { - hints->max_points = 0; - hints->axis[0].segments = NULL; - hints->axis[0].edges = NULL; - hints->axis[1].segments = NULL; - hints->axis[1].edges = NULL; + if ( FT_RENEW_ARRAY( hints->points, old_max, new_max ) ) goto Exit; - } - /* readjust some pointers - */ - hints->max_points = new_max; - hints->points = (AF_Point) items; - - hints->axis[0].segments = (AF_Segment)( items + off1 ); - hints->axis[1].segments = hints->axis[0].segments + new_max; - - hints->axis[0].edges = (AF_Edge) ( items + off2 ); - hints->axis[1].edges = hints->axis[0].edges + new_max; + hints->max_points = new_max; } hints->num_points = outline->n_points; hints->num_contours = outline->n_contours; - - /* We can't rely on the value of `FT_Outline.flags' to know the fill */ - /* direction used for a glyph, given that some fonts are broken (e.g. */ - /* the Arphic ones). We thus recompute it each time we need to. */ - /* */ - hints->axis[ AF_DIMENSION_HORZ ].major_dir = AF_DIR_UP; - hints->axis[ AF_DIMENSION_VERT ].major_dir = AF_DIR_LEFT; + /* We can't rely on the value of `FT_Outline.flags' to know the fill */ + /* direction used for a glyph, given that some fonts are broken (e.g., */ + /* the Arphic ones). We thus recompute it each time we need to. */ + /* */ + hints->axis[AF_DIMENSION_HORZ].major_dir = AF_DIR_UP; + hints->axis[AF_DIMENSION_VERT].major_dir = AF_DIR_LEFT; if ( FT_Outline_Get_Orientation( outline ) == FT_ORIENTATION_POSTSCRIPT ) { - hints->axis[ AF_DIMENSION_HORZ ].major_dir = AF_DIR_DOWN; - hints->axis[ AF_DIMENSION_VERT ].major_dir = AF_DIR_RIGHT; + hints->axis[AF_DIMENSION_HORZ].major_dir = AF_DIR_DOWN; + hints->axis[AF_DIMENSION_VERT].major_dir = AF_DIR_RIGHT; } hints->x_scale = x_scale; @@ -444,7 +543,7 @@ AF_Point point_limit = points + hints->num_points; - /* compute coordinates & bezier flags */ + /* compute coordinates & Bezier flags */ { FT_Vector* vec = outline->points; char* tag = outline->tags; @@ -452,8 +551,8 @@ for ( point = points; point < point_limit; point++, vec++, tag++ ) { - point->fx = vec->x; - point->fy = vec->y; + point->fx = (FT_Short)vec->x; + point->fy = (FT_Short)vec->y; point->ox = point->x = FT_MulFix( vec->x, x_scale ) + x_delta; point->oy = point->y = FT_MulFix( vec->y, y_scale ) + y_delta; @@ -467,7 +566,6 @@ break; default: point->flags = 0; - ; } } } @@ -527,22 +625,22 @@ { for ( point = points; point < point_limit; point++ ) { - AF_Point prev; - AF_Point next; - FT_Pos in_x, in_y, out_x, out_y; + AF_Point prev; + AF_Point next; + FT_Pos in_x, in_y, out_x, out_y; prev = point->prev; in_x = point->fx - prev->fx; in_y = point->fy - prev->fy; - point->in_dir = af_direction_compute( in_x, in_y ); + point->in_dir = (FT_Char)af_direction_compute( in_x, in_y ); next = point->next; out_x = next->fx - point->fx; out_y = next->fy - point->fy; - point->out_dir = af_direction_compute( out_x, out_y ); + point->out_dir = (FT_Char)af_direction_compute( out_x, out_y ); if ( point->flags & ( AF_FLAG_CONIC | AF_FLAG_CUBIC ) ) { @@ -570,8 +668,7 @@ } } - /* compute inflection points - */ + /* compute inflection points */ af_glyph_hints_compute_inflections( hints ); Exit: @@ -580,18 +677,19 @@ FT_LOCAL_DEF( void ) - af_glyph_hints_save( AF_GlyphHints hints, - FT_Outline* outline ) + af_glyph_hints_save( AF_GlyphHints hints, + FT_Outline* outline ) { AF_Point point = hints->points; AF_Point limit = point + hints->num_points; FT_Vector* vec = outline->points; char* tag = outline->tags; + for ( ; point < limit; point++, vec++, tag++ ) { - vec->x = (FT_Pos) point->x; - vec->y = (FT_Pos) point->y; + vec->x = point->x; + vec->y = point->y; if ( point->flags & AF_FLAG_CONIC ) tag[0] = FT_CURVE_TAG_CONIC; @@ -603,22 +701,23 @@ } - /* - * - * E D G E P O I N T G R I D - F I T T I N G - * - */ + /**************************************************************** + * + * EDGE POINT GRID-FITTING + * + ****************************************************************/ FT_LOCAL_DEF( void ) af_glyph_hints_align_edge_points( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = & hints->axis[ dim ]; + AF_AxisHints axis = & hints->axis[dim]; AF_Edge edges = axis->edges; AF_Edge edge_limit = edges + axis->num_edges; AF_Edge edge; + for ( edge = edges; edge < edge_limit; edge++ ) { /* move the points of each segment */ @@ -657,15 +756,16 @@ } - /* - * - * S T R O N G P O I N T I N T E R P O L A T I O N - * - */ + /**************************************************************** + * + * STRONG POINT INTERPOLATION + * + ****************************************************************/ /* hint the strong points -- this is equivalent to the TrueType `IP' */ /* hinting instruction */ + FT_LOCAL_DEF( void ) af_glyph_hints_align_strong_points( AF_GlyphHints hints, AF_Dimension dim ) @@ -688,6 +788,7 @@ AF_Point point; AF_Edge edge; + for ( point = points; point < point_limit; point++ ) { FT_Pos u, ou, fu; /* point position */ @@ -697,8 +798,9 @@ if ( point->flags & touch_flag ) continue; - /* if this point is candidate to weak interpolation, we will */ + /* if this point is candidate to weak interpolation, we */ /* interpolate it after all strong points have been processed */ + if ( ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) && !( point->flags & AF_FLAG_INFLECTION ) ) continue; @@ -776,9 +878,7 @@ } } - Store_Point: - /* save the point position */ if ( dim == AF_DIMENSION_HORZ ) point->x = u; @@ -791,11 +891,12 @@ } - /* - * - * W E A K P O I N T I N T E R P O L A T I O N - * - */ + /**************************************************************** + * + * WEAK POINT INTERPOLATION + * + ****************************************************************/ + static void af_iup_shift( AF_Point p1, @@ -886,14 +987,14 @@ af_glyph_hints_align_weak_points( AF_GlyphHints hints, AF_Dimension dim ) { - AF_Point points = hints->points; - AF_Point point_limit = points + hints->num_points; - AF_Point* contour = hints->contours; - AF_Point* contour_limit = contour + hints->num_contours; - AF_Flags touch_flag; - AF_Point point; - AF_Point end_point; - AF_Point first_point; + AF_Point points = hints->points; + AF_Point point_limit = points + hints->num_points; + AF_Point* contour = hints->contours; + AF_Point* contour_limit = contour + hints->num_contours; + AF_Flags touch_flag; + AF_Point point; + AF_Point end_point; + AF_Point first_point; /* PASS 1: Move segment points to edge positions */ @@ -919,7 +1020,7 @@ } } - point = points; + point = points; for ( ; contour < contour_limit; contour++ ) { @@ -984,3 +1085,6 @@ point->y = point->u; } } + + +/* END */ diff --git a/src/libs/freetype2/autofit/afhints.h b/src/libs/freetype2/autofit/afhints.h index c69cdc66c6..6f1a8a59a9 100644 --- a/src/libs/freetype2/autofit/afhints.h +++ b/src/libs/freetype2/autofit/afhints.h @@ -1,20 +1,40 @@ +/***************************************************************************/ +/* */ +/* afhints.h */ +/* */ +/* Auto-fitter hinting routines (specification). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #ifndef __AFHINTS_H__ #define __AFHINTS_H__ #include "aftypes.h" + FT_BEGIN_HEADER /* - * The definition of outline glyph hints. These are shared by all - * script analysis routines (until now) - * + * The definition of outline glyph hints. These are shared by all + * script analysis routines (until now). */ typedef enum { - AF_DIMENSION_HORZ = 0, /* x coordinates, i.e. vertical segments & edges */ - AF_DIMENSION_VERT = 1, /* y coordinates, i.e. horizontal segments & edges */ + AF_DIMENSION_HORZ = 0, /* x coordinates, */ + /* i.e., vertical segments & edges */ + AF_DIMENSION_VERT = 1, /* y coordinates, */ + /* i.e., horizontal segments & edges */ AF_DIMENSION_MAX /* do not remove */ @@ -22,7 +42,7 @@ FT_BEGIN_HEADER /* hint directions -- the values are computed so that two vectors are */ - /* in opposite directions iff `dir1+dir2 == 0' */ + /* in opposite directions iff `dir1 + dir2 == 0' */ typedef enum { AF_DIR_NONE = 4, @@ -37,30 +57,30 @@ FT_BEGIN_HEADER /* point hint flags */ typedef enum { - AF_FLAG_NONE = 0, + AF_FLAG_NONE = 0, - /* point type flags */ - AF_FLAG_CONIC = (1 << 0), - AF_FLAG_CUBIC = (1 << 1), + /* point type flags */ + AF_FLAG_CONIC = 1 << 0, + AF_FLAG_CUBIC = 1 << 1, AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC, - /* point extremum flags */ - AF_FLAG_EXTREMA_X = (1 << 2), - AF_FLAG_EXTREMA_Y = (1 << 3), + /* point extremum flags */ + AF_FLAG_EXTREMA_X = 1 << 2, + AF_FLAG_EXTREMA_Y = 1 << 3, - /* point roundness flags */ - AF_FLAG_ROUND_X = (1 << 4), - AF_FLAG_ROUND_Y = (1 << 5), + /* point roundness flags */ + AF_FLAG_ROUND_X = 1 << 4, + AF_FLAG_ROUND_Y = 1 << 5, - /* point touch flags */ - AF_FLAG_TOUCH_X = (1 << 6), - AF_FLAG_TOUCH_Y = (1 << 7), + /* point touch flags */ + AF_FLAG_TOUCH_X = 1 << 6, + AF_FLAG_TOUCH_Y = 1 << 7, - /* candidates for weak interpolation have this flag set */ - AF_FLAG_WEAK_INTERPOLATION = (1 << 8), + /* candidates for weak interpolation have this flag set */ + AF_FLAG_WEAK_INTERPOLATION = 1 << 8, - /* all inflection points in the outline have this flag set */ - AF_FLAG_INFLECTION = (1 << 9) + /* all inflection points in the outline have this flag set */ + AF_FLAG_INFLECTION = 1 << 9 } AF_Flags; @@ -69,14 +89,13 @@ FT_BEGIN_HEADER typedef enum { AF_EDGE_NORMAL = 0, - AF_EDGE_ROUND = (1 << 0), - AF_EDGE_SERIF = (1 << 1), - AF_EDGE_DONE = (1 << 2) + AF_EDGE_ROUND = 1 << 0, + AF_EDGE_SERIF = 1 << 1, + AF_EDGE_DONE = 1 << 2 } AF_Edge_Flags; - typedef struct AF_PointRec_* AF_Point; typedef struct AF_SegmentRec_* AF_Segment; typedef struct AF_EdgeRec_* AF_Edge; @@ -84,73 +103,75 @@ FT_BEGIN_HEADER typedef struct AF_PointRec_ { - AF_Flags flags; /* point flags used by hinter */ - FT_Pos ox, oy; /* original, scaled position */ - FT_Pos fx, fy; /* original, unscaled position (font units) */ - FT_Pos x, y; /* current position */ - FT_Pos u, v; /* current (x,y) or (y,x) depending on context */ + FT_UShort flags; /* point flags used by hinter */ + FT_Char in_dir; /* direction of inwards vector */ + FT_Char out_dir; /* direction of outwards vector */ - AF_Direction in_dir; /* direction of inwards vector */ - AF_Direction out_dir; /* direction of outwards vector */ + FT_Pos ox, oy; /* original, scaled position */ + FT_Short fx, fy; /* original, unscaled position (font units) */ + FT_Pos x, y; /* current position */ + FT_Pos u, v; /* current (x,y) or (y,x) depending on context */ - AF_Point next; /* next point in contour */ - AF_Point prev; /* previous point in contour */ + AF_Point next; /* next point in contour */ + AF_Point prev; /* previous point in contour */ } AF_PointRec; typedef struct AF_SegmentRec_ { - AF_Edge_Flags flags; /* edge/segment flags for this segment */ - AF_Direction dir; /* segment direction */ - FT_Pos pos; /* position of segment */ - FT_Pos min_coord; /* minimum coordinate of segment */ - FT_Pos max_coord; /* maximum coordinate of segment */ + FT_Byte flags; /* edge/segment flags for this segment */ + FT_Char dir; /* segment direction */ + FT_Short pos; /* position of segment */ + FT_Short min_coord; /* minimum coordinate of segment */ + FT_Short max_coord; /* maximum coordinate of segment */ - AF_Edge edge; /* the segment's parent edge */ - AF_Segment edge_next; /* link to next segment in parent edge */ + AF_Edge edge; /* the segment's parent edge */ + AF_Segment edge_next; /* link to next segment in parent edge */ - AF_Segment link; /* (stem) link segment */ - AF_Segment serif; /* primary segment for serifs */ - FT_Pos num_linked; /* number of linked segments */ - FT_Pos score; /* used during stem matching */ + AF_Segment link; /* (stem) link segment */ + AF_Segment serif; /* primary segment for serifs */ + FT_Pos num_linked; /* number of linked segments */ + FT_Pos score; /* used during stem matching */ - AF_Point first; /* first point in edge segment */ - AF_Point last; /* last point in edge segment */ - AF_Point* contour; /* ptr to first point of segment's contour */ + AF_Point first; /* first point in edge segment */ + AF_Point last; /* last point in edge segment */ + AF_Point* contour; /* ptr to first point of segment's contour */ } AF_SegmentRec; typedef struct AF_EdgeRec_ { - FT_Pos fpos; /* original, unscaled position (font units) */ - FT_Pos opos; /* original, scaled position */ - FT_Pos pos; /* current position */ + FT_Short fpos; /* original, unscaled position (font units) */ + FT_Pos opos; /* original, scaled position */ + FT_Pos pos; /* current position */ - AF_Edge_Flags flags; /* edge flags */ - AF_Direction dir; /* edge direction */ - FT_Fixed scale; /* used to speed up interpolation between edges */ - AF_Width blue_edge; /* non-NULL if this is a blue edge */ + FT_Byte flags; /* edge flags */ + FT_Char dir; /* edge direction */ + FT_Fixed scale; /* used to speed up interpolation between edges */ + AF_Width blue_edge; /* non-NULL if this is a blue edge */ - AF_Edge link; - AF_Edge serif; - FT_Int num_linked; + AF_Edge link; + AF_Edge serif; + FT_Short num_linked; - FT_Int score; + FT_Int score; - AF_Segment first; - AF_Segment last; + AF_Segment first; + AF_Segment last; } AF_EdgeRec; - typedef struct AF_AxisHintsRec_ + typedef struct AF_AxisHintsRec_ { FT_Int num_segments; + FT_Int max_segments; AF_Segment segments; FT_Int num_edges; + FT_Int max_edges; AF_Edge edges; AF_Direction major_dir; @@ -158,46 +179,47 @@ FT_BEGIN_HEADER } AF_AxisHintsRec, *AF_AxisHints; - typedef struct AF_GlyphHintsRec_ + typedef struct AF_GlyphHintsRec_ { - FT_Memory memory; + FT_Memory memory; - FT_Fixed x_scale; - FT_Pos x_delta; + FT_Fixed x_scale; + FT_Pos x_delta; - FT_Fixed y_scale; - FT_Pos y_delta; + FT_Fixed y_scale; + FT_Pos y_delta; - FT_Pos edge_distance_threshold; + FT_Pos edge_distance_threshold; - FT_Int max_points; - FT_Int num_points; - AF_Point points; + FT_Int max_points; + FT_Int num_points; + AF_Point points; - FT_Int max_contours; - FT_Int num_contours; - AF_Point* contours; + FT_Int max_contours; + FT_Int num_contours; + AF_Point* contours; - AF_AxisHintsRec axis[ AF_DIMENSION_MAX ]; - - FT_UInt32 scaler_flags; /* copy of scaler flags */ - FT_UInt32 other_flags; /* free for script-specific implementations */ + AF_AxisHintsRec axis[AF_DIMENSION_MAX]; + + FT_UInt32 scaler_flags; /* copy of scaler flags */ + FT_UInt32 other_flags; /* free for script-specific */ + /* implementations */ AF_ScriptMetrics metrics; } AF_GlyphHintsRec; -#define AF_HINTS_TEST_SCALER(h,f) ( (h)->scaler_flags & (f) ) -#define AF_HINTS_TEST_OTHER(h,f) ( (h)->other_flags & (f) ) +#define AF_HINTS_TEST_SCALER( h, f ) ( (h)->scaler_flags & (f) ) +#define AF_HINTS_TEST_OTHER( h, f ) ( (h)->other_flags & (f) ) -#define AF_HINTS_DO_HORIZONTAL(h) \ - !AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_HORIZONTAL) +#define AF_HINTS_DO_HORIZONTAL( h ) \ + !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) -#define AF_HINTS_DO_VERTICAL(h) \ - !AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_VERTICAL) +#define AF_HINTS_DO_VERTICAL( h ) \ + !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_VERTICAL ) -#define AF_HINTS_DO_ADVANCE(h) \ - !AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_ADVANCE) +#define AF_HINTS_DO_ADVANCE( h ) \ + !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_ADVANCE ) FT_LOCAL( AF_Direction ) @@ -205,24 +227,38 @@ FT_BEGIN_HEADER FT_Pos dy ); + FT_LOCAL( FT_Error ) + af_axis_hints_new_segment( AF_AxisHints axis, + FT_Memory memory, + AF_Segment *asegment ); + + FT_LOCAL( FT_Error) + af_axis_hints_new_edge( AF_AxisHints axis, + FT_Int fpos, + FT_Memory memory, + AF_Edge *edge ); + FT_LOCAL( void ) af_glyph_hints_init( AF_GlyphHints hints, FT_Memory memory ); - /* recomputes all AF_Point in a AF_GlyphHints from the definitions - * in a source outline - */ + /* + * recompute all AF_Point in a AF_GlyphHints from the definitions + * in a source outline + */ + FT_LOCAL( void ) + af_glyph_hints_rescale( AF_GlyphHints hints, + AF_ScriptMetrics metrics ); + FT_LOCAL( FT_Error ) - af_glyph_hints_reset( AF_GlyphHints hints, - AF_Scaler scaler, - AF_ScriptMetrics metrics, - FT_Outline* outline ); + af_glyph_hints_reload( AF_GlyphHints hints, + FT_Outline* outline ); FT_LOCAL( void ) - af_glyph_hints_save( AF_GlyphHints hints, - FT_Outline* outline ); + af_glyph_hints_save( AF_GlyphHints hints, + FT_Outline* outline ); FT_LOCAL( void ) af_glyph_hints_align_edge_points( AF_GlyphHints hints, @@ -241,6 +277,10 @@ FT_BEGIN_HEADER /* */ + FT_END_HEADER #endif /* __AFHINTS_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/autofit/aflatin.c b/src/libs/freetype2/autofit/aflatin.c index 9a20110fbb..35dfe2932d 100644 --- a/src/libs/freetype2/autofit/aflatin.c +++ b/src/libs/freetype2/autofit/aflatin.c @@ -1,12 +1,32 @@ -#include "aflatin.h" +/***************************************************************************/ +/* */ +/* aflatin.c */ +/* */ +/* Auto-fitter hinting routines for latin script (body). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** L A T I N G L O B A L M E T R I C S *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + +#include "aflatin.h" +#include "aferrors.h" + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** L A T I N G L O B A L M E T R I C S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ static void af_latin_metrics_init_widths( AF_LatinMetrics metrics, @@ -15,17 +35,19 @@ /* scan the array of segments in each direction */ AF_GlyphHintsRec hints[1]; + af_glyph_hints_init( hints, face->memory ); - metrics->axis[ AF_DIMENSION_HORZ ].width_count = 0; - metrics->axis[ AF_DIMENSION_VERT ].width_count = 0; + metrics->axis[AF_DIMENSION_HORZ].width_count = 0; + metrics->axis[AF_DIMENSION_VERT].width_count = 0; - /* For now, compute the standard width and height from the `o' */ + /* For now, compute the standard width and height from the `o'. */ { - FT_Error error; - FT_UInt glyph_index; - AF_Dimension dim; - AF_ScalerRec scaler[1]; + FT_Error error; + FT_UInt glyph_index; + int dim; + AF_ScriptMetricsRec dummy[1]; + AF_Scaler scaler = &dummy->scaler; glyph_index = FT_Get_Char_Index( face, 'o' ); @@ -36,28 +58,37 @@ if ( error || face->glyph->outline.n_points <= 0 ) goto Exit; + FT_ZERO( dummy ); + scaler->x_scale = scaler->y_scale = 0x10000L; scaler->x_delta = scaler->y_delta = 0; scaler->face = face; - scaler->render_mode = 0; + scaler->render_mode = FT_RENDER_MODE_NORMAL; scaler->flags = 0; - error = af_glyph_hints_reset( hints, scaler, - (AF_ScriptMetrics) metrics, - &face->glyph->outline ); + af_glyph_hints_rescale( hints, dummy ); + + error = af_glyph_hints_reload( hints, &face->glyph->outline ); if ( error ) goto Exit; for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { - AF_LatinAxis axis = & metrics->axis[ dim ]; - AF_AxisHints axhints = & hints->axis[ dim ]; + AF_LatinAxis axis = &metrics->axis[dim]; + AF_AxisHints axhints = &hints->axis[dim]; AF_Segment seg, limit, link; - FT_UInt num_widths = 0; + + FT_UInt num_widths = 0; FT_Pos edge_distance_threshold = 32000; - af_latin_hints_compute_segments( hints, dim ); - af_latin_hints_link_segments ( hints, dim ); + + error = af_latin_hints_compute_segments( hints, + (AF_Dimension)dim ); + if ( error ) + goto Exit; + + af_latin_hints_link_segments( hints, + (AF_Dimension)dim ); seg = axhints->segments; limit = seg + axhints->num_segments; @@ -65,6 +96,7 @@ for ( ; seg < limit; seg++ ) { link = seg->link; + /* we only consider stem segments there! */ if ( link && link->link == seg && link > seg ) { @@ -88,7 +120,7 @@ edge_distance_threshold = axis->widths[0].org; /* Now, compute the edge distance threshold as a fraction of the */ - /* smallest width in the font. Set it in `hinter->glyph' too! */ + /* smallest width in the font. Set it in `hinter->glyph' too! */ if ( edge_distance_threshold == 32000 ) edge_distance_threshold = 50; @@ -106,7 +138,7 @@ #define AF_LATIN_MAX_TEST_CHARACTERS 12 - static const char* const af_latin_blue_chars[ AF_LATIN_MAX_BLUES ] = + static const char* const af_latin_blue_chars[AF_LATIN_MAX_BLUES] = { "THEZOCQS", "HEZLOCUS", @@ -121,16 +153,17 @@ af_latin_metrics_init_blues( AF_LatinMetrics metrics, FT_Face face ) { - FT_Pos flats [ AF_LATIN_MAX_TEST_CHARACTERS ]; - FT_Pos rounds[ AF_LATIN_MAX_TEST_CHARACTERS ]; + FT_Pos flats [AF_LATIN_MAX_TEST_CHARACTERS]; + FT_Pos rounds[AF_LATIN_MAX_TEST_CHARACTERS]; FT_Int num_flats; FT_Int num_rounds; FT_Int bb; AF_LatinBlue blue; FT_Error error; - AF_LatinAxis axis = &metrics->axis[ AF_DIMENSION_VERT ]; + AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT]; FT_GlyphSlot glyph = face->glyph; + /* we compute the blues simply by loading each character from the */ /* 'af_latin_blue_chars[blues]' string, then compute its top-most or */ /* bottom-most points (depending on `AF_IS_TOP_BLUE') */ @@ -145,6 +178,7 @@ FT_Pos* blue_ref; FT_Pos* blue_shoot; + AF_LOG(( "blue %3d: ", bb )); num_flats = 0; @@ -271,10 +305,11 @@ if ( num_flats == 0 && num_rounds == 0 ) { - /* we couldn't find a single glyph to compute this blue zone, - * we will simply ignore it then - */ - AF_LOG(( "empty !!\n" )); + /* + * we couldn't find a single glyph to compute this blue zone, + * we will simply ignore it then + */ + AF_LOG(( "empty!\n" )); continue; } @@ -284,15 +319,15 @@ af_sort_pos( num_rounds, rounds ); af_sort_pos( num_flats, flats ); - blue = & axis->blues[ axis->blue_count ]; + blue = & axis->blues[axis->blue_count]; blue_ref = & blue->ref.org; blue_shoot = & blue->shoot.org; - axis->blue_count ++; + axis->blue_count++; if ( num_flats == 0 ) { - *blue_ref = + *blue_ref = *blue_shoot = rounds[num_rounds / 2]; } else if ( num_rounds == 0 ) @@ -321,9 +356,17 @@ } blue->flags = 0; - if ( AF_LATIN_IS_TOP_BLUE(bb) ) + if ( AF_LATIN_IS_TOP_BLUE( bb ) ) blue->flags |= AF_LATIN_BLUE_TOP; + /* + * The following flags is used later to adjust the y and x scales + * in order to optimize the pixel grid alignment of the top of small + * letters. + */ + if ( bb == AF_LATIN_BLUE_SMALL_TOP ) + blue->flags |= AF_LATIN_BLUE_ADJUSTMENT; + AF_LOG(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot )); } @@ -335,34 +378,52 @@ af_latin_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { - FT_Error error; - FT_CharMap oldmap = face->charmap; + FT_Error error = AF_Err_Ok; + FT_CharMap oldmap = face->charmap; + FT_UInt ee; + + static const FT_Encoding latin_encodings[] = + { + FT_ENCODING_UNICODE, + FT_ENCODING_APPLE_ROMAN, + FT_ENCODING_ADOBE_STANDARD, + FT_ENCODING_ADOBE_LATIN_1, + FT_ENCODING_NONE /* end of list */ + }; - /* do we have a Unicode charmap in there? */ - error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); - if ( error ) goto Exit; metrics->units_per_em = face->units_per_EM; - af_latin_metrics_init_widths( metrics, face ); - af_latin_metrics_init_blues( metrics, face ); + /* do we have a latin charmap in there? */ + for ( ee = 0; latin_encodings[ee] != FT_ENCODING_NONE; ee++ ) + { + error = FT_Select_Charmap( face, latin_encodings[ee] ); + if ( !error ) + break; + } + + if ( !error ) + { + af_latin_metrics_init_widths( metrics, face ); + af_latin_metrics_init_blues( metrics, face ); + } - Exit: FT_Set_Charmap( face, oldmap ); - return error; + return AF_Err_Ok; } static void - af_latin_metrics_scale_dim( AF_LatinMetrics metrics, - AF_Scaler scaler, - AF_Dimension dim ) + af_latin_metrics_scale_dim( AF_LatinMetrics metrics, + AF_Scaler scaler, + AF_Dimension dim ) { FT_Fixed scale; FT_Pos delta; AF_LatinAxis axis; FT_UInt nn; + if ( dim == AF_DIMENSION_HORZ ) { scale = scaler->x_scale; @@ -374,7 +435,7 @@ delta = scaler->y_delta; } - axis = & metrics->axis[ dim ]; + axis = &metrics->axis[dim]; if ( axis->org_scale == scale && axis->org_delta == delta ) return; @@ -382,8 +443,45 @@ axis->org_scale = scale; axis->org_delta = delta; - /* XXX: TODO: Correct Y and X scale according to Chester rules - */ + /* + * correct X and Y scale to optimize the alignment of the top of small + * letters to the pixel grid + */ + { + AF_LatinAxis Axis = &metrics->axis[AF_DIMENSION_VERT]; + AF_LatinBlue blue = NULL; + + + for ( nn = 0; nn < Axis->blue_count; nn++ ) + { + if ( Axis->blues[nn].flags & AF_LATIN_BLUE_ADJUSTMENT ) + { + blue = &Axis->blues[nn]; + break; + } + } + + if ( blue ) + { + FT_Pos scaled = FT_MulFix( blue->shoot.org, scaler->y_scale ); + FT_Pos fitted = FT_PIX_ROUND( scaled ); + + + if ( scaled != fitted ) + { + if ( dim == AF_DIMENSION_HORZ ) + { + if ( fitted < scaled ) + scale -= scale/50; /* x_scale = x_scale*0.98 */ + } + else + { + scale = FT_MulDiv( scale, fitted, scaled ); + } + } + } + } + axis->scale = scale; axis->delta = delta; @@ -398,36 +496,60 @@ metrics->root.scaler.y_delta = delta; } - /* scale the standard widths - */ + /* scale the standard widths */ for ( nn = 0; nn < axis->width_count; nn++ ) { AF_Width width = axis->widths + nn; + width->cur = FT_MulFix( width->org, scale ); width->fit = width->cur; } if ( dim == AF_DIMENSION_VERT ) { - /* scale the blue zones - */ + /* scale the blue zones */ for ( nn = 0; nn < axis->blue_count; nn++ ) { - AF_LatinBlue blue = & axis->blues[nn]; + AF_LatinBlue blue = &axis->blues[nn]; FT_Pos dist; - blue->ref.cur = FT_MulFix( blue->ref.org, scale ) + delta; - blue->ref.fit = blue->ref.cur; + blue->ref.cur = FT_MulFix( blue->ref.org, scale ) + delta; + blue->ref.fit = blue->ref.cur; blue->shoot.cur = FT_MulFix( blue->shoot.org, scale ) + delta; blue->shoot.fit = blue->shoot.cur; + blue->flags &= ~AF_LATIN_BLUE_ACTIVE; - /* a blue zone is only active when it is less than 3/4 pixels tall - */ + /* a blue zone is only active if it is less than 3/4 pixels tall */ dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale ); - if ( dist >= 48 || dist <= -48 ) - blue->flags |= ~AF_LATIN_BLUE_ACTIVE; + if ( dist <= 48 && dist >= -48 ) + { + FT_Pos delta1, delta2; + + + delta1 = blue->shoot.org - blue->ref.org; + delta2 = delta1; + if ( delta1 < 0 ) + delta2 = -delta2; + + delta2 = FT_MulFix( delta2, scale ); + + if ( delta2 < 32 ) + delta2 = 0; + else if ( delta2 < 64 ) + delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 ); + else + delta2 = FT_PIX_ROUND( delta2 ); + + if ( delta1 < 0 ) + delta2 = -delta2; + + blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); + blue->shoot.fit = blue->ref.fit + delta2; + + blue->flags |= AF_LATIN_BLUE_ACTIVE; + } } } } @@ -442,42 +564,45 @@ } - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** L A T I N G L Y P H A N A L Y S I S *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** L A T I N G L Y P H A N A L Y S I S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ - FT_LOCAL_DEF( void ) + FT_LOCAL_DEF( FT_Error ) af_latin_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = &hints->axis[dim]; - AF_Segment segments = axis->segments; - AF_Segment segment = segments; - FT_Int num_segments = 0; - AF_Point* contour = hints->contours; - AF_Point* contour_limit = contour + hints->num_contours; + AF_AxisHints axis = &hints->axis[dim]; + FT_Memory memory = hints->memory; + FT_Error error = AF_Err_Ok; + AF_Segment segment = NULL; + AF_Point* contour = hints->contours; + AF_Point* contour_limit = contour + hints->num_contours; AF_Direction major_dir, segment_dir; #ifdef AF_HINT_METRICS - AF_Point min_point = 0; - AF_Point max_point = 0; - FT_Pos min_coord = 32000; - FT_Pos max_coord = -32000; + AF_Point min_point = 0; + AF_Point max_point = 0; + FT_Pos min_coord = 32000; + FT_Pos max_coord = -32000; #endif - major_dir = FT_ABS( axis->major_dir ); + major_dir = (AF_Direction)FT_ABS( axis->major_dir ); segment_dir = major_dir; + axis->num_segments = 0; + /* set up (u,v) in each point */ if ( dim == AF_DIMENSION_HORZ ) { AF_Point point = hints->points; AF_Point limit = point + hints->num_points; + for ( ; point < limit; point++ ) { point->u = point->fx; @@ -489,6 +614,7 @@ AF_Point point = hints->points; AF_Point limit = point + hints->num_points; + for ( ; point < limit; point++ ) { point->u = point->fy; @@ -496,7 +622,6 @@ } } - /* do each contour separately */ for ( ; contour < contour_limit; contour++ ) { @@ -563,7 +688,7 @@ { /* we are just leaving an edge; record a new segment! */ segment->last = point; - segment->pos = ( min_pos + max_pos ) >> 1; + segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); /* a segment is round if either its first or last point */ /* is a control point */ @@ -580,12 +705,11 @@ if ( v > max_pos ) max_pos = v; - segment->min_coord = min_pos; - segment->max_coord = max_pos; + segment->min_coord = (FT_Short)min_pos; + segment->max_coord = (FT_Short)max_pos; on_edge = 0; - num_segments++; - segment++; + segment = NULL; /* fallthrough */ } } @@ -601,12 +725,14 @@ if ( !on_edge && FT_ABS( point->out_dir ) == major_dir ) { /* this is the start of a new segment! */ - segment_dir = point->out_dir; + segment_dir = (AF_Direction)point->out_dir; /* clear all segment fields */ - FT_ZERO( segment ); + error = af_axis_hints_new_segment( axis, memory, &segment ); + if ( error ) + goto Exit; - segment->dir = segment_dir; + segment->dir = (FT_Char)segment_dir; segment->flags = AF_EDGE_NORMAL; min_pos = max_pos = point->u; segment->first = point; @@ -634,6 +760,7 @@ /* we need to ensure that there are edges on the left-most and */ /* right-most points of the glyph in order to hint the metrics; */ /* we do this by inserting fake segments when needed */ + if ( dim == AF_DIMENSION_HORZ ) { AF_Point point = hints->points; @@ -668,7 +795,9 @@ if ( min_point ) { /* clear all segment fields */ - FT_ZERO( segment ); + error = af_axis_hints_new_segment( axis, memory, &segment ); + if ( error ) + goto Exit; segment->dir = segment_dir; segment->flags = AF_EDGE_NORMAL; @@ -678,15 +807,16 @@ segment->score = 32000; segment->link = NULL; - num_segments++; - segment++; + segment = NULL; } /* insert maximum segment */ if ( max_point ) { /* clear all segment fields */ - FT_ZERO( segment ); + error = af_axis_hints_new_segment( axis, memory, &segment ); + if ( error ) + goto Exit; segment->dir = segment_dir; segment->flags = AF_EDGE_NORMAL; @@ -696,13 +826,13 @@ segment->score = 32000; segment->link = NULL; - num_segments++; - segment++; + segment = NULL; } } #endif /* AF_HINT_METRICS */ - axis->num_segments = num_segments; + Exit: + return error; } @@ -716,6 +846,7 @@ AF_Direction major_dir = axis->major_dir; AF_Segment seg1, seg2; + /* now compare each segment to the others */ for ( seg1 = segments; seg1 < segment_limit; seg1++ ) { @@ -786,15 +917,16 @@ } - FT_LOCAL_DEF( void ) + FT_LOCAL_DEF( FT_Error ) af_latin_hints_compute_edges( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = &hints->axis[dim]; - AF_Edge edges = axis->edges; - AF_Edge edge, edge_limit; + AF_AxisHints axis = &hints->axis[dim]; + FT_Error error = AF_Err_Ok; + FT_Memory memory = hints->memory; + AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; - AF_Segment segments = axis->segments; + AF_Segment segments = axis->segments; AF_Segment segment_limit = segments + axis->num_segments; AF_Segment seg; @@ -803,6 +935,8 @@ FT_Pos edge_distance_threshold; + axis->num_edges = 0; + scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale : hints->y_scale; @@ -825,7 +959,7 @@ /* */ /*********************************************************************/ - edge_distance_threshold = FT_MulFix( hints->edge_distance_threshold, + edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, scale ); if ( edge_distance_threshold > 64 / 4 ) edge_distance_threshold = 64 / 4; @@ -833,16 +967,17 @@ edge_distance_threshold = FT_DivFix( edge_distance_threshold, scale ); - edge_limit = edges; for ( seg = segments; seg < segment_limit; seg++ ) { AF_Edge found = 0; + FT_Int ee; /* look for an edge corresponding to the segment */ - for ( edge = edges; edge < edge_limit; edge++ ) + for ( ee = 0; ee < axis->num_edges; ee++ ) { - FT_Pos dist; + AF_Edge edge = axis->edges + ee; + FT_Pos dist; dist = seg->pos - edge->fpos; @@ -858,19 +993,18 @@ if ( !found ) { + AF_Edge edge; + + /* insert a new edge in the list and */ /* sort according to the position */ - while ( edge > edges && edge[-1].fpos > seg->pos ) - { - edge[0] = edge[-1]; - edge--; - } - edge_limit++; - - /* clear all edge fields */ - FT_ZERO( edge ); + error = af_axis_hints_new_edge( axis, seg->pos, memory, &edge ); + if ( error ) + goto Exit; /* add the segment to the new edge's list */ + FT_ZERO( edge ); + edge->first = seg; edge->last = seg; edge->fpos = seg->pos; @@ -881,12 +1015,11 @@ { /* if an edge was found, simply add the segment to the edge's */ /* list */ - seg->edge_next = edge->first; - edge->last->edge_next = seg; - edge->last = seg; + seg->edge_next = found->first; + found->last->edge_next = seg; + found->last = seg; } } - axis->num_edges = (FT_Int)( edge_limit - edges ); /*********************************************************************/ @@ -904,138 +1037,156 @@ /* first of all, set the `edge' field in each segment -- this is */ /* required in order to compute edge links */ - /* Note that I've tried to remove this loop, setting - * the "edge" field of each segment directly in the - * code above. For some reason, it slows down execution - * speed -- on a Sun. + /* + * Note that removing this loop and setting the `edge' field of each + * segment directly in the code above slows down execution speed for + * some reasons on platforms like the Sun. */ - for ( edge = edges; edge < edge_limit; edge++ ) { - seg = edge->first; - if ( seg ) + AF_Edge edges = axis->edges; + AF_Edge edge_limit = edges + axis->num_edges; + AF_Edge edge; + + + for ( edge = edges; edge < edge_limit; edge++ ) + { + seg = edge->first; + if ( seg ) + do + { + seg->edge = edge; + seg = seg->edge_next; + + } while ( seg != edge->first ); + } + + /* now, compute each edge properties */ + for ( edge = edges; edge < edge_limit; edge++ ) + { + FT_Int is_round = 0; /* does it contain round segments? */ + FT_Int is_straight = 0; /* does it contain straight segments? */ + FT_Pos ups = 0; /* number of upwards segments */ + FT_Pos downs = 0; /* number of downwards segments */ + + + seg = edge->first; + do { - seg->edge = edge; - seg = seg->edge_next; - } - while ( seg != edge->first ); - } - - /* now, compute each edge properties */ - for ( edge = edges; edge < edge_limit; edge++ ) - { - FT_Int is_round = 0; /* does it contain round segments? */ - FT_Int is_straight = 0; /* does it contain straight segments? */ - FT_Pos ups = 0; /* number of upwards segments */ - FT_Pos downs = 0; /* number of downwards segments */ + FT_Bool is_serif; - seg = edge->first; + /* check for roundness of segment */ + if ( seg->flags & AF_EDGE_ROUND ) + is_round++; + else + is_straight++; - do - { - FT_Bool is_serif; + /* check for segment direction */ + if ( seg->dir == up_dir ) + ups += seg->max_coord-seg->min_coord; + else + downs += seg->max_coord-seg->min_coord; + /* check for links -- if seg->serif is set, then seg->link must */ + /* be ignored */ + is_serif = (FT_Bool)( seg->serif && seg->serif->edge != edge ); - /* check for roundness of segment */ - if ( seg->flags & AF_EDGE_ROUND ) - is_round++; - else - is_straight++; - - /* check for segment direction */ - if ( seg->dir == up_dir ) - ups += seg->max_coord-seg->min_coord; - else - downs += seg->max_coord-seg->min_coord; - - /* check for links -- if seg->serif is set, then seg->link must */ - /* be ignored */ - is_serif = (FT_Bool)( seg->serif && seg->serif->edge != edge ); - - if ( seg->link || is_serif ) - { - AF_Edge edge2; - AF_Segment seg2; - - - edge2 = edge->link; - seg2 = seg->link; - - if ( is_serif ) + if ( seg->link || is_serif ) { - seg2 = seg->serif; - edge2 = edge->serif; - } - - if ( edge2 ) - { - FT_Pos edge_delta; - FT_Pos seg_delta; + AF_Edge edge2; + AF_Segment seg2; - edge_delta = edge->fpos - edge2->fpos; - if ( edge_delta < 0 ) - edge_delta = -edge_delta; + edge2 = edge->link; + seg2 = seg->link; - seg_delta = seg->pos - seg2->pos; - if ( seg_delta < 0 ) - seg_delta = -seg_delta; + if ( is_serif ) + { + seg2 = seg->serif; + edge2 = edge->serif; + } - if ( seg_delta < edge_delta ) + if ( edge2 ) + { + FT_Pos edge_delta; + FT_Pos seg_delta; + + + edge_delta = edge->fpos - edge2->fpos; + if ( edge_delta < 0 ) + edge_delta = -edge_delta; + + seg_delta = seg->pos - seg2->pos; + if ( seg_delta < 0 ) + seg_delta = -seg_delta; + + if ( seg_delta < edge_delta ) + edge2 = seg2->edge; + } + else edge2 = seg2->edge; + + if ( is_serif ) + { + edge->serif = edge2; + edge2->flags |= AF_EDGE_SERIF; + } + else + edge->link = edge2; } - else - edge2 = seg2->edge; - if ( is_serif ) - { - edge->serif = edge2; - edge2->flags |= AF_EDGE_SERIF; - } - else - edge->link = edge2; - } + seg = seg->edge_next; - seg = seg->edge_next; + } while ( seg != edge->first ); - } while ( seg != edge->first ); + /* set the round/straight flags */ + edge->flags = AF_EDGE_NORMAL; - /* set the round/straight flags */ - edge->flags = AF_EDGE_NORMAL; + if ( is_round > 0 && is_round >= is_straight ) + edge->flags |= AF_EDGE_ROUND; - if ( is_round > 0 && is_round >= is_straight ) - edge->flags |= AF_EDGE_ROUND; + /* set the edge's main direction */ + edge->dir = AF_DIR_NONE; - /* set the edge's main direction */ - edge->dir = AF_DIR_NONE; + if ( ups > downs ) + edge->dir = (FT_Char)up_dir; - if ( ups > downs ) - edge->dir = up_dir; + else if ( ups < downs ) + edge->dir = (FT_Char)-up_dir; - else if ( ups < downs ) - edge->dir = -up_dir; + else if ( ups == downs ) + edge->dir = 0; /* both up and down! */ - else if ( ups == downs ) - edge->dir = 0; /* both up and down! */ + /* gets rid of serifs if link is set */ + /* XXX: This gets rid of many unpleasant artefacts! */ + /* Example: the `c' in cour.pfa at size 13 */ - /* gets rid of serifs if link is set */ - /* XXX: This gets rid of many unpleasant artefacts! */ - /* Example: the `c' in cour.pfa at size 13 */ - - if ( edge->serif && edge->link ) - edge->serif = 0; + if ( edge->serif && edge->link ) + edge->serif = 0; + } } + + Exit: + return error; } - FT_LOCAL_DEF( void ) + FT_LOCAL_DEF( FT_Error ) af_latin_hints_detect_features( AF_GlyphHints hints, AF_Dimension dim ) { - af_latin_hints_compute_segments( hints, dim ); - af_latin_hints_link_segments ( hints, dim ); - af_latin_hints_compute_edges ( hints, dim ); + FT_Error error; + + + error = af_latin_hints_compute_segments( hints, dim ); + if ( !error ) + { + af_latin_hints_link_segments( hints, dim ); + + error = af_latin_hints_compute_edges( hints, dim ); + } + return error; } @@ -1053,12 +1204,12 @@ /* compute which blue zones are active, i.e. have their scaled */ /* size < 3/4 pixels */ - /* for each horizontal edge search the blue zone which is closest */ + /* for each horizontal edge search the blue zone which is closest */ for ( ; edge < edge_limit; edge++ ) { - FT_Int bb; - AF_Width best_blue = NULL; - FT_Pos best_dist; /* initial threshold */ + FT_Int bb; + AF_Width best_blue = NULL; + FT_Pos best_dist; /* initial threshold */ /* compute the initial threshold as a fraction of the EM size */ @@ -1072,16 +1223,16 @@ AF_LatinBlue blue = latin->blues + bb; FT_Bool is_top_blue, is_major_dir; - /* skip inactive blue zones (i.e. those that are too small - */ - if ( !(blue->flags & AF_LATIN_BLUE_ACTIVE) ) + + /* skip inactive blue zones (i.e., those that are too small) */ + if ( !( blue->flags & AF_LATIN_BLUE_ACTIVE ) ) continue; /* if it is a top zone, check for right edges -- if it is a bottom */ /* zone, check for left edges */ /* */ /* of course, that's for TrueType */ - is_top_blue = (blue->flags & AF_LATIN_BLUE_TOP) != 0; + is_top_blue = (FT_Byte)( ( blue->flags & AF_LATIN_BLUE_TOP ) != 0 ); is_major_dir = FT_BOOL( edge->dir == axis->major_dir ); /* if it is a top zone, the edge must be against the major */ @@ -1089,7 +1240,7 @@ /* direction */ if ( is_top_blue ^ is_major_dir ) { - FT_Pos dist; + FT_Pos dist; /* first of all, compare it to the reference position */ @@ -1138,69 +1289,64 @@ static FT_Error af_latin_hints_init( AF_GlyphHints hints, - FT_Outline* outline, AF_LatinMetrics metrics ) { - FT_Error error; FT_Render_Mode mode; - error = af_glyph_hints_reset( hints, &metrics->root.scaler, - (AF_ScriptMetrics) metrics, - outline ); - if (error) - goto Exit; + af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics ); - /* compute flags depending on render mode, etc... - */ + /* + * correct x_scale and y_scale when needed, since they may have + * been modified af_latin_scale_dim above + */ + hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale; + hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta; + hints->y_scale = metrics->axis[AF_DIMENSION_VERT].scale; + hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta; + + /* compute flags depending on render mode, etc... */ mode = metrics->root.scaler.render_mode; - /* we snap the width of vertical stems for the monochrome and - * horizontal LCD rendering targets only. - */ + /* + * We snap the width of vertical stems for the monochrome and + * horizontal LCD rendering targets only. + */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD ) hints->other_flags |= AF_LATIN_HINTS_HORZ_SNAP; - /* we snap the width of horizontal stems for the monochrome and - * vertical LCD rendering targets only. - */ + /* + * We snap the width of horizontal stems for the monochrome and + * vertical LCD rendering targets only. + */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V ) hints->other_flags |= AF_LATIN_HINTS_VERT_SNAP; - /* XXX - */ + /* + * We adjust stems to full pixels only if we don't use the `light' mode. + */ if ( mode != FT_RENDER_MODE_LIGHT ) hints->other_flags |= AF_LATIN_HINTS_STEM_ADJUST; if ( mode == FT_RENDER_MODE_MONO ) hints->other_flags |= AF_LATIN_HINTS_MONO; - /* analyze glyph outline - */ - if ( AF_HINTS_DO_HORIZONTAL(hints) ) - af_latin_hints_detect_features( hints, AF_DIMENSION_HORZ ); - - if ( AF_HINTS_DO_VERTICAL(hints) ) - { - af_latin_hints_detect_features( hints, AF_DIMENSION_VERT ); - af_latin_hints_compute_blue_edges( hints, metrics ); - } - - Exit: - return error; + return 0; } - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** L A T I N G L Y P H G R I D - F I T T I N G *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** L A T I N G L Y P H G R I D - F I T T I N G *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ /* snap a given width in scaled coordinates to one of the */ /* current standard widths */ + static FT_Pos af_latin_snap_width( AF_Width widths, FT_Int count, @@ -1256,7 +1402,7 @@ AF_Edge_Flags stem_flags ) { AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics; - AF_LatinAxis axis = & metrics->axis[ dim ]; + AF_LatinAxis axis = & metrics->axis[dim]; FT_Pos dist = width; FT_Int sign = 0; FT_Int vertical = AF_HINTS_DO_VERTICAL( hints ); @@ -1275,7 +1421,6 @@ ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) { /* smooth hinting process: very lightly quantize the stem width */ - /* */ /* leave the widths of serifs alone */ @@ -1294,8 +1439,8 @@ { FT_Pos delta; - /* compare to standard width - */ + + /* compare to standard width */ if ( axis->width_count > 0 ) { delta = dist - axis->widths[0].cur; @@ -1305,7 +1450,7 @@ if ( delta < 40 ) { - dist = axis->widths[ 0 ].cur; + dist = axis->widths[0].cur; if ( dist < 48 ) dist = 48; @@ -1337,13 +1482,14 @@ else { /* strong hinting process: snap the stem width to integer pixels */ - /* */ + dist = af_latin_snap_width( axis->widths, axis->width_count, dist ); if ( vertical ) { /* in the case of vertical hinting, always round */ /* the stem heights to integer pixels */ + if ( dist >= 64 ) dist = ( dist + 16 ) & ~63; else @@ -1355,6 +1501,7 @@ { /* monochrome horizontal hinting: snap widths to integer pixels */ /* with a different threshold */ + if ( dist < 64 ) dist = 64; else @@ -1365,6 +1512,7 @@ /* for horizontal anti-aliased hinting, we adopt a more subtle */ /* approach: we strengthen small stems, round stems whose size */ /* is between 1 and 2 pixels to an integer, otherwise nothing */ + if ( dist < 48 ) dist = ( dist + 64 ) >> 1; @@ -1385,8 +1533,8 @@ } - /* align one stem edge relative to the previous stem edge */ + static void af_latin_align_linked_edge( AF_GlyphHints hints, AF_Dimension dim, @@ -1395,11 +1543,11 @@ { FT_Pos dist = stem_edge->opos - base_edge->opos; - FT_Pos fitted_width = af_latin_compute_stem_width( hints, - dim, - dist, - base_edge->flags, - stem_edge->flags ); + FT_Pos fitted_width = af_latin_compute_stem_width( + hints, dim, dist, + (AF_Edge_Flags)base_edge->flags, + (AF_Edge_Flags)stem_edge->flags ); + stem_edge->pos = base_edge->pos + fitted_width; } @@ -1415,11 +1563,12 @@ serif->pos = base->pos + (serif->opos - base->opos); } + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ - /**** E D G E H I N T I N G ****/ + /**** E D G E H I N T I N G ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ @@ -1427,20 +1576,21 @@ FT_LOCAL_DEF( void ) - af_latin_hint_edges( AF_GlyphHints hints, - AF_Dimension dim ) + af_latin_hint_edges( AF_GlyphHints hints, + AF_Dimension dim ) { - AF_AxisHints axis = & hints->axis[dim]; - AF_Edge edges = axis->edges; + AF_AxisHints axis = &hints->axis[dim]; + AF_Edge edges = axis->edges; AF_Edge edge_limit = edges + axis->num_edges; FT_Int n_edges; AF_Edge edge; - AF_Edge anchor = 0; + AF_Edge anchor = 0; FT_Int has_serifs = 0; /* we begin by aligning all stems relative to the blue zone */ /* if needed -- that's only for horizontal edges */ + if ( dim == AF_DIMENSION_VERT ) { for ( edge = edges; edge < edge_limit; edge++ ) @@ -1519,8 +1669,10 @@ org_len = edge2->opos - edge->opos; - cur_len = af_latin_compute_stem_width( hints, dim, org_len, - edge->flags, edge2->flags ); + cur_len = af_latin_compute_stem_width( + hints, dim, org_len, + (AF_Edge_Flags)edge->flags, + (AF_Edge_Flags)edge2->flags ); if ( cur_len <= 64 ) u_off = d_off = 32; else @@ -1571,8 +1723,10 @@ org_len = edge2->opos - edge->opos; org_center = org_pos + ( org_len >> 1 ); - cur_len = af_latin_compute_stem_width( hints, dim, org_len, - edge->flags, edge2->flags ); + cur_len = af_latin_compute_stem_width( + hints, dim, org_len, + (AF_Edge_Flags)edge->flags, + (AF_Edge_Flags)edge2->flags ); if ( cur_len < 96 ) { @@ -1611,16 +1765,18 @@ org_len = edge2->opos - edge->opos; org_center = org_pos + ( org_len >> 1 ); - cur_len = af_latin_compute_stem_width( hints, dim, org_len, - edge->flags, edge2->flags ); + cur_len = af_latin_compute_stem_width( + hints, dim, org_len, + (AF_Edge_Flags)edge->flags, + (AF_Edge_Flags)edge2->flags ); cur_pos1 = FT_PIX_ROUND( org_pos ); - delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center ); + delta1 = cur_pos1 + ( cur_len >> 1 ) - org_center; if ( delta1 < 0 ) delta1 = -delta1; cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len; - delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center ); + delta2 = cur_pos2 + ( cur_len >> 1 ) - org_center; if ( delta2 < 0 ) delta2 = -delta2; @@ -1639,7 +1795,7 @@ /* make sure that lowercase m's maintain their symmetry */ /* In general, lowercase m's have six vertical edges if they are sans */ - /* serif, or twelve if they are avec serif. This implementation is */ + /* serif, or twelve if they are with serifs. This implementation is */ /* based on that assumption, and seems to work very well with most */ /* faces. However, if for a certain face this assumption is not */ /* true, the m is just rendered like before. In addition, any stem */ @@ -1700,9 +1856,10 @@ if ( has_serifs || !anchor ) { - /* now hint the remaining edges (serifs and single) in order - * to complete our processing - */ + /* + * now hint the remaining edges (serifs and single) in order + * to complete our processing + */ for ( edge = edges; edge < edge_limit; edge++ ) { if ( edge->flags & AF_EDGE_DONE ) @@ -1738,52 +1895,82 @@ FT_Outline* outline, AF_LatinMetrics metrics ) { - AF_Dimension dim; + FT_Error error; + int dim; - FT_UNUSED( metrics ); + error = af_glyph_hints_reload( hints, outline ); + if ( error ) + goto Exit; + + /* analyze glyph outline */ + if ( AF_HINTS_DO_HORIZONTAL( hints ) ) + { + error = af_latin_hints_detect_features( hints, AF_DIMENSION_HORZ ); + if ( error ) + goto Exit; + } + + if ( AF_HINTS_DO_VERTICAL( hints ) ) + { + error = af_latin_hints_detect_features( hints, AF_DIMENSION_VERT ); + if ( error ) + goto Exit; + + af_latin_hints_compute_blue_edges( hints, metrics ); + } + + /* grid-fit the outline */ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { - if ( (dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL(hints)) || - (dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL(hints)) ) + if ( ( dim == AF_DIMENSION_HORZ && AF_HINTS_DO_HORIZONTAL( hints ) ) || + ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) ) { - af_latin_hint_edges( hints, dim ); - af_glyph_hints_align_edge_points( hints, dim ); - af_glyph_hints_align_strong_points( hints, dim ); - af_glyph_hints_align_weak_points( hints, dim ); + af_latin_hint_edges( hints, (AF_Dimension)dim ); + af_glyph_hints_align_edge_points( hints, (AF_Dimension)dim ); + af_glyph_hints_align_strong_points( hints, (AF_Dimension)dim ); + af_glyph_hints_align_weak_points( hints, (AF_Dimension)dim ); } } af_glyph_hints_save( hints, outline ); - return 0; + Exit: + return error; } - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** L A T I N S C R I P T C L A S S *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** L A T I N S C R I P T C L A S S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + static const AF_Script_UniRangeRec af_latin_uniranges[] = { - { 32, 127 }, /* XXX: TODO: Add new Unicode ranges here !! */ + { 32, 127 }, /* XXX: TODO: Add new Unicode ranges here! */ { 160, 255 }, - { 0, 0 } + { 0, 0 } }; - FT_LOCAL_DEF( const AF_ScriptClassRec ) af_latin_script_class = + + FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec + af_latin_script_class = { AF_SCRIPT_LATIN, af_latin_uniranges, sizeof( AF_LatinMetricsRec ), - (AF_Script_InitMetricsFunc) af_latin_metrics_init, - (AF_Script_ScaleMetricsFunc) af_latin_metrics_scale, - (AF_Script_DoneMetricsFunc) NULL, - (AF_Script_InitHintsFunc) af_latin_hints_init, - (AF_Script_ApplyHintsFunc) af_latin_hints_apply + (AF_Script_InitMetricsFunc) af_latin_metrics_init, + (AF_Script_ScaleMetricsFunc)af_latin_metrics_scale, + (AF_Script_DoneMetricsFunc) NULL, + + (AF_Script_InitHintsFunc) af_latin_hints_init, + (AF_Script_ApplyHintsFunc) af_latin_hints_apply }; + +/* END */ diff --git a/src/libs/freetype2/autofit/aflatin.h b/src/libs/freetype2/autofit/aflatin.h index a52e421011..bc63c02118 100644 --- a/src/libs/freetype2/autofit/aflatin.h +++ b/src/libs/freetype2/autofit/aflatin.h @@ -1,34 +1,53 @@ +/***************************************************************************/ +/* */ +/* aflatin.h */ +/* */ +/* Auto-fitter hinting routines for latin script (specification). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #ifndef __AFLATIN_H__ #define __AFLATIN_H__ #include "afhints.h" + FT_BEGIN_HEADER - /* - * the latin-specific script class - * - */ - FT_LOCAL( const AF_ScriptClassRec ) af_latin_script_class; - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** L A T I N G L O B A L M E T R I C S *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + /* the latin-specific script class */ - /* - * the following declarations could be embedded in the file "aflatin.c" - * they've been made semi-public to allow alternate script hinters to - * re-use some of them - */ + FT_CALLBACK_TABLE const AF_ScriptClassRec + af_latin_script_class; - /* - * Latin (global) metrics management - * - */ + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** L A T I N G L O B A L M E T R I C S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + /* + * The following declarations could be embedded in the file `aflatin.c'; + * they have been made semi-public to allow alternate script hinters to + * re-use some of them. + */ + + + /* Latin (global) metrics management */ enum { @@ -42,44 +61,47 @@ FT_BEGIN_HEADER AF_LATIN_BLUE_MAX }; + #define AF_LATIN_IS_TOP_BLUE( b ) ( (b) == AF_LATIN_BLUE_CAPITAL_TOP || \ (b) == AF_LATIN_BLUE_SMALL_F_TOP || \ (b) == AF_LATIN_BLUE_SMALL_TOP ) -#define AF_LATIN_MAX_WIDTHS 16 -#define AF_LATIN_MAX_BLUES AF_LATIN_BLUE_MAX +#define AF_LATIN_MAX_WIDTHS 16 +#define AF_LATIN_MAX_BLUES AF_LATIN_BLUE_MAX + enum { - AF_LATIN_BLUE_ACTIVE = (1 << 0), - AF_LATIN_BLUE_TOP = (1 << 1), - + AF_LATIN_BLUE_ACTIVE = 1 << 0, + AF_LATIN_BLUE_TOP = 1 << 1, + AF_LATIN_BLUE_ADJUSTMENT = 1 << 2, /* used for scale adjustment */ + /* optimization */ AF_LATIN_BLUE_FLAG_MAX }; - typedef struct AF_LatinBlueRec_ + typedef struct AF_LatinBlueRec_ { - AF_WidthRec ref; - AF_WidthRec shoot; - FT_UInt flags; + AF_WidthRec ref; + AF_WidthRec shoot; + FT_UInt flags; } AF_LatinBlueRec, *AF_LatinBlue; - typedef struct AF_LatinAxisRec_ + typedef struct AF_LatinAxisRec_ { FT_Fixed scale; FT_Pos delta; FT_UInt width_count; - AF_WidthRec widths[ AF_LATIN_MAX_WIDTHS ]; + AF_WidthRec widths[AF_LATIN_MAX_WIDTHS]; FT_Pos edge_distance_threshold; - /* ignored for horizontal metrics */ + /* ignored for horizontal metrics */ FT_Bool control_overshoot; FT_UInt blue_count; - AF_LatinBlueRec blues[ AF_LATIN_BLUE_MAX ]; + AF_LatinBlueRec blues[AF_LATIN_BLUE_MAX]; FT_Fixed org_scale; FT_Pos org_delta; @@ -87,16 +109,15 @@ FT_BEGIN_HEADER } AF_LatinAxisRec, *AF_LatinAxis; - typedef struct AF_LatinMetricsRec_ + typedef struct AF_LatinMetricsRec_ { - AF_ScriptMetricsRec root; - FT_UInt units_per_em; - AF_LatinAxisRec axis[ AF_DIMENSION_MAX ]; + AF_ScriptMetricsRec root; + FT_UInt units_per_em; + AF_LatinAxisRec axis[AF_DIMENSION_MAX]; } AF_LatinMetricsRec, *AF_LatinMetrics; - FT_LOCAL( FT_Error ) af_latin_metrics_init( AF_LatinMetrics metrics, FT_Face face ); @@ -107,57 +128,63 @@ FT_BEGIN_HEADER - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** L A T I N G L Y P H A N A L Y S I S *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** L A T I N G L Y P H A N A L Y S I S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ enum { - AF_LATIN_HINTS_HORZ_SNAP = (1 << 0), /* enable stem width snapping */ - AF_LATIN_HINTS_VERT_SNAP = (1 << 1), /* enable stem height snapping */ - AF_LATIN_HINTS_STEM_ADJUST = (1 << 2), /* enable stem width/height adjustment */ - AF_LATIN_HINTS_MONO = (1 << 3) /* indicate monochrome rendering */ + AF_LATIN_HINTS_HORZ_SNAP = 1 << 0, /* enable stem width snapping */ + AF_LATIN_HINTS_VERT_SNAP = 1 << 1, /* enable stem height snapping */ + AF_LATIN_HINTS_STEM_ADJUST = 1 << 2, /* enable stem width/height */ + /* adjustment */ + AF_LATIN_HINTS_MONO = 1 << 3 /* indicate monochrome */ + /* rendering */ }; -#define AF_LATIN_HINTS_DO_HORZ_SNAP(h) \ - AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_HORZ_SNAP) -#define AF_LATIN_HINTS_DO_VERT_SNAP(h) \ - AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_VERT_SNAP) +#define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \ + AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP ) -#define AF_LATIN_HINTS_DO_STEM_ADJUST(h) \ - AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_STEM_ADJUST) +#define AF_LATIN_HINTS_DO_VERT_SNAP( h ) \ + AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP ) -#define AF_LATIN_HINTS_DO_MONO(h) \ - AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_MONO) +#define AF_LATIN_HINTS_DO_STEM_ADJUST( h ) \ + AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST ) + +#define AF_LATIN_HINTS_DO_MONO( h ) \ + AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO ) - /* this shouldn't normally be exported. However, other scripts might - * like to use this function as-is - */ - FT_LOCAL( void ) + /* + * This shouldn't normally be exported. However, other scripts might + * like to use this function as-is. + */ + FT_LOCAL( FT_Error ) af_latin_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ); - /* this shouldn't normally be exported. However, other scripts might - * want to use this function as-is - */ + /* + * This shouldn't normally be exported. However, other scripts might + * want to use this function as-is. + */ FT_LOCAL( void ) af_latin_hints_link_segments( AF_GlyphHints hints, AF_Dimension dim ); - /* this shouldn't normally be exported. However, other scripts might - * want to use this function as-is - */ - FT_LOCAL( void ) + /* + * This shouldn't normally be exported. However, other scripts might + * want to use this function as-is. + */ + FT_LOCAL( FT_Error ) af_latin_hints_compute_edges( AF_GlyphHints hints, AF_Dimension dim ); - FT_LOCAL( void ) + FT_LOCAL( FT_Error ) af_latin_hints_detect_features( AF_GlyphHints hints, AF_Dimension dim ); @@ -166,3 +193,6 @@ FT_BEGIN_HEADER FT_END_HEADER #endif /* __AFLATIN_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/autofit/afloader.c b/src/libs/freetype2/autofit/afloader.c index ed422384e7..c3f3b2c37b 100644 --- a/src/libs/freetype2/autofit/afloader.c +++ b/src/libs/freetype2/autofit/afloader.c @@ -1,7 +1,27 @@ +/***************************************************************************/ +/* */ +/* afloader.c */ +/* */ +/* Auto-fitter glyph loading routines (body). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #include "afloader.h" #include "afhints.h" #include "afglobal.h" #include "aflatin.h" +#include "aferrors.h" + FT_LOCAL_DEF( FT_Error ) af_loader_init( AF_Loader loader, @@ -9,6 +29,7 @@ { FT_Error error; + FT_ZERO( loader ); af_glyph_hints_init( &loader->hints, memory ); @@ -28,13 +49,14 @@ FT_LOCAL_DEF( FT_Error ) - af_loader_reset( AF_Loader loader, - FT_Face face ) + af_loader_reset( AF_Loader loader, + FT_Face face ) { - FT_Error error = 0; + FT_Error error = AF_Err_Ok; + loader->face = face; - loader->globals = (AF_FaceGlobals) face->autohint.data; + loader->globals = (AF_FaceGlobals)face->autohint.data; FT_GlyphLoader_Rewind( loader->gloader ); @@ -43,17 +65,22 @@ error = af_face_globals_new( face, &loader->globals ); if ( !error ) { - face->autohint.data = (FT_Pointer) loader->globals; - face->autohint.finalizer = (FT_Generic_Finalizer) af_face_globals_free; + face->autohint.data = + (FT_Pointer)loader->globals; + face->autohint.finalizer = + (FT_Generic_Finalizer)af_face_globals_free; } } + return error; } FT_LOCAL_DEF( void ) - af_loader_done( AF_Loader loader ) + af_loader_done( AF_Loader loader ) { + af_glyph_hints_done( &loader->hints ); + loader->face = NULL; loader->globals = NULL; @@ -69,7 +96,7 @@ FT_Int32 load_flags, FT_UInt depth ) { - FT_Error error = 0; + FT_Error error; FT_Face face = loader->face; FT_GlyphLoader gloader = loader->gloader; AF_ScriptMetrics metrics = loader->metrics; @@ -77,6 +104,7 @@ FT_GlyphSlot slot = face->glyph; FT_Slot_Internal internal = slot->internal; + error = FT_Load_Glyph( face, glyph_index, load_flags ); if ( error ) goto Exit; @@ -86,6 +114,7 @@ { FT_Matrix inverse; + loader->trans_matrix = internal->glyph_matrix; loader->trans_delta = internal->glyph_delta; @@ -100,100 +129,114 @@ switch ( slot->format ) { - case FT_GLYPH_FORMAT_OUTLINE: - /* translate the loaded glyph when an internal transform - * is needed - */ - if ( loader->transformed ) + case FT_GLYPH_FORMAT_OUTLINE: + /* translate the loaded glyph when an internal transform is needed */ + if ( loader->transformed ) + FT_Outline_Translate( &slot->outline, + loader->trans_delta.x, + loader->trans_delta.y ); + + /* copy the outline points in the loader's current */ + /* extra points which is used to keep original glyph coordinates */ + error = FT_GlyphLoader_CheckPoints( gloader, + slot->outline.n_points + 4, + slot->outline.n_contours ); + if ( error ) + goto Exit; + + FT_ARRAY_COPY( gloader->current.outline.points, + slot->outline.points, + slot->outline.n_points ); + + FT_ARRAY_COPY( gloader->current.extra_points, + slot->outline.points, + slot->outline.n_points ); + + FT_ARRAY_COPY( gloader->current.outline.contours, + slot->outline.contours, + slot->outline.n_contours ); + + FT_ARRAY_COPY( gloader->current.outline.tags, + slot->outline.tags, + slot->outline.n_points ); + + gloader->current.outline.n_points = slot->outline.n_points; + gloader->current.outline.n_contours = slot->outline.n_contours; + + /* compute original horizontal phantom points (and ignore */ + /* vertical ones) */ + loader->pp1.x = hints->x_delta; + loader->pp1.y = hints->y_delta; + loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance, + hints->x_scale ) + hints->x_delta; + loader->pp2.y = hints->y_delta; + + /* be sure to check for spacing glyphs */ + if ( slot->outline.n_points == 0 ) + goto Hint_Metrics; + + /* now load the slot image into the auto-outline and run the */ + /* automatic hinting process */ + metrics->clazz->script_hints_apply( hints, + &gloader->current.outline, + metrics ); + + /* we now need to hint the metrics according to the change in */ + /* width/positioning that occured during the hinting process */ + { + FT_Pos old_advance, old_rsb, old_lsb, new_lsb; + FT_Pos pp1x_uh, pp2x_uh; + AF_AxisHints axis = &hints->axis[AF_DIMENSION_HORZ]; + AF_Edge edge1 = axis->edges; /* leftmost edge */ + AF_Edge edge2 = edge1 + + axis->num_edges - 1; /* rightmost edge */ + + + if ( axis->num_edges > 1 ) { - FT_Vector* point = slot->outline.points; - FT_Vector* limit = point + slot->outline.n_points; - - for ( ; point < limit; point++ ) - { - point->x += loader->trans_delta.x; - point->y += loader->trans_delta.y; - } - } - - /* copy the outline points in the loader's current */ - /* extra points which is used to keep original glyph coordinates */ - error = FT_GlyphLoader_CheckPoints( gloader, - slot->outline.n_points + 4, - slot->outline.n_contours ); - if ( error ) - goto Exit; - - FT_ARRAY_COPY( gloader->current.outline.points, - slot->outline.points, - slot->outline.n_points ); - - FT_ARRAY_COPY( gloader->current.extra_points, - slot->outline.points, - slot->outline.n_points ); - - FT_ARRAY_COPY( gloader->current.outline.contours, - slot->outline.contours, - slot->outline.n_contours ); - - FT_ARRAY_COPY( gloader->current.outline.tags, - slot->outline.tags, - slot->outline.n_points ); - - gloader->current.outline.n_points = slot->outline.n_points; - gloader->current.outline.n_contours = slot->outline.n_contours; - - /* compute original horizontal phantom points (and ignore */ - /* vertical ones) */ - loader->pp1.x = hints->x_delta; - loader->pp1.y = hints->y_delta; - loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance, - hints->x_scale ) + hints->x_delta; - loader->pp2.y = hints->y_delta; - - /* be sure to check for spacing glyphs */ - if ( slot->outline.n_points == 0 ) - goto Hint_Metrics; - - /* now load the slot image into the auto-outline and run the */ - /* automatic hinting process */ - error = metrics->clazz->script_hints_init( hints, - &gloader->current.outline, - metrics ); - if ( error ) - goto Exit; - - /* apply the hints */ - metrics->clazz->script_hints_apply( hints, - &gloader->current.outline, - metrics ); - /* we now need to hint the metrics according to the change in */ - /* width/positioning that occured during the hinting process */ - { - FT_Pos old_advance, old_rsb, old_lsb, new_lsb; - AF_AxisHints axis = &hints->axis[ AF_DIMENSION_HORZ ]; - AF_Edge edge1 = axis->edges; /* leftmost edge */ - AF_Edge edge2 = edge1 + axis->num_edges - 1; /* rightmost edge */ - - old_advance = loader->pp2.x; old_rsb = old_advance - edge2->opos; old_lsb = edge1->opos; new_lsb = edge1->pos; - loader->pp1.x = FT_PIX_ROUND( new_lsb - old_lsb ); - loader->pp2.x = FT_PIX_ROUND( edge2->pos + old_rsb ); + /* remember unhinted values to later account */ + /* for rounding errors */ + + pp1x_uh = new_lsb - old_lsb; + pp2x_uh = edge2->pos + old_rsb; + + /* prefer too much space over too little space */ + /* for very small sizes */ + + if ( old_lsb < 24 ) + pp1x_uh -= 5; + + if ( old_rsb < 24 ) + pp2x_uh += 5; + + loader->pp1.x = FT_PIX_ROUND( pp1x_uh ); + loader->pp2.x = FT_PIX_ROUND( pp2x_uh ); + + slot->lsb_delta = loader->pp1.x - pp1x_uh; + slot->rsb_delta = loader->pp2.x - pp2x_uh; #if 0 /* try to fix certain bad advance computations */ if ( loader->pp2.x + loader->pp1.x == edge2->pos && old_rsb > 4 ) loader->pp2.x += 64; #endif - } - /* good, we simply add the glyph to our loader's base */ - FT_GlyphLoader_Add( gloader ); - break; + } + else + { + loader->pp1.x = FT_PIX_ROUND( loader->pp1.x ); + loader->pp2.x = FT_PIX_ROUND( loader->pp2.x ); + } + } + + /* good, we simply add the glyph to our loader's base */ + FT_GlyphLoader_Add( gloader ); + break; case FT_GLYPH_FORMAT_COMPOSITE: { @@ -214,7 +257,7 @@ num_subglyphs ); gloader->current.num_subglyphs = num_subglyphs; - num_base_subgs = gloader->base.num_subglyphs; + num_base_subgs = gloader->base.num_subglyphs; /* now, read each subglyph independently */ for ( nn = 0; nn < num_subglyphs; nn++ ) @@ -289,7 +332,7 @@ if ( start_point + k >= num_base_points || l >= (FT_UInt)num_new_points ) { - error = FT_Err_Invalid_Composite; + error = AF_Err_Invalid_Composite; goto Exit; } @@ -308,8 +351,8 @@ x = FT_MulFix( subglyph->arg1, hints->x_scale ) + hints->x_delta; y = FT_MulFix( subglyph->arg2, hints->y_scale ) + hints->y_delta; - x = FT_PIX_ROUND(x); - y = FT_PIX_ROUND(y); + x = FT_PIX_ROUND( x ); + y = FT_PIX_ROUND( y ); } { @@ -327,7 +370,7 @@ default: /* we don't support other formats (yet?) */ - error = FT_Err_Unimplemented_Feature; + error = AF_Err_Unimplemented_Feature; } Hint_Metrics: @@ -347,10 +390,10 @@ FT_Outline_Get_CBox( &gloader->base.outline, &bbox ); - bbox.xMin = FT_PIX_FLOOR( bbox.xMin ); - bbox.yMin = FT_PIX_FLOOR( bbox.yMin ); - bbox.xMax = FT_PIX_CEIL( bbox.xMax ); - bbox.yMax = FT_PIX_CEIL( bbox.yMax ); + bbox.xMin = FT_PIX_FLOOR( bbox.xMin ); + bbox.yMin = FT_PIX_FLOOR( bbox.yMin ); + bbox.xMax = FT_PIX_CEIL( bbox.xMax ); + bbox.yMax = FT_PIX_CEIL( bbox.yMax ); slot->metrics.width = bbox.xMax - bbox.xMin; slot->metrics.height = bbox.yMax - bbox.yMin; @@ -366,7 +409,11 @@ slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, x_scale ); #else - slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; + if ( !FT_IS_FIXED_WIDTH( slot->face ) ) + slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; + else + slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, + metrics->scaler.x_scale ); #endif slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); @@ -390,8 +437,6 @@ } - - FT_LOCAL_DEF( FT_Error ) af_loader_load_glyph( AF_Loader loader, FT_Face face, @@ -402,8 +447,9 @@ FT_Size size = face->size; AF_ScalerRec scaler; + if ( !size ) - return FT_Err_Invalid_Argument; + return AF_Err_Invalid_Argument; FT_ZERO( &scaler ); @@ -421,21 +467,31 @@ { AF_ScriptMetrics metrics; - error = af_face_globals_get_metrics( loader->globals, gindex, &metrics ); + + error = af_face_globals_get_metrics( loader->globals, gindex, + &metrics ); if ( !error ) { loader->metrics = metrics; - metrics->scaler = scaler; - if ( metrics->clazz->script_metrics_scale ) metrics->clazz->script_metrics_scale( metrics, &scaler ); + else + metrics->scaler = scaler; load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM; load_flags &= ~FT_LOAD_RENDER; + error = metrics->clazz->script_hints_init( &loader->hints, metrics ); + if ( error ) + goto Exit; + error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 ); } } + Exit: return error; } + + +/* END */ diff --git a/src/libs/freetype2/autofit/afloader.h b/src/libs/freetype2/autofit/afloader.h index 12361560a5..fa67c10ffe 100644 --- a/src/libs/freetype2/autofit/afloader.h +++ b/src/libs/freetype2/autofit/afloader.h @@ -1,9 +1,28 @@ +/***************************************************************************/ +/* */ +/* afloader.h */ +/* */ +/* Auto-fitter glyph loading routines (specification). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #ifndef __AF_LOADER_H__ #define __AF_LOADER_H__ #include "afhints.h" #include "afglobal.h" + FT_BEGIN_HEADER typedef struct AF_LoaderRec_ @@ -45,6 +64,10 @@ FT_BEGIN_HEADER /* */ + FT_END_HEADER #endif /* __AF_LOADER_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/autofit/afmodule.c b/src/libs/freetype2/autofit/afmodule.c index f266a7afe8..ee6bc1a87c 100644 --- a/src/libs/freetype2/autofit/afmodule.c +++ b/src/libs/freetype2/autofit/afmodule.c @@ -1,7 +1,27 @@ +/***************************************************************************/ +/* */ +/* afmodule.c */ +/* */ +/* Auto-fitter module implementation (body). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #include "afmodule.h" #include "afloader.h" + #include FT_INTERNAL_OBJECTS_H + typedef struct FT_AutofitterRec_ { FT_ModuleRec root; @@ -31,21 +51,20 @@ FT_UInt glyph_index, FT_Int32 load_flags ) { - FT_UNUSED(size); + FT_UNUSED( size ); return af_loader_load_glyph( module->loader, slot->face, glyph_index, load_flags ); } - FT_CALLBACK_TABLE_DEF const FT_AutoHinter_ServiceRec af_autofitter_service = { NULL, NULL, NULL, - (FT_AutoHinter_GlyphLoadFunc) af_autofitter_load_glyph + (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph }; @@ -59,11 +78,11 @@ 0x10000L, /* version 1.0 of the autofitter */ 0x20000L, /* requires FreeType 2.0 or above */ - (const void*) &af_autofitter_service, + (const void*)&af_autofitter_service, - (FT_Module_Constructor) af_autofitter_init, - (FT_Module_Destructor) af_autofitter_done, - (FT_Module_Requester) 0 + (FT_Module_Constructor)af_autofitter_init, + (FT_Module_Destructor) af_autofitter_done, + (FT_Module_Requester) NULL }; diff --git a/src/libs/freetype2/autofit/afmodule.h b/src/libs/freetype2/autofit/afmodule.h index b898cb375f..36268a0890 100644 --- a/src/libs/freetype2/autofit/afmodule.h +++ b/src/libs/freetype2/autofit/afmodule.h @@ -1,3 +1,21 @@ +/***************************************************************************/ +/* */ +/* afmodule.h */ +/* */ +/* Auto-fitter module implementation (specification). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #ifndef __AFMODULE_H__ #define __AFMODULE_H__ @@ -14,3 +32,6 @@ FT_BEGIN_HEADER FT_END_HEADER #endif /* __AFMODULE_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/autofit/aftypes.h b/src/libs/freetype2/autofit/aftypes.h index abd2ff5fa8..c9323e74ce 100644 --- a/src/libs/freetype2/autofit/aftypes.h +++ b/src/libs/freetype2/autofit/aftypes.h @@ -1,44 +1,82 @@ +/***************************************************************************/ +/* */ +/* aftypes.h */ +/* */ +/* Auto-fitter types (specification only). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/*************************************************************************** + * + * The auto-fitter is a complete rewrite of the old auto-hinter. + * Its main feature is the ability to differentiate between different + * scripts in order to apply language-specific rules. + * + * The code has also been compartimentized into several entities that + * should make algorithmic experimentation easier than with the old + * code. + * + * Finally, we get rid of the Catharon license, since this code is + * released under the FreeType one. + * + ***************************************************************************/ + + #ifndef __AFTYPES_H__ #define __AFTYPES_H__ #include <ft2build.h> + #include FT_FREETYPE_H #include FT_OUTLINE_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H + FT_BEGIN_HEADER - /**************************************************************************/ - /**************************************************************************/ - /***** *****/ - /***** D E B U G G I N G *****/ - /***** *****/ - /**************************************************************************/ - /**************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** D E B U G G I N G *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ #define xxAF_DEBUG #ifdef AF_DEBUG -# include <stdio.h> -# define AF_LOG( x ) printf x +#include <stdio.h> + +#define AF_LOG( x ) printf x #else -# define AF_LOG( x ) do ; while ( 0 ) /* nothing */ +#define AF_LOG( x ) do ; while ( 0 ) /* nothing */ #endif /* AF_DEBUG */ - /**************************************************************************/ - /**************************************************************************/ - /***** *****/ - /***** U T I L I T Y *****/ - /***** *****/ - /**************************************************************************/ - /**************************************************************************/ - typedef struct AF_WidthRec_ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** U T I L I T Y S T U F F *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + typedef struct AF_WidthRec_ { FT_Pos org; /* original position/width in font units */ FT_Pos cur; /* current/scaled position/width in device sub-pixels */ @@ -48,99 +86,97 @@ FT_BEGIN_HEADER FT_LOCAL( void ) - af_sort_pos( FT_UInt count, - FT_Pos* table ); + af_sort_pos( FT_UInt count, + FT_Pos* table ); FT_LOCAL( void ) af_sort_widths( FT_UInt count, AF_Width widths ); - /**************************************************************************/ - /**************************************************************************/ - /***** *****/ - /***** A N G L E T Y P E S *****/ - /***** *****/ - /**************************************************************************/ - /**************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** A N G L E T Y P E S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ - /* - * Angle type. The auto-fitter doesn't need a very high angular accuracy, - * and this allows us to speed up some computations considerably with a - * light Cordic algorithm (see afangles.c) - * - */ + /* + * The auto-fitter doesn't need a very high angular accuracy; + * this allows us to speed up some computations considerably with a + * light Cordic algorithm (see afangles.c). + */ - typedef FT_Int AF_Angle; + typedef FT_Int AF_Angle; -#define AF_ANGLE_PI 128 -#define AF_ANGLE_2PI (AF_ANGLE_PI*2) -#define AF_ANGLE_PI2 (AF_ANGLE_PI/2) -#define AF_ANGLE_PI4 (AF_ANGLE_PI/4) - /* - * compute the angle of a given 2-D vector - * - */ +#define AF_ANGLE_PI 256 +#define AF_ANGLE_2PI ( AF_ANGLE_PI * 2 ) +#define AF_ANGLE_PI2 ( AF_ANGLE_PI / 2 ) +#define AF_ANGLE_PI4 ( AF_ANGLE_PI / 4 ) + + + /* + * compute the angle of a given 2-D vector + */ FT_LOCAL( AF_Angle ) af_angle_atan( FT_Pos dx, FT_Pos dy ); - /* - * computes "angle2 - angle1", the result is always within - * the range [ -AF_ANGLE_PI .. AF_ANGLE_PI-1 ] - * - */ + /* + * compute `angle2 - angle1'; the result is always within + * the range [-AF_ANGLE_PI .. AF_ANGLE_PI - 1] + */ FT_LOCAL( AF_Angle ) af_angle_diff( AF_Angle angle1, AF_Angle angle2 ); - /**************************************************************************/ - /**************************************************************************/ - /***** *****/ - /***** O U T L I N E S *****/ - /***** *****/ - /**************************************************************************/ - /**************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** O U T L I N E S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ - /* opaque handle to glyph-specific hints. see "afhints.h" for more - * details - */ - typedef struct AF_GlyphHintsRec_* AF_GlyphHints; + /* opaque handle to glyph-specific hints -- see `afhints.h' for more + * details + */ + typedef struct AF_GlyphHintsRec_* AF_GlyphHints; - /* this structure is used to model an input glyph outline to - * the auto-hinter. The latter will set the "hints" field - * depending on the glyph's script - */ - typedef struct AF_OutlineRec_ + /* This structure is used to model an input glyph outline to + * the auto-hinter. The latter will set the `hints' field + * depending on the glyph's script. + */ + typedef struct AF_OutlineRec_ { - FT_Face face; - FT_Outline outline; - FT_UInt outline_resolution; + FT_Face face; + FT_Outline outline; + FT_UInt outline_resolution; - FT_Int advance; - FT_UInt metrics_resolution; + FT_Int advance; + FT_UInt metrics_resolution; - AF_GlyphHints hints; + AF_GlyphHints hints; } AF_OutlineRec; - /**************************************************************************/ - /**************************************************************************/ - /***** *****/ - /***** S C A L E R S *****/ - /***** *****/ - /**************************************************************************/ - /**************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** S C A L E R S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ - /* - * A scaler models the target pixel device that will receive the - * auto-hinted glyph image - * - */ + /* + * A scaler models the target pixel device that will receive the + * auto-hinted glyph image. + */ typedef enum { @@ -151,104 +187,116 @@ FT_BEGIN_HEADER } AF_ScalerFlags; - typedef struct AF_ScalerRec_ + typedef struct AF_ScalerRec_ { - FT_Face face; /* source font face */ - FT_Fixed x_scale; /* from font units to 1/64th device pixels */ - FT_Fixed y_scale; /* from font units to 1/64th device pixels */ - FT_Pos x_delta; /* in 1/64th device pixels */ - FT_Pos y_delta; /* in 1/64th device pixels */ - FT_Render_Mode render_mode; /* monochrome, anti-aliased, LCD, etc.. */ - FT_UInt32 flags; /* additionnal control flags, see above */ + FT_Face face; /* source font face */ + FT_Fixed x_scale; /* from font units to 1/64th device pixels */ + FT_Fixed y_scale; /* from font units to 1/64th device pixels */ + FT_Pos x_delta; /* in 1/64th device pixels */ + FT_Pos y_delta; /* in 1/64th device pixels */ + FT_Render_Mode render_mode; /* monochrome, anti-aliased, LCD, etc. */ + FT_UInt32 flags; /* additional control flags, see above */ } AF_ScalerRec, *AF_Scaler; +#define AF_SCALER_EQUAL_SCALES( a, b ) \ + ( (a)->x_scale == (b)->x_scale && \ + (a)->y_scale == (b)->y_scale && \ + (a)->x_delta == (b)->x_delta && \ + (a)->y_delta == (b)->y_delta ) - /**************************************************************************/ - /**************************************************************************/ - /***** *****/ - /***** S C R I P T S *****/ - /***** *****/ - /**************************************************************************/ - /**************************************************************************/ - /* - * the list of know scripts. Each different script correspond to the - * following information: - * - * - a set of Unicode ranges to test weither the face supports the - * script - * - * - a specific global analyzer that will compute global metrics - * specific to the script. - * - * - a specific glyph analyzer that will compute segments and - * edges for each glyph covered by the script - * - * - a specific grid-fitting algorithm that will distort the - * scaled glyph outline according to the results of the glyph - * analyzer - * - * note that a given analyzer and/or grid-fitting algorithm can be - * used by more than one script - */ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** S C R I P T S *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* + * The list of know scripts. Each different script corresponds to the + * following information: + * + * - A set of Unicode ranges to test whether the face supports the + * script. + * + * - A specific global analyzer that will compute global metrics + * specific to the script. + * + * - A specific glyph analyzer that will compute segments and + * edges for each glyph covered by the script. + * + * - A specific grid-fitting algorithm that will distort the + * scaled glyph outline according to the results of the glyph + * analyzer. + * + * Note that a given analyzer and/or grid-fitting algorithm can be + * used by more than one script. + */ + typedef enum { AF_SCRIPT_NONE = 0, AF_SCRIPT_LATIN = 1, - /* add new scripts here. don't forget to update the list in "afglobal.c" */ + /* add new scripts here. Don't forget to update the list in */ + /* `afglobal.c'. */ AF_SCRIPT_MAX /* do not remove */ } AF_Script; - typedef struct AF_ScriptClassRec_ const* AF_ScriptClass; - typedef struct AF_ScriptMetricsRec_ + typedef struct AF_ScriptMetricsRec_ { - AF_ScriptClass clazz; - AF_ScalerRec scaler; + AF_ScriptClass clazz; + AF_ScalerRec scaler; } AF_ScriptMetricsRec, *AF_ScriptMetrics; - /* this function parses a FT_Face to compute global metrics for - * a specific script - */ - typedef FT_Error (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics metrics, - FT_Face face ); + /* This function parses an FT_Face to compute global metrics for + * a specific script. + */ + typedef FT_Error + (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics metrics, + FT_Face face ); - typedef void (*AF_Script_ScaleMetricsFunc)( AF_ScriptMetrics metrics, - AF_Scaler scaler ); + typedef void + (*AF_Script_ScaleMetricsFunc)( AF_ScriptMetrics metrics, + AF_Scaler scaler ); - typedef void (*AF_Script_DoneMetricsFunc)( AF_ScriptMetrics metrics ); + typedef void + (*AF_Script_DoneMetricsFunc)( AF_ScriptMetrics metrics ); - typedef FT_Error (*AF_Script_InitHintsFunc)( AF_GlyphHints hints, - FT_Outline* outline, - AF_ScriptMetrics metrics ); + typedef FT_Error + (*AF_Script_InitHintsFunc)( AF_GlyphHints hints, + AF_ScriptMetrics metrics ); - typedef void (*AF_Script_ApplyHintsFunc)( AF_GlyphHints hints, - FT_Outline* outline, - AF_ScriptMetrics metrics ); + typedef void + (*AF_Script_ApplyHintsFunc)( AF_GlyphHints hints, + FT_Outline* outline, + AF_ScriptMetrics metrics ); - typedef struct AF_Script_UniRangeRec_ + typedef struct AF_Script_UniRangeRec_ { - FT_UInt32 first; - FT_UInt32 last; + FT_UInt32 first; + FT_UInt32 last; } AF_Script_UniRangeRec; - typedef const AF_Script_UniRangeRec * AF_Script_UniRange; + typedef const AF_Script_UniRangeRec *AF_Script_UniRange; - typedef struct AF_ScriptClassRec_ + + typedef struct AF_ScriptClassRec_ { AF_Script script; - AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ + AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ FT_UInt script_metrics_size; AF_Script_InitMetricsFunc script_metrics_init; @@ -266,3 +314,6 @@ FT_BEGIN_HEADER FT_END_HEADER #endif /* __AFTYPES_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/autofit/autofit.c b/src/libs/freetype2/autofit/autofit.c index c258e0d7aa..2d58682ce8 100644 --- a/src/libs/freetype2/autofit/autofit.c +++ b/src/libs/freetype2/autofit/autofit.c @@ -1,3 +1,21 @@ +/***************************************************************************/ +/* */ +/* autofit.c */ +/* */ +/* Auto-fitter module (body). */ +/* */ +/* Copyright 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> #include "afangles.c" @@ -7,3 +25,6 @@ #include "aflatin.c" #include "afloader.c" #include "afmodule.c" + + +/* END */ diff --git a/src/libs/freetype2/autofit/module.mk b/src/libs/freetype2/autofit/module.mk new file mode 100644 index 0000000000..aa19380fbb --- /dev/null +++ b/src/libs/freetype2/autofit/module.mk @@ -0,0 +1,22 @@ +# +# FreeType 2 auto-fitter module definition +# + + +# Copyright 2003, 2004, 2005 by +# David Turner, Robert Wilhelm, and Werner Lemberg. +# +# This file is part of the FreeType project, and may only be used, modified, +# and distributed under the terms of the FreeType project license, +# LICENSE.TXT. By continuing to use, modify, or distribute this file you +# indicate that you have read the license and understand and accept it +# fully. + + +make_module_list: add_autofit_module + +add_autofit_module: + $(OPEN_DRIVER)autofit_module_class$(CLOSE_DRIVER) + $(ECHO_DRIVER)autofit $(ECHO_DRIVER_DESC)automatic hinting module$(ECHO_DRIVER_DONE) + +# EOF diff --git a/src/libs/freetype2/autofit/rules.mk b/src/libs/freetype2/autofit/rules.mk new file mode 100644 index 0000000000..7f7ff99759 --- /dev/null +++ b/src/libs/freetype2/autofit/rules.mk @@ -0,0 +1,75 @@ +# +# FreeType 2 auto-fitter module configuration rules +# + + +# Copyright 2003, 2004, 2005 by +# David Turner, Robert Wilhelm, and Werner Lemberg. +# +# This file is part of the FreeType project, and may only be used, modified, +# and distributed under the terms of the FreeType project license, +# LICENSE.TXT. By continuing to use, modify, or distribute this file you +# indicate that you have read the license and understand and accept it +# fully. + + +# AUTOF driver directory +# +AUTOF_DIR := $(SRC_DIR)/autofit + + +# compilation flags for the driver +# +AUTOF_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(AUTOF_DIR)) + + +# AUTOF driver sources (i.e., C files) +# +AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ + $(AUTOF_DIR)/afdummy.c \ + $(AUTOF_DIR)/afglobal.c \ + $(AUTOF_DIR)/afhints.c \ + $(AUTOF_DIR)/aflatin.c \ + $(AUTOF_DIR)/afloader.c \ + $(AUTOF_DIR)/afmodule.c + +# AUTOF driver headers +# +AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ + $(AUTOF_DIR)/aftypes.h \ + $(AUTOF_DIR)/aferrors.h + + +# AUTOF driver object(s) +# +# AUTOF_DRV_OBJ_M is used during `multi' builds. +# AUTOF_DRV_OBJ_S is used during `single' builds. +# +AUTOF_DRV_OBJ_M := $(AUTOF_DRV_SRC:$(AUTOF_DIR)/%.c=$(OBJ_DIR)/%.$O) +AUTOF_DRV_OBJ_S := $(OBJ_DIR)/autofit.$O + +# AUTOF driver source file for single build +# +AUTOF_DRV_SRC_S := $(AUTOF_DIR)/autofit.c + + +# AUTOF driver - single object +# +$(AUTOF_DRV_OBJ_S): $(AUTOF_DRV_SRC_S) $(AUTOF_DRV_SRC) \ + $(FREETYPE_H) $(AUTOF_DRV_H) + $(AUTOF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(AUTOF_DRV_SRC_S)) + + +# AUTOF driver - multiple objects +# +$(OBJ_DIR)/%.$O: $(AUTOF_DIR)/%.c $(FREETYPE_H) $(AUTOF_DRV_H) + $(AUTOF_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + +# update main driver object lists +# +DRV_OBJS_S += $(AUTOF_DRV_OBJ_S) +DRV_OBJS_M += $(AUTOF_DRV_OBJ_M) + + +# EOF diff --git a/src/libs/freetype2/base/Jamfile b/src/libs/freetype2/base/Jamfile index 345444ba10..f8bdfc9991 100644 --- a/src/libs/freetype2/base/Jamfile +++ b/src/libs/freetype2/base/Jamfile @@ -25,7 +25,7 @@ UseFreeTypeHeaders ; # FT2_Library $(FT2_LIB) : ftsystem.c ftinit.c ftglyph.c ftmm.c ftbdf.c ftbbox.c ftdebug.c ftxf86.c fttype1.c ftpfr.c - ftstroke.c ftwinfnt.c ; + ftstroke.c ftwinfnt.c ftotval.c ftbitmap.c ; # Add Macintosh-specific file to the library when necessary. # diff --git a/src/libs/freetype2/base/ftbbox.c b/src/libs/freetype2/base/ftbbox.c index f71c9f0dbf..8886995739 100644 --- a/src/libs/freetype2/base/ftbbox.c +++ b/src/libs/freetype2/base/ftbbox.c @@ -4,7 +4,7 @@ /* */ /* FreeType bbox computation (body). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -48,7 +48,7 @@ /* This function is used as a `move_to' and `line_to' emitter during */ /* FT_Outline_Decompose(). It simply records the destination point */ /* in `user->last'; no further computations are necessary since we */ - /* the cbox as the starting bbox which must be refined. */ + /* use the cbox as the starting bbox which must be refined. */ /* */ /* <Input> */ /* to :: A pointer to the destination vector. */ @@ -88,11 +88,14 @@ /* */ /* <Input> */ /* y1 :: The start coordinate. */ + /* */ /* y2 :: The coordinate of the control point. */ + /* */ /* y3 :: The end coordinate. */ /* */ /* <InOut> */ /* min :: The address of the current minimum. */ + /* */ /* max :: The address of the current maximum. */ /* */ static void @@ -102,19 +105,17 @@ FT_Pos* min, FT_Pos* max ) { - if ( y1 <= y3 ) + if ( y1 <= y3 && y2 == y1 ) /* flat arc */ + goto Suite; + + if ( y1 < y3 ) { - if ( y2 == y1 ) /* Flat arc */ - goto Suite; - } - else if ( y1 < y3 ) - { - if ( y2 >= y1 && y2 <= y3 ) /* Ascending arc */ + if ( y2 >= y1 && y2 <= y3 ) /* ascending arc */ goto Suite; } else { - if ( y2 >= y3 && y2 <= y1 ) /* Descending arc */ + if ( y2 >= y3 && y2 <= y1 ) /* descending arc */ { y2 = y1; y1 = y3; @@ -144,6 +145,7 @@ /* */ /* <Input> */ /* control :: A pointer to a control point. */ + /* */ /* to :: A pointer to the destination vector. */ /* */ /* <InOut> */ @@ -165,7 +167,6 @@ /* within the bbox */ if ( CHECK_X( control, user->bbox ) ) - BBox_Conic_Check( user->last.x, control->x, to->x, @@ -173,7 +174,6 @@ &user->bbox.xMax ); if ( CHECK_Y( control, user->bbox ) ) - BBox_Conic_Check( user->last.y, control->y, to->y, @@ -194,19 +194,25 @@ /* <Description> */ /* Finds the extrema of a 1-dimensional cubic Bezier curve and */ /* updates a bounding range. This version uses splitting because we */ - /* don't want to use square roots and extra accuracies. */ + /* don't want to use square roots and extra accuracy. */ /* */ /* <Input> */ /* p1 :: The start coordinate. */ + /* */ /* p2 :: The coordinate of the first control point. */ + /* */ /* p3 :: The coordinate of the second control point. */ + /* */ /* p4 :: The end coordinate. */ /* */ /* <InOut> */ /* min :: The address of the current minimum. */ + /* */ /* max :: The address of the current maximum. */ /* */ + #if 0 + static void BBox_Cubic_Check( FT_Pos p1, FT_Pos p2, @@ -235,17 +241,17 @@ if ( y1 == y4 ) { - if ( y1 == y2 && y1 == y3 ) /* Flat */ + if ( y1 == y2 && y1 == y3 ) /* flat */ goto Test; } else if ( y1 < y4 ) { - if ( y2 >= y1 && y2 <= y4 && y3 >= y1 && y3 <= y4 ) /* Ascending */ + if ( y2 >= y1 && y2 <= y4 && y3 >= y1 && y3 <= y4 ) /* ascending */ goto Test; } else { - if ( y2 >= y4 && y2 <= y1 && y3 >= y4 && y3 <= y1 ) /* Descending */ + if ( y2 >= y4 && y2 <= y1 && y3 >= y4 && y3 <= y1 ) /* descending */ { y2 = y1; y1 = y4; @@ -254,7 +260,7 @@ } } - /* Unknown direction -- split the arc in two */ + /* unknown direction -- split the arc in two */ arc[6] = y4; arc[1] = y1 = ( y1 + y2 ) / 2; arc[5] = y4 = ( y4 + y3 ) / 2; @@ -275,6 +281,7 @@ ; } while ( arc >= stack ); } + #else static void @@ -296,17 +303,19 @@ FT_UNUSED ( y4 ); - /* The polynom is */ - /* */ - /* a*x^3 + 3b*x^2 + 3c*x + d . */ - /* */ - /* However, we also have */ - /* */ - /* dP/dx(u) = 0 , */ - /* */ - /* which implies that */ - /* */ - /* P(u) = b*u^2 + 2c*u + d */ + /* The polynom is */ + /* */ + /* P(x) = a*x^3 + 3b*x^2 + 3c*x + d , */ + /* */ + /* dP/dx = 3a*x^2 + 6b*x + 3c . */ + /* */ + /* However, we also have */ + /* */ + /* dP/dx(u) = 0 , */ + /* */ + /* which implies by subtraction that */ + /* */ + /* P(u) = b*u^2 + 2c*u + d . */ if ( u > 0 && u < 0x10000L ) { @@ -357,72 +366,67 @@ FT_Fixed t; - /* We need to solve "ax^2+2bx+c" here, without floating points! */ + /* We need to solve `ax^2+2bx+c' here, without floating points! */ /* The trick is to normalize to a different representation in order */ /* to use our 16.16 fixed point routines. */ /* */ - /* We compute FT_MulFix(b,b) and FT_MulFix(a,c) after the */ - /* the normalization. These values must fit into a single 16.16 */ - /* value. */ - /* */ - /* We normalize a, b, and c to "8.16" fixed float values to ensure */ - /* that their product is held in a "16.16" value. */ + /* We compute FT_MulFix(b,b) and FT_MulFix(a,c) after normalization. */ + /* These values must fit into a single 16.16 value. */ /* */ + /* We normalize a, b, and c to `8.16' fixed float values to ensure */ + /* that its product is held in a `16.16' value. */ + { FT_ULong t1, t2; int shift = 0; - /* Technical explanation of what's happening there. */ - /* */ - /* The following computation is based on the fact that for */ - /* any value "y", if "n" is the position of the most */ - /* significant bit of "abs(y)" (starting from 0 for the */ - /* least significant bit), then y is in the range */ - /* */ - /* "-2^n..2^n-1" */ - /* */ - /* We want to shift "a", "b" and "c" concurrently in order */ - /* to ensure that they all fit in 8.16 values, which maps */ - /* to the integer range "-2^23..2^23-1". */ - /* */ - /* Necessarily, we need to shift "a", "b" and "c" so that */ - /* the most significant bit of their absolute values is at */ - /* _most_ at position 23. */ - /* */ - /* We begin by computing "t1" as the bitwise "or" of the */ - /* absolute values of "a", "b", "c". */ - /* */ - t1 = (FT_ULong)((a >= 0) ? a : -a ); - t2 = (FT_ULong)((b >= 0) ? b : -b ); + /* The following computation is based on the fact that for */ + /* any value `y', if `n' is the position of the most */ + /* significant bit of `abs(y)' (starting from 0 for the */ + /* least significant bit), then `y' is in the range */ + /* */ + /* -2^n..2^n-1 */ + /* */ + /* We want to shift `a', `b', and `c' concurrently in order */ + /* to ensure that they all fit in 8.16 values, which maps */ + /* to the integer range `-2^23..2^23-1'. */ + /* */ + /* Necessarily, we need to shift `a', `b', and `c' so that */ + /* the most significant bit of its absolute values is at */ + /* _most_ at position 23. */ + /* */ + /* We begin by computing `t1' as the bitwise `OR' of the */ + /* absolute values of `a', `b', `c'. */ + + t1 = (FT_ULong)( ( a >= 0 ) ? a : -a ); + t2 = (FT_ULong)( ( b >= 0 ) ? b : -b ); t1 |= t2; - t2 = (FT_ULong)((c >= 0) ? c : -c ); + t2 = (FT_ULong)( ( c >= 0 ) ? c : -c ); t1 |= t2; - /* Now, the most significant bit of "t1" is sure to be the */ - /* msb of one of "a", "b", "c", depending on which one is */ - /* expressed in the greatest integer range. */ - /* */ - /* We now compute the "shift", by shifting "t1" as many */ - /* times as necessary to move its msb to position 23. */ - /* */ - /* This corresponds to a value of t1 that is in the range */ - /* 0x40_0000..0x7F_FFFF. */ - /* */ - /* Finally, we shift "a", "b" and "c" by the same amount. */ - /* This ensures that all values are now in the range */ - /* -2^23..2^23, i.e. that they are now expressed as 8.16 */ - /* fixed float numbers. */ - /* */ - /* This also means that we are using 24 bits of precision */ - /* to compute the zeros, independently of the range of */ - /* the original polynom coefficients. */ - /* */ - /* This should ensure reasonably accurate values for the */ - /* zeros. Note that the latter are only expressed with */ - /* 16 bits when computing the extrema (the zeros need to */ - /* be in 0..1 exclusive to be considered part of the arc). */ - /* */ + /* Now we can be sure that the most significant bit of `t1' */ + /* is the most significant bit of either `a', `b', or `c', */ + /* depending on the greatest integer range of the particular */ + /* variable. */ + /* */ + /* Next, we compute the `shift', by shifting `t1' as many */ + /* times as necessary to move its MSB to position 23. This */ + /* corresponds to a value of `t1' that is in the range */ + /* 0x40_0000..0x7F_FFFF. */ + /* */ + /* Finally, we shift `a', `b', and `c' by the same amount. */ + /* This ensures that all values are now in the range */ + /* -2^23..2^23, i.e., they are now expressed as 8.16 */ + /* fixed-float numbers. This also means that we are using */ + /* 24 bits of precision to compute the zeros, independently */ + /* of the range of the original polynomial coefficients. */ + /* */ + /* This algorithm should ensure reasonably accurate values */ + /* for the zeros. Note that they are only expressed with */ + /* 16 bits when computing the extrema (the zeros need to */ + /* be in 0..1 exclusive to be considered part of the arc). */ + if ( t1 == 0 ) /* all coefficients are 0! */ return; @@ -432,10 +436,11 @@ { shift++; t1 >>= 1; + } while ( t1 > 0x7FFFFFUL ); - /* losing some bits of precision, but we use 24 of them */ - /* for the computation anyway. */ + /* this loses some bits of precision, but we use 24 of them */ + /* for the computation anyway */ a >>= shift; b >>= shift; c >>= shift; @@ -446,6 +451,7 @@ { shift++; t1 <<= 1; + } while ( t1 < 0x400000UL ); a <<= shift; @@ -478,7 +484,7 @@ } else { - /* there are two solutions; we need to filter them though */ + /* there are two solutions; we need to filter them */ d = FT_SqrtFixed( (FT_Int32)d ); t = - FT_DivFix( b - d, a ); test_cubic_extrema( y1, y2, y3, y4, t, min, max ); @@ -506,7 +512,9 @@ /* */ /* <Input> */ /* control1 :: A pointer to the first control point. */ + /* */ /* control2 :: A pointer to the second control point. */ + /* */ /* to :: A pointer to the destination vector. */ /* */ /* <InOut> */ @@ -517,7 +525,7 @@ /* */ /* <Note> */ /* In the case of a non-monotonous arc, we don't compute directly */ - /* extremum coordinates, we subdivise instead. */ + /* extremum coordinates, we subdivide instead. */ /* */ static int BBox_Cubic_To( FT_Vector* control1, @@ -530,23 +538,21 @@ if ( CHECK_X( control1, user->bbox ) || CHECK_X( control2, user->bbox ) ) - - BBox_Cubic_Check( user->last.x, - control1->x, - control2->x, - to->x, - &user->bbox.xMin, - &user->bbox.xMax ); + BBox_Cubic_Check( user->last.x, + control1->x, + control2->x, + to->x, + &user->bbox.xMin, + &user->bbox.xMax ); if ( CHECK_Y( control1, user->bbox ) || CHECK_Y( control2, user->bbox ) ) - - BBox_Cubic_Check( user->last.y, - control1->y, - control2->y, - to->y, - &user->bbox.yMin, - &user->bbox.yMax ); + BBox_Cubic_Check( user->last.y, + control1->y, + control2->y, + to->y, + &user->bbox.yMin, + &user->bbox.yMax ); user->last = *to; diff --git a/src/libs/freetype2/base/ftbdf.c b/src/libs/freetype2/base/ftbdf.c index d2f133db77..fec27e2db6 100644 --- a/src/libs/freetype2/base/ftbdf.c +++ b/src/libs/freetype2/base/ftbdf.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (body). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,8 @@ #include FT_SERVICE_BDF_H + /* documentation is in ftbdf.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_BDF_Charset_ID( FT_Face face, const char* *acharset_encoding, @@ -54,6 +56,8 @@ } + /* documentation is in ftbdf.h */ + FT_EXPORT( FT_Error ) FT_Get_BDF_Property( FT_Face face, const char* prop_name, diff --git a/src/libs/freetype2/base/ftbitmap.c b/src/libs/freetype2/base/ftbitmap.c new file mode 100644 index 0000000000..7c95af7fa9 --- /dev/null +++ b/src/libs/freetype2/base/ftbitmap.c @@ -0,0 +1,616 @@ +/***************************************************************************/ +/* */ +/* ftbitmap.c */ +/* */ +/* FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */ +/* bitmaps into 8bpp format (body). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include <ft2build.h> +#include FT_BITMAP_H +#include FT_INTERNAL_OBJECTS_H + + + static + const FT_Bitmap null_bitmap = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + + /* documentation is in ftbitmap.h */ + + FT_EXPORT_DEF( void ) + FT_Bitmap_New( FT_Bitmap *abitmap ) + { + *abitmap = null_bitmap; + } + + + /* documentation is in ftbitmap.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Copy( FT_Library library, + const FT_Bitmap *source, + FT_Bitmap *target) + { + FT_Memory memory = library->memory; + FT_Error error = FT_Err_Ok; + FT_Int pitch = source->pitch; + FT_ULong size; + + + if ( source == target ) + return FT_Err_Ok; + + if ( source->buffer == NULL ) + { + *target = *source; + + return FT_Err_Ok; + } + + if ( pitch < 0 ) + pitch = -pitch; + size = (FT_ULong)( pitch * source->rows ); + + if ( target->buffer ) + { + FT_Int target_pitch = target->pitch; + FT_ULong target_size; + + + if ( target_pitch < 0 ) + target_pitch = -target_pitch; + target_size = (FT_ULong)( target_pitch * target->rows ); + + if ( target_size != size ) + FT_QREALLOC( target->buffer, target_size, size ); + } + else + FT_QALLOC( target->buffer, size ); + + if ( !error ) + { + unsigned char *p; + + + p = target->buffer; + *target = *source; + target->buffer = p; + + FT_MEM_COPY( target->buffer, source->buffer, size ); + } + + return error; + } + + + static FT_Error + ft_bitmap_assure_buffer( FT_Memory memory, + FT_Bitmap* bitmap, + FT_UInt xpixels, + FT_UInt ypixels ) + { + FT_Error error; + int pitch; + int new_pitch; + FT_UInt ppb; + FT_Int i; + unsigned char* buffer; + + + pitch = bitmap->pitch; + if ( pitch < 0 ) + pitch = -pitch; + + switch ( bitmap->pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + ppb = 8; + break; + case FT_PIXEL_MODE_GRAY2: + ppb = 4; + break; + case FT_PIXEL_MODE_GRAY4: + ppb = 2; + break; + case FT_PIXEL_MODE_GRAY: + case FT_PIXEL_MODE_LCD: + case FT_PIXEL_MODE_LCD_V: + ppb = 1; + break; + default: + return FT_Err_Invalid_Glyph_Format; + } + + /* if no need to allocate memory */ + if ( ypixels == 0 && pitch * ppb >= bitmap->width + xpixels ) + { + /* zero the padding */ + for ( i = 0; i < bitmap->rows; i++ ) + { + unsigned char* last_byte; + int bits = xpixels * ( 8 / ppb ); + int mask = 0; + + + last_byte = bitmap->buffer + i * pitch + ( bitmap->width - 1 ) / ppb; + + if ( bits >= 8 ) + { + FT_MEM_ZERO( last_byte + 1, bits / 8 ); + bits %= 8; + } + + if ( bits > 0 ) + { + while ( bits-- > 0 ) + mask |= 1 << bits; + + *last_byte &= ~mask; + } + } + + return FT_Err_Ok; + } + + new_pitch = ( bitmap->width + xpixels + ppb - 1 ) / ppb; + + if ( FT_ALLOC( buffer, new_pitch * ( bitmap->rows + ypixels ) ) ) + return error; + + if ( bitmap->pitch > 0 ) + { + for ( i = 0; i < bitmap->rows; i++ ) + FT_MEM_COPY( buffer + new_pitch * ( ypixels + i ), + bitmap->buffer + pitch * i, pitch ); + } + else + { + for ( i = 0; i < bitmap->rows; i++ ) + FT_MEM_COPY( buffer + new_pitch * i, + bitmap->buffer + pitch * i, pitch ); + } + + FT_FREE( bitmap->buffer ); + bitmap->buffer = buffer; + + if ( bitmap->pitch < 0 ) + new_pitch = -new_pitch; + + /* set pitch only */ + bitmap->pitch = new_pitch; + + return FT_Err_Ok; + } + + + /* documentation is in ftbitmap.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Embolden( FT_Library library, + FT_Bitmap* bitmap, + FT_Pos xStrength, + FT_Pos yStrength ) + { + FT_Error error; + unsigned char* p; + FT_Int i, x, y, pitch; + FT_Int xstr, ystr; + + + if ( !library ) + return FT_Err_Invalid_Library_Handle; + + if ( !bitmap || !bitmap->buffer ) + return FT_Err_Invalid_Argument; + + xstr = FT_PIX_ROUND( xStrength ) >> 6; + ystr = FT_PIX_ROUND( yStrength ) >> 6; + + if ( xstr == 0 && ystr == 0 ) + return FT_Err_Ok; + else if ( xstr < 0 || ystr < 0 ) + return FT_Err_Invalid_Argument; + + switch ( bitmap->pixel_mode ) + { + case FT_PIXEL_MODE_GRAY2: + case FT_PIXEL_MODE_GRAY4: + { + FT_Bitmap tmp; + FT_Int align; + + + if ( bitmap->pixel_mode == FT_PIXEL_MODE_GRAY2 ) + align = ( bitmap->width + xstr + 3 ) / 4; + else + align = ( bitmap->width + xstr + 1 ) / 2; + + FT_Bitmap_New( &tmp ); + error = FT_Bitmap_Convert( library, bitmap, &tmp, align ); + + if ( error ) + return error; + + FT_Bitmap_Done( library, bitmap ); + *bitmap = tmp; + } + break; + + case FT_PIXEL_MODE_MONO: + if ( xstr > 8 ) + xstr = 8; + break; + + case FT_PIXEL_MODE_LCD: + xstr *= 3; + break; + + case FT_PIXEL_MODE_LCD_V: + ystr *= 3; + break; + } + + error = ft_bitmap_assure_buffer( library->memory, bitmap, xstr, ystr ); + if ( error ) + return error; + + pitch = bitmap->pitch; + if ( pitch > 0 ) + p = bitmap->buffer + pitch * ystr; + else + { + pitch = -pitch; + p = bitmap->buffer + pitch * ( bitmap->rows - 1 ); + } + + /* for each row */ + for ( y = 0; y < bitmap->rows ; y++ ) + { + /* + * Horizontally: + * + * From the last pixel on, make each pixel or'ed with the + * `xstr' pixels before it. + */ + for ( x = pitch - 1; x >= 0; x-- ) + { + unsigned char tmp; + + + tmp = p[x]; + for ( i = 1; i <= xstr; i++ ) + { + if ( bitmap->pixel_mode == FT_PIXEL_MODE_MONO ) + { + p[x] |= tmp >> i; + + /* the maximum value of 8 for `xstr' comes from here */ + if ( x > 0 ) + p[x] |= p[x - 1] << ( 8 - i ); + +#if 0 + if ( p[x] == 0xff ) + break; +#endif + } + else + { + if ( x - i >= 0 ) + { + if ( p[x] + p[x - i] > bitmap->num_grays - 1 ) + { + p[x] = bitmap->num_grays - 1; + break; + } + else + { + p[x] += p[x - i]; + if ( p[x] == bitmap->num_grays - 1 ) + break; + } + } + else + break; + } + } + } + + /* + * Vertically: + * + * Make the above `ystr' rows or'ed with it. + */ + for ( x = 1; x <= ystr; x++ ) + { + unsigned char* q; + + + q = p - bitmap->pitch * x; + for ( i = 0; i < pitch; i++ ) + q[i] |= p[i]; + } + + p += bitmap->pitch; + } + + bitmap->width += xstr; + bitmap->rows += ystr; + + return FT_Err_Ok; + } + + + /* documentation is in ftbitmap.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Convert( FT_Library library, + const FT_Bitmap *source, + FT_Bitmap *target, + FT_Int alignment ) + { + FT_Error error = FT_Err_Ok; + FT_Memory memory; + + + if ( !library ) + return FT_Err_Invalid_Library_Handle; + + memory = library->memory; + + switch ( source->pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + case FT_PIXEL_MODE_GRAY: + case FT_PIXEL_MODE_GRAY2: + case FT_PIXEL_MODE_GRAY4: + { + FT_Int pad; + FT_Long old_size; + + + old_size = target->rows * target->pitch; + if ( old_size < 0 ) + old_size = -old_size; + + target->pixel_mode = FT_PIXEL_MODE_GRAY; + target->rows = source->rows; + target->width = source->width; + + pad = 0; + if ( alignment > 0 ) + { + pad = source->width % alignment; + if ( pad != 0 ) + pad = alignment - pad; + } + + target->pitch = source->width + pad; + + if ( target->rows * target->pitch > old_size && + FT_QREALLOC( target->buffer, + old_size, target->rows * target->pitch ) ) + return error; + } + break; + + default: + error = FT_Err_Invalid_Argument; + } + + switch ( source->pixel_mode ) + { + case FT_PIXEL_MODE_MONO: + { + FT_Byte* s = source->buffer; + FT_Byte* t = target->buffer; + FT_Int i; + + + target->num_grays = 2; + + for ( i = source->rows; i > 0; i-- ) + { + FT_Byte* ss = s; + FT_Byte* tt = t; + FT_Int j; + + + /* get the full bytes */ + for ( j = source->width >> 3; j > 0; j-- ) + { + FT_Int val = ss[0]; /* avoid a byte->int cast on each line */ + + + tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 ); + tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 ); + tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 ); + tt[3] = (FT_Byte)( ( val & 0x10 ) >> 4 ); + tt[4] = (FT_Byte)( ( val & 0x08 ) >> 3 ); + tt[5] = (FT_Byte)( ( val & 0x04 ) >> 2 ); + tt[6] = (FT_Byte)( ( val & 0x02 ) >> 1 ); + tt[7] = (FT_Byte)( val & 0x01 ); + + tt += 8; + ss += 1; + } + + /* get remaining pixels (if any) */ + j = source->width & 7; + if ( j > 0 ) + { + FT_Int val = *ss; + + + for ( ; j > 0; j-- ) + { + tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7); + val <<= 1; + tt += 1; + } + } + + s += source->pitch; + t += target->pitch; + } + } + break; + + + case FT_PIXEL_MODE_GRAY: + { + FT_Int width = source->width; + FT_Byte* s = source->buffer; + FT_Byte* t = target->buffer; + FT_Int s_pitch = source->pitch; + FT_Int t_pitch = target->pitch; + FT_Int i; + + + target->num_grays = 256; + + for ( i = source->rows; i > 0; i-- ) + { + FT_ARRAY_COPY( t, s, width ); + + s += s_pitch; + t += t_pitch; + } + } + break; + + + case FT_PIXEL_MODE_GRAY2: + { + FT_Byte* s = source->buffer; + FT_Byte* t = target->buffer; + FT_Int i; + + + target->num_grays = 4; + + for ( i = source->rows; i > 0; i-- ) + { + FT_Byte* ss = s; + FT_Byte* tt = t; + FT_Int j; + + + /* get the full bytes */ + for ( j = source->width >> 2; j > 0; j-- ) + { + FT_Int val = ss[0]; + + + tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 ); + tt[1] = (FT_Byte)( ( val & 0x30 ) >> 4 ); + tt[2] = (FT_Byte)( ( val & 0x0C ) >> 2 ); + tt[3] = (FT_Byte)( ( val & 0x03 ) ); + + ss += 1; + tt += 4; + } + + j = source->width & 3; + if ( j > 0 ) + { + FT_Int val = ss[0]; + + + for ( ; j > 0; j-- ) + { + tt[0] = (FT_Byte)( ( val & 0xC0 ) >> 6 ); + val <<= 2; + tt += 1; + } + } + + s += source->pitch; + t += target->pitch; + } + } + break; + + + case FT_PIXEL_MODE_GRAY4: + { + FT_Byte* s = source->buffer; + FT_Byte* t = target->buffer; + FT_Int i; + + + target->num_grays = 16; + + for ( i = source->rows; i > 0; i-- ) + { + FT_Byte* ss = s; + FT_Byte* tt = t; + FT_Int j; + + + /* get the full bytes */ + for ( j = source->width >> 1; j > 0; j-- ) + { + FT_Int val = ss[0]; + + + tt[0] = (FT_Byte)( ( val & 0xF0 ) >> 4 ); + tt[1] = (FT_Byte)( ( val & 0x0F ) ); + + ss += 1; + tt += 2; + } + + if ( source->width & 1 ) + tt[0] = (FT_Byte)( ( ss[0] & 0xF0 ) >> 4 ); + + s += source->pitch; + t += target->pitch; + } + } + break; + + + default: + ; + } + + return error; + } + + + /* documentation is in ftbitmap.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Bitmap_Done( FT_Library library, + FT_Bitmap *bitmap ) + { + FT_Memory memory; + + + if ( !library ) + return FT_Err_Invalid_Library_Handle; + + if ( !bitmap ) + return FT_Err_Invalid_Argument; + + memory = library->memory; + + FT_FREE( bitmap->buffer ); + *bitmap = null_bitmap; + + return FT_Err_Ok; + } + + +/* END */ diff --git a/src/libs/freetype2/base/ftcalc.c b/src/libs/freetype2/base/ftcalc.c index f169642e0b..6e19e55f34 100644 --- a/src/libs/freetype2/base/ftcalc.c +++ b/src/libs/freetype2/base/ftcalc.c @@ -586,7 +586,7 @@ #endif /* FT_LONG64 */ - /* a not-so-fast but working 16.16 fixed point square root function */ + /* documentation is in ftcalc.h */ FT_EXPORT_DEF( FT_Int32 ) FT_SqrtFixed( FT_Int32 x ) diff --git a/src/libs/freetype2/base/ftdbgmem.c b/src/libs/freetype2/base/ftdbgmem.c index 152220c605..2442a41c48 100644 --- a/src/libs/freetype2/base/ftdbgmem.c +++ b/src/libs/freetype2/base/ftdbgmem.c @@ -4,7 +4,7 @@ /* */ /* Memory debugger (body). */ /* */ -/* Copyright 2001, 2002, 2003, 2004 by */ +/* Copyright 2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,28 +27,69 @@ #ifdef FT_DEBUG_MEMORY +#define KEEPALIVE /* `Keep alive' means that freed blocks aren't released + * to the heap. This is useful to detect double-frees + * or weird heap corruption, but it uses large amounts of + * memory, however. + */ #include <stdio.h> #include <stdlib.h> - typedef struct FT_MemNodeRec_* FT_MemNode; - typedef struct FT_MemTableRec_* FT_MemTable; + extern void + FT_DumpMemory( FT_Memory memory ); + + + typedef struct FT_MemSourceRec_* FT_MemSource; + typedef struct FT_MemNodeRec_* FT_MemNode; + typedef struct FT_MemTableRec_* FT_MemTable; + #define FT_MEM_VAL( addr ) ((FT_ULong)(FT_Pointer)( addr )) + + typedef struct FT_MemSourceRec_ + { + const char* file_name; + long line_no; + + FT_Long cur_blocks; /* current number of allocated blocks */ + FT_Long max_blocks; /* max. number of allocated blocks */ + FT_Long all_blocks; /* total number of blocks allocated */ + + FT_Long cur_size; /* current cumulative allocated size */ + FT_Long max_size; /* maximum cumulative allocated size */ + FT_Long all_size; /* total cumulative allocated size */ + + FT_Long cur_max; /* current maximum allocated size */ + + FT_UInt32 hash; + FT_MemSource link; + + } FT_MemSourceRec; + + +/* + * We don't need a resizable array for the memory sources, because + * their number is pretty limited within FreeType. + */ +#define FT_MEM_SOURCE_BUCKETS 128 + + typedef struct FT_MemNodeRec_ { - FT_Byte* address; - FT_Long size; /* < 0 if the block was freed */ + FT_Byte* address; + FT_Long size; /* < 0 if the block was freed */ - const char* alloc_file_name; - FT_Long alloc_line_no; + FT_MemSource source; - const char* free_file_name; - FT_Long free_line_no; +#ifdef KEEPALIVE + const char* free_file_name; + FT_Long free_line_no; +#endif - FT_MemNode link; + FT_MemNode link; } FT_MemNodeRec; @@ -64,15 +105,19 @@ FT_ULong alloc_max; FT_ULong alloc_count; - FT_Bool bound_total; + FT_Bool bound_total; FT_ULong alloc_total_max; - + FT_Bool bound_count; FT_ULong alloc_count_max; + FT_MemSource sources[FT_MEM_SOURCE_BUCKETS]; + const char* file_name; FT_Long line_no; + FT_Bool keep_alive; + FT_Memory memory; FT_Pointer memory_user; FT_Alloc_Func alloc; @@ -88,6 +133,10 @@ #define FT_FILENAME( x ) ((x) ? (x) : "unknown file") + /* + * Prime numbers are ugly to handle. It would be better to implement + * L-Hashing, which is 10% faster and doesn't require divisions. + */ static const FT_UInt ft_mem_primes[] = { 7, @@ -128,24 +177,6 @@ }; - - extern void - ft_mem_debug_panic( const char* fmt, ... ) - { - va_list ap; - - - printf( "FreeType.Debug: " ); - - va_start( ap, fmt ); - vprintf( fmt, ap ); - va_end( ap ); - - printf( "\n" ); - exit( EXIT_FAILURE ); - } - - static FT_ULong ft_mem_closest_prime( FT_ULong num ) { @@ -161,6 +192,24 @@ } + extern void + ft_mem_debug_panic( const char* fmt, + ... ) + { + va_list ap; + + + printf( "FreeType.Debug: " ); + + va_start( ap, fmt ); + vprintf( fmt, ap ); + va_end( ap ); + + printf( "\n" ); + exit( EXIT_FAILURE ); + } + + static FT_Pointer ft_mem_table_alloc( FT_MemTable table, FT_Long size ) @@ -199,17 +248,17 @@ new_size = ft_mem_closest_prime( table->nodes ); if ( new_size != table->size ) { - FT_MemNode* new_buckets ; + FT_MemNode* new_buckets; FT_ULong i; new_buckets = (FT_MemNode *) - ft_mem_table_alloc( table, - new_size * sizeof ( FT_MemNode ) ); + ft_mem_table_alloc( table, + new_size * sizeof ( FT_MemNode ) ); if ( new_buckets == NULL ) return; - FT_MEM_ZERO( new_buckets, sizeof ( FT_MemNode ) * new_size ); + FT_ARRAY_ZERO( new_buckets, new_size ); for ( i = 0; i < table->size; i++ ) { @@ -250,7 +299,7 @@ if ( table == NULL ) goto Exit; - FT_MEM_ZERO( table, sizeof ( *table ) ); + FT_ZERO( table ); table->size = FT_MEM_SIZE_MIN; table->nodes = 0; @@ -264,10 +313,10 @@ table->free = memory->free; table->buckets = (FT_MemNode *) - memory->alloc( memory, - table->size * sizeof ( FT_MemNode ) ); + memory->alloc( memory, + table->size * sizeof ( FT_MemNode ) ); if ( table->buckets ) - FT_MEM_ZERO( table->buckets, sizeof ( FT_MemNode ) * table->size ); + FT_ARRAY_ZERO( table->buckets, table->size ); else { memory->free( memory, table ); @@ -285,12 +334,14 @@ FT_ULong i; + FT_DumpMemory( table->memory ); + if ( table ) { FT_Long leak_count = 0; FT_ULong leaks = 0; - + /* remove all blocks from the table, revealing leaked ones */ for ( i = 0; i < table->size; i++ ) { FT_MemNode *pnode = table->buckets + i, next, node = *pnode; @@ -306,8 +357,8 @@ printf( "leaked memory block at address %p, size %8ld in (%s:%ld)\n", node->address, node->size, - FT_FILENAME( node->alloc_file_name ), - node->alloc_line_no ); + FT_FILENAME( node->source->file_name ), + node->source->line_no ); leak_count++; leaks += node->size; @@ -318,28 +369,45 @@ node->address = NULL; node->size = 0; - free( node ); + ft_mem_table_free( table, node ); node = next; } table->buckets[i] = 0; } + ft_mem_table_free( table, table->buckets ); table->buckets = NULL; table->size = 0; table->nodes = 0; + /* remove all sources */ + for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ ) + { + FT_MemSource source, next; + + + for ( source = table->sources[i]; source != NULL; source = next ) + { + next = source->link; + ft_mem_table_free( table, source ); + } + + table->sources[i] = NULL; + } + printf( "FreeType: total memory allocations = %ld\n", table->alloc_total ); printf( "FreeType: maximum memory footprint = %ld\n", table->alloc_max ); - free( table ); + ft_mem_table_free( table, table ); if ( leak_count > 0 ) ft_mem_debug_panic( "FreeType: %ld bytes of memory leaked in %ld blocks\n", leaks, leak_count ); + printf( "FreeType: No memory leaks detected!\n" ); } } @@ -371,6 +439,57 @@ } + static FT_MemSource + ft_mem_table_get_source( FT_MemTable table ) + { + FT_UInt32 hash; + FT_MemSource node, *pnode; + + + hash = (FT_UInt32)(void*)table->file_name + + (FT_UInt32)( 5 * table->line_no ); + pnode = &table->sources[hash % FT_MEM_SOURCE_BUCKETS]; + + for ( ;; ) + { + node = *pnode; + if ( node == NULL ) + break; + + if ( node->file_name == table->file_name && + node->line_no == table->line_no ) + goto Exit; + + pnode = &node->link; + } + + node = (FT_MemSource)ft_mem_table_alloc( table, sizeof ( *node ) ); + if ( node == NULL ) + ft_mem_debug_panic( + "not enough memory to perform memory debugging\n" ); + + node->file_name = table->file_name; + node->line_no = table->line_no; + + node->cur_blocks = 0; + node->max_blocks = 0; + node->all_blocks = 0; + + node->cur_size = 0; + node->max_size = 0; + node->all_size = 0; + + node->cur_max = 0; + + node->link = NULL; + node->hash = hash; + *pnode = node; + + Exit: + return node; + } + + static void ft_mem_table_set( FT_MemTable table, FT_Byte* address, @@ -381,23 +500,32 @@ if ( table ) { + FT_MemSource source; + + pnode = ft_mem_table_get_nodep( table, address ); node = *pnode; if ( node ) { if ( node->size < 0 ) { - /* this block was already freed. This means that our memory is */ - /* now completely corrupted! */ + /* This block was already freed. Our memory is now completely */ + /* corrupted! */ + /* This can only happen in keep-alive mode. */ ft_mem_debug_panic( "memory heap corrupted (allocating freed block)" ); } else { - /* this block was already allocated. This means that our memory */ + /* This block was already allocated. This means that our memory */ /* is also corrupted! */ ft_mem_debug_panic( - "memory heap corrupted (re-allocating allocated block)" ); + "memory heap corrupted (re-allocating allocated block at" + " %p, of size %ld)\n" + "org=%s:%d new=%s:%d\n", + node->address, node->size, + FT_FILENAME( node->source->file_name ), node->source->line_no, + FT_FILENAME( table->file_name ), table->line_no ); } } @@ -409,8 +537,20 @@ node->address = address; node->size = size; - node->alloc_file_name = table->file_name; - node->alloc_line_no = table->line_no; + node->source = source = ft_mem_table_get_source( table ); + + source->all_blocks++; + source->cur_blocks++; + if ( source->cur_blocks > source->max_blocks ) + source->max_blocks = source->cur_blocks; + + if ( size > (FT_ULong)source->cur_max ) + source->cur_max = size; + + source->all_size += size; + source->cur_size += size; + if ( source->cur_size > source->max_size ) + source->max_size = source->cur_size; node->free_file_name = NULL; node->free_line_no = 0; @@ -445,23 +585,50 @@ node = *pnode; if ( node ) { + FT_MemSource source; + + if ( node->size < 0 ) ft_mem_debug_panic( "freeing memory block at %p more than once at (%s:%ld)\n" "block allocated at (%s:%ld) and released at (%s:%ld)", address, FT_FILENAME( table->file_name ), table->line_no, - FT_FILENAME( node->alloc_file_name ), node->alloc_line_no, + FT_FILENAME( node->source->file_name ), node->source->line_no, FT_FILENAME( node->free_file_name ), node->free_line_no ); - /* we simply invert the node's size to indicate that the node */ - /* was freed. We also change its contents. */ + /* scramble the node's content for additional safety */ FT_MEM_SET( address, 0xF3, node->size ); - table->alloc_current -= node->size; - node->size = -node->size; - node->free_file_name = table->file_name; - node->free_line_no = table->line_no; + + source = node->source; + + source->cur_blocks--; + source->cur_size -= node->size; + + if ( table->keep_alive ) + { + /* we simply invert the node's size to indicate that the node */ + /* was freed. */ + node->size = -node->size; + node->free_file_name = table->file_name; + node->free_line_no = table->line_no; + } + else + { + table->nodes--; + + *pnode = node->link; + + node->size = 0; + node->source = NULL; + + ft_mem_table_free( table, node ); + + if ( table->nodes * 3 < table->size || + table->size * 3 < table->nodes ) + ft_mem_table_resize( table ); + } } else ft_mem_debug_panic( @@ -484,14 +651,14 @@ ft_mem_debug_panic( "negative block size allocation (%ld)", size ); /* return NULL if the maximum number of allocations was reached */ - if ( table->bound_count && + if ( table->bound_count && table->alloc_count >= table->alloc_count_max ) return NULL; /* return NULL if this allocation would overflow the maximum heap size */ - if ( table->bound_total && + if ( table->bound_total && table->alloc_current + (FT_ULong)size > table->alloc_total_max ) - return NULL; + return NULL; block = (FT_Byte *)ft_mem_table_alloc( table, size ); if ( block ) @@ -502,7 +669,7 @@ table->file_name = NULL; table->line_no = 0; - return (FT_Pointer) block; + return (FT_Pointer)block; } @@ -520,7 +687,11 @@ ft_mem_table_remove( table, (FT_Byte*)block ); - /* we never really free the block */ + if ( !table->keep_alive ) + ft_mem_table_free( table, block ); + + table->alloc_count--; + table->file_name = NULL; table->line_no = 0; } @@ -540,16 +711,21 @@ FT_Long line_no = table->line_no; + /* the following is valid according to ANSI C */ +#if 0 if ( block == NULL || cur_size == 0 ) ft_mem_debug_panic( "trying to reallocate NULL in (%s:%ld)", - file_name, line_no ); + file_name, line_no ); +#endif + /* while the following is allowed in ANSI C also, we abort since */ + /* such case should be handled by FreeType. */ if ( new_size <= 0 ) ft_mem_debug_panic( "trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)", block, cur_size, file_name, line_no ); - /* check 'cur_size' value */ + /* check `cur_size' value */ pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block ); node = *pnode; if ( !node ) @@ -595,36 +771,49 @@ if ( table ) { const char* p; - + + memory->user = table; memory->alloc = ft_mem_debug_alloc; memory->realloc = ft_mem_debug_realloc; memory->free = ft_mem_debug_free; - + p = getenv( "FT2_ALLOC_TOTAL_MAX" ); if ( p != NULL ) { - FT_Long total_max = ft_atol(p); - + FT_Long total_max = ft_atol( p ); + + if ( total_max > 0 ) { table->bound_total = 1; - table->alloc_total_max = (FT_ULong) total_max; + table->alloc_total_max = (FT_ULong)total_max; } } - + p = getenv( "FT2_ALLOC_COUNT_MAX" ); if ( p != NULL ) { - FT_Long total_count = ft_atol(p); - + FT_Long total_count = ft_atol( p ); + + if ( total_count > 0 ) { table->bound_count = 1; - table->alloc_count_max = (FT_ULong) total_count; + table->alloc_count_max = (FT_ULong)total_count; } } + p = getenv( "FT2_KEEP_ALIVE" ); + if ( p != NULL ) + { + FT_Long keep_alive = ft_atol( p ); + + + if ( keep_alive > 0 ) + table->keep_alive = 1; + } + result = 1; } } @@ -665,6 +854,7 @@ table->file_name = file_name; table->line_no = line_no; } + return FT_Alloc( memory, size, P ); } @@ -685,10 +875,52 @@ table->file_name = file_name; table->line_no = line_no; } + return FT_Realloc( memory, current, size, P ); } + FT_BASE_DEF( FT_Error ) + FT_QAlloc_Debug( FT_Memory memory, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ) + { + FT_MemTable table = (FT_MemTable)memory->user; + + + if ( table ) + { + table->file_name = file_name; + table->line_no = line_no; + } + + return FT_QAlloc( memory, size, P ); + } + + + FT_BASE_DEF( FT_Error ) + FT_QRealloc_Debug( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *P, + const char* file_name, + FT_Long line_no ) + { + FT_MemTable table = (FT_MemTable)memory->user; + + + if ( table ) + { + table->file_name = file_name; + table->line_no = line_no; + } + + return FT_QRealloc( memory, current, size, P ); + } + + FT_BASE_DEF( void ) FT_Free_Debug( FT_Memory memory, FT_Pointer block, @@ -703,10 +935,95 @@ table->file_name = file_name; table->line_no = line_no; } + FT_Free( memory, (void **)block ); } + static int + ft_mem_source_compare( const void* p1, + const void* p2 ) + { + FT_MemSource s1 = *(FT_MemSource*)p1; + FT_MemSource s2 = *(FT_MemSource*)p2; + + + if ( s2->max_size > s1->max_size ) + return 1; + else if ( s2->max_size < s1->max_size ) + return -1; + else + return 0; + } + + + extern void + FT_DumpMemory( FT_Memory memory ) + { + FT_MemTable table = (FT_MemTable)memory->user; + + + if ( table ) + { + FT_MemSource* bucket = table->sources; + FT_MemSource* limit = bucket + FT_MEM_SOURCE_BUCKETS; + FT_MemSource* sources; + FT_UInt nn, count; + const char* fmt; + + + count = 0; + for ( ; bucket < limit; bucket++ ) + { + FT_MemSource source = *bucket; + + + for ( ; source; source = source->link ) + count++; + } + + sources = (FT_MemSource*)ft_mem_table_alloc( + table, sizeof ( *sources ) * count ); + + count = 0; + for ( bucket = table->sources; bucket < limit; bucket++ ) + { + FT_MemSource source = *bucket; + + + for ( ; source; source = source->link ) + sources[count++] = source; + } + + ft_qsort( sources, count, sizeof ( *sources ), ft_mem_source_compare ); + + printf( "FreeType Memory Dump: " + "current=%ld max=%ld total=%ld count=%ld\n", + table->alloc_current, table->alloc_max, + table->alloc_total, table->alloc_count ); + printf( " block block sizes sizes sizes source\n" ); + printf( " count high sum highsum max location\n" ); + printf( "-------------------------------------------------\n" ); + + fmt = "%6ld %6ld %8ld %8ld %8ld %s:%d\n"; + + for ( nn = 0; nn < count; nn++ ) + { + FT_MemSource source = sources[nn]; + + + printf( fmt, + source->cur_blocks, source->max_blocks, + source->cur_size, source->max_size, source->cur_max, + FT_FILENAME( source->file_name ), + source->line_no ); + } + printf( "------------------------------------------------\n" ); + + ft_mem_table_free( table, sources ); + } + } + #else /* !FT_DEBUG_MEMORY */ /* ANSI C doesn't like empty source files */ diff --git a/src/libs/freetype2/base/ftdebug.c b/src/libs/freetype2/base/ftdebug.c index a6c18412b8..160f20bfa5 100644 --- a/src/libs/freetype2/base/ftdebug.c +++ b/src/libs/freetype2/base/ftdebug.c @@ -48,6 +48,8 @@ #if defined( FT_DEBUG_LEVEL_ERROR ) + /* documentation is in ftdebug.h */ + FT_EXPORT_DEF( void ) FT_Message( const char* fmt, ... ) { @@ -60,6 +62,8 @@ } + /* documentation is in ftdebug.h */ + FT_EXPORT_DEF( void ) FT_Panic( const char* fmt, ... ) { @@ -125,17 +129,17 @@ /* value of the `FT2_DEBUG' environment variable. It must be a list of */ /* toggles, separated by spaces, `;', or `,'. Example: */ /* */ - /* export FT2_DEBUG="any:3 memory:6 stream:5" */ + /* export FT2_DEBUG="any:3 memory:7 stream:5" */ /* */ /* This requests that all levels be set to 3, except the trace level for */ - /* the memory and stream components which are set to 6 and 5, */ + /* the memory and stream components which are set to 7 and 5, */ /* respectively. */ /* */ /* See the file <include/freetype/internal/fttrace.h> for details of the */ /* available toggle names. */ /* */ - /* The level must be between 0 and 6; 0 means quiet (except for serious */ - /* runtime errors), and 6 means _very_ verbose. */ + /* The level must be between 0 and 7; 0 means quiet (except for serious */ + /* runtime errors), and 7 means _very_ verbose. */ /* */ FT_BASE_DEF( void ) ft_debug_init( void ) @@ -189,7 +193,7 @@ if ( *p ) { level = *p++ - '0'; - if ( level < 0 || level > 6 ) + if ( level < 0 || level > 7 ) level = -1; } diff --git a/src/libs/freetype2/base/ftgloadr.c b/src/libs/freetype2/base/ftgloadr.c index 0308f713c8..94a0706733 100644 --- a/src/libs/freetype2/base/ftgloadr.c +++ b/src/libs/freetype2/base/ftgloadr.c @@ -182,14 +182,14 @@ } - /* Ensure that we can add `n_points' and `n_contours' to our glyph. this */ - /* function reallocates its outline tables if necessary. Note that it */ - /* DOESN'T change the number of points within the loader! */ + /* Ensure that we can add `n_points' and `n_contours' to our glyph. */ + /* This function reallocates its outline tables if necessary. Note that */ + /* it DOESN'T change the number of points within the loader! */ /* */ FT_BASE_DEF( FT_Error ) FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader, - FT_UInt n_points, - FT_UInt n_contours ) + FT_UInt n_points, + FT_UInt n_contours ) { FT_Memory memory = loader->memory; FT_Error error = FT_Err_Ok; diff --git a/src/libs/freetype2/base/ftglyph.c b/src/libs/freetype2/base/ftglyph.c index c6c458cc16..af0eadf728 100644 --- a/src/libs/freetype2/base/ftglyph.c +++ b/src/libs/freetype2/base/ftglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,6 +31,7 @@ #include <ft2build.h> #include FT_GLYPH_H #include FT_OUTLINE_H +#include FT_BITMAP_H #include FT_INTERNAL_OBJECTS_H @@ -114,37 +115,13 @@ /*************************************************************************/ /*************************************************************************/ - static FT_Error - ft_bitmap_copy( FT_Memory memory, - FT_Bitmap* source, - FT_Bitmap* target ) + FT_CALLBACK_DEF( FT_Error ) + ft_bitmap_glyph_init( FT_Glyph bitmap_glyph, + FT_GlyphSlot slot ) { - FT_Error error; - FT_Int pitch = source->pitch; - FT_ULong size; - - - *target = *source; - - if ( pitch < 0 ) - pitch = -pitch; - - size = (FT_ULong)( pitch * source->rows ); - - if ( !FT_ALLOC( target->buffer, size ) ) - FT_MEM_COPY( target->buffer, source->buffer, size ); - - return error; - } - - - static FT_Error - ft_bitmap_glyph_init( FT_BitmapGlyph glyph, - FT_GlyphSlot slot ) - { - FT_Error error = FT_Err_Ok; - FT_Library library = FT_GLYPH(glyph)->library; - FT_Memory memory = library->memory; + FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; + FT_Error error = FT_Err_Ok; + FT_Library library = FT_GLYPH( glyph )->library; if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) @@ -153,17 +130,19 @@ goto Exit; } - /* grab the bitmap in the slot - do lazy copying whenever possible */ - glyph->bitmap = slot->bitmap; - glyph->left = slot->bitmap_left; - glyph->top = slot->bitmap_top; + glyph->left = slot->bitmap_left; + glyph->top = slot->bitmap_top; + /* do lazy copying whenever possible */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) + { + glyph->bitmap = slot->bitmap; slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; + } else { - /* copy the bitmap into a new buffer */ - error = ft_bitmap_copy( memory, &slot->bitmap, &glyph->bitmap ); + FT_Bitmap_New( &glyph->bitmap ); + error = FT_Bitmap_Copy( library, &slot->bitmap, &glyph->bitmap ); } Exit: @@ -171,34 +150,40 @@ } - static FT_Error - ft_bitmap_glyph_copy( FT_BitmapGlyph source, - FT_BitmapGlyph target ) + FT_CALLBACK_DEF( FT_Error ) + ft_bitmap_glyph_copy( FT_Glyph bitmap_source, + FT_Glyph bitmap_target ) { - FT_Memory memory = source->root.library->memory; + FT_Library library = bitmap_source->library; + FT_BitmapGlyph source = (FT_BitmapGlyph)bitmap_source; + FT_BitmapGlyph target = (FT_BitmapGlyph)bitmap_target; target->left = source->left; target->top = source->top; - return ft_bitmap_copy( memory, &source->bitmap, &target->bitmap ); + return FT_Bitmap_Copy( library, &source->bitmap, &target->bitmap ); } - static void - ft_bitmap_glyph_done( FT_BitmapGlyph glyph ) + FT_CALLBACK_DEF( void ) + ft_bitmap_glyph_done( FT_Glyph bitmap_glyph ) { - FT_Memory memory = FT_GLYPH(glyph)->library->memory; + FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; + FT_Library library = FT_GLYPH( glyph )->library; - FT_FREE( glyph->bitmap.buffer ); + FT_Bitmap_Done( library, &glyph->bitmap ); } - static void - ft_bitmap_glyph_bbox( FT_BitmapGlyph glyph, - FT_BBox* cbox ) + FT_CALLBACK_DEF( void ) + ft_bitmap_glyph_bbox( FT_Glyph bitmap_glyph, + FT_BBox* cbox ) { + FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; + + cbox->xMin = glyph->left << 6; cbox->xMax = cbox->xMin + ( glyph->bitmap.width << 6 ); cbox->yMax = glyph->top << 6; @@ -209,15 +194,15 @@ FT_CALLBACK_TABLE_DEF const FT_Glyph_Class ft_bitmap_glyph_class = { - sizeof( FT_BitmapGlyphRec ), + sizeof ( FT_BitmapGlyphRec ), FT_GLYPH_FORMAT_BITMAP, - (FT_Glyph_InitFunc) ft_bitmap_glyph_init, - (FT_Glyph_DoneFunc) ft_bitmap_glyph_done, - (FT_Glyph_CopyFunc) ft_bitmap_glyph_copy, - (FT_Glyph_TransformFunc)0, - (FT_Glyph_GetBBoxFunc) ft_bitmap_glyph_bbox, - (FT_Glyph_PrepareFunc) 0 + ft_bitmap_glyph_init, + ft_bitmap_glyph_done, + ft_bitmap_glyph_copy, + 0, /* FT_Glyph_TransformFunc */ + ft_bitmap_glyph_bbox, + 0 /* FT_Glyph_PrepareFunc */ }; @@ -230,14 +215,15 @@ /*************************************************************************/ - static FT_Error - ft_outline_glyph_init( FT_OutlineGlyph glyph, - FT_GlyphSlot slot ) + FT_CALLBACK_DEF( FT_Error ) + ft_outline_glyph_init( FT_Glyph outline_glyph, + FT_GlyphSlot slot ) { - FT_Error error = FT_Err_Ok; - FT_Library library = FT_GLYPH(glyph)->library; - FT_Outline* source = &slot->outline; - FT_Outline* target = &glyph->outline; + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + FT_Error error = FT_Err_Ok; + FT_Library library = FT_GLYPH( glyph )->library; + FT_Outline* source = &slot->outline; + FT_Outline* target = &glyph->outline; /* check format in glyph slot */ @@ -253,34 +239,31 @@ if ( error ) goto Exit; - /* copy it */ - FT_ARRAY_COPY( target->points, source->points, source->n_points ); - - FT_ARRAY_COPY( target->tags, source->tags, source->n_points ); - - FT_ARRAY_COPY( target->contours, source->contours, source->n_contours ); - - /* copy all flags, except the `FT_OUTLINE_OWNER' one */ - target->flags = source->flags | FT_OUTLINE_OWNER; + FT_Outline_Copy( source, target ); Exit: return error; } - static void - ft_outline_glyph_done( FT_OutlineGlyph glyph ) + FT_CALLBACK_DEF( void ) + ft_outline_glyph_done( FT_Glyph outline_glyph ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + FT_Outline_Done( FT_GLYPH( glyph )->library, &glyph->outline ); } - static FT_Error - ft_outline_glyph_copy( FT_OutlineGlyph source, - FT_OutlineGlyph target ) + FT_CALLBACK_DEF( FT_Error ) + ft_outline_glyph_copy( FT_Glyph outline_source, + FT_Glyph outline_target ) { - FT_Error error; - FT_Library library = FT_GLYPH( source )->library; + FT_OutlineGlyph source = (FT_OutlineGlyph)outline_source; + FT_OutlineGlyph target = (FT_OutlineGlyph)outline_target; + FT_Error error; + FT_Library library = FT_GLYPH( source )->library; error = FT_Outline_New( library, source->outline.n_points, @@ -292,11 +275,14 @@ } - static void - ft_outline_glyph_transform( FT_OutlineGlyph glyph, - FT_Matrix* matrix, - FT_Vector* delta ) + FT_CALLBACK_DEF( void ) + ft_outline_glyph_transform( FT_Glyph outline_glyph, + const FT_Matrix* matrix, + const FT_Vector* delta ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + if ( matrix ) FT_Outline_Transform( &glyph->outline, matrix ); @@ -305,18 +291,24 @@ } - static void - ft_outline_glyph_bbox( FT_OutlineGlyph glyph, - FT_BBox* bbox ) + FT_CALLBACK_DEF( void ) + ft_outline_glyph_bbox( FT_Glyph outline_glyph, + FT_BBox* bbox ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + FT_Outline_Get_CBox( &glyph->outline, bbox ); } - static FT_Error - ft_outline_glyph_prepare( FT_OutlineGlyph glyph, - FT_GlyphSlot slot ) + FT_CALLBACK_DEF( FT_Error ) + ft_outline_glyph_prepare( FT_Glyph outline_glyph, + FT_GlyphSlot slot ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + slot->format = FT_GLYPH_FORMAT_OUTLINE; slot->outline = glyph->outline; slot->outline.flags &= ~FT_OUTLINE_OWNER; @@ -328,15 +320,15 @@ FT_CALLBACK_TABLE_DEF const FT_Glyph_Class ft_outline_glyph_class = { - sizeof( FT_OutlineGlyphRec ), + sizeof ( FT_OutlineGlyphRec ), FT_GLYPH_FORMAT_OUTLINE, - (FT_Glyph_InitFunc) ft_outline_glyph_init, - (FT_Glyph_DoneFunc) ft_outline_glyph_done, - (FT_Glyph_CopyFunc) ft_outline_glyph_copy, - (FT_Glyph_TransformFunc)ft_outline_glyph_transform, - (FT_Glyph_GetBBoxFunc) ft_outline_glyph_bbox, - (FT_Glyph_PrepareFunc) ft_outline_glyph_prepare + ft_outline_glyph_init, + ft_outline_glyph_done, + ft_outline_glyph_copy, + ft_outline_glyph_transform, + ft_outline_glyph_bbox, + ft_outline_glyph_prepare }; @@ -611,7 +603,7 @@ /* create result bitmap glyph */ error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class, - (FT_Glyph*)&bitmap ); + (FT_Glyph*)(void*)&bitmap ); if ( error ) goto Exit; @@ -644,7 +636,7 @@ goto Exit; /* in case of success, copy the bitmap to the glyph bitmap */ - error = ft_bitmap_glyph_init( bitmap, &dummy ); + error = ft_bitmap_glyph_init( (FT_Glyph)bitmap, &dummy ); if ( error ) goto Exit; diff --git a/src/libs/freetype2/base/ftinit.c b/src/libs/freetype2/base/ftinit.c index 79ba9f0bd2..ac009b76d0 100644 --- a/src/libs/freetype2/base/ftinit.c +++ b/src/libs/freetype2/base/ftinit.c @@ -4,7 +4,7 @@ /* */ /* FreeType initialization layer (body). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -55,9 +55,9 @@ #undef FT_USE_MODULE #ifdef __cplusplus -#define FT_USE_MODULE( x ) extern "C" const FT_Module_Class* x; +#define FT_USE_MODULE( x ) extern "C" const FT_Module_Class x; #else -#define FT_USE_MODULE( x ) extern const FT_Module_Class* x; +#define FT_USE_MODULE( x ) extern const FT_Module_Class x; #endif @@ -65,7 +65,7 @@ #undef FT_USE_MODULE -#define FT_USE_MODULE( x ) (const FT_Module_Class*)&x, +#define FT_USE_MODULE( x ) (const FT_Module_Class*)&(x), static const FT_Module_Class* const ft_default_modules[] = diff --git a/src/libs/freetype2/base/ftmac.c b/src/libs/freetype2/base/ftmac.c index c714753827..0c45372c6f 100644 --- a/src/libs/freetype2/base/ftmac.c +++ b/src/libs/freetype2/base/ftmac.c @@ -63,17 +63,13 @@ #include FT_FREETYPE_H #include FT_INTERNAL_STREAM_H -#ifdef __GNUC__ -#include "../truetype/ttobjs.h" -#include "../type1/t1objs.h" +#if defined( __GNUC__ ) || defined( __IBMC__ ) /* This is for Mac OS X. Without redefinition, OS_INLINE */ /* expands to `static inline' which doesn't survive the */ /* -ansi compilation flag of GCC. */ #define OS_INLINE static __inline__ #include <Carbon/Carbon.h> #else -#include "truetype/ttobjs.h" -#include "type1/t1objs.h" #include <Resources.h> #include <Fonts.h> #include <Errors.h> @@ -1012,11 +1008,13 @@ FT_Long face_index, FT_Face *aface ) { +#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO FT_Open_Args args; - FT_Error error; FT_Stream stream; FILE* file; FT_Memory memory; +#endif + FT_Error error; /* test for valid `library' and `aface' delayed to FT_Open_Face() */ diff --git a/src/libs/freetype2/base/ftmm.c b/src/libs/freetype2/base/ftmm.c index 0bb2813092..940f8640a7 100644 --- a/src/libs/freetype2/base/ftmm.c +++ b/src/libs/freetype2/base/ftmm.c @@ -4,7 +4,7 @@ /* */ /* Multiple Master font support (body). */ /* */ -/* Copyright 1996-2001, 2003 by */ +/* Copyright 1996-2001, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -82,6 +82,28 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Get_MM_Var( FT_Face face, + FT_MM_Var* *amaster ) + { + FT_Error error; + FT_Service_MultiMasters service; + + + error = ft_face_get_mm_service( face, &service ); + if ( !error ) + { + error = FT_Err_Invalid_Argument; + if ( service->get_mm_var ) + error = service->get_mm_var( face, amaster ); + } + + return error; + } + + /* documentation is in ftmm.h */ FT_EXPORT_DEF( FT_Error ) @@ -105,6 +127,29 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Set_Var_Design_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Error error; + FT_Service_MultiMasters service; + + + error = ft_face_get_mm_service( face, &service ); + if ( !error ) + { + error = FT_Err_Invalid_Argument; + if ( service->set_var_design ) + error = service->set_var_design( face, num_coords, coords ); + } + + return error; + } + + /* documentation is in ftmm.h */ FT_EXPORT_DEF( FT_Error ) @@ -128,4 +173,30 @@ } + /* documentation is in ftmm.h */ + + /* This is exactly the same as the previous function. It exists for */ + /* orthogonality. */ + + FT_EXPORT_DEF( FT_Error ) + FT_Set_Var_Blend_Coordinates( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Error error; + FT_Service_MultiMasters service; + + + error = ft_face_get_mm_service( face, &service ); + if ( !error ) + { + error = FT_Err_Invalid_Argument; + if ( service->set_mm_blend ) + error = service->set_mm_blend( face, num_coords, coords ); + } + + return error; + } + + /* END */ diff --git a/src/libs/freetype2/base/ftobjs.c b/src/libs/freetype2/base/ftobjs.c index 517e83e42c..1bf813a482 100644 --- a/src/libs/freetype2/base/ftobjs.c +++ b/src/libs/freetype2/base/ftobjs.c @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,6 +19,7 @@ #include <ft2build.h> #include FT_LIST_H #include FT_OUTLINE_H +#include FT_INTERNAL_VALIDATE_H #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_RFORK_H @@ -67,7 +68,7 @@ valid->base = base; valid->limit = limit; valid->level = level; - valid->error = 0; + valid->error = FT_Err_Ok; } @@ -287,11 +288,11 @@ FT_ZERO( &slot->metrics ); FT_ZERO( &slot->outline ); - slot->bitmap.width = 0; - slot->bitmap.rows = 0; - slot->bitmap.pitch = 0; + slot->bitmap.width = 0; + slot->bitmap.rows = 0; + slot->bitmap.pitch = 0; slot->bitmap.pixel_mode = 0; - /* don't touch 'slot->bitmap.buffer'! */ + /* `slot->bitmap.buffer' has been handled by ft_glyphslot_free_bitmap */ slot->bitmap_left = 0; slot->bitmap_top = 0; @@ -304,6 +305,8 @@ slot->linearHoriAdvance = 0; slot->linearVertAdvance = 0; + slot->lsb_delta = 0; + slot->rsb_delta = 0; } @@ -345,11 +348,9 @@ FT_GlyphSlot slot; - if ( !face || !aslot || !face->driver ) + if ( !face || !face->driver ) return FT_Err_Invalid_Argument; - *aslot = 0; - driver = face->driver; clazz = driver->clazz; memory = driver->root.memory; @@ -367,8 +368,15 @@ goto Exit; } - *aslot = slot; + slot->next = face->glyph; + face->glyph = slot; + + if ( aslot ) + *aslot = slot; } + else if ( aslot ) + *aslot = 0; + Exit: FT_TRACE4(( "FT_New_GlyphSlot: Return %d\n", error )); @@ -383,26 +391,31 @@ { if ( slot ) { - FT_Driver driver = slot->face->driver; - FT_Memory memory = driver->root.memory; - FT_GlyphSlot* parent; - FT_GlyphSlot cur; + FT_Driver driver = slot->face->driver; + FT_Memory memory = driver->root.memory; + FT_GlyphSlot prev; + FT_GlyphSlot cur; /* Remove slot from its parent face's list */ - parent = &slot->face->glyph; - cur = *parent; + prev = NULL; + cur = slot->face->glyph; while ( cur ) { if ( cur == slot ) { - *parent = cur->next; + if ( !prev ) + slot->face->glyph = cur->next; + else + prev->next = cur->next; + ft_glyphslot_done( slot ); FT_FREE( slot ); break; } - cur = cur->next; + prev = cur; + cur = cur->next; } } } @@ -673,6 +686,10 @@ } + static void + ft_cmap_done_internal( FT_CMap cmap ); + + static void destroy_charmaps( FT_Face face, FT_Memory memory ) @@ -685,7 +702,7 @@ FT_CMap cmap = FT_CMAP( face->charmaps[n] ); - FT_CMap_Done( cmap ); + ft_cmap_done_internal( cmap ); face->charmaps[n] = NULL; } @@ -814,10 +831,10 @@ * when found. Otherwise, a 16-bit one is returned when found. */ - /* since the `interesting' table, with id's 3,10, is normally the */ - /* last one, we loop backwards. This looses with type1 fonts with */ - /* non-BMP characters (<.0001%), this wins with .ttf with non-BMP */ - /* chars (.01% ?), and this is the same about 99.99% of the time! */ + /* Since the `interesting' table, with IDs (3,10), is normally the */ + /* last one, we loop backwards. This looses with type1 fonts with */ + /* non-BMP characters (<.0001%), this wins with .ttf with non-BMP */ + /* chars (.01% ?), and this is the same about 99.99% of the time! */ cur = first + face->num_charmaps; /* points after the last one */ @@ -834,7 +851,7 @@ ( cur[0]->platform_id == TT_PLATFORM_APPLE_UNICODE && cur[0]->encoding_id == TT_APPLE_ID_UNICODE_32 ) ) - /* Hurray! We found a UCS-4 charmap. We can stop the scan! */ + /* Hurray! We found a UCS-4 charmap. We can stop the scan! */ { face->charmap = cur[0]; return 0; @@ -842,8 +859,8 @@ } } - /* We do not have any UCS-4 charmap. Sigh. */ - /* Let's see if we have some other kind of Unicode charmap, though. */ + /* We do not have any UCS-4 charmap. Sigh. */ + /* Let's see if we have some other kind of Unicode charmap, though. */ if ( unicmap != NULL ) { face->charmap = unicmap[0]; @@ -1547,11 +1564,9 @@ /* test for valid `library' delayed to */ /* FT_Stream_New() */ - if ( !aface || !args ) + if ( ( !aface && face_index >= 0 ) || !args ) return FT_Err_Invalid_Argument; - *aface = 0; - external_stream = FT_BOOL( ( args->flags & FT_OPEN_STREAM ) && args->stream ); @@ -1676,18 +1691,11 @@ FT_List_Add( &face->driver->faces_list, node ); /* now allocate a glyph slot object for the face */ - { - FT_GlyphSlot slot; + FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" )); - - FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" )); - - error = FT_New_GlyphSlot( face, &slot ); - if ( error ) - goto Fail; - - face->glyph = slot; - } + error = FT_New_GlyphSlot( face, NULL ); + if ( error ) + goto Fail; /* finally, allocate a size object for the face */ { @@ -1717,7 +1725,8 @@ internal->transform_delta.y = 0; } - *aface = face; + if ( aface ) + *aface = face; goto Exit; Fail: @@ -1744,6 +1753,7 @@ if ( !filepathname ) return FT_Err_Invalid_Argument; + open.stream = NULL; open.flags = FT_OPEN_PATHNAME; open.pathname = (char*)filepathname; @@ -1999,7 +2009,7 @@ if ( char_height < 1 * 64 ) char_height = 1 * 64; - /* Compute pixel sizes in 26.6 units with rounding */ + /* Compute pixel sizes in 26.6 units */ dim_x = ( char_width * horz_resolution + 36 ) / 72; dim_y = ( char_height * vert_resolution + 36 ) / 72; @@ -2008,8 +2018,14 @@ FT_UShort y_ppem = (FT_UShort)( ( dim_y + 32 ) >> 6 ); + /* Don't take, say, 12.5x12.5 equal to 13x13. If working with */ + /* fractional font sizes this would hide slightly different */ + /* font metrics. Consequently, the next two lines are */ + /* disabled. */ +#if 0 if ( x_ppem == metrics->x_ppem && y_ppem == metrics->y_ppem ) return FT_Err_Ok; +#endif metrics->x_ppem = x_ppem; metrics->y_ppem = y_ppem; @@ -2134,6 +2150,16 @@ if ( kern_mode != FT_KERNING_UNFITTED ) { + /* we scale down kerning values for small ppem values */ + /* to avoid that rounding makes them too big. */ + /* `25' has been determined heuristically. */ + if ( face->size->metrics.x_ppem < 25 ) + akerning->x = FT_MulDiv( akerning->x, + face->size->metrics.x_ppem, 25 ); + if ( face->size->metrics.y_ppem < 25 ) + akerning->y = FT_MulDiv( akerning->y, + face->size->metrics.y_ppem, 25 ); + akerning->x = FT_PIX_ROUND( akerning->x ); akerning->y = FT_PIX_ROUND( akerning->y ); } @@ -2215,20 +2241,81 @@ } + /* documentation is in freetype.h */ + + FT_EXPORT_DEF( FT_Int ) + FT_Get_Charmap_Index( FT_CharMap charmap ) + { + FT_Int i; + + + for ( i = 0; i < charmap->face->num_charmaps; i++ ) + if ( charmap->face->charmaps[i] == charmap ) + break; + + FT_ASSERT( i < charmap->face->num_charmaps ); + + return i; + } + + + static void + ft_cmap_done_internal( FT_CMap cmap ) + { + FT_CMap_Class clazz = cmap->clazz; + FT_Face face = cmap->charmap.face; + FT_Memory memory = FT_FACE_MEMORY(face); + + + if ( clazz->done ) + clazz->done( cmap ); + + FT_FREE( cmap ); + } + + FT_BASE_DEF( void ) FT_CMap_Done( FT_CMap cmap ) { if ( cmap ) { - FT_CMap_Class clazz = cmap->clazz; - FT_Face face = cmap->charmap.face; - FT_Memory memory = FT_FACE_MEMORY(face); + FT_Face face = cmap->charmap.face; + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Error error; + FT_Int i, j; - if ( clazz->done ) - clazz->done( cmap ); + for ( i = 0; i < face->num_charmaps; i++ ) + { + if ( (FT_CMap)face->charmaps[i] == cmap ) + { + FT_CharMap last_charmap = face->charmaps[face->num_charmaps - 1]; - FT_FREE( cmap ); + + if ( FT_RENEW_ARRAY( face->charmaps, + face->num_charmaps, + face->num_charmaps - 1 ) ) + return; + + /* remove it from our list of charmaps */ + for ( j = i + 1; j < face->num_charmaps; j++ ) + { + if ( j == face->num_charmaps - 1 ) + face->charmaps[j - 1] = last_charmap; + else + face->charmaps[j - 1] = face->charmaps[j]; + } + + face->num_charmaps--; + + if ( (FT_CMap)face->charmap == cmap ) + face->charmap = NULL; + + ft_cmap_done_internal( cmap ); + + break; + } + } } } @@ -2239,7 +2326,7 @@ FT_CharMap charmap, FT_CMap *acmap ) { - FT_Error error = 0; + FT_Error error = FT_Err_Ok; FT_Face face; FT_Memory memory; FT_CMap cmap; @@ -2266,7 +2353,7 @@ /* add it to our list of charmaps */ if ( FT_RENEW_ARRAY( face->charmaps, face->num_charmaps, - face->num_charmaps+1 ) ) + face->num_charmaps + 1 ) ) goto Fail; face->charmaps[face->num_charmaps++] = (FT_CharMap)cmap; @@ -2279,7 +2366,7 @@ return error; Fail: - FT_CMap_Done( cmap ); + ft_cmap_done_internal( cmap ); cmap = NULL; goto Exit; } @@ -2490,6 +2577,30 @@ } + /* documentation is in tttables.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Sfnt_Table_Info( FT_Face face, + FT_UInt table_index, + FT_ULong *tag, + FT_ULong *length ) + { + FT_Service_SFNT_Table service; + + + if ( !face || !FT_IS_SFNT( face ) ) + return FT_Err_Invalid_Face_Handle; + + FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE ); + if ( service == NULL ) + return FT_Err_Unimplemented_Feature; + + return service->table_info( face, table_index, tag, length ); + } + + + /* documentation is in tttables.h */ + FT_EXPORT_DEF( FT_ULong ) FT_Get_CMap_Language_ID( FT_CharMap charmap ) { @@ -2512,6 +2623,8 @@ } + /* documentation is in ftsizes.h */ + FT_EXPORT_DEF( FT_Error ) FT_Activate_Size( FT_Size size ) { diff --git a/src/libs/freetype2/base/ftotval.c b/src/libs/freetype2/base/ftotval.c new file mode 100644 index 0000000000..1364d754ec --- /dev/null +++ b/src/libs/freetype2/base/ftotval.c @@ -0,0 +1,72 @@ +/***************************************************************************/ +/* */ +/* ftotval.c */ +/* */ +/* FreeType API for validating OpenType tables (body). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +#include <ft2build.h> +#include FT_INTERNAL_OBJECTS_H +#include FT_SERVICE_OPENTYPE_VALIDATE_H + + + /* documentation is in ftotval.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_OpenType_Validate( FT_Face face, + FT_UInt validation_flags, + FT_Bytes *BASE_table, + FT_Bytes *GDEF_table, + FT_Bytes *GPOS_table, + FT_Bytes *GSUB_table, + FT_Bytes *JSTF_table ) + { + FT_Service_OTvalidate service; + FT_Error error; + + + if ( !face ) + { + error = FT_Err_Invalid_Face_Handle; + goto Exit; + } + + if ( !( BASE_table && + GDEF_table && + GPOS_table && + GSUB_table && + JSTF_table ) ) + { + error = FT_Err_Invalid_Argument; + goto Exit; + } + + FT_FACE_FIND_GLOBAL_SERVICE( face, service, OPENTYPE_VALIDATE ); + + if ( service ) + error = service->validate( face, + validation_flags, + BASE_table, + GDEF_table, + GPOS_table, + GSUB_table, + JSTF_table ); + else + error = FT_Err_Invalid_Argument; + + Exit: + return error; + } + + +/* END */ diff --git a/src/libs/freetype2/base/ftoutln.c b/src/libs/freetype2/base/ftoutln.c index 5cae931f67..d2e53cd772 100644 --- a/src/libs/freetype2/base/ftoutln.c +++ b/src/libs/freetype2/base/ftoutln.c @@ -4,7 +4,7 @@ /* */ /* FreeType outline management (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -347,8 +347,8 @@ /* documentation is in ftoutln.h */ FT_EXPORT_DEF( FT_Error ) - FT_Outline_Copy( FT_Outline* source, - FT_Outline *target ) + FT_Outline_Copy( const FT_Outline* source, + FT_Outline *target ) { FT_Int is_owner; @@ -358,6 +358,9 @@ source->n_contours != target->n_contours ) return FT_Err_Invalid_Argument; + if ( source == target ) + return FT_Err_Ok; + FT_ARRAY_COPY( target->points, source->points, source->n_points ); FT_ARRAY_COPY( target->tags, source->tags, source->n_points ); @@ -379,7 +382,7 @@ FT_Outline_Done_Internal( FT_Memory memory, FT_Outline* outline ) { - if ( outline ) + if ( memory && outline ) { if ( outline->flags & FT_OUTLINE_OWNER ) { @@ -414,8 +417,8 @@ /* documentation is in ftoutln.h */ FT_EXPORT_DEF( void ) - FT_Outline_Get_CBox( FT_Outline* outline, - FT_BBox *acbox ) + FT_Outline_Get_CBox( const FT_Outline* outline, + FT_BBox *acbox ) { FT_Pos xMin, yMin, xMax, yMax; @@ -464,14 +467,17 @@ /* documentation is in ftoutln.h */ FT_EXPORT_DEF( void ) - FT_Outline_Translate( FT_Outline* outline, - FT_Pos xOffset, - FT_Pos yOffset ) + FT_Outline_Translate( const FT_Outline* outline, + FT_Pos xOffset, + FT_Pos yOffset ) { FT_UShort n; FT_Vector* vec = outline->points; + if ( !outline ) + return; + for ( n = 0; n < outline->n_points; n++ ) { vec->x += xOffset; @@ -490,6 +496,9 @@ FT_Int first, last; + if ( !outline ) + return; + first = 0; for ( n = 0; n < outline->n_contours; n++ ) @@ -553,7 +562,7 @@ if ( !library ) return FT_Err_Invalid_Library_Handle; - if ( !params ) + if ( !outline || !params ) return FT_Err_Invalid_Argument; renderer = library->cur_renderer; @@ -591,9 +600,9 @@ /* documentation is in ftoutln.h */ FT_EXPORT_DEF( FT_Error ) - FT_Outline_Get_Bitmap( FT_Library library, - FT_Outline* outline, - FT_Bitmap *abitmap ) + FT_Outline_Get_Bitmap( FT_Library library, + FT_Outline* outline, + const FT_Bitmap *abitmap ) { FT_Raster_Params params; @@ -618,8 +627,8 @@ /* documentation is in ftoutln.h */ FT_EXPORT_DEF( void ) - FT_Vector_Transform( FT_Vector* vector, - FT_Matrix* matrix ) + FT_Vector_Transform( FT_Vector* vector, + const FT_Matrix* matrix ) { FT_Pos xz, yz; @@ -641,154 +650,165 @@ /* documentation is in ftoutln.h */ FT_EXPORT_DEF( void ) - FT_Outline_Transform( FT_Outline* outline, - FT_Matrix* matrix ) + FT_Outline_Transform( const FT_Outline* outline, + const FT_Matrix* matrix ) { - FT_Vector* vec = outline->points; - FT_Vector* limit = vec + outline->n_points; + FT_Vector* vec; + FT_Vector* limit; + if ( !outline || !matrix ) + return; + + vec = outline->points; + limit = vec + outline->n_points; + for ( ; vec < limit; vec++ ) FT_Vector_Transform( vec, matrix ); } - typedef struct FT_OrientationExtremumRec_ + /* documentation is in ftoutln.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Outline_Embolden( FT_Outline* outline, + FT_Pos strength ) { - FT_Int index; - FT_Long pos; - FT_Int first; - FT_Int last; - - } FT_OrientationExtremumRec; + FT_Vector* points; + FT_Vector v_prev, v_first, v_next, v_cur; + FT_Angle rotate, angle_in, angle_out; + FT_Int c, n, first; - static FT_Orientation - ft_orientation_extremum_compute( FT_OrientationExtremumRec* extremum, - FT_Outline* outline ) - { - FT_Vector *point, *first, *last, *prev, *next; - FT_Vector* points = outline->points; - FT_Angle angle_in, angle_out; + if ( !outline ) + return FT_Err_Invalid_Argument; + if ( strength == 0 ) + return FT_Err_Ok; - /* compute the previous and next points in the same contour */ - point = points + extremum->index; - first = points + extremum->first; - last = points + extremum->last; + if ( FT_Outline_Get_Orientation( outline ) == FT_ORIENTATION_TRUETYPE ) + rotate = -FT_ANGLE_PI2; + else + rotate = FT_ANGLE_PI2; - prev = point; - next = point; + points = outline->points; - do + first = 0; + for ( c = 0; c < outline->n_contours; c++ ) { - prev = ( prev == first ) ? last : prev - 1; - if ( prev == point ) - return FT_ORIENTATION_TRUETYPE; /* degenerate case */ + int last = outline->contours[c]; - } while ( prev->x != point->x || prev->y != point->y ); - do - { - next = ( next == last ) ? first : next + 1; - if ( next == point ) - return FT_ORIENTATION_TRUETYPE; /* shouldn't happen */ + v_first = points[first]; + v_prev = points[last]; + v_cur = v_first; - } while ( next->x != point->x || next->y != point->y ); + for ( n = first; n <= last; n++ ) + { + FT_Vector in, out; + FT_Angle angle_diff; + FT_Pos d; + FT_Fixed scale; - /* now compute the orientation of the `out' vector relative */ - /* to the `in' vector. */ - angle_in = FT_Atan2( point->x - prev->x, point->y - prev->y ); - angle_out = FT_Atan2( next->x - point->x, next->y - point->y ); - return ( FT_Angle_Diff( angle_in, angle_out ) >= 0 ) - ? FT_ORIENTATION_TRUETYPE - : FT_ORIENTATION_POSTSCRIPT; + if ( n < last ) + v_next = points[n + 1]; + else + v_next = v_first; + + /* compute the in and out vectors */ + in.x = v_cur.x - v_prev.x; + in.y = v_cur.y - v_prev.y; + + out.x = v_next.x - v_cur.x; + out.y = v_next.y - v_cur.y; + + angle_in = FT_Atan2( in.x, in.y ); + angle_out = FT_Atan2( out.x, out.y ); + angle_diff = FT_Angle_Diff( angle_in, angle_out ); + scale = FT_Cos( angle_diff / 2 ); + + if ( scale < 0x4000L && scale > -0x4000L ) + in.x = in.y = 0; + else + { + d = FT_DivFix( strength, scale ); + + FT_Vector_From_Polar( &in, d, angle_in + angle_diff / 2 - rotate ); + } + + outline->points[n].x = v_cur.x + strength + in.x; + outline->points[n].y = v_cur.y + strength + in.y; + + v_prev = v_cur; + v_cur = v_next; + } + + first = last + 1; + } + + return FT_Err_Ok; } + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Orientation ) FT_Outline_Get_Orientation( FT_Outline* outline ) { - FT_Orientation result = FT_ORIENTATION_TRUETYPE; + FT_Pos xmin = 32768L; + FT_Vector* xmin_point = NULL; + FT_Vector* xmin_first = NULL; + FT_Vector* xmin_last = NULL; + + short* contour; + + FT_Vector* first; + FT_Vector* last; + FT_Vector* prev; + FT_Vector* next; - if ( outline && outline->n_points > 0 ) + if ( !outline || outline->n_points <= 0 ) + return FT_ORIENTATION_TRUETYPE; + + first = outline->points; + for ( contour = outline->contours; + contour < outline->contours + outline->n_contours; + contour++, first = last + 1 ) { - FT_OrientationExtremumRec xmin, ymin, xmax, ymax; - FT_Int n; - FT_Int first, last; - FT_Vector* points = outline->points; + FT_Vector* point; - xmin.pos = ymin.pos = +32768L; - xmax.pos = ymax.pos = -32768L; + last = outline->points + *contour; - xmin.index = ymin.index = xmax.index = ymax.index = -1; + /* skip degenerate contours */ + if ( last < first + 2 ) + continue; - first = 0; - for ( n = 0; n < outline->n_contours; n++, first = last + 1 ) + for ( point = first; point <= last; point++ ) { - last = outline->contours[n]; - - /* skip single-point contours; these are degenerated cases */ - if ( last > first + 1 ) + if ( point->x < xmin ) { - FT_Int i; - - - for ( i = first; i < last; i++ ) - { - FT_Pos x = points[i].x; - FT_Pos y = points[i].y; - - - if ( x < xmin.pos ) - { - xmin.pos = x; - xmin.index = i; - xmin.first = first; - xmin.last = last; - } - if ( x > xmax.pos ) - { - xmax.pos = x; - xmax.index = i; - xmax.first = first; - xmax.last = last; - } - if ( y < ymin.pos ) - { - ymin.pos = y; - ymin.index = i; - ymin.first = first; - ymin.last = last; - } - if ( y > ymax.pos ) - { - ymax.pos = y; - ymax.index = i; - ymax.first = first; - ymax.last = last; - } - } + xmin = point->x; + xmin_point = point; + xmin_first = first; + xmin_last = last; } - - if ( xmin.index >= 0 ) - result = ft_orientation_extremum_compute( &xmin, outline ); - - else if ( xmax.index >= 0 ) - result = ft_orientation_extremum_compute( &xmax, outline ); - - else if ( ymin.index >= 0 ) - result = ft_orientation_extremum_compute( &ymin, outline ); - - else if ( ymax.index >= 0 ) - result = ft_orientation_extremum_compute( &ymax, outline ); } } - return result; + if ( !xmin_point ) + return FT_ORIENTATION_TRUETYPE; + + prev = ( xmin_point == xmin_first ) ? xmin_last : xmin_point - 1; + next = ( xmin_point == xmin_last ) ? xmin_first : xmin_point + 1; + + if ( FT_Atan2( prev->x - xmin_point->x, prev->y - xmin_point->y ) > + FT_Atan2( next->x - xmin_point->x, next->y - xmin_point->y ) ) + return FT_ORIENTATION_POSTSCRIPT; + else + return FT_ORIENTATION_TRUETYPE; } diff --git a/src/libs/freetype2/base/ftpfr.c b/src/libs/freetype2/base/ftpfr.c index fb959e37fc..9e930ddf7e 100644 --- a/src/libs/freetype2/base/ftpfr.c +++ b/src/libs/freetype2/base/ftpfr.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (body). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,6 +33,8 @@ } + /* documentation is in ftpfr.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_PFR_Metrics( FT_Face face, FT_UInt *aoutline_resolution, @@ -78,6 +80,8 @@ } + /* documentation is in ftpfr.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_PFR_Kerning( FT_Face face, FT_UInt left, @@ -101,6 +105,8 @@ } + /* documentation is in ftpfr.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_PFR_Advance( FT_Face face, FT_UInt gindex, diff --git a/src/libs/freetype2/base/ftrfork.c b/src/libs/freetype2/base/ftrfork.c index cf790ccc00..50dcf858c7 100644 --- a/src/libs/freetype2/base/ftrfork.c +++ b/src/libs/freetype2/base/ftrfork.c @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (body). */ /* */ -/* Copyright 2004 by */ +/* Copyright 2004, 2005 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */ @@ -569,19 +569,21 @@ { FT_Int32 magic_from_stream; FT_Error error; - FT_Int32 version_number; + FT_Int32 version_number = 0; FT_UShort n_of_entries; int i; - FT_UInt32 entry_id, entry_offset, entry_length; + FT_UInt32 entry_id, entry_offset, entry_length = 0; const FT_UInt32 resource_fork_entry_id = 0x2; FT_UNUSED( library ); FT_UNUSED( base_file_name ); + FT_UNUSED( version_number ); + FT_UNUSED( entry_length ); - if ( FT_READ_LONG ( magic_from_stream ) ) + if ( FT_READ_LONG( magic_from_stream ) ) return error; if ( magic_from_stream != magic ) return FT_Err_Unknown_File_Format; @@ -625,15 +627,12 @@ char * file_name, FT_Long *result_offset ) { - FT_Memory memory; FT_Open_Args args2; FT_Stream stream2; char * nouse = NULL; FT_Error error; - memory = library->memory; - args2.flags = FT_OPEN_PATHNAME; args2.pathname = file_name; error = FT_Stream_New( library, &args2, &stream2 ); @@ -658,7 +657,10 @@ char* tmp; const char* slash; unsigned new_length; - FT_ULong error; + FT_ULong error = FT_Err_Ok; + + FT_UNUSED( error ); + new_length = ft_strlen( original_name ) + ft_strlen( insertion ); if ( FT_ALLOC( new_name, new_length + 1 ) ) @@ -701,6 +703,10 @@ { int i; + FT_UNUSED( library ); + FT_UNUSED( stream ); + FT_UNUSED( base_name ); + for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) { diff --git a/src/libs/freetype2/base/ftstream.c b/src/libs/freetype2/base/ftstream.c index 7ff1e90532..3b7b29f904 100644 --- a/src/libs/freetype2/base/ftstream.c +++ b/src/libs/freetype2/base/ftstream.c @@ -4,7 +4,7 @@ /* */ /* I/O stream support (body). */ /* */ -/* Copyright 2000-2001, 2002, 2004 by */ +/* Copyright 2000-2001, 2002, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -49,10 +49,7 @@ FT_Stream_Close( FT_Stream stream ) { if ( stream && stream->close ) - { stream->close( stream ); - stream->close = NULL; - } } @@ -156,6 +153,35 @@ } + FT_BASE_DEF( FT_ULong ) + FT_Stream_TryRead( FT_Stream stream, + FT_Byte* buffer, + FT_ULong count ) + { + FT_ULong read_bytes = 0; + + + if ( stream->pos >= stream->size ) + goto Exit; + + if ( stream->read ) + read_bytes = stream->read( stream, stream->pos, buffer, count ); + else + { + read_bytes = stream->size - stream->pos; + if ( read_bytes > count ) + read_bytes = count; + + FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes ); + } + + stream->pos += read_bytes; + + Exit: + return read_bytes; + } + + FT_BASE_DEF( FT_Error ) FT_Stream_ExtractFrame( FT_Stream stream, FT_ULong count, @@ -210,7 +236,7 @@ FT_Memory memory = stream->memory; - if ( FT_ALLOC( stream->base, count ) ) + if ( FT_QALLOC( stream->base, count ) ) goto Exit; /* read it */ diff --git a/src/libs/freetype2/base/ftstroke.c b/src/libs/freetype2/base/ftstroke.c index 10aad2db81..26ff21511b 100644 --- a/src/libs/freetype2/base/ftstroke.c +++ b/src/libs/freetype2/base/ftstroke.c @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (body). */ /* */ -/* Copyright 2002, 2003, 2004 by */ +/* Copyright 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,6 +24,9 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H + + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_StrokerBorder ) FT_Outline_GetInsideBorder( FT_Outline* outline ) { @@ -35,6 +38,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_StrokerBorder ) FT_Outline_GetOutsideBorder( FT_Outline* outline ) { @@ -234,6 +239,7 @@ } FT_StrokeTags; +#define FT_STROKE_TAG_BEGIN_END (FT_STROKE_TAG_BEGIN|FT_STROKE_TAG_END) typedef struct FT_StrokeBorderRec_ { @@ -279,15 +285,64 @@ static void - ft_stroke_border_close( FT_StrokeBorder border ) + ft_stroke_border_close( FT_StrokeBorder border, + FT_Bool reverse ) { + FT_UInt start = border->start; + FT_UInt count = border->num_points; + + FT_ASSERT( border->start >= 0 ); /* don't record empty paths! */ - if ( border->num_points > (FT_UInt)border->start ) + if ( count <= start + 1U ) + border->num_points = start; + else { - border->tags[border->start ] |= FT_STROKE_TAG_BEGIN; - border->tags[border->num_points - 1] |= FT_STROKE_TAG_END; + /* copy the last point to the start of this sub-path, since */ + /* it contains the `adjusted' starting coordinates */ + border->num_points = --count; + border->points[start] = border->points[count]; + + if ( reverse ) + { + /* reverse the points */ + { + FT_Vector* vec1 = border->points + start + 1; + FT_Vector* vec2 = border->points + count - 1; + + + for ( ; vec1 < vec2; vec1++, vec2-- ) + { + FT_Vector tmp; + + + tmp = *vec1; + *vec1 = *vec2; + *vec2 = tmp; + } + } + + /* then the tags */ + { + FT_Byte* tag1 = border->tags + start + 1; + FT_Byte* tag2 = border->tags + count - 1; + + + for ( ; tag1 < tag2; tag1++, tag2-- ) + { + FT_Byte tmp; + + + tmp = *tag1; + *tag1 = *tag2; + *tag2 = tmp; + } + } + } + + border->tags[start ] |= FT_STROKE_TAG_BEGIN; + border->tags[count - 1] |= FT_STROKE_TAG_END; } border->start = -1; @@ -472,7 +527,7 @@ { /* close current open path if any ? */ if ( border->start >= 0 ) - ft_stroke_border_close( border ); + ft_stroke_border_close( border, 0 ); border->start = border->num_points; border->movable = 0; @@ -658,6 +713,8 @@ } FT_StrokerRec; + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Stroker_New( FT_Memory memory, FT_Stroker *astroker ) @@ -678,6 +735,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( void ) FT_Stroker_Set( FT_Stroker stroker, FT_Fixed radius, @@ -694,6 +753,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( void ) FT_Stroker_Rewind( FT_Stroker stroker ) { @@ -705,6 +766,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( void ) FT_Stroker_Done( FT_Stroker stroker ) { @@ -821,9 +884,10 @@ phi = stroker->angle_in + theta; - thcos = FT_Cos( theta ); - sigma = FT_MulFix( stroker->miter_limit, thcos ); + thcos = FT_Cos( theta ); + sigma = FT_MulFix( stroker->miter_limit, thcos ); + /* TODO: find better criterion to switch off the optimization */ if ( sigma < 0x10000L ) { FT_Vector_From_Polar( &delta, stroker->radius, @@ -1036,6 +1100,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Stroker_LineTo( FT_Stroker stroker, FT_Vector* to ) @@ -1097,6 +1163,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Stroker_ConicTo( FT_Stroker stroker, FT_Vector* control, @@ -1193,6 +1261,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Stroker_CubicTo( FT_Stroker stroker, FT_Vector* control1, @@ -1301,6 +1371,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Stroker_BeginSubPath( FT_Stroker stroker, FT_Vector* to, @@ -1351,12 +1423,17 @@ *dst_tag = *src_tag; if ( open ) - dst_tag[0] &= ~( FT_STROKE_TAG_BEGIN | FT_STROKE_TAG_END ); + dst_tag[0] &= ~FT_STROKE_TAG_BEGIN_END; else { - /* switch begin/end tags if necessary.. */ - if ( dst_tag[0] & ( FT_STROKE_TAG_BEGIN | FT_STROKE_TAG_END ) ) - dst_tag[0] ^= ( FT_STROKE_TAG_BEGIN | FT_STROKE_TAG_END ); + FT_Byte ttag = (FT_Byte)( dst_tag[0] & FT_STROKE_TAG_BEGIN_END ); + + + /* switch begin/end tags if necessary */ + if ( ttag == FT_STROKE_TAG_BEGIN || + ttag == FT_STROKE_TAG_END ) + dst_tag[0] ^= FT_STROKE_TAG_BEGIN_END; + } src_point--; @@ -1378,6 +1455,8 @@ } + /* documentation is in ftstroke.h */ + /* there's a lot of magic in this function! */ FT_EXPORT_DEF( FT_Error ) FT_Stroker_EndSubPath( FT_Stroker stroker ) @@ -1409,7 +1488,7 @@ /* Now end the right subpath accordingly. The left one is */ /* rewind and doesn't need further processing. */ - ft_stroke_border_close( right ); + ft_stroke_border_close( right, 0 ); } else { @@ -1440,11 +1519,9 @@ if ( turn < 0 ) inside_side = 1; - /* IMPORTANT: WE DO NOT PROCESS THE INSIDE BORDER HERE! */ - /* process the inside side */ - /* error = ft_stroker_inside( stroker, inside_side ); */ - /* if ( error ) */ - /* goto Exit; */ + error = ft_stroker_inside( stroker, inside_side ); + if ( error ) + goto Exit; /* process the outside side */ error = ft_stroker_outside( stroker, 1 - inside_side ); @@ -1453,8 +1530,8 @@ } /* then end our two subpaths */ - ft_stroke_border_close( stroker->borders + 0 ); - ft_stroke_border_close( stroker->borders + 1 ); + ft_stroke_border_close( stroker->borders + 0, 1 ); + ft_stroke_border_close( stroker->borders + 1, 0 ); } Exit: @@ -1462,6 +1539,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Stroker_GetBorderCounts( FT_Stroker stroker, FT_StrokerBorder border, @@ -1491,6 +1570,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Stroker_GetCounts( FT_Stroker stroker, FT_UInt *anum_points, @@ -1521,6 +1602,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( void ) FT_Stroker_ExportBorder( FT_Stroker stroker, FT_StrokerBorder border, @@ -1538,6 +1621,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( void ) FT_Stroker_Export( FT_Stroker stroker, FT_Outline* outline ) @@ -1547,6 +1632,8 @@ } + /* documentation is in ftstroke.h */ + /* * The following is very similar to FT_Outline_Decompose, except * that we do support opened paths, and do not scale the outline. @@ -1580,12 +1667,19 @@ for ( n = 0; n < outline->n_contours; n++ ) { - FT_Int last; /* index of last point in contour */ + FT_UInt last; /* index of last point in contour */ last = outline->contours[n]; limit = outline->points + last; + /* skip empty points; we don't stroke these */ + if ( last <= first ) + { + first = last + 1; + continue; + } + v_start = outline->points[first]; v_last = outline->points[last]; @@ -1749,6 +1843,8 @@ extern const FT_Glyph_Class ft_outline_glyph_class; + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Glyph_Stroke( FT_Glyph *pglyph, FT_Stroker stroker, @@ -1819,6 +1915,8 @@ } + /* documentation is in ftstroke.h */ + FT_EXPORT_DEF( FT_Error ) FT_Glyph_StrokeBorder( FT_Glyph *pglyph, FT_Stroker stroker, diff --git a/src/libs/freetype2/base/ftsynth.c b/src/libs/freetype2/base/ftsynth.c index cee36822fd..020bfdfe4f 100644 --- a/src/libs/freetype2/base/ftsynth.c +++ b/src/libs/freetype2/base/ftsynth.c @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,14 +17,10 @@ #include <ft2build.h> -#include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_CALC_H -#include FT_OUTLINE_H -#include FT_TRIGONOMETRY_H #include FT_SYNTHESIS_H - - -#define FT_BOLD_THRESHOLD 0x0100 +#include FT_INTERNAL_OBJECTS_H +#include FT_OUTLINE_H +#include FT_BITMAP_H /*************************************************************************/ @@ -35,6 +31,8 @@ /*************************************************************************/ /*************************************************************************/ + /* documentation is in ftsynth.h */ + FT_EXPORT_DEF( void ) FT_GlyphSlot_Oblique( FT_GlyphSlot slot ) { @@ -70,217 +68,74 @@ /*************************************************************************/ - - static int - ft_test_extrema( FT_Outline* outline, - int n ) - { - FT_Vector *prev, *cur, *next; - FT_Pos product; - FT_Int c, first, last; - - - /* we need to compute the `previous' and `next' point */ - /* for these extrema. */ - cur = outline->points + n; - prev = cur - 1; - next = cur + 1; - - first = 0; - for ( c = 0; c < outline->n_contours; c++ ) - { - last = outline->contours[c]; - - if ( n == first ) - prev = outline->points + last; - - if ( n == last ) - next = outline->points + first; - - first = last + 1; - } - - product = FT_MulDiv( cur->x - prev->x, /* in.x */ - next->y - cur->y, /* out.y */ - 0x40 ) - - - FT_MulDiv( cur->y - prev->y, /* in.y */ - next->x - cur->x, /* out.x */ - 0x40 ); - - if ( product ) - product = product > 0 ? 1 : -1; - - return product; - } - - - /* Compute the orientation of path filling. It differs between TrueType */ - /* and Type1 formats. We could use the `FT_OUTLINE_REVERSE_FILL' flag, */ - /* but it is better to re-compute it directly (it seems that this flag */ - /* isn't correctly set for some weird composite glyphs currently). */ - /* */ - /* We do this by computing bounding box points, and computing their */ - /* curvature. */ - /* */ - /* The function returns either 1 or -1. */ - /* */ - static int - ft_get_orientation( FT_Outline* outline ) - { - FT_BBox box; - FT_BBox indices; - int n, last; - - - indices.xMin = -1; - indices.yMin = -1; - indices.xMax = -1; - indices.yMax = -1; - - box.xMin = box.yMin = 32767; - box.xMax = box.yMax = -32768; - - /* is it empty ? */ - if ( outline->n_contours < 1 ) - return 1; - - last = outline->contours[outline->n_contours - 1]; - - for ( n = 0; n <= last; n++ ) - { - FT_Pos x, y; - - - x = outline->points[n].x; - if ( x < box.xMin ) - { - box.xMin = x; - indices.xMin = n; - } - if ( x > box.xMax ) - { - box.xMax = x; - indices.xMax = n; - } - - y = outline->points[n].y; - if ( y < box.yMin ) - { - box.yMin = y; - indices.yMin = n; - } - if ( y > box.yMax ) - { - box.yMax = y; - indices.yMax = n; - } - } - - /* test orientation of the xmin */ - n = ft_test_extrema( outline, indices.xMin ); - if ( n ) - goto Exit; - - n = ft_test_extrema( outline, indices.yMin ); - if ( n ) - goto Exit; - - n = ft_test_extrema( outline, indices.xMax ); - if ( n ) - goto Exit; - - n = ft_test_extrema( outline, indices.yMax ); - if ( !n ) - n = 1; - - Exit: - return n; - } - + /* documentation is in ftsynth.h */ FT_EXPORT_DEF( void ) FT_GlyphSlot_Embolden( FT_GlyphSlot slot ) { - FT_Vector* points; - FT_Vector v_prev, v_first, v_next, v_cur; - FT_Pos distance; - FT_Outline* outline = &slot->outline; - FT_Face face = FT_SLOT_FACE( slot ); - FT_Angle rotate, angle_in, angle_out; - FT_Int c, n, first, orientation; + FT_Library library = slot->library; + FT_Face face = FT_SLOT_FACE( slot ); + FT_Error error = FT_Err_Ok; + FT_Pos xstr, ystr; - /* only embolden outline glyph images */ - if ( slot->format != FT_GLYPH_FORMAT_OUTLINE ) - return; + /* some reasonable strength */ + xstr = FT_MulFix( face->units_per_EM, + face->size->metrics.y_scale ) / 42; + ystr = xstr; - /* compute control distance */ - distance = FT_MulFix( face->units_per_EM / 60, - face->size->metrics.y_scale ); - - orientation = ft_get_orientation( outline ); - rotate = FT_ANGLE_PI2*orientation; - - points = outline->points; - - first = 0; - for ( c = 0; c < outline->n_contours; c++ ) + if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) { - int last = outline->contours[c]; + error = FT_Outline_Embolden( &slot->outline, xstr ); + xstr = xstr * 4; /* according to the documentation */ + ystr = xstr; + } + else if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) + { + xstr = FT_PIX_FLOOR( xstr ); + if ( xstr == 0 ) + xstr = 1 << 6; + ystr = FT_PIX_FLOOR( ystr ); - - v_first = points[first]; - v_prev = points[last]; - v_cur = v_first; - - for ( n = first; n <= last; n++ ) + /* slot must be bitmap-owner */ + if ( !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) { - FT_Pos d; - FT_Vector in, out; - FT_Fixed scale; - FT_Angle angle_diff; + FT_Bitmap bitmap; - if ( n < last ) v_next = points[n + 1]; - else v_next = v_first; + FT_Bitmap_New( &bitmap ); + error = FT_Bitmap_Copy( library, &slot->bitmap, &bitmap ); - /* compute the in and out vectors */ - in.x = v_cur.x - v_prev.x; - in.y = v_cur.y - v_prev.y; - - out.x = v_next.x - v_cur.x; - out.y = v_next.y - v_cur.y; - - angle_in = FT_Atan2( in.x, in.y ); - angle_out = FT_Atan2( out.x, out.y ); - angle_diff = FT_Angle_Diff( angle_in, angle_out ); - scale = FT_Cos( angle_diff/2 ); - - if ( scale < 0x400L && scale > -0x400L ) + if ( !error ) { - if ( scale >= 0 ) - scale = 0x400L; - else - scale = -0x400L; + slot->bitmap = bitmap; + slot->internal->flags |= FT_GLYPH_OWN_BITMAP; } - - d = FT_DivFix( distance, scale ); - - FT_Vector_From_Polar( &in, d, angle_in + angle_diff/2 - rotate ); - - outline->points[n].x = v_cur.x + distance + in.x; - outline->points[n].y = v_cur.y + distance + in.y; - - v_prev = v_cur; - v_cur = v_next; } - first = last + 1; + if ( !error ) + error = FT_Bitmap_Embolden( library, &slot->bitmap, xstr, ystr ); } + else + error = FT_Err_Invalid_Argument; - slot->metrics.horiAdvance = - ( slot->metrics.horiAdvance + distance*4 ) & ~63; + /* modify the metrics accordingly */ + if ( !error ) + { + slot->advance.x += xstr; + slot->advance.y += ystr; + + slot->metrics.width += xstr; + slot->metrics.height += ystr; + slot->metrics.horiBearingY += ystr; + slot->metrics.horiAdvance += xstr; + slot->metrics.vertBearingX -= xstr / 2; + slot->metrics.vertBearingY += ystr; + slot->metrics.vertAdvance += ystr; + + if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) + slot->bitmap_top += ystr >> 6; + } } diff --git a/src/libs/freetype2/base/fttrigon.c b/src/libs/freetype2/base/fttrigon.c index 5347dd852a..1ab34384d8 100644 --- a/src/libs/freetype2/base/fttrigon.c +++ b/src/libs/freetype2/base/fttrigon.c @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (body). */ /* */ -/* Copyright 2001, 2002, 2003 by */ +/* Copyright 2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -274,7 +274,7 @@ if ( theta >= 0 ) theta = FT_PAD_ROUND( theta, 32 ); else - theta = - FT_PAD_ROUND( -theta, 32 ); + theta = -FT_PAD_ROUND( -theta, 32 ); vec->x = x; vec->y = theta; @@ -485,6 +485,7 @@ { FT_Angle delta = angle2 - angle1; + delta %= FT_ANGLE_2PI; if ( delta < 0 ) delta += FT_ANGLE_2PI; diff --git a/src/libs/freetype2/base/fttype1.c b/src/libs/freetype2/base/fttype1.c index 553b84f56f..3975584db8 100644 --- a/src/libs/freetype2/base/fttype1.c +++ b/src/libs/freetype2/base/fttype1.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for PS names support (body). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -67,4 +67,28 @@ } + /* documentation is in t1tables.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Get_PS_Font_Private( FT_Face face, + PS_PrivateRec* afont_private ) + { + FT_Error error = FT_Err_Invalid_Argument; + + + if ( face ) + { + FT_Service_PsInfo service = NULL; + + + FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO ); + + if ( service && service->ps_get_font_private ) + error = service->ps_get_font_private( face, afont_private ); + } + + return error; + } + + /* END */ diff --git a/src/libs/freetype2/base/ftutil.c b/src/libs/freetype2/base/ftutil.c index 451bee524c..5b3aa8b662 100644 --- a/src/libs/freetype2/base/ftutil.c +++ b/src/libs/freetype2/base/ftutil.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for memory and list management (body). */ /* */ -/* Copyright 2002 by */ +/* Copyright 2002, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,6 +19,7 @@ #include <ft2build.h> #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_MEMORY_H +#include FT_INTERNAL_OBJECTS_H #include FT_LIST_H @@ -77,6 +78,38 @@ } + /* documentation is in ftmemory.h */ + + FT_BASE_DEF( FT_Error ) + FT_QAlloc( FT_Memory memory, + FT_Long size, + void* *P ) + { + FT_ASSERT( P != 0 ); + + if ( size > 0 ) + { + *P = memory->alloc( memory, size ); + if ( !*P ) + { + FT_ERROR(( "FT_QAlloc:" )); + FT_ERROR(( " Out of memory? (%ld requested)\n", + size )); + + return FT_Err_Out_Of_Memory; + } + } + else + *P = NULL; + + FT_TRACE7(( "FT_QAlloc:" )); + FT_TRACE7(( " size = %ld, block = 0x%08p, ref = 0x%08p\n", + size, *P, P )); + + return FT_Err_Ok; + } + + /* documentation is in ftmemory.h */ FT_BASE_DEF( FT_Error ) @@ -119,6 +152,45 @@ } + /* documentation is in ftmemory.h */ + + FT_BASE_DEF( FT_Error ) + FT_QRealloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void** P ) + { + void* Q; + + + FT_ASSERT( P != 0 ); + + /* if the original pointer is NULL, call FT_QAlloc() */ + if ( !*P ) + return FT_QAlloc( memory, size, P ); + + /* if the new block if zero-sized, clear the current one */ + if ( size <= 0 ) + { + FT_Free( memory, P ); + return FT_Err_Ok; + } + + Q = memory->realloc( memory, current, size, *P ); + if ( !Q ) + goto Fail; + + *P = Q; + return FT_Err_Ok; + + Fail: + FT_ERROR(( "FT_QRealloc:" )); + FT_ERROR(( " Failed (current %ld, requested %ld)\n", + current, size )); + return FT_Err_Out_Of_Memory; + } + + /* documentation is in ftmemory.h */ FT_BASE_DEF( void ) @@ -327,4 +399,26 @@ } + FT_BASE( FT_UInt32 ) + ft_highpow2( FT_UInt32 value ) + { + FT_UInt32 value2; + + + /* + * We simply clear the lowest bit in each iteration. When + * we reach 0, we know that the previous value was our result. + */ + for ( ;; ) + { + value2 = value & (value - 1); /* clear lowest bit */ + if ( value2 == 0 ) + break; + + value = value2; + } + return value; + } + + /* END */ diff --git a/src/libs/freetype2/base/ftwinfnt.c b/src/libs/freetype2/base/ftwinfnt.c index 46f618c518..bc2e90e1f6 100644 --- a/src/libs/freetype2/base/ftwinfnt.c +++ b/src/libs/freetype2/base/ftwinfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing Windows FNT specific info (body). */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,6 +22,8 @@ #include FT_SERVICE_WINFNT_H + /* documentation is in ftwinfnt.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_WinFNT_Header( FT_Face face, FT_WinFNT_HeaderRec *header ) diff --git a/src/libs/freetype2/base/ftxf86.c b/src/libs/freetype2/base/ftxf86.c index 04e80236e6..a4bf767dfa 100644 --- a/src/libs/freetype2/base/ftxf86.c +++ b/src/libs/freetype2/base/ftxf86.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for X11 support (body). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,9 @@ #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_XFREE86_NAME_H + + /* documentation is in ftxf86.h */ + FT_EXPORT_DEF( const char* ) FT_Get_X11_Font_Format( FT_Face face ) { diff --git a/src/libs/freetype2/base/rules.mk b/src/libs/freetype2/base/rules.mk index 8017e8589f..a92cb0df6c 100644 --- a/src/libs/freetype2/base/rules.mk +++ b/src/libs/freetype2/base/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003, 2004 by +# Copyright 1996-2000, 2002, 2003, 2004, 2005 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -50,12 +50,15 @@ BASE_SRC := $(BASE_DIR)/ftapi.c \ # object. It will then be linked to the final executable only if one of its # symbols is used by the application. # -BASE_EXT_SRC := $(BASE_DIR)/ftbbox.c \ +BASE_EXT_SRC := $(BASE_DIR)/ftbitmap.c \ + $(BASE_DIR)/ftbbox.c \ $(BASE_DIR)/ftbdf.c \ $(BASE_DIR)/ftglyph.c \ $(BASE_DIR)/ftmm.c \ + $(BASE_DIR)/ftotval.c \ $(BASE_DIR)/ftpfr.c \ $(BASE_DIR)/ftstroke.c \ + $(BASE_DIR)/ftsynth.c \ $(BASE_DIR)/fttype1.c \ $(BASE_DIR)/ftwinfnt.c \ $(BASE_DIR)/ftxf86.c diff --git a/src/libs/freetype2/bdf/Jamfile b/src/libs/freetype2/bdf/Jamfile index f2c5917e8c..bcf6550a38 100644 --- a/src/libs/freetype2/bdf/Jamfile +++ b/src/libs/freetype2/bdf/Jamfile @@ -20,4 +20,5 @@ UseFreeTypeHeaders ; FT2_Library $(FT2_LIB) : $(_sources).c ; } -# end of src/bdf Jamfile +# end of src/bdf Jamfile + diff --git a/src/libs/freetype2/bdf/bdf.h b/src/libs/freetype2/bdf/bdf.h index 4dab5ae9d0..b42baa6e04 100644 --- a/src/libs/freetype2/bdf/bdf.h +++ b/src/libs/freetype2/bdf/bdf.h @@ -1,6 +1,6 @@ /* * Copyright 2000 Computing Research Labs, New Mexico State University - * Copyright 2001, 2002, 2003 Francesco Zappa Nardelli + * Copyright 2001, 2002, 2003, 2004 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"), @@ -202,7 +202,7 @@ FT_BEGIN_HEADER unsigned short monowidth; /* Logical width for monowidth font. */ - long default_glyph; /* Encoding of the default glyph. */ + long default_char; /* Encoding of the default glyph. */ long font_ascent; /* Font ascent. */ long font_descent; /* Font descent. */ diff --git a/src/libs/freetype2/bdf/bdfdrivr.c b/src/libs/freetype2/bdf/bdfdrivr.c index 2e8f93ca6b..e14306efda 100644 --- a/src/libs/freetype2/bdf/bdfdrivr.c +++ b/src/libs/freetype2/bdf/bdfdrivr.c @@ -2,7 +2,7 @@ FreeType font driver for bdf files - Copyright (C) 2001, 2002, 2003, 2004 by + Copyright (C) 2001, 2002, 2003, 2004, 2005 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -60,9 +60,12 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_Error ) - bdf_cmap_init( BDF_CMap cmap ) + bdf_cmap_init( FT_CMap bdfcmap, + FT_Pointer init_data ) { + BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_Face face = (BDF_Face)FT_CMAP_FACE( cmap ); + FT_UNUSED( init_data ); cmap->num_encodings = face->bdffont->glyphs_used; @@ -73,20 +76,24 @@ THE SOFTWARE. FT_CALLBACK_DEF( void ) - bdf_cmap_done( BDF_CMap cmap ) + bdf_cmap_done( FT_CMap bdfcmap ) { + BDF_CMap cmap = (BDF_CMap)bdfcmap; + + cmap->encodings = NULL; cmap->num_encodings = 0; } FT_CALLBACK_DEF( FT_UInt ) - bdf_cmap_char_index( BDF_CMap cmap, + bdf_cmap_char_index( FT_CMap bdfcmap, FT_UInt32 charcode ) { + BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_encoding_el* encodings = cmap->encodings; FT_UInt min, max, mid; - FT_UInt result = 0; + FT_UInt result = 0; min = 0; @@ -102,6 +109,8 @@ THE SOFTWARE. if ( charcode == code ) { + /* increase glyph index by 1 -- */ + /* we reserve slot 0 for the undefined glyph */ result = encodings[mid].glyph + 1; break; } @@ -117,9 +126,10 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_UInt ) - bdf_cmap_char_next( BDF_CMap cmap, + bdf_cmap_char_next( FT_CMap bdfcmap, FT_UInt32 *acharcode ) { + BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_encoding_el* encodings = cmap->encodings; FT_UInt min, max, mid; FT_UInt32 charcode = *acharcode + 1; @@ -139,6 +149,8 @@ THE SOFTWARE. if ( charcode == code ) { + /* increase glyph index by 1 -- */ + /* we reserve slot 0 for the undefined glyph */ result = encodings[mid].glyph + 1; goto Exit; } @@ -162,13 +174,14 @@ THE SOFTWARE. } - FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec bdf_cmap_class = + FT_CALLBACK_TABLE_DEF + const FT_CMap_ClassRec bdf_cmap_class = { - sizeof( BDF_CMapRec ), - (FT_CMap_InitFunc) bdf_cmap_init, - (FT_CMap_DoneFunc) bdf_cmap_done, - (FT_CMap_CharIndexFunc)bdf_cmap_char_index, - (FT_CMap_CharNextFunc) bdf_cmap_char_next + sizeof ( BDF_CMapRec ), + bdf_cmap_init, + bdf_cmap_done, + bdf_cmap_char_index, + bdf_cmap_char_next }; @@ -284,9 +297,10 @@ THE SOFTWARE. } - FT_CALLBACK_DEF( FT_Error ) - BDF_Face_Done( BDF_Face face ) + FT_CALLBACK_DEF( void ) + BDF_Face_Done( FT_Face bdfface ) /* BDF_Face */ { + BDF_Face face = (BDF_Face)bdfface; FT_Memory memory = FT_FACE_MEMORY( face ); @@ -296,26 +310,25 @@ THE SOFTWARE. FT_FREE( face->charset_encoding ); FT_FREE( face->charset_registry ); - FT_FREE( face->root.family_name ); + FT_FREE( bdfface->family_name ); - FT_FREE( face->root.available_sizes ); + FT_FREE( bdfface->available_sizes ); FT_FREE( face->bdffont ); FT_TRACE4(( "BDF_Face_Done: done face\n" )); - - return BDF_Err_Ok; } FT_CALLBACK_DEF( FT_Error ) BDF_Face_Init( FT_Stream stream, - BDF_Face face, + FT_Face bdfface, /* BDF_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { FT_Error error = BDF_Err_Ok; + BDF_Face face = (BDF_Face)bdfface; FT_Memory memory = FT_FACE_MEMORY( face ); bdf_font_t* font; @@ -346,7 +359,6 @@ THE SOFTWARE. /* we have a bdf font: let's construct the face object */ face->bdffont = font; { - FT_Face root = FT_FACE( face ); bdf_property_t* prop = NULL; @@ -357,18 +369,18 @@ THE SOFTWARE. font->unencoded_size, font->unencoded_used )); - root->num_faces = 1; - root->face_index = 0; - root->face_flags = FT_FACE_FLAG_FIXED_SIZES | - FT_FACE_FLAG_HORIZONTAL | - FT_FACE_FLAG_FAST_GLYPHS; + bdfface->num_faces = 1; + bdfface->face_index = 0; + bdfface->face_flags = FT_FACE_FLAG_FIXED_SIZES | + FT_FACE_FLAG_HORIZONTAL | + FT_FACE_FLAG_FAST_GLYPHS; prop = bdf_get_font_property( font, "SPACING" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && ( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' || *(prop->value.atom) == 'C' || *(prop->value.atom) == 'c' ) ) - root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; + bdfface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; /* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */ /* FZ XXX: I need a font to implement this */ @@ -379,36 +391,38 @@ THE SOFTWARE. int l = ft_strlen( prop->value.atom ) + 1; - if ( FT_NEW_ARRAY( root->family_name, l ) ) + if ( FT_NEW_ARRAY( bdfface->family_name, l ) ) goto Exit; - ft_strcpy( root->family_name, prop->value.atom ); + ft_strcpy( bdfface->family_name, prop->value.atom ); } else - root->family_name = 0; + bdfface->family_name = 0; if ( ( error = bdf_interpret_style( face ) ) != 0 ) goto Exit; - root->num_glyphs = font->glyphs_size; /* unencoded included */ + /* the number of glyphs (with one slot for the undefined glyph */ + /* at position 0 and all unencoded glyphs) */ + bdfface->num_glyphs = font->glyphs_size + 1; - root->num_fixed_sizes = 1; - if ( FT_NEW_ARRAY( root->available_sizes, 1 ) ) + bdfface->num_fixed_sizes = 1; + if ( FT_NEW_ARRAY( bdfface->available_sizes, 1 ) ) goto Exit; { - FT_Bitmap_Size* bsize = root->available_sizes; + FT_Bitmap_Size* bsize = bdfface->available_sizes; FT_Short resolution_x = 0, resolution_y = 0; FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) ); - bsize->height = font->font_ascent + font->font_descent; + bsize->height = (FT_Short)( font->font_ascent + font->font_descent ); prop = bdf_get_font_property( font, "AVERAGE_WIDTH" ); if ( prop ) bsize->width = (FT_Short)( ( prop->value.int32 + 5 ) / 10 ); else - bsize->width = bsize->height * 2/3; + bsize->width = (FT_Short)( bsize->height * 2/3 ); prop = bdf_get_font_property( font, "POINT_SIZE" ); if ( prop ) @@ -449,11 +463,15 @@ THE SOFTWARE. if ( FT_NEW_ARRAY( face->en_table, font->glyphs_size ) ) goto Exit; + face->default_glyph = 0; for ( n = 0; n < font->glyphs_size; n++ ) { (face->en_table[n]).enc = cur[n].encoding; FT_TRACE4(( "idx %d, val 0x%lX\n", n, cur[n].encoding )); (face->en_table[n]).glyph = (FT_Short)n; + + if ( cur[n].encoding == font->default_char ) + face->default_glyph = n; } } @@ -521,8 +539,8 @@ THE SOFTWARE. #if 0 /* Select default charmap */ - if (root->num_charmaps) - root->charmap = root->charmaps[0]; + if ( bdfface->num_charmaps ) + bdfface->charmap = bdfface->charmaps[0]; #endif } @@ -544,8 +562,8 @@ THE SOFTWARE. error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); /* Select default charmap */ - if (root->num_charmaps) - root->charmap = root->charmaps[0]; + if ( bdfface->num_charmaps ) + bdfface->charmap = bdfface->charmaps[0]; } } } @@ -554,17 +572,52 @@ THE SOFTWARE. return error; Fail: - BDF_Face_Done( face ); + BDF_Face_Done( bdfface ); return BDF_Err_Unknown_File_Format; } - static FT_Error - BDF_Set_Pixel_Size( FT_Size size ) + FT_CALLBACK_DEF( FT_Error ) + BDF_Set_Pixel_Size( FT_Size size, + FT_UInt char_width, + FT_UInt char_height ) { BDF_Face face = (BDF_Face)FT_SIZE_FACE( size ); FT_Face root = FT_FACE( face ); + FT_UNUSED( char_width ); + + + if ( char_height == (FT_UInt)root->available_sizes->height ) + { + size->metrics.ascender = face->bdffont->font_ascent << 6; + size->metrics.descender = -face->bdffont->font_descent << 6; + size->metrics.height = ( face->bdffont->font_ascent + + face->bdffont->font_descent ) << 6; + size->metrics.max_advance = face->bdffont->bbx.width << 6; + + return BDF_Err_Ok; + } + else + return BDF_Err_Invalid_Pixel_Size; + } + + + FT_CALLBACK_DEF( FT_Error ) + BDF_Set_Point_Size( FT_Size size, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ) + { + BDF_Face face = (BDF_Face)FT_SIZE_FACE( size ); + FT_Face root = FT_FACE( face ); + + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); + FT_UNUSED( horz_resolution ); + FT_UNUSED( vert_resolution ); + FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem, root->available_sizes->y_ppem )); @@ -584,19 +637,17 @@ THE SOFTWARE. } - static FT_Error + FT_CALLBACK_DEF( FT_Error ) BDF_Glyph_Load( FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags ) { - BDF_Face face = (BDF_Face)FT_SIZE_FACE( size ); - FT_Error error = BDF_Err_Ok; - FT_Bitmap* bitmap = &slot->bitmap; - bdf_glyph_t glyph; - int bpp = face->bdffont->bpp; - int i, j, count; - unsigned char *p, *pp; + BDF_Face face = (BDF_Face)FT_SIZE_FACE( size ); + FT_Error error = BDF_Err_Ok; + FT_Bitmap* bitmap = &slot->bitmap; + bdf_glyph_t glyph; + int bpp = face->bdffont->bpp; FT_UNUSED( load_flags ); @@ -607,7 +658,10 @@ THE SOFTWARE. goto Exit; } - if ( glyph_index > 0 ) + /* index 0 is the undefined glyph */ + if ( glyph_index == 0 ) + glyph_index = face->default_glyph; + else glyph_index--; /* slot, bitmap => freetype, glyph => bdflib */ @@ -615,109 +669,27 @@ THE SOFTWARE. bitmap->rows = glyph.bbx.height; bitmap->width = glyph.bbx.width; + bitmap->pitch = glyph.bpr; - if ( bpp == 1 ) + /* note: we don't allocate a new array to hold the bitmap; */ + /* we can simply point to it */ + ft_glyphslot_set_bitmap( slot, glyph.bitmap ); + + switch ( bpp ) { + case 1: bitmap->pixel_mode = FT_PIXEL_MODE_MONO; - bitmap->pitch = glyph.bpr; - - /* note: we don't allocate a new array to hold the bitmap, we */ - /* can simply point to it */ - ft_glyphslot_set_bitmap( slot, glyph.bitmap ); - } - else - { - /* blow up pixmap to have 8 bits per pixel */ + break; + case 2: + bitmap->pixel_mode = FT_PIXEL_MODE_GRAY2; + break; + case 4: + bitmap->pixel_mode = FT_PIXEL_MODE_GRAY4; + break; + case 8: bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; - bitmap->pitch = bitmap->width; - - error = ft_glyphslot_alloc_bitmap( slot, bitmap->rows * bitmap->pitch ); - if ( error ) - goto Exit; - - switch ( bpp ) - { - case 2: - bitmap->num_grays = 4; - - count = 0; - p = glyph.bitmap; - - for ( i = 0; i < bitmap->rows; i++ ) - { - pp = p; - - /* get the full bytes */ - for ( j = 0; j < ( bitmap->width >> 2 ); j++ ) - { - bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xC0 ) >> 6 ); - bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x30 ) >> 4 ); - bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x0C ) >> 2 ); - bitmap->buffer[count++] = (FT_Byte)( *pp & 0x03 ); - - pp++; - } - - /* get remaining pixels (if any) */ - switch ( bitmap->width & 3 ) - { - case 3: - bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xC0 ) >> 6 ); - /* fall through */ - case 2: - bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x30 ) >> 4 ); - /* fall through */ - case 1: - bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0x0C ) >> 2 ); - /* fall through */ - case 0: - break; - } - - p += glyph.bpr; - } - break; - - case 4: - bitmap->num_grays = 16; - - count = 0; - p = glyph.bitmap; - - for ( i = 0; i < bitmap->rows; i++ ) - { - pp = p; - - /* get the full bytes */ - for ( j = 0; j < ( bitmap->width >> 1 ); j++ ) - { - bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xF0 ) >> 4 ); - bitmap->buffer[count++] = (FT_Byte)( *pp & 0x0F ); - - pp++; - } - - /* get remaining pixel (if any) */ - switch ( bitmap->width & 1 ) - { - case 1: - bitmap->buffer[count++] = (FT_Byte)( ( *pp & 0xF0 ) >> 4 ); - /* fall through */ - case 0: - break; - } - - p += glyph.bpr; - } - break; - - case 8: - bitmap->num_grays = 256; - - FT_MEM_COPY( bitmap->buffer, glyph.bitmap, - bitmap->rows * bitmap->pitch ); - break; - } + bitmap->num_grays = 256; + break; } slot->bitmap_left = glyph.bbx.x_offset; @@ -784,6 +756,7 @@ THE SOFTWARE. return BDF_Err_Invalid_Argument; } + static FT_Error bdf_get_charset_id( BDF_Face face, const char* *acharset_encoding, @@ -817,7 +790,7 @@ THE SOFTWARE. }; - static FT_Module_Interface + FT_CALLBACK_DEF( FT_Module_Interface ) bdf_driver_requester( FT_Module module, const char* name ) { @@ -851,21 +824,21 @@ THE SOFTWARE. sizeof ( FT_SizeRec ), sizeof ( FT_GlyphSlotRec ), - (FT_Face_InitFunc) BDF_Face_Init, - (FT_Face_DoneFunc) BDF_Face_Done, - (FT_Size_InitFunc) 0, - (FT_Size_DoneFunc) 0, - (FT_Slot_InitFunc) 0, - (FT_Slot_DoneFunc) 0, + BDF_Face_Init, + BDF_Face_Done, + 0, /* FT_Size_InitFunc */ + 0, /* FT_Size_DoneFunc */ + 0, /* FT_Slot_InitFunc */ + 0, /* FT_Slot_DoneFunc */ - (FT_Size_ResetPointsFunc) BDF_Set_Pixel_Size, - (FT_Size_ResetPixelsFunc) BDF_Set_Pixel_Size, + BDF_Set_Point_Size, + BDF_Set_Pixel_Size, - (FT_Slot_LoadFunc) BDF_Glyph_Load, + BDF_Glyph_Load, - (FT_Face_GetKerningFunc) 0, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc) 0 + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ + 0, /* FT_Face_GetAdvancesFunc */ }; diff --git a/src/libs/freetype2/bdf/bdfdrivr.h b/src/libs/freetype2/bdf/bdfdrivr.h index 148041ff24..86f40ee4af 100644 --- a/src/libs/freetype2/bdf/bdfdrivr.h +++ b/src/libs/freetype2/bdf/bdfdrivr.h @@ -2,7 +2,7 @@ FreeType font driver for bdf fonts - Copyright (C) 2001, 2002, 2003 by + Copyright (C) 2001, 2002, 2003, 2004 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -59,6 +59,8 @@ FT_BEGIN_HEADER FT_CharMap charmap_handle; FT_CharMapRec charmap; /* a single charmap per face */ + FT_UInt default_glyph; + } BDF_FaceRec, *BDF_Face; diff --git a/src/libs/freetype2/bdf/bdflib.c b/src/libs/freetype2/bdf/bdflib.c index be0e3987e4..31100ed743 100644 --- a/src/libs/freetype2/bdf/bdflib.c +++ b/src/libs/freetype2/bdf/bdflib.c @@ -1,6 +1,6 @@ /* * Copyright 2000 Computing Research Labs, New Mexico State University - * Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli + * Copyright 2001, 2002, 2003, 2004, 2005 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"), @@ -224,7 +224,6 @@ if ( FT_NEW_ARRAY( ht->table, ht->size ) ) goto Exit; - FT_MEM_ZERO( ht->table, sizeof ( hashnode ) * ht->size ); for ( i = 0, bp = obp; i < sz; i++, bp++ ) { @@ -255,7 +254,6 @@ if ( FT_NEW_ARRAY( ht->table, sz ) ) goto Exit; - FT_MEM_ZERO( ht->table, sizeof ( hashnode ) * sz ); Exit: return error; @@ -351,6 +349,7 @@ char** field; unsigned long size; unsigned long used; + FT_Memory memory; } _bdf_list_t; @@ -389,20 +388,126 @@ #define sbitset( m, cc ) ( m[(cc) >> 3] & ( 1 << ( (cc) & 7 ) ) ) + static void + _bdf_list_init( _bdf_list_t* list, + FT_Memory memory ) + { + FT_ZERO( list ); + list->memory = memory; + } + + + static void + _bdf_list_done( _bdf_list_t* list ) + { + FT_Memory memory = list->memory; + + + if ( memory ) + { + FT_FREE( list->field ); + FT_ZERO( list ); + } + } + + + static FT_Error + _bdf_list_ensure( _bdf_list_t* list, + int num_items ) + { + FT_Error error = BDF_Err_Ok; + + + if ( num_items > (int)list->size ) + { + int oldsize = list->size; + int newsize = oldsize + ( oldsize >> 1 ) + 4; + int bigsize = FT_INT_MAX / sizeof ( char* ); + FT_Memory memory = list->memory; + + + if ( oldsize == bigsize ) + { + error = BDF_Err_Out_Of_Memory; + goto Exit; + } + else if ( newsize < oldsize || newsize > bigsize ) + newsize = bigsize; + + if ( FT_RENEW_ARRAY( list->field, oldsize, newsize ) ) + goto Exit; + + list->size = newsize; + } + + Exit: + return error; + } + + + static void + _bdf_list_shift( _bdf_list_t* list, + unsigned long n ) + { + unsigned long i, u; + + + if ( list == 0 || list->used == 0 || n == 0 ) + return; + + if ( n >= list->used ) + { + list->used = 0; + return; + } + + for ( u = n, i = 0; u < list->used; i++, u++ ) + list->field[i] = list->field[u]; + list->used -= n; + } + + + static char * + _bdf_list_join( _bdf_list_t* list, + int c, + unsigned long *alen ) + { + unsigned long i, j; + char *fp, *dp; + + + *alen = 0; + + if ( list == 0 || list->used == 0 ) + return 0; + + dp = list->field[0]; + for ( i = j = 0; i < list->used; i++ ) + { + fp = list->field[i]; + while ( *fp ) + dp[j++] = *fp++; + + if ( i + 1 < list->used ) + dp[j++] = (char)c; + } + dp[j] = 0; + + *alen = j; + return dp; + } + + /* An empty string for empty fields. */ static const char empty[1] = { 0 }; /* XXX eliminate this */ - /* Assume the line is NULL-terminated and that the `list' parameter */ - /* was initialized the first time it was used. */ - static FT_Error - _bdf_split( char* separators, - char* line, - unsigned long linelen, - _bdf_list_t* list, - FT_Memory memory ) + _bdf_list_split( _bdf_list_t* list, + char* separators, + char* line, + unsigned long linelen ) { int mult, final_empty; char *sp, *ep, *end; @@ -451,20 +556,9 @@ /* Resize the list if necessary. */ if ( list->used == list->size ) { - if ( list->size == 0 ) - { - if ( FT_NEW_ARRAY( list->field, 5 ) ) - goto Exit; - } - else - { - if ( FT_RENEW_ARRAY ( list->field , - list->size, - list->size + 5 ) ) - goto Exit; - } - - list->size += 5; + error = _bdf_list_ensure( list, list->used + 1 ); + if ( error ) + goto Exit; } /* Assign the field appropriately. */ @@ -489,48 +583,16 @@ } /* Finally, NULL-terminate the list. */ - if ( list->used + final_empty + 1 >= list->size ) + if ( list->used + final_empty >= list->size ) { - if ( list->used == list->size ) - { - if ( list->size == 0 ) - { - if ( FT_NEW_ARRAY( list->field, 5 ) ) - goto Exit; - } - else - { - if ( FT_RENEW_ARRAY( list->field, - list->size, - list->size + 5 ) ) - goto Exit; - } - - list->size += 5; - } + error = _bdf_list_ensure( list, list->used + final_empty + 1 ); + if ( error ) + goto Exit; } if ( final_empty ) list->field[list->used++] = (char*)empty; - if ( list->used == list->size ) - { - if ( list->size == 0 ) - { - if ( FT_NEW_ARRAY( list->field, 5 ) ) - goto Exit; - } - else - { - if ( FT_RENEW_ARRAY( list->field, - list->size, - list->size + 5 ) ) - goto Exit; - } - - list->size += 5; - } - list->field[list->used] = 0; Exit: @@ -538,99 +600,7 @@ } - static void - _bdf_shift( unsigned long n, - _bdf_list_t* list ) - { - unsigned long i, u; - - - if ( list == 0 || list->used == 0 || n == 0 ) - return; - - if ( n >= list->used ) - { - list->used = 0; - return; - } - - for ( u = n, i = 0; u < list->used; i++, u++ ) - list->field[i] = list->field[u]; - list->used -= n; - } - - - static char * - _bdf_join( int c, - unsigned long* len, - _bdf_list_t* list ) - { - unsigned long i, j; - char *fp, *dp; - - - if ( list == 0 || list->used == 0 ) - return 0; - - *len = 0; - - dp = list->field[0]; - for ( i = j = 0; i < list->used; i++ ) - { - fp = list->field[i]; - while ( *fp ) - dp[j++] = *fp++; - - if ( i + 1 < list->used ) - dp[j++] = (char)c; - } - dp[j] = 0; - - *len = j; - return dp; - } - - - /* High speed file reader that passes each line to a callback. */ - static FT_Error - bdf_internal_readstream( FT_Stream stream, - char* buffer, - int count, - int *read_bytes ) - { - int rbytes; - unsigned long pos = stream->pos; - FT_Error error = BDF_Err_Ok; - - - if ( pos > stream->size ) - { - FT_ERROR(( "bdf_internal_readstream:" )); - FT_ERROR(( " invalid i/o; pos = 0x%lx, size = 0x%lx\n", - pos, stream->size )); - error = BDF_Err_Invalid_Stream_Operation; - goto Exit; - } - - if ( stream->read ) - rbytes = stream->read( stream, pos, - (unsigned char *)buffer, count ); - else - { - rbytes = stream->size - pos; - if ( rbytes > count ) - rbytes = count; - - FT_MEM_COPY( buffer, stream->base + pos, rbytes ); - } - - stream->pos = pos + rbytes; - - *read_bytes = rbytes; - - Exit: - return error; - } +#define NO_SKIP 256 /* this value cannot be stored in a 'char' */ static FT_Error @@ -640,10 +610,10 @@ unsigned long *lno ) { _bdf_line_func_t cb; - unsigned long lineno; - int n, done, refill, bytes, hold; - char *ls, *le, *pp, *pe, *hp; - char *buf = 0; + unsigned long lineno, buf_size; + int refill, bytes, hold, to_skip; + int start, end, cursor, avail; + char* buf = 0; FT_Memory memory = stream->memory; FT_Error error = BDF_Err_Ok; @@ -654,85 +624,115 @@ goto Exit; } - if ( FT_NEW_ARRAY( buf, 65536L ) ) + /* initial size and allocation of the input buffer */ + buf_size = 1024; + + if ( FT_NEW_ARRAY( buf, buf_size ) ) goto Exit; - cb = callback; - lineno = 1; - buf[0] = 0; + cb = callback; + lineno = 1; + buf[0] = 0; + start = 0; + end = 0; + avail = 0; + cursor = 0; + refill = 1; + to_skip = NO_SKIP; + bytes = 0; /* make compiler happy */ - done = 0; - pp = ls = le = buf; - - bytes = 65536L; - - while ( !done ) + for (;;) { - error = bdf_internal_readstream( stream, pp, bytes, &n ); - if ( error ) - goto Exit; - - if ( n == 0 ) - break; - - /* Determine the new end of the buffer pages. */ - pe = pp + n; - - for ( refill = 0; done == 0 && refill == 0; ) + if ( refill ) { - while ( le < pe && *le != '\n' && *le != '\r' ) - le++; + bytes = (int)FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor, + (FT_ULong)(buf_size - cursor) ); + avail = cursor + bytes; + cursor = 0; + refill = 0; + } - if ( le == pe ) + end = start; + + /* should we skip an optional character like \n or \r? */ + if ( start < avail && buf[start] == to_skip ) + { + start += 1; + to_skip = NO_SKIP; + continue; + } + + /* try to find the end of the line */ + while ( end < avail && buf[end] != '\n' && buf[end] != '\r' ) + end++; + + /* if we hit the end of the buffer, try shifting its content */ + /* or even resizing it */ + if ( end >= avail ) + { + if ( bytes == 0 ) /* last line in file doesn't end in \r or \n */ + break; /* ignore it then exit */ + + if ( start == 0 ) { - /* Hit the end of the last page in the buffer. Need to find */ - /* out how many pages to shift and how many pages need to be */ - /* read in. Adjust the line start and end pointers down to */ - /* point to the right places in the pages. */ + /* this line is definitely too long; try resizing the input */ + /* buffer a bit to handle it. */ + FT_ULong new_size; - pp = buf + ( ( ( ls - buf ) >> 13 ) << 13 ); - n = pp - buf; - ls -= n; - le -= n; - n = pe - pp; - FT_MEM_MOVE( buf, pp, n ); + if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */ + { + error = BDF_Err_Invalid_Argument; + goto Exit; + } - pp = buf + n; - bytes = 65536L - n; - refill = 1; + new_size = buf_size * 2; + if ( FT_RENEW_ARRAY( buf, buf_size, new_size ) ) + goto Exit; + + cursor = buf_size; + buf_size = new_size; } else { - /* Temporarily NULL-terminate the line. */ - hp = le; - hold = *le; - *le = 0; + bytes = avail - start; - /* XXX: Use encoding independent value for 0x1a */ - if ( *ls != '#' && *ls != 0x1a && - le > ls && - ( error = (*cb)( ls, le - ls, lineno, (void *)&cb, - client_data ) ) != BDF_Err_Ok ) - done = 1; - else - { - ls = ++le; - /* Handle the case of DOS crlf sequences. */ - if ( le < pe && hold == '\n' && *le =='\r' ) - ls = ++le; - } + FT_MEM_COPY( buf, buf + start, bytes ); - /* Increment the line number. */ - lineno++; - - /* Restore the character at the end of the line. */ - *hp = (char)hold; + cursor = bytes; + avail -= bytes; + start = 0; } + refill = 1; + continue; } + + /* Temporarily NUL-terminate the line. */ + hold = buf[end]; + buf[end] = 0; + + /* XXX: Use encoding independent value for 0x1a */ + if ( buf[start] != '#' && buf[start] != 0x1a && end > start ) + { + error = (*cb)( buf + start, end - start, lineno, + (void*)&cb, client_data ); + if ( error ) + break; + } + + lineno += 1; + buf[end] = (char)hold; + start = end + 1; + + if ( hold == '\n' ) + to_skip = '\r'; + else if ( hold == '\r' ) + to_skip = '\n'; + else + to_skip = NO_SKIP; } - *lno = lineno; + *lno = lineno; Exit: FT_FREE( buf ); @@ -955,7 +955,8 @@ if ( c1->encoding < c2->encoding ) return -1; - else if ( c1->encoding > c2->encoding ) + + if ( c1->encoding > c2->encoding ) return 1; return 0; @@ -979,23 +980,16 @@ if ( hash_lookup( name, &(font->proptbl) ) ) goto Exit; - if ( font->nuser_props == 0 ) - { - if ( FT_NEW_ARRAY( font->user_props, 1 ) ) - goto Exit; - } - else - { - if ( FT_RENEW_ARRAY( font->user_props, - font->nuser_props, - font->nuser_props + 1 ) ) - goto Exit; - } + if ( FT_RENEW_ARRAY( font->user_props, + font->nuser_props, + font->nuser_props + 1 ) ) + goto Exit; p = font->user_props + font->nuser_props; - FT_MEM_ZERO( p, sizeof ( bdf_property_t ) ); + FT_ZERO( p ); n = (unsigned long)( ft_strlen( name ) + 1 ); + if ( FT_NEW_ARRAY( p->name, n ) ) goto Exit; @@ -1110,23 +1104,16 @@ FT_Error error = BDF_Err_Ok; - if ( font->comments_len == 0 ) - { - if ( FT_NEW_ARRAY( font->comments, len + 1 ) ) - goto Exit; - } - else - { - if ( FT_RENEW_ARRAY( font->comments, - font->comments_len, - font->comments_len + len + 1 ) ) - goto Exit; - } + if ( FT_RENEW_ARRAY( font->comments, + font->comments_len, + font->comments_len + len + 1 ) ) + goto Exit; cp = font->comments + font->comments_len; + FT_MEM_COPY( cp, comment, len ); - cp += len; - *cp++ = '\n'; + cp[len] = '\n'; + font->comments_len += len + 1; Exit: @@ -1155,16 +1142,16 @@ memory = font->memory; + _bdf_list_init( &list, memory ); + font->spacing = opts->font_spacing; len = (unsigned long)( ft_strlen( font->name ) + 1 ); FT_MEM_COPY( name, font->name, len ); - list.size = list.used = 0; - - error = _bdf_split( (char *)"-", name, len, &list, memory ); + error = _bdf_list_split( &list, (char *)"-", name, len ); if ( error ) - goto Exit; + goto Fail; if ( list.used == 15 ) { @@ -1185,7 +1172,8 @@ } } - FT_FREE( list.field ); + Fail: + _bdf_list_done( &list ); Exit: return error; @@ -1404,7 +1392,7 @@ /* present, and the SPACING property should override the default */ /* spacing. */ if ( ft_memcmp( name, "DEFAULT_CHAR", 12 ) == 0 ) - font->default_glyph = fp->value.int32; + font->default_char = fp->value.int32; else if ( ft_memcmp( name, "FONT_ASCENT", 11 ) == 0 ) font->font_ascent = fp->value.int32; else if ( ft_memcmp( name, "FONT_DESCENT", 12 ) == 0 ) @@ -1484,7 +1472,7 @@ goto Exit; } - error = _bdf_split( (char *)" +", line, linelen, &p->list, memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; p->cnt = font->glyphs_size = _bdf_atoul( p->list.field[1], 0, 10 ); @@ -1538,15 +1526,17 @@ /* encoding can be checked for an unencoded character. */ FT_FREE( p->glyph_name ); - error = _bdf_split( (char *)" +", line, linelen, &p->list,memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; - _bdf_shift( 1, &p->list ); - s = _bdf_join( ' ', &slen, &p->list ); + _bdf_list_shift( &p->list, 1 ); + + s = _bdf_list_join( &p->list, ' ', &slen ); if ( FT_NEW_ARRAY( p->glyph_name, slen + 1 ) ) goto Exit; + FT_MEM_COPY( p->glyph_name, s, slen + 1 ); p->flags |= _BDF_GLYPH; @@ -1565,9 +1555,10 @@ goto Exit; } - error = _bdf_split( (char *)" +", line, linelen, &p->list, memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; + p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 ); /* Check to see whether this encoding has already been encountered. */ @@ -1598,8 +1589,7 @@ font->glyphs_size, font->glyphs_size + 64 ) ) goto Exit; - FT_MEM_ZERO( font->glyphs + font->glyphs_size, - sizeof ( bdf_glyph_t ) * 64 ); /* FZ inutile */ + font->glyphs_size += 64; } @@ -1619,18 +1609,11 @@ /* Allocate the next unencoded glyph. */ if ( font->unencoded_used == font->unencoded_size ) { - if ( font->unencoded_size == 0 ) - { - if ( FT_NEW_ARRAY( font->unencoded, 4 ) ) - goto Exit; - } - else - { - if ( FT_RENEW_ARRAY( font->unencoded , - font->unencoded_size, - font->unencoded_size + 4 ) ) - goto Exit; - } + if ( FT_RENEW_ARRAY( font->unencoded , + font->unencoded_size, + font->unencoded_size + 4 ) ) + goto Exit; + font->unencoded_size += 4; } @@ -1719,9 +1702,10 @@ goto Exit; } - error = _bdf_split( (char *)" +", line, linelen, &p->list, memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; + glyph->swidth = (unsigned short)_bdf_atoul( p->list.field[1], 0, 10 ); p->flags |= _BDF_SWIDTH; @@ -1731,9 +1715,10 @@ /* Expect the DWIDTH (scalable width) field next. */ if ( ft_memcmp( line, "DWIDTH", 6 ) == 0 ) { - error = _bdf_split( (char *)" +", line, linelen, &p->list,memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; + glyph->dwidth = (unsigned short)_bdf_atoul( p->list.field[1], 0, 10 ); if ( !( p->flags & _BDF_SWIDTH ) ) @@ -1755,7 +1740,7 @@ /* Expect the BBX field next. */ if ( ft_memcmp( line, "BBX", 3 ) == 0 ) { - error = _bdf_split( (char *)" +", line, linelen, &p->list, memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; @@ -1862,7 +1847,6 @@ char* name; char* value; char nbuf[128]; - FT_Memory memory; FT_Error error = BDF_Err_Ok; FT_UNUSED( lineno ); @@ -1871,8 +1855,6 @@ next = (_bdf_line_func_t *)call_data; p = (_bdf_parse_t *) client_data; - memory = p->font->memory; - /* Check for the end of the properties. */ if ( ft_memcmp( line, "ENDPROPERTIES", 13 ) == 0 ) { @@ -1936,13 +1918,13 @@ } else { - error = _bdf_split( (char *)" +", line, linelen, &p->list, memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; name = p->list.field[0]; - _bdf_shift( 1, &p->list ); - value = _bdf_join( ' ', &vlen, &p->list ); + _bdf_list_shift( &p->list, 1 ); + value = _bdf_list_join( &p->list, ' ', &vlen ); error = _bdf_add_property( p->font, name, value ); if ( error ) @@ -2048,8 +2030,8 @@ error = hash_init( (hashtable *)p->font->internal,memory ); if ( error ) goto Exit; - p->font->spacing = p->opts->font_spacing; - p->font->default_glyph = -1; + p->font->spacing = p->opts->font_spacing; + p->font->default_char = -1; goto Exit; } @@ -2057,7 +2039,7 @@ /* Check for the start of the properties. */ if ( ft_memcmp( line, "STARTPROPERTIES", 15 ) == 0 ) { - error = _bdf_split( (char *)" +", line, linelen, &p->list, memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1], 0, 10 ); @@ -2082,7 +2064,7 @@ goto Exit; } - error = _bdf_split( (char *)" +", line, linelen, &p->list , memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; @@ -2105,12 +2087,12 @@ /* The next thing to check for is the FONT field. */ if ( ft_memcmp( line, "FONT", 4 ) == 0 ) { - error = _bdf_split( (char *)" +", line, linelen, &p->list , memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; - _bdf_shift( 1, &p->list ); + _bdf_list_shift( &p->list, 1 ); - s = _bdf_join( ' ', &slen, &p->list ); + s = _bdf_list_join( &p->list, ' ', &slen ); if ( FT_NEW_ARRAY( p->font->name, slen + 1 ) ) goto Exit; FT_MEM_COPY( p->font->name, s, slen + 1 ); @@ -2137,7 +2119,7 @@ goto Exit; } - error = _bdf_split( (char *)" +", line, linelen, &p->list, memory ); + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; @@ -2207,7 +2189,7 @@ FT_Error error = BDF_Err_Ok; - if ( FT_ALLOC( p, sizeof ( _bdf_parse_t ) ) ) + if ( FT_NEW( p ) ) goto Exit; memory = NULL; @@ -2215,6 +2197,8 @@ p->minlb = 32767; p->memory = extmemory; /* only during font creation */ + _bdf_list_init( &p->list, extmemory ); + error = _bdf_readstream( stream, _bdf_parse_start, (void *)p, &lineno ); if ( error ) @@ -2301,10 +2285,6 @@ } } - /* Free up the list used during the parsing. */ - if ( memory != NULL ) - FT_FREE( p->list.field ); - if ( p->font != 0 ) { /* Make sure the comments are NULL terminated if they exist. */ @@ -2327,7 +2307,10 @@ Exit: if ( p ) { + _bdf_list_done( &p->list ); + memory = extmemory; + FT_FREE( p ); } diff --git a/src/libs/freetype2/cache/Jamfile b/src/libs/freetype2/cache/Jamfile index bef45ae448..27816e3fe9 100644 --- a/src/libs/freetype2/cache/Jamfile +++ b/src/libs/freetype2/cache/Jamfile @@ -26,4 +26,5 @@ UseFreeTypeHeaders ; FT2_Library $(FT2_LIB) : $(_sources).c ; } -# end of src/cache Jamfile +# end of src/cache Jamfile + diff --git a/src/libs/freetype2/cache/ftcbasic.c b/src/libs/freetype2/cache/ftcbasic.c index 5d5061cfb2..689cdc61b0 100644 --- a/src/libs/freetype2/cache/ftcbasic.c +++ b/src/libs/freetype2/cache/ftcbasic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType basic cache interface (body). */ /* */ -/* Copyright 2003, 2004 by */ +/* Copyright 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,9 +38,9 @@ } FTC_BasicAttrRec, *FTC_BasicAttrs; -#define FTC_BASIC_ATTR_COMPARE( a, b ) \ - ( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \ - (a)->load_flags == (b)->load_flags ) +#define FTC_BASIC_ATTR_COMPARE( a, b ) \ + FT_BOOL( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \ + (a)->load_flags == (b)->load_flags ) #define FTC_BASIC_ATTR_HASH( a ) \ ( FTC_SCALER_HASH( &(a)->scaler ) + 31*(a)->load_flags ) @@ -63,18 +63,27 @@ FT_CALLBACK_DEF( FT_Bool ) - ftc_basic_family_compare( FTC_BasicFamily family, - FTC_BasicQuery query ) + ftc_basic_family_compare( FTC_MruNode ftcfamily, + FT_Pointer ftcquery ) { - return FT_BOOL( FTC_BASIC_ATTR_COMPARE( &family->attrs, &query->attrs ) ); + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FTC_BasicQuery query = (FTC_BasicQuery)ftcquery; + + + return FTC_BASIC_ATTR_COMPARE( &family->attrs, &query->attrs ); } FT_CALLBACK_DEF( FT_Error ) - ftc_basic_family_init( FTC_BasicFamily family, - FTC_BasicQuery query, - FTC_Cache cache ) + ftc_basic_family_init( FTC_MruNode ftcfamily, + FT_Pointer ftcquery, + FT_Pointer ftccache ) { + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FTC_BasicQuery query = (FTC_BasicQuery)ftcquery; + FTC_Cache cache = (FTC_Cache)ftccache; + + FTC_Family_Init( FTC_FAMILY( family ), cache ); family->attrs = query->attrs; return 0; @@ -82,12 +91,13 @@ FT_CALLBACK_DEF( FT_UInt ) - ftc_basic_family_get_count( FTC_BasicFamily family, - FTC_Manager manager ) + ftc_basic_family_get_count( FTC_Family ftcfamily, + FTC_Manager manager ) { - FT_Error error; - FT_Face face; - FT_UInt result = 0; + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FT_Error error; + FT_Face face; + FT_UInt result = 0; error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id, @@ -100,13 +110,14 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_basic_family_load_bitmap( FTC_BasicFamily family, - FT_UInt gindex, - FTC_Manager manager, - FT_Face *aface ) + ftc_basic_family_load_bitmap( FTC_Family ftcfamily, + FT_UInt gindex, + FTC_Manager manager, + FT_Face *aface ) { - FT_Error error; - FT_Size size; + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FT_Error error; + FT_Size size; error = FTC_Manager_LookupSize( manager, &family->attrs.scaler, &size ); @@ -126,15 +137,16 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_basic_family_load_glyph( FTC_BasicFamily family, - FT_UInt gindex, - FTC_Cache cache, - FT_Glyph *aglyph ) + ftc_basic_family_load_glyph( FTC_Family ftcfamily, + FT_UInt gindex, + FTC_Cache cache, + FT_Glyph *aglyph ) { - FT_Error error; - FTC_Scaler scaler = &family->attrs.scaler; - FT_Face face; - FT_Size size; + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FT_Error error; + FTC_Scaler scaler = &family->attrs.scaler; + FT_Face face; + FT_Size size; /* we will now load the glyph image */ @@ -173,11 +185,13 @@ FT_CALLBACK_DEF( FT_Bool ) - ftc_basic_gnode_compare_faceid( FTC_GNode gnode, - FTC_FaceID face_id, + ftc_basic_gnode_compare_faceid( FTC_Node ftcgnode, + FT_Pointer ftcface_id, FTC_Cache cache ) { - FTC_BasicFamily family = (FTC_BasicFamily)gnode->family; + FTC_GNode gnode = (FTC_GNode)ftcgnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + FTC_BasicFamily family = (FTC_BasicFamily)gnode->family; FT_Bool result; @@ -203,13 +217,13 @@ const FTC_IFamilyClassRec ftc_basic_image_family_class = { { - sizeof( FTC_BasicFamilyRec ), - (FTC_MruNode_CompareFunc)ftc_basic_family_compare, - (FTC_MruNode_InitFunc) ftc_basic_family_init, - (FTC_MruNode_ResetFunc) NULL, - (FTC_MruNode_DoneFunc) NULL + sizeof ( FTC_BasicFamilyRec ), + ftc_basic_family_compare, + ftc_basic_family_init, + 0, /* FTC_MruNode_ResetFunc */ + 0 /* FTC_MruNode_DoneFunc */ }, - (FTC_IFamily_LoadGlyphFunc)ftc_basic_family_load_glyph + ftc_basic_family_load_glyph }; @@ -217,20 +231,22 @@ const FTC_GCacheClassRec ftc_basic_image_cache_class = { { - (FTC_Node_NewFunc) ftc_inode_new, - (FTC_Node_WeightFunc) ftc_inode_weight, - (FTC_Node_CompareFunc)ftc_gnode_compare, - (FTC_Node_CompareFunc)ftc_basic_gnode_compare_faceid, - (FTC_Node_FreeFunc) ftc_inode_free, + ftc_inode_new, + ftc_inode_weight, + ftc_gnode_compare, + ftc_basic_gnode_compare_faceid, + ftc_inode_free, - sizeof( FTC_GCacheRec ), - (FTC_Cache_InitFunc) ftc_gcache_init, - (FTC_Cache_DoneFunc) ftc_gcache_done + sizeof ( FTC_GCacheRec ), + ftc_gcache_init, + ftc_gcache_done }, (FTC_MruListClass)&ftc_basic_image_family_class }; + /* documentation is in ftcache.h */ + FT_EXPORT_DEF( FT_Error ) FTC_ImageCache_New( FTC_Manager manager, FTC_ImageCache *acache ) @@ -240,7 +256,7 @@ } - /* documentation is in ftcimage.h */ + /* documentation is in ftcache.h */ FT_EXPORT_DEF( FT_Error ) FTC_ImageCache_Lookup( FTC_ImageCache cache, @@ -250,7 +266,7 @@ FTC_Node *anode ) { FTC_BasicQueryRec query; - FTC_INode node; + FTC_INode node = 0; /* make compiler happy */ FT_Error error; FT_UInt32 hash; @@ -319,13 +335,13 @@ { { sizeof( FTC_BasicFamilyRec ), - (FTC_MruNode_CompareFunc)ftc_basic_family_compare, - (FTC_MruNode_InitFunc) ftc_basic_family_init, - (FTC_MruNode_ResetFunc) NULL, - (FTC_MruNode_DoneFunc) NULL + ftc_basic_family_compare, + ftc_basic_family_init, + 0, /* FTC_MruNode_ResetFunc */ + 0 /* FTC_MruNode_DoneFunc */ }, - (FTC_SFamily_GetCountFunc) ftc_basic_family_get_count, - (FTC_SFamily_LoadGlyphFunc)ftc_basic_family_load_bitmap + ftc_basic_family_get_count, + ftc_basic_family_load_bitmap }; @@ -333,20 +349,22 @@ const FTC_GCacheClassRec ftc_basic_sbit_cache_class = { { - (FTC_Node_NewFunc) ftc_snode_new, - (FTC_Node_WeightFunc) ftc_snode_weight, - (FTC_Node_CompareFunc)ftc_snode_compare, - (FTC_Node_CompareFunc)ftc_basic_gnode_compare_faceid, - (FTC_Node_FreeFunc) ftc_snode_free, + ftc_snode_new, + ftc_snode_weight, + ftc_snode_compare, + ftc_basic_gnode_compare_faceid, + ftc_snode_free, - sizeof( FTC_GCacheRec ), - (FTC_Cache_InitFunc) ftc_gcache_init, - (FTC_Cache_DoneFunc) ftc_gcache_done + sizeof ( FTC_GCacheRec ), + ftc_gcache_init, + ftc_gcache_done }, (FTC_MruListClass)&ftc_basic_sbit_family_class }; + /* documentation is in ftcache.h */ + FT_EXPORT_DEF( FT_Error ) FTC_SBitCache_New( FTC_Manager manager, FTC_SBitCache *acache ) @@ -356,6 +374,8 @@ } + /* documentation is in ftcache.h */ + FT_EXPORT_DEF( FT_Error ) FTC_SBitCache_Lookup( FTC_SBitCache cache, FTC_ImageType type, @@ -365,7 +385,7 @@ { FT_Error error; FTC_BasicQueryRec query; - FTC_SNode node; + FTC_SNode node = 0; /* make compiler happy */ FT_UInt32 hash; diff --git a/src/libs/freetype2/cache/ftccache.c b/src/libs/freetype2/cache/ftccache.c index 2b6bee9cfe..ad036805f5 100644 --- a/src/libs/freetype2/cache/ftccache.c +++ b/src/libs/freetype2/cache/ftccache.c @@ -4,7 +4,7 @@ /* */ /* The FreeType internal cache interface (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -303,6 +303,13 @@ FT_EXPORT_DEF( FT_Error ) FTC_Cache_Init( FTC_Cache cache ) + { + return ftc_cache_init( cache ); + } + + + FT_LOCAL_DEF( FT_Error ) + ftc_cache_init( FTC_Cache cache ) { FT_Memory memory = cache->memory; @@ -315,13 +322,6 @@ } - FT_LOCAL_DEF( FT_Error ) - ftc_cache_init( FTC_Cache cache ) - { - return FTC_Cache_Init( cache ); - } - - FT_EXPORT_DEF( void ) FTC_Cache_Clear( FTC_Cache cache ) { @@ -360,8 +360,8 @@ } - FT_EXPORT_DEF( void ) - FTC_Cache_Done( FTC_Cache cache ) + FT_LOCAL_DEF( void ) + ftc_cache_done( FTC_Cache cache ) { if ( cache->memory ) { @@ -380,10 +380,10 @@ } - FT_LOCAL_DEF( void ) - ftc_cache_done( FTC_Cache cache ) + FT_EXPORT_DEF( void ) + FTC_Cache_Done( FTC_Cache cache ) { - FTC_Cache_Done( cache ); + ftc_cache_done( cache ); } @@ -424,65 +424,31 @@ FT_Error error; FTC_Node node; + /* - * Try to allocate a new cache node. Note that in case of - * out-of-memory error (OOM), we'll flush the cache a bit, - * then try again. - * - * On each try, the `tries' variable gives the number - * of old nodes we want to flush from the manager's global list - * before the next allocation attempt. It barely doubles on - * each iteration. - * + * We use the FTC_CACHE_TRYLOOP macros to support out-of-memory + * errors (OOM) correctly, i.e., by flushing the cache progressively + * in order to make more room. */ - error = cache->clazz.node_new( &node, query, cache ); + + FTC_CACHE_TRYLOOP( cache ) + { + error = cache->clazz.node_new( &node, query, cache ); + } + FTC_CACHE_TRYLOOP_END(); + if ( error ) - goto FlushCache; + node = NULL; + else + { + /* don't assume that the cache has the same number of buckets, since + * our allocation request might have triggered global cache flushing + */ + ftc_cache_add( cache, hash, node ); + } - AddNode: - /* don't assume that the cache has the same number of buckets, since - * our allocation request might have triggered global cache flushing - */ - ftc_cache_add( cache, hash, node ); - - Exit: *anode = node; return error; - - FlushCache: - node = NULL; - if ( error != FT_Err_Out_Of_Memory ) - goto Exit; - - { - FTC_Manager manager = cache->manager; - FT_UInt count, tries = 1; - - - for (;;) - { - error = cache->clazz.node_new( &node, query, cache ); - if ( !error ) - break; - - node = NULL; - if ( error != FT_Err_Out_Of_Memory ) - goto Exit; - - count = FTC_Manager_FlushN( manager, tries ); - if ( count == 0 ) - goto Exit; - - if ( count == tries ) - { - count = tries * 2; - if ( count < tries || count > manager->num_nodes ) - count = manager->num_nodes; - } - tries = count; - } - } - goto AddNode; } diff --git a/src/libs/freetype2/cache/ftccback.h b/src/libs/freetype2/cache/ftccback.h index 68be913850..6b47e095e8 100644 --- a/src/libs/freetype2/cache/ftccback.h +++ b/src/libs/freetype2/cache/ftccback.h @@ -28,46 +28,49 @@ FT_LOCAL( void ) - ftc_inode_free( FTC_INode inode, + ftc_inode_free( FTC_Node inode, FTC_Cache cache ); FT_LOCAL( FT_Error ) - ftc_inode_new( FTC_INode *pinode, - FTC_GQuery gquery, - FTC_Cache cache ); - - FT_LOCAL( FT_ULong ) - ftc_inode_weight( FTC_INode inode ); - - - FT_LOCAL( void ) - ftc_snode_free( FTC_SNode snode, - FTC_Cache cache ); - - FT_LOCAL( FT_Error ) - ftc_snode_new( FTC_SNode *psnode, - FTC_GQuery gquery, + ftc_inode_new( FTC_Node *pinode, + FT_Pointer gquery, FTC_Cache cache ); FT_LOCAL( FT_ULong ) - ftc_snode_weight( FTC_SNode snode ); + ftc_inode_weight( FTC_Node inode, + FTC_Cache cache ); + + + FT_LOCAL( void ) + ftc_snode_free( FTC_Node snode, + FTC_Cache cache ); + + FT_LOCAL( FT_Error ) + ftc_snode_new( FTC_Node *psnode, + FT_Pointer gquery, + FTC_Cache cache ); + + FT_LOCAL( FT_ULong ) + ftc_snode_weight( FTC_Node snode, + FTC_Cache cache ); FT_LOCAL( FT_Bool ) - ftc_snode_compare( FTC_SNode snode, - FTC_GQuery gquery, + ftc_snode_compare( FTC_Node snode, + FT_Pointer gquery, FTC_Cache cache ); FT_LOCAL( FT_Bool ) - ftc_gnode_compare( FTC_GNode gnode, - FTC_GQuery gquery ); + ftc_gnode_compare( FTC_Node gnode, + FT_Pointer gquery, + FTC_Cache cache ); FT_LOCAL( FT_Error ) - ftc_gcache_init( FTC_GCache cache ); + ftc_gcache_init( FTC_Cache cache ); FT_LOCAL( void ) - ftc_gcache_done( FTC_GCache cache ); + ftc_gcache_done( FTC_Cache cache ); FT_LOCAL( FT_Error ) diff --git a/src/libs/freetype2/cache/ftccmap.c b/src/libs/freetype2/cache/ftccmap.c index dfdbb488bc..02b814818d 100644 --- a/src/libs/freetype2/cache/ftccmap.c +++ b/src/libs/freetype2/cache/ftccmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType CharMap cache (body) */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -98,10 +98,11 @@ /* no need for specific finalizer; we use `ftc_node_done' directly */ FT_CALLBACK_DEF( void ) - ftc_cmap_node_free( FTC_CMapNode node, - FTC_Cache cache ) + ftc_cmap_node_free( FTC_Node ftcnode, + FTC_Cache cache ) { - FT_Memory memory = cache->memory; + FTC_CMapNode node = (FTC_CMapNode)ftcnode; + FT_Memory memory = cache->memory; FT_FREE( node ); @@ -110,14 +111,16 @@ /* initialize a new cmap node */ FT_CALLBACK_DEF( FT_Error ) - ftc_cmap_node_new( FTC_CMapNode *anode, - FTC_CMapQuery query, - FTC_Cache cache ) + ftc_cmap_node_new( FTC_Node *ftcanode, + FT_Pointer ftcquery, + FTC_Cache cache ) { - FT_Error error; - FT_Memory memory = cache->memory; - FTC_CMapNode node; - FT_UInt nn; + FTC_CMapNode *anode = (FTC_CMapNode*)ftcanode; + FTC_CMapQuery query = (FTC_CMapQuery)ftcquery; + FT_Error error; + FT_Memory memory = cache->memory; + FTC_CMapNode node; + FT_UInt nn; if ( !FT_NEW( node ) ) @@ -138,9 +141,11 @@ /* compute the weight of a given cmap node */ FT_CALLBACK_DEF( FT_ULong ) - ftc_cmap_node_weight( FTC_CMapNode cnode ) + ftc_cmap_node_weight( FTC_Node cnode, + FTC_Cache cache ) { FT_UNUSED( cnode ); + FT_UNUSED( cache ); return sizeof ( *cnode ); } @@ -148,9 +153,15 @@ /* compare a cmap node to a given query */ FT_CALLBACK_DEF( FT_Bool ) - ftc_cmap_node_compare( FTC_CMapNode node, - FTC_CMapQuery query ) + ftc_cmap_node_compare( FTC_Node ftcnode, + FT_Pointer ftcquery, + FTC_Cache cache ) { + FTC_CMapNode node = (FTC_CMapNode)ftcnode; + FTC_CMapQuery query = (FTC_CMapQuery)ftcquery; + FT_UNUSED( cache ); + + if ( node->face_id == query->face_id && node->cmap_index == query->cmap_index ) { @@ -165,9 +176,14 @@ FT_CALLBACK_DEF( FT_Bool ) - ftc_cmap_node_remove_faceid( FTC_CMapNode node, - FTC_FaceID face_id ) + ftc_cmap_node_remove_faceid( FTC_Node ftcnode, + FT_Pointer ftcface_id, + FTC_Cache cache ) { + FTC_CMapNode node = (FTC_CMapNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + FT_UNUSED( cache ); + return FT_BOOL( node->face_id == face_id ); } @@ -184,19 +200,19 @@ FT_CALLBACK_TABLE_DEF const FTC_CacheClassRec ftc_cmap_cache_class = { - (FTC_Node_NewFunc) ftc_cmap_node_new, - (FTC_Node_WeightFunc) ftc_cmap_node_weight, - (FTC_Node_CompareFunc)ftc_cmap_node_compare, - (FTC_Node_CompareFunc)ftc_cmap_node_remove_faceid, - (FTC_Node_FreeFunc) ftc_cmap_node_free, + ftc_cmap_node_new, + ftc_cmap_node_weight, + ftc_cmap_node_compare, + ftc_cmap_node_remove_faceid, + ftc_cmap_node_free, sizeof ( FTC_CacheRec ), - (FTC_Cache_InitFunc) ftc_cache_init, - (FTC_Cache_DoneFunc) ftc_cache_done, + ftc_cache_init, + ftc_cache_done, }; - /* documentation is in ftccmap.h */ + /* documentation is in ftcache.h */ FT_EXPORT_DEF( FT_Error ) FTC_CMapCache_New( FTC_Manager manager, @@ -208,7 +224,7 @@ } - /* documentation is in ftccmap.h */ + /* documentation is in ftcache.h */ FT_EXPORT_DEF( FT_UInt ) FTC_CMapCache_Lookup( FTC_CMapCache cmap_cache, @@ -276,7 +292,7 @@ FT_Set_Charmap( face, old ); } - node->indices[char_code - node->first] = gindex; + node->indices[char_code - node->first] = (FT_UShort)gindex; } Exit: diff --git a/src/libs/freetype2/cache/ftcglyph.c b/src/libs/freetype2/cache/ftcglyph.c index 5e6c9771af..46d5965b69 100644 --- a/src/libs/freetype2/cache/ftcglyph.c +++ b/src/libs/freetype2/cache/ftcglyph.c @@ -47,9 +47,8 @@ gnode->family = NULL; - if ( family && --family->num_nodes <= 0 ) - FTC_MruList_Remove( &FTC_GCACHE( cache )->families, - (FTC_MruNode)family ); + if ( family && --family->num_nodes == 0 ) + FTC_FAMILY_FREE( family, cache ); } @@ -64,20 +63,26 @@ } - FT_EXPORT_DEF( FT_Bool ) - FTC_GNode_Compare( FTC_GNode gnode, - FTC_GQuery gquery ) + FT_LOCAL_DEF( FT_Bool ) + ftc_gnode_compare( FTC_Node ftcgnode, + FT_Pointer ftcgquery, + FTC_Cache cache ) { + FTC_GNode gnode = (FTC_GNode)ftcgnode; + FTC_GQuery gquery = (FTC_GQuery)ftcgquery; + FT_UNUSED( cache ); + + return FT_BOOL( gnode->family == gquery->family && gnode->gindex == gquery->gindex ); } - FT_LOCAL_DEF( FT_Bool ) - ftc_gnode_compare( FTC_GNode gnode, + FT_EXPORT_DEF( FT_Bool ) + FTC_GNode_Compare( FTC_GNode gnode, FTC_GQuery gquery ) { - return FTC_GNode_Compare( gnode, gquery ); + return ftc_gnode_compare( FTC_NODE( gnode ), gquery, NULL ); } @@ -102,10 +107,12 @@ } - FT_EXPORT_DEF( FT_Error ) - FTC_GCache_Init( FTC_GCache cache ) + FT_LOCAL_DEF( FT_Error ) + ftc_gcache_init( FTC_Cache ftccache ) { - FT_Error error; + FTC_GCache cache = (FTC_GCache)ftccache; + FT_Error error; + error = FTC_Cache_Init( FTC_CACHE( cache ) ); if ( !error ) @@ -123,25 +130,28 @@ } - FT_LOCAL_DEF( FT_Error ) - ftc_gcache_init( FTC_GCache cache ) + FT_EXPORT_DEF( FT_Error ) + FTC_GCache_Init( FTC_GCache cache ) { - return FTC_GCache_Init( cache ); + return ftc_gcache_init( FTC_CACHE( cache ) ); + } + + + FT_LOCAL_DEF( void ) + ftc_gcache_done( FTC_Cache ftccache ) + { + FTC_GCache cache = (FTC_GCache)ftccache; + + + FTC_Cache_Done( (FTC_Cache)cache ); + FTC_MruList_Done( &cache->families ); } FT_EXPORT_DEF( void ) FTC_GCache_Done( FTC_GCache cache ) { - FTC_Cache_Done( (FTC_Cache)cache ); - FTC_MruList_Done( &cache->families ); - } - - - FT_LOCAL_DEF( void ) - ftc_gcache_done( FTC_GCache cache ) - { - FTC_GCache_Done( cache ); + ftc_gcache_done( FTC_CACHE( cache ) ); } @@ -169,8 +179,19 @@ FTC_MRULIST_LOOKUP( &cache->families, query, query->family, error ); if ( !error ) + { + FTC_Family family = query->family; + + + /* prevent the family from being destroyed too early when an */ + /* out-of-memory condition occurs during glyph node initialization. */ + family->num_nodes++; + error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode ); + if ( --family->num_nodes == 0 ) + FTC_FAMILY_FREE( family, cache ); + } return error; } diff --git a/src/libs/freetype2/cache/ftcimage.c b/src/libs/freetype2/cache/ftcimage.c index 22a26ac47c..508ed6c153 100644 --- a/src/libs/freetype2/cache/ftcimage.c +++ b/src/libs/freetype2/cache/ftcimage.c @@ -26,10 +26,11 @@ /* finalize a given glyph image node */ - FT_EXPORT_DEF( void ) - FTC_INode_Free( FTC_INode inode, + FT_LOCAL_DEF( void ) + ftc_inode_free( FTC_Node ftcinode, FTC_Cache cache ) { + FTC_INode inode = (FTC_INode)ftcinode; FT_Memory memory = cache->memory; @@ -44,11 +45,11 @@ } - FT_LOCAL_DEF( void ) - ftc_inode_free( FTC_INode inode, + FT_EXPORT_DEF( void ) + FTC_INode_Free( FTC_INode inode, FTC_Cache cache ) { - FTC_INode_Free( inode, cache ); + ftc_inode_free( FTC_NODE( inode ), cache ); } @@ -85,19 +86,27 @@ FT_LOCAL_DEF( FT_Error ) - ftc_inode_new( FTC_INode *pinode, - FTC_GQuery gquery, - FTC_Cache cache ) + ftc_inode_new( FTC_Node *ftcpinode, + FT_Pointer ftcgquery, + FTC_Cache cache ) { + FTC_INode *pinode = (FTC_INode*)ftcpinode; + FTC_GQuery gquery = (FTC_GQuery)ftcgquery; + + return FTC_INode_New( pinode, gquery, cache ); } - FT_EXPORT_DEF( FT_ULong ) - FTC_INode_Weight( FTC_INode inode ) + FT_LOCAL_DEF( FT_ULong ) + ftc_inode_weight( FTC_Node ftcinode, + FTC_Cache ftccache ) { - FT_ULong size = 0; - FT_Glyph glyph = inode->glyph; + FTC_INode inode = (FTC_INode)ftcinode; + FT_ULong size = 0; + FT_Glyph glyph = inode->glyph; + + FT_UNUSED( ftccache ); switch ( glyph->format ) @@ -135,10 +144,10 @@ } - FT_LOCAL_DEF( FT_ULong ) - ftc_inode_weight( FTC_INode inode ) + FT_EXPORT_DEF( FT_ULong ) + FTC_INode_Weight( FTC_INode inode ) { - return FTC_INode_Weight( inode ); + return ftc_inode_weight( FTC_NODE( inode ), NULL ); } diff --git a/src/libs/freetype2/cache/ftcmanag.c b/src/libs/freetype2/cache/ftcmanag.c index 9cc64891c4..337bea5f95 100644 --- a/src/libs/freetype2/cache/ftcmanag.c +++ b/src/libs/freetype2/cache/ftcmanag.c @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -79,9 +79,12 @@ FT_CALLBACK_DEF( void ) - ftc_size_node_done( FTC_SizeNode node ) + ftc_size_node_done( FTC_MruNode ftcnode, + FT_Pointer data ) { - FT_Size size = node->size; + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FT_Size size = node->size; + FT_UNUSED( data ); if ( size ) @@ -90,10 +93,12 @@ FT_CALLBACK_DEF( FT_Bool ) - ftc_size_node_compare( FTC_SizeNode node, - FTC_Scaler scaler ) + ftc_size_node_compare( FTC_MruNode ftcnode, + FT_Pointer ftcscaler ) { - FTC_Scaler scaler0 = &node->scaler; + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_Scaler scaler = (FTC_Scaler)ftcscaler; + FTC_Scaler scaler0 = &node->scaler; if ( FTC_SCALER_COMPARE( scaler0, scaler ) ) @@ -106,10 +111,15 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_size_node_init( FTC_SizeNode node, - FTC_Scaler scaler, - FTC_Manager manager ) + ftc_size_node_init( FTC_MruNode ftcnode, + FT_Pointer ftcscaler, + FT_Pointer ftcmanager ) { + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_Scaler scaler = (FTC_Scaler)ftcscaler; + FTC_Manager manager = (FTC_Manager)ftcmanager; + + node->scaler = scaler[0]; return ftc_scaler_lookup_size( manager, scaler, &node->size ); @@ -117,10 +127,15 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_size_node_reset( FTC_SizeNode node, - FTC_Scaler scaler, - FTC_Manager manager ) + ftc_size_node_reset( FTC_MruNode ftcnode, + FT_Pointer ftcscaler, + FT_Pointer ftcmanager ) { + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_Scaler scaler = (FTC_Scaler)ftcscaler; + FTC_Manager manager = (FTC_Manager)ftcmanager; + + FT_Done_Size( node->size ); node->scaler = scaler[0]; @@ -132,23 +147,29 @@ FT_CALLBACK_TABLE_DEF const FTC_MruListClassRec ftc_size_list_class = { - sizeof( FTC_SizeNodeRec ), - (FTC_MruNode_CompareFunc)ftc_size_node_compare, - (FTC_MruNode_InitFunc) ftc_size_node_init, - (FTC_MruNode_ResetFunc) ftc_size_node_reset, - (FTC_MruNode_DoneFunc) ftc_size_node_done + sizeof ( FTC_SizeNodeRec ), + ftc_size_node_compare, + ftc_size_node_init, + ftc_size_node_reset, + ftc_size_node_done }; /* helper function used by ftc_face_node_done */ static FT_Bool - ftc_size_node_compare_faceid( FTC_SizeNode node, - FTC_FaceID face_id ) + ftc_size_node_compare_faceid( FTC_MruNode ftcnode, + FT_Pointer ftcface_id ) { + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + + return FT_BOOL( node->scaler.face_id == face_id ); } + /* documentation is in ftcache.h */ + FT_EXPORT_DEF( FT_Error ) FTC_Manager_LookupSize( FTC_Manager manager, FTC_Scaler scaler, @@ -200,11 +221,14 @@ FT_CALLBACK_DEF( FT_Error ) - ftc_face_node_init( FTC_FaceNode node, - FTC_FaceID face_id, - FTC_Manager manager ) + ftc_face_node_init( FTC_MruNode ftcnode, + FT_Pointer ftcface_id, + FT_Pointer ftcmanager ) { - FT_Error error; + FTC_FaceNode node = (FTC_FaceNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + FTC_Manager manager = (FTC_Manager)ftcmanager; + FT_Error error; node->face_id = face_id; @@ -225,15 +249,18 @@ FT_CALLBACK_DEF( void ) - ftc_face_node_done( FTC_FaceNode node, - FTC_Manager manager ) + ftc_face_node_done( FTC_MruNode ftcnode, + FT_Pointer ftcmanager ) { + FTC_FaceNode node = (FTC_FaceNode)ftcnode; + FTC_Manager manager = (FTC_Manager)ftcmanager; + + /* we must begin by removing all scalers for the target face */ /* from the manager's list */ - FTC_MruList_RemoveSelection( - & manager->sizes, - (FTC_MruNode_CompareFunc)ftc_size_node_compare_faceid, - node->face_id ); + FTC_MruList_RemoveSelection( &manager->sizes, + ftc_size_node_compare_faceid, + node->face_id ); /* all right, we can discard the face now */ FT_Done_Face( node->face ); @@ -243,9 +270,13 @@ FT_CALLBACK_DEF( FT_Bool ) - ftc_face_node_compare( FTC_FaceNode node, - FTC_FaceID face_id ) + ftc_face_node_compare( FTC_MruNode ftcnode, + FT_Pointer ftcface_id ) { + FTC_FaceNode node = (FTC_FaceNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + + return FT_BOOL( node->face_id == face_id ); } @@ -253,12 +284,12 @@ FT_CALLBACK_TABLE_DEF const FTC_MruListClassRec ftc_face_list_class = { - sizeof( FTC_FaceNodeRec), + sizeof ( FTC_FaceNodeRec), - (FTC_MruNode_CompareFunc)ftc_face_node_compare, - (FTC_MruNode_InitFunc) ftc_face_node_init, - (FTC_MruNode_ResetFunc) NULL, - (FTC_MruNode_DoneFunc) ftc_face_node_done + ftc_face_node_compare, + ftc_face_node_init, + 0, /* FTC_MruNode_ResetFunc */ + ftc_face_node_done }; @@ -608,7 +639,7 @@ result++; } - if ( prev == manager->nodes_list ) + if ( node == first ) break; node = prev; @@ -617,6 +648,8 @@ } + /* documentation is in ftcache.h */ + FT_EXPORT_DEF( void ) FTC_Manager_RemoveFaceID( FTC_Manager manager, FTC_FaceID face_id ) @@ -633,7 +666,7 @@ } - /* documentation is in ftcmanag.h */ + /* documentation is in ftcache.h */ FT_EXPORT_DEF( void ) FTC_Node_Unref( FTC_Node node, diff --git a/src/libs/freetype2/cache/ftcsbits.c b/src/libs/freetype2/cache/ftcsbits.c index 6af5c7ee6b..891c7ab8e9 100644 --- a/src/libs/freetype2/cache/ftcsbits.c +++ b/src/libs/freetype2/cache/ftcsbits.c @@ -4,7 +4,7 @@ /* */ /* FreeType sbits manager (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -58,10 +58,11 @@ } - FT_EXPORT_DEF( void ) - FTC_SNode_Free( FTC_SNode snode, + FT_LOCAL_DEF( void ) + ftc_snode_free( FTC_Node ftcsnode, FTC_Cache cache ) { + FTC_SNode snode = (FTC_SNode)ftcsnode; FTC_SBit sbit = snode->sbits; FT_UInt count = snode->count; FT_Memory memory = cache->memory; @@ -76,14 +77,24 @@ } - FT_LOCAL_DEF( void ) - ftc_snode_free( FTC_SNode snode, + FT_EXPORT_DEF( void ) + FTC_SNode_Free( FTC_SNode snode, FTC_Cache cache ) { - FTC_SNode_Free( snode, cache ); + ftc_snode_free( FTC_NODE( snode ), cache ); } + /* + * This function tries to load a small bitmap within a given FTC_SNode. + * Note that it returns a non-zero error code _only_ in the case of + * out-of-memory condition. For all other errors (e.g., corresponding + * to a bad font file), this function will mark the sbit as `unavailable' + * and return a value of 0. + * + * You should also read the comment within the @ftc_snode_compare + * function below to see how out-of-memory is handled during a lookup. + */ static FT_Error ftc_snode_load( FTC_SNode snode, FTC_Manager manager, @@ -136,8 +147,8 @@ #define CHECK_BYTE( d ) ( temp = (FT_Byte)d, temp == d ) /* horizontal advance in pixels */ - xadvance = ( slot->metrics.horiAdvance + 32 ) >> 6; - yadvance = ( slot->metrics.vertAdvance + 32 ) >> 6; + xadvance = ( slot->advance.x + 32 ) >> 6; + yadvance = ( slot->advance.y + 32 ) >> 6; if ( !CHECK_BYTE( bitmap->rows ) || !CHECK_BYTE( bitmap->width ) || @@ -240,22 +251,30 @@ FT_LOCAL_DEF( FT_Error ) - ftc_snode_new( FTC_SNode *psnode, - FTC_GQuery gquery, + ftc_snode_new( FTC_Node *ftcpsnode, + FT_Pointer ftcgquery, FTC_Cache cache ) { + FTC_SNode *psnode = (FTC_SNode*)ftcpsnode; + FTC_GQuery gquery = (FTC_GQuery)ftcgquery; + + return FTC_SNode_New( psnode, gquery, cache ); } - FT_EXPORT_DEF( FT_ULong ) - FTC_SNode_Weight( FTC_SNode snode ) + FT_LOCAL_DEF( FT_ULong ) + ftc_snode_weight( FTC_Node ftcsnode, + FTC_Cache cache ) { + FTC_SNode snode = (FTC_SNode)ftcsnode; FT_UInt count = snode->count; FTC_SBit sbit = snode->sbits; FT_Int pitch; FT_ULong size; + FT_UNUSED( cache ); + FT_ASSERT( snode->count <= FTC_SBIT_ITEMS_PER_NODE ); @@ -279,21 +298,23 @@ } - FT_LOCAL_DEF( FT_ULong ) - ftc_snode_weight( FTC_SNode snode ) + FT_EXPORT_DEF( FT_ULong ) + FTC_SNode_Weight( FTC_SNode snode ) { - return FTC_SNode_Weight( snode ); + return ftc_snode_weight( FTC_NODE( snode ), NULL ); } - FT_EXPORT_DEF( FT_Bool ) - FTC_SNode_Compare( FTC_SNode snode, - FTC_GQuery gquery, + FT_LOCAL_DEF( FT_Bool ) + ftc_snode_compare( FTC_Node ftcsnode, + FT_Pointer ftcgquery, FTC_Cache cache ) { - FTC_GNode gnode = FTC_GNODE( snode ); - FT_UInt gindex = gquery->gindex; - FT_Bool result; + FTC_SNode snode = (FTC_SNode)ftcsnode; + FTC_GQuery gquery = (FTC_GQuery)ftcgquery; + FTC_GNode gnode = FTC_GNODE( snode ); + FT_UInt gindex = gquery->gindex; + FT_Bool result; result = FT_BOOL( gnode->family == gquery->family && @@ -304,16 +325,59 @@ FTC_SBit sbit = snode->sbits + ( gindex - gnode->gindex ); + /* + * The following code illustrates what to do when you want to + * perform operations that may fail within a lookup function. + * + * Here, we want to load a small bitmap on-demand; we thus + * need to call the `ftc_snode_load' function which may return + * a non-zero error code only when we are out of memory (OOM). + * + * The correct thing to do is to use @FTC_CACHE_TRYLOOP and + * @FTC_CACHE_TRYLOOP_END in order to implement a retry loop + * that is capable of flushing the cache incrementally when + * an OOM errors occur. + * + * However, we need to `lock' the node before this operation to + * prevent it from being flushed within the loop. + * + * When we exit the loop, we unlock the node, then check the `error' + * variable. If it is non-zero, this means that the cache was + * completely flushed and that no usable memory was found to load + * the bitmap. + * + * We then prefer to return a value of 0 (i.e., NO MATCH). This + * ensures that the caller will try to allocate a new node. + * This operation consequently _fail_ and the lookup function + * returns the appropriate OOM error code. + * + * Note that `buffer == NULL && width == 255' is a hack used to + * tag `unavailable' bitmaps in the array. We should never try + * to load these. + * + */ + if ( sbit->buffer == NULL && sbit->width != 255 ) { FT_ULong size; + FT_Error error; - if ( !ftc_snode_load( snode, cache->manager, - gindex, &size ) ) + ftcsnode->ref_count++; /* lock node to prevent flushing */ + /* in retry loop */ + + FTC_CACHE_TRYLOOP( cache ) { - cache->manager->cur_weight += size; + error = ftc_snode_load( snode, cache->manager, gindex, &size ); } + FTC_CACHE_TRYLOOP_END(); + + ftcsnode->ref_count--; /* unlock the node */ + + if ( error ) + result = 0; + else + cache->manager->cur_weight += size; } } @@ -321,12 +385,12 @@ } - FT_LOCAL_DEF( FT_Bool ) - ftc_snode_compare( FTC_SNode snode, + FT_EXPORT_DEF( FT_Bool ) + FTC_SNode_Compare( FTC_SNode snode, FTC_GQuery gquery, FTC_Cache cache ) { - return FTC_SNode_Compare( snode, gquery, cache ); + return ftc_snode_compare( FTC_NODE( snode ), gquery, cache ); } diff --git a/src/libs/freetype2/cff/Jamfile b/src/libs/freetype2/cff/Jamfile index f01c8c9cea..33c5e18ab0 100644 --- a/src/libs/freetype2/cff/Jamfile +++ b/src/libs/freetype2/cff/Jamfile @@ -20,4 +20,5 @@ UseFreeTypeHeaders ; FT2_Library $(FT2_LIB) : $(_sources).c ; } -# end of src/cff Jamfile +# end of src/cff Jamfile + diff --git a/src/libs/freetype2/cff/cffcmap.c b/src/libs/freetype2/cff/cffcmap.c index 82e04d2366..88169d0b35 100644 --- a/src/libs/freetype2/cff/cffcmap.c +++ b/src/libs/freetype2/cff/cffcmap.c @@ -4,7 +4,7 @@ /* */ /* CFF character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002, 2003, 2004 by */ +/* Copyright 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -149,6 +149,13 @@ FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; + /* can't build Unicode map for CID-keyed font */ + if ( !charset->sids ) + { + error = CFF_Err_Invalid_Argument; + goto Exit; + } + cmap->num_pairs = 0; cmap->pairs = NULL; @@ -213,6 +220,7 @@ } } + Exit: return error; } diff --git a/src/libs/freetype2/cff/cffdrivr.c b/src/libs/freetype2/cff/cffdrivr.c index 60ee90ae3d..8298e412f7 100644 --- a/src/libs/freetype2/cff/cffdrivr.c +++ b/src/libs/freetype2/cff/cffdrivr.c @@ -4,7 +4,7 @@ /* */ /* OpenType font driver implementation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -67,7 +67,7 @@ /*************************************************************************/ /* */ /* <Function> */ - /* Get_Kerning */ + /* cff_get_kerning */ /* */ /* <Description> */ /* A driver method used to return the kerning vector between two */ @@ -96,56 +96,23 @@ /* */ /* They can be implemented by format-specific interfaces. */ /* */ - static FT_Error - Get_Kerning( TT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph, - FT_Vector* kerning ) + FT_CALLBACK_DEF( FT_Error ) + cff_get_kerning( FT_Face ttface, /* TT_Face */ + FT_UInt left_glyph, + FT_UInt right_glyph, + FT_Vector* kerning ) { - TT_Kern0_Pair pair; + TT_Face face = (TT_Face)ttface; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; - if ( !face ) - return CFF_Err_Invalid_Face_Handle; - kerning->x = 0; kerning->y = 0; - if ( face->kern_pairs ) - { - /* there are some kerning pairs in this font file! */ - FT_ULong search_tag = PAIR_TAG( left_glyph, right_glyph ); - FT_Long left, right; + if ( sfnt ) + kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); - - left = 0; - right = face->num_kern_pairs - 1; - - while ( left <= right ) - { - FT_Long middle = left + ( ( right - left ) >> 1 ); - FT_ULong cur_pair; - - - pair = face->kern_pairs + middle; - cur_pair = PAIR_TAG( pair->left, pair->right ); - - if ( cur_pair == search_tag ) - goto Found; - - if ( cur_pair < search_tag ) - left = middle + 1; - else - right = middle - 1; - } - } - - Exit: return CFF_Err_Ok; - - Found: - kerning->x = pair->value; - goto Exit; } @@ -178,13 +145,15 @@ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ - static FT_Error - Load_Glyph( CFF_GlyphSlot slot, - CFF_Size size, - FT_UShort glyph_index, - FT_Int32 load_flags ) + FT_CALLBACK_DEF( FT_Error ) + Load_Glyph( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ + FT_Size cffsize, /* CFF_Size */ + FT_UInt glyph_index, + FT_Int32 load_flags ) { FT_Error error; + CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; + CFF_Size size = (CFF_Size)cffsize; if ( !slot ) @@ -200,8 +169,8 @@ /* reset the size object if necessary */ if ( size ) { - /* these two object must have the same parent */ - if ( size->root.face != slot->root.face ) + /* these two objects must have the same parent */ + if ( cffsize->face != cffslot->face ) return CFF_Err_Invalid_Face_Handle; } @@ -335,8 +304,9 @@ static const FT_Service_PsInfoRec cff_service_ps_info = { - (PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */ - (PS_HasGlyphNamesFunc)cff_ps_has_glyph_names + (PS_GetFontInfoFunc) NULL, /* unsupported with CFF fonts */ + (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, + (PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */ }; @@ -409,8 +379,8 @@ }; - static FT_Module_Interface - cff_get_interface( CFF_Driver driver, + FT_CALLBACK_DEF( FT_Module_Interface ) + cff_get_interface( FT_Module driver, /* CFF_Driver */ const char* module_interface ) { FT_Module sfnt; @@ -422,7 +392,7 @@ return result; /* we pass our request to the `sfnt' module */ - sfnt = FT_Get_Module( driver->root.root.library, "sfnt" ); + sfnt = FT_Get_Module( driver->library, "sfnt" ); return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0; } @@ -446,9 +416,9 @@ 0, /* module-specific interface */ - (FT_Module_Constructor)cff_driver_init, - (FT_Module_Destructor) cff_driver_done, - (FT_Module_Requester) cff_get_interface, + cff_driver_init, + cff_driver_done, + cff_get_interface, }, /* now the specific driver fields */ @@ -456,21 +426,21 @@ sizeof( CFF_SizeRec ), sizeof( CFF_GlyphSlotRec ), - (FT_Face_InitFunc) cff_face_init, - (FT_Face_DoneFunc) cff_face_done, - (FT_Size_InitFunc) cff_size_init, - (FT_Size_DoneFunc) cff_size_done, - (FT_Slot_InitFunc) cff_slot_init, - (FT_Slot_DoneFunc) cff_slot_done, + cff_face_init, + cff_face_done, + cff_size_init, + cff_size_done, + cff_slot_init, + cff_slot_done, - (FT_Size_ResetPointsFunc)cff_size_reset, - (FT_Size_ResetPixelsFunc)cff_size_reset, + cff_point_size_reset, + cff_size_reset, - (FT_Slot_LoadFunc) Load_Glyph, + Load_Glyph, - (FT_Face_GetKerningFunc) Get_Kerning, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc)0, + cff_get_kerning, + 0, /* FT_Face_AttachFunc */ + 0 /* FT_Face_GetAdvancesFunc */ }; diff --git a/src/libs/freetype2/cff/cffgload.c b/src/libs/freetype2/cff/cffgload.c index c1339d82eb..3c0ef6bc26 100644 --- a/src/libs/freetype2/cff/cffgload.c +++ b/src/libs/freetype2/cff/cffgload.c @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -825,7 +825,7 @@ zone = decoder->zones; stack = decoder->top; - hinter = (T2_Hints_Funcs) builder->hints_funcs; + hinter = (T2_Hints_Funcs)builder->hints_funcs; builder->path_begun = 0; @@ -842,7 +842,7 @@ if ( hinter ) hinter->open( hinter->hints ); - /* now, execute loop */ + /* now execute loop */ while ( ip < limit ) { CFF_Operator op; @@ -1266,7 +1266,7 @@ if ( cff_builder_start_point ( builder, x, y ) || check_points( builder, num_args / 2 ) ) - goto Memory_Error; + goto Fail; if ( num_args < 2 || num_args & 1 ) goto Stack_Underflow; @@ -1291,9 +1291,9 @@ FT_TRACE4(( op == cff_op_hlineto ? " hlineto" : " vlineto" )); - if ( cff_builder_start_point ( builder, x, y ) || - check_points( builder, num_args ) ) - goto Memory_Error; + if ( cff_builder_start_point ( builder, x, y ) || + check_points( builder, num_args ) ) + goto Fail; args = stack; while (args < decoder->top ) @@ -1304,7 +1304,7 @@ y += args[0]; if ( cff_builder_add_point1( builder, x, y ) ) - goto Memory_Error; + goto Fail; args++; phase ^= 1; @@ -1322,7 +1322,7 @@ if ( cff_builder_start_point ( builder, x, y ) || check_points( builder, num_args / 2 ) ) - goto Memory_Error; + goto Fail; args = stack; while ( args < decoder->top ) @@ -1344,8 +1344,8 @@ case cff_op_vvcurveto: FT_TRACE4(( " vvcurveto" )); - if ( cff_builder_start_point ( builder, x, y ) ) - goto Memory_Error; + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; args = stack; if ( num_args & 1 ) @@ -1359,7 +1359,7 @@ goto Stack_Underflow; if ( check_points( builder, 3 * ( num_args / 4 ) ) ) - goto Memory_Error; + goto Fail; while ( args < decoder->top ) { @@ -1378,8 +1378,8 @@ case cff_op_hhcurveto: FT_TRACE4(( " hhcurveto" )); - if ( cff_builder_start_point ( builder, x, y ) ) - goto Memory_Error; + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; args = stack; if ( num_args & 1 ) @@ -1393,7 +1393,7 @@ goto Stack_Underflow; if ( check_points( builder, 3 * ( num_args / 4 ) ) ) - goto Memory_Error; + goto Fail; while ( args < decoder->top ) { @@ -1418,8 +1418,8 @@ FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto" : " hvcurveto" )); - if ( cff_builder_start_point ( builder, x, y ) ) - goto Memory_Error; + if ( cff_builder_start_point( builder, x, y ) ) + goto Fail; args = stack; if (num_args < 4 || ( num_args % 4 ) > 1 ) @@ -1476,7 +1476,7 @@ if ( cff_builder_start_point( builder, x, y ) || check_points( builder, num_lines + 3 ) ) - goto Memory_Error; + goto Fail; args = stack; @@ -1516,7 +1516,7 @@ if ( cff_builder_start_point ( builder, x, y ) || check_points( builder, num_curves*3 + 2 ) ) - goto Memory_Error; + goto Fail; args = stack; @@ -1555,10 +1555,10 @@ /* adding five more points; 4 control points, 1 on-curve point */ /* make sure we have enough space for the start point if it */ - /* needs to be added.. */ + /* needs to be added */ if ( cff_builder_start_point( builder, x, y ) || check_points( builder, 6 ) ) - goto Memory_Error; + goto Fail; /* Record the starting point's y postion for later use */ start_y = y; @@ -1608,8 +1608,8 @@ /* adding six more points; 4 control points, 2 on-curve points */ if ( cff_builder_start_point( builder, x, y ) || - check_points ( builder, 6 ) ) - goto Memory_Error; + check_points( builder, 6 ) ) + goto Fail; /* record the starting point's y-position for later use */ start_y = y; @@ -1661,7 +1661,7 @@ /* adding six more points; 4 control points, 2 on-curve points */ if ( cff_builder_start_point( builder, x, y ) || check_points( builder, 6 ) ) - goto Memory_Error; + goto Fail; /* record the starting point's x, y postion for later use */ start_x = x; @@ -1724,7 +1724,7 @@ if ( cff_builder_start_point( builder, x, y ) || check_points( builder, 6 ) ) - goto Memory_Error; + goto Fail; args = stack; for ( count = 6; count > 0; count-- ) @@ -2175,6 +2175,7 @@ FT_TRACE4(( "..end..\n\n" )); + Fail: return error; Syntax_Error: @@ -2188,9 +2189,6 @@ Stack_Overflow: FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!" )); return CFF_Err_Stack_Overflow; - - Memory_Error: - return builder->error; } @@ -2468,8 +2466,19 @@ #endif /* FT_CONFIG_OPTION_INCREMENTAL */ - font_matrix = cff->top_font.font_dict.font_matrix; - font_offset = cff->top_font.font_dict.font_offset; + if ( cff->num_subfonts >= 1 ) + { + FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); + + + font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix; + font_offset = cff->subfonts[fd_index]->font_dict.font_offset; + } + else + { + font_matrix = cff->top_font.font_dict.font_matrix; + font_offset = cff->top_font.font_dict.font_offset; + } /* Now, set the metrics -- this is rather simple, as */ /* the left side bearing is the xMin, and the top side */ diff --git a/src/libs/freetype2/cff/cffgload.h b/src/libs/freetype2/cff/cffgload.h index 3adfe7cc65..89ae049b53 100644 --- a/src/libs/freetype2/cff/cffgload.h +++ b/src/libs/freetype2/cff/cffgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -75,9 +75,6 @@ FT_BEGIN_HEADER /* */ /* no_recurse :: Set but not used. */ /* */ - /* error :: An error code that is only used to report memory */ - /* allocation problems. */ - /* */ /* metrics_only :: A boolean indicating that we only want to compute */ /* the metrics of a given glyph, not load all of its */ /* points. */ @@ -111,7 +108,6 @@ FT_BEGIN_HEADER FT_Bool load_points; FT_Bool no_recurse; - FT_Error error; /* only used for memory errors */ FT_Bool metrics_only; void* hints_funcs; /* hinter-specific */ diff --git a/src/libs/freetype2/cff/cffload.c b/src/libs/freetype2/cff/cffload.c index 44f3254bd8..237915cfd4 100644 --- a/src/libs/freetype2/cff/cffload.c +++ b/src/libs/freetype2/cff/cffload.c @@ -4,7 +4,7 @@ /* */ /* OpenType and CFF data/program tables loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1095,7 +1095,7 @@ idx->stream = stream; if ( !FT_READ_USHORT( count ) && - count > 0 ) + count > 0 ) { FT_Byte* p; FT_Byte offsize; @@ -1687,7 +1687,7 @@ FT_MEM_ZERO( charset->cids, sizeof ( FT_UShort ) * max_cid ); for ( i = 0; i < num_glyphs; i++ ) - charset->cids[charset->sids[i]] = i; + charset->cids[charset->sids[i]] = (FT_UShort)i; } Exit: @@ -2100,6 +2100,7 @@ FT_ULong base_offset; CFF_FontRecDict dict; + FT_ZERO( font ); font->stream = stream; @@ -2239,11 +2240,9 @@ /* read the Charset and Encoding tables if available */ if ( font->num_glyphs > 0 ) { - FT_Bool invert; + FT_Bool invert = FT_BOOL( dict->cid_registry != 0xFFFFU ); - invert = dict->cid_registry != 0xFFFFU && - font->charstrings_index.count != dict->cid_count; error = cff_charset_load( &font->charset, font->num_glyphs, stream, base_offset, dict->charset_offset, invert ); if ( error ) diff --git a/src/libs/freetype2/cff/cffobjs.c b/src/libs/freetype2/cff/cffobjs.c index bbe1654ee7..8522c1f1f4 100644 --- a/src/libs/freetype2/cff/cffobjs.c +++ b/src/libs/freetype2/cff/cffobjs.c @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -46,7 +46,7 @@ /* */ /* SIZE FUNCTIONS */ /* */ - /* Note that we store the global hints in the size's "internal" root */ + /* Note that we store the global hints in the size's `internal' root */ /* field. */ /* */ /*************************************************************************/ @@ -74,30 +74,49 @@ sbit_metrics = &size->strike_metrics; error = sfnt->set_sbit_strike( face, - metrics->x_ppem, metrics->y_ppem, + metrics->x_ppem, + metrics->y_ppem, &strike_index ); if ( !error ) { + /* XXX: TODO: move this code to the SFNT module where it belongs */ + +#ifdef FT_OPTIMIZE_MEMORY + + FT_Byte* strike = face->sbit_table + 8 + strike_index*48; + + sbit_metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */ + sbit_metrics->descender = (FT_Char)strike[17] << 6; /* hori.descender */ + + /* XXX: Is this correct? */ + sbit_metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */ + strike[18] + /* max_width */ + (FT_Char)strike[23] /* min_advance_SB */ + ) << 6; + +#else /* !OPTIMIZE_MEMORY */ + TT_SBit_Strike strike = face->sbit_strikes + strike_index; - sbit_metrics->x_ppem = metrics->x_ppem; - sbit_metrics->y_ppem = metrics->y_ppem; - sbit_metrics->ascender = strike->hori.ascender << 6; sbit_metrics->descender = strike->hori.descender << 6; - /* XXX: Is this correct? */ - sbit_metrics->height = sbit_metrics->ascender - - sbit_metrics->descender; - /* XXX: Is this correct? */ sbit_metrics->max_advance = ( strike->hori.min_origin_SB + strike->hori.max_width + strike->hori.min_advance_SB ) << 6; - size->strike_index = (FT_UInt)strike_index; +#endif /* !OPTIMIZE_MEMORY */ + + /* XXX: Is this correct? */ + sbit_metrics->height = sbit_metrics->ascender - + sbit_metrics->descender; + + sbit_metrics->x_ppem = metrics->x_ppem; + sbit_metrics->y_ppem = metrics->y_ppem; + size->strike_index = (FT_UInt)strike_index; } else { @@ -135,25 +154,29 @@ FT_LOCAL_DEF( void ) - cff_size_done( CFF_Size size ) + cff_size_done( FT_Size cffsize ) /* CFF_Size */ { - if ( size->root.internal ) + CFF_Size size = (CFF_Size)cffsize; + + + if ( cffsize->internal ) { PSH_Globals_Funcs funcs; funcs = cff_size_get_globals_funcs( size ); if ( funcs ) - funcs->destroy( (PSH_Globals)size->root.internal ); + funcs->destroy( (PSH_Globals)cffsize->internal ); - size->root.internal = 0; + cffsize->internal = 0; } } FT_LOCAL_DEF( FT_Error ) - cff_size_init( CFF_Size size ) + cff_size_init( FT_Size cffsize ) /* CFF_Size */ { + CFF_Size size = (CFF_Size)cffsize; FT_Error error = CFF_Err_Ok; PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size ); @@ -161,7 +184,7 @@ if ( funcs ) { PSH_Globals globals; - CFF_Face face = (CFF_Face)size->root.face; + CFF_Face face = (CFF_Face)cffsize->face; CFF_Font font = (CFF_FontRec *)face->extra.data; CFF_SubFont subfont = &font->top_font; @@ -215,9 +238,9 @@ priv.lenIV = cpriv->lenIV; } - error = funcs->create( size->root.face->memory, &priv, &globals ); + error = funcs->create( cffsize->face->memory, &priv, &globals ); if ( !error ) - size->root.internal = (FT_Size_Internal)(void*)globals; + cffsize->internal = (FT_Size_Internal)(void*)globals; } return error; @@ -225,17 +248,23 @@ FT_LOCAL_DEF( FT_Error ) - cff_size_reset( CFF_Size size ) + cff_size_reset( FT_Size cffsize, /* CFF_Size */ + FT_UInt char_width, + FT_UInt char_height ) { + CFF_Size size = (CFF_Size)cffsize; PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size ); FT_Error error = CFF_Err_Ok; - FT_Face face = size->root.face; + FT_Face face = cffsize->face; + + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); if ( funcs ) - error = funcs->set_scale( (PSH_Globals)size->root.internal, - size->root.metrics.x_scale, - size->root.metrics.y_scale, + error = funcs->set_scale( (PSH_Globals)cffsize->internal, + cffsize->metrics.x_scale, + cffsize->metrics.y_scale, 0, 0 ); #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS @@ -245,7 +274,7 @@ error = sbit_size_reset( size ); if ( !error && !( face->face_flags & FT_FACE_FLAG_SCALABLE ) ) - size->root.metrics = size->strike_metrics; + cffsize->metrics = size->strike_metrics; } #endif @@ -257,6 +286,22 @@ } + FT_LOCAL_DEF( FT_Error ) + cff_point_size_reset( FT_Size cffsize, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ) + { + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); + FT_UNUSED( horz_resolution ); + FT_UNUSED( vert_resolution ); + + return cff_size_reset( cffsize, 0, 0 ); + } + + /*************************************************************************/ /* */ /* SLOT FUNCTIONS */ @@ -264,16 +309,16 @@ /*************************************************************************/ FT_LOCAL_DEF( void ) - cff_slot_done( CFF_GlyphSlot slot ) + cff_slot_done( FT_GlyphSlot slot ) { - slot->root.internal->glyph_hints = 0; + slot->internal->glyph_hints = 0; } FT_LOCAL_DEF( FT_Error ) - cff_slot_init( CFF_GlyphSlot slot ) + cff_slot_init( FT_GlyphSlot slot ) { - CFF_Face face = (CFF_Face)slot->root.face; + CFF_Face face = (CFF_Face)slot->face; CFF_Font font = (CFF_FontRec *)face->extra.data; PSHinter_Service pshinter = (PSHinter_Service)font->pshinter; @@ -283,7 +328,7 @@ FT_Module module; - module = FT_Get_Module( slot->root.face->driver->root.library, + module = FT_Get_Module( slot->face->driver->root.library, "pshinter" ); if ( module ) { @@ -291,7 +336,7 @@ funcs = pshinter->get_t2_funcs( module ); - slot->root.internal->glyph_hints = (void*)funcs; + slot->internal->glyph_hints = (void*)funcs; } } @@ -328,11 +373,12 @@ FT_LOCAL_DEF( FT_Error ) cff_face_init( FT_Stream stream, - CFF_Face face, + FT_Face cffface, /* CFF_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { + CFF_Face face = (CFF_Face)cffface; FT_Error error; SFNT_Service sfnt; FT_Service_PsCMaps psnames; @@ -340,6 +386,7 @@ FT_Bool pure_cff = 1; FT_Bool sfnt_format = 0; + #if 0 FT_FACE_FIND_GLOBAL_SERVICE( face, sfnt, SFNT ); FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_NAMES ); @@ -349,14 +396,14 @@ goto Bad_Format; #else sfnt = (SFNT_Service)FT_Get_Module_Interface( - face->root.driver->root.library, "sfnt" ); + cffface->driver->root.library, "sfnt" ); if ( !sfnt ) goto Bad_Format; FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); pshinter = (PSHinter_Service)FT_Get_Module_Interface( - face->root.driver->root.library, "pshinter" ); + cffface->driver->root.library, "pshinter" ); #endif /* create input stream from resource */ @@ -377,6 +424,14 @@ if ( face_index < 0 ) return CFF_Err_Ok; + /* UNDOCUMENTED! A CFF in an SFNT can have only a single font. */ + if ( face_index > 0 ) + { + FT_ERROR(( "cff_face_init: invalid face index\n" )); + error = CFF_Err_Invalid_Argument; + goto Exit; + } + sfnt_format = 1; /* now, the font can be either an OpenType/CFF font, or an SVG CEF */ @@ -421,9 +476,9 @@ { CFF_Font cff; CFF_FontRecDict dict; - FT_Memory memory = face->root.memory; - FT_Face root; + FT_Memory memory = cffface->memory; FT_Int32 flags; + FT_UInt i; if ( FT_NEW( cff ) ) @@ -438,10 +493,10 @@ cff->psnames = (void*)psnames; /* Complement the root flags with some interesting information. */ - /* Note that this is only necessary for pure CFF and CEF fonts. */ + /* Note that this is only necessary for pure CFF and CEF fonts; */ + /* SFNT based fonts use the `name' table instead. */ - root = &face->root; - root->num_glyphs = cff->num_glyphs; + cffface->num_glyphs = cff->num_glyphs; dict = &cff->top_font.font_dict; @@ -461,58 +516,66 @@ char* style_name = NULL; - /* Set up num_faces. */ - root->num_faces = cff->num_faces; + /* set up num_faces */ + cffface->num_faces = cff->num_faces; /* compute number of glyphs */ if ( dict->cid_registry != 0xFFFFU ) - root->num_glyphs = dict->cid_count; + cffface->num_glyphs = dict->cid_count; else - root->num_glyphs = cff->charstrings_index.count; + cffface->num_glyphs = cff->charstrings_index.count; /* set global bbox, as well as EM size */ - root->bbox.xMin = dict->font_bbox.xMin >> 16; - root->bbox.yMin = dict->font_bbox.yMin >> 16; - root->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16; - root->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16; + cffface->bbox.xMin = dict->font_bbox.xMin >> 16; + cffface->bbox.yMin = dict->font_bbox.yMin >> 16; + cffface->bbox.xMax = ( dict->font_bbox.xMax + 0xFFFFU ) >> 16; + cffface->bbox.yMax = ( dict->font_bbox.yMax + 0xFFFFU ) >> 16; - root->ascender = (FT_Short)( root->bbox.yMax ); - root->descender = (FT_Short)( root->bbox.yMin ); - root->height = (FT_Short)( - ( ( root->ascender - root->descender ) * 12 ) / 10 ); + cffface->ascender = (FT_Short)( cffface->bbox.yMax ); + cffface->descender = (FT_Short)( cffface->bbox.yMin ); + cffface->height = (FT_Short)( + ( ( cffface->ascender - cffface->descender ) * 12 ) / 10 ); - if ( dict->units_per_em ) - root->units_per_EM = dict->units_per_em; - else - root->units_per_EM = 1000; + if ( !dict->units_per_em ) + dict->units_per_em = 1000; - root->underline_position = + cffface->units_per_EM = dict->units_per_em; + + cffface->underline_position = (FT_Short)( dict->underline_position >> 16 ); - root->underline_thickness = + cffface->underline_thickness = (FT_Short)( dict->underline_thickness >> 16 ); /* retrieve font family & style name */ - root->family_name = cff_index_get_name( &cff->name_index, - face_index ); + cffface->family_name = cff_index_get_name( &cff->name_index, + face_index ); - if ( root->family_name ) + if ( cffface->family_name ) { char* full = cff_index_get_sid_string( &cff->string_index, dict->full_name, psnames ); char* fullp = full; - char* family = root->family_name; + char* family = cffface->family_name; + char* family_name = 0; - /* we're going to try to extract the style name from the - * full name. We need to ignore spaces and dashes during - * the search. - */ - if ( full ) + + if ( dict->family_name ) + { + family_name = cff_index_get_sid_string( &cff->string_index, + dict->family_name, + psnames); + if ( family_name ) + family = family_name; + } + + /* We try to extract the style name from the full name. */ + /* We need to ignore spaces and dashes during the search. */ + if ( full && family ) { while ( *fullp ) { - /* skip common characters at the start of both strings - */ + /* skip common characters at the start of both strings */ if ( *fullp == *family ) { family++; @@ -520,15 +583,14 @@ continue; } - /* ignore spaces or dashes in full name during comparison - */ + /* ignore spaces and dashes in full name during comparison */ if ( *fullp == ' ' || *fullp == '-' ) { fullp++; continue; } - /* ignore spaces and dashes in family name during comparison - */ + + /* ignore spaces and dashes in family name during comparison */ if ( *family == ' ' || *family == '-' ) { family++; @@ -537,15 +599,17 @@ if ( !*family && *fullp ) { - /* the full name begins with the same characters than the - * family name, with spaces and dashes removed. In this - * case, the remaining string in "fullp" will be used - * as the style name - */ + /* The full name begins with the same characters as the */ + /* family name, with spaces and dashes removed. In this */ + /* case, the remaining string in `fullp' will be used as */ + /* the style name. */ style_name = cff_strcpy( memory, fullp ); } break; } + + if ( family_name ) + FT_FREE( family_name ); FT_FREE( full ); } } @@ -559,14 +623,14 @@ /* do we have a `/FontName' for a CID-keyed font? */ if ( cid_font_name ) - root->family_name = cid_font_name; + cffface->family_name = cid_font_name; } if ( style_name ) - root->style_name = style_name; + cffface->style_name = style_name; else /* assume "Regular" style if we don't know better */ - root->style_name = cff_strcpy( memory, (char *)"Regular" ); + cffface->style_name = cff_strcpy( memory, (char *)"Regular" ); /*******************************************************************/ /* */ @@ -589,7 +653,7 @@ flags |= FT_FACE_FLAG_KERNING; #endif - root->face_flags = flags; + cffface->face_flags = flags; /*******************************************************************/ /* */ @@ -613,14 +677,51 @@ FT_FREE( weight ); } - root->style_flags = flags; + /* double check */ + if ( !(flags & FT_STYLE_FLAG_BOLD) && cffface->style_name ) + if ( !strncmp( cffface->style_name, "Bold", 4 ) || + !strncmp( cffface->style_name, "Black", 5 ) ) + flags |= FT_STYLE_FLAG_BOLD; + + cffface->style_flags = flags; + } + else + { + if ( !dict->units_per_em ) + dict->units_per_em = face->root.units_per_EM; + } + + /* handle font matrix settings in subfonts (if any) */ + for ( i = cff->num_subfonts; i > 0; i-- ) + { + CFF_FontRecDict sub = &cff->subfonts[i - 1]->font_dict; + CFF_FontRecDict top = &cff->top_font.font_dict; + + + if ( sub->units_per_em ) + { + FT_Matrix scale; + + + scale.xx = scale.yy = (FT_Fixed)FT_DivFix( top->units_per_em, + sub->units_per_em ); + scale.xy = scale.yx = 0; + + FT_Matrix_Multiply( &scale, &sub->font_matrix ); + FT_Vector_Transform( &sub->font_offset, &scale ); + } + else + { + sub->font_matrix = top->font_matrix; + sub->font_offset = top->font_offset; + } } #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */ /* has unset this flag because of the 3.0 `post' table */ if ( dict->cid_registry == 0xFFFFU ) - root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES; + cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES; #endif /*******************************************************************/ @@ -638,9 +739,9 @@ CFF_Encoding encoding = &cff->encoding; - for ( nn = 0; nn < (FT_UInt)root->num_charmaps; nn++ ) + for ( nn = 0; nn < (FT_UInt)cffface->num_charmaps; nn++ ) { - cmap = root->charmaps[nn]; + cmap = cffface->charmaps[nn]; /* Windows Unicode (3,1)? */ if ( cmap->platform_id == 3 && cmap->encoding_id == 1 ) @@ -657,18 +758,18 @@ goto Exit; /* we didn't find a Unicode charmap -- synthetize one */ - cmaprec.face = root; + cmaprec.face = cffface; cmaprec.platform_id = 3; cmaprec.encoding_id = 1; cmaprec.encoding = FT_ENCODING_UNICODE; - nn = (FT_UInt)root->num_charmaps; + nn = (FT_UInt)cffface->num_charmaps; FT_CMap_New( &cff_cmap_unicode_class_rec, NULL, &cmaprec, NULL ); /* if no Unicode charmap was previously selected, select this one */ - if ( root->charmap == NULL && nn != (FT_UInt)root->num_charmaps ) - root->charmap = root->charmaps[nn]; + if ( cffface->charmap == NULL && nn != (FT_UInt)cffface->num_charmaps ) + cffface->charmap = cffface->charmaps[nn]; Skip_Unicode: if ( encoding->count > 0 ) @@ -676,7 +777,7 @@ FT_CMap_Class clazz; - cmaprec.face = root; + cmaprec.face = cffface; cmaprec.platform_id = 7; /* Adobe platform id */ if ( encoding->offset == 0 ) @@ -713,9 +814,10 @@ FT_LOCAL_DEF( void ) - cff_face_done( CFF_Face face ) + cff_face_done( FT_Face cffface ) /* CFF_Face */ { - FT_Memory memory = face->root.memory; + CFF_Face face = (CFF_Face)cffface; + FT_Memory memory = cffface->memory; SFNT_Service sfnt = (SFNT_Service)face->sfnt; @@ -736,18 +838,18 @@ FT_LOCAL_DEF( FT_Error ) - cff_driver_init( CFF_Driver driver ) + cff_driver_init( FT_Module module ) { - FT_UNUSED( driver ); + FT_UNUSED( module ); return CFF_Err_Ok; } FT_LOCAL_DEF( void ) - cff_driver_done( CFF_Driver driver ) + cff_driver_done( FT_Module module ) { - FT_UNUSED( driver ); + FT_UNUSED( module ); } diff --git a/src/libs/freetype2/cff/cffobjs.h b/src/libs/freetype2/cff/cffobjs.h index f02a5d7484..338ec748bb 100644 --- a/src/libs/freetype2/cff/cffobjs.h +++ b/src/libs/freetype2/cff/cffobjs.h @@ -113,19 +113,28 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - cff_size_init( CFF_Size size ); + cff_size_init( FT_Size size ); /* CFF_Size */ FT_LOCAL( void ) - cff_size_done( CFF_Size size ); + cff_size_done( FT_Size size ); /* CFF_Size */ FT_LOCAL( FT_Error ) - cff_size_reset( CFF_Size size ); + cff_size_reset( FT_Size size, /* CFF_Size */ + FT_UInt char_width, + FT_UInt char_height ); + + FT_LOCAL( FT_Error ) + cff_point_size_reset( FT_Size cffsize, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ); FT_LOCAL( void ) - cff_slot_done( CFF_GlyphSlot slot ); + cff_slot_done( FT_GlyphSlot slot ); FT_LOCAL( FT_Error ) - cff_slot_init( CFF_GlyphSlot slot ); + cff_slot_init( FT_GlyphSlot slot ); /*************************************************************************/ @@ -134,13 +143,13 @@ FT_BEGIN_HEADER /* */ FT_LOCAL( FT_Error ) cff_face_init( FT_Stream stream, - CFF_Face face, + FT_Face face, /* CFF_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ); FT_LOCAL( void ) - cff_face_done( CFF_Face face ); + cff_face_done( FT_Face face ); /* CFF_Face */ /*************************************************************************/ @@ -148,10 +157,10 @@ FT_BEGIN_HEADER /* Driver functions */ /* */ FT_LOCAL( FT_Error ) - cff_driver_init( CFF_Driver driver ); + cff_driver_init( FT_Module module ); FT_LOCAL( void ) - cff_driver_done( CFF_Driver driver ); + cff_driver_done( FT_Module module ); FT_END_HEADER diff --git a/src/libs/freetype2/cff/cffparse.c b/src/libs/freetype2/cff/cffparse.c index c4e5a6c595..fdf7173344 100644 --- a/src/libs/freetype2/cff/cffparse.c +++ b/src/libs/freetype2/cff/cffparse.c @@ -143,8 +143,8 @@ FT_Int power_ten ) { FT_Byte* p = start; - FT_Long num, divider, result, exp; - FT_Int sign = 0, exp_sign = 0; + FT_Long num, divider, result, exponent; + FT_Int sign = 0, exponent_sign = 0; FT_UInt nib; FT_UInt phase; @@ -212,13 +212,13 @@ /* read exponent, if any */ if ( nib == 12 ) { - exp_sign = 1; - nib = 11; + exponent_sign = 1; + nib = 11; } if ( nib == 11 ) { - exp = 0; + exponent = 0; for (;;) { @@ -239,13 +239,13 @@ if ( nib >= 10 ) break; - exp = exp * 10 + nib; + exponent = exponent * 10 + nib; } - if ( exp_sign ) - exp = -exp; + if ( exponent_sign ) + exponent = -exponent; - power_ten += (FT_Int)exp; + power_ten += (FT_Int)exponent; } /* raise to power of ten if needed */ @@ -590,19 +590,19 @@ Store_Number: switch ( field->size ) { - case 1: + case (8 / FT_CHAR_BIT): *(FT_Byte*)q = (FT_Byte)val; break; - case 2: + case (16 / FT_CHAR_BIT): *(FT_Short*)q = (FT_Short)val; break; - case 4: + case (32 / FT_CHAR_BIT): *(FT_Int32*)q = (FT_Int)val; break; - default: /* for 64-bit systems where long is 8 bytes */ + default: /* for 64-bit systems */ *(FT_Long*)q = val; } break; @@ -627,15 +627,15 @@ val += cff_parse_num( data++ ); switch ( field->size ) { - case 1: + case (8 / FT_CHAR_BIT): *(FT_Byte*)q = (FT_Byte)val; break; - case 2: + case (16 / FT_CHAR_BIT): *(FT_Short*)q = (FT_Short)val; break; - case 4: + case (32 / FT_CHAR_BIT): *(FT_Int32*)q = (FT_Int)val; break; diff --git a/src/libs/freetype2/cff/cfftoken.h b/src/libs/freetype2/cff/cfftoken.h index 659d1576aa..6bb27d5caf 100644 --- a/src/libs/freetype2/cff/cfftoken.h +++ b/src/libs/freetype2/cff/cfftoken.h @@ -49,7 +49,7 @@ CFF_FIELD_STRING ( 0x116, base_font_name ) CFF_FIELD_DELTA ( 0x117, base_font_blend, 16 ) CFF_FIELD_CALLBACK( 0x118, multiple_master ) - CFF_FIELD_CALLBACK( 0x119, blend_axit_types ) + CFF_FIELD_CALLBACK( 0x119, blend_axis_types ) #endif CFF_FIELD_CALLBACK( 0x11E, cid_ros ) diff --git a/src/libs/freetype2/cid/Jamfile b/src/libs/freetype2/cid/Jamfile index f09529a31b..a6cc421810 100644 --- a/src/libs/freetype2/cid/Jamfile +++ b/src/libs/freetype2/cid/Jamfile @@ -20,4 +20,5 @@ UseFreeTypeHeaders ; FT2_Library $(FT2_LIB) : $(_sources).c ; } -# end of src/cid Jamfile +# end of src/cid Jamfile + diff --git a/src/libs/freetype2/cid/cidgload.c b/src/libs/freetype2/cid/cidgload.c index 3717eeb9e5..cbd0865d3c 100644 --- a/src/libs/freetype2/cid/cidgload.c +++ b/src/libs/freetype2/cid/cidgload.c @@ -269,14 +269,16 @@ FT_LOCAL_DEF( FT_Error ) - cid_slot_load_glyph( CID_GlyphSlot glyph, - CID_Size size, - FT_Int glyph_index, - FT_Int32 load_flags ) + cid_slot_load_glyph( FT_GlyphSlot cidglyph, /* CID_GlyphSlot */ + FT_Size cidsize, /* CID_Size */ + FT_UInt glyph_index, + FT_Int32 load_flags ) { + CID_GlyphSlot glyph = (CID_GlyphSlot)cidglyph; + CID_Size size = (CID_Size)cidsize; FT_Error error; T1_DecoderRec decoder; - CID_Face face = (CID_Face)glyph->root.face; + CID_Face face = (CID_Face)cidglyph->face; FT_Bool hinting; PSAux_Service psaux = (PSAux_Service)face->psaux; @@ -287,22 +289,22 @@ if ( load_flags & FT_LOAD_NO_RECURSE ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; - glyph->x_scale = size->root.metrics.x_scale; - glyph->y_scale = size->root.metrics.y_scale; + glyph->x_scale = cidsize->metrics.x_scale; + glyph->y_scale = cidsize->metrics.y_scale; - glyph->root.outline.n_points = 0; - glyph->root.outline.n_contours = 0; + cidglyph->outline.n_points = 0; + cidglyph->outline.n_contours = 0; hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); - glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; + cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; { error = psaux->t1_decoder_funcs->init( &decoder, - (FT_Face)face, - (FT_Size)size, - (FT_GlyphSlot)glyph, + cidglyph->face, + cidsize, + cidglyph, 0, /* glyph names -- XXX */ 0, /* blend == 0 */ hinting, @@ -327,18 +329,18 @@ /* bearing the yMax */ if ( !error ) { - glyph->root.outline.flags &= FT_OUTLINE_OWNER; - glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL; + cidglyph->outline.flags &= FT_OUTLINE_OWNER; + cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL; /* for composite glyphs, return only left side bearing and */ /* advance width */ if ( load_flags & FT_LOAD_NO_RECURSE ) { - FT_Slot_Internal internal = glyph->root.internal; + FT_Slot_Internal internal = cidglyph->internal; - glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x; - glyph->root.metrics.horiAdvance = decoder.builder.advance.x; + cidglyph->metrics.horiBearingX = decoder.builder.left_bearing.x; + cidglyph->metrics.horiAdvance = decoder.builder.advance.x; internal->glyph_matrix = font_matrix; internal->glyph_delta = font_offset; @@ -347,30 +349,30 @@ else { FT_BBox cbox; - FT_Glyph_Metrics* metrics = &glyph->root.metrics; + FT_Glyph_Metrics* metrics = &cidglyph->metrics; FT_Vector advance; /* copy the _unscaled_ advance width */ - metrics->horiAdvance = decoder.builder.advance.x; - glyph->root.linearHoriAdvance = decoder.builder.advance.x; - glyph->root.internal->glyph_transformed = 0; + metrics->horiAdvance = decoder.builder.advance.x; + cidglyph->linearHoriAdvance = decoder.builder.advance.x; + cidglyph->internal->glyph_transformed = 0; /* make up vertical metrics */ metrics->vertBearingX = 0; metrics->vertBearingY = 0; metrics->vertAdvance = 0; - glyph->root.linearVertAdvance = 0; - glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; + cidglyph->linearVertAdvance = 0; + cidglyph->format = FT_GLYPH_FORMAT_OUTLINE; - if ( size && size->root.metrics.y_ppem < 24 ) - glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION; + if ( size && cidsize->metrics.y_ppem < 24 ) + cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; /* apply the font matrix */ - FT_Outline_Transform( &glyph->root.outline, &font_matrix ); + FT_Outline_Transform( &cidglyph->outline, &font_matrix ); - FT_Outline_Translate( &glyph->root.outline, + FT_Outline_Translate( &cidglyph->outline, font_offset.x, font_offset.y ); @@ -401,7 +403,7 @@ vec->y = FT_MulFix( vec->y, y_scale ); } - FT_Outline_Get_CBox( &glyph->root.outline, &cbox ); + FT_Outline_Get_CBox( &cidglyph->outline, &cbox ); /* Then scale the metrics */ metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale ); @@ -421,7 +423,7 @@ } /* compute the other metrics */ - FT_Outline_Get_CBox( &glyph->root.outline, &cbox ); + FT_Outline_Get_CBox( &cidglyph->outline, &cbox ); /* grid fit the bounding box if necessary */ if ( hinting ) @@ -439,6 +441,7 @@ metrics->horiBearingY = cbox.yMax; } } + return error; } diff --git a/src/libs/freetype2/cid/cidgload.h b/src/libs/freetype2/cid/cidgload.h index 93858e8650..a0a91bfea8 100644 --- a/src/libs/freetype2/cid/cidgload.h +++ b/src/libs/freetype2/cid/cidgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -37,10 +37,10 @@ FT_BEGIN_HEADER #endif /* 0 */ FT_LOCAL( FT_Error ) - cid_slot_load_glyph( CID_GlyphSlot glyph, - CID_Size size, - FT_Int glyph_index, - FT_Int32 load_flags ); + cid_slot_load_glyph( FT_GlyphSlot glyph, /* CID_Glyph_Slot */ + FT_Size size, /* CID_Size */ + FT_UInt glyph_index, + FT_Int32 load_flags ); FT_END_HEADER diff --git a/src/libs/freetype2/cid/cidload.c b/src/libs/freetype2/cid/cidload.c index ad29dd52d2..8d96ea6ee4 100644 --- a/src/libs/freetype2/cid/cidload.c +++ b/src/libs/freetype2/cid/cidload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -324,8 +324,8 @@ if ( !name ) break; - if ( cur[0] == name[0] && - len == ft_strlen( (const char*)name ) ) + if ( cur[0] == name[0] && + len == (FT_PtrDist)ft_strlen( (const char*)name ) ) { FT_PtrDist n; @@ -536,11 +536,11 @@ } if ( ft_isdigit( *p ) ) - val = *p - '0'; + val = (FT_Byte)( *p - '0' ); else if ( *p >= 'a' && *p <= 'f' ) - val = *p - 'a'; + val = (FT_Byte)( *p - 'a' ); else if ( *p >= 'A' && *p <= 'F' ) - val = *p - 'A' + 10; + val = (FT_Byte)( *p - 'A' + 10 ); else if ( *p == ' ' || *p == '\t' || *p == '\r' || @@ -563,14 +563,14 @@ } if ( upper_nibble ) - *d = val << 4; + *d = (FT_Byte)( val << 4 ); else { - *d += val; + *d = (FT_Byte)( *d + val ); d++; } - upper_nibble = 1 - upper_nibble; + upper_nibble = (FT_Byte)( 1 - upper_nibble ); if ( done ) break; diff --git a/src/libs/freetype2/cid/cidobjs.c b/src/libs/freetype2/cid/cidobjs.c index 356d01805a..3fb47bccec 100644 --- a/src/libs/freetype2/cid/cidobjs.c +++ b/src/libs/freetype2/cid/cidobjs.c @@ -4,7 +4,7 @@ /* */ /* CID objects manager (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -47,20 +47,20 @@ /*************************************************************************/ FT_LOCAL_DEF( void ) - cid_slot_done( CID_GlyphSlot slot ) + cid_slot_done( FT_GlyphSlot slot ) { - slot->root.internal->glyph_hints = 0; + slot->internal->glyph_hints = 0; } FT_LOCAL_DEF( FT_Error ) - cid_slot_init( CID_GlyphSlot slot ) + cid_slot_init( FT_GlyphSlot slot ) { CID_Face face; PSHinter_Service pshinter; - face = (CID_Face)slot->root.face; + face = (CID_Face)slot->face; pshinter = (PSHinter_Service)face->pshinter; if ( pshinter ) @@ -68,7 +68,7 @@ FT_Module module; - module = FT_Get_Module( slot->root.face->driver->root.library, + module = FT_Get_Module( slot->face->driver->root.library, "pshinter" ); if ( module ) { @@ -76,7 +76,7 @@ funcs = pshinter->get_t1_funcs( module ); - slot->root.internal->glyph_hints = (void*)funcs; + slot->internal->glyph_hints = (void*)funcs; } } @@ -108,25 +108,29 @@ FT_LOCAL_DEF( void ) - cid_size_done( CID_Size size ) + cid_size_done( FT_Size cidsize ) /* CID_Size */ { - if ( size->root.internal ) + CID_Size size = (CID_Size)cidsize; + + + if ( cidsize->internal ) { PSH_Globals_Funcs funcs; funcs = cid_size_get_globals_funcs( size ); if ( funcs ) - funcs->destroy( (PSH_Globals)size->root.internal ); + funcs->destroy( (PSH_Globals)cidsize->internal ); - size->root.internal = 0; + cidsize->internal = 0; } } FT_LOCAL_DEF( FT_Error ) - cid_size_init( CID_Size size ) + cid_size_init( FT_Size cidsize ) /* CID_Size */ { + CID_Size size = (CID_Size)cidsize; FT_Error error = 0; PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size ); @@ -134,14 +138,14 @@ if ( funcs ) { PSH_Globals globals; - CID_Face face = (CID_Face)size->root.face; + CID_Face face = (CID_Face)cidsize->face; CID_FaceDict dict = face->cid.font_dicts + face->root.face_index; PS_Private priv = &dict->private_dict; - error = funcs->create( size->root.face->memory, priv, &globals ); + error = funcs->create( cidsize->face->memory, priv, &globals ); if ( !error ) - size->root.internal = (FT_Size_Internal)(void*)globals; + cidsize->internal = (FT_Size_Internal)(void*)globals; } return error; @@ -149,21 +153,43 @@ FT_LOCAL_DEF( FT_Error ) - cid_size_reset( CID_Size size ) + cid_size_reset( FT_Size cidsize, /* CID_Size */ + FT_UInt char_width, + FT_UInt char_height ) { + CID_Size size = (CID_Size)cidsize; PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size ); FT_Error error = 0; + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); + if ( funcs ) - error = funcs->set_scale( (PSH_Globals)size->root.internal, - size->root.metrics.x_scale, - size->root.metrics.y_scale, + error = funcs->set_scale( (PSH_Globals)cidsize->internal, + cidsize->metrics.x_scale, + cidsize->metrics.y_scale, 0, 0 ); return error; } + FT_LOCAL_DEF( FT_Error ) + cid_point_size_reset( FT_Size size, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ) + { + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); + FT_UNUSED( horz_resolution ); + FT_UNUSED( vert_resolution ); + + return cid_size_reset( size, 0, 0 ); + } + + /*************************************************************************/ /* */ /* FACE FUNCTIONS */ @@ -182,8 +208,9 @@ /* face :: A pointer to the face object to destroy. */ /* */ FT_LOCAL_DEF( void ) - cid_face_done( CID_Face face ) + cid_face_done( FT_Face cidface ) /* CID_Face */ { + CID_Face face = (CID_Face)cidface; FT_Memory memory; @@ -193,7 +220,7 @@ PS_FontInfo info = &cid->font_info; - memory = face->root.memory; + memory = cidface->memory; /* release subrs */ if ( face->subrs ) @@ -232,8 +259,8 @@ FT_FREE( cid->registry ); FT_FREE( cid->ordering ); - face->root.family_name = 0; - face->root.style_name = 0; + cidface->family_name = 0; + cidface->style_name = 0; FT_FREE( face->binary_data ); FT_FREE( face->cid_stream ); @@ -266,24 +293,22 @@ /* */ FT_LOCAL_DEF( FT_Error ) cid_face_init( FT_Stream stream, - CID_Face face, + FT_Face cidface, /* CID_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { - FT_Error error; - FT_Service_PsCMaps psnames; - PSAux_Service psaux; - PSHinter_Service pshinter; + CID_Face face = (CID_Face)cidface; + FT_Error error; + PSAux_Service psaux; + PSHinter_Service pshinter; FT_UNUSED( num_params ); FT_UNUSED( params ); FT_UNUSED( stream ); - face->root.num_faces = 1; - - FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); + cidface->num_faces = 1; psaux = (PSAux_Service)face->psaux; if ( !psaux ) @@ -329,33 +354,32 @@ /* set up root face fields */ { - FT_Face root = (FT_Face)&face->root; CID_FaceInfo cid = &face->cid; PS_FontInfo info = &cid->font_info; - root->num_glyphs = cid->cid_count; - root->num_charmaps = 0; + cidface->num_glyphs = cid->cid_count; + cidface->num_charmaps = 0; - root->face_index = face_index; - root->face_flags = FT_FACE_FLAG_SCALABLE; + cidface->face_index = face_index; + cidface->face_flags = FT_FACE_FLAG_SCALABLE; - root->face_flags |= FT_FACE_FLAG_HORIZONTAL; + cidface->face_flags |= FT_FACE_FLAG_HORIZONTAL; if ( info->is_fixed_pitch ) - root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; + cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; /* XXX: TODO: add kerning with .afm support */ /* get style name -- be careful, some broken fonts only */ /* have a /FontName dictionary entry! */ - root->family_name = info->family_name; + cidface->family_name = info->family_name; /* assume "Regular" style if we don't know better */ - root->style_name = (char *)"Regular"; - if ( root->family_name ) + cidface->style_name = (char *)"Regular"; + if ( cidface->family_name ) { char* full = info->full_name; - char* family = root->family_name; + char* family = cidface->family_name; if ( full ) @@ -376,7 +400,7 @@ else { if ( !*family ) - root->style_name = full; + cidface->style_name = full; break; } } @@ -387,42 +411,42 @@ { /* do we have a `/FontName'? */ if ( cid->cid_font_name ) - root->family_name = cid->cid_font_name; + cidface->family_name = cid->cid_font_name; } /* compute style flags */ - root->style_flags = 0; + cidface->style_flags = 0; if ( info->italic_angle ) - root->style_flags |= FT_STYLE_FLAG_ITALIC; + cidface->style_flags |= FT_STYLE_FLAG_ITALIC; if ( info->weight ) { if ( !ft_strcmp( info->weight, "Bold" ) || !ft_strcmp( info->weight, "Black" ) ) - root->style_flags |= FT_STYLE_FLAG_BOLD; + cidface->style_flags |= FT_STYLE_FLAG_BOLD; } /* no embedded bitmap support */ - root->num_fixed_sizes = 0; - root->available_sizes = 0; + cidface->num_fixed_sizes = 0; + cidface->available_sizes = 0; - root->bbox.xMin = cid->font_bbox.xMin >> 16; - root->bbox.yMin = cid->font_bbox.yMin >> 16; - root->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16; - root->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16; + cidface->bbox.xMin = cid->font_bbox.xMin >> 16; + cidface->bbox.yMin = cid->font_bbox.yMin >> 16; + cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16; + cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16; - if ( !root->units_per_EM ) - root->units_per_EM = 1000; + if ( !cidface->units_per_EM ) + cidface->units_per_EM = 1000; - root->ascender = (FT_Short)( root->bbox.yMax ); - root->descender = (FT_Short)( root->bbox.yMin ); - root->height = (FT_Short)( - ( ( root->ascender - root->descender ) * 12 ) / 10 ); + cidface->ascender = (FT_Short)( cidface->bbox.yMax ); + cidface->descender = (FT_Short)( cidface->bbox.yMin ); + cidface->height = (FT_Short)( + ( ( cidface->ascender - cidface->descender ) * 12 ) / 10 ); - root->underline_position = (FT_Short)info->underline_position; - root->underline_thickness = (FT_Short)info->underline_thickness; + cidface->underline_position = (FT_Short)info->underline_position; + cidface->underline_thickness = (FT_Short)info->underline_thickness; - root->internal->max_points = 0; - root->internal->max_contours = 0; + cidface->internal->max_points = 0; + cidface->internal->max_contours = 0; } Exit: @@ -445,7 +469,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - cid_driver_init( CID_Driver driver ) + cid_driver_init( FT_Module driver ) { FT_UNUSED( driver ); @@ -465,7 +489,7 @@ /* driver :: A handle to the target CID driver. */ /* */ FT_LOCAL_DEF( void ) - cid_driver_done( CID_Driver driver ) + cid_driver_done( FT_Module driver ) { FT_UNUSED( driver ); } diff --git a/src/libs/freetype2/cid/cidobjs.h b/src/libs/freetype2/cid/cidobjs.h index 2d72d73e2f..9d230baf8c 100644 --- a/src/libs/freetype2/cid/cidobjs.h +++ b/src/libs/freetype2/cid/cidobjs.h @@ -4,7 +4,7 @@ /* */ /* CID objects manager (specification). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -112,42 +112,47 @@ FT_BEGIN_HEADER FT_LOCAL( void ) - cid_slot_done( CID_GlyphSlot slot ); + cid_slot_done( FT_GlyphSlot slot ); FT_LOCAL( FT_Error ) - cid_slot_init( CID_GlyphSlot slot ); + cid_slot_init( FT_GlyphSlot slot ); FT_LOCAL( void ) - cid_size_done( CID_Size size ); - + cid_size_done( FT_Size size ); /* CID_Size */ FT_LOCAL( FT_Error ) - cid_size_init( CID_Size size ); - + cid_size_init( FT_Size size ); /* CID_Size */ FT_LOCAL( FT_Error ) - cid_size_reset( CID_Size size ); + cid_size_reset( FT_Size size, /* CID_Size */ + FT_UInt char_width, + FT_UInt char_height ); + + FT_LOCAL( FT_Error ) + cid_point_size_reset( FT_Size size, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ); FT_LOCAL( FT_Error ) cid_face_init( FT_Stream stream, - CID_Face face, + FT_Face face, /* CID_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ); - FT_LOCAL( void ) - cid_face_done( CID_Face face ); + cid_face_done( FT_Face face ); /* CID_Face */ FT_LOCAL( FT_Error ) - cid_driver_init( CID_Driver driver ); - + cid_driver_init( FT_Module driver ); FT_LOCAL( void ) - cid_driver_done( CID_Driver driver ); + cid_driver_done( FT_Module driver ); FT_END_HEADER diff --git a/src/libs/freetype2/cid/cidparse.c b/src/libs/freetype2/cid/cidparse.c index 3f18749f60..a964d81575 100644 --- a/src/libs/freetype2/cid/cidparse.c +++ b/src/libs/freetype2/cid/cidparse.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 parser (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -152,6 +152,9 @@ while ( cur < limit ) { + if ( parser->root.error ) + break; + if ( *cur == 'S' && ft_strncmp( (char*)cur, "StartData", 9 ) == 0 ) { if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 ) diff --git a/src/libs/freetype2/cid/cidriver.c b/src/libs/freetype2/cid/cidriver.c index f5639b9f76..377835b3c9 100644 --- a/src/libs/freetype2/cid/cidriver.c +++ b/src/libs/freetype2/cid/cidriver.c @@ -4,7 +4,7 @@ /* */ /* CID driver interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -78,8 +78,9 @@ static const FT_Service_PsInfoRec cid_service_ps_info = { - (PS_GetFontInfoFunc) cid_ps_get_font_info, - (PS_HasGlyphNamesFunc)NULL /* unsupported with CID fonts */ + (PS_GetFontInfoFunc) cid_ps_get_font_info, + (PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */ + (PS_GetFontPrivateFunc)NULL /* unsupported */ }; @@ -97,12 +98,11 @@ }; - static FT_Module_Interface - cid_get_interface( FT_Driver driver, - const FT_String* cid_interface ) + FT_CALLBACK_DEF( FT_Module_Interface ) + cid_get_interface( FT_Module module, + const char* cid_interface ) { - FT_UNUSED( driver ); - FT_UNUSED( cid_interface ); + FT_UNUSED( module ); return ft_service_list_lookup( cid_services, cid_interface ); } @@ -125,9 +125,9 @@ 0, - (FT_Module_Constructor)cid_driver_init, - (FT_Module_Destructor) cid_driver_done, - (FT_Module_Requester) cid_get_interface + cid_driver_init, + cid_driver_done, + cid_get_interface }, /* then the other font drivers fields */ @@ -135,23 +135,23 @@ sizeof( CID_SizeRec ), sizeof( CID_GlyphSlotRec ), - (FT_Face_InitFunc) cid_face_init, - (FT_Face_DoneFunc) cid_face_done, + cid_face_init, + cid_face_done, - (FT_Size_InitFunc) cid_size_init, - (FT_Size_DoneFunc) cid_size_done, - (FT_Slot_InitFunc) cid_slot_init, - (FT_Slot_DoneFunc) cid_slot_done, + cid_size_init, + cid_size_done, + cid_slot_init, + cid_slot_done, - (FT_Size_ResetPointsFunc)cid_size_reset, - (FT_Size_ResetPixelsFunc)cid_size_reset, + cid_point_size_reset, + cid_size_reset, - (FT_Slot_LoadFunc) cid_slot_load_glyph, + cid_slot_load_glyph, - (FT_Face_GetKerningFunc) 0, - (FT_Face_AttachFunc) 0, + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ - (FT_Face_GetAdvancesFunc)0, + 0 /* FT_Face_GetAdvancesFunc */ }; diff --git a/src/libs/freetype2/gzip/adler32.c b/src/libs/freetype2/gzip/adler32.c index bd47f73093..706da263d2 100644 --- a/src/libs/freetype2/gzip/adler32.c +++ b/src/libs/freetype2/gzip/adler32.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: adler32.c,v 1.3 2004/06/22 14:01:14 darkwyrm Exp $ */ +/* @(#) $Id$ */ #include "zlib.h" diff --git a/src/libs/freetype2/gzip/ftgzip.c b/src/libs/freetype2/gzip/ftgzip.c index e35c07385b..67e7bb8f05 100644 --- a/src/libs/freetype2/gzip/ftgzip.c +++ b/src/libs/freetype2/gzip/ftgzip.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2002, 2003, 2004 by */ +/* Copyright 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -562,10 +562,18 @@ FT_GZipFile zip; + /* + * check the header right now; this prevents allocating un-necessary + * objects when we don't need them + */ + error = ft_gzip_check_header( source ); + if ( error ) + goto Exit; + FT_ZERO( stream ); stream->memory = memory; - if ( !FT_NEW( zip ) ) + if ( !FT_QNEW( zip ) ) { error = ft_gzip_file_init( zip, stream, source ); if ( error ) diff --git a/src/libs/freetype2/gzip/zconf.h b/src/libs/freetype2/gzip/zconf.h index f0bbc8da35..d6989c9f85 100644 --- a/src/libs/freetype2/gzip/zconf.h +++ b/src/libs/freetype2/gzip/zconf.h @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: zconf.h,v 1.3 2004/06/22 14:01:14 darkwyrm Exp $ */ +/* @(#) $Id$ */ #ifndef _ZCONF_H #define _ZCONF_H diff --git a/src/libs/freetype2/gzip/zutil.c b/src/libs/freetype2/gzip/zutil.c index e3591954e5..5da9f98134 100644 --- a/src/libs/freetype2/gzip/zutil.c +++ b/src/libs/freetype2/gzip/zutil.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -/* @(#) $Id: zutil.c,v 1.3 2004/06/22 14:01:14 darkwyrm Exp $ */ +/* @(#) $Id$ */ #include "zutil.h" diff --git a/src/libs/freetype2/gzip/zutil.h b/src/libs/freetype2/gzip/zutil.h index 12af4e0d31..ce02022aa7 100644 --- a/src/libs/freetype2/gzip/zutil.h +++ b/src/libs/freetype2/gzip/zutil.h @@ -8,7 +8,7 @@ subject to change. Applications should only use zlib.h. */ -/* @(#) $Id: zutil.h,v 1.3 2004/06/22 14:01:14 darkwyrm Exp $ */ +/* @(#) $Id$ */ #ifndef _Z_UTIL_H #define _Z_UTIL_H diff --git a/src/libs/freetype2/lzw/ftlzw.c b/src/libs/freetype2/lzw/ftlzw.c index a0e4cc5762..5d23cd2420 100644 --- a/src/libs/freetype2/lzw/ftlzw.c +++ b/src/libs/freetype2/lzw/ftlzw.c @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2004 by */ +/* Copyright 2004, 2005 by */ /* Albert Chin-A-Young. */ /* */ /* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */ @@ -415,6 +415,17 @@ FT_LZWFile zip; + /* + * Check the header right now; this prevents allocation a huge + * LZWFile object (400 KByte of heap memory) if not necessary. + * + * Did I mention that you should never use .Z compressed font + * file? + */ + error = ft_lzw_check_header( source ); + if ( error ) + goto Exit; + FT_ZERO( stream ); stream->memory = memory; diff --git a/src/libs/freetype2/lzw/zopen.c b/src/libs/freetype2/lzw/zopen.c index 5267f1622b..5a3c5bc2b3 100644 --- a/src/libs/freetype2/lzw/zopen.c +++ b/src/libs/freetype2/lzw/zopen.c @@ -35,7 +35,7 @@ /*- * - * Copyright (c) 2004 + * Copyright (c) 2004, 2005 * Albert Chin-A-Young. * * Modified to work with FreeType's PCF driver. @@ -66,10 +66,14 @@ static char rcsid[] = "$NetBSD: zopen.c,v 1.8 2003/08/07 11:13:29 agc Exp $"; */ #include <ctype.h> +#if 0 #include <signal.h> +#endif #include <stdlib.h> #include <string.h> +#if 0 #include <unistd.h> +#endif #if 0 static char_type magic_header[] = @@ -246,7 +250,7 @@ zread(s_zstate_t *zs) /* Special case for KwKwK string. */ if (code >= free_ent) { - *stackp++ = finchar; + *stackp++ = (unsigned char)finchar; code = oldcode; } @@ -255,7 +259,7 @@ zread(s_zstate_t *zs) *stackp++ = tab_suffixof(code); code = tab_prefixof(code); } - *stackp++ = finchar = tab_suffixof(code); + *stackp++ = (unsigned char)(finchar = tab_suffixof(code)); /* And put them out in forward order. */ middle: @@ -272,8 +276,8 @@ middle: /* Generate the new entry. */ if ((code = free_ent) < maxmaxcode) { - tab_prefixof(code) = (unsigned short) oldcode; - tab_suffixof(code) = finchar; + tab_prefixof(code) = (unsigned short)oldcode; + tab_suffixof(code) = (unsigned char)finchar; free_ent = code + 1; } @@ -318,7 +322,7 @@ getcode(s_zstate_t *zs) } if ( zs->avail_in < (unsigned int)n_bits && in_count > (long)n_bits ) { memcpy (buf, zs->next_in, zs->avail_in); - buf_len = zs->avail_in; + buf_len = (unsigned char)zs->avail_in; zs->avail_in = 0; return -1; } diff --git a/src/libs/freetype2/otvalid/Jamfile b/src/libs/freetype2/otvalid/Jamfile new file mode 100644 index 0000000000..d6ce7d16c6 --- /dev/null +++ b/src/libs/freetype2/otvalid/Jamfile @@ -0,0 +1,31 @@ +# FreeType 2 src/otvalid Jamfile +# +# Copyright 2004 by +# David Turner, Robert Wilhelm, and Werner Lemberg. +# +# This file is part of the FreeType project, and may only be used, modified, +# and distributed under the terms of the FreeType project license, +# LICENSE.TXT. By continuing to use, modify, or distribute this file you +# indicate that you have read the license and understand and accept it +# fully. + +SubDir OBOS_TOP src libs freetype2 otvalid ; + +UseFreeTypeHeaders ; + +{ + local _sources ; + + if $(FT2_MULTI) + { + _sources = otvbase otvcommn otvgdef otvgpos otvgsub otvjstf otvmod ; + } + else + { + _sources = otvalid ; + } + + FT2_Library $(FT2_LIB) : $(_sources).c ; +} + +# end of src/otvalid Jamfile diff --git a/src/libs/freetype2/otvalid/module.mk b/src/libs/freetype2/otvalid/module.mk new file mode 100644 index 0000000000..8f7cdf26c4 --- /dev/null +++ b/src/libs/freetype2/otvalid/module.mk @@ -0,0 +1,22 @@ +# +# FreeType 2 otvalid module definition +# + + +# Copyright 2004 by +# David Turner, Robert Wilhelm, and Werner Lemberg. +# +# This file is part of the FreeType project, and may only be used, modified, +# and distributed under the terms of the FreeType project license, +# LICENSE.TXT. By continuing to use, modify, or distribute this file you +# indicate that you have read the license and understand and accept it +# fully. + + +make_module_list: add_otvalid_module + +add_otvalid_module: + $(OPEN_DRIVER)otvalid_module_class$(CLOSE_DRIVER) + $(ECHO_DRIVER)otvalid $(ECHO_DRIVER_DESC)OpenType validation module$(ECHO_DRIVER_DONE) + +# EOF diff --git a/src/libs/freetype2/otvalid/otvalid.c b/src/libs/freetype2/otvalid/otvalid.c new file mode 100644 index 0000000000..2f85f601b6 --- /dev/null +++ b/src/libs/freetype2/otvalid/otvalid.c @@ -0,0 +1,30 @@ +/***************************************************************************/ +/* */ +/* otvalid.c */ +/* */ +/* FreeType validator for OpenType tables (body only). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +#define FT_MAKE_OPTION_SINGLE_OBJECT + +#include <ft2build.h> + +#include "otvbase.c" +#include "otvcommn.c" +#include "otvgdef.c" +#include "otvgpos.c" +#include "otvgsub.c" +#include "otvjstf.c" +#include "otvmod.c" + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvalid.h b/src/libs/freetype2/otvalid/otvalid.h new file mode 100644 index 0000000000..38f030f393 --- /dev/null +++ b/src/libs/freetype2/otvalid/otvalid.h @@ -0,0 +1,72 @@ +/***************************************************************************/ +/* */ +/* otvalid.h */ +/* */ +/* OpenType table validation (specification only). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __OTVALID_H__ +#define __OTVALID_H__ + + +#include <ft2build.h> +#include FT_FREETYPE_H + +#include "otverror.h" /* must come before FT_INTERNAL_VALIDATE_H */ + +#include FT_INTERNAL_VALIDATE_H +#include FT_INTERNAL_STREAM_H + + +FT_BEGIN_HEADER + + + FT_LOCAL( void ) + otv_BASE_validate( FT_Bytes table, + FT_Validator valid ); + + /* GSUB and GPOS tables should already be validated; */ + /* if missing, set corresponding argument to 0 */ + FT_LOCAL( void ) + otv_GDEF_validate( FT_Bytes table, + FT_Bytes gsub, + FT_Bytes gpos, + FT_Validator valid ); + + FT_LOCAL( void ) + otv_GPOS_validate( FT_Bytes table, + FT_UInt glyph_count, + FT_Validator valid ); + + FT_LOCAL( void ) + otv_GSUB_validate( FT_Bytes table, + FT_UInt glyph_count, + FT_Validator valid ); + + /* GSUB and GPOS tables should already be validated; */ + /* if missing, set corresponding argument to 0 */ + FT_LOCAL( void ) + otv_JSTF_validate( FT_Bytes table, + FT_Bytes gsub, + FT_Bytes gpos, + FT_UInt glyph_count, + FT_Validator valid ); + + +FT_END_HEADER + +#endif /* __OTVALID_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvbase.c b/src/libs/freetype2/otvalid/otvbase.c new file mode 100644 index 0000000000..8ad2238d6d --- /dev/null +++ b/src/libs/freetype2/otvalid/otvbase.c @@ -0,0 +1,318 @@ +/***************************************************************************/ +/* */ +/* otvbase.c */ +/* */ +/* OpenType BASE table validation (body). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include "otvalid.h" +#include "otvcommn.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_otvbase + + + static void + otv_BaseCoord_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt BaseCoordFormat; + + + OTV_NAME_ENTER( "BaseCoord" ); + + OTV_LIMIT_CHECK( 4 ); + BaseCoordFormat = FT_NEXT_USHORT( p ); + p += 2; /* skip Coordinate */ + + OTV_TRACE(( " (format %d)\n", BaseCoordFormat )); + + switch ( BaseCoordFormat ) + { + case 1: /* BaseCoordFormat1 */ + break; + + case 2: /* BaseCoordFormat2 */ + OTV_LIMIT_CHECK( 4 ); /* ReferenceGlyph, BaseCoordPoint */ + break; + + case 3: /* BaseCoordFormat3 */ + OTV_LIMIT_CHECK( 2 ); + /* DeviceTable */ + otv_Device_validate( table + FT_NEXT_USHORT( p ), valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + static void + otv_BaseTagList_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt BaseTagCount; + + + OTV_NAME_ENTER( "BaseTagList" ); + + OTV_LIMIT_CHECK( 2 ); + + BaseTagCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (BaseTagCount = %d)\n", BaseTagCount )); + + OTV_LIMIT_CHECK( BaseTagCount * 4 ); /* BaselineTag */ + + OTV_EXIT; + } + + + static void + otv_BaseValues_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt BaseCoordCount; + + + OTV_NAME_ENTER( "BaseValues" ); + + OTV_LIMIT_CHECK( 4 ); + + p += 2; /* skip DefaultIndex */ + BaseCoordCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (BaseCoordCount = %d)\n", BaseCoordCount )); + + OTV_LIMIT_CHECK( BaseCoordCount * 2 ); + + /* BaseCoord */ + for ( ; BaseCoordCount > 0; BaseCoordCount-- ) + otv_BaseCoord_validate( table + FT_NEXT_USHORT( p ), valid ); + + OTV_EXIT; + } + + + static void + otv_MinMax_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt table_size; + FT_UInt FeatMinMaxCount; + + OTV_OPTIONAL_TABLE( MinCoord ); + OTV_OPTIONAL_TABLE( MaxCoord ); + + + OTV_NAME_ENTER( "MinMax" ); + + OTV_LIMIT_CHECK( 6 ); + + OTV_OPTIONAL_OFFSET( MinCoord ); + OTV_OPTIONAL_OFFSET( MaxCoord ); + FeatMinMaxCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (FeatMinMaxCount = %d)\n", FeatMinMaxCount )); + + table_size = FeatMinMaxCount * 8 + 6; + + OTV_SIZE_CHECK( MinCoord ); + if ( MinCoord ) + otv_BaseCoord_validate( table + MinCoord, valid ); + + OTV_SIZE_CHECK( MaxCoord ); + if ( MaxCoord ) + otv_BaseCoord_validate( table + MaxCoord, valid ); + + OTV_LIMIT_CHECK( FeatMinMaxCount * 8 ); + + /* FeatMinMaxRecord */ + for ( ; FeatMinMaxCount > 0; FeatMinMaxCount-- ) + { + p += 4; /* skip FeatureTableTag */ + + OTV_OPTIONAL_OFFSET( MinCoord ); + OTV_OPTIONAL_OFFSET( MaxCoord ); + + OTV_SIZE_CHECK( MinCoord ); + if ( MinCoord ) + otv_BaseCoord_validate( table + MinCoord, valid ); + + OTV_SIZE_CHECK( MaxCoord ); + if ( MaxCoord ) + otv_BaseCoord_validate( table + MaxCoord, valid ); + } + + OTV_EXIT; + } + + + static void + otv_BaseScript_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt table_size; + FT_UInt BaseLangSysCount; + + OTV_OPTIONAL_TABLE( BaseValues ); + OTV_OPTIONAL_TABLE( DefaultMinMax ); + + + OTV_NAME_ENTER( "BaseScript" ); + + OTV_LIMIT_CHECK( 6 ); + OTV_OPTIONAL_OFFSET( BaseValues ); + OTV_OPTIONAL_OFFSET( DefaultMinMax ); + BaseLangSysCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (BaseLangSysCount = %d)\n", BaseLangSysCount )); + + table_size = BaseLangSysCount * 6 + 6; + + OTV_SIZE_CHECK( BaseValues ); + if ( BaseValues ) + otv_BaseValues_validate( table + BaseValues, valid ); + + OTV_SIZE_CHECK( DefaultMinMax ); + if ( DefaultMinMax ) + otv_MinMax_validate( table + DefaultMinMax, valid ); + + OTV_LIMIT_CHECK( BaseLangSysCount * 6 ); + + /* BaseLangSysRecord */ + for ( ; BaseLangSysCount > 0; BaseLangSysCount-- ) + { + p += 4; /* skip BaseLangSysTag */ + + otv_MinMax_validate( table + FT_NEXT_USHORT( p ), valid ); + } + + OTV_EXIT; + } + + + static void + otv_BaseScriptList_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt BaseScriptCount; + + + OTV_NAME_ENTER( "BaseScriptList" ); + + OTV_LIMIT_CHECK( 2 ); + BaseScriptCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (BaseScriptCount = %d)\n", BaseScriptCount )); + + OTV_LIMIT_CHECK( BaseScriptCount * 6 ); + + /* BaseScriptRecord */ + for ( ; BaseScriptCount > 0; BaseScriptCount-- ) + { + p += 4; /* skip BaseScriptTag */ + + /* BaseScript */ + otv_BaseScript_validate( table + FT_NEXT_USHORT( p ), valid ); + } + + OTV_EXIT; + } + + + static void + otv_Axis_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt table_size; + + OTV_OPTIONAL_TABLE( BaseTagList ); + + + OTV_NAME_ENTER( "Axis" ); + + OTV_LIMIT_CHECK( 4 ); + OTV_OPTIONAL_OFFSET( BaseTagList ); + + table_size = 4; + + OTV_SIZE_CHECK( BaseTagList ); + if ( BaseTagList ) + otv_BaseTagList_validate( table + BaseTagList, valid ); + + /* BaseScriptList */ + otv_BaseScriptList_validate( table + FT_NEXT_USHORT( p ), valid ); + + OTV_EXIT; + } + + + FT_LOCAL_DEF( void ) + otv_BASE_validate( FT_Bytes table, + FT_Validator ftvalid ) + { + OTV_ValidatorRec validrec; + OTV_Validator valid = &validrec; + FT_Bytes p = table; + FT_UInt table_size; + + OTV_OPTIONAL_TABLE( HorizAxis ); + OTV_OPTIONAL_TABLE( VertAxis ); + + + valid->root = ftvalid; + + FT_TRACE3(( "validating BASE table\n" )); + OTV_INIT; + + OTV_LIMIT_CHECK( 6 ); + + if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + FT_INVALID_DATA; + + table_size = 6; + + OTV_OPTIONAL_OFFSET( HorizAxis ); + OTV_SIZE_CHECK( HorizAxis ); + if ( HorizAxis ) + otv_Axis_validate( table + HorizAxis, valid ); + + OTV_OPTIONAL_OFFSET( VertAxis ); + OTV_SIZE_CHECK( VertAxis ); + if ( VertAxis ) + otv_Axis_validate( table + VertAxis, valid ); + + FT_TRACE4(( "\n" )); + } + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvcommn.c b/src/libs/freetype2/otvalid/otvcommn.c new file mode 100644 index 0000000000..1b9d77c425 --- /dev/null +++ b/src/libs/freetype2/otvalid/otvcommn.c @@ -0,0 +1,1055 @@ +/***************************************************************************/ +/* */ +/* otvcommn.c */ +/* */ +/* OpenType common tables validation (body). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include "otvcommn.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_otvcommon + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** COVERAGE TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL_DEF( void ) + otv_Coverage_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt CoverageFormat; + + + OTV_NAME_ENTER( "Coverage" ); + + OTV_LIMIT_CHECK( 4 ); + CoverageFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", CoverageFormat )); + + switch ( CoverageFormat ) + { + case 1: /* CoverageFormat1 */ + { + FT_UInt GlyphCount; + + + GlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + + OTV_LIMIT_CHECK( GlyphCount * 2 ); /* GlyphArray */ + } + break; + + case 2: /* CoverageFormat2 */ + { + FT_UInt n, RangeCount; + FT_UInt Start, End, StartCoverageIndex, total = 0, last = 0; + + + RangeCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (RangeCount = %d)\n", RangeCount )); + + OTV_LIMIT_CHECK( RangeCount * 6 ); + + /* RangeRecord */ + for ( n = 0; n < RangeCount; n++ ) + { + Start = FT_NEXT_USHORT( p ); + End = FT_NEXT_USHORT( p ); + StartCoverageIndex = FT_NEXT_USHORT( p ); + + if ( Start > End || StartCoverageIndex != total ) + FT_INVALID_DATA; + + if ( n > 0 && Start <= last ) + FT_INVALID_DATA; + + total += End - Start + 1; + last = End; + } + } + break; + + default: + FT_INVALID_FORMAT; + } + + /* no need to check glyph indices used as input to coverage tables */ + /* since even invalid glyph indices return a meaningful result */ + + OTV_EXIT; + } + + + FT_LOCAL_DEF( FT_UInt ) + otv_Coverage_get_first( FT_Bytes table ) + { + FT_Bytes p = table; + + + p += 4; /* skip CoverageFormat and Glyph/RangeCount */ + + return FT_NEXT_USHORT( p ); + } + + + FT_LOCAL_DEF( FT_UInt ) + otv_Coverage_get_last( FT_Bytes table ) + { + FT_Bytes p = table; + FT_UInt CoverageFormat = FT_NEXT_USHORT( p ); + FT_UInt count = FT_NEXT_USHORT( p ); /* Glyph/RangeCount */ + FT_UInt result = 0; + + + switch ( CoverageFormat ) + { + case 1: + p += ( count - 1 ) * 2; + result = FT_NEXT_USHORT( p ); + break; + + case 2: + p += ( count - 1 ) * 6 + 2; + result = FT_NEXT_USHORT( p ); + break; + + default: + ; + } + + return result; + } + + + FT_LOCAL_DEF( FT_UInt ) + otv_Coverage_get_count( FT_Bytes table ) + { + FT_Bytes p = table; + FT_UInt CoverageFormat = FT_NEXT_USHORT( p ); + FT_UInt count = FT_NEXT_USHORT( p ); /* Glyph/RangeCount */ + FT_UInt result = 0; + + + switch ( CoverageFormat ) + { + case 1: + return count; + + case 2: + { + FT_UInt Start, End; + + + for ( ; count > 0; count-- ) + { + Start = FT_NEXT_USHORT( p ); + End = FT_NEXT_USHORT( p ); + p += 2; /* skip StartCoverageIndex */ + + result += End - Start + 1; + } + } + break; + + default: + ; + } + + return result; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CLASS DEFINITION TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL_DEF( void ) + otv_ClassDef_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt ClassFormat; + + + OTV_NAME_ENTER( "ClassDef" ); + + OTV_LIMIT_CHECK( 4 ); + ClassFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", ClassFormat )); + + switch ( ClassFormat ) + { + case 1: /* ClassDefFormat1 */ + { + FT_UInt GlyphCount; + + + p += 2; /* skip StartGlyph */ + + OTV_LIMIT_CHECK( 2 ); + + OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + + GlyphCount = FT_NEXT_USHORT( p ); + + OTV_LIMIT_CHECK( GlyphCount * 2 ); /* ClassValueArray */ + } + break; + + case 2: /* ClassDefFormat2 */ + { + FT_UInt n, ClassRangeCount; + FT_UInt Start, End, last = 0; + + + ClassRangeCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (ClassRangeCount = %d)\n", ClassRangeCount )); + + OTV_LIMIT_CHECK( ClassRangeCount * 6 ); + + /* ClassRangeRecord */ + for ( n = 0; n < ClassRangeCount; n++ ) + { + Start = FT_NEXT_USHORT( p ); + End = FT_NEXT_USHORT( p ); + p += 2; /* skip Class */ + + if ( Start > End || ( n > 0 && Start <= last ) ) + FT_INVALID_DATA; + + last = End; + } + } + break; + + default: + FT_INVALID_FORMAT; + } + + /* no need to check glyph indices used as input to class definition */ + /* tables since even invalid glyph indices return a meaningful result */ + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** DEVICE TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL_DEF( void ) + otv_Device_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt StartSize, EndSize, DeltaFormat, count; + + + OTV_NAME_ENTER( "Device" ); + + OTV_LIMIT_CHECK( 8 ); + StartSize = FT_NEXT_USHORT( p ); + EndSize = FT_NEXT_USHORT( p ); + DeltaFormat = FT_NEXT_USHORT( p ); + + if ( DeltaFormat < 1 || DeltaFormat > 3 || EndSize < StartSize ) + FT_INVALID_DATA; + + count = EndSize - StartSize + 1; + OTV_LIMIT_CHECK( ( 1 << DeltaFormat ) * count / 8 ); /* DeltaValue */ + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** LOOKUPS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* uses valid->type_count */ + /* uses valid->type_funcs */ + + FT_LOCAL_DEF( void ) + otv_Lookup_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt LookupType, SubTableCount; + OTV_Validate_Func validate; + + + OTV_NAME_ENTER( "Lookup" ); + + OTV_LIMIT_CHECK( 6 ); + LookupType = FT_NEXT_USHORT( p ); + p += 2; /* skip LookupFlag */ + SubTableCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (type %d)\n", LookupType )); + + if ( LookupType == 0 || LookupType >= valid->type_count ) + FT_INVALID_DATA; + + validate = valid->type_funcs[LookupType - 1]; + + OTV_TRACE(( " (SubTableCount = %d)\n", SubTableCount )); + + OTV_LIMIT_CHECK( SubTableCount * 2 ); + + /* SubTable */ + for ( ; SubTableCount > 0; SubTableCount-- ) + validate( table + FT_NEXT_USHORT( p ), valid ); + + OTV_EXIT; + } + + + /* uses valid->lookup_count */ + + FT_LOCAL_DEF( void ) + otv_LookupList_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt LookupCount; + + + OTV_NAME_ENTER( "LookupList" ); + + OTV_LIMIT_CHECK( 2 ); + LookupCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (LookupCount = %d)\n", LookupCount )); + + OTV_LIMIT_CHECK( LookupCount * 2 ); + + valid->lookup_count = LookupCount; + + /* Lookup */ + for ( ; LookupCount > 0; LookupCount-- ) + otv_Lookup_validate( table + FT_NEXT_USHORT( p ), valid ); + + OTV_EXIT; + } + + + static FT_UInt + otv_LookupList_get_count( FT_Bytes table ) + { + return FT_NEXT_USHORT( table ); + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FEATURES *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* uses valid->lookup_count */ + + FT_LOCAL_DEF( void ) + otv_Feature_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt LookupCount; + + + OTV_NAME_ENTER( "Feature" ); + + OTV_LIMIT_CHECK( 4 ); + p += 2; /* skip FeatureParams (unused) */ + LookupCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (LookupCount = %d)\n", LookupCount )); + + OTV_LIMIT_CHECK( LookupCount * 2 ); + + /* LookupListIndex */ + for ( ; LookupCount > 0; LookupCount-- ) + if ( FT_NEXT_USHORT( p ) >= valid->lookup_count ) + FT_INVALID_DATA; + + OTV_EXIT; + } + + + static FT_UInt + otv_Feature_get_count( FT_Bytes table ) + { + return FT_NEXT_USHORT( table ); + } + + + /* sets valid->lookup_count */ + + FT_LOCAL_DEF( void ) + otv_FeatureList_validate( FT_Bytes table, + FT_Bytes lookups, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt FeatureCount; + + + OTV_NAME_ENTER( "FeatureList" ); + + OTV_LIMIT_CHECK( 2 ); + FeatureCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (FeatureCount = %d)\n", FeatureCount )); + + OTV_LIMIT_CHECK( FeatureCount * 2 ); + + valid->lookup_count = otv_LookupList_get_count( lookups ); + + /* FeatureRecord */ + for ( ; FeatureCount > 0; FeatureCount-- ) + { + p += 4; /* skip FeatureTag */ + + /* Feature */ + otv_Feature_validate( table + FT_NEXT_USHORT( p ), valid ); + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** LANGUAGE SYSTEM *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + /* uses valid->extra1 (number of features) */ + + FT_LOCAL_DEF( void ) + otv_LangSys_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt ReqFeatureIndex; + FT_UInt FeatureCount; + + + OTV_NAME_ENTER( "LangSys" ); + + OTV_LIMIT_CHECK( 6 ); + p += 2; /* skip LookupOrder (unused) */ + ReqFeatureIndex = FT_NEXT_USHORT( p ); + FeatureCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (ReqFeatureIndex = %d)\n", ReqFeatureIndex )); + OTV_TRACE(( " (FeatureCount = %d)\n", FeatureCount )); + + if ( ReqFeatureIndex != 0xFFFFU && ReqFeatureIndex >= valid->extra1 ) + FT_INVALID_DATA; + + OTV_LIMIT_CHECK( FeatureCount * 2 ); + + /* FeatureIndex */ + for ( ; FeatureCount > 0; FeatureCount-- ) + if ( FT_NEXT_USHORT( p ) >= valid->extra1 ) + FT_INVALID_DATA; + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** SCRIPTS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL_DEF( void ) + otv_Script_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_UInt DefaultLangSys, LangSysCount; + FT_Bytes p = table; + + + OTV_NAME_ENTER( "Script" ); + + OTV_LIMIT_CHECK( 4 ); + DefaultLangSys = FT_NEXT_USHORT( p ); + LangSysCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (LangSysCount = %d)\n", LangSysCount )); + + if ( DefaultLangSys != 0 ) + otv_LangSys_validate( table + DefaultLangSys, valid ); + + OTV_LIMIT_CHECK( LangSysCount * 6 ); + + /* LangSysRecord */ + for ( ; LangSysCount > 0; LangSysCount-- ) + { + p += 4; /* skip LangSysTag */ + + /* LangSys */ + otv_LangSys_validate( table + FT_NEXT_USHORT( p ), valid ); + } + + OTV_EXIT; + } + + + /* sets valid->extra1 (number of features) */ + + FT_LOCAL_DEF( void ) + otv_ScriptList_validate( FT_Bytes table, + FT_Bytes features, + OTV_Validator valid ) + { + FT_UInt ScriptCount; + FT_Bytes p = table; + + + OTV_NAME_ENTER( "ScriptList" ); + + OTV_LIMIT_CHECK( 2 ); + ScriptCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (ScriptCount = %d)\n", ScriptCount )); + + OTV_LIMIT_CHECK( ScriptCount * 6 ); + + valid->extra1 = otv_Feature_get_count( features ); + + /* ScriptRecord */ + for ( ; ScriptCount > 0; ScriptCount-- ) + { + p += 4; /* skip ScriptTag */ + + otv_Script_validate( table + FT_NEXT_USHORT( p ), valid ); /* Script */ + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** UTILITY FUNCTIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* + u: uint16 + ux: unit16 [x] + + s: struct + sx: struct [x] + sxy: struct [x], using external y count + + x: uint16 x + + C: Coverage + + O: Offset + On: Offset (NULL) + Ox: Offset [x] + Onx: Offset (NULL) [x] + */ + + FT_LOCAL_DEF( void ) + otv_x_Ox( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt Count; + OTV_Validate_Func func; + + + OTV_ENTER; + + OTV_LIMIT_CHECK( 2 ); + Count = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (Count = %d)\n", Count )); + + OTV_LIMIT_CHECK( Count * 2 ); + + valid->nesting_level++; + func = valid->func[valid->nesting_level]; + + for ( ; Count > 0; Count-- ) + func( table + FT_NEXT_USHORT( p ), valid ); + + valid->nesting_level--; + + OTV_EXIT; + } + + + FT_LOCAL_DEF( void ) + otv_u_C_x_Ox( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt Count, Coverage; + OTV_Validate_Func func; + + + OTV_ENTER; + + p += 2; /* skip Format */ + + OTV_LIMIT_CHECK( 4 ); + Coverage = FT_NEXT_USHORT( p ); + Count = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (Count = %d)\n", Count )); + + otv_Coverage_validate( table + Coverage, valid ); + + OTV_LIMIT_CHECK( Count * 2 ); + + valid->nesting_level++; + func = valid->func[valid->nesting_level]; + + for ( ; Count > 0; Count-- ) + func( table + FT_NEXT_USHORT( p ), valid ); + + valid->nesting_level--; + + OTV_EXIT; + } + + + /* uses valid->extra1 (if > 0: array value limit) */ + + FT_LOCAL_DEF( void ) + otv_x_ux( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt Count; + + + OTV_ENTER; + + OTV_LIMIT_CHECK( 2 ); + Count = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (Count = %d)\n", Count )); + + OTV_LIMIT_CHECK( Count * 2 ); + + if ( valid->extra1 ) + { + for ( ; Count > 0; Count-- ) + if ( FT_NEXT_USHORT( p ) >= valid->extra1 ) + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /* `ux' in the function's name is not really correct since only x-1 */ + /* elements are tested */ + + /* uses valid->extra1 (array value limit) */ + + FT_LOCAL_DEF( void ) + otv_x_y_ux_sy( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt Count1, Count2; + + + OTV_ENTER; + + OTV_LIMIT_CHECK( 4 ); + Count1 = FT_NEXT_USHORT( p ); + Count2 = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (Count1 = %d)\n", Count1 )); + OTV_TRACE(( " (Count2 = %d)\n", Count2 )); + + if ( Count1 == 0 ) + FT_INVALID_DATA; + + OTV_LIMIT_CHECK( ( Count1 - 1 ) * 2 + Count2 * 4 ); + + for ( ; Count2 > 0; Count2-- ) + { + if ( FT_NEXT_USHORT( p ) >= Count1 ) + FT_INVALID_DATA; + + if ( FT_NEXT_USHORT( p ) >= valid->extra1 ) + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /* `uy' in the function's name is not really correct since only y-1 */ + /* elements are tested */ + + /* uses valid->extra1 (array value limit) */ + + FT_LOCAL_DEF( void ) + otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt BacktrackCount, InputCount, LookaheadCount; + FT_UInt Count; + + + OTV_ENTER; + + OTV_LIMIT_CHECK( 2 ); + BacktrackCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (BacktrackCount = %d)\n", BacktrackCount )); + + OTV_LIMIT_CHECK( BacktrackCount * 2 + 2 ); + p += BacktrackCount * 2; + + InputCount = FT_NEXT_USHORT( p ); + if ( InputCount == 0 ) + FT_INVALID_DATA; + + OTV_TRACE(( " (InputCount = %d)\n", InputCount )); + + OTV_LIMIT_CHECK( InputCount * 2 ); + p += ( InputCount - 1 ) * 2; + + LookaheadCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (LookaheadCount = %d)\n", LookaheadCount )); + + OTV_LIMIT_CHECK( LookaheadCount * 2 + 2 ); + p += LookaheadCount * 2; + + Count = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (Count = %d)\n", Count )); + + OTV_LIMIT_CHECK( Count * 4 ); + + for ( ; Count > 0; Count-- ) + { + if ( FT_NEXT_USHORT( p ) >= InputCount ) + FT_INVALID_DATA; + + if ( FT_NEXT_USHORT( p ) >= valid->extra1 ) + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /* sets valid->extra1 (valid->lookup_count) */ + + FT_LOCAL_DEF( void ) + otv_u_O_O_x_Onx( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt Coverage, ClassDef, ClassSetCount; + OTV_Validate_Func func; + + + OTV_ENTER; + + p += 2; /* skip Format */ + + OTV_LIMIT_CHECK( 6 ); + Coverage = FT_NEXT_USHORT( p ); + ClassDef = FT_NEXT_USHORT( p ); + ClassSetCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (ClassSetCount = %d)\n", ClassSetCount )); + + otv_Coverage_validate( table + Coverage, valid ); + otv_ClassDef_validate( table + ClassDef, valid ); + + OTV_LIMIT_CHECK( ClassSetCount * 2 ); + + valid->nesting_level++; + func = valid->func[valid->nesting_level]; + valid->extra1 = valid->lookup_count; + + for ( ; ClassSetCount > 0; ClassSetCount-- ) + { + FT_UInt offset = FT_NEXT_USHORT( p ); + + + if ( offset ) + func( table + offset, valid ); + } + + valid->nesting_level--; + + OTV_EXIT; + } + + + /* uses valid->lookup_count */ + + FT_LOCAL_DEF( void ) + otv_u_x_y_Ox_sy( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt GlyphCount, Count, count1; + + + OTV_ENTER; + + p += 2; /* skip Format */ + + OTV_LIMIT_CHECK( 4 ); + GlyphCount = FT_NEXT_USHORT( p ); + Count = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + OTV_TRACE(( " (Count = %d)\n", Count )); + + OTV_LIMIT_CHECK( GlyphCount * 2 + Count * 4 ); + + for ( count1 = GlyphCount; count1 > 0; count1-- ) + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid ); + + for ( ; Count > 0; Count-- ) + { + if ( FT_NEXT_USHORT( p ) >= GlyphCount ) + FT_INVALID_DATA; + + if ( FT_NEXT_USHORT( p ) >= valid->lookup_count ) + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /* sets valid->extra1 (valid->lookup_count) */ + + FT_LOCAL_DEF( void ) + otv_u_O_O_O_O_x_Onx( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt Coverage; + FT_UInt BacktrackClassDef, InputClassDef, LookaheadClassDef; + FT_UInt ChainClassSetCount; + OTV_Validate_Func func; + + + OTV_ENTER; + + p += 2; /* skip Format */ + + OTV_LIMIT_CHECK( 10 ); + Coverage = FT_NEXT_USHORT( p ); + BacktrackClassDef = FT_NEXT_USHORT( p ); + InputClassDef = FT_NEXT_USHORT( p ); + LookaheadClassDef = FT_NEXT_USHORT( p ); + ChainClassSetCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (ChainClassSetCount = %d)\n", ChainClassSetCount )); + + otv_Coverage_validate( table + Coverage, valid ); + + otv_ClassDef_validate( table + BacktrackClassDef, valid ); + otv_ClassDef_validate( table + InputClassDef, valid ); + otv_ClassDef_validate( table + LookaheadClassDef, valid ); + + OTV_LIMIT_CHECK( ChainClassSetCount * 2 ); + + valid->nesting_level++; + func = valid->func[valid->nesting_level]; + valid->extra1 = valid->lookup_count; + + for ( ; ChainClassSetCount > 0; ChainClassSetCount-- ) + { + FT_UInt offset = FT_NEXT_USHORT( p ); + + + if ( offset ) + func( table + offset, valid ); + } + + valid->nesting_level--; + + OTV_EXIT; + } + + + /* uses valid->lookup_count */ + + FT_LOCAL_DEF( void ) + otv_u_x_Ox_y_Oy_z_Oz_p_sp( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt BacktrackGlyphCount, InputGlyphCount, LookaheadGlyphCount; + FT_UInt count1, count2; + + + OTV_ENTER; + + p += 2; /* skip Format */ + + OTV_LIMIT_CHECK( 2 ); + BacktrackGlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (BacktrackGlyphCount = %d)\n", BacktrackGlyphCount )); + + OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 ); + + for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- ) + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid ); + + InputGlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (InputGlyphCount = %d)\n", InputGlyphCount )); + + OTV_LIMIT_CHECK( InputGlyphCount * 2 + 2 ); + + for ( count1 = InputGlyphCount; count1 > 0; count1-- ) + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid ); + + LookaheadGlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (LookaheadGlyphCount = %d)\n", LookaheadGlyphCount )); + + OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 ); + + for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- ) + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid ); + + count2 = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (Count = %d)\n", count2 )); + + OTV_LIMIT_CHECK( count2 * 4 ); + + for ( ; count2 > 0; count2-- ) + { + if ( FT_NEXT_USHORT( p ) >= InputGlyphCount ) + FT_INVALID_DATA; + + if ( FT_NEXT_USHORT( p ) >= valid->lookup_count ) + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + FT_LOCAL_DEF( FT_UInt ) + otv_GSUBGPOS_get_Lookup_count( FT_Bytes table ) + { + FT_Bytes p = table + 8; + + + return otv_LookupList_get_count( table + FT_NEXT_USHORT( p ) ); + } + + + FT_LOCAL_DEF( FT_UInt ) + otv_GSUBGPOS_have_MarkAttachmentType_flag( FT_Bytes table ) + { + FT_Bytes p, lookup; + FT_UInt count; + + + if ( !table ) + return 0; + + /* LookupList */ + p = table + 8; + table += FT_NEXT_USHORT( p ); + + /* LookupCount */ + p = table; + count = FT_NEXT_USHORT( p ); + + for ( ; count > 0; count-- ) + { + FT_Bytes oldp; + + + /* Lookup */ + lookup = table + FT_NEXT_USHORT( p ); + + oldp = p; + + /* LookupFlag */ + p = lookup + 2; + if ( FT_NEXT_USHORT( p ) & 0xFF00U ) + return 1; + + p = oldp; + } + + return 0; + } + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvcommn.h b/src/libs/freetype2/otvalid/otvcommn.h new file mode 100644 index 0000000000..9f84910d51 --- /dev/null +++ b/src/libs/freetype2/otvalid/otvcommn.h @@ -0,0 +1,442 @@ +/***************************************************************************/ +/* */ +/* otvcommn.h */ +/* */ +/* OpenType common tables validation (specification). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __OTVCOMMN_H__ +#define __OTVCOMMN_H__ + + +#include <ft2build.h> +#include "otvalid.h" +#include FT_INTERNAL_DEBUG_H + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** VALIDATION *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + typedef struct OTV_ValidatorRec_* OTV_Validator; + + typedef void (*OTV_Validate_Func)( FT_Bytes table, + OTV_Validator valid ); + + typedef struct OTV_ValidatorRec_ + { + FT_Validator root; + FT_UInt type_count; + OTV_Validate_Func* type_funcs; + + FT_UInt lookup_count; + FT_UInt glyph_count; + + FT_UInt nesting_level; + + OTV_Validate_Func func[3]; + + FT_UInt extra1; /* for passing parameters */ + FT_UInt extra2; + FT_Bytes extra3; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_UInt debug_indent; + const FT_String* debug_function_name[3]; +#endif + + } OTV_ValidatorRec; + + +#undef FT_INVALID_ +#define FT_INVALID_( _prefix, _error ) \ + ft_validator_error( valid->root, _prefix ## _error ) + +#define OTV_OPTIONAL_TABLE( _table ) FT_UInt _table; \ + FT_Bytes _table ## _p + +#define OTV_OPTIONAL_OFFSET( _offset ) \ + FT_BEGIN_STMNT \ + _offset ## _p = p; \ + _offset = FT_NEXT_USHORT( p ); \ + FT_END_STMNT + +#define OTV_LIMIT_CHECK( _count ) \ + FT_BEGIN_STMNT \ + if ( p + (_count) > valid->root->limit ) \ + FT_INVALID_TOO_SHORT; \ + FT_END_STMNT + +#define OTV_SIZE_CHECK( _size ) \ + FT_BEGIN_STMNT \ + if ( _size > 0 && _size < table_size ) \ + { \ + if ( valid->root->level == FT_VALIDATE_PARANOID ) \ + FT_INVALID_OFFSET; \ + else \ + { \ + /* strip off `const' */ \ + FT_Byte* pp = (FT_Byte*)_size ## _p; \ + \ + \ + FT_TRACE3(( "\n" \ + "Invalid offset to optional table `%s'!\n" \ + "Set to zero.\n" \ + "\n", #_size )); \ + \ + /* always assume 16bit entities */ \ + _size = pp[0] = pp[1] = 0; \ + } \ + } \ + FT_END_STMNT + + +#ifdef FT_DEBUG_LEVEL_TRACE + + /* use preprocessor's argument prescan to expand one argument into two */ +#define OTV_NEST1( x ) OTV_NEST1_( x ) +#define OTV_NEST1_( func0, name0 ) \ + FT_BEGIN_STMNT \ + valid->nesting_level = 0; \ + valid->func[0] = func0; \ + valid->debug_function_name[0] = name0; \ + FT_END_STMNT + + /* use preprocessor's argument prescan to expand two arguments into four */ +#define OTV_NEST2( x, y ) OTV_NEST2_( x, y ) +#define OTV_NEST2_( func0, name0, func1, name1 ) \ + FT_BEGIN_STMNT \ + valid->nesting_level = 0; \ + valid->func[0] = func0; \ + valid->func[1] = func1; \ + valid->debug_function_name[0] = name0; \ + valid->debug_function_name[1] = name1; \ + FT_END_STMNT + + /* use preprocessor's argument prescan to expand three arguments into six */ +#define OTV_NEST3( x, y, z ) OTV_NEST3_( x, y, z ) +#define OTV_NEST3_( func0, name0, func1, name1, func2, name2 ) \ + FT_BEGIN_STMNT \ + valid->nesting_level = 0; \ + valid->func[0] = func0; \ + valid->func[1] = func1; \ + valid->func[2] = func2; \ + valid->debug_function_name[0] = name0; \ + valid->debug_function_name[1] = name1; \ + valid->debug_function_name[2] = name2; \ + FT_END_STMNT + +#define OTV_INIT valid->debug_indent = 0 + +#define OTV_ENTER \ + FT_BEGIN_STMNT \ + valid->debug_indent += 2; \ + FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \ + FT_TRACE4(( "%s table\n", \ + valid->debug_function_name[valid->nesting_level] )); \ + FT_END_STMNT + +#define OTV_NAME_ENTER( name ) \ + FT_BEGIN_STMNT \ + valid->debug_indent += 2; \ + FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \ + FT_TRACE4(( "%s table\n", name )); \ + FT_END_STMNT + +#define OTV_EXIT valid->debug_indent -= 2 + +#define OTV_TRACE( s ) \ + FT_BEGIN_STMNT \ + FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \ + FT_TRACE4( s ); \ + FT_END_STMNT + +#else /* !FT_DEBUG_LEVEL_TRACE */ + + /* use preprocessor's argument prescan to expand one argument into two */ +#define OTV_NEST1( x ) OTV_NEST1_( x ) +#define OTV_NEST1_( func0, name0 ) \ + FT_BEGIN_STMNT \ + valid->nesting_level = 0; \ + valid->func[0] = func0; \ + FT_END_STMNT + + /* use preprocessor's argument prescan to expand two arguments into four */ +#define OTV_NEST2( x, y ) OTV_NEST2_( x, y ) +#define OTV_NEST2_( func0, name0, func1, name1 ) \ + FT_BEGIN_STMNT \ + valid->nesting_level = 0; \ + valid->func[0] = func0; \ + valid->func[1] = func1; \ + FT_END_STMNT + + /* use preprocessor's argument prescan to expand three arguments into six */ +#define OTV_NEST3( x, y, z ) OTV_NEST3_( x, y, z ) +#define OTV_NEST3_( func0, name0, func1, name1, func2, name2 ) \ + FT_BEGIN_STMNT \ + valid->nesting_level = 0; \ + valid->func[0] = func0; \ + valid->func[1] = func1; \ + valid->func[2] = func2; \ + FT_END_STMNT + +#define OTV_INIT do ; while ( 0 ) +#define OTV_ENTER do ; while ( 0 ) +#define OTV_NAME_ENTER( name ) do ; while ( 0 ) +#define OTV_EXIT do ; while ( 0 ) + +#define OTV_TRACE( s ) do ; while ( 0 ) + +#endif /* !FT_DEBUG_LEVEL_TRACE */ + + +#define OTV_RUN valid->func[0] + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** COVERAGE TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + otv_Coverage_validate( FT_Bytes table, + OTV_Validator valid ); + + /* return first covered glyph */ + FT_LOCAL( FT_UInt ) + otv_Coverage_get_first( FT_Bytes table ); + + /* return last covered glyph */ + FT_LOCAL( FT_UInt ) + otv_Coverage_get_last( FT_Bytes table ); + + /* return number of covered glyphs */ + FT_LOCAL( FT_UInt ) + otv_Coverage_get_count( FT_Bytes table ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** CLASS DEFINITION TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + otv_ClassDef_validate( FT_Bytes table, + OTV_Validator valid ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** DEVICE TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + otv_Device_validate( FT_Bytes table, + OTV_Validator valid ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** LOOKUPS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + otv_Lookup_validate( FT_Bytes table, + OTV_Validator valid ); + + FT_LOCAL( void ) + otv_LookupList_validate( FT_Bytes table, + OTV_Validator valid ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FEATURES *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + otv_Feature_validate( FT_Bytes table, + OTV_Validator valid ); + + /* lookups must already be validated */ + FT_LOCAL( void ) + otv_FeatureList_validate( FT_Bytes table, + FT_Bytes lookups, + OTV_Validator valid ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** LANGUAGE SYSTEM *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + otv_LangSys_validate( FT_Bytes table, + OTV_Validator valid ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** SCRIPTS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL( void ) + otv_Script_validate( FT_Bytes table, + OTV_Validator valid ); + + /* features must already be validated */ + FT_LOCAL( void ) + otv_ScriptList_validate( FT_Bytes table, + FT_Bytes features, + OTV_Validator valid ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** UTILITY FUNCTIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define ChainPosClassSet otv_x_Ox, "ChainPosClassSet" +#define ChainPosRuleSet otv_x_Ox, "ChainPosRuleSet" +#define ChainSubClassSet otv_x_Ox, "ChainSubClassSet" +#define ChainSubRuleSet otv_x_Ox, "ChainSubRuleSet" +#define JstfLangSys otv_x_Ox, "JstfLangSys" +#define JstfMax otv_x_Ox, "JstfMax" +#define LigGlyph otv_x_Ox, "LigGlyph" +#define LigatureArray otv_x_Ox, "LigatureArray" +#define LigatureSet otv_x_Ox, "LigatureSet" +#define PosClassSet otv_x_Ox, "PosClassSet" +#define PosRuleSet otv_x_Ox, "PosRuleSet" +#define SubClassSet otv_x_Ox, "SubClassSet" +#define SubRuleSet otv_x_Ox, "SubRuleSet" + + FT_LOCAL( void ) + otv_x_Ox ( FT_Bytes table, + OTV_Validator valid ); + +#define AlternateSubstFormat1 otv_u_C_x_Ox, "AlternateSubstFormat1" +#define ChainContextPosFormat1 otv_u_C_x_Ox, "ChainContextPosFormat1" +#define ChainContextSubstFormat1 otv_u_C_x_Ox, "ChainContextSubstFormat1" +#define ContextPosFormat1 otv_u_C_x_Ox, "ContextPosFormat1" +#define ContextSubstFormat1 otv_u_C_x_Ox, "ContextSubstFormat1" +#define LigatureSubstFormat1 otv_u_C_x_Ox, "LigatureSubstFormat1" +#define MultipleSubstFormat1 otv_u_C_x_Ox, "MultipleSubstFormat1" + + FT_LOCAL( void ) + otv_u_C_x_Ox( FT_Bytes table, + OTV_Validator valid ); + +#define AlternateSet otv_x_ux, "AlternateSet" +#define AttachPoint otv_x_ux, "AttachPoint" +#define ExtenderGlyph otv_x_ux, "ExtenderGlyph" +#define JstfGPOSModList otv_x_ux, "JstfGPOSModList" +#define JstfGSUBModList otv_x_ux, "JstfGSUBModList" +#define Sequence otv_x_ux, "Sequence" + + FT_LOCAL( void ) + otv_x_ux( FT_Bytes table, + OTV_Validator valid ); + +#define PosClassRule otv_x_y_ux_sy, "PosClassRule" +#define PosRule otv_x_y_ux_sy, "PosRule" +#define SubClassRule otv_x_y_ux_sy, "SubClassRule" +#define SubRule otv_x_y_ux_sy, "SubRule" + + FT_LOCAL( void ) + otv_x_y_ux_sy( FT_Bytes table, + OTV_Validator valid ); + +#define ChainPosClassRule otv_x_ux_y_uy_z_uz_p_sp, "ChainPosClassRule" +#define ChainPosRule otv_x_ux_y_uy_z_uz_p_sp, "ChainPosRule" +#define ChainSubClassRule otv_x_ux_y_uy_z_uz_p_sp, "ChainSubClassRule" +#define ChainSubRule otv_x_ux_y_uy_z_uz_p_sp, "ChainSubRule" + + FT_LOCAL( void ) + otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes table, + OTV_Validator valid ); + +#define ContextPosFormat2 otv_u_O_O_x_Onx, "ContextPosFormat2" +#define ContextSubstFormat2 otv_u_O_O_x_Onx, "ContextSubstFormat2" + + FT_LOCAL( void ) + otv_u_O_O_x_Onx( FT_Bytes table, + OTV_Validator valid ); + +#define ContextPosFormat3 otv_u_x_y_Ox_sy, "ContextPosFormat3" +#define ContextSubstFormat3 otv_u_x_y_Ox_sy, "ContextSubstFormat3" + + FT_LOCAL( void ) + otv_u_x_y_Ox_sy( FT_Bytes table, + OTV_Validator valid ); + +#define ChainContextPosFormat2 otv_u_O_O_O_O_x_Onx, "ChainContextPosFormat2" +#define ChainContextSubstFormat2 otv_u_O_O_O_O_x_Onx, "ChainContextSubstFormat2" + + FT_LOCAL( void ) + otv_u_O_O_O_O_x_Onx( FT_Bytes table, + OTV_Validator valid ); + +#define ChainContextPosFormat3 otv_u_x_Ox_y_Oy_z_Oz_p_sp, "ChainContextPosFormat3" +#define ChainContextSubstFormat3 otv_u_x_Ox_y_Oy_z_Oz_p_sp, "ChainContextSubstFormat3" + + FT_LOCAL( void ) + otv_u_x_Ox_y_Oy_z_Oz_p_sp( FT_Bytes table, + OTV_Validator valid ); + + + FT_LOCAL( FT_UInt ) + otv_GSUBGPOS_get_Lookup_count( FT_Bytes table ); + + FT_LOCAL( FT_UInt ) + otv_GSUBGPOS_have_MarkAttachmentType_flag( FT_Bytes table ); + + /* */ + +FT_END_HEADER + +#endif /* __OTVCOMMN_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otverror.h b/src/libs/freetype2/otvalid/otverror.h new file mode 100644 index 0000000000..041b538368 --- /dev/null +++ b/src/libs/freetype2/otvalid/otverror.h @@ -0,0 +1,43 @@ +/***************************************************************************/ +/* */ +/* otverror.h */ +/* */ +/* OpenType validation module error codes (specification only). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /*************************************************************************/ + /* */ + /* This file is used to define the OpenType validation module error */ + /* enumeration constants. */ + /* */ + /*************************************************************************/ + +#ifndef __OTVERROR_H__ +#define __OTVERROR_H__ + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#define FT_ERR_PREFIX OTV_Err_ +#define FT_ERR_BASE FT_Mod_Err_OTvalid + +#define FT_KEEP_ERR_PREFIX + +#include FT_ERRORS_H + +#endif /* __OTVERROR_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvgdef.c b/src/libs/freetype2/otvalid/otvgdef.c new file mode 100644 index 0000000000..e408c709ad --- /dev/null +++ b/src/libs/freetype2/otvalid/otvgdef.c @@ -0,0 +1,219 @@ +/***************************************************************************/ +/* */ +/* otvgdef.c */ +/* */ +/* OpenType GDEF table validation (body). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include "otvalid.h" +#include "otvcommn.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_otvgdef + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** UTILITY FUNCTIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define AttachList otv_O_x_Ox, "AttachList" +#define LigCaretList otv_O_x_Ox, "LigCaretList" + + /* sets valid->extra1 (0) */ + + static void + otv_O_x_Ox( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_Bytes Coverage; + FT_UInt GlyphCount; + OTV_Validate_Func func; + + + OTV_ENTER; + + OTV_LIMIT_CHECK( 4 ); + Coverage = table + FT_NEXT_USHORT( p ); + GlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + + otv_Coverage_validate( Coverage, valid ); + if ( GlyphCount != otv_Coverage_get_count( Coverage ) ) + FT_INVALID_DATA; + + OTV_LIMIT_CHECK( GlyphCount * 2 ); + + valid->nesting_level++; + func = valid->func[valid->nesting_level]; + valid->extra1 = 0; + + for ( ; GlyphCount > 0; GlyphCount-- ) + func( table + FT_NEXT_USHORT( p ), valid ); + + valid->nesting_level--; + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** LIGATURE CARETS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define CaretValue otv_CaretValue_validate, "CaretValue" + + static void + otv_CaretValue_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt CaretValueFormat; + + + OTV_ENTER; + + OTV_LIMIT_CHECK( 4 ); + + CaretValueFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format = %d)\n", CaretValueFormat )); + + switch ( CaretValueFormat ) + { + case 1: /* CaretValueFormat1 */ + /* skip Coordinate, no test */ + break; + + case 2: /* CaretValueFormat2 */ + /* skip CaretValuePoint, no test */ + break; + + case 3: /* CaretValueFormat3 */ + p += 2; /* skip Coordinate */ + + OTV_LIMIT_CHECK( 2 ); + + /* DeviceTable */ + otv_Device_validate( table + FT_NEXT_USHORT( p ), valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GDEF TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + FT_LOCAL_DEF( void ) + otv_GDEF_validate( FT_Bytes table, + FT_Bytes gsub, + FT_Bytes gpos, + FT_Validator ftvalid ) + { + OTV_ValidatorRec validrec; + OTV_Validator valid = &validrec; + FT_Bytes p = table; + FT_UInt table_size; + FT_Bool need_MarkAttachClassDef; + + OTV_OPTIONAL_TABLE( GlyphClassDef ); + OTV_OPTIONAL_TABLE( AttachListOffset ); + OTV_OPTIONAL_TABLE( LigCaretListOffset ); + OTV_OPTIONAL_TABLE( MarkAttachClassDef ); + + + valid->root = ftvalid; + + FT_TRACE3(( "validating GDEF table\n" )); + OTV_INIT; + + OTV_LIMIT_CHECK( 12 ); + + if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + FT_INVALID_FORMAT; + + /* MarkAttachClassDef has been added to the OpenType */ + /* specification without increasing GDEF's version, */ + /* so we use this ugly hack to find out whether the */ + /* table is needed actually. */ + + need_MarkAttachClassDef = FT_BOOL( + otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || + otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); + + if ( need_MarkAttachClassDef ) + table_size = 12; /* OpenType >= 1.2 */ + else + table_size = 10; /* OpenType < 1.2 */ + + OTV_OPTIONAL_OFFSET( GlyphClassDef ); + OTV_SIZE_CHECK( GlyphClassDef ); + if ( GlyphClassDef ) + otv_ClassDef_validate( table + GlyphClassDef, valid ); + + OTV_OPTIONAL_OFFSET( AttachListOffset ); + OTV_SIZE_CHECK( AttachListOffset ); + if ( AttachListOffset ) + { + OTV_NEST2( AttachList, AttachPoint ); + OTV_RUN( table + AttachListOffset, valid ); + } + + OTV_OPTIONAL_OFFSET( LigCaretListOffset ); + OTV_SIZE_CHECK( LigCaretListOffset ); + if ( LigCaretListOffset ) + { + OTV_NEST3( LigCaretList, LigGlyph, CaretValue ); + OTV_RUN( table + LigCaretListOffset, valid ); + } + + if ( need_MarkAttachClassDef ) + { + OTV_OPTIONAL_OFFSET( MarkAttachClassDef ); + OTV_SIZE_CHECK( MarkAttachClassDef ); + if ( MarkAttachClassDef ) + otv_ClassDef_validate( table + MarkAttachClassDef, valid ); + } + + FT_TRACE4(( "\n" )); + } + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvgpos.c b/src/libs/freetype2/otvalid/otvgpos.c new file mode 100644 index 0000000000..ceffd2f8ef --- /dev/null +++ b/src/libs/freetype2/otvalid/otvgpos.c @@ -0,0 +1,1013 @@ +/***************************************************************************/ +/* */ +/* otvgpos.c */ +/* */ +/* OpenType GPOS table validation (body). */ +/* */ +/* Copyright 2002, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include "otvalid.h" +#include "otvcommn.h" +#include "otvgpos.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_otvgpos + + + static void + otv_Anchor_validate( FT_Bytes table, + OTV_Validator valid ); + + static void + otv_MarkArray_validate( FT_Bytes table, + OTV_Validator valid ); + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** UTILITY FUNCTIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define BaseArray otv_x_sxy, "BaseArray" +#define LigatureAttach otv_x_sxy, "LigatureAttach" +#define Mark2Array otv_x_sxy, "Mark2Array" + + /* uses valid->extra1 (counter) */ + /* uses valid->extra2 (boolean to handle NULL anchor field) */ + + static void + otv_x_sxy( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt Count, count1, table_size; + + + OTV_ENTER; + + OTV_LIMIT_CHECK( 2 ); + + OTV_TRACE(( " (Count = %d)\n", Count )); + + Count = FT_NEXT_USHORT( p ); + + OTV_LIMIT_CHECK( Count * valid->extra1 * 2 ); + + table_size = Count * valid->extra1 * 2 + 2; + + for ( ; Count > 0; Count-- ) + for ( count1 = valid->extra1; count1 > 0; count1-- ) + { + OTV_OPTIONAL_TABLE( anchor_offset ); + + + OTV_OPTIONAL_OFFSET( anchor_offset ); + + if ( valid->extra2 ) + { + OTV_SIZE_CHECK( anchor_offset ); + if ( anchor_offset ) + otv_Anchor_validate( table + anchor_offset, valid ); + } + else + otv_Anchor_validate( table + anchor_offset, valid ); + } + + OTV_EXIT; + } + + +#define MarkBasePosFormat1 otv_u_O_O_u_O_O, "MarkBasePosFormat1" +#define MarkLigPosFormat1 otv_u_O_O_u_O_O, "MarkLigPosFormat1" +#define MarkMarkPosFormat1 otv_u_O_O_u_O_O, "MarkMarkPosFormat1" + + /* sets valid->extra1 (class count) */ + + static void + otv_u_O_O_u_O_O( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt Coverage1, Coverage2, ClassCount; + FT_UInt Array1, Array2; + OTV_Validate_Func func; + + + OTV_ENTER; + + p += 2; /* skip PosFormat */ + + OTV_LIMIT_CHECK( 10 ); + Coverage1 = FT_NEXT_USHORT( p ); + Coverage2 = FT_NEXT_USHORT( p ); + ClassCount = FT_NEXT_USHORT( p ); + Array1 = FT_NEXT_USHORT( p ); + Array2 = FT_NEXT_USHORT( p ); + + otv_Coverage_validate( table + Coverage1, valid ); + otv_Coverage_validate( table + Coverage2, valid ); + + otv_MarkArray_validate( table + Array1, valid ); + + valid->nesting_level++; + func = valid->func[valid->nesting_level]; + valid->extra1 = ClassCount; + + func( table + Array2, valid ); + + valid->nesting_level--; + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** VALUE RECORDS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static FT_UInt + otv_value_length( FT_UInt format ) + { + FT_UInt count; + + + count = ( ( format & 0xAA ) >> 1 ) + ( format & 0x55 ); + count = ( ( count & 0xCC ) >> 2 ) + ( count & 0x33 ); + count = ( ( count & 0xF0 ) >> 4 ) + ( count & 0x0F ); + + return count * 2; + } + + + /* uses valid->extra3 (pointer to base table) */ + + static void + otv_ValueRecord_validate( FT_Bytes table, + FT_UInt format, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt count; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_Int loop; + FT_ULong res = 0; + + + OTV_NAME_ENTER( "ValueRecord" ); + + /* display `format' in dual representation */ + for ( loop = 7; loop >= 0; loop-- ) + { + res <<= 4; + res += ( format >> loop ) & 1; + } + + OTV_TRACE(( " (format 0b%08lx)\n", res )); +#endif + + if ( format >= 0x100 ) + FT_INVALID_DATA; + + for ( count = 4; count > 0; count-- ) + { + if ( format & 1 ) + { + /* XPlacement, YPlacement, XAdvance, YAdvance */ + OTV_LIMIT_CHECK( 2 ); + p += 2; + } + + format >>= 1; + } + + for ( count = 4; count > 0; count-- ) + { + if ( format & 1 ) + { + FT_UInt table_size; + + OTV_OPTIONAL_TABLE( device ); + + + /* XPlaDevice, YPlaDevice, XAdvDevice, YAdvDevice */ + OTV_LIMIT_CHECK( 2 ); + OTV_OPTIONAL_OFFSET( device ); + + /* XXX: this value is usually too small, especially if the current */ + /* ValueRecord is part of an array -- getting the correct table */ + /* size is probably not worth the trouble */ + + table_size = p - valid->extra3; + + OTV_SIZE_CHECK( device ); + if ( device ) + otv_Device_validate( valid->extra3 + device, valid ); + } + format >>= 1; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** ANCHORS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + otv_Anchor_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt AnchorFormat; + + + OTV_NAME_ENTER( "Anchor"); + + OTV_LIMIT_CHECK( 6 ); + AnchorFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", AnchorFormat )); + + p += 4; /* skip XCoordinate and YCoordinate */ + + switch ( AnchorFormat ) + { + case 1: + break; + + case 2: + OTV_LIMIT_CHECK( 2 ); /* AnchorPoint */ + break; + + case 3: + { + FT_UInt table_size; + + OTV_OPTIONAL_TABLE( XDeviceTable ); + OTV_OPTIONAL_TABLE( YDeviceTable ); + + + OTV_LIMIT_CHECK( 4 ); + OTV_OPTIONAL_OFFSET( XDeviceTable ); + OTV_OPTIONAL_OFFSET( YDeviceTable ); + + table_size = 6 + 4; + + OTV_SIZE_CHECK( XDeviceTable ); + if ( XDeviceTable ) + otv_Device_validate( table + XDeviceTable, valid ); + + OTV_SIZE_CHECK( YDeviceTable ); + if ( YDeviceTable ) + otv_Device_validate( table + YDeviceTable, valid ); + } + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** MARK ARRAYS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + otv_MarkArray_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt MarkCount; + + + OTV_NAME_ENTER( "MarkArray" ); + + OTV_LIMIT_CHECK( 2 ); + MarkCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (MarkCount = %d)\n", MarkCount )); + + OTV_LIMIT_CHECK( MarkCount * 4 ); + + /* MarkRecord */ + for ( ; MarkCount > 0; MarkCount-- ) + { + p += 2; /* skip Class */ + /* MarkAnchor */ + otv_Anchor_validate( table + FT_NEXT_USHORT( p ), valid ); + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 1 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra3 (pointer to base table) */ + + static void + otv_SinglePos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "SinglePos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + valid->extra3 = table; + + switch ( PosFormat ) + { + case 1: /* SinglePosFormat1 */ + { + FT_UInt Coverage, ValueFormat; + + + OTV_LIMIT_CHECK( 4 ); + Coverage = FT_NEXT_USHORT( p ); + ValueFormat = FT_NEXT_USHORT( p ); + + otv_Coverage_validate( table + Coverage, valid ); + otv_ValueRecord_validate( p, ValueFormat, valid ); /* Value */ + } + break; + + case 2: /* SinglePosFormat2 */ + { + FT_UInt Coverage, ValueFormat, ValueCount, len_value; + + + OTV_LIMIT_CHECK( 6 ); + Coverage = FT_NEXT_USHORT( p ); + ValueFormat = FT_NEXT_USHORT( p ); + ValueCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (ValueCount = %d)\n", ValueCount )); + + len_value = otv_value_length( ValueFormat ); + + otv_Coverage_validate( table + Coverage, valid ); + + OTV_LIMIT_CHECK( ValueCount * len_value ); + + /* Value */ + for ( ; ValueCount > 0; ValueCount-- ) + { + otv_ValueRecord_validate( p, ValueFormat, valid ); + p += len_value; + } + } + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 2 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + otv_PairSet_validate( FT_Bytes table, + FT_UInt format1, + FT_UInt format2, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt value_len1, value_len2, PairValueCount; + + + OTV_NAME_ENTER( "PairSet" ); + + OTV_LIMIT_CHECK( 2 ); + PairValueCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (PairValueCount = %d)\n", PairValueCount )); + + value_len1 = otv_value_length( format1 ); + value_len2 = otv_value_length( format2 ); + + OTV_LIMIT_CHECK( PairValueCount * ( value_len1 + value_len2 + 2 ) ); + + /* PairValueRecord */ + for ( ; PairValueCount > 0; PairValueCount-- ) + { + p += 2; /* skip SecondGlyph */ + + if ( format1 ) + otv_ValueRecord_validate( p, format1, valid ); /* Value1 */ + p += value_len1; + + if ( format2 ) + otv_ValueRecord_validate( p, format2, valid ); /* Value2 */ + p += value_len2; + } + + OTV_EXIT; + } + + + /* sets valid->extra3 (pointer to base table) */ + + static void + otv_PairPos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "PairPos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + valid->extra3 = table; + + switch ( PosFormat ) + { + case 1: /* PairPosFormat1 */ + { + FT_UInt Coverage, ValueFormat1, ValueFormat2, PairSetCount; + + + OTV_LIMIT_CHECK( 8 ); + Coverage = FT_NEXT_USHORT( p ); + ValueFormat1 = FT_NEXT_USHORT( p ); + ValueFormat2 = FT_NEXT_USHORT( p ); + PairSetCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (PairSetCount = %d)\n", PairSetCount )); + + otv_Coverage_validate( table + Coverage, valid ); + + OTV_LIMIT_CHECK( PairSetCount * 2 ); + + /* PairSetOffset */ + for ( ; PairSetCount > 0; PairSetCount-- ) + otv_PairSet_validate( table + FT_NEXT_USHORT( p ), + ValueFormat1, ValueFormat2, valid ); + } + break; + + case 2: /* PairPosFormat2 */ + { + FT_UInt Coverage, ValueFormat1, ValueFormat2, ClassDef1, ClassDef2; + FT_UInt ClassCount1, ClassCount2, len_value1, len_value2, count; + + + OTV_LIMIT_CHECK( 14 ); + Coverage = FT_NEXT_USHORT( p ); + ValueFormat1 = FT_NEXT_USHORT( p ); + ValueFormat2 = FT_NEXT_USHORT( p ); + ClassDef1 = FT_NEXT_USHORT( p ); + ClassDef2 = FT_NEXT_USHORT( p ); + ClassCount1 = FT_NEXT_USHORT( p ); + ClassCount2 = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (ClassCount1 = %d)\n", ClassCount1 )); + OTV_TRACE(( " (ClassCount2 = %d)\n", ClassCount2 )); + + len_value1 = otv_value_length( ValueFormat1 ); + len_value2 = otv_value_length( ValueFormat2 ); + + otv_Coverage_validate( table + Coverage, valid ); + otv_ClassDef_validate( table + ClassDef1, valid ); + otv_ClassDef_validate( table + ClassDef2, valid ); + + OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 * + ( len_value1 + len_value2 ) ); + + /* Class1Record */ + for ( ; ClassCount1 > 0; ClassCount1-- ) + { + /* Class2Record */ + for ( count = ClassCount2; count > 0; count-- ) + { + if ( ValueFormat1 ) + /* Value1 */ + otv_ValueRecord_validate( p, ValueFormat1, valid ); + p += len_value1; + + if ( ValueFormat2 ) + /* Value2 */ + otv_ValueRecord_validate( p, ValueFormat2, valid ); + p += len_value2; + } + } + } + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 3 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + static void + otv_CursivePos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "CursivePos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + switch ( PosFormat ) + { + case 1: /* CursivePosFormat1 */ + { + FT_UInt table_size; + FT_UInt Coverage, EntryExitCount; + + OTV_OPTIONAL_TABLE( EntryAnchor ); + OTV_OPTIONAL_TABLE( ExitAnchor ); + + + OTV_LIMIT_CHECK( 4 ); + Coverage = FT_NEXT_USHORT( p ); + EntryExitCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (EntryExitCount = %d)\n", EntryExitCount )); + + otv_Coverage_validate( table + Coverage, valid ); + + OTV_LIMIT_CHECK( EntryExitCount * 4 ); + + table_size = EntryExitCount * 4 + 4; + + /* EntryExitRecord */ + for ( ; EntryExitCount > 0; EntryExitCount-- ) + { + OTV_OPTIONAL_OFFSET( EntryAnchor ); + OTV_OPTIONAL_OFFSET( ExitAnchor ); + + OTV_SIZE_CHECK( EntryAnchor ); + if ( EntryAnchor ) + otv_Anchor_validate( table + EntryAnchor, valid ); + + OTV_SIZE_CHECK( ExitAnchor ); + if ( ExitAnchor ) + otv_Anchor_validate( table + ExitAnchor, valid ); + } + } + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 4 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra2 (0) */ + + static void + otv_MarkBasePos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "MarkBasePos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + switch ( PosFormat ) + { + case 1: + valid->extra2 = 0; + OTV_NEST2( MarkBasePosFormat1, BaseArray ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 5 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra2 (1) */ + + static void + otv_MarkLigPos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "MarkLigPos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + switch ( PosFormat ) + { + case 1: + valid->extra2 = 1; + OTV_NEST3( MarkLigPosFormat1, LigatureArray, LigatureAttach ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 6 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra2 (0) */ + + static void + otv_MarkMarkPos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "MarkMarkPos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + switch ( PosFormat ) + { + case 1: + valid->extra2 = 0; + OTV_NEST2( MarkMarkPosFormat1, Mark2Array ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 7 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra1 (lookup count) */ + + static void + otv_ContextPos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "ContextPos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + switch ( PosFormat ) + { + case 1: + /* no need to check glyph indices/classes used as input for these */ + /* context rules since even invalid glyph indices/classes return */ + /* meaningful results */ + + valid->extra1 = valid->lookup_count; + OTV_NEST3( ContextPosFormat1, PosRuleSet, PosRule ); + OTV_RUN( table, valid ); + break; + + case 2: + /* no need to check glyph indices/classes used as input for these */ + /* context rules since even invalid glyph indices/classes return */ + /* meaningful results */ + + OTV_NEST3( ContextPosFormat2, PosClassSet, PosClassRule ); + OTV_RUN( table, valid ); + break; + + case 3: + OTV_NEST1( ContextPosFormat3 ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 8 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra1 (lookup count) */ + + static void + otv_ChainContextPos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "ChainContextPos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + switch ( PosFormat ) + { + case 1: + /* no need to check glyph indices/classes used as input for these */ + /* context rules since even invalid glyph indices/classes return */ + /* meaningful results */ + + valid->extra1 = valid->lookup_count; + OTV_NEST3( ChainContextPosFormat1, + ChainPosRuleSet, ChainPosRule ); + OTV_RUN( table, valid ); + break; + + case 2: + /* no need to check glyph indices/classes used as input for these */ + /* context rules since even invalid glyph indices/classes return */ + /* meaningful results */ + + OTV_NEST3( ChainContextPosFormat2, + ChainPosClassSet, ChainPosClassRule ); + OTV_RUN( table, valid ); + break; + + case 3: + OTV_NEST1( ChainContextPosFormat3 ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS LOOKUP TYPE 9 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* uses valid->type_funcs */ + + static void + otv_ExtensionPos_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt PosFormat; + + + OTV_NAME_ENTER( "ExtensionPos" ); + + OTV_LIMIT_CHECK( 2 ); + PosFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", PosFormat )); + + switch ( PosFormat ) + { + case 1: /* ExtensionPosFormat1 */ + { + FT_UInt ExtensionLookupType, ExtensionOffset; + OTV_Validate_Func validate; + + + OTV_LIMIT_CHECK( 6 ); + ExtensionLookupType = FT_NEXT_USHORT( p ); + ExtensionOffset = FT_NEXT_ULONG( p ); + + if ( ExtensionLookupType == 0 || ExtensionLookupType >= 9 ) + FT_INVALID_DATA; + + validate = valid->type_funcs[ExtensionLookupType - 1]; + validate( table + ExtensionOffset, valid ); + } + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + static const OTV_Validate_Func otv_gpos_validate_funcs[9] = + { + otv_SinglePos_validate, + otv_PairPos_validate, + otv_CursivePos_validate, + otv_MarkBasePos_validate, + otv_MarkLigPos_validate, + otv_MarkMarkPos_validate, + otv_ContextPos_validate, + otv_ChainContextPos_validate, + otv_ExtensionPos_validate + }; + + + /* sets valid->type_count */ + /* sets valid->type_funcs */ + + FT_LOCAL_DEF( void ) + otv_GPOS_subtable_validate( FT_Bytes table, + OTV_Validator valid ) + { + valid->type_count = 9; + valid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs; + + otv_Lookup_validate( table, valid ); + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GPOS TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->glyph_count */ + + FT_LOCAL_DEF( void ) + otv_GPOS_validate( FT_Bytes table, + FT_UInt glyph_count, + FT_Validator ftvalid ) + { + OTV_ValidatorRec validrec; + OTV_Validator valid = &validrec; + FT_Bytes p = table; + FT_UInt ScriptList, FeatureList, LookupList; + + + valid->root = ftvalid; + + FT_TRACE3(( "validating GPOS table\n" )); + OTV_INIT; + + OTV_LIMIT_CHECK( 10 ); + + if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + FT_INVALID_DATA; + + ScriptList = FT_NEXT_USHORT( p ); + FeatureList = FT_NEXT_USHORT( p ); + LookupList = FT_NEXT_USHORT( p ); + + valid->type_count = 9; + valid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs; + valid->glyph_count = glyph_count; + + otv_LookupList_validate( table + LookupList, + valid ); + otv_FeatureList_validate( table + FeatureList, table + LookupList, + valid ); + otv_ScriptList_validate( table + ScriptList, table + FeatureList, + valid ); + + FT_TRACE4(( "\n" )); + } + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvgpos.h b/src/libs/freetype2/otvalid/otvgpos.h new file mode 100644 index 0000000000..14ca408261 --- /dev/null +++ b/src/libs/freetype2/otvalid/otvgpos.h @@ -0,0 +1,36 @@ +/***************************************************************************/ +/* */ +/* otvgpos.h */ +/* */ +/* OpenType GPOS table validator (specification). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __OTVGPOS_H__ +#define __OTVGPOS_H__ + + +FT_BEGIN_HEADER + + + FT_LOCAL( void ) + otv_GPOS_subtable_validate( FT_Bytes table, + OTV_Validator valid ); + + +FT_END_HEADER + +#endif /* __OTVGPOS_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvgsub.c b/src/libs/freetype2/otvalid/otvgsub.c new file mode 100644 index 0000000000..022fa46f6d --- /dev/null +++ b/src/libs/freetype2/otvalid/otvgsub.c @@ -0,0 +1,584 @@ +/***************************************************************************/ +/* */ +/* otvgsub.c */ +/* */ +/* OpenType GSUB table validation (body). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include "otvalid.h" +#include "otvcommn.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_otvgsub + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB LOOKUP TYPE 1 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* uses valid->glyph_count */ + + static void + otv_SingleSubst_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt SubstFormat; + + + OTV_NAME_ENTER( "SingleSubst" ); + + OTV_LIMIT_CHECK( 2 ); + SubstFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", SubstFormat )); + + switch ( SubstFormat ) + { + case 1: /* SingleSubstFormat1 */ + { + FT_Bytes Coverage; + FT_Int DeltaGlyphID; + FT_Long idx; + + + OTV_LIMIT_CHECK( 4 ); + Coverage = table + FT_NEXT_USHORT( p ); + DeltaGlyphID = FT_NEXT_SHORT( p ); + + otv_Coverage_validate( Coverage, valid ); + + idx = otv_Coverage_get_first( Coverage ) + DeltaGlyphID; + if ( idx < 0 ) + FT_INVALID_DATA; + + idx = otv_Coverage_get_last( Coverage ) + DeltaGlyphID; + if ( (FT_UInt)idx >= valid->glyph_count ) + FT_INVALID_DATA; + } + break; + + case 2: /* SingleSubstFormat2 */ + { + FT_UInt Coverage, GlyphCount; + + + OTV_LIMIT_CHECK( 4 ); + Coverage = FT_NEXT_USHORT( p ); + GlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + + otv_Coverage_validate( table + Coverage, valid ); + + OTV_LIMIT_CHECK( GlyphCount * 2 ); + + /* Substitute */ + for ( ; GlyphCount > 0; GlyphCount-- ) + if ( FT_NEXT_USHORT( p ) >= valid->glyph_count ) + FT_INVALID_DATA; + } + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB LOOKUP TYPE 2 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra1 (glyph count) */ + + static void + otv_MultipleSubst_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt SubstFormat; + + + OTV_NAME_ENTER( "MultipleSubst" ); + + OTV_LIMIT_CHECK( 2 ); + SubstFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", SubstFormat )); + + switch ( SubstFormat ) + { + case 1: + valid->extra1 = valid->glyph_count; + OTV_NEST2( MultipleSubstFormat1, Sequence ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB LOOKUP TYPE 3 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra1 (glyph count) */ + + static void + otv_AlternateSubst_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt SubstFormat; + + + OTV_NAME_ENTER( "AlternateSubst" ); + + OTV_LIMIT_CHECK( 2 ); + SubstFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", SubstFormat )); + + switch ( SubstFormat ) + { + case 1: + valid->extra1 = valid->glyph_count; + OTV_NEST2( AlternateSubstFormat1, AlternateSet ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB LOOKUP TYPE 4 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + +#define Ligature otv_Ligature_validate, "Ligature" + + /* uses valid->glyph_count */ + + static void + otv_Ligature_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt LigatureGlyph, CompCount; + + + OTV_ENTER; + + OTV_LIMIT_CHECK( 4 ); + LigatureGlyph = FT_NEXT_USHORT( p ); + if ( LigatureGlyph >= valid->glyph_count ) + FT_INVALID_DATA; + + CompCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (CompCount = %d)\n", CompCount )); + + if ( CompCount == 0 ) + FT_INVALID_DATA; + + CompCount--; + + OTV_LIMIT_CHECK( CompCount * 2 ); /* Component */ + + /* no need to check the Component glyph indices */ + + OTV_EXIT; + } + + + static void + otv_LigatureSubst_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt SubstFormat; + + + OTV_NAME_ENTER( "LigatureSubst" ); + + OTV_LIMIT_CHECK( 2 ); + SubstFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", SubstFormat )); + + switch ( SubstFormat ) + { + case 1: + OTV_NEST3( LigatureSubstFormat1, LigatureSet, Ligature ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB LOOKUP TYPE 5 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra1 (lookup count) */ + + static void + otv_ContextSubst_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt SubstFormat; + + + OTV_NAME_ENTER( "ContextSubst" ); + + OTV_LIMIT_CHECK( 2 ); + SubstFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", SubstFormat )); + + switch ( SubstFormat ) + { + case 1: + /* no need to check glyph indices/classes used as input for these */ + /* context rules since even invalid glyph indices/classes return */ + /* meaningful results */ + + valid->extra1 = valid->lookup_count; + OTV_NEST3( ContextSubstFormat1, SubRuleSet, SubRule ); + OTV_RUN( table, valid ); + break; + + case 2: + /* no need to check glyph indices/classes used as input for these */ + /* context rules since even invalid glyph indices/classes return */ + /* meaningful results */ + + OTV_NEST3( ContextSubstFormat2, SubClassSet, SubClassRule ); + OTV_RUN( table, valid ); + break; + + case 3: + OTV_NEST1( ContextSubstFormat3 ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB LOOKUP TYPE 6 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->extra1 (lookup count) */ + + static void + otv_ChainContextSubst_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt SubstFormat; + + + OTV_NAME_ENTER( "ChainContextSubst" ); + + OTV_LIMIT_CHECK( 2 ); + SubstFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", SubstFormat )); + + switch ( SubstFormat ) + { + case 1: + /* no need to check glyph indices/classes used as input for these */ + /* context rules since even invalid glyph indices/classes return */ + /* meaningful results */ + + valid->extra1 = valid->lookup_count; + OTV_NEST3( ChainContextSubstFormat1, + ChainSubRuleSet, ChainSubRule ); + OTV_RUN( table, valid ); + break; + + case 2: + /* no need to check glyph indices/classes used as input for these */ + /* context rules since even invalid glyph indices/classes return */ + /* meaningful results */ + + OTV_NEST3( ChainContextSubstFormat2, + ChainSubClassSet, ChainSubClassRule ); + OTV_RUN( table, valid ); + break; + + case 3: + OTV_NEST1( ChainContextSubstFormat3 ); + OTV_RUN( table, valid ); + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB LOOKUP TYPE 7 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* uses valid->type_funcs */ + + static void + otv_ExtensionSubst_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt SubstFormat; + + + OTV_NAME_ENTER( "ExtensionSubst" ); + + OTV_LIMIT_CHECK( 2 ); + SubstFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", SubstFormat )); + + switch ( SubstFormat ) + { + case 1: /* ExtensionSubstFormat1 */ + { + FT_UInt ExtensionLookupType, ExtensionOffset; + OTV_Validate_Func validate; + + + OTV_LIMIT_CHECK( 6 ); + ExtensionLookupType = FT_NEXT_USHORT( p ); + ExtensionOffset = FT_NEXT_ULONG( p ); + + if ( ExtensionLookupType == 0 || + ExtensionLookupType == 7 || + ExtensionLookupType > 8 ) + FT_INVALID_DATA; + + validate = valid->type_funcs[ExtensionLookupType - 1]; + validate( table + ExtensionOffset, valid ); + } + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB LOOKUP TYPE 8 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* uses valid->glyph_count */ + + static void + otv_ReverseChainSingleSubst_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table, Coverage; + FT_UInt SubstFormat; + FT_UInt BacktrackGlyphCount, LookaheadGlyphCount, GlyphCount; + + + OTV_NAME_ENTER( "ReverseChainSingleSubst" ); + + OTV_LIMIT_CHECK( 2 ); + SubstFormat = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (format %d)\n", SubstFormat )); + + switch ( SubstFormat ) + { + case 1: /* ReverseChainSingleSubstFormat1 */ + OTV_LIMIT_CHECK( 4 ); + Coverage = table + FT_NEXT_USHORT( p ); + BacktrackGlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (BacktrackGlyphCount = %d)\n", BacktrackGlyphCount )); + + otv_Coverage_validate( Coverage, valid ); + + OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 ); + + for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- ) + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid ); + + LookaheadGlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (LookaheadGlyphCount = %d)\n", LookaheadGlyphCount )); + + OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 ); + + for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- ) + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid ); + + GlyphCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); + + if ( GlyphCount != otv_Coverage_get_count( Coverage ) ) + FT_INVALID_DATA; + + OTV_LIMIT_CHECK( GlyphCount * 2 ); + + /* Substitute */ + for ( ; GlyphCount > 0; GlyphCount-- ) + if ( FT_NEXT_USHORT( p ) >= valid->glyph_count ) + FT_INVALID_DATA; + + break; + + default: + FT_INVALID_DATA; + } + + OTV_EXIT; + } + + + static const OTV_Validate_Func otv_gsub_validate_funcs[8] = + { + otv_SingleSubst_validate, + otv_MultipleSubst_validate, + otv_AlternateSubst_validate, + otv_LigatureSubst_validate, + otv_ContextSubst_validate, + otv_ChainContextSubst_validate, + otv_ExtensionSubst_validate, + otv_ReverseChainSingleSubst_validate + }; + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GSUB TABLE *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* sets valid->type_count */ + /* sets valid->type_funcs */ + /* sets valid->glyph_count */ + + FT_LOCAL_DEF( void ) + otv_GSUB_validate( FT_Bytes table, + FT_UInt glyph_count, + FT_Validator ftvalid ) + { + OTV_ValidatorRec validrec; + OTV_Validator valid = &validrec; + FT_Bytes p = table; + FT_UInt ScriptList, FeatureList, LookupList; + + + valid->root = ftvalid; + + FT_TRACE3(( "validating GSUB table\n" )); + OTV_INIT; + + OTV_LIMIT_CHECK( 10 ); + + if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + FT_INVALID_DATA; + + ScriptList = FT_NEXT_USHORT( p ); + FeatureList = FT_NEXT_USHORT( p ); + LookupList = FT_NEXT_USHORT( p ); + + valid->type_count = 8; + valid->type_funcs = (OTV_Validate_Func*)otv_gsub_validate_funcs; + valid->glyph_count = glyph_count; + + otv_LookupList_validate( table + LookupList, + valid ); + otv_FeatureList_validate( table + FeatureList, table + LookupList, + valid ); + otv_ScriptList_validate( table + ScriptList, table + FeatureList, + valid ); + + FT_TRACE4(( "\n" )); + } + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvjstf.c b/src/libs/freetype2/otvalid/otvjstf.c new file mode 100644 index 0000000000..a230b36fbc --- /dev/null +++ b/src/libs/freetype2/otvalid/otvjstf.c @@ -0,0 +1,258 @@ +/***************************************************************************/ +/* */ +/* otvjstf.c */ +/* */ +/* OpenType JSTF table validation (body). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include "otvalid.h" +#include "otvcommn.h" +#include "otvgpos.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_otvjstf + + +#define JstfPriority otv_JstfPriority_validate, "JstfPriority" +#define JstfLookup otv_GPOS_subtable_validate, "" + + /* uses valid->extra1 (GSUB lookup count) */ + /* uses valid->extra2 (GPOS lookup count) */ + /* sets valid->extra1 (counter) */ + + static void + otv_JstfPriority_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt table_size; + FT_UInt gsub_lookup_count, gpos_lookup_count; + + OTV_OPTIONAL_TABLE( ShrinkageEnableGSUB ); + OTV_OPTIONAL_TABLE( ShrinkageDisableGSUB ); + OTV_OPTIONAL_TABLE( ShrinkageEnableGPOS ); + OTV_OPTIONAL_TABLE( ShrinkageDisableGPOS ); + OTV_OPTIONAL_TABLE( ExtensionEnableGSUB ); + OTV_OPTIONAL_TABLE( ExtensionDisableGSUB ); + OTV_OPTIONAL_TABLE( ExtensionEnableGPOS ); + OTV_OPTIONAL_TABLE( ExtensionDisableGPOS ); + OTV_OPTIONAL_TABLE( ShrinkageJstfMax ); + OTV_OPTIONAL_TABLE( ExtensionJstfMax ); + + + OTV_ENTER; + OTV_TRACE(( "JstfPriority table\n" )); + + OTV_LIMIT_CHECK( 20 ); + + gsub_lookup_count = valid->extra1; + gpos_lookup_count = valid->extra2; + + table_size = 20; + + valid->extra1 = gsub_lookup_count; + + OTV_OPTIONAL_OFFSET( ShrinkageEnableGSUB ); + OTV_SIZE_CHECK( ShrinkageEnableGSUB ); + if ( ShrinkageEnableGSUB ) + otv_x_ux( table + ShrinkageEnableGSUB, valid ); + + OTV_OPTIONAL_OFFSET( ShrinkageDisableGSUB ); + OTV_SIZE_CHECK( ShrinkageDisableGSUB ); + if ( ShrinkageDisableGSUB ) + otv_x_ux( table + ShrinkageDisableGSUB, valid ); + + valid->extra1 = gpos_lookup_count; + + OTV_OPTIONAL_OFFSET( ShrinkageEnableGPOS ); + OTV_SIZE_CHECK( ShrinkageEnableGPOS ); + if ( ShrinkageEnableGPOS ) + otv_x_ux( table + ShrinkageEnableGPOS, valid ); + + OTV_OPTIONAL_OFFSET( ShrinkageDisableGPOS ); + OTV_SIZE_CHECK( ShrinkageDisableGPOS ); + if ( ShrinkageDisableGPOS ) + otv_x_ux( table + ShrinkageDisableGPOS, valid ); + + OTV_OPTIONAL_OFFSET( ShrinkageJstfMax ); + OTV_SIZE_CHECK( ShrinkageJstfMax ); + if ( ShrinkageJstfMax ) + { + /* XXX: check lookup types? */ + OTV_NEST2( JstfMax, JstfLookup ); + OTV_RUN( table + ShrinkageJstfMax, valid ); + } + + valid->extra1 = gsub_lookup_count; + + OTV_OPTIONAL_OFFSET( ExtensionEnableGSUB ); + OTV_SIZE_CHECK( ExtensionEnableGSUB ); + if ( ExtensionEnableGSUB ) + otv_x_ux( table + ExtensionEnableGSUB, valid ); + + OTV_OPTIONAL_OFFSET( ExtensionDisableGSUB ); + OTV_SIZE_CHECK( ExtensionDisableGSUB ); + if ( ExtensionDisableGSUB ) + otv_x_ux( table + ExtensionDisableGSUB, valid ); + + valid->extra1 = gpos_lookup_count; + + OTV_OPTIONAL_OFFSET( ExtensionEnableGPOS ); + OTV_SIZE_CHECK( ExtensionEnableGPOS ); + if ( ExtensionEnableGPOS ) + otv_x_ux( table + ExtensionEnableGPOS, valid ); + + OTV_OPTIONAL_OFFSET( ExtensionDisableGPOS ); + OTV_SIZE_CHECK( ExtensionDisableGPOS ); + if ( ExtensionDisableGPOS ) + otv_x_ux( table + ExtensionDisableGPOS, valid ); + + OTV_OPTIONAL_OFFSET( ExtensionJstfMax ); + OTV_SIZE_CHECK( ExtensionJstfMax ); + if ( ExtensionJstfMax ) + { + /* XXX: check lookup types? */ + OTV_NEST2( JstfMax, JstfLookup ); + OTV_RUN( table + ExtensionJstfMax, valid ); + } + + valid->extra1 = gsub_lookup_count; + valid->extra2 = gpos_lookup_count; + + OTV_EXIT; + } + + + /* sets valid->extra (glyph count) */ + /* sets valid->func1 (otv_JstfPriority_validate) */ + + static void + otv_JstfScript_validate( FT_Bytes table, + OTV_Validator valid ) + { + FT_Bytes p = table; + FT_UInt table_size; + FT_UInt JstfLangSysCount; + + OTV_OPTIONAL_TABLE( ExtGlyph ); + OTV_OPTIONAL_TABLE( DefJstfLangSys ); + + + OTV_NAME_ENTER( "JstfScript" ); + + OTV_LIMIT_CHECK( 6 ); + OTV_OPTIONAL_OFFSET( ExtGlyph ); + OTV_OPTIONAL_OFFSET( DefJstfLangSys ); + JstfLangSysCount = FT_NEXT_USHORT( p ); + + OTV_TRACE(( " (JstfLangSysCount = %d)\n", JstfLangSysCount )); + + table_size = JstfLangSysCount * 6 + 6; + + OTV_SIZE_CHECK( ExtGlyph ); + if ( ExtGlyph ) + { + valid->extra1 = valid->glyph_count; + OTV_NEST1( ExtenderGlyph ); + OTV_RUN( table + ExtGlyph, valid ); + } + + OTV_SIZE_CHECK( DefJstfLangSys ); + if ( DefJstfLangSys ) + { + OTV_NEST2( JstfLangSys, JstfPriority ); + OTV_RUN( table + DefJstfLangSys, valid ); + } + + OTV_LIMIT_CHECK( 6 * JstfLangSysCount ); + + /* JstfLangSysRecord */ + OTV_NEST2( JstfLangSys, JstfPriority ); + for ( ; JstfLangSysCount > 0; JstfLangSysCount-- ) + { + p += 4; /* skip JstfLangSysTag */ + + OTV_RUN( table + FT_NEXT_USHORT( p ), valid ); + } + + OTV_EXIT; + } + + + /* sets valid->extra1 (GSUB lookup count) */ + /* sets valid->extra2 (GPOS lookup count) */ + /* sets valid->glyph_count */ + + FT_LOCAL_DEF( void ) + otv_JSTF_validate( FT_Bytes table, + FT_Bytes gsub, + FT_Bytes gpos, + FT_UInt glyph_count, + FT_Validator ftvalid ) + { + OTV_ValidatorRec validrec; + OTV_Validator valid = &validrec; + FT_Bytes p = table; + FT_UInt JstfScriptCount; + + + valid->root = ftvalid; + + FT_TRACE3(( "validating JSTF table\n" )); + OTV_INIT; + + OTV_LIMIT_CHECK( 6 ); + + if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ + FT_INVALID_DATA; + + JstfScriptCount = FT_NEXT_USHORT( p ); + + FT_TRACE3(( " (JstfScriptCount = %d)\n", JstfScriptCount )); + + OTV_LIMIT_CHECK( JstfScriptCount * 6 ); + + if ( gsub ) + valid->extra1 = otv_GSUBGPOS_get_Lookup_count( gsub ); + else + valid->extra1 = 0; + + if ( gpos ) + valid->extra2 = otv_GSUBGPOS_get_Lookup_count( gpos ); + else + valid->extra2 = 0; + + valid->glyph_count = glyph_count; + + /* JstfScriptRecord */ + for ( ; JstfScriptCount > 0; JstfScriptCount-- ) + { + p += 4; /* skip JstfScriptTag */ + + /* JstfScript */ + otv_JstfScript_validate( table + FT_NEXT_USHORT( p ), valid ); + } + + FT_TRACE4(( "\n" )); + } + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvmod.c b/src/libs/freetype2/otvalid/otvmod.c new file mode 100644 index 0000000000..3572a3dd8f --- /dev/null +++ b/src/libs/freetype2/otvalid/otvmod.c @@ -0,0 +1,238 @@ +/***************************************************************************/ +/* */ +/* otvmod.c */ +/* */ +/* FreeType's OpenType validation module implementation (body). */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include <ft2build.h> +#include FT_TRUETYPE_TABLES_H +#include FT_TRUETYPE_TAGS_H +#include FT_OPENTYPE_VALIDATE_H +#include FT_INTERNAL_OBJECTS_H +#include FT_SERVICE_OPENTYPE_VALIDATE_H + +#include "otvmod.h" +#include "otvalid.h" +#include "otvcommn.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_otvmodule + + + static FT_Error + otv_load_table( FT_Face face, + FT_Tag tag, + FT_Byte* *table, + FT_ULong *table_len ) + { + FT_Error error; + FT_Memory memory = FT_FACE_MEMORY( face ); + + + error = FT_Load_Sfnt_Table( face, tag, 0, NULL, table_len ); + if ( error == OTV_Err_Table_Missing ) + return OTV_Err_Ok; + if ( error ) + goto Exit; + + if ( FT_ALLOC( *table, *table_len ) ) + goto Exit; + + error = FT_Load_Sfnt_Table( face, tag, 0, *table, table_len ); + + Exit: + return error; + } + + + static FT_Error + otv_validate( FT_Face face, + FT_UInt ot_flags, + FT_Bytes *ot_base, + FT_Bytes *ot_gdef, + FT_Bytes *ot_gpos, + FT_Bytes *ot_gsub, + FT_Bytes *ot_jstf ) + { + FT_Error error = OTV_Err_Ok; + FT_Byte *base, *gdef, *gpos, *gsub, *jstf; + FT_ULong len_base, len_gdef, len_gpos, len_gsub, len_jstf; + FT_ValidatorRec valid; + + + base = gdef = gpos = gsub = jstf = NULL; + len_base = len_gdef = len_gpos = len_gsub = len_jstf = 0; + + /* load tables */ + + if ( ot_flags & FT_VALIDATE_BASE ) + { + error = otv_load_table( face, TTAG_BASE, &base, &len_base ); + if ( error ) + goto Exit; + } + + if ( ot_flags & FT_VALIDATE_GDEF ) + { + error = otv_load_table( face, TTAG_GDEF, &gdef, &len_gdef ); + if ( error ) + goto Exit; + } + + if ( ot_flags & FT_VALIDATE_GPOS ) + { + error = otv_load_table( face, TTAG_GPOS, &gpos, &len_gpos ); + if ( error ) + goto Exit; + } + + if ( ot_flags & FT_VALIDATE_GSUB ) + { + error = otv_load_table( face, TTAG_GSUB, &gsub, &len_gsub ); + if ( error ) + goto Exit; + } + + if ( ot_flags & FT_VALIDATE_JSTF ) + { + error = otv_load_table( face, TTAG_JSTF, &jstf, &len_jstf ); + if ( error ) + goto Exit; + } + + /* validate tables */ + + if ( base ) + { + ft_validator_init( &valid, base, base + len_base, FT_VALIDATE_DEFAULT ); + if ( ft_setjmp( valid.jump_buffer ) == 0 ) + otv_BASE_validate( base, &valid ); + error = valid.error; + if ( error ) + goto Exit; + } + + if ( gpos ) + { + ft_validator_init( &valid, gpos, gpos + len_gpos, FT_VALIDATE_DEFAULT ); + if (ft_setjmp( valid.jump_buffer ) == 0 ) + otv_GPOS_validate( gpos, face->num_glyphs, &valid ); + error = valid.error; + if ( error ) + goto Exit; + } + + if ( gsub ) + { + ft_validator_init( &valid, gsub, gsub + len_gsub, FT_VALIDATE_DEFAULT ); + if ( ft_setjmp( valid.jump_buffer ) == 0 ) + otv_GSUB_validate( gsub, face->num_glyphs, &valid ); + error = valid.error; + if ( error ) + goto Exit; + } + + if ( gdef ) + { + ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT ); + if ( ft_setjmp( valid.jump_buffer ) == 0 ) + otv_GDEF_validate( gdef, gsub, gpos, &valid ); + error = valid.error; + if ( error ) + goto Exit; + } + + if ( jstf ) + { + ft_validator_init( &valid, jstf, jstf + len_jstf, FT_VALIDATE_DEFAULT ); + if ( ft_setjmp( valid.jump_buffer ) == 0 ) + otv_JSTF_validate( jstf, gsub, gpos, face->num_glyphs, &valid ); + error = valid.error; + if ( error ) + goto Exit; + } + + *ot_base = (FT_Bytes)base; + *ot_gdef = (FT_Bytes)gdef; + *ot_gpos = (FT_Bytes)gpos; + *ot_gsub = (FT_Bytes)gsub; + *ot_jstf = (FT_Bytes)jstf; + + Exit: + if ( error ) { + FT_Memory memory = FT_FACE_MEMORY( face ); + + + FT_FREE( base ); + FT_FREE( gdef ); + FT_FREE( gpos ); + FT_FREE( gsub ); + FT_FREE( jstf ); + } + + return error; + } + + + static + const FT_Service_OTvalidateRec otvalid_interface = + { + otv_validate + }; + + + static + const FT_ServiceDescRec otvalid_services[] = + { + { FT_SERVICE_ID_OPENTYPE_VALIDATE, &otvalid_interface }, + { NULL, NULL } + }; + + + static FT_Pointer + otvalid_get_service( FT_Module module, + const char* service_id ) + { + FT_UNUSED( module ); + + return ft_service_list_lookup( otvalid_services, service_id ); + } + + + FT_CALLBACK_TABLE_DEF + const FT_Module_Class otv_module_class = + { + 0, + sizeof( FT_ModuleRec ), + "otvalid", + 0x10000L, + 0x20000L, + + 0, /* module-specific interface */ + + (FT_Module_Constructor)0, + (FT_Module_Destructor) 0, + (FT_Module_Requester) otvalid_get_service + }; + + +/* END */ diff --git a/src/libs/freetype2/otvalid/otvmod.h b/src/libs/freetype2/otvalid/otvmod.h new file mode 100644 index 0000000000..1bfc1899fe --- /dev/null +++ b/src/libs/freetype2/otvalid/otvmod.h @@ -0,0 +1,39 @@ +/***************************************************************************/ +/* */ +/* otvmod.h */ +/* */ +/* FreeType's OpenType validation module implementation */ +/* (specification). */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __OTVMOD_H__ +#define __OTVMOD_H__ + + +#include <ft2build.h> +#include FT_MODULE_H + + +FT_BEGIN_HEADER + + + FT_EXPORT_VAR( const FT_Module_Class ) otv_module_class; + + +FT_END_HEADER + +#endif /* __OTVMOD_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/otvalid/rules.mk b/src/libs/freetype2/otvalid/rules.mk new file mode 100644 index 0000000000..48f12336f7 --- /dev/null +++ b/src/libs/freetype2/otvalid/rules.mk @@ -0,0 +1,77 @@ +# +# FreeType 2 OpenType validation driver configuration rules +# + + +# Copyright 2004 by +# David Turner, Robert Wilhelm, and Werner Lemberg. +# +# This file is part of the FreeType project, and may only be used, modified, +# and distributed under the terms of the FreeType project license, +# LICENSE.TXT. By continuing to use, modify, or distribute this file you +# indicate that you have read the license and understand and accept it +# fully. + + +# OTV driver directory +# +OTV_DIR := $(SRC_DIR)/otvalid + + +# compilation flags for the driver +# +OTV_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(OTV_DIR)) + + +# OTV driver sources (i.e., C files) +# +OTV_DRV_SRC := $(OTV_DIR)/otvbase.c \ + $(OTV_DIR)/otvcommn.c \ + $(OTV_DIR)/otvgdef.c \ + $(OTV_DIR)/otvgpos.c \ + $(OTV_DIR)/otvgsub.c \ + $(OTV_DIR)/otvjstf.c \ + $(OTV_DIR)/otvmod.c + +# OTV driver headers +# +OTV_DRV_H := $(OTV_DIR)/otvalid.h \ + $(OTV_DIR)/otverror.h \ + $(OTV_DIR)/otvcommn.h \ + $(OTV_DIR)/otvgpos.h \ + $(OTV_DIR)/otvmod.h + + +# OTV driver object(s) +# +# OTV_DRV_OBJ_M is used during `multi' builds. +# OTV_DRV_OBJ_S is used during `single' builds. +# +OTV_DRV_OBJ_M := $(OTV_DRV_SRC:$(OTV_DIR)/%.c=$(OBJ_DIR)/%.$O) +OTV_DRV_OBJ_S := $(OBJ_DIR)/otvalid.$O + +# OTV driver source file for single build +# +OTV_DRV_SRC_S := $(OTV_DIR)/otvalid.c + + +# OTV driver - single object +# +$(OTV_DRV_OBJ_S): $(OTV_DRV_SRC_S) $(OTV_DRV_SRC) \ + $(FREETYPE_H) $(OTV_DRV_H) + $(OTV_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(OTV_DRV_SRC_S)) + + +# OTV driver - multiple objects +# +$(OBJ_DIR)/%.$O: $(OTV_DIR)/%.c $(FREETYPE_H) $(OTV_DRV_H) + $(OTV_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) + + +# update main driver object lists +# +DRV_OBJS_S += $(OTV_DRV_OBJ_S) +DRV_OBJS_M += $(OTV_DRV_OBJ_M) + + +# EOF diff --git a/src/libs/freetype2/pcf/README b/src/libs/freetype2/pcf/README new file mode 100644 index 0000000000..75f49e1427 --- /dev/null +++ b/src/libs/freetype2/pcf/README @@ -0,0 +1,114 @@ + FreeType font driver for PCF fonts + + Francesco Zappa Nardelli + <francesco.zappa.nardelli@ens.fr> + + +Introduction +************ + +PCF (Portable Compiled Format) is a binary bitmap font format, largely used +in X world. This code implements a PCF driver for the FreeType library. +Glyph images are loaded into memory only on demand, thus leading to a small +memory footprint. + +Informations on the PCF font format can only be worked out from +``pcfread.c'', and ``pcfwrite.c'', to be found, for instance, in the XFree86 +(www.xfree86.org) source tree (xc/lib/font/bitmap/). + +Many good bitmap fonts in bdf format come with XFree86: they can be +compiled into the pcf format using the ``bdftopcf'' utility. + + +Supported hardware +****************** + +The driver has been tested on linux/x86 and sunos5.5/sparc. In both +cases the compiler was gcc. When back in Paris, I will test it also +on linux/alpha. + + +Encodings +********* + +The variety of encodings that accompanies pcf fonts appears to encompass the +small set defined in freetype.h. On the other hand, each pcf font defines +two properties that specify encoding and registry. + +I decided to make these two properties directly accessible, leaving to the +client application the work of interpreting them. For instance: + + #include "pcftypes.h" /* include/freetype/internal/pcftypes.h */ + + FT_Face face; + PCF_Public_Face pcfface; + + FT_New_Face( library,..., &face ); + + pcfface = (PCF_Public_Face)face; + + if ((pcfface->charset_registry == "ISO10646") && + (pcfface->charset_encoding) == "1")) [..] + +Thus the driver always export ``ft_encoding_none'' as +face->charmap.encoding. FT_Get_Char_Index() behavior is unmodified, that +is, it converts the ULong value given as argument into the corresponding +glyph number. + + +Known problems +************** + +- dealing explicitly with encodings breaks the uniformity of freetype2 + api. + +- except for encodings properties, client applications have no + visibility of the PCF_Face object. This means that applications + cannot directly access font tables and are obliged to trust + FreeType. + +- currently, glyph names and ink_metrics are ignored. + +I plan to give full visibility of the PCF_Face object in the next +release of the driver, thus implementing also glyph names and +ink_metrics. + +- height is defined as (ascent - descent). Is this correct? + +- if unable to read size informations from the font, PCF_Init_Face + sets available_size->width and available_size->height to 12. + +- too many english grammar errors in the readme file :-( + + +License +******* + +Copyright (C) 2000 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. + + +Credits +******* + +Keith Packard wrote the pcf driver found in XFree86. His work is at +the same time the specification and the sample implementation of the +PCF format. Undoubtedly, this driver is inspired from his work. diff --git a/src/libs/freetype2/pcf/pcfdrivr.c b/src/libs/freetype2/pcf/pcfdrivr.c index 80f043f9eb..e47a684525 100644 --- a/src/libs/freetype2/pcf/pcfdrivr.c +++ b/src/libs/freetype2/pcf/pcfdrivr.c @@ -40,6 +40,7 @@ THE SOFTWARE. #include "pcfread.h" #include "pcferror.h" +#include "pcfutil.h" #undef FT_COMPONENT #define FT_COMPONENT trace_pcfread @@ -47,9 +48,20 @@ THE SOFTWARE. #include FT_SERVICE_BDF_H #include FT_SERVICE_XFREE86_NAME_H + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_pcfdriver + + typedef struct PCF_CMapRec_ { - FT_CMapRec cmap; + FT_CMapRec root; FT_UInt num_encodings; PCF_Encoding encodings; @@ -57,9 +69,13 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_Error ) - pcf_cmap_init( PCF_CMap cmap ) + pcf_cmap_init( FT_CMap pcfcmap, /* PCF_CMap */ + FT_Pointer init_data ) { - PCF_Face face = (PCF_Face)FT_CMAP_FACE( cmap ); + PCF_CMap cmap = (PCF_CMap)pcfcmap; + PCF_Face face = (PCF_Face)FT_CMAP_FACE( pcfcmap ); + + FT_UNUSED( init_data ); cmap->num_encodings = (FT_UInt)face->nencodings; @@ -70,20 +86,24 @@ THE SOFTWARE. FT_CALLBACK_DEF( void ) - pcf_cmap_done( PCF_CMap cmap ) + pcf_cmap_done( FT_CMap pcfcmap ) /* PCF_CMap */ { + PCF_CMap cmap = (PCF_CMap)pcfcmap; + + cmap->encodings = NULL; cmap->num_encodings = 0; } FT_CALLBACK_DEF( FT_UInt ) - pcf_cmap_char_index( PCF_CMap cmap, + pcf_cmap_char_index( FT_CMap pcfcmap, /* PCF_CMap */ FT_UInt32 charcode ) { + PCF_CMap cmap = (PCF_CMap)pcfcmap; PCF_Encoding encodings = cmap->encodings; FT_UInt min, max, mid; - FT_UInt result = 0; + FT_UInt result = 0; min = 0; @@ -114,13 +134,14 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_UInt ) - pcf_cmap_char_next( PCF_CMap cmap, + pcf_cmap_char_next( FT_CMap pcfcmap, /* PCF_CMap */ FT_UInt32 *acharcode ) { + PCF_CMap cmap = (PCF_CMap)pcfcmap; PCF_Encoding encodings = cmap->encodings; FT_UInt min, max, mid; - FT_UInt32 charcode = *acharcode + 1; - FT_UInt result = 0; + FT_UInt32 charcode = *acharcode + 1; + FT_UInt result = 0; min = 0; @@ -159,29 +180,21 @@ THE SOFTWARE. } - FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pcf_cmap_class = + FT_CALLBACK_TABLE_DEF + const FT_CMap_ClassRec pcf_cmap_class = { - sizeof( PCF_CMapRec ), - (FT_CMap_InitFunc) pcf_cmap_init, - (FT_CMap_DoneFunc) pcf_cmap_done, - (FT_CMap_CharIndexFunc)pcf_cmap_char_index, - (FT_CMap_CharNextFunc) pcf_cmap_char_next + sizeof ( PCF_CMapRec ), + pcf_cmap_init, + pcf_cmap_done, + pcf_cmap_char_index, + pcf_cmap_char_next }; - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_pcfdriver - - - FT_CALLBACK_DEF( FT_Error ) - PCF_Face_Done( PCF_Face face ) + FT_CALLBACK_DEF( void ) + PCF_Face_Done( FT_Face pcfface ) /* PCF_Face */ { + PCF_Face face = (PCF_Face)pcfface; FT_Memory memory = FT_FACE_MEMORY( face ); @@ -207,31 +220,31 @@ THE SOFTWARE. } FT_FREE( face->toc.tables ); - FT_FREE( face->root.family_name ); - FT_FREE( face->root.available_sizes ); + FT_FREE( pcfface->family_name ); + FT_FREE( pcfface->style_name ); + FT_FREE( pcfface->available_sizes ); FT_FREE( face->charset_encoding ); FT_FREE( face->charset_registry ); FT_TRACE4(( "PCF_Face_Done: done face\n" )); /* close gzip/LZW stream if any */ - if ( face->root.stream == &face->gzip_stream ) + if ( pcfface->stream == &face->gzip_stream ) { FT_Stream_Close( &face->gzip_stream ); - face->root.stream = face->gzip_source; + pcfface->stream = face->gzip_source; } - - return PCF_Err_Ok; } FT_CALLBACK_DEF( FT_Error ) PCF_Face_Init( FT_Stream stream, - PCF_Face face, + FT_Face pcfface, /* PCF_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { + PCF_Face face = (PCF_Face)pcfface; FT_Error error = PCF_Err_Ok; FT_UNUSED( num_params ); @@ -266,9 +279,9 @@ THE SOFTWARE. goto Fail; face->gzip_source = stream; - face->root.stream = &face->gzip_stream; + pcfface->stream = &face->gzip_stream; - stream = face->root.stream; + stream = pcfface->stream; error = pcf_load_font( stream, face ); if ( error ) @@ -277,9 +290,9 @@ THE SOFTWARE. else { face->gzip_source = stream; - face->root.stream = &face->gzip_stream; + pcfface->stream = &face->gzip_stream; - stream = face->root.stream; + stream = pcfface->stream; error = pcf_load_font( stream, face ); if ( error ) @@ -287,19 +300,16 @@ THE SOFTWARE. } } - /* set-up charmap */ + /* set up charmap */ { - FT_String *charset_registry, *charset_encoding; + FT_String *charset_registry = face->charset_registry; + FT_String *charset_encoding = face->charset_encoding; FT_Bool unicode_charmap = 0; - charset_registry = face->charset_registry; - charset_encoding = face->charset_encoding; - - if ( ( charset_registry != NULL ) && - ( charset_encoding != NULL ) ) + if ( charset_registry && charset_encoding ) { - char* s = face->charset_registry; + char* s = charset_registry; /* Uh, oh, compare first letters manually to avoid dependency @@ -336,8 +346,8 @@ THE SOFTWARE. #if 0 /* Select default charmap */ - if (face->root.num_charmaps) - face->root.charmap = face->root.charmaps[0]; + if ( pcfface->num_charmaps ) + pcfface->charmap = pcfface->charmaps[0]; #endif } } @@ -352,14 +362,56 @@ THE SOFTWARE. } - static FT_Error - PCF_Set_Pixel_Size( FT_Size size ) + FT_CALLBACK_DEF( FT_Error ) + PCF_Set_Pixel_Size( FT_Size size, + FT_UInt pixel_width, + FT_UInt pixel_height ) { - PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); + PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); + + FT_UNUSED( pixel_width ); - FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem, - face->root.available_sizes->y_ppem >> 6 )); + if ( pixel_height == (FT_UInt)face->root.available_sizes->height ) + { + size->metrics.ascender = face->accel.fontAscent << 6; + size->metrics.descender = face->accel.fontDescent * (-64); +#if 0 + size->metrics.height = face->accel.maxbounds.ascent << 6; +#endif + size->metrics.height = size->metrics.ascender - + size->metrics.descender; + + size->metrics.max_advance = face->accel.maxbounds.characterWidth << 6; + + return PCF_Err_Ok; + } + else + { + FT_TRACE4(( "pixel size WRONG\n" )); + return PCF_Err_Invalid_Pixel_Size; + } + } + + + FT_CALLBACK_DEF( FT_Error ) + PCF_Set_Point_Size( FT_Size size, + FT_F26Dot6 char_width, + FT_F26Dot6 char_height, + FT_UInt horz_resolution, + FT_UInt vert_resolution ) + { + PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); + + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); + FT_UNUSED( horz_resolution ); + FT_UNUSED( vert_resolution ); + + + FT_TRACE4(( "rec %d - pres %d\n", + size->metrics.y_ppem, + face->root.available_sizes->y_ppem >> 6 )); if ( size->metrics.y_ppem == face->root.available_sizes->y_ppem >> 6 ) { @@ -383,7 +435,7 @@ THE SOFTWARE. } - static FT_Error + FT_CALLBACK_DEF( FT_Error ) PCF_Glyph_Load( FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, @@ -567,7 +619,7 @@ THE SOFTWARE. }; - static FT_Module_Interface + FT_CALLBACK_DEF( FT_Module_Interface ) pcf_driver_requester( FT_Module module, const char* name ) { @@ -591,30 +643,30 @@ THE SOFTWARE. 0, - (FT_Module_Constructor)0, - (FT_Module_Destructor) 0, - (FT_Module_Requester) pcf_driver_requester + 0, + 0, + pcf_driver_requester }, - sizeof( PCF_FaceRec ), - sizeof( FT_SizeRec ), - sizeof( FT_GlyphSlotRec ), + sizeof ( PCF_FaceRec ), + sizeof ( FT_SizeRec ), + sizeof ( FT_GlyphSlotRec ), - (FT_Face_InitFunc) PCF_Face_Init, - (FT_Face_DoneFunc) PCF_Face_Done, - (FT_Size_InitFunc) 0, - (FT_Size_DoneFunc) 0, - (FT_Slot_InitFunc) 0, - (FT_Slot_DoneFunc) 0, + PCF_Face_Init, + PCF_Face_Done, + 0, /* FT_Size_InitFunc */ + 0, /* FT_Size_DoneFunc */ + 0, /* FT_Slot_InitFunc */ + 0, /* FT_Slot_DoneFunc */ - (FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size, - (FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size, + PCF_Set_Point_Size, + PCF_Set_Pixel_Size, - (FT_Slot_LoadFunc) PCF_Glyph_Load, + PCF_Glyph_Load, - (FT_Face_GetKerningFunc) 0, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc) 0 + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ + 0 /* FT_Face_GetAdvancesFunc */ }; diff --git a/src/libs/freetype2/pcf/pcfread.c b/src/libs/freetype2/pcf/pcfread.c index 3beabbfb2f..ea74d17d5f 100644 --- a/src/libs/freetype2/pcf/pcfread.c +++ b/src/libs/freetype2/pcf/pcfread.c @@ -2,7 +2,7 @@ FreeType font driver for pcf fonts - Copyright 2000, 2001, 2002, 2003, 2004 by + Copyright 2000, 2001, 2002, 2003, 2004, 2005 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -101,7 +101,8 @@ THE SOFTWARE. FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) ) return PCF_Err_Cannot_Open_Resource; - if ( toc->version != PCF_FILE_VERSION ) + if ( toc->version != PCF_FILE_VERSION || + toc->count > FT_ARRAY_MAX( face->toc.tables ) ) return PCF_Err_Invalid_File_Format; if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) ) @@ -122,7 +123,10 @@ THE SOFTWARE. const char* name = "?"; - FT_TRACE4(( "Tables count: %ld\n", face->toc.count )); + FT_TRACE4(( "pcf_read_TOC:\n" )); + + FT_TRACE4(( " number of tables: %ld\n", face->toc.count )); + tables = face->toc.tables; for ( i = 0; i < toc->count; i++ ) { @@ -130,12 +134,12 @@ THE SOFTWARE. if ( tables[i].type == (FT_UInt)( 1 << j ) ) name = tableNames[j]; - FT_TRACE4(( "Table %d: type=%-6s format=0x%04lX " - "size=0x%06lX (%8ld) offset=0x%04lX\n", + FT_TRACE4(( " %d: type=%s, format=0x%X, " + "size=%ld (0x%lX), offset=%ld (0x%lX)\n", i, name, tables[i].format, tables[i].size, tables[i].size, - tables[i].offset )); + tables[i].offset, tables[i].offset )); } } @@ -370,7 +374,9 @@ THE SOFTWARE. if ( FT_READ_ULONG_LE( format ) ) goto Bail; - FT_TRACE4(( "get_prop: format = %ld\n", format )); + FT_TRACE4(( "pcf_get_properties:\n" )); + + FT_TRACE4(( " format = %ld\n", format )); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) goto Bail; @@ -382,7 +388,7 @@ THE SOFTWARE. if ( error ) goto Bail; - FT_TRACE4(( "get_prop: nprop = %d\n", nprops )); + FT_TRACE4(( " nprop = %d\n", nprops )); if ( FT_NEW_ARRAY( props, nprops ) ) goto Bail; @@ -419,7 +425,7 @@ THE SOFTWARE. if ( error ) goto Bail; - FT_TRACE4(( "get_prop: string_size = %ld\n", string_size )); + FT_TRACE4(( " string_size = %ld\n", string_size )); if ( FT_NEW_ARRAY( strings, string_size ) ) goto Bail; @@ -437,7 +443,9 @@ THE SOFTWARE. if ( FT_NEW_ARRAY( properties[i].name, ft_strlen( strings + props[i].name ) + 1 ) ) goto Bail; - ft_strcpy( properties[i].name,strings + props[i].name ); + ft_strcpy( properties[i].name, strings + props[i].name ); + + FT_TRACE4(( " %s:", properties[i].name )); properties[i].isString = props[i].isString; @@ -447,9 +455,15 @@ THE SOFTWARE. ft_strlen( strings + props[i].value ) + 1 ) ) goto Bail; ft_strcpy( properties[i].value.atom, strings + props[i].value ); + + FT_TRACE4(( " `%s'\n", properties[i].value.atom )); } else + { properties[i].value.integer = props[i].value; + + FT_TRACE4(( " %d\n", properties[i].value.integer )); + } } face->properties = properties; @@ -518,6 +532,8 @@ THE SOFTWARE. if ( FT_NEW_ARRAY( face->metrics, nmetrics ) ) return PCF_Err_Out_Of_Memory; + FT_TRACE4(( "pcf_get_metrics:\n" )); + metrics = face->metrics; for ( i = 0; i < nmetrics; i++ ) { @@ -525,7 +541,7 @@ THE SOFTWARE. metrics[i].bits = 0; - FT_TRACE4(( "%d : width=%d, " + FT_TRACE4(( " idx %d: width=%d, " "lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d\n", i, ( metrics + i )->characterWidth, @@ -588,6 +604,8 @@ THE SOFTWARE. if ( FT_NEW_ARRAY( offsets, nbitmaps ) ) return error; + FT_TRACE4(( "pcf_get_bitmaps:\n" )); + for ( i = 0; i < nbitmaps; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) @@ -595,7 +613,8 @@ THE SOFTWARE. else (void)FT_READ_LONG_LE( offsets[i] ); - FT_TRACE4(( "bitmap %d is at offset %ld\n", i, offsets[i] )); + FT_TRACE4(( " bitmap %d: offset %ld (0x%lX)\n", + i, offsets[i], offsets[i] )); } if ( error ) goto Bail; @@ -611,13 +630,13 @@ THE SOFTWARE. sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )]; - FT_TRACE4(( "padding %d implies a size of %ld\n", i, bitmapSizes[i] )); + FT_TRACE4(( " padding %d implies a size of %ld\n", i, bitmapSizes[i] )); } FT_TRACE4(( " %d bitmaps, padding index %ld\n", nbitmaps, PCF_GLYPH_PAD_INDEX( format ) )); - FT_TRACE4(( "bitmap size = %d\n", sizebitmaps )); + FT_TRACE4(( " bitmap size = %d\n", sizebitmaps )); FT_UNUSED( sizebitmaps ); /* only used for debugging */ @@ -640,8 +659,8 @@ THE SOFTWARE. pcf_get_encodings( FT_Stream stream, PCF_Face face ) { - FT_Error error = PCF_Err_Ok; - FT_Memory memory = FT_FACE(face)->memory; + FT_Error error = PCF_Err_Ok; + FT_Memory memory = FT_FACE(face)->memory; FT_ULong format, size; int firstCol, lastCol; int firstRow, lastRow; @@ -687,7 +706,9 @@ THE SOFTWARE. if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return PCF_Err_Invalid_File_Format; - FT_TRACE4(( "enc: firstCol %d, lastCol %d, firstRow %d, lastRow %d\n", + FT_TRACE4(( "pdf_get_encodings:\n" )); + + FT_TRACE4(( " firstCol %d, lastCol %d, firstRow %d, lastRow %d\n", firstCol, lastCol, firstRow, lastRow )); nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 ); @@ -714,11 +735,13 @@ THE SOFTWARE. firstCol ); tmpEncoding[j].glyph = (FT_Short)encodingOffset; + + FT_TRACE4(( " code %d (0x%04X): idx %d\n", + tmpEncoding[j].enc, tmpEncoding[j].enc, + tmpEncoding[j].glyph )); + j++; } - - FT_TRACE4(( "enc n. %d ; Uni %ld ; Glyph %d\n", - i, tmpEncoding[j - 1].enc, encodingOffset )); } FT_Stream_ExitFrame( stream ); @@ -923,7 +946,12 @@ THE SOFTWARE. } if ( !parts || !len ) - face->style_name = (char *)"Regular"; + { + if ( FT_ALLOC( face->style_name, 8 ) ) + return error; + ft_strcpy( face->style_name, "Regular" ); + face->style_name[7] = '\0'; + } else { char *style, *s; @@ -1075,13 +1103,14 @@ THE SOFTWARE. FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) ); - bsize->height = face->accel.fontAscent + face->accel.fontDescent; + bsize->height = (FT_Short)( face->accel.fontAscent + + face->accel.fontDescent ); prop = pcf_find_property( face, "AVERAGE_WIDTH" ); if ( prop ) bsize->width = (FT_Short)( ( prop->value.integer + 5 ) / 10 ); else - bsize->width = bsize->height * 2/3; + bsize->width = (FT_Short)( bsize->height * 2/3 ); prop = pcf_find_property( face, "POINT_SIZE" ); if ( prop ) diff --git a/src/libs/freetype2/pcf/pcfutil.c b/src/libs/freetype2/pcf/pcfutil.c index ddaca35fd9..67e657908d 100644 --- a/src/libs/freetype2/pcf/pcfutil.c +++ b/src/libs/freetype2/pcf/pcfutil.c @@ -32,57 +32,25 @@ in this Software without prior written authorization from The Open Group. #include "pcfutil.h" - /* Utility functions for reformatting font bitmaps */ - - static const unsigned char _reverse_byte[0x100] = - { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff - }; - /* * Invert bit order within each BYTE of an array. */ - static void + FT_LOCAL_DEF( void ) BitOrderInvert( unsigned char* buf, int nbytes ) { - const unsigned char* rev = _reverse_byte; - - for ( ; --nbytes >= 0; buf++ ) - *buf = rev[*buf]; + { + unsigned int val = *buf; + + + val = ( ( val >> 1 ) & 0x55 ) | ( ( val << 1 ) & 0xAA ); + val = ( ( val >> 2 ) & 0x33 ) | ( ( val << 2 ) & 0xCC ); + val = ( ( val >> 4 ) & 0x0F ) | ( ( val << 4 ) & 0xF0 ); + + *buf = (unsigned char)val; + } } @@ -90,14 +58,14 @@ in this Software without prior written authorization from The Open Group. * Invert byte order within each 16-bits of an array. */ - static void + FT_LOCAL_DEF( void ) TwoByteSwap( unsigned char* buf, int nbytes ) { unsigned char c; - for ( ; nbytes > 0; nbytes -= 2, buf += 2 ) + for ( ; nbytes >= 2; nbytes -= 2, buf += 2 ) { c = buf[0]; buf[0] = buf[1]; @@ -109,14 +77,14 @@ in this Software without prior written authorization from The Open Group. * Invert byte order within each 32-bits of an array. */ - static void + FT_LOCAL_DEF( void ) FourByteSwap( unsigned char* buf, int nbytes ) { unsigned char c; - for ( ; nbytes > 0; nbytes -= 4, buf += 4 ) + for ( ; nbytes >= 4; nbytes -= 4, buf += 4 ) { c = buf[0]; buf[0] = buf[3]; diff --git a/src/libs/freetype2/pcf/pcfutil.h b/src/libs/freetype2/pcf/pcfutil.h index 017c515baa..1557be3e80 100644 --- a/src/libs/freetype2/pcf/pcfutil.h +++ b/src/libs/freetype2/pcf/pcfutil.h @@ -30,20 +30,24 @@ THE SOFTWARE. #include <ft2build.h> +#include FT_CONFIG_CONFIG_H - static void +FT_BEGIN_HEADER + + FT_LOCAL( void ) BitOrderInvert( unsigned char* buf, - int nbytes); + int nbytes ); - static void + FT_LOCAL( void ) TwoByteSwap( unsigned char* buf, - int nbytes); + int nbytes ); - static void + FT_LOCAL( void ) FourByteSwap( unsigned char* buf, - int nbytes); + int nbytes ); +FT_END_HEADER #endif /* __PCFUTIL_H__ */ diff --git a/src/libs/freetype2/pfr/pfrdrivr.c b/src/libs/freetype2/pfr/pfrdrivr.c index 4e0d6fdb47..55752a5f46 100644 --- a/src/libs/freetype2/pfr/pfrdrivr.c +++ b/src/libs/freetype2/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver interface (body). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,16 +27,17 @@ #include "pfrerror.h" - static FT_Error - pfr_get_kerning( PFR_Face face, + FT_CALLBACK_DEF( FT_Error ) + pfr_get_kerning( FT_Face pfrface, /* PFR_Face */ FT_UInt left, FT_UInt right, FT_Vector *avector ) { + PFR_Face face = (PFR_Face)pfrface; PFR_PhyFont phys = &face->phy_font; - pfr_face_get_kerning( face, left, right, avector ); + pfr_face_get_kerning( pfrface, left, right, avector ); /* convert from metrics to outline units when necessary */ if ( phys->outline_resolution != phys->metrics_resolution ) @@ -59,11 +60,12 @@ * */ - static FT_Error - pfr_get_advance( PFR_Face face, + FT_CALLBACK_DEF( FT_Error ) + pfr_get_advance( FT_Face pfrface, /* PFR_Face */ FT_UInt gindex, FT_Pos *anadvance ) { + PFR_Face face = (PFR_Face)pfrface; FT_Error error = PFR_Err_Bad_Argument; @@ -84,13 +86,14 @@ } - static FT_Error - pfr_get_metrics( PFR_Face face, + FT_CALLBACK_DEF( FT_Error ) + pfr_get_metrics( FT_Face pfrface, /* PFR_Face */ FT_UInt *anoutline_resolution, FT_UInt *ametrics_resolution, FT_Fixed *ametrics_x_scale, FT_Fixed *ametrics_y_scale ) { + PFR_Face face = (PFR_Face)pfrface; PFR_PhyFont phys = &face->phy_font; FT_Fixed x_scale, y_scale; FT_Size size = face->root.size; @@ -127,9 +130,9 @@ FT_CALLBACK_TABLE_DEF const FT_Service_PfrMetricsRec pfr_metrics_service_rec = { - (FT_PFR_GetMetricsFunc)pfr_get_metrics, - (FT_PFR_GetKerningFunc)pfr_face_get_kerning, - (FT_PFR_GetAdvanceFunc)pfr_get_advance + pfr_get_metrics, + pfr_face_get_kerning, + pfr_get_advance }; @@ -146,11 +149,11 @@ }; - static FT_Module_Interface - pfr_get_service( FT_Driver driver, + FT_CALLBACK_DEF( FT_Module_Interface ) + pfr_get_service( FT_Module module, const FT_String* service_id ) { - FT_UNUSED( driver ); + FT_UNUSED( module ); return ft_service_list_lookup( pfr_services, service_id ); } @@ -171,29 +174,29 @@ NULL, - (FT_Module_Constructor)NULL, - (FT_Module_Destructor) NULL, - (FT_Module_Requester) pfr_get_service + 0, + 0, + pfr_get_service }, sizeof( PFR_FaceRec ), sizeof( PFR_SizeRec ), sizeof( PFR_SlotRec ), - (FT_Face_InitFunc) pfr_face_init, - (FT_Face_DoneFunc) pfr_face_done, - (FT_Size_InitFunc) NULL, - (FT_Size_DoneFunc) NULL, - (FT_Slot_InitFunc) pfr_slot_init, - (FT_Slot_DoneFunc) pfr_slot_done, + pfr_face_init, + pfr_face_done, + 0, /* FT_Size_InitFunc */ + 0, /* FT_Size_DoneFunc */ + pfr_slot_init, + pfr_slot_done, - (FT_Size_ResetPointsFunc)NULL, - (FT_Size_ResetPixelsFunc)NULL, - (FT_Slot_LoadFunc) pfr_slot_load, + 0, /* FT_Size_ResetPointsFunc */ + 0, /* FT_Size_ResetPixelsFunc */ + pfr_slot_load, - (FT_Face_GetKerningFunc) pfr_get_kerning, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc)0 + pfr_get_kerning, + 0, /* FT_Face_AttachFunc */ + 0 /* FT_Face_GetAdvancesFunc */ }; diff --git a/src/libs/freetype2/pfr/pfrgload.c b/src/libs/freetype2/pfr/pfrgload.c index 87ba6846e8..f9615824c8 100644 --- a/src/libs/freetype2/pfr/pfrgload.c +++ b/src/libs/freetype2/pfr/pfrgload.c @@ -793,6 +793,8 @@ /* initialize glyph loader */ FT_GlyphLoader_Rewind( glyph->loader ); + glyph->num_subs = 0; + /* load the glyph, recursively when needed */ return pfr_glyph_load_rec( glyph, stream, gps_offset, offset, size ); } diff --git a/src/libs/freetype2/pfr/pfrload.c b/src/libs/freetype2/pfr/pfrload.c index 19ced45d13..6961dc499b 100644 --- a/src/libs/freetype2/pfr/pfrload.c +++ b/src/libs/freetype2/pfr/pfrload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (body). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -609,11 +609,13 @@ } - /* - * The kerning data embedded in a PFR font are (charcode,charcode) - * pairs; we need to translate them to (gindex,gindex) and sort - * the resulting array. - */ +#ifndef FT_OPTIMIZE_MEMORY + + /* + * The kerning data embedded in a PFR font are (charcode,charcode) + * pairs; we need to translate them to (gindex,gindex) and sort + * the resulting array. + */ static FT_UInt pfr_get_gindex( PFR_Char chars, FT_UInt count, @@ -670,14 +672,14 @@ FT_UInt count; - /* create kerning pairs array - */ + /* create kerning pairs array */ if ( FT_NEW_ARRAY( phy_font->kern_pairs, phy_font->num_kern_pairs ) ) goto Exit; - /* load all kerning items into the array, - * converting character codes into glyph indices - */ + /* + * load all kerning items into the array, + * converting character codes into glyph indices + */ pairs = phy_font->kern_pairs; item = phy_font->kern_items; count = 0; @@ -721,7 +723,7 @@ if ( item->flags & PFR_KERN_2BYTE_ADJ ) kerning = item->base_adj + FT_NEXT_SHORT( p ); else - kerning = item->base_adj + FT_NEXT_CHAR( p ); + kerning = item->base_adj + FT_NEXT_BYTE( p ); pair->glyph1 = pfr_get_gindex( chars, num_chars, char1 ); pair->glyph2 = pfr_get_gindex( chars, num_chars, char2 ); @@ -731,8 +733,7 @@ FT_FRAME_EXIT(); } - /* sort the resulting array - */ + /* sort the resulting array */ ft_qsort( pairs, count, sizeof ( PFR_KernPairRec ), pfr_compare_kern_pairs ); @@ -748,6 +749,8 @@ return error; } +#endif /* !FT_OPTIMIZE_MEMORY */ + static const PFR_ExtraItemRec pfr_phy_font_extra_items[] = { @@ -826,7 +829,10 @@ FT_FREE( phy_font->blue_values ); phy_font->num_blue_values = 0; +#ifndef FT_OPTIMIZE_MEMORY FT_FREE( phy_font->kern_pairs ); +#endif + { PFR_KernItem item, next; @@ -1065,8 +1071,10 @@ phy_font->bct_offset = FT_STREAM_POS(); phy_font->cursor = NULL; +#ifndef FT_OPTIMIZE_MEMORY /* now sort kerning pairs */ error = pfr_sort_kerning_pairs( stream, phy_font ); +#endif Exit: return error; diff --git a/src/libs/freetype2/pfr/pfrobjs.c b/src/libs/freetype2/pfr/pfrobjs.c index 4c6179aa57..a4eefb0da5 100644 --- a/src/libs/freetype2/pfr/pfrobjs.c +++ b/src/libs/freetype2/pfr/pfrobjs.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (body). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -39,30 +39,32 @@ /*************************************************************************/ FT_LOCAL_DEF( void ) - pfr_face_done( PFR_Face face ) + pfr_face_done( FT_Face pfrface ) /* PFR_Face */ { - FT_Memory memory = face->root.driver->root.memory; + PFR_Face face = (PFR_Face)pfrface; + FT_Memory memory = pfrface->driver->root.memory; /* we don't want dangling pointers */ - face->root.family_name = NULL; - face->root.style_name = NULL; - + pfrface->family_name = NULL; + pfrface->style_name = NULL; + /* finalize the physical font record */ pfr_phy_font_done( &face->phy_font, FT_FACE_MEMORY( face ) ); /* no need to finalize the logical font or the header */ - FT_FREE( face->root.available_sizes ); + FT_FREE( pfrface->available_sizes ); } FT_LOCAL_DEF( FT_Error ) pfr_face_init( FT_Stream stream, - PFR_Face face, + FT_Face pfrface, FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { + PFR_Face face = (PFR_Face)pfrface; FT_Error error; FT_UNUSED( num_params ); @@ -92,13 +94,13 @@ if ( error ) goto Exit; - face->root.num_faces = num_faces; + pfrface->num_faces = num_faces; } if ( face_index < 0 ) goto Exit; - if ( face_index >= face->root.num_faces ) + if ( face_index >= pfrface->num_faces ) { FT_ERROR(( "pfr_face_init: invalid face index\n" )); error = PFR_Err_Invalid_Argument; @@ -122,75 +124,74 @@ /* now, set-up all root face fields */ { - FT_Face root = FT_FACE( face ); PFR_PhyFont phy_font = &face->phy_font; - root->face_index = face_index; - root->num_glyphs = phy_font->num_chars; - root->face_flags = FT_FACE_FLAG_SCALABLE; + pfrface->face_index = face_index; + pfrface->num_glyphs = phy_font->num_chars; + pfrface->face_flags = FT_FACE_FLAG_SCALABLE; if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 ) - root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; + pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; if ( phy_font->flags & PFR_PHY_VERTICAL ) - root->face_flags |= FT_FACE_FLAG_VERTICAL; + pfrface->face_flags |= FT_FACE_FLAG_VERTICAL; else - root->face_flags |= FT_FACE_FLAG_HORIZONTAL; + pfrface->face_flags |= FT_FACE_FLAG_HORIZONTAL; if ( phy_font->num_strikes > 0 ) - root->face_flags |= FT_FACE_FLAG_FIXED_SIZES; + pfrface->face_flags |= FT_FACE_FLAG_FIXED_SIZES; if ( phy_font->num_kern_pairs > 0 ) - root->face_flags |= FT_FACE_FLAG_KERNING; + pfrface->face_flags |= FT_FACE_FLAG_KERNING; /* If no family name was found in the "undocumented" auxiliary * data, use the font ID instead. This sucks but is better than * nothing. */ - root->family_name = phy_font->family_name; - if ( root->family_name == NULL ) - root->family_name = phy_font->font_id; + pfrface->family_name = phy_font->family_name; + if ( pfrface->family_name == NULL ) + pfrface->family_name = phy_font->font_id; /* note that the style name can be NULL in certain PFR fonts, * probably meaning "Regular" */ - root->style_name = phy_font->style_name; + pfrface->style_name = phy_font->style_name; - root->num_fixed_sizes = 0; - root->available_sizes = 0; + pfrface->num_fixed_sizes = 0; + pfrface->available_sizes = 0; - root->bbox = phy_font->bbox; - root->units_per_EM = (FT_UShort)phy_font->outline_resolution; - root->ascender = (FT_Short) phy_font->bbox.yMax; - root->descender = (FT_Short) phy_font->bbox.yMin; - root->height = (FT_Short)( - ( ( root->ascender - root->descender ) * 12 ) / 10 ); + pfrface->bbox = phy_font->bbox; + pfrface->units_per_EM = (FT_UShort)phy_font->outline_resolution; + pfrface->ascender = (FT_Short) phy_font->bbox.yMax; + pfrface->descender = (FT_Short) phy_font->bbox.yMin; + pfrface->height = (FT_Short)( + ( ( pfrface->ascender - pfrface->descender ) * 12 ) / 10 ); if ( phy_font->num_strikes > 0 ) { FT_UInt n, count = phy_font->num_strikes; FT_Bitmap_Size* size; PFR_Strike strike; - FT_Memory memory = root->stream->memory; - - - if ( FT_NEW_ARRAY( root->available_sizes, count ) ) + FT_Memory memory = pfrface->stream->memory; + + + if ( FT_NEW_ARRAY( pfrface->available_sizes, count ) ) goto Exit; - - size = root->available_sizes; + + size = pfrface->available_sizes; strike = phy_font->strikes; for ( n = 0; n < count; n++, size++, strike++ ) { size->height = (FT_UShort)strike->y_ppm; size->width = (FT_UShort)strike->x_ppm; } - root->num_fixed_sizes = count; + pfrface->num_fixed_sizes = count; } /* now compute maximum advance width */ if ( ( phy_font->flags & PFR_PHY_PROPORTIONAL ) == 0 ) - root->max_advance_width = (FT_Short)phy_font->standard_advance; + pfrface->max_advance_width = (FT_Short)phy_font->standard_advance; else { FT_Int max = 0; @@ -204,20 +205,20 @@ max = gchar->advance; } - root->max_advance_width = (FT_Short)max; + pfrface->max_advance_width = (FT_Short)max; } - root->max_advance_height = root->height; + pfrface->max_advance_height = pfrface->height; - root->underline_position = (FT_Short)( - root->units_per_EM / 10 ); - root->underline_thickness = (FT_Short)( root->units_per_EM / 30 ); + pfrface->underline_position = (FT_Short)( -pfrface->units_per_EM / 10 ); + pfrface->underline_thickness = (FT_Short)( pfrface->units_per_EM / 30 ); /* create charmap */ { FT_CharMapRec charmap; - charmap.face = root; + charmap.face = pfrface; charmap.platform_id = 3; charmap.encoding_id = 1; charmap.encoding = FT_ENCODING_UNICODE; @@ -226,14 +227,14 @@ #if 0 /* Select default charmap */ - if (root->num_charmaps) - root->charmap = root->charmaps[0]; + if ( pfrface->num_charmaps ) + pfrface->charmap = pfrface->charmaps[0]; #endif } /* check whether we've loaded any kerning pairs */ if ( phy_font->num_kern_pairs ) - root->face_flags |= FT_FACE_FLAG_KERNING; + pfrface->face_flags |= FT_FACE_FLAG_KERNING; } Exit: @@ -250,9 +251,11 @@ /*************************************************************************/ FT_LOCAL_DEF( FT_Error ) - pfr_slot_init( PFR_Slot slot ) + pfr_slot_init( FT_GlyphSlot pfrslot ) /* PFR_Slot */ { - FT_GlyphLoader loader = slot->root.internal->loader; + PFR_Slot slot = (PFR_Slot)pfrslot; + FT_GlyphLoader loader = pfrslot->internal->loader; + pfr_glyph_init( &slot->glyph, loader ); @@ -261,22 +264,27 @@ FT_LOCAL_DEF( void ) - pfr_slot_done( PFR_Slot slot ) + pfr_slot_done( FT_GlyphSlot pfrslot ) /* PFR_Slot */ { + PFR_Slot slot = (PFR_Slot)pfrslot; + + pfr_glyph_done( &slot->glyph ); } FT_LOCAL_DEF( FT_Error ) - pfr_slot_load( PFR_Slot slot, - PFR_Size size, - FT_UInt gindex, - FT_Int32 load_flags ) + pfr_slot_load( FT_GlyphSlot pfrslot, /* PFR_Slot */ + FT_Size pfrsize, /* PFR_Size */ + FT_UInt gindex, + FT_Int32 load_flags ) { + PFR_Slot slot = (PFR_Slot)pfrslot; + PFR_Size size = (PFR_Size)pfrsize; FT_Error error; - PFR_Face face = (PFR_Face)slot->root.face; + PFR_Face face = (PFR_Face)pfrslot->face; PFR_Char gchar; - FT_Outline* outline = &slot->root.outline; + FT_Outline* outline = &pfrslot->outline; FT_ULong gps_offset; @@ -301,7 +309,7 @@ } gchar = face->phy_font.chars + gindex; - slot->root.format = FT_GLYPH_FORMAT_OUTLINE; + pfrslot->format = FT_GLYPH_FORMAT_OUTLINE; outline->n_points = 0; outline->n_contours = 0; gps_offset = face->header.gps_section_offset; @@ -313,7 +321,7 @@ if ( !error ) { FT_BBox cbox; - FT_Glyph_Metrics* metrics = &slot->root.metrics; + FT_Glyph_Metrics* metrics = &pfrslot->metrics; FT_Pos advance; FT_Int em_metrics, em_outline; FT_Bool scaling; @@ -327,7 +335,7 @@ outline->flags &= ~FT_OUTLINE_OWNER; outline->flags |= FT_OUTLINE_REVERSE_FILL; - if ( size && size->root.metrics.y_ppem < 24 ) + if ( size && pfrsize->metrics.y_ppem < 24 ) outline->flags |= FT_OUTLINE_HIGH_PRECISION; /* compute the advance vector */ @@ -346,13 +354,15 @@ else metrics->horiAdvance = advance; - slot->root.linearHoriAdvance = metrics->horiAdvance; - slot->root.linearVertAdvance = metrics->vertAdvance; + pfrslot->linearHoriAdvance = metrics->horiAdvance; + pfrslot->linearVertAdvance = metrics->vertAdvance; /* make-up vertical metrics(?) */ metrics->vertBearingX = 0; metrics->vertBearingY = 0; +#if 0 /* some fonts seem to be broken here! */ + /* Apply the font matrix, if any. */ /* TODO: Test existing fonts with unusual matrix */ /* whether we have to adjust Units per EM. */ @@ -367,13 +377,14 @@ FT_Outline_Transform( outline, &font_matrix ); } +#endif /* scale when needed */ if ( scaling ) { FT_Int n; - FT_Fixed x_scale = size->root.metrics.x_scale; - FT_Fixed y_scale = size->root.metrics.y_scale; + FT_Fixed x_scale = pfrsize->metrics.x_scale; + FT_Fixed y_scale = pfrsize->metrics.y_scale; FT_Vector* vec = outline->points; @@ -411,46 +422,175 @@ /*************************************************************************/ /*************************************************************************/ - FT_LOCAL_DEF( void ) - pfr_face_get_kerning( PFR_Face face, +#ifdef FT_OPTIMIZE_MEMORY + + FT_LOCAL_DEF( FT_Error ) + pfr_face_get_kerning( FT_Face pfrface, /* PFR_Face */ FT_UInt glyph1, FT_UInt glyph2, FT_Vector* kerning ) { + PFR_Face face = (PFR_Face)pfrface; + FT_Error error = PFR_Err_Ok; + PFR_PhyFont phy_font = &face->phy_font; + FT_UInt32 code1, code2, pair; + + + kerning->x = 0; + kerning->y = 0; + + if ( glyph1 > 0 ) + glyph1--; + + if ( glyph2 > 0 ) + glyph2--; + + /* convert glyph indices to character codes */ + if ( glyph1 > phy_font->num_chars || + glyph2 > phy_font->num_chars ) + goto Exit; + + code1 = phy_font->chars[glyph1].char_code; + code2 = phy_font->chars[glyph2].char_code; + pair = PFR_KERN_INDEX( code1, code2 ); + + /* now search the list of kerning items */ + { + PFR_KernItem item = phy_font->kern_items; + FT_Stream stream = pfrface->stream; + + + for ( ; item; item = item->next ) + { + if ( pair >= item->pair1 && pair <= item->pair2 ) + goto FoundPair; + } + goto Exit; + + FoundPair: /* we found an item, now parse it and find the value if any */ + if ( FT_STREAM_SEEK( item->offset ) || + FT_FRAME_ENTER( item->pair_count * item->pair_size ) ) + goto Exit; + + { + FT_UInt count = item->pair_count; + FT_UInt size = item->pair_size; + FT_UInt power = (FT_UInt)ft_highpow2( (FT_UInt32)count ); + FT_UInt probe = power * size; + FT_UInt extra = count - power; + FT_Byte* base = stream->cursor; + FT_Bool twobytes = item->flags & 1; + FT_Byte* p; + FT_UInt32 cpair; + + + if ( extra > 0 ) + { + p = base + extra * size; + + if ( twobytes ) + cpair = FT_NEXT_ULONG( p ); + else + cpair = PFR_NEXT_KPAIR( p ); + + if ( cpair == pair ) + goto Found; + + if ( cpair < pair ) + base = p; + } + + while ( probe > size ) + { + probe >>= 1; + p = base + probe; + + if ( twobytes ) + cpair = FT_NEXT_ULONG( p ); + else + cpair = PFR_NEXT_KPAIR( p ); + + if ( cpair == pair ) + goto Found; + + if ( cpair < pair ) + base += probe; + } + + p = base; + + if ( twobytes ) + cpair = FT_NEXT_ULONG( p ); + else + cpair = PFR_NEXT_KPAIR( p ); + + if ( cpair == pair ) + { + FT_Int value; + + + Found: + if ( item->flags & 2 ) + value = FT_PEEK_SHORT( p ); + else + value = p[0]; + + kerning->x = item->base_adj + value; + } + } + + FT_FRAME_EXIT(); + } + + Exit: + return error; + } + +#else /* !FT_OPTIMIZE_MEMORY */ + + FT_LOCAL_DEF( FT_Error ) + pfr_face_get_kerning( FT_Face pfrface, /* PFR_Face */ + FT_UInt glyph1, + FT_UInt glyph2, + FT_Vector* kerning ) + { + PFR_Face face = (PFR_Face)pfrface; FT_Error error = PFR_Err_Ok; PFR_PhyFont phy_font = &face->phy_font; PFR_KernPair pairs = phy_font->kern_pairs; FT_UInt32 idx = PFR_KERN_INDEX( glyph1, glyph2 ); FT_UInt min, max; - FT_UNUSED( error ); /* just needed as syntactical sugar */ - kerning->x = 0; kerning->y = 0; min = 0; max = phy_font->num_kern_pairs; - + while ( min < max ) { FT_UInt mid = ( min + max ) >> 1; PFR_KernPair pair = pairs + mid; FT_UInt32 pidx = PFR_KERN_PAIR_INDEX( pair ); - + if ( pidx == idx ) { kerning->x = pair->kerning; break; } - + if ( pidx < idx ) min = mid + 1; else max = mid; } + + return error; } +#endif /* !FT_OPTIMIZE_MEMORY */ + /* END */ diff --git a/src/libs/freetype2/pfr/pfrobjs.h b/src/libs/freetype2/pfr/pfrobjs.h index efd7b7c6d3..f6aa8b44cc 100644 --- a/src/libs/freetype2/pfr/pfrobjs.h +++ b/src/libs/freetype2/pfr/pfrobjs.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (specification). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -58,34 +58,34 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) pfr_face_init( FT_Stream stream, - PFR_Face face, + FT_Face face, /* PFR_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ); FT_LOCAL( void ) - pfr_face_done( PFR_Face face ); + pfr_face_done( FT_Face face ); /* PFR_Face */ - FT_LOCAL( void ) - pfr_face_get_kerning( PFR_Face face, + FT_LOCAL( FT_Error ) + pfr_face_get_kerning( FT_Face face, /* PFR_Face */ FT_UInt glyph1, FT_UInt glyph2, FT_Vector* kerning ); FT_LOCAL( FT_Error ) - pfr_slot_init( PFR_Slot slot ); + pfr_slot_init( FT_GlyphSlot slot ); /* PFR_Slot */ FT_LOCAL( void ) - pfr_slot_done( PFR_Slot slot ); + pfr_slot_done( FT_GlyphSlot slot ); /* PFR_Slot */ FT_LOCAL( FT_Error ) - pfr_slot_load( PFR_Slot slot, - PFR_Size size, - FT_UInt gindex, - FT_Int32 load_flags ); + pfr_slot_load( FT_GlyphSlot slot, /* PFR_Slot */ + FT_Size size, /* PFR_Size */ + FT_UInt gindex, + FT_Int32 load_flags ); FT_END_HEADER diff --git a/src/libs/freetype2/pfr/pfrtypes.h b/src/libs/freetype2/pfr/pfrtypes.h index a10a2b26c8..b8bd557b2e 100644 --- a/src/libs/freetype2/pfr/pfrtypes.h +++ b/src/libs/freetype2/pfr/pfrtypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType PFR data structures (specification only). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -196,22 +196,27 @@ FT_BEGIN_HEADER typedef struct PFR_KernItemRec_ { PFR_KernItem next; - FT_UInt pair_count; + FT_Byte pair_count; + FT_Byte flags; + FT_Short base_adj; FT_UInt pair_size; - FT_Int base_adj; - FT_UInt flags; FT_UInt32 offset; FT_UInt32 pair1; FT_UInt32 pair2; } PFR_KernItemRec; -#define PFR_KERN_INDEX( g1, g2 ) \ - ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) ) -#define PFR_KERN_PAIR_INDEX( pair ) \ +#define PFR_KERN_INDEX( g1, g2 ) \ + ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) ) + +#define PFR_KERN_PAIR_INDEX( pair ) \ PFR_KERN_INDEX( (pair)->glyph1, (pair)->glyph2 ) +#define PFR_NEXT_KPAIR( p ) ( p += 2, \ + ( (FT_UInt32)p[-2] << 16 ) | p[-1] ) + + typedef struct PFR_KernPairRec_ { FT_UInt glyph1; @@ -261,7 +266,9 @@ FT_BEGIN_HEADER FT_UInt num_kern_pairs; PFR_KernItem kern_items; PFR_KernItem* kern_items_tail; +#ifndef FT_OPTIMIZE_MEMORY PFR_KernPair kern_pairs; +#endif /* not part of the spec, but used during load */ FT_UInt32 bct_offset; diff --git a/src/libs/freetype2/psaux/psobjs.c b/src/libs/freetype2/psaux/psobjs.c index 7087ca5aca..2480c3fa26 100644 --- a/src/libs/freetype2/psaux/psobjs.c +++ b/src/libs/freetype2/psaux/psobjs.c @@ -4,7 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -285,7 +285,7 @@ #if 'A' == 65 /* ASCII */ - static const char ft_char_table[128] = + static const char ft_char_table[128] = { /* 0x00 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -306,7 +306,7 @@ #if 'A' == 193 /* EBCDIC */ - static const char ft_char_table[128] = + static const char ft_char_table[128] = { /* 0x80 */ -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1, @@ -429,7 +429,10 @@ } if ( cur < limit && *cur != '>' ) + { + FT_ERROR(( "skip_string: missing closing delimiter `>'\n" )); parser->error = PSaux_Err_Invalid_File_Format; + } else cur++; @@ -492,6 +495,8 @@ cur++; if ( cur >= limit || *cur != '>' ) /* >> */ { + FT_ERROR(( "ps_parser_skip_PS_token: " + "unexpected closing delimiter `>'\n" )); parser->error = PSaux_Err_Invalid_File_Format; goto Exit; } @@ -516,6 +521,8 @@ if ( *cur == ')' ) { + FT_ERROR(( "ps_parser_skip_PS_token: " + "unexpected closing delimiter `)'\n" )); parser->error = PSaux_Err_Invalid_File_Format; goto Exit; } @@ -795,6 +802,7 @@ { if ( *cur != '<' ) { + FT_ERROR(( "ps_tobytes: Missing starting delimiter `<'\n" )); error = PSaux_Err_Invalid_File_Format; goto Exit; } @@ -834,6 +842,7 @@ { if ( cur < limit && *cur != '>' ) { + FT_ERROR(( "ps_tobytes: Missing closing delimiter `>'\n" )); error = PSaux_Err_Invalid_File_Format; goto Exit; } @@ -1255,15 +1264,15 @@ Store_Integer: switch ( field->size ) { - case 1: + case (8 / FT_CHAR_BIT): *(FT_Byte*)q = (FT_Byte)val; break; - case 2: + case (16 / FT_CHAR_BIT): *(FT_UShort*)q = (FT_UShort)val; break; - case 4: + case (32 / FT_CHAR_BIT): *(FT_UInt32*)q = (FT_UInt32)val; break; @@ -1543,7 +1552,7 @@ FT_GlyphSlot glyph, FT_Bool hinting ) { - builder->path_begun = 0; + builder->parse_state = T1_Parse_Start; builder->load_points = 1; builder->face = face; @@ -1700,17 +1709,21 @@ FT_Pos x, FT_Pos y ) { - FT_Error error = 0; + FT_Error error = PSaux_Err_Invalid_File_Format; /* test whether we are building a new contour */ - if ( !builder->path_begun ) + + if ( builder->parse_state == T1_Parse_Have_Path ) + error = PSaux_Err_Ok; + else if ( builder->parse_state == T1_Parse_Have_Moveto ) { - builder->path_begun = 1; + builder->parse_state = T1_Parse_Have_Path; error = t1_builder_add_contour( builder ); if ( !error ) error = t1_builder_add_point1( builder, x, y ); } + return error; } diff --git a/src/libs/freetype2/psaux/t1decode.c b/src/libs/freetype2/psaux/t1decode.c index db1911e7bd..cf4bcc52f6 100644 --- a/src/libs/freetype2/psaux/t1decode.c +++ b/src/libs/freetype2/psaux/t1decode.c @@ -4,7 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -340,7 +340,7 @@ decoder->zone = decoder->zones; zone = decoder->zones; - builder->path_begun = 0; + builder->parse_state = T1_Parse_Start; hinter = (T1_Hints_Funcs)builder->hints_funcs; @@ -556,7 +556,7 @@ decoder->num_flex_vectors = 0; if ( start_point( builder, x, y ) || check_points( builder, 6 ) ) - goto Memory_Error; + goto Fail; break; case 2: /* add flex vectors */ @@ -747,6 +747,8 @@ case op_hsbw: FT_TRACE4(( " hsbw" )); + builder->parse_state = T1_Parse_Have_Width; + builder->left_bearing.x += top[0]; builder->advance.x = top[1]; builder->advance.y = 0; @@ -772,6 +774,8 @@ case op_sbw: FT_TRACE4(( " sbw" )); + builder->parse_state = T1_Parse_Have_Width; + builder->left_bearing.x += top[0]; builder->left_bearing.y += top[1]; builder->advance.x = top[2]; @@ -792,14 +796,17 @@ FT_TRACE4(( " closepath" )); close_contour( builder ); - builder->path_begun = 0; + if ( !( builder->parse_state == T1_Parse_Have_Path || + builder->parse_state == T1_Parse_Have_Moveto ) ) + goto Syntax_Error; + builder->parse_state = T1_Parse_Have_Width; break; case op_hlineto: FT_TRACE4(( " hlineto" )); if ( start_point( builder, x, y ) ) - goto Memory_Error; + goto Fail; x += top[0]; goto Add_Line; @@ -809,7 +816,11 @@ x += top[0]; if ( !decoder->flex_state ) - builder->path_begun = 0; + { + if ( builder->parse_state == T1_Parse_Start ) + goto Syntax_Error; + builder->parse_state = T1_Parse_Have_Moveto; + } break; case op_hvcurveto: @@ -817,7 +828,7 @@ if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) - goto Memory_Error; + goto Fail; x += top[0]; add_point( builder, x, y, 0 ); @@ -832,14 +843,14 @@ FT_TRACE4(( " rlineto" )); if ( start_point( builder, x, y ) ) - goto Memory_Error; + goto Fail; x += top[0]; y += top[1]; Add_Line: if ( add_point1( builder, x, y ) ) - goto Memory_Error; + goto Fail; break; case op_rmoveto: @@ -848,7 +859,11 @@ x += top[0]; y += top[1]; if ( !decoder->flex_state ) - builder->path_begun = 0; + { + if ( builder->parse_state == T1_Parse_Start ) + goto Syntax_Error; + builder->parse_state = T1_Parse_Have_Moveto; + } break; case op_rrcurveto: @@ -856,7 +871,7 @@ if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) - goto Memory_Error; + goto Fail; x += top[0]; y += top[1]; @@ -876,7 +891,7 @@ if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) - goto Memory_Error; + goto Fail; y += top[0]; add_point( builder, x, y, 0 ); @@ -891,7 +906,7 @@ FT_TRACE4(( " vlineto" )); if ( start_point( builder, x, y ) ) - goto Memory_Error; + goto Fail; y += top[0]; goto Add_Line; @@ -901,7 +916,11 @@ y += top[0]; if ( !decoder->flex_state ) - builder->path_begun = 0; + { + if ( builder->parse_state == T1_Parse_Start ) + goto Syntax_Error; + builder->parse_state = T1_Parse_Have_Moveto; + } break; case op_div: @@ -1072,6 +1091,7 @@ FT_TRACE4(( "..end..\n\n" )); + Fail: return error; Syntax_Error: @@ -1079,9 +1099,6 @@ Stack_Underflow: return PSaux_Err_Stack_Underflow; - - Memory_Error: - return builder->error; } diff --git a/src/libs/freetype2/pshinter/pshalgo.c b/src/libs/freetype2/pshinter/pshalgo.c index 5f077d54d1..8bf9c6a9eb 100644 --- a/src/libs/freetype2/pshinter/pshalgo.c +++ b/src/libs/freetype2/pshinter/pshalgo.c @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (body). */ /* */ -/* Copyright 2001, 2002, 2003, 2004 by */ +/* Copyright 2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -2031,7 +2031,8 @@ scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale ); fitted = FT_PIX_ROUND( scaled ); - if (scaled != fitted ) { + if ( fitted != 0 && scaled != fitted ) + { y_scale = FT_MulDiv( y_scale, fitted, scaled ); if ( fitted < scaled ) diff --git a/src/libs/freetype2/psnames/psmodule.c b/src/libs/freetype2/psnames/psmodule.c index f6d6ae3285..ba9deae8aa 100644 --- a/src/libs/freetype2/psnames/psmodule.c +++ b/src/libs/freetype2/psnames/psmodule.c @@ -4,7 +4,7 @@ /* */ /* PSNames module implementation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,18 +32,13 @@ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - /* return the Unicode value corresponding to a given glyph. Note that */ + /* Return the Unicode value corresponding to a given glyph. Note that */ /* we do deal with glyph variants by detecting a non-initial dot in */ - /* the name, as in `A.swash' or `e.final', etc. */ + /* the name, as in `A.swash' or `e.final'. */ /* */ static FT_UInt32 ps_unicode_value( const char* glyph_name ) { - FT_Int n; - char first = glyph_name[0]; - char temp[64]; - - /* If the name begins with `uni', then the glyph name may be a */ /* hard-coded unicode character code. */ if ( glyph_name[0] == 'u' && @@ -127,37 +122,22 @@ /* look for a non-initial dot in the glyph name in order to */ /* sort-out variants like `A.swash', `e.final', etc. */ { - const char* p; - int len; + const char* p = glyph_name; + const char* dot = NULL; - p = glyph_name; - - while ( *p && *p != '.' ) - p++; - - len = (int)( p - glyph_name ); - - if ( *p && len < 64 ) + for ( ; *p; p++ ) { - ft_strncpy( temp, glyph_name, len ); - temp[len] = 0; - glyph_name = temp; + if ( *p == '.' && p > glyph_name && !dot ) + dot = p; } + + if ( !dot ) + dot = p; + + /* now, look up the glyph in the Adobe Glyph List */ + return ft_get_adobe_glyph_index( glyph_name, dot ); } - - /* now, look up the glyph in the Adobe Glyph List */ - for ( n = 0; n < NUM_ADOBE_GLYPHS; n++ ) - { - const char* name = sid_standard_names[n]; - - - if ( first == name[0] && ft_strcmp( glyph_name, name ) == 0 ) - return ps_names_to_unicode[n]; - } - - /* not found, there is probably no Unicode value for this glyph name */ - return 0; } @@ -320,17 +300,20 @@ static const char* ps_get_macintosh_name( FT_UInt name_index ) { - if ( name_index >= 258 ) + if ( name_index >= FT_NUM_MAC_NAMES ) name_index = 0; - return ps_glyph_names[mac_standard_names[name_index]]; + return ft_standard_glyph_names + ft_mac_names[name_index]; } static const char* ps_get_standard_strings( FT_UInt sid ) { - return ( sid < NUM_SID_GLYPHS ? sid_standard_names[sid] : 0 ); + if ( sid >= FT_NUM_SID_NAMES ) + return 0; + + return ft_standard_glyph_names + ft_sid_names[sid]; } diff --git a/src/libs/freetype2/psnames/pstables.h b/src/libs/freetype2/psnames/pstables.h index 7c07393757..cc40ef735d 100644 --- a/src/libs/freetype2/psnames/pstables.h +++ b/src/libs/freetype2/psnames/pstables.h @@ -1,10 +1,10 @@ /***************************************************************************/ /* */ -/* pstables.h.new */ +/* pstables.h */ /* */ -/* PostScript glyph names (specification only). */ +/* PostScript glyph names. */ /* */ -/* Copyright 2000-2001, 2003 by */ +/* Copyright 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,9422 +16,4075 @@ /***************************************************************************/ - /* this file has been generated automatically -- do not edit! */ + /* This file has been generated automatically -- do not edit! */ - static const char* const ps_glyph_names[] = + static const char ft_standard_glyph_names[3696] = { - ".null", - "nonmarkingreturn", - ".notdef", - "space", - "exclam", - "quotedbl", - "numbersign", - "dollar", - "percent", - "ampersand", - "quoteright", - "parenleft", - "parenright", - "asterisk", - "plus", - "comma", - "hyphen", - "period", - "slash", - "zero", - "one", - "two", - "three", - "four", - "five", - "six", - "seven", - "eight", - "nine", - "colon", - "semicolon", - "less", - "equal", - "greater", - "question", - "at", - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "bracketleft", - "backslash", - "bracketright", - "asciicircum", - "underscore", - "quoteleft", - "a", - "b", - "c", - "d", - "e", - "f", - "g", - "h", - "i", - "j", - "k", - "l", - "m", - "n", - "o", - "p", - "q", - "r", - "s", - "t", - "u", - "v", - "w", - "x", - "y", - "z", - "braceleft", - "bar", - "braceright", - "asciitilde", - "exclamdown", - "cent", - "sterling", - "fraction", - "yen", - "florin", - "section", - "currency", - "quotesingle", - "quotedblleft", - "guillemotleft", - "guilsinglleft", - "guilsinglright", - "fi", - "fl", - "endash", - "dagger", - "daggerdbl", - "periodcentered", - "paragraph", - "bullet", - "quotesinglbase", - "quotedblbase", - "quotedblright", - "guillemotright", - "ellipsis", - "perthousand", - "questiondown", - "grave", - "acute", - "circumflex", - "tilde", - "macron", - "breve", - "dotaccent", - "dieresis", - "ring", - "cedilla", - "hungarumlaut", - "ogonek", - "caron", - "emdash", - "AE", - "ordfeminine", - "Lslash", - "Oslash", - "OE", - "ordmasculine", - "ae", - "dotlessi", - "lslash", - "oslash", - "oe", - "germandbls", - "onesuperior", - "logicalnot", - "mu", - "trademark", - "Eth", - "onehalf", - "plusminus", - "Thorn", - "onequarter", - "divide", - "brokenbar", - "degree", - "thorn", - "threequarters", - "twosuperior", - "registered", - "minus", - "eth", - "multiply", - "threesuperior", - "copyright", - "Aacute", - "Acircumflex", - "Adieresis", - "Agrave", - "Aring", - "Atilde", - "Ccedilla", - "Eacute", - "Ecircumflex", - "Edieresis", - "Egrave", - "Iacute", - "Icircumflex", - "Idieresis", - "Igrave", - "Ntilde", - "Oacute", - "Ocircumflex", - "Odieresis", - "Ograve", - "Otilde", - "Scaron", - "Uacute", - "Ucircumflex", - "Udieresis", - "Ugrave", - "Yacute", - "Ydieresis", - "Zcaron", - "aacute", - "acircumflex", - "adieresis", - "agrave", - "aring", - "atilde", - "ccedilla", - "eacute", - "ecircumflex", - "edieresis", - "egrave", - "iacute", - "icircumflex", - "idieresis", - "igrave", - "ntilde", - "oacute", - "ocircumflex", - "odieresis", - "ograve", - "otilde", - "scaron", - "uacute", - "ucircumflex", - "udieresis", - "ugrave", - "yacute", - "ydieresis", - "zcaron", - "exclamsmall", - "Hungarumlautsmall", - "dollaroldstyle", - "dollarsuperior", - "ampersandsmall", - "Acutesmall", - "parenleftsuperior", - "parenrightsuperior", - "twodotenleader", - "onedotenleader", - "zerooldstyle", - "oneoldstyle", - "twooldstyle", - "threeoldstyle", - "fouroldstyle", - "fiveoldstyle", - "sixoldstyle", - "sevenoldstyle", - "eightoldstyle", - "nineoldstyle", - "commasuperior", - "threequartersemdash", - "periodsuperior", - "questionsmall", - "asuperior", - "bsuperior", - "centsuperior", - "dsuperior", - "esuperior", - "isuperior", - "lsuperior", - "msuperior", - "nsuperior", - "osuperior", - "rsuperior", - "ssuperior", - "tsuperior", - "ff", - "ffi", - "ffl", - "parenleftinferior", - "parenrightinferior", - "Circumflexsmall", - "hyphensuperior", - "Gravesmall", - "Asmall", - "Bsmall", - "Csmall", - "Dsmall", - "Esmall", - "Fsmall", - "Gsmall", - "Hsmall", - "Ismall", - "Jsmall", - "Ksmall", - "Lsmall", - "Msmall", - "Nsmall", - "Osmall", - "Psmall", - "Qsmall", - "Rsmall", - "Ssmall", - "Tsmall", - "Usmall", - "Vsmall", - "Wsmall", - "Xsmall", - "Ysmall", - "Zsmall", - "colonmonetary", - "onefitted", - "rupiah", - "Tildesmall", - "exclamdownsmall", - "centoldstyle", - "Lslashsmall", - "Scaronsmall", - "Zcaronsmall", - "Dieresissmall", - "Brevesmall", - "Caronsmall", - "Dotaccentsmall", - "Macronsmall", - "figuredash", - "hypheninferior", - "Ogoneksmall", - "Ringsmall", - "Cedillasmall", - "questiondownsmall", - "oneeighth", - "threeeighths", - "fiveeighths", - "seveneighths", - "onethird", - "twothirds", - "zerosuperior", - "foursuperior", - "fivesuperior", - "sixsuperior", - "sevensuperior", - "eightsuperior", - "ninesuperior", - "zeroinferior", - "oneinferior", - "twoinferior", - "threeinferior", - "fourinferior", - "fiveinferior", - "sixinferior", - "seveninferior", - "eightinferior", - "nineinferior", - "centinferior", - "dollarinferior", - "periodinferior", - "commainferior", - "Agravesmall", - "Aacutesmall", - "Acircumflexsmall", - "Atildesmall", - "Adieresissmall", - "Aringsmall", - "AEsmall", - "Ccedillasmall", - "Egravesmall", - "Eacutesmall", - "Ecircumflexsmall", - "Edieresissmall", - "Igravesmall", - "Iacutesmall", - "Icircumflexsmall", - "Idieresissmall", - "Ethsmall", - "Ntildesmall", - "Ogravesmall", - "Oacutesmall", - "Ocircumflexsmall", - "Otildesmall", - "Odieresissmall", - "OEsmall", - "Oslashsmall", - "Ugravesmall", - "Uacutesmall", - "Ucircumflexsmall", - "Udieresissmall", - "Yacutesmall", - "Thornsmall", - "Ydieresissmall", - "001.000", - "001.001", - "001.002", - "001.003", - "Black", - "Bold", - "Book", - "Light", - "Medium", - "Regular", - "Roman", - "Semibold", - -#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - - "AEacute", - "AEmacron", - "Abreve", - "Abreveacute", - "Abrevecyrillic", - "Abrevedotbelow", - "Abrevegrave", - "Abrevehookabove", - "Abrevetilde", - "Acaron", - "Acircle", - "Acircumflexacute", - "Acircumflexdotbelow", - "Acircumflexgrave", - "Acircumflexhookabove", - "Acircumflextilde", - "Acute", - "Acyrillic", - "Adblgrave", - "Adieresiscyrillic", - "Adieresismacron", - "Adotbelow", - "Adotmacron", - "Ahookabove", - "Aiecyrillic", - "Ainvertedbreve", - "Alpha", - "Alphatonos", - "Amacron", - "Amonospace", - "Aogonek", - "Aringacute", - "Aringbelow", - "Aybarmenian", - "Bcircle", - "Bdotaccent", - "Bdotbelow", - "Becyrillic", - "Benarmenian", - "Beta", - "Bhook", - "Blinebelow", - "Bmonospace", - "Btopbar", - "Caarmenian", - "Cacute", - "Caron", - "Ccaron", - "Ccedillaacute", - "Ccircle", - "Ccircumflex", - "Cdot", - "Cdotaccent", - "Chaarmenian", - "Cheabkhasiancyrillic", - "Checyrillic", - "Chedescenderabkhasiancyrillic", - "Chedescendercyrillic", - "Chedieresiscyrillic", - "Cheharmenian", - "Chekhakassiancyrillic", - "Cheverticalstrokecyrillic", - "Chi", - "Chook", - "Cmonospace", - "Coarmenian", - "DZ", - "DZcaron", - "Daarmenian", - "Dafrican", - "Dcaron", - "Dcedilla", - "Dcircle", - "Dcircumflexbelow", - "Dcroat", - "Ddotaccent", - "Ddotbelow", - "Decyrillic", - "Deicoptic", - "Delta", - "Deltagreek", - "Dhook", - "Dieresis", - "DieresisAcute", - "DieresisGrave", - "Digammagreek", - "Djecyrillic", - "Dlinebelow", - "Dmonospace", - "Dslash", - "Dtopbar", - "Dz", - "Dzcaron", - "Dzeabkhasiancyrillic", - "Dzecyrillic", - "Dzhecyrillic", - "Ebreve", - "Ecaron", - "Ecedillabreve", - "Echarmenian", - "Ecircle", - "Ecircumflexacute", - "Ecircumflexbelow", - "Ecircumflexdotbelow", - "Ecircumflexgrave", - "Ecircumflexhookabove", - "Ecircumflextilde", - "Ecyrillic", - "Edblgrave", - "Edot", - "Edotaccent", - "Edotbelow", - "Efcyrillic", - "Eharmenian", - "Ehookabove", - "Eightroman", - "Einvertedbreve", - "Eiotifiedcyrillic", - "Elcyrillic", - "Elevenroman", - "Emacron", - "Emacronacute", - "Emacrongrave", - "Emcyrillic", - "Emonospace", - "Encyrillic", - "Endescendercyrillic", - "Eng", - "Enghecyrillic", - "Enhookcyrillic", - "Eogonek", - "Eopen", - "Epsilon", - "Epsilontonos", - "Ercyrillic", - "Ereversed", - "Ereversedcyrillic", - "Escyrillic", - "Esdescendercyrillic", - "Esh", - "Eta", - "Etarmenian", - "Etatonos", - "Etilde", - "Etildebelow", - "Euro", - "Ezh", - "Ezhcaron", - "Ezhreversed", - "Fcircle", - "Fdotaccent", - "Feharmenian", - "Feicoptic", - "Fhook", - "Fitacyrillic", - "Fiveroman", - "Fmonospace", - "Fourroman", - "GBsquare", - "Gacute", - "Gamma", - "Gammaafrican", - "Gangiacoptic", - "Gbreve", - "Gcaron", - "Gcedilla", - "Gcircle", - "Gcircumflex", - "Gcommaaccent", - "Gdot", - "Gdotaccent", - "Gecyrillic", - "Ghadarmenian", - "Ghemiddlehookcyrillic", - "Ghestrokecyrillic", - "Gheupturncyrillic", - "Ghook", - "Gimarmenian", - "Gjecyrillic", - "Gmacron", - "Gmonospace", - "Grave", - "Gsmallhook", - "Gstroke", - "H18533", - "H18543", - "H18551", - "H22073", - "HPsquare", - "Haabkhasiancyrillic", - "Hadescendercyrillic", - "Hardsigncyrillic", - "Hbar", - "Hbrevebelow", - "Hcedilla", - "Hcircle", - "Hcircumflex", - "Hdieresis", - "Hdotaccent", - "Hdotbelow", - "Hmonospace", - "Hoarmenian", - "Horicoptic", - "Hungarumlaut", - "Hzsquare", - "IAcyrillic", - "IJ", - "IUcyrillic", - "Ibreve", - "Icaron", - "Icircle", - "Icyrillic", - "Idblgrave", - "Idieresisacute", - "Idieresiscyrillic", - "Idot", - "Idotaccent", - "Idotbelow", - "Iebrevecyrillic", - "Iecyrillic", - "Ifraktur", - "Ihookabove", - "Iicyrillic", - "Iinvertedbreve", - "Iishortcyrillic", - "Imacron", - "Imacroncyrillic", - "Imonospace", - "Iniarmenian", - "Iocyrillic", - "Iogonek", - "Iota", - "Iotaafrican", - "Iotadieresis", - "Iotatonos", - "Istroke", - "Itilde", - "Itildebelow", - "Izhitsacyrillic", - "Izhitsadblgravecyrillic", - "Jaarmenian", - "Jcircle", - "Jcircumflex", - "Jecyrillic", - "Jheharmenian", - "Jmonospace", - "KBsquare", - "KKsquare", - "Kabashkircyrillic", - "Kacute", - "Kacyrillic", - "Kadescendercyrillic", - "Kahookcyrillic", - "Kappa", - "Kastrokecyrillic", - "Kaverticalstrokecyrillic", - "Kcaron", - "Kcedilla", - "Kcircle", - "Kcommaaccent", - "Kdotbelow", - "Keharmenian", - "Kenarmenian", - "Khacyrillic", - "Kheicoptic", - "Khook", - "Kjecyrillic", - "Klinebelow", - "Kmonospace", - "Koppacyrillic", - "Koppagreek", - "Ksicyrillic", - "LJ", - "LL", - "Lacute", - "Lambda", - "Lcaron", - "Lcedilla", - "Lcircle", - "Lcircumflexbelow", - "Lcommaaccent", - "Ldot", - "Ldotaccent", - "Ldotbelow", - "Ldotbelowmacron", - "Liwnarmenian", - "Lj", - "Ljecyrillic", - "Llinebelow", - "Lmonospace", - "MBsquare", - "Macron", - "Macute", - "Mcircle", - "Mdotaccent", - "Mdotbelow", - "Menarmenian", - "Mmonospace", - "Mturned", - "Mu", - "NJ", - "Nacute", - "Ncaron", - "Ncedilla", - "Ncircle", - "Ncircumflexbelow", - "Ncommaaccent", - "Ndotaccent", - "Ndotbelow", - "Nhookleft", - "Nineroman", - "Nj", - "Njecyrillic", - "Nlinebelow", - "Nmonospace", - "Nowarmenian", - "Nu", - "Obarredcyrillic", - "Obarreddieresiscyrillic", - "Obreve", - "Ocaron", - "Ocenteredtilde", - "Ocircle", - "Ocircumflexacute", - "Ocircumflexdotbelow", - "Ocircumflexgrave", - "Ocircumflexhookabove", - "Ocircumflextilde", - "Ocyrillic", - "Odblacute", - "Odblgrave", - "Odieresiscyrillic", - "Odotbelow", - "Oharmenian", - "Ohm", - "Ohookabove", - "Ohorn", - "Ohornacute", - "Ohorndotbelow", - "Ohorngrave", - "Ohornhookabove", - "Ohorntilde", - "Ohungarumlaut", - "Oi", - "Oinvertedbreve", - "Omacron", - "Omacronacute", - "Omacrongrave", - "Omega", - "Omegacyrillic", - "Omegagreek", - "Omegaroundcyrillic", - "Omegatitlocyrillic", - "Omegatonos", - "Omicron", - "Omicrontonos", - "Omonospace", - "Oneroman", - "Oogonek", - "Oogonekmacron", - "Oopen", - "Oslashacute", - "Ostrokeacute", - "Otcyrillic", - "Otildeacute", - "Otildedieresis", - "Pacute", - "Pcircle", - "Pdotaccent", - "Pecyrillic", - "Peharmenian", - "Pemiddlehookcyrillic", - "Phi", - "Phook", - "Pi", - "Piwrarmenian", - "Pmonospace", - "Psi", - "Psicyrillic", - "Qcircle", - "Qmonospace", - "Raarmenian", - "Racute", - "Rcaron", - "Rcedilla", - "Rcircle", - "Rcommaaccent", - "Rdblgrave", - "Rdotaccent", - "Rdotbelow", - "Rdotbelowmacron", - "Reharmenian", - "Rfraktur", - "Rho", - "Rinvertedbreve", - "Rlinebelow", - "Rmonospace", - "Rsmallinverted", - "Rsmallinvertedsuperior", - "SF010000", - "SF020000", - "SF030000", - "SF040000", - "SF050000", - "SF060000", - "SF070000", - "SF080000", - "SF090000", - "SF100000", - "SF110000", - "SF190000", - "SF200000", - "SF210000", - "SF220000", - "SF230000", - "SF240000", - "SF250000", - "SF260000", - "SF270000", - "SF280000", - "SF360000", - "SF370000", - "SF380000", - "SF390000", - "SF400000", - "SF410000", - "SF420000", - "SF430000", - "SF440000", - "SF450000", - "SF460000", - "SF470000", - "SF480000", - "SF490000", - "SF500000", - "SF510000", - "SF520000", - "SF530000", - "SF540000", - "Sacute", - "Sacutedotaccent", - "Sampigreek", - "Scarondotaccent", - "Scedilla", - "Schwa", - "Schwacyrillic", - "Schwadieresiscyrillic", - "Scircle", - "Scircumflex", - "Scommaaccent", - "Sdotaccent", - "Sdotbelow", - "Sdotbelowdotaccent", - "Seharmenian", - "Sevenroman", - "Shaarmenian", - "Shacyrillic", - "Shchacyrillic", - "Sheicoptic", - "Shhacyrillic", - "Shimacoptic", - "Sigma", - "Sixroman", - "Smonospace", - "Softsigncyrillic", - "Stigmagreek", - "Tau", - "Tbar", - "Tcaron", - "Tcedilla", - "Tcircle", - "Tcircumflexbelow", - "Tcommaaccent", - "Tdotaccent", - "Tdotbelow", - "Tecyrillic", - "Tedescendercyrillic", - "Tenroman", - "Tetsecyrillic", - "Theta", - "Thook", - "Threeroman", - "Tiwnarmenian", - "Tlinebelow", - "Tmonospace", - "Toarmenian", - "Tonefive", - "Tonesix", - "Tonetwo", - "Tretroflexhook", - "Tsecyrillic", - "Tshecyrillic", - "Twelveroman", - "Tworoman", - "Ubreve", - "Ucaron", - "Ucircle", - "Ucircumflexbelow", - "Ucyrillic", - "Udblacute", - "Udblgrave", - "Udieresisacute", - "Udieresisbelow", - "Udieresiscaron", - "Udieresiscyrillic", - "Udieresisgrave", - "Udieresismacron", - "Udotbelow", - "Uhookabove", - "Uhorn", - "Uhornacute", - "Uhorndotbelow", - "Uhorngrave", - "Uhornhookabove", - "Uhorntilde", - "Uhungarumlaut", - "Uhungarumlautcyrillic", - "Uinvertedbreve", - "Ukcyrillic", - "Umacron", - "Umacroncyrillic", - "Umacrondieresis", - "Umonospace", - "Uogonek", - "Upsilon", - "Upsilon1", - "Upsilonacutehooksymbolgreek", - "Upsilonafrican", - "Upsilondieresis", - "Upsilondieresishooksymbolgreek", - "Upsilonhooksymbol", - "Upsilontonos", - "Uring", - "Ushortcyrillic", - "Ustraightcyrillic", - "Ustraightstrokecyrillic", - "Utilde", - "Utildeacute", - "Utildebelow", - "Vcircle", - "Vdotbelow", - "Vecyrillic", - "Vewarmenian", - "Vhook", - "Vmonospace", - "Voarmenian", - "Vtilde", - "Wacute", - "Wcircle", - "Wcircumflex", - "Wdieresis", - "Wdotaccent", - "Wdotbelow", - "Wgrave", - "Wmonospace", - "Xcircle", - "Xdieresis", - "Xdotaccent", - "Xeharmenian", - "Xi", - "Xmonospace", - "Yatcyrillic", - "Ycircle", - "Ycircumflex", - "Ydotaccent", - "Ydotbelow", - "Yericyrillic", - "Yerudieresiscyrillic", - "Ygrave", - "Yhook", - "Yhookabove", - "Yiarmenian", - "Yicyrillic", - "Yiwnarmenian", - "Ymonospace", - "Ytilde", - "Yusbigcyrillic", - "Yusbigiotifiedcyrillic", - "Yuslittlecyrillic", - "Yuslittleiotifiedcyrillic", - "Zaarmenian", - "Zacute", - "Zcircle", - "Zcircumflex", - "Zdot", - "Zdotaccent", - "Zdotbelow", - "Zecyrillic", - "Zedescendercyrillic", - "Zedieresiscyrillic", - "Zeta", - "Zhearmenian", - "Zhebrevecyrillic", - "Zhecyrillic", - "Zhedescendercyrillic", - "Zhedieresiscyrillic", - "Zlinebelow", - "Zmonospace", - "Zstroke", - "aabengali", - "aadeva", - "aagujarati", - "aagurmukhi", - "aamatragurmukhi", - "aarusquare", - "aavowelsignbengali", - "aavowelsigndeva", - "aavowelsigngujarati", - "abbreviationmarkarmenian", - "abbreviationsigndeva", - "abengali", - "abopomofo", - "abreve", - "abreveacute", - "abrevecyrillic", - "abrevedotbelow", - "abrevegrave", - "abrevehookabove", - "abrevetilde", - "acaron", - "acircle", - "acircumflexacute", - "acircumflexdotbelow", - "acircumflexgrave", - "acircumflexhookabove", - "acircumflextilde", - "acutebelowcmb", - "acutecmb", - "acutecomb", - "acutedeva", - "acutelowmod", - "acutetonecmb", - "acyrillic", - "adblgrave", - "addakgurmukhi", - "adeva", - "adieresiscyrillic", - "adieresismacron", - "adotbelow", - "adotmacron", - "aeacute", - "aekorean", - "aemacron", - "afii00208", - "afii08941", - "afii10017", - "afii10018", - "afii10019", - "afii10020", - "afii10021", - "afii10022", - "afii10023", - "afii10024", - "afii10025", - "afii10026", - "afii10027", - "afii10028", - "afii10029", - "afii10030", - "afii10031", - "afii10032", - "afii10033", - "afii10034", - "afii10035", - "afii10036", - "afii10037", - "afii10038", - "afii10039", - "afii10040", - "afii10041", - "afii10042", - "afii10043", - "afii10044", - "afii10045", - "afii10046", - "afii10047", - "afii10048", - "afii10049", - "afii10050", - "afii10051", - "afii10052", - "afii10053", - "afii10054", - "afii10055", - "afii10056", - "afii10057", - "afii10058", - "afii10059", - "afii10060", - "afii10061", - "afii10062", - "afii10063", - "afii10064", - "afii10065", - "afii10066", - "afii10067", - "afii10068", - "afii10069", - "afii10070", - "afii10071", - "afii10072", - "afii10073", - "afii10074", - "afii10075", - "afii10076", - "afii10077", - "afii10078", - "afii10079", - "afii10080", - "afii10081", - "afii10082", - "afii10083", - "afii10084", - "afii10085", - "afii10086", - "afii10087", - "afii10088", - "afii10089", - "afii10090", - "afii10091", - "afii10092", - "afii10093", - "afii10094", - "afii10095", - "afii10096", - "afii10097", - "afii10098", - "afii10099", - "afii10100", - "afii10101", - "afii10102", - "afii10103", - "afii10104", - "afii10105", - "afii10106", - "afii10107", - "afii10108", - "afii10109", - "afii10110", - "afii10145", - "afii10146", - "afii10147", - "afii10148", - "afii10192", - "afii10193", - "afii10194", - "afii10195", - "afii10196", - "afii10831", - "afii10832", - "afii10846", - "afii299", - "afii300", - "afii301", - "afii57381", - "afii57388", - "afii57392", - "afii57393", - "afii57394", - "afii57395", - "afii57396", - "afii57397", - "afii57398", - "afii57399", - "afii57400", - "afii57401", - "afii57403", - "afii57407", - "afii57409", - "afii57410", - "afii57411", - "afii57412", - "afii57413", - "afii57414", - "afii57415", - "afii57416", - "afii57417", - "afii57418", - "afii57419", - "afii57420", - "afii57421", - "afii57422", - "afii57423", - "afii57424", - "afii57425", - "afii57426", - "afii57427", - "afii57428", - "afii57429", - "afii57430", - "afii57431", - "afii57432", - "afii57433", - "afii57434", - "afii57440", - "afii57441", - "afii57442", - "afii57443", - "afii57444", - "afii57445", - "afii57446", - "afii57448", - "afii57449", - "afii57450", - "afii57451", - "afii57452", - "afii57453", - "afii57454", - "afii57455", - "afii57456", - "afii57457", - "afii57458", - "afii57470", - "afii57505", - "afii57506", - "afii57507", - "afii57508", - "afii57509", - "afii57511", - "afii57512", - "afii57513", - "afii57514", - "afii57519", - "afii57534", - "afii57636", - "afii57645", - "afii57658", - "afii57664", - "afii57665", - "afii57666", - "afii57667", - "afii57668", - "afii57669", - "afii57670", - "afii57671", - "afii57672", - "afii57673", - "afii57674", - "afii57675", - "afii57676", - "afii57677", - "afii57678", - "afii57679", - "afii57680", - "afii57681", - "afii57682", - "afii57683", - "afii57684", - "afii57685", - "afii57686", - "afii57687", - "afii57688", - "afii57689", - "afii57690", - "afii57694", - "afii57695", - "afii57700", - "afii57705", - "afii57716", - "afii57717", - "afii57718", - "afii57723", - "afii57793", - "afii57794", - "afii57795", - "afii57796", - "afii57797", - "afii57798", - "afii57799", - "afii57800", - "afii57801", - "afii57802", - "afii57803", - "afii57804", - "afii57806", - "afii57807", - "afii57839", - "afii57841", - "afii57842", - "afii57929", - "afii61248", - "afii61289", - "afii61352", - "afii61573", - "afii61574", - "afii61575", - "afii61664", - "afii63167", - "afii64937", - "agujarati", - "agurmukhi", - "ahiragana", - "ahookabove", - "aibengali", - "aibopomofo", - "aideva", - "aiecyrillic", - "aigujarati", - "aigurmukhi", - "aimatragurmukhi", - "ainarabic", - "ainfinalarabic", - "aininitialarabic", - "ainmedialarabic", - "ainvertedbreve", - "aivowelsignbengali", - "aivowelsigndeva", - "aivowelsigngujarati", - "akatakana", - "akatakanahalfwidth", - "akorean", - "alef", - "alefarabic", - "alefdageshhebrew", - "aleffinalarabic", - "alefhamzaabovearabic", - "alefhamzaabovefinalarabic", - "alefhamzabelowarabic", - "alefhamzabelowfinalarabic", - "alefhebrew", - "aleflamedhebrew", - "alefmaddaabovearabic", - "alefmaddaabovefinalarabic", - "alefmaksuraarabic", - "alefmaksurafinalarabic", - "alefmaksurainitialarabic", - "alefmaksuramedialarabic", - "alefpatahhebrew", - "alefqamatshebrew", - "aleph", - "allequal", - "alpha", - "alphatonos", - "amacron", - "amonospace", - "ampersandmonospace", - "amsquare", - "anbopomofo", - "angbopomofo", - "angkhankhuthai", - "angle", - "anglebracketleft", - "anglebracketleftvertical", - "anglebracketright", - "anglebracketrightvertical", - "angleleft", - "angleright", - "angstrom", - "anoteleia", - "anudattadeva", - "anusvarabengali", - "anusvaradeva", - "anusvaragujarati", - "aogonek", - "apaatosquare", - "aparen", - "apostrophearmenian", - "apostrophemod", - "apple", - "approaches", - "approxequal", - "approxequalorimage", - "approximatelyequal", - "araeaekorean", - "araeakorean", - "arc", - "arighthalfring", - "aringacute", - "aringbelow", - "arrowboth", - "arrowdashdown", - "arrowdashleft", - "arrowdashright", - "arrowdashup", - "arrowdblboth", - "arrowdbldown", - "arrowdblleft", - "arrowdblright", - "arrowdblup", - "arrowdown", - "arrowdownleft", - "arrowdownright", - "arrowdownwhite", - "arrowheaddownmod", - "arrowheadleftmod", - "arrowheadrightmod", - "arrowheadupmod", - "arrowhorizex", - "arrowleft", - "arrowleftdbl", - "arrowleftdblstroke", - "arrowleftoverright", - "arrowleftwhite", - "arrowright", - "arrowrightdblstroke", - "arrowrightheavy", - "arrowrightoverleft", - "arrowrightwhite", - "arrowtableft", - "arrowtabright", - "arrowup", - "arrowupdn", - "arrowupdnbse", - "arrowupdownbase", - "arrowupleft", - "arrowupleftofdown", - "arrowupright", - "arrowupwhite", - "arrowvertex", - "asciicircummonospace", - "asciitildemonospace", - "ascript", - "ascriptturned", - "asmallhiragana", - "asmallkatakana", - "asmallkatakanahalfwidth", - "asteriskaltonearabic", - "asteriskarabic", - "asteriskmath", - "asteriskmonospace", - "asterisksmall", - "asterism", - "asymptoticallyequal", - "atmonospace", - "atsmall", - "aturned", - "aubengali", - "aubopomofo", - "audeva", - "augujarati", - "augurmukhi", - "aulengthmarkbengali", - "aumatragurmukhi", - "auvowelsignbengali", - "auvowelsigndeva", - "auvowelsigngujarati", - "avagrahadeva", - "aybarmenian", - "ayin", - "ayinaltonehebrew", - "ayinhebrew", - "babengali", - "backslashmonospace", - "badeva", - "bagujarati", - "bagurmukhi", - "bahiragana", - "bahtthai", - "bakatakana", - "barmonospace", - "bbopomofo", - "bcircle", - "bdotaccent", - "bdotbelow", - "beamedsixteenthnotes", - "because", - "becyrillic", - "beharabic", - "behfinalarabic", - "behinitialarabic", - "behiragana", - "behmedialarabic", - "behmeeminitialarabic", - "behmeemisolatedarabic", - "behnoonfinalarabic", - "bekatakana", - "benarmenian", - "bet", - "beta", - "betasymbolgreek", - "betdagesh", - "betdageshhebrew", - "bethebrew", - "betrafehebrew", - "bhabengali", - "bhadeva", - "bhagujarati", - "bhagurmukhi", - "bhook", - "bihiragana", - "bikatakana", - "bilabialclick", - "bindigurmukhi", - "birusquare", - "blackcircle", - "blackdiamond", - "blackdownpointingtriangle", - "blackleftpointingpointer", - "blackleftpointingtriangle", - "blacklenticularbracketleft", - "blacklenticularbracketleftvertical", - "blacklenticularbracketright", - "blacklenticularbracketrightvertical", - "blacklowerlefttriangle", - "blacklowerrighttriangle", - "blackrectangle", - "blackrightpointingpointer", - "blackrightpointingtriangle", - "blacksmallsquare", - "blacksmilingface", - "blacksquare", - "blackstar", - "blackupperlefttriangle", - "blackupperrighttriangle", - "blackuppointingsmalltriangle", - "blackuppointingtriangle", - "blank", - "blinebelow", - "block", - "bmonospace", - "bobaimaithai", - "bohiragana", - "bokatakana", - "bparen", - "bqsquare", - "braceex", - "braceleftbt", - "braceleftmid", - "braceleftmonospace", - "braceleftsmall", - "bracelefttp", - "braceleftvertical", - "bracerightbt", - "bracerightmid", - "bracerightmonospace", - "bracerightsmall", - "bracerighttp", - "bracerightvertical", - "bracketleftbt", - "bracketleftex", - "bracketleftmonospace", - "bracketlefttp", - "bracketrightbt", - "bracketrightex", - "bracketrightmonospace", - "bracketrighttp", - "brevebelowcmb", - "brevecmb", - "breveinvertedbelowcmb", - "breveinvertedcmb", - "breveinverteddoublecmb", - "bridgebelowcmb", - "bridgeinvertedbelowcmb", - "bstroke", - "btopbar", - "buhiragana", - "bukatakana", - "bulletinverse", - "bulletoperator", - "bullseye", - "caarmenian", - "cabengali", - "cacute", - "cadeva", - "cagujarati", - "cagurmukhi", - "calsquare", - "candrabindubengali", - "candrabinducmb", - "candrabindudeva", - "candrabindugujarati", - "capslock", - "careof", - "caronbelowcmb", - "caroncmb", - "carriagereturn", - "cbopomofo", - "ccaron", - "ccedillaacute", - "ccircle", - "ccircumflex", - "ccurl", - "cdot", - "cdotaccent", - "cdsquare", - "cedillacmb", - "centigrade", - "centmonospace", - "chaarmenian", - "chabengali", - "chadeva", - "chagujarati", - "chagurmukhi", - "chbopomofo", - "cheabkhasiancyrillic", - "checkmark", - "checyrillic", - "chedescenderabkhasiancyrillic", - "chedescendercyrillic", - "chedieresiscyrillic", - "cheharmenian", - "chekhakassiancyrillic", - "cheverticalstrokecyrillic", - "chi", - "chieuchacirclekorean", - "chieuchaparenkorean", - "chieuchcirclekorean", - "chieuchkorean", - "chieuchparenkorean", - "chochangthai", - "chochanthai", - "chochingthai", - "chochoethai", - "chook", - "cieucacirclekorean", - "cieucaparenkorean", - "cieuccirclekorean", - "cieuckorean", - "cieucparenkorean", - "cieucuparenkorean", - "circle", - "circlemultiply", - "circleot", - "circleplus", - "circlepostalmark", - "circlewithlefthalfblack", - "circlewithrighthalfblack", - "circumflexbelowcmb", - "circumflexcmb", - "clear", - "clickalveolar", - "clickdental", - "clicklateral", - "clickretroflex", - "club", - "clubsuitblack", - "clubsuitwhite", - "cmcubedsquare", - "cmonospace", - "cmsquaredsquare", - "coarmenian", - "colonmonospace", - "colonsign", - "colonsmall", - "colontriangularhalfmod", - "colontriangularmod", - "commaabovecmb", - "commaaboverightcmb", - "commaaccent", - "commaarabic", - "commaarmenian", - "commamonospace", - "commareversedabovecmb", - "commareversedmod", - "commasmall", - "commaturnedabovecmb", - "commaturnedmod", - "compass", - "congruent", - "contourintegral", - "control", - "controlACK", - "controlBEL", - "controlBS", - "controlCAN", - "controlCR", - "controlDC1", - "controlDC2", - "controlDC3", - "controlDC4", - "controlDEL", - "controlDLE", - "controlEM", - "controlENQ", - "controlEOT", - "controlESC", - "controlETB", - "controlETX", - "controlFF", - "controlFS", - "controlGS", - "controlHT", - "controlLF", - "controlNAK", - "controlRS", - "controlSI", - "controlSO", - "controlSOT", - "controlSTX", - "controlSUB", - "controlSYN", - "controlUS", - "controlVT", - "copyrightsans", - "copyrightserif", - "cornerbracketleft", - "cornerbracketlefthalfwidth", - "cornerbracketleftvertical", - "cornerbracketright", - "cornerbracketrighthalfwidth", - "cornerbracketrightvertical", - "corporationsquare", - "cosquare", - "coverkgsquare", - "cparen", - "cruzeiro", - "cstretched", - "curlyand", - "curlyor", - "cyrBreve", - "cyrFlex", - "cyrbreve", - "cyrflex", - "daarmenian", - "dabengali", - "dadarabic", - "dadeva", - "dadfinalarabic", - "dadinitialarabic", - "dadmedialarabic", - "dagesh", - "dageshhebrew", - "dagujarati", - "dagurmukhi", - "dahiragana", - "dakatakana", - "dalarabic", - "dalet", - "daletdagesh", - "daletdageshhebrew", - "dalethatafpatah", - "dalethatafpatahhebrew", - "dalethatafsegol", - "dalethatafsegolhebrew", - "dalethebrew", - "dalethiriq", - "dalethiriqhebrew", - "daletholam", - "daletholamhebrew", - "daletpatah", - "daletpatahhebrew", - "daletqamats", - "daletqamatshebrew", - "daletqubuts", - "daletqubutshebrew", - "daletsegol", - "daletsegolhebrew", - "daletsheva", - "daletshevahebrew", - "dalettsere", - "dalettserehebrew", - "dalfinalarabic", - "dammaarabic", - "dammalowarabic", - "dammatanaltonearabic", - "dammatanarabic", - "danda", - "dargahebrew", - "dargalefthebrew", - "dasiapneumatacyrilliccmb", - "dblGrave", - "dblanglebracketleft", - "dblanglebracketleftvertical", - "dblanglebracketright", - "dblanglebracketrightvertical", - "dblarchinvertedbelowcmb", - "dblarrowleft", - "dblarrowright", - "dbldanda", - "dblgrave", - "dblgravecmb", - "dblintegral", - "dbllowline", - "dbllowlinecmb", - "dbloverlinecmb", - "dblprimemod", - "dblverticalbar", - "dblverticallineabovecmb", - "dbopomofo", - "dbsquare", - "dcaron", - "dcedilla", - "dcircle", - "dcircumflexbelow", - "dcroat", - "ddabengali", - "ddadeva", - "ddagujarati", - "ddagurmukhi", - "ddalarabic", - "ddalfinalarabic", - "dddhadeva", - "ddhabengali", - "ddhadeva", - "ddhagujarati", - "ddhagurmukhi", - "ddotaccent", - "ddotbelow", - "decimalseparatorarabic", - "decimalseparatorpersian", - "decyrillic", - "dehihebrew", - "dehiragana", - "deicoptic", - "dekatakana", - "deleteleft", - "deleteright", - "delta", - "deltaturned", - "denominatorminusonenumeratorbengali", - "dezh", - "dhabengali", - "dhadeva", - "dhagujarati", - "dhagurmukhi", - "dhook", - "dialytikatonos", - "dialytikatonoscmb", - "diamond", - "diamondsuitwhite", - "dieresisacute", - "dieresisbelowcmb", - "dieresiscmb", - "dieresisgrave", - "dieresistonos", - "dihiragana", - "dikatakana", - "dittomark", - "divides", - "divisionslash", - "djecyrillic", - "dkshade", - "dlinebelow", - "dlsquare", - "dmacron", - "dmonospace", - "dnblock", - "dochadathai", - "dodekthai", - "dohiragana", - "dokatakana", - "dollarmonospace", - "dollarsmall", - "dong", - "dorusquare", - "dotaccentcmb", - "dotbelowcmb", - "dotbelowcomb", - "dotkatakana", - "dotlessj", - "dotlessjstrokehook", - "dotmath", - "dottedcircle", - "doubleyodpatah", - "doubleyodpatahhebrew", - "downtackbelowcmb", - "downtackmod", - "dparen", - "dtail", - "dtopbar", - "duhiragana", - "dukatakana", - "dz", - "dzaltone", - "dzcaron", - "dzcurl", - "dzeabkhasiancyrillic", - "dzecyrillic", - "dzhecyrillic", - "earth", - "ebengali", - "ebopomofo", - "ebreve", - "ecandradeva", - "ecandragujarati", - "ecandravowelsigndeva", - "ecandravowelsigngujarati", - "ecaron", - "ecedillabreve", - "echarmenian", - "echyiwnarmenian", - "ecircle", - "ecircumflexacute", - "ecircumflexbelow", - "ecircumflexdotbelow", - "ecircumflexgrave", - "ecircumflexhookabove", - "ecircumflextilde", - "ecyrillic", - "edblgrave", - "edeva", - "edot", - "edotaccent", - "edotbelow", - "eegurmukhi", - "eematragurmukhi", - "efcyrillic", - "egujarati", - "eharmenian", - "ehbopomofo", - "ehiragana", - "ehookabove", - "eibopomofo", - "eightarabic", - "eightbengali", - "eightcircle", - "eightcircleinversesansserif", - "eightdeva", - "eighteencircle", - "eighteenparen", - "eighteenperiod", - "eightgujarati", - "eightgurmukhi", - "eighthackarabic", - "eighthangzhou", - "eighthnotebeamed", - "eightideographicparen", - "eightmonospace", - "eightparen", - "eightperiod", - "eightpersian", - "eightroman", - "eightthai", - "einvertedbreve", - "eiotifiedcyrillic", - "ekatakana", - "ekatakanahalfwidth", - "ekonkargurmukhi", - "ekorean", - "elcyrillic", - "element", - "elevencircle", - "elevenparen", - "elevenperiod", - "elevenroman", - "ellipsisvertical", - "emacron", - "emacronacute", - "emacrongrave", - "emcyrillic", - "emdashvertical", - "emonospace", - "emphasismarkarmenian", - "emptyset", - "enbopomofo", - "encyrillic", - "endashvertical", - "endescendercyrillic", - "eng", - "engbopomofo", - "enghecyrillic", - "enhookcyrillic", - "enspace", - "eogonek", - "eokorean", - "eopen", - "eopenclosed", - "eopenreversed", - "eopenreversedclosed", - "eopenreversedhook", - "eparen", - "epsilon", - "epsilontonos", - "equalmonospace", - "equalsmall", - "equalsuperior", - "equivalence", - "erbopomofo", - "ercyrillic", - "ereversed", - "ereversedcyrillic", - "escyrillic", - "esdescendercyrillic", - "esh", - "eshcurl", - "eshortdeva", - "eshortvowelsigndeva", - "eshreversedloop", - "eshsquatreversed", - "esmallhiragana", - "esmallkatakana", - "esmallkatakanahalfwidth", - "estimated", - "eta", - "etarmenian", - "etatonos", - "etilde", - "etildebelow", - "etnahtafoukhhebrew", - "etnahtafoukhlefthebrew", - "etnahtahebrew", - "etnahtalefthebrew", - "eturned", - "eukorean", - "euro", - "evowelsignbengali", - "evowelsigndeva", - "evowelsigngujarati", - "exclamarmenian", - "exclamdbl", - "exclammonospace", - "existential", - "ezh", - "ezhcaron", - "ezhcurl", - "ezhreversed", - "ezhtail", - "fadeva", - "fagurmukhi", - "fahrenheit", - "fathaarabic", - "fathalowarabic", - "fathatanarabic", - "fbopomofo", - "fcircle", - "fdotaccent", - "feharabic", - "feharmenian", - "fehfinalarabic", - "fehinitialarabic", - "fehmedialarabic", - "feicoptic", - "female", - "fifteencircle", - "fifteenparen", - "fifteenperiod", - "filledbox", - "filledrect", - "finalkaf", - "finalkafdagesh", - "finalkafdageshhebrew", - "finalkafhebrew", - "finalkafqamats", - "finalkafqamatshebrew", - "finalkafsheva", - "finalkafshevahebrew", - "finalmem", - "finalmemhebrew", - "finalnun", - "finalnunhebrew", - "finalpe", - "finalpehebrew", - "finaltsadi", - "finaltsadihebrew", - "firsttonechinese", - "fisheye", - "fitacyrillic", - "fivearabic", - "fivebengali", - "fivecircle", - "fivecircleinversesansserif", - "fivedeva", - "fivegujarati", - "fivegurmukhi", - "fivehackarabic", - "fivehangzhou", - "fiveideographicparen", - "fivemonospace", - "fiveparen", - "fiveperiod", - "fivepersian", - "fiveroman", - "fivethai", - "fmonospace", - "fmsquare", - "fofanthai", - "fofathai", - "fongmanthai", - "forall", - "fourarabic", - "fourbengali", - "fourcircle", - "fourcircleinversesansserif", - "fourdeva", - "fourgujarati", - "fourgurmukhi", - "fourhackarabic", - "fourhangzhou", - "fourideographicparen", - "fourmonospace", - "fournumeratorbengali", - "fourparen", - "fourperiod", - "fourpersian", - "fourroman", - "fourteencircle", - "fourteenparen", - "fourteenperiod", - "fourthai", - "fourthtonechinese", - "fparen", - "franc", - "gabengali", - "gacute", - "gadeva", - "gafarabic", - "gaffinalarabic", - "gafinitialarabic", - "gafmedialarabic", - "gagujarati", - "gagurmukhi", - "gahiragana", - "gakatakana", - "gamma", - "gammalatinsmall", - "gammasuperior", - "gangiacoptic", - "gbopomofo", - "gbreve", - "gcaron", - "gcedilla", - "gcircle", - "gcircumflex", - "gcommaaccent", - "gdot", - "gdotaccent", - "gecyrillic", - "gehiragana", - "gekatakana", - "geometricallyequal", - "gereshaccenthebrew", - "gereshhebrew", - "gereshmuqdamhebrew", - "gershayimaccenthebrew", - "gershayimhebrew", - "getamark", - "ghabengali", - "ghadarmenian", - "ghadeva", - "ghagujarati", - "ghagurmukhi", - "ghainarabic", - "ghainfinalarabic", - "ghaininitialarabic", - "ghainmedialarabic", - "ghemiddlehookcyrillic", - "ghestrokecyrillic", - "gheupturncyrillic", - "ghhadeva", - "ghhagurmukhi", - "ghook", - "ghzsquare", - "gihiragana", - "gikatakana", - "gimarmenian", - "gimel", - "gimeldagesh", - "gimeldageshhebrew", - "gimelhebrew", - "gjecyrillic", - "glottalinvertedstroke", - "glottalstop", - "glottalstopinverted", - "glottalstopmod", - "glottalstopreversed", - "glottalstopreversedmod", - "glottalstopreversedsuperior", - "glottalstopstroke", - "glottalstopstrokereversed", - "gmacron", - "gmonospace", - "gohiragana", - "gokatakana", - "gparen", - "gpasquare", - "gradient", - "gravebelowcmb", - "gravecmb", - "gravecomb", - "gravedeva", - "gravelowmod", - "gravemonospace", - "gravetonecmb", - "greaterequal", - "greaterequalorless", - "greatermonospace", - "greaterorequivalent", - "greaterorless", - "greateroverequal", - "greatersmall", - "gscript", - "gstroke", - "guhiragana", - "gukatakana", - "guramusquare", - "gysquare", - "haabkhasiancyrillic", - "haaltonearabic", - "habengali", - "hadescendercyrillic", - "hadeva", - "hagujarati", - "hagurmukhi", - "haharabic", - "hahfinalarabic", - "hahinitialarabic", - "hahiragana", - "hahmedialarabic", - "haitusquare", - "hakatakana", - "hakatakanahalfwidth", - "halantgurmukhi", - "hamzaarabic", - "hamzadammaarabic", - "hamzadammatanarabic", - "hamzafathaarabic", - "hamzafathatanarabic", - "hamzalowarabic", - "hamzalowkasraarabic", - "hamzalowkasratanarabic", - "hamzasukunarabic", - "hangulfiller", - "hardsigncyrillic", - "harpoonleftbarbup", - "harpoonrightbarbup", - "hasquare", - "hatafpatah", - "hatafpatah16", - "hatafpatah23", - "hatafpatah2f", - "hatafpatahhebrew", - "hatafpatahnarrowhebrew", - "hatafpatahquarterhebrew", - "hatafpatahwidehebrew", - "hatafqamats", - "hatafqamats1b", - "hatafqamats28", - "hatafqamats34", - "hatafqamatshebrew", - "hatafqamatsnarrowhebrew", - "hatafqamatsquarterhebrew", - "hatafqamatswidehebrew", - "hatafsegol", - "hatafsegol17", - "hatafsegol24", - "hatafsegol30", - "hatafsegolhebrew", - "hatafsegolnarrowhebrew", - "hatafsegolquarterhebrew", - "hatafsegolwidehebrew", - "hbar", - "hbopomofo", - "hbrevebelow", - "hcedilla", - "hcircle", - "hcircumflex", - "hdieresis", - "hdotaccent", - "hdotbelow", - "he", - "heart", - "heartsuitblack", - "heartsuitwhite", - "hedagesh", - "hedageshhebrew", - "hehaltonearabic", - "heharabic", - "hehebrew", - "hehfinalaltonearabic", - "hehfinalalttwoarabic", - "hehfinalarabic", - "hehhamzaabovefinalarabic", - "hehhamzaaboveisolatedarabic", - "hehinitialaltonearabic", - "hehinitialarabic", - "hehiragana", - "hehmedialaltonearabic", - "hehmedialarabic", - "heiseierasquare", - "hekatakana", - "hekatakanahalfwidth", - "hekutaarusquare", - "henghook", - "herutusquare", - "het", - "hethebrew", - "hhook", - "hhooksuperior", - "hieuhacirclekorean", - "hieuhaparenkorean", - "hieuhcirclekorean", - "hieuhkorean", - "hieuhparenkorean", - "hihiragana", - "hikatakana", - "hikatakanahalfwidth", - "hiriq", - "hiriq14", - "hiriq21", - "hiriq2d", - "hiriqhebrew", - "hiriqnarrowhebrew", - "hiriqquarterhebrew", - "hiriqwidehebrew", - "hlinebelow", - "hmonospace", - "hoarmenian", - "hohipthai", - "hohiragana", - "hokatakana", - "hokatakanahalfwidth", - "holam", - "holam19", - "holam26", - "holam32", - "holamhebrew", - "holamnarrowhebrew", - "holamquarterhebrew", - "holamwidehebrew", - "honokhukthai", - "hookabovecomb", - "hookcmb", - "hookpalatalizedbelowcmb", - "hookretroflexbelowcmb", - "hoonsquare", - "horicoptic", - "horizontalbar", - "horncmb", - "hotsprings", - "house", - "hparen", - "hsuperior", - "hturned", - "huhiragana", - "huiitosquare", - "hukatakana", - "hukatakanahalfwidth", - "hungarumlautcmb", - "hv", - "hyphenmonospace", - "hyphensmall", - "hyphentwo", - "iacyrillic", - "ibengali", - "ibopomofo", - "ibreve", - "icaron", - "icircle", - "icyrillic", - "idblgrave", - "ideographearthcircle", - "ideographfirecircle", - "ideographicallianceparen", - "ideographiccallparen", - "ideographiccentrecircle", - "ideographicclose", - "ideographiccomma", - "ideographiccommaleft", - "ideographiccongratulationparen", - "ideographiccorrectcircle", - "ideographicearthparen", - "ideographicenterpriseparen", - "ideographicexcellentcircle", - "ideographicfestivalparen", - "ideographicfinancialcircle", - "ideographicfinancialparen", - "ideographicfireparen", - "ideographichaveparen", - "ideographichighcircle", - "ideographiciterationmark", - "ideographiclaborcircle", - "ideographiclaborparen", - "ideographicleftcircle", - "ideographiclowcircle", - "ideographicmedicinecircle", - "ideographicmetalparen", - "ideographicmoonparen", - "ideographicnameparen", - "ideographicperiod", - "ideographicprintcircle", - "ideographicreachparen", - "ideographicrepresentparen", - "ideographicresourceparen", - "ideographicrightcircle", - "ideographicsecretcircle", - "ideographicselfparen", - "ideographicsocietyparen", - "ideographicspace", - "ideographicspecialparen", - "ideographicstockparen", - "ideographicstudyparen", - "ideographicsunparen", - "ideographicsuperviseparen", - "ideographicwaterparen", - "ideographicwoodparen", - "ideographiczero", - "ideographmetalcircle", - "ideographmooncircle", - "ideographnamecircle", - "ideographsuncircle", - "ideographwatercircle", - "ideographwoodcircle", - "ideva", - "idieresisacute", - "idieresiscyrillic", - "idotbelow", - "iebrevecyrillic", - "iecyrillic", - "ieungacirclekorean", - "ieungaparenkorean", - "ieungcirclekorean", - "ieungkorean", - "ieungparenkorean", - "igujarati", - "igurmukhi", - "ihiragana", - "ihookabove", - "iibengali", - "iicyrillic", - "iideva", - "iigujarati", - "iigurmukhi", - "iimatragurmukhi", - "iinvertedbreve", - "iishortcyrillic", - "iivowelsignbengali", - "iivowelsigndeva", - "iivowelsigngujarati", - "ij", - "ikatakana", - "ikatakanahalfwidth", - "ikorean", - "ilde", - "iluyhebrew", - "imacron", - "imacroncyrillic", - "imageorapproximatelyequal", - "imatragurmukhi", - "imonospace", - "increment", - "infinity", - "iniarmenian", - "integral", - "integralbottom", - "integralbt", - "integralex", - "integraltop", - "integraltp", - "intersection", - "intisquare", - "invbullet", - "invcircle", - "invsmileface", - "iocyrillic", - "iogonek", - "iota", - "iotadieresis", - "iotadieresistonos", - "iotalatin", - "iotatonos", - "iparen", - "irigurmukhi", - "ismallhiragana", - "ismallkatakana", - "ismallkatakanahalfwidth", - "issharbengali", - "istroke", - "iterationhiragana", - "iterationkatakana", - "itilde", - "itildebelow", - "iubopomofo", - "iucyrillic", - "ivowelsignbengali", - "ivowelsigndeva", - "ivowelsigngujarati", - "izhitsacyrillic", - "izhitsadblgravecyrillic", - "jaarmenian", - "jabengali", - "jadeva", - "jagujarati", - "jagurmukhi", - "jbopomofo", - "jcaron", - "jcircle", - "jcircumflex", - "jcrossedtail", - "jdotlessstroke", - "jecyrillic", - "jeemarabic", - "jeemfinalarabic", - "jeeminitialarabic", - "jeemmedialarabic", - "jeharabic", - "jehfinalarabic", - "jhabengali", - "jhadeva", - "jhagujarati", - "jhagurmukhi", - "jheharmenian", - "jis", - "jmonospace", - "jparen", - "jsuperior", - "kabashkircyrillic", - "kabengali", - "kacute", - "kacyrillic", - "kadescendercyrillic", - "kadeva", - "kaf", - "kafarabic", - "kafdagesh", - "kafdageshhebrew", - "kaffinalarabic", - "kafhebrew", - "kafinitialarabic", - "kafmedialarabic", - "kafrafehebrew", - "kagujarati", - "kagurmukhi", - "kahiragana", - "kahookcyrillic", - "kakatakana", - "kakatakanahalfwidth", - "kappa", - "kappasymbolgreek", - "kapyeounmieumkorean", - "kapyeounphieuphkorean", - "kapyeounpieupkorean", - "kapyeounssangpieupkorean", - "karoriisquare", - "kashidaautoarabic", - "kashidaautonosidebearingarabic", - "kasmallkatakana", - "kasquare", - "kasraarabic", - "kasratanarabic", - "kastrokecyrillic", - "katahiraprolongmarkhalfwidth", - "kaverticalstrokecyrillic", - "kbopomofo", - "kcalsquare", - "kcaron", - "kcedilla", - "kcircle", - "kcommaaccent", - "kdotbelow", - "keharmenian", - "kehiragana", - "kekatakana", - "kekatakanahalfwidth", - "kenarmenian", - "kesmallkatakana", - "kgreenlandic", - "khabengali", - "khacyrillic", - "khadeva", - "khagujarati", - "khagurmukhi", - "khaharabic", - "khahfinalarabic", - "khahinitialarabic", - "khahmedialarabic", - "kheicoptic", - "khhadeva", - "khhagurmukhi", - "khieukhacirclekorean", - "khieukhaparenkorean", - "khieukhcirclekorean", - "khieukhkorean", - "khieukhparenkorean", - "khokhaithai", - "khokhonthai", - "khokhuatthai", - "khokhwaithai", - "khomutthai", - "khook", - "khorakhangthai", - "khzsquare", - "kihiragana", - "kikatakana", - "kikatakanahalfwidth", - "kiroguramusquare", - "kiromeetorusquare", - "kirosquare", - "kiyeokacirclekorean", - "kiyeokaparenkorean", - "kiyeokcirclekorean", - "kiyeokkorean", - "kiyeokparenkorean", - "kiyeoksioskorean", - "kjecyrillic", - "klinebelow", - "klsquare", - "kmcubedsquare", - "kmonospace", - "kmsquaredsquare", - "kohiragana", - "kohmsquare", - "kokaithai", - "kokatakana", - "kokatakanahalfwidth", - "kooposquare", - "koppacyrillic", - "koreanstandardsymbol", - "koroniscmb", - "kparen", - "kpasquare", - "ksicyrillic", - "ktsquare", - "kturned", - "kuhiragana", - "kukatakana", - "kukatakanahalfwidth", - "kvsquare", - "kwsquare", - "labengali", - "lacute", - "ladeva", - "lagujarati", - "lagurmukhi", - "lakkhangyaothai", - "lamaleffinalarabic", - "lamalefhamzaabovefinalarabic", - "lamalefhamzaaboveisolatedarabic", - "lamalefhamzabelowfinalarabic", - "lamalefhamzabelowisolatedarabic", - "lamalefisolatedarabic", - "lamalefmaddaabovefinalarabic", - "lamalefmaddaaboveisolatedarabic", - "lamarabic", - "lambda", - "lambdastroke", - "lamed", - "lameddagesh", - "lameddageshhebrew", - "lamedhebrew", - "lamedholam", - "lamedholamdagesh", - "lamedholamdageshhebrew", - "lamedholamhebrew", - "lamfinalarabic", - "lamhahinitialarabic", - "laminitialarabic", - "lamjeeminitialarabic", - "lamkhahinitialarabic", - "lamlamhehisolatedarabic", - "lammedialarabic", - "lammeemhahinitialarabic", - "lammeeminitialarabic", - "lammeemjeeminitialarabic", - "lammeemkhahinitialarabic", - "largecircle", - "lbar", - "lbelt", - "lbopomofo", - "lcaron", - "lcedilla", - "lcircle", - "lcircumflexbelow", - "lcommaaccent", - "ldot", - "ldotaccent", - "ldotbelow", - "ldotbelowmacron", - "leftangleabovecmb", - "lefttackbelowcmb", - "lessequal", - "lessequalorgreater", - "lessmonospace", - "lessorequivalent", - "lessorgreater", - "lessoverequal", - "lesssmall", - "lezh", - "lfblock", - "lhookretroflex", - "lira", - "liwnarmenian", - "lj", - "ljecyrillic", - "ll", - "lladeva", - "llagujarati", - "llinebelow", - "llladeva", - "llvocalicbengali", - "llvocalicdeva", - "llvocalicvowelsignbengali", - "llvocalicvowelsigndeva", - "lmiddletilde", - "lmonospace", - "lmsquare", - "lochulathai", - "logicaland", - "logicalnotreversed", - "logicalor", - "lolingthai", - "longs", - "lowlinecenterline", - "lowlinecmb", - "lowlinedashed", - "lozenge", - "lparen", - "lsquare", - "ltshade", - "luthai", - "lvocalicbengali", - "lvocalicdeva", - "lvocalicvowelsignbengali", - "lvocalicvowelsigndeva", - "lxsquare", - "mabengali", - "macronbelowcmb", - "macroncmb", - "macronlowmod", - "macronmonospace", - "macute", - "madeva", - "magujarati", - "magurmukhi", - "mahapakhhebrew", - "mahapakhlefthebrew", - "mahiragana", - "maichattawalowleftthai", - "maichattawalowrightthai", - "maichattawathai", - "maichattawaupperleftthai", - "maieklowleftthai", - "maieklowrightthai", - "maiekthai", - "maiekupperleftthai", - "maihanakatleftthai", - "maihanakatthai", - "maitaikhuleftthai", - "maitaikhuthai", - "maitholowleftthai", - "maitholowrightthai", - "maithothai", - "maithoupperleftthai", - "maitrilowleftthai", - "maitrilowrightthai", - "maitrithai", - "maitriupperleftthai", - "maiyamokthai", - "makatakana", - "makatakanahalfwidth", - "male", - "mansyonsquare", - "maqafhebrew", - "mars", - "masoracirclehebrew", - "masquare", - "mbopomofo", - "mbsquare", - "mcircle", - "mcubedsquare", - "mdotaccent", - "mdotbelow", - "meemarabic", - "meemfinalarabic", - "meeminitialarabic", - "meemmedialarabic", - "meemmeeminitialarabic", - "meemmeemisolatedarabic", - "meetorusquare", - "mehiragana", - "meizierasquare", - "mekatakana", - "mekatakanahalfwidth", - "mem", - "memdagesh", - "memdageshhebrew", - "memhebrew", - "menarmenian", - "merkhahebrew", - "merkhakefulahebrew", - "merkhakefulalefthebrew", - "merkhalefthebrew", - "mhook", - "mhzsquare", - "middledotkatakanahalfwidth", - "middot", - "mieumacirclekorean", - "mieumaparenkorean", - "mieumcirclekorean", - "mieumkorean", - "mieumpansioskorean", - "mieumparenkorean", - "mieumpieupkorean", - "mieumsioskorean", - "mihiragana", - "mikatakana", - "mikatakanahalfwidth", - "minusbelowcmb", - "minuscircle", - "minusmod", - "minusplus", - "minute", - "miribaarusquare", - "mirisquare", - "mlonglegturned", - "mlsquare", - "mmcubedsquare", - "mmonospace", - "mmsquaredsquare", - "mohiragana", - "mohmsquare", - "mokatakana", - "mokatakanahalfwidth", - "molsquare", - "momathai", - "moverssquare", - "moverssquaredsquare", - "mparen", - "mpasquare", - "mssquare", - "mturned", - "mu1", - "muasquare", - "muchgreater", - "muchless", - "mufsquare", - "mugreek", - "mugsquare", - "muhiragana", - "mukatakana", - "mukatakanahalfwidth", - "mulsquare", - "mumsquare", - "munahhebrew", - "munahlefthebrew", - "musicalnote", - "musicalnotedbl", - "musicflatsign", - "musicsharpsign", - "mussquare", - "muvsquare", - "muwsquare", - "mvmegasquare", - "mvsquare", - "mwmegasquare", - "mwsquare", - "nabengali", - "nabla", - "nacute", - "nadeva", - "nagujarati", - "nagurmukhi", - "nahiragana", - "nakatakana", - "nakatakanahalfwidth", - "napostrophe", - "nasquare", - "nbopomofo", - "nbspace", - "ncaron", - "ncedilla", - "ncircle", - "ncircumflexbelow", - "ncommaaccent", - "ndotaccent", - "ndotbelow", - "nehiragana", - "nekatakana", - "nekatakanahalfwidth", - "newsheqelsign", - "nfsquare", - "ngabengali", - "ngadeva", - "ngagujarati", - "ngagurmukhi", - "ngonguthai", - "nhiragana", - "nhookleft", - "nhookretroflex", - "nieunacirclekorean", - "nieunaparenkorean", - "nieuncieuckorean", - "nieuncirclekorean", - "nieunhieuhkorean", - "nieunkorean", - "nieunpansioskorean", - "nieunparenkorean", - "nieunsioskorean", - "nieuntikeutkorean", - "nihiragana", - "nikatakana", - "nikatakanahalfwidth", - "nikhahitleftthai", - "nikhahitthai", - "ninearabic", - "ninebengali", - "ninecircle", - "ninecircleinversesansserif", - "ninedeva", - "ninegujarati", - "ninegurmukhi", - "ninehackarabic", - "ninehangzhou", - "nineideographicparen", - "ninemonospace", - "nineparen", - "nineperiod", - "ninepersian", - "nineroman", - "nineteencircle", - "nineteenparen", - "nineteenperiod", - "ninethai", - "nj", - "njecyrillic", - "nkatakana", - "nkatakanahalfwidth", - "nlegrightlong", - "nlinebelow", - "nmonospace", - "nmsquare", - "nnabengali", - "nnadeva", - "nnagujarati", - "nnagurmukhi", - "nnnadeva", - "nohiragana", - "nokatakana", - "nokatakanahalfwidth", - "nonbreakingspace", - "nonenthai", - "nonuthai", - "noonarabic", - "noonfinalarabic", - "noonghunnaarabic", - "noonghunnafinalarabic", - "noonhehinitialarabic", - "nooninitialarabic", - "noonjeeminitialarabic", - "noonjeemisolatedarabic", - "noonmedialarabic", - "noonmeeminitialarabic", - "noonmeemisolatedarabic", - "noonnoonfinalarabic", - "notcontains", - "notelement", - "notelementof", - "notequal", - "notgreater", - "notgreaternorequal", - "notgreaternorless", - "notidentical", - "notless", - "notlessnorequal", - "notparallel", - "notprecedes", - "notsubset", - "notsucceeds", - "notsuperset", - "nowarmenian", - "nparen", - "nssquare", - "nu", - "nuhiragana", - "nukatakana", - "nukatakanahalfwidth", - "nuktabengali", - "nuktadeva", - "nuktagujarati", - "nuktagurmukhi", - "numbersignmonospace", - "numbersignsmall", - "numeralsigngreek", - "numeralsignlowergreek", - "numero", - "nun", - "nundagesh", - "nundageshhebrew", - "nunhebrew", - "nvsquare", - "nwsquare", - "nyabengali", - "nyadeva", - "nyagujarati", - "nyagurmukhi", - "oangthai", - "obarred", - "obarredcyrillic", - "obarreddieresiscyrillic", - "obengali", - "obopomofo", - "obreve", - "ocandradeva", - "ocandragujarati", - "ocandravowelsigndeva", - "ocandravowelsigngujarati", - "ocaron", - "ocircle", - "ocircumflexacute", - "ocircumflexdotbelow", - "ocircumflexgrave", - "ocircumflexhookabove", - "ocircumflextilde", - "ocyrillic", - "odblacute", - "odblgrave", - "odeva", - "odieresiscyrillic", - "odotbelow", - "oekorean", - "ogonekcmb", - "ogujarati", - "oharmenian", - "ohiragana", - "ohookabove", - "ohorn", - "ohornacute", - "ohorndotbelow", - "ohorngrave", - "ohornhookabove", - "ohorntilde", - "ohungarumlaut", - "oi", - "oinvertedbreve", - "okatakana", - "okatakanahalfwidth", - "okorean", - "olehebrew", - "omacron", - "omacronacute", - "omacrongrave", - "omdeva", - "omega", - "omega1", - "omegacyrillic", - "omegalatinclosed", - "omegaroundcyrillic", - "omegatitlocyrillic", - "omegatonos", - "omgujarati", - "omicron", - "omicrontonos", - "omonospace", - "onearabic", - "onebengali", - "onecircle", - "onecircleinversesansserif", - "onedeva", - "onegujarati", - "onegurmukhi", - "onehackarabic", - "onehangzhou", - "oneideographicparen", - "onemonospace", - "onenumeratorbengali", - "oneparen", - "oneperiod", - "onepersian", - "oneroman", - "onethai", - "oogonek", - "oogonekmacron", - "oogurmukhi", - "oomatragurmukhi", - "oopen", - "oparen", - "openbullet", - "option", - "orthogonal", - "oshortdeva", - "oshortvowelsigndeva", - "oslashacute", - "osmallhiragana", - "osmallkatakana", - "osmallkatakanahalfwidth", - "ostrokeacute", - "otcyrillic", - "otildeacute", - "otildedieresis", - "oubopomofo", - "overline", - "overlinecenterline", - "overlinecmb", - "overlinedashed", - "overlinedblwavy", - "overlinewavy", - "overscore", - "ovowelsignbengali", - "ovowelsigndeva", - "ovowelsigngujarati", - "paampssquare", - "paasentosquare", - "pabengali", - "pacute", - "padeva", - "pagedown", - "pageup", - "pagujarati", - "pagurmukhi", - "pahiragana", - "paiyannoithai", - "pakatakana", - "palatalizationcyrilliccmb", - "palochkacyrillic", - "pansioskorean", - "parallel", - "parenleftaltonearabic", - "parenleftbt", - "parenleftex", - "parenleftmonospace", - "parenleftsmall", - "parenlefttp", - "parenleftvertical", - "parenrightaltonearabic", - "parenrightbt", - "parenrightex", - "parenrightmonospace", - "parenrightsmall", - "parenrighttp", - "parenrightvertical", - "partialdiff", - "paseqhebrew", - "pashtahebrew", - "pasquare", - "patah", - "patah11", - "patah1d", - "patah2a", - "patahhebrew", - "patahnarrowhebrew", - "patahquarterhebrew", - "patahwidehebrew", - "pazerhebrew", - "pbopomofo", - "pcircle", - "pdotaccent", - "pe", - "pecyrillic", - "pedagesh", - "pedageshhebrew", - "peezisquare", - "pefinaldageshhebrew", - "peharabic", - "peharmenian", - "pehebrew", - "pehfinalarabic", - "pehinitialarabic", - "pehiragana", - "pehmedialarabic", - "pekatakana", - "pemiddlehookcyrillic", - "perafehebrew", - "percentarabic", - "percentmonospace", - "percentsmall", - "periodarmenian", - "periodhalfwidth", - "periodmonospace", - "periodsmall", - "perispomenigreekcmb", - "perpendicular", - "peseta", - "pfsquare", - "phabengali", - "phadeva", - "phagujarati", - "phagurmukhi", - "phi", - "phi1", - "phieuphacirclekorean", - "phieuphaparenkorean", - "phieuphcirclekorean", - "phieuphkorean", - "phieuphparenkorean", - "philatin", - "phinthuthai", - "phisymbolgreek", - "phook", - "phophanthai", - "phophungthai", - "phosamphaothai", - "pi", - "pieupacirclekorean", - "pieupaparenkorean", - "pieupcieuckorean", - "pieupcirclekorean", - "pieupkiyeokkorean", - "pieupkorean", - "pieupparenkorean", - "pieupsioskiyeokkorean", - "pieupsioskorean", - "pieupsiostikeutkorean", - "pieupthieuthkorean", - "pieuptikeutkorean", - "pihiragana", - "pikatakana", - "pisymbolgreek", - "piwrarmenian", - "plusbelowcmb", - "pluscircle", - "plusmod", - "plusmonospace", - "plussmall", - "plussuperior", - "pmonospace", - "pmsquare", - "pohiragana", - "pointingindexdownwhite", - "pointingindexleftwhite", - "pointingindexrightwhite", - "pointingindexupwhite", - "pokatakana", - "poplathai", - "postalmark", - "postalmarkface", - "pparen", - "precedes", - "prescription", - "primemod", - "primereversed", - "product", - "projective", - "prolongedkana", - "propellor", - "propersubset", - "propersuperset", - "proportion", - "proportional", - "psi", - "psicyrillic", - "psilipneumatacyrilliccmb", - "pssquare", - "puhiragana", - "pukatakana", - "pvsquare", - "pwsquare", - "qadeva", - "qadmahebrew", - "qafarabic", - "qaffinalarabic", - "qafinitialarabic", - "qafmedialarabic", - "qamats", - "qamats10", - "qamats1a", - "qamats1c", - "qamats27", - "qamats29", - "qamats33", - "qamatsde", - "qamatshebrew", - "qamatsnarrowhebrew", - "qamatsqatanhebrew", - "qamatsqatannarrowhebrew", - "qamatsqatanquarterhebrew", - "qamatsqatanwidehebrew", - "qamatsquarterhebrew", - "qamatswidehebrew", - "qarneyparahebrew", - "qbopomofo", - "qcircle", - "qhook", - "qmonospace", - "qof", - "qofdagesh", - "qofdageshhebrew", - "qofhatafpatah", - "qofhatafpatahhebrew", - "qofhatafsegol", - "qofhatafsegolhebrew", - "qofhebrew", - "qofhiriq", - "qofhiriqhebrew", - "qofholam", - "qofholamhebrew", - "qofpatah", - "qofpatahhebrew", - "qofqamats", - "qofqamatshebrew", - "qofqubuts", - "qofqubutshebrew", - "qofsegol", - "qofsegolhebrew", - "qofsheva", - "qofshevahebrew", - "qoftsere", - "qoftserehebrew", - "qparen", - "quarternote", - "qubuts", - "qubuts18", - "qubuts25", - "qubuts31", - "qubutshebrew", - "qubutsnarrowhebrew", - "qubutsquarterhebrew", - "qubutswidehebrew", - "questionarabic", - "questionarmenian", - "questiongreek", - "questionmonospace", - "quotedblmonospace", - "quotedblprime", - "quotedblprimereversed", - "quoteleftreversed", - "quotereversed", - "quoterightn", - "quotesinglemonospace", - "raarmenian", - "rabengali", - "racute", - "radeva", - "radical", - "radicalex", - "radoverssquare", - "radoverssquaredsquare", - "radsquare", - "rafe", - "rafehebrew", - "ragujarati", - "ragurmukhi", - "rahiragana", - "rakatakana", - "rakatakanahalfwidth", - "ralowerdiagonalbengali", - "ramiddlediagonalbengali", - "ramshorn", - "ratio", - "rbopomofo", - "rcaron", - "rcedilla", - "rcircle", - "rcommaaccent", - "rdblgrave", - "rdotaccent", - "rdotbelow", - "rdotbelowmacron", - "referencemark", - "reflexsubset", - "reflexsuperset", - "registersans", - "registerserif", - "reharabic", - "reharmenian", - "rehfinalarabic", - "rehiragana", - "rehyehaleflamarabic", - "rekatakana", - "rekatakanahalfwidth", - "resh", - "reshdageshhebrew", - "reshhatafpatah", - "reshhatafpatahhebrew", - "reshhatafsegol", - "reshhatafsegolhebrew", - "reshhebrew", - "reshhiriq", - "reshhiriqhebrew", - "reshholam", - "reshholamhebrew", - "reshpatah", - "reshpatahhebrew", - "reshqamats", - "reshqamatshebrew", - "reshqubuts", - "reshqubutshebrew", - "reshsegol", - "reshsegolhebrew", - "reshsheva", - "reshshevahebrew", - "reshtsere", - "reshtserehebrew", - "reversedtilde", - "reviahebrew", - "reviamugrashhebrew", - "revlogicalnot", - "rfishhook", - "rfishhookreversed", - "rhabengali", - "rhadeva", - "rho", - "rhook", - "rhookturned", - "rhookturnedsuperior", - "rhosymbolgreek", - "rhotichookmod", - "rieulacirclekorean", - "rieulaparenkorean", - "rieulcirclekorean", - "rieulhieuhkorean", - "rieulkiyeokkorean", - "rieulkiyeoksioskorean", - "rieulkorean", - "rieulmieumkorean", - "rieulpansioskorean", - "rieulparenkorean", - "rieulphieuphkorean", - "rieulpieupkorean", - "rieulpieupsioskorean", - "rieulsioskorean", - "rieulthieuthkorean", - "rieultikeutkorean", - "rieulyeorinhieuhkorean", - "rightangle", - "righttackbelowcmb", - "righttriangle", - "rihiragana", - "rikatakana", - "rikatakanahalfwidth", - "ringbelowcmb", - "ringcmb", - "ringhalfleft", - "ringhalfleftarmenian", - "ringhalfleftbelowcmb", - "ringhalfleftcentered", - "ringhalfright", - "ringhalfrightbelowcmb", - "ringhalfrightcentered", - "rinvertedbreve", - "rittorusquare", - "rlinebelow", - "rlongleg", - "rlonglegturned", - "rmonospace", - "rohiragana", - "rokatakana", - "rokatakanahalfwidth", - "roruathai", - "rparen", - "rrabengali", - "rradeva", - "rragurmukhi", - "rreharabic", - "rrehfinalarabic", - "rrvocalicbengali", - "rrvocalicdeva", - "rrvocalicgujarati", - "rrvocalicvowelsignbengali", - "rrvocalicvowelsigndeva", - "rrvocalicvowelsigngujarati", - "rtblock", - "rturned", - "rturnedsuperior", - "ruhiragana", - "rukatakana", - "rukatakanahalfwidth", - "rupeemarkbengali", - "rupeesignbengali", - "ruthai", - "rvocalicbengali", - "rvocalicdeva", - "rvocalicgujarati", - "rvocalicvowelsignbengali", - "rvocalicvowelsigndeva", - "rvocalicvowelsigngujarati", - "sabengali", - "sacute", - "sacutedotaccent", - "sadarabic", - "sadeva", - "sadfinalarabic", - "sadinitialarabic", - "sadmedialarabic", - "sagujarati", - "sagurmukhi", - "sahiragana", - "sakatakana", - "sakatakanahalfwidth", - "sallallahoualayhewasallamarabic", - "samekh", - "samekhdagesh", - "samekhdageshhebrew", - "samekhhebrew", - "saraaathai", - "saraaethai", - "saraaimaimalaithai", - "saraaimaimuanthai", - "saraamthai", - "saraathai", - "saraethai", - "saraiileftthai", - "saraiithai", - "saraileftthai", - "saraithai", - "saraothai", - "saraueeleftthai", - "saraueethai", - "saraueleftthai", - "sarauethai", - "sarauthai", - "sarauuthai", - "sbopomofo", - "scarondotaccent", - "scedilla", - "schwa", - "schwacyrillic", - "schwadieresiscyrillic", - "schwahook", - "scircle", - "scircumflex", - "scommaaccent", - "sdotaccent", - "sdotbelow", - "sdotbelowdotaccent", - "seagullbelowcmb", - "second", - "secondtonechinese", - "seenarabic", - "seenfinalarabic", - "seeninitialarabic", - "seenmedialarabic", - "segol", - "segol13", - "segol1f", - "segol2c", - "segolhebrew", - "segolnarrowhebrew", - "segolquarterhebrew", - "segoltahebrew", - "segolwidehebrew", - "seharmenian", - "sehiragana", - "sekatakana", - "sekatakanahalfwidth", - "semicolonarabic", - "semicolonmonospace", - "semicolonsmall", - "semivoicedmarkkana", - "semivoicedmarkkanahalfwidth", - "sentisquare", - "sentosquare", - "sevenarabic", - "sevenbengali", - "sevencircle", - "sevencircleinversesansserif", - "sevendeva", - "sevengujarati", - "sevengurmukhi", - "sevenhackarabic", - "sevenhangzhou", - "sevenideographicparen", - "sevenmonospace", - "sevenparen", - "sevenperiod", - "sevenpersian", - "sevenroman", - "seventeencircle", - "seventeenparen", - "seventeenperiod", - "seventhai", - "sfthyphen", - "shaarmenian", - "shabengali", - "shacyrillic", - "shaddaarabic", - "shaddadammaarabic", - "shaddadammatanarabic", - "shaddafathaarabic", - "shaddafathatanarabic", - "shaddakasraarabic", - "shaddakasratanarabic", - "shade", - "shadedark", - "shadelight", - "shademedium", - "shadeva", - "shagujarati", - "shagurmukhi", - "shalshelethebrew", - "shbopomofo", - "shchacyrillic", - "sheenarabic", - "sheenfinalarabic", - "sheeninitialarabic", - "sheenmedialarabic", - "sheicoptic", - "sheqel", - "sheqelhebrew", - "sheva", - "sheva115", - "sheva15", - "sheva22", - "sheva2e", - "shevahebrew", - "shevanarrowhebrew", - "shevaquarterhebrew", - "shevawidehebrew", - "shhacyrillic", - "shimacoptic", - "shin", - "shindagesh", - "shindageshhebrew", - "shindageshshindot", - "shindageshshindothebrew", - "shindageshsindot", - "shindageshsindothebrew", - "shindothebrew", - "shinhebrew", - "shinshindot", - "shinshindothebrew", - "shinsindot", - "shinsindothebrew", - "shook", - "sigma", - "sigma1", - "sigmafinal", - "sigmalunatesymbolgreek", - "sihiragana", - "sikatakana", - "sikatakanahalfwidth", - "siluqhebrew", - "siluqlefthebrew", - "similar", - "sindothebrew", - "siosacirclekorean", - "siosaparenkorean", - "sioscieuckorean", - "sioscirclekorean", - "sioskiyeokkorean", - "sioskorean", - "siosnieunkorean", - "siosparenkorean", - "siospieupkorean", - "siostikeutkorean", - "sixarabic", - "sixbengali", - "sixcircle", - "sixcircleinversesansserif", - "sixdeva", - "sixgujarati", - "sixgurmukhi", - "sixhackarabic", - "sixhangzhou", - "sixideographicparen", - "sixmonospace", - "sixparen", - "sixperiod", - "sixpersian", - "sixroman", - "sixteencircle", - "sixteencurrencydenominatorbengali", - "sixteenparen", - "sixteenperiod", - "sixthai", - "slashmonospace", - "slong", - "slongdotaccent", - "smileface", - "smonospace", - "sofpasuqhebrew", - "softhyphen", - "softsigncyrillic", - "sohiragana", - "sokatakana", - "sokatakanahalfwidth", - "soliduslongoverlaycmb", - "solidusshortoverlaycmb", - "sorusithai", - "sosalathai", - "sosothai", - "sosuathai", - "spacehackarabic", - "spade", - "spadesuitblack", - "spadesuitwhite", - "sparen", - "squarebelowcmb", - "squarecc", - "squarecm", - "squarediagonalcrosshatchfill", - "squarehorizontalfill", - "squarekg", - "squarekm", - "squarekmcapital", - "squareln", - "squarelog", - "squaremg", - "squaremil", - "squaremm", - "squaremsquared", - "squareorthogonalcrosshatchfill", - "squareupperlefttolowerrightfill", - "squareupperrighttolowerleftfill", - "squareverticalfill", - "squarewhitewithsmallblack", - "srsquare", - "ssabengali", - "ssadeva", - "ssagujarati", - "ssangcieuckorean", - "ssanghieuhkorean", - "ssangieungkorean", - "ssangkiyeokkorean", - "ssangnieunkorean", - "ssangpieupkorean", - "ssangsioskorean", - "ssangtikeutkorean", - "sterlingmonospace", - "strokelongoverlaycmb", - "strokeshortoverlaycmb", - "subset", - "subsetnotequal", - "subsetorequal", - "succeeds", - "suchthat", - "suhiragana", - "sukatakana", - "sukatakanahalfwidth", - "sukunarabic", - "summation", - "sun", - "superset", - "supersetnotequal", - "supersetorequal", - "svsquare", - "syouwaerasquare", - "tabengali", - "tackdown", - "tackleft", - "tadeva", - "tagujarati", - "tagurmukhi", - "taharabic", - "tahfinalarabic", - "tahinitialarabic", - "tahiragana", - "tahmedialarabic", - "taisyouerasquare", - "takatakana", - "takatakanahalfwidth", - "tatweelarabic", - "tau", - "tav", - "tavdages", - "tavdagesh", - "tavdageshhebrew", - "tavhebrew", - "tbar", - "tbopomofo", - "tcaron", - "tccurl", - "tcedilla", - "tcheharabic", - "tchehfinalarabic", - "tchehinitialarabic", - "tchehmedialarabic", - "tchehmeeminitialarabic", - "tcircle", - "tcircumflexbelow", - "tcommaaccent", - "tdieresis", - "tdotaccent", - "tdotbelow", - "tecyrillic", - "tedescendercyrillic", - "teharabic", - "tehfinalarabic", - "tehhahinitialarabic", - "tehhahisolatedarabic", - "tehinitialarabic", - "tehiragana", - "tehjeeminitialarabic", - "tehjeemisolatedarabic", - "tehmarbutaarabic", - "tehmarbutafinalarabic", - "tehmedialarabic", - "tehmeeminitialarabic", - "tehmeemisolatedarabic", - "tehnoonfinalarabic", - "tekatakana", - "tekatakanahalfwidth", - "telephone", - "telephoneblack", - "telishagedolahebrew", - "telishaqetanahebrew", - "tencircle", - "tenideographicparen", - "tenparen", - "tenperiod", - "tenroman", - "tesh", - "tet", - "tetdagesh", - "tetdageshhebrew", - "tethebrew", - "tetsecyrillic", - "tevirhebrew", - "tevirlefthebrew", - "thabengali", - "thadeva", - "thagujarati", - "thagurmukhi", - "thalarabic", - "thalfinalarabic", - "thanthakhatlowleftthai", - "thanthakhatlowrightthai", - "thanthakhatthai", - "thanthakhatupperleftthai", - "theharabic", - "thehfinalarabic", - "thehinitialarabic", - "thehmedialarabic", - "thereexists", - "therefore", - "theta", - "theta1", - "thetasymbolgreek", - "thieuthacirclekorean", - "thieuthaparenkorean", - "thieuthcirclekorean", - "thieuthkorean", - "thieuthparenkorean", - "thirteencircle", - "thirteenparen", - "thirteenperiod", - "thonangmonthothai", - "thook", - "thophuthaothai", - "thothahanthai", - "thothanthai", - "thothongthai", - "thothungthai", - "thousandcyrillic", - "thousandsseparatorarabic", - "thousandsseparatorpersian", - "threearabic", - "threebengali", - "threecircle", - "threecircleinversesansserif", - "threedeva", - "threegujarati", - "threegurmukhi", - "threehackarabic", - "threehangzhou", - "threeideographicparen", - "threemonospace", - "threenumeratorbengali", - "threeparen", - "threeperiod", - "threepersian", - "threeroman", - "threethai", - "thzsquare", - "tihiragana", - "tikatakana", - "tikatakanahalfwidth", - "tikeutacirclekorean", - "tikeutaparenkorean", - "tikeutcirclekorean", - "tikeutkorean", - "tikeutparenkorean", - "tildebelowcmb", - "tildecmb", - "tildecomb", - "tildedoublecmb", - "tildeoperator", - "tildeoverlaycmb", - "tildeverticalcmb", - "timescircle", - "tipehahebrew", - "tipehalefthebrew", - "tippigurmukhi", - "titlocyrilliccmb", - "tiwnarmenian", - "tlinebelow", - "tmonospace", - "toarmenian", - "tohiragana", - "tokatakana", - "tokatakanahalfwidth", - "tonebarextrahighmod", - "tonebarextralowmod", - "tonebarhighmod", - "tonebarlowmod", - "tonebarmidmod", - "tonefive", - "tonesix", - "tonetwo", - "tonos", - "tonsquare", - "topatakthai", - "tortoiseshellbracketleft", - "tortoiseshellbracketleftsmall", - "tortoiseshellbracketleftvertical", - "tortoiseshellbracketright", - "tortoiseshellbracketrightsmall", - "tortoiseshellbracketrightvertical", - "totaothai", - "tpalatalhook", - "tparen", - "trademarksans", - "trademarkserif", - "tretroflexhook", - "triagdn", - "triaglf", - "triagrt", - "triagup", - "ts", - "tsadi", - "tsadidagesh", - "tsadidageshhebrew", - "tsadihebrew", - "tsecyrillic", - "tsere", - "tsere12", - "tsere1e", - "tsere2b", - "tserehebrew", - "tserenarrowhebrew", - "tserequarterhebrew", - "tserewidehebrew", - "tshecyrillic", - "ttabengali", - "ttadeva", - "ttagujarati", - "ttagurmukhi", - "tteharabic", - "ttehfinalarabic", - "ttehinitialarabic", - "ttehmedialarabic", - "tthabengali", - "tthadeva", - "tthagujarati", - "tthagurmukhi", - "tturned", - "tuhiragana", - "tukatakana", - "tukatakanahalfwidth", - "tusmallhiragana", - "tusmallkatakana", - "tusmallkatakanahalfwidth", - "twelvecircle", - "twelveparen", - "twelveperiod", - "twelveroman", - "twentycircle", - "twentyhangzhou", - "twentyparen", - "twentyperiod", - "twoarabic", - "twobengali", - "twocircle", - "twocircleinversesansserif", - "twodeva", - "twodotleader", - "twodotleadervertical", - "twogujarati", - "twogurmukhi", - "twohackarabic", - "twohangzhou", - "twoideographicparen", - "twomonospace", - "twonumeratorbengali", - "twoparen", - "twoperiod", - "twopersian", - "tworoman", - "twostroke", - "twothai", - "ubar", - "ubengali", - "ubopomofo", - "ubreve", - "ucaron", - "ucircle", - "ucircumflexbelow", - "ucyrillic", - "udattadeva", - "udblacute", - "udblgrave", - "udeva", - "udieresisacute", - "udieresisbelow", - "udieresiscaron", - "udieresiscyrillic", - "udieresisgrave", - "udieresismacron", - "udotbelow", - "ugujarati", - "ugurmukhi", - "uhiragana", - "uhookabove", - "uhorn", - "uhornacute", - "uhorndotbelow", - "uhorngrave", - "uhornhookabove", - "uhorntilde", - "uhungarumlaut", - "uhungarumlautcyrillic", - "uinvertedbreve", - "ukatakana", - "ukatakanahalfwidth", - "ukcyrillic", - "ukorean", - "umacron", - "umacroncyrillic", - "umacrondieresis", - "umatragurmukhi", - "umonospace", - "underscoredbl", - "underscoremonospace", - "underscorevertical", - "underscorewavy", - "union", - "universal", - "uogonek", - "uparen", - "upblock", - "upperdothebrew", - "upsilon", - "upsilondieresis", - "upsilondieresistonos", - "upsilonlatin", - "upsilontonos", - "uptackbelowcmb", - "uptackmod", - "uragurmukhi", - "uring", - "ushortcyrillic", - "usmallhiragana", - "usmallkatakana", - "usmallkatakanahalfwidth", - "ustraightcyrillic", - "ustraightstrokecyrillic", - "utilde", - "utildeacute", - "utildebelow", - "uubengali", - "uudeva", - "uugujarati", - "uugurmukhi", - "uumatragurmukhi", - "uuvowelsignbengali", - "uuvowelsigndeva", - "uuvowelsigngujarati", - "uvowelsignbengali", - "uvowelsigndeva", - "uvowelsigngujarati", - "vadeva", - "vagujarati", - "vagurmukhi", - "vakatakana", - "vav", - "vavdagesh", - "vavdagesh65", - "vavdageshhebrew", - "vavhebrew", - "vavholam", - "vavholamhebrew", - "vavvavhebrew", - "vavyodhebrew", - "vcircle", - "vdotbelow", - "vecyrillic", - "veharabic", - "vehfinalarabic", - "vehinitialarabic", - "vehmedialarabic", - "vekatakana", - "venus", - "verticalbar", - "verticallineabovecmb", - "verticallinebelowcmb", - "verticallinelowmod", - "verticallinemod", - "vewarmenian", - "vhook", - "vikatakana", - "viramabengali", - "viramadeva", - "viramagujarati", - "visargabengali", - "visargadeva", - "visargagujarati", - "vmonospace", - "voarmenian", - "voicediterationhiragana", - "voicediterationkatakana", - "voicedmarkkana", - "voicedmarkkanahalfwidth", - "vokatakana", - "vparen", - "vtilde", - "vturned", - "vuhiragana", - "vukatakana", - "wacute", - "waekorean", - "wahiragana", - "wakatakana", - "wakatakanahalfwidth", - "wakorean", - "wasmallhiragana", - "wasmallkatakana", - "wattosquare", - "wavedash", - "wavyunderscorevertical", - "wawarabic", - "wawfinalarabic", - "wawhamzaabovearabic", - "wawhamzaabovefinalarabic", - "wbsquare", - "wcircle", - "wcircumflex", - "wdieresis", - "wdotaccent", - "wdotbelow", - "wehiragana", - "weierstrass", - "wekatakana", - "wekorean", - "weokorean", - "wgrave", - "whitebullet", - "whitecircle", - "whitecircleinverse", - "whitecornerbracketleft", - "whitecornerbracketleftvertical", - "whitecornerbracketright", - "whitecornerbracketrightvertical", - "whitediamond", - "whitediamondcontainingblacksmalldiamond", - "whitedownpointingsmalltriangle", - "whitedownpointingtriangle", - "whiteleftpointingsmalltriangle", - "whiteleftpointingtriangle", - "whitelenticularbracketleft", - "whitelenticularbracketright", - "whiterightpointingsmalltriangle", - "whiterightpointingtriangle", - "whitesmallsquare", - "whitesmilingface", - "whitesquare", - "whitestar", - "whitetelephone", - "whitetortoiseshellbracketleft", - "whitetortoiseshellbracketright", - "whiteuppointingsmalltriangle", - "whiteuppointingtriangle", - "wihiragana", - "wikatakana", - "wikorean", - "wmonospace", - "wohiragana", - "wokatakana", - "wokatakanahalfwidth", - "won", - "wonmonospace", - "wowaenthai", - "wparen", - "wring", - "wsuperior", - "wturned", - "wynn", - "xabovecmb", - "xbopomofo", - "xcircle", - "xdieresis", - "xdotaccent", - "xeharmenian", - "xi", - "xmonospace", - "xparen", - "xsuperior", - "yaadosquare", - "yabengali", - "yadeva", - "yaekorean", - "yagujarati", - "yagurmukhi", - "yahiragana", - "yakatakana", - "yakatakanahalfwidth", - "yakorean", - "yamakkanthai", - "yasmallhiragana", - "yasmallkatakana", - "yasmallkatakanahalfwidth", - "yatcyrillic", - "ycircle", - "ycircumflex", - "ydotaccent", - "ydotbelow", - "yeharabic", - "yehbarreearabic", - "yehbarreefinalarabic", - "yehfinalarabic", - "yehhamzaabovearabic", - "yehhamzaabovefinalarabic", - "yehhamzaaboveinitialarabic", - "yehhamzaabovemedialarabic", - "yehinitialarabic", - "yehmedialarabic", - "yehmeeminitialarabic", - "yehmeemisolatedarabic", - "yehnoonfinalarabic", - "yehthreedotsbelowarabic", - "yekorean", - "yenmonospace", - "yeokorean", - "yeorinhieuhkorean", - "yerahbenyomohebrew", - "yerahbenyomolefthebrew", - "yericyrillic", - "yerudieresiscyrillic", - "yesieungkorean", - "yesieungpansioskorean", - "yesieungsioskorean", - "yetivhebrew", - "ygrave", - "yhook", - "yhookabove", - "yiarmenian", - "yicyrillic", - "yikorean", - "yinyang", - "yiwnarmenian", - "ymonospace", - "yod", - "yoddagesh", - "yoddageshhebrew", - "yodhebrew", - "yodyodhebrew", - "yodyodpatahhebrew", - "yohiragana", - "yoikorean", - "yokatakana", - "yokatakanahalfwidth", - "yokorean", - "yosmallhiragana", - "yosmallkatakana", - "yosmallkatakanahalfwidth", - "yotgreek", - "yoyaekorean", - "yoyakorean", - "yoyakthai", - "yoyingthai", - "yparen", - "ypogegrammeni", - "ypogegrammenigreekcmb", - "yr", - "yring", - "ysuperior", - "ytilde", - "yturned", - "yuhiragana", - "yuikorean", - "yukatakana", - "yukatakanahalfwidth", - "yukorean", - "yusbigcyrillic", - "yusbigiotifiedcyrillic", - "yuslittlecyrillic", - "yuslittleiotifiedcyrillic", - "yusmallhiragana", - "yusmallkatakana", - "yusmallkatakanahalfwidth", - "yuyekorean", - "yuyeokorean", - "yyabengali", - "yyadeva", - "zaarmenian", - "zacute", - "zadeva", - "zagurmukhi", - "zaharabic", - "zahfinalarabic", - "zahinitialarabic", - "zahiragana", - "zahmedialarabic", - "zainarabic", - "zainfinalarabic", - "zakatakana", - "zaqefgadolhebrew", - "zaqefqatanhebrew", - "zarqahebrew", - "zayin", - "zayindagesh", - "zayindageshhebrew", - "zayinhebrew", - "zbopomofo", - "zcircle", - "zcircumflex", - "zcurl", - "zdot", - "zdotaccent", - "zdotbelow", - "zecyrillic", - "zedescendercyrillic", - "zedieresiscyrillic", - "zehiragana", - "zekatakana", - "zeroarabic", - "zerobengali", - "zerodeva", - "zerogujarati", - "zerogurmukhi", - "zerohackarabic", - "zeromonospace", - "zeropersian", - "zerothai", - "zerowidthjoiner", - "zerowidthnonjoiner", - "zerowidthspace", - "zeta", - "zhbopomofo", - "zhearmenian", - "zhebrevecyrillic", - "zhecyrillic", - "zhedescendercyrillic", - "zhedieresiscyrillic", - "zihiragana", - "zikatakana", - "zinorhebrew", - "zlinebelow", - "zmonospace", - "zohiragana", - "zokatakana", - "zparen", - "zretroflexhook", - "zstroke", - "zuhiragana", - "zukatakana", - -#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ - - NULL + '.','n','u','l','l', 0, + 'n','o','n','m','a','r','k','i','n','g','r','e','t','u','r','n', 0, + 'n','o','t','e','q','u','a','l', 0, + 'i','n','f','i','n','i','t','y', 0, + 'l','e','s','s','e','q','u','a','l', 0, + 'g','r','e','a','t','e','r','e','q','u','a','l', 0, + 'p','a','r','t','i','a','l','d','i','f','f', 0, + 's','u','m','m','a','t','i','o','n', 0, + 'p','r','o','d','u','c','t', 0, + 'p','i', 0, + 'i','n','t','e','g','r','a','l', 0, + 'O','m','e','g','a', 0, + 'r','a','d','i','c','a','l', 0, + 'a','p','p','r','o','x','e','q','u','a','l', 0, + 'D','e','l','t','a', 0, + 'n','o','n','b','r','e','a','k','i','n','g','s','p','a','c','e', 0, + 'l','o','z','e','n','g','e', 0, + 'a','p','p','l','e', 0, + 'f','r','a','n','c', 0, + 'G','b','r','e','v','e', 0, + 'g','b','r','e','v','e', 0, + 'I','d','o','t','a','c','c','e','n','t', 0, + 'S','c','e','d','i','l','l','a', 0, + 's','c','e','d','i','l','l','a', 0, + 'C','a','c','u','t','e', 0, + 'c','a','c','u','t','e', 0, + 'C','c','a','r','o','n', 0, + 'c','c','a','r','o','n', 0, + 'd','c','r','o','a','t', 0, + '.','n','o','t','d','e','f', 0, + 's','p','a','c','e', 0, + 'e','x','c','l','a','m', 0, + 'q','u','o','t','e','d','b','l', 0, + 'n','u','m','b','e','r','s','i','g','n', 0, + 'd','o','l','l','a','r', 0, + 'p','e','r','c','e','n','t', 0, + 'a','m','p','e','r','s','a','n','d', 0, + 'q','u','o','t','e','r','i','g','h','t', 0, + 'p','a','r','e','n','l','e','f','t', 0, + 'p','a','r','e','n','r','i','g','h','t', 0, + 'a','s','t','e','r','i','s','k', 0, + 'p','l','u','s', 0, + 'c','o','m','m','a', 0, + 'h','y','p','h','e','n', 0, + 'p','e','r','i','o','d', 0, + 's','l','a','s','h', 0, + 'z','e','r','o', 0, + 'o','n','e', 0, + 't','w','o', 0, + 't','h','r','e','e', 0, + 'f','o','u','r', 0, + 'f','i','v','e', 0, + 's','i','x', 0, + 's','e','v','e','n', 0, + 'e','i','g','h','t', 0, + 'n','i','n','e', 0, + 'c','o','l','o','n', 0, + 's','e','m','i','c','o','l','o','n', 0, + 'l','e','s','s', 0, + 'e','q','u','a','l', 0, + 'g','r','e','a','t','e','r', 0, + 'q','u','e','s','t','i','o','n', 0, + 'a','t', 0, + 'A', 0, + 'B', 0, + 'C', 0, + 'D', 0, + 'E', 0, + 'F', 0, + 'G', 0, + 'H', 0, + 'I', 0, + 'J', 0, + 'K', 0, + 'L', 0, + 'M', 0, + 'N', 0, + 'O', 0, + 'P', 0, + 'Q', 0, + 'R', 0, + 'S', 0, + 'T', 0, + 'U', 0, + 'V', 0, + 'W', 0, + 'X', 0, + 'Y', 0, + 'Z', 0, + 'b','r','a','c','k','e','t','l','e','f','t', 0, + 'b','a','c','k','s','l','a','s','h', 0, + 'b','r','a','c','k','e','t','r','i','g','h','t', 0, + 'a','s','c','i','i','c','i','r','c','u','m', 0, + 'u','n','d','e','r','s','c','o','r','e', 0, + 'q','u','o','t','e','l','e','f','t', 0, + 'a', 0, + 'b', 0, + 'c', 0, + 'd', 0, + 'e', 0, + 'f', 0, + 'g', 0, + 'h', 0, + 'i', 0, + 'j', 0, + 'k', 0, + 'l', 0, + 'm', 0, + 'n', 0, + 'o', 0, + 'p', 0, + 'q', 0, + 'r', 0, + 's', 0, + 't', 0, + 'u', 0, + 'v', 0, + 'w', 0, + 'x', 0, + 'y', 0, + 'z', 0, + 'b','r','a','c','e','l','e','f','t', 0, + 'b','a','r', 0, + 'b','r','a','c','e','r','i','g','h','t', 0, + 'a','s','c','i','i','t','i','l','d','e', 0, + 'e','x','c','l','a','m','d','o','w','n', 0, + 'c','e','n','t', 0, + 's','t','e','r','l','i','n','g', 0, + 'f','r','a','c','t','i','o','n', 0, + 'y','e','n', 0, + 'f','l','o','r','i','n', 0, + 's','e','c','t','i','o','n', 0, + 'c','u','r','r','e','n','c','y', 0, + 'q','u','o','t','e','s','i','n','g','l','e', 0, + 'q','u','o','t','e','d','b','l','l','e','f','t', 0, + 'g','u','i','l','l','e','m','o','t','l','e','f','t', 0, + 'g','u','i','l','s','i','n','g','l','l','e','f','t', 0, + 'g','u','i','l','s','i','n','g','l','r','i','g','h','t', 0, + 'f','i', 0, + 'f','l', 0, + 'e','n','d','a','s','h', 0, + 'd','a','g','g','e','r', 0, + 'd','a','g','g','e','r','d','b','l', 0, + 'p','e','r','i','o','d','c','e','n','t','e','r','e','d', 0, + 'p','a','r','a','g','r','a','p','h', 0, + 'b','u','l','l','e','t', 0, + 'q','u','o','t','e','s','i','n','g','l','b','a','s','e', 0, + 'q','u','o','t','e','d','b','l','b','a','s','e', 0, + 'q','u','o','t','e','d','b','l','r','i','g','h','t', 0, + 'g','u','i','l','l','e','m','o','t','r','i','g','h','t', 0, + 'e','l','l','i','p','s','i','s', 0, + 'p','e','r','t','h','o','u','s','a','n','d', 0, + 'q','u','e','s','t','i','o','n','d','o','w','n', 0, + 'g','r','a','v','e', 0, + 'a','c','u','t','e', 0, + 'c','i','r','c','u','m','f','l','e','x', 0, + 't','i','l','d','e', 0, + 'm','a','c','r','o','n', 0, + 'b','r','e','v','e', 0, + 'd','o','t','a','c','c','e','n','t', 0, + 'd','i','e','r','e','s','i','s', 0, + 'r','i','n','g', 0, + 'c','e','d','i','l','l','a', 0, + 'h','u','n','g','a','r','u','m','l','a','u','t', 0, + 'o','g','o','n','e','k', 0, + 'c','a','r','o','n', 0, + 'e','m','d','a','s','h', 0, + 'A','E', 0, + 'o','r','d','f','e','m','i','n','i','n','e', 0, + 'L','s','l','a','s','h', 0, + 'O','s','l','a','s','h', 0, + 'O','E', 0, + 'o','r','d','m','a','s','c','u','l','i','n','e', 0, + 'a','e', 0, + 'd','o','t','l','e','s','s','i', 0, + 'l','s','l','a','s','h', 0, + 'o','s','l','a','s','h', 0, + 'o','e', 0, + 'g','e','r','m','a','n','d','b','l','s', 0, + 'o','n','e','s','u','p','e','r','i','o','r', 0, + 'l','o','g','i','c','a','l','n','o','t', 0, + 'm','u', 0, + 't','r','a','d','e','m','a','r','k', 0, + 'E','t','h', 0, + 'o','n','e','h','a','l','f', 0, + 'p','l','u','s','m','i','n','u','s', 0, + 'T','h','o','r','n', 0, + 'o','n','e','q','u','a','r','t','e','r', 0, + 'd','i','v','i','d','e', 0, + 'b','r','o','k','e','n','b','a','r', 0, + 'd','e','g','r','e','e', 0, + 't','h','o','r','n', 0, + 't','h','r','e','e','q','u','a','r','t','e','r','s', 0, + 't','w','o','s','u','p','e','r','i','o','r', 0, + 'r','e','g','i','s','t','e','r','e','d', 0, + 'm','i','n','u','s', 0, + 'e','t','h', 0, + 'm','u','l','t','i','p','l','y', 0, + 't','h','r','e','e','s','u','p','e','r','i','o','r', 0, + 'c','o','p','y','r','i','g','h','t', 0, + 'A','a','c','u','t','e', 0, + 'A','c','i','r','c','u','m','f','l','e','x', 0, + 'A','d','i','e','r','e','s','i','s', 0, + 'A','g','r','a','v','e', 0, + 'A','r','i','n','g', 0, + 'A','t','i','l','d','e', 0, + 'C','c','e','d','i','l','l','a', 0, + 'E','a','c','u','t','e', 0, + 'E','c','i','r','c','u','m','f','l','e','x', 0, + 'E','d','i','e','r','e','s','i','s', 0, + 'E','g','r','a','v','e', 0, + 'I','a','c','u','t','e', 0, + 'I','c','i','r','c','u','m','f','l','e','x', 0, + 'I','d','i','e','r','e','s','i','s', 0, + 'I','g','r','a','v','e', 0, + 'N','t','i','l','d','e', 0, + 'O','a','c','u','t','e', 0, + 'O','c','i','r','c','u','m','f','l','e','x', 0, + 'O','d','i','e','r','e','s','i','s', 0, + 'O','g','r','a','v','e', 0, + 'O','t','i','l','d','e', 0, + 'S','c','a','r','o','n', 0, + 'U','a','c','u','t','e', 0, + 'U','c','i','r','c','u','m','f','l','e','x', 0, + 'U','d','i','e','r','e','s','i','s', 0, + 'U','g','r','a','v','e', 0, + 'Y','a','c','u','t','e', 0, + 'Y','d','i','e','r','e','s','i','s', 0, + 'Z','c','a','r','o','n', 0, + 'a','a','c','u','t','e', 0, + 'a','c','i','r','c','u','m','f','l','e','x', 0, + 'a','d','i','e','r','e','s','i','s', 0, + 'a','g','r','a','v','e', 0, + 'a','r','i','n','g', 0, + 'a','t','i','l','d','e', 0, + 'c','c','e','d','i','l','l','a', 0, + 'e','a','c','u','t','e', 0, + 'e','c','i','r','c','u','m','f','l','e','x', 0, + 'e','d','i','e','r','e','s','i','s', 0, + 'e','g','r','a','v','e', 0, + 'i','a','c','u','t','e', 0, + 'i','c','i','r','c','u','m','f','l','e','x', 0, + 'i','d','i','e','r','e','s','i','s', 0, + 'i','g','r','a','v','e', 0, + 'n','t','i','l','d','e', 0, + 'o','a','c','u','t','e', 0, + 'o','c','i','r','c','u','m','f','l','e','x', 0, + 'o','d','i','e','r','e','s','i','s', 0, + 'o','g','r','a','v','e', 0, + 'o','t','i','l','d','e', 0, + 's','c','a','r','o','n', 0, + 'u','a','c','u','t','e', 0, + 'u','c','i','r','c','u','m','f','l','e','x', 0, + 'u','d','i','e','r','e','s','i','s', 0, + 'u','g','r','a','v','e', 0, + 'y','a','c','u','t','e', 0, + 'y','d','i','e','r','e','s','i','s', 0, + 'z','c','a','r','o','n', 0, + 'e','x','c','l','a','m','s','m','a','l','l', 0, + 'H','u','n','g','a','r','u','m','l','a','u','t','s','m','a','l','l', 0, + 'd','o','l','l','a','r','o','l','d','s','t','y','l','e', 0, + 'd','o','l','l','a','r','s','u','p','e','r','i','o','r', 0, + 'a','m','p','e','r','s','a','n','d','s','m','a','l','l', 0, + 'A','c','u','t','e','s','m','a','l','l', 0, + 'p','a','r','e','n','l','e','f','t','s','u','p','e','r','i','o','r', 0, + 'p','a','r','e','n','r','i','g','h','t','s','u','p','e','r','i','o','r', 0, + 't','w','o','d','o','t','e','n','l','e','a','d','e','r', 0, + 'o','n','e','d','o','t','e','n','l','e','a','d','e','r', 0, + 'z','e','r','o','o','l','d','s','t','y','l','e', 0, + 'o','n','e','o','l','d','s','t','y','l','e', 0, + 't','w','o','o','l','d','s','t','y','l','e', 0, + 't','h','r','e','e','o','l','d','s','t','y','l','e', 0, + 'f','o','u','r','o','l','d','s','t','y','l','e', 0, + 'f','i','v','e','o','l','d','s','t','y','l','e', 0, + 's','i','x','o','l','d','s','t','y','l','e', 0, + 's','e','v','e','n','o','l','d','s','t','y','l','e', 0, + 'e','i','g','h','t','o','l','d','s','t','y','l','e', 0, + 'n','i','n','e','o','l','d','s','t','y','l','e', 0, + 'c','o','m','m','a','s','u','p','e','r','i','o','r', 0, + 't','h','r','e','e','q','u','a','r','t','e','r','s','e','m','d','a','s','h', 0, + 'p','e','r','i','o','d','s','u','p','e','r','i','o','r', 0, + 'q','u','e','s','t','i','o','n','s','m','a','l','l', 0, + 'a','s','u','p','e','r','i','o','r', 0, + 'b','s','u','p','e','r','i','o','r', 0, + 'c','e','n','t','s','u','p','e','r','i','o','r', 0, + 'd','s','u','p','e','r','i','o','r', 0, + 'e','s','u','p','e','r','i','o','r', 0, + 'i','s','u','p','e','r','i','o','r', 0, + 'l','s','u','p','e','r','i','o','r', 0, + 'm','s','u','p','e','r','i','o','r', 0, + 'n','s','u','p','e','r','i','o','r', 0, + 'o','s','u','p','e','r','i','o','r', 0, + 'r','s','u','p','e','r','i','o','r', 0, + 's','s','u','p','e','r','i','o','r', 0, + 't','s','u','p','e','r','i','o','r', 0, + 'f','f', 0, + 'f','f','i', 0, + 'f','f','l', 0, + 'p','a','r','e','n','l','e','f','t','i','n','f','e','r','i','o','r', 0, + 'p','a','r','e','n','r','i','g','h','t','i','n','f','e','r','i','o','r', 0, + 'C','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0, + 'h','y','p','h','e','n','s','u','p','e','r','i','o','r', 0, + 'G','r','a','v','e','s','m','a','l','l', 0, + 'A','s','m','a','l','l', 0, + 'B','s','m','a','l','l', 0, + 'C','s','m','a','l','l', 0, + 'D','s','m','a','l','l', 0, + 'E','s','m','a','l','l', 0, + 'F','s','m','a','l','l', 0, + 'G','s','m','a','l','l', 0, + 'H','s','m','a','l','l', 0, + 'I','s','m','a','l','l', 0, + 'J','s','m','a','l','l', 0, + 'K','s','m','a','l','l', 0, + 'L','s','m','a','l','l', 0, + 'M','s','m','a','l','l', 0, + 'N','s','m','a','l','l', 0, + 'O','s','m','a','l','l', 0, + 'P','s','m','a','l','l', 0, + 'Q','s','m','a','l','l', 0, + 'R','s','m','a','l','l', 0, + 'S','s','m','a','l','l', 0, + 'T','s','m','a','l','l', 0, + 'U','s','m','a','l','l', 0, + 'V','s','m','a','l','l', 0, + 'W','s','m','a','l','l', 0, + 'X','s','m','a','l','l', 0, + 'Y','s','m','a','l','l', 0, + 'Z','s','m','a','l','l', 0, + 'c','o','l','o','n','m','o','n','e','t','a','r','y', 0, + 'o','n','e','f','i','t','t','e','d', 0, + 'r','u','p','i','a','h', 0, + 'T','i','l','d','e','s','m','a','l','l', 0, + 'e','x','c','l','a','m','d','o','w','n','s','m','a','l','l', 0, + 'c','e','n','t','o','l','d','s','t','y','l','e', 0, + 'L','s','l','a','s','h','s','m','a','l','l', 0, + 'S','c','a','r','o','n','s','m','a','l','l', 0, + 'Z','c','a','r','o','n','s','m','a','l','l', 0, + 'D','i','e','r','e','s','i','s','s','m','a','l','l', 0, + 'B','r','e','v','e','s','m','a','l','l', 0, + 'C','a','r','o','n','s','m','a','l','l', 0, + 'D','o','t','a','c','c','e','n','t','s','m','a','l','l', 0, + 'M','a','c','r','o','n','s','m','a','l','l', 0, + 'f','i','g','u','r','e','d','a','s','h', 0, + 'h','y','p','h','e','n','i','n','f','e','r','i','o','r', 0, + 'O','g','o','n','e','k','s','m','a','l','l', 0, + 'R','i','n','g','s','m','a','l','l', 0, + 'C','e','d','i','l','l','a','s','m','a','l','l', 0, + 'q','u','e','s','t','i','o','n','d','o','w','n','s','m','a','l','l', 0, + 'o','n','e','e','i','g','h','t','h', 0, + 't','h','r','e','e','e','i','g','h','t','h','s', 0, + 'f','i','v','e','e','i','g','h','t','h','s', 0, + 's','e','v','e','n','e','i','g','h','t','h','s', 0, + 'o','n','e','t','h','i','r','d', 0, + 't','w','o','t','h','i','r','d','s', 0, + 'z','e','r','o','s','u','p','e','r','i','o','r', 0, + 'f','o','u','r','s','u','p','e','r','i','o','r', 0, + 'f','i','v','e','s','u','p','e','r','i','o','r', 0, + 's','i','x','s','u','p','e','r','i','o','r', 0, + 's','e','v','e','n','s','u','p','e','r','i','o','r', 0, + 'e','i','g','h','t','s','u','p','e','r','i','o','r', 0, + 'n','i','n','e','s','u','p','e','r','i','o','r', 0, + 'z','e','r','o','i','n','f','e','r','i','o','r', 0, + 'o','n','e','i','n','f','e','r','i','o','r', 0, + 't','w','o','i','n','f','e','r','i','o','r', 0, + 't','h','r','e','e','i','n','f','e','r','i','o','r', 0, + 'f','o','u','r','i','n','f','e','r','i','o','r', 0, + 'f','i','v','e','i','n','f','e','r','i','o','r', 0, + 's','i','x','i','n','f','e','r','i','o','r', 0, + 's','e','v','e','n','i','n','f','e','r','i','o','r', 0, + 'e','i','g','h','t','i','n','f','e','r','i','o','r', 0, + 'n','i','n','e','i','n','f','e','r','i','o','r', 0, + 'c','e','n','t','i','n','f','e','r','i','o','r', 0, + 'd','o','l','l','a','r','i','n','f','e','r','i','o','r', 0, + 'p','e','r','i','o','d','i','n','f','e','r','i','o','r', 0, + 'c','o','m','m','a','i','n','f','e','r','i','o','r', 0, + 'A','g','r','a','v','e','s','m','a','l','l', 0, + 'A','a','c','u','t','e','s','m','a','l','l', 0, + 'A','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0, + 'A','t','i','l','d','e','s','m','a','l','l', 0, + 'A','d','i','e','r','e','s','i','s','s','m','a','l','l', 0, + 'A','r','i','n','g','s','m','a','l','l', 0, + 'A','E','s','m','a','l','l', 0, + 'C','c','e','d','i','l','l','a','s','m','a','l','l', 0, + 'E','g','r','a','v','e','s','m','a','l','l', 0, + 'E','a','c','u','t','e','s','m','a','l','l', 0, + 'E','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0, + 'E','d','i','e','r','e','s','i','s','s','m','a','l','l', 0, + 'I','g','r','a','v','e','s','m','a','l','l', 0, + 'I','a','c','u','t','e','s','m','a','l','l', 0, + 'I','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0, + 'I','d','i','e','r','e','s','i','s','s','m','a','l','l', 0, + 'E','t','h','s','m','a','l','l', 0, + 'N','t','i','l','d','e','s','m','a','l','l', 0, + 'O','g','r','a','v','e','s','m','a','l','l', 0, + 'O','a','c','u','t','e','s','m','a','l','l', 0, + 'O','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0, + 'O','t','i','l','d','e','s','m','a','l','l', 0, + 'O','d','i','e','r','e','s','i','s','s','m','a','l','l', 0, + 'O','E','s','m','a','l','l', 0, + 'O','s','l','a','s','h','s','m','a','l','l', 0, + 'U','g','r','a','v','e','s','m','a','l','l', 0, + 'U','a','c','u','t','e','s','m','a','l','l', 0, + 'U','c','i','r','c','u','m','f','l','e','x','s','m','a','l','l', 0, + 'U','d','i','e','r','e','s','i','s','s','m','a','l','l', 0, + 'Y','a','c','u','t','e','s','m','a','l','l', 0, + 'T','h','o','r','n','s','m','a','l','l', 0, + 'Y','d','i','e','r','e','s','i','s','s','m','a','l','l', 0, + '0','0','1','.','0','0','0', 0, + '0','0','1','.','0','0','1', 0, + '0','0','1','.','0','0','2', 0, + '0','0','1','.','0','0','3', 0, + 'B','l','a','c','k', 0, + 'B','o','l','d', 0, + 'B','o','o','k', 0, + 'L','i','g','h','t', 0, + 'M','e','d','i','u','m', 0, + 'R','e','g','u','l','a','r', 0, + 'R','o','m','a','n', 0, + 'S','e','m','i','b','o','l','d', 0, }; - static const char* const * const sid_standard_names = ps_glyph_names + 2; +#define FT_NUM_MAC_NAMES 258 + /* Values are offsets into the `ft_standard_glyph_names' table */ -#define NUM_SID_GLYPHS 391 - -#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST -#define NUM_ADOBE_GLYPHS 4294 -#else -#define NUM_ADOBE_GLYPHS 391 -#endif - - - static const unsigned short mac_standard_names[259] = + static const short ft_mac_names[FT_NUM_MAC_NAMES] = { - 2, - 0, - 1, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 106, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 126, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 96, - 97, - 175, - 177, - 179, - 180, - 188, - 191, - 197, - 202, - 205, - 203, - 204, - 207, - 206, - 208, - 209, - 212, - 210, - 211, - 213, - 216, - 214, - 215, - 217, - 218, - 221, - 219, - 220, - 222, - 224, - 227, - 225, - 226, - 114, - 163, - 99, - 100, - 104, - 118, - 117, - 151, - 167, - 172, - 155, - 127, - 133, - 2919, - 140, - 143, - 2413, - 158, - 2642, - 2156, - 102, - 154, - 3092, - 3681, - 3192, - 3153, - 2415, - 141, - 145, - 741, - 146, - 149, - 125, - 98, - 153, - 3284, - 103, - 1353, - 472, - 108, - 122, - 123, - 2901, - 176, - 178, - 193, - 144, - 150, - 113, - 139, - 107, - 121, - 67, - 10, - 161, - 2677, - 229, - 200, - 101, - 105, - 109, - 110, - 111, - 112, - 115, - 116, - 119, - 120, - 124, - 174, - 181, - 173, - 182, - 183, - 184, - 185, - 186, - 187, - 189, - 190, - 1351, - 192, - 195, - 196, - 198, - 147, - 128, - 129, - 130, - 131, - 132, - 134, - 135, - 136, - 137, - 138, - 142, - 148, - 194, - 223, - 201, - 230, - 162, - 156, - 169, - 199, - 228, - 159, - 164, - 168, - 170, - 152, - 166, - 171, - 157, - 160, - 165, - 2074, - 556, - 2091, - 609, - 836, - 3465, - 438, - 1545, - 440, - 1560, - 1767, - 0 + 253, 0, 6, 261, 267, 274, 283, 294, 301, 309, 758, 330, 340, 351, + 360, 365, 371, 378, 385, 391, 396, 400, 404, 410, 415, 420, 424, 430, + 436, 441, 447, 457, 462, 468, 476, 485, 488, 490, 492, 494, 496, 498, + 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, + 528, 530, 532, 534, 536, 538, 540, 552, 562, 575, 587, 979, 608, 610, + 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, + 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 670, 674, 685, + 1375,1392,1405,1414,1486,1512,1562,1603,1632,1610,1622,1645,1639,1652, + 1661,1690,1668,1680,1697,1726,1704,1716,1733,1740,1769,1747,1759,1776, + 1790,1819,1797,1809, 839,1263, 707, 712, 741, 881, 871,1160,1302,1346, + 1197, 985,1031, 23,1086,1108, 32,1219, 41, 51, 730,1194, 64, 76, + 86, 94, 97,1089,1118, 106,1131,1150, 966, 696,1183, 112, 734, 120, + 132, 783, 930, 945, 138,1385,1398,1529,1115,1157, 832,1079, 770, 916, + 598, 319,1246, 155,1833,1586, 721, 749, 797, 811, 826, 829, 846, 856, + 888, 903, 954,1363,1421,1356,1433,1443,1450,1457,1469,1479,1493,1500, + 163,1522,1543,1550,1572,1134, 991,1002,1008,1015,1021,1040,1045,1053, + 1066,1073,1101,1143,1536,1783,1596,1843,1253,1207,1319,1579,1826,1229, + 1270,1313,1323,1171,1290,1332,1211,1235,1276, 169, 175, 182, 189, 200, + 209, 218, 225, 232, 239, 246 }; +#define FT_NUM_SID_NAMES 391 - static const unsigned short ps_names_to_unicode[4295] = + /* Values are offsets into the `ft_standard_glyph_names' table */ + + static const short ft_sid_names[FT_NUM_SID_NAMES] = { - 0, - 0x0020U, - 0x0021U, - 0x0022U, - 0x0023U, - 0x0024U, - 0x0025U, - 0x0026U, - 0x2019U, - 0x0028U, - 0x0029U, - 0x002AU, - 0x002BU, - 0x002CU, - 0x002DU, - 0x002EU, - 0x002FU, - 0x0030U, - 0x0031U, - 0x0032U, - 0x0033U, - 0x0034U, - 0x0035U, - 0x0036U, - 0x0037U, - 0x0038U, - 0x0039U, - 0x003AU, - 0x003BU, - 0x003CU, - 0x003DU, - 0x003EU, - 0x003FU, - 0x0040U, - 0x0041U, - 0x0042U, - 0x0043U, - 0x0044U, - 0x0045U, - 0x0046U, - 0x0047U, - 0x0048U, - 0x0049U, - 0x004AU, - 0x004BU, - 0x004CU, - 0x004DU, - 0x004EU, - 0x004FU, - 0x0050U, - 0x0051U, - 0x0052U, - 0x0053U, - 0x0054U, - 0x0055U, - 0x0056U, - 0x0057U, - 0x0058U, - 0x0059U, - 0x005AU, - 0x005BU, - 0x005CU, - 0x005DU, - 0x005EU, - 0x005FU, - 0x2018U, - 0x0061U, - 0x0062U, - 0x0063U, - 0x0064U, - 0x0065U, - 0x0066U, - 0x0067U, - 0x0068U, - 0x0069U, - 0x006AU, - 0x006BU, - 0x006CU, - 0x006DU, - 0x006EU, - 0x006FU, - 0x0070U, - 0x0071U, - 0x0072U, - 0x0073U, - 0x0074U, - 0x0075U, - 0x0076U, - 0x0077U, - 0x0078U, - 0x0079U, - 0x007AU, - 0x007BU, - 0x007CU, - 0x007DU, - 0x007EU, - 0x00A1U, - 0x00A2U, - 0x00A3U, - 0x2044U, - 0x00A5U, - 0x0192U, - 0x00A7U, - 0x00A4U, - 0x0027U, - 0x201CU, - 0x00ABU, - 0x2039U, - 0x203AU, - 0xFB01U, - 0xFB02U, - 0x2013U, - 0x2020U, - 0x2021U, - 0x00B7U, - 0x00B6U, - 0x2022U, - 0x201AU, - 0x201EU, - 0x201DU, - 0x00BBU, - 0x2026U, - 0x2030U, - 0x00BFU, - 0x0060U, - 0x00B4U, - 0x02C6U, - 0x02DCU, - 0x00AFU, - 0x02D8U, - 0x02D9U, - 0x00A8U, - 0x02DAU, - 0x00B8U, - 0x02DDU, - 0x02DBU, - 0x02C7U, - 0x2014U, - 0x00C6U, - 0x00AAU, - 0x0141U, - 0x00D8U, - 0x0152U, - 0x00BAU, - 0x00E6U, - 0x0131U, - 0x0142U, - 0x00F8U, - 0x0153U, - 0x00DFU, - 0x00B9U, - 0x00ACU, - 0x00B5U, - 0x2122U, - 0x00D0U, - 0x00BDU, - 0x00B1U, - 0x00DEU, - 0x00BCU, - 0x00F7U, - 0x00A6U, - 0x00B0U, - 0x00FEU, - 0x00BEU, - 0x00B2U, - 0x00AEU, - 0x2212U, - 0x00F0U, - 0x00D7U, - 0x00B3U, - 0x00A9U, - 0x00C1U, - 0x00C2U, - 0x00C4U, - 0x00C0U, - 0x00C5U, - 0x00C3U, - 0x00C7U, - 0x00C9U, - 0x00CAU, - 0x00CBU, - 0x00C8U, - 0x00CDU, - 0x00CEU, - 0x00CFU, - 0x00CCU, - 0x00D1U, - 0x00D3U, - 0x00D4U, - 0x00D6U, - 0x00D2U, - 0x00D5U, - 0x0160U, - 0x00DAU, - 0x00DBU, - 0x00DCU, - 0x00D9U, - 0x00DDU, - 0x0178U, - 0x017DU, - 0x00E1U, - 0x00E2U, - 0x00E4U, - 0x00E0U, - 0x00E5U, - 0x00E3U, - 0x00E7U, - 0x00E9U, - 0x00EAU, - 0x00EBU, - 0x00E8U, - 0x00EDU, - 0x00EEU, - 0x00EFU, - 0x00ECU, - 0x00F1U, - 0x00F3U, - 0x00F4U, - 0x00F6U, - 0x00F2U, - 0x00F5U, - 0x0161U, - 0x00FAU, - 0x00FBU, - 0x00FCU, - 0x00F9U, - 0x00FDU, - 0x00FFU, - 0x017EU, - 0xF721U, - 0xF6F8U, - 0xF724U, - 0xF6E4U, - 0xF726U, - 0xF7B4U, - 0x207DU, - 0x207EU, - 0x2025U, - 0x2024U, - 0xF730U, - 0xF731U, - 0xF732U, - 0xF733U, - 0xF734U, - 0xF735U, - 0xF736U, - 0xF737U, - 0xF738U, - 0xF739U, - 0xF6E2U, - 0xF6DEU, - 0xF6E8U, - 0xF73FU, - 0xF6E9U, - 0xF6EAU, - 0xF6E0U, - 0xF6EBU, - 0xF6ECU, - 0xF6EDU, - 0xF6EEU, - 0xF6EFU, - 0x207FU, - 0xF6F0U, - 0xF6F1U, - 0xF6F2U, - 0xF6F3U, - 0xFB00U, - 0xFB03U, - 0xFB04U, - 0x208DU, - 0x208EU, - 0xF6F6U, - 0xF6E6U, - 0xF760U, - 0xF761U, - 0xF762U, - 0xF763U, - 0xF764U, - 0xF765U, - 0xF766U, - 0xF767U, - 0xF768U, - 0xF769U, - 0xF76AU, - 0xF76BU, - 0xF76CU, - 0xF76DU, - 0xF76EU, - 0xF76FU, - 0xF770U, - 0xF771U, - 0xF772U, - 0xF773U, - 0xF774U, - 0xF775U, - 0xF776U, - 0xF777U, - 0xF778U, - 0xF779U, - 0xF77AU, - 0x20A1U, - 0xF6DCU, - 0xF6DDU, - 0xF6FEU, - 0xF7A1U, - 0xF7A2U, - 0xF6F9U, - 0xF6FDU, - 0xF6FFU, - 0xF7A8U, - 0xF6F4U, - 0xF6F5U, - 0xF6F7U, - 0xF7AFU, - 0x2012U, - 0xF6E5U, - 0xF6FBU, - 0xF6FCU, - 0xF7B8U, - 0xF7BFU, - 0x215BU, - 0x215CU, - 0x215DU, - 0x215EU, - 0x2153U, - 0x2154U, - 0x2070U, - 0x2074U, - 0x2075U, - 0x2076U, - 0x2077U, - 0x2078U, - 0x2079U, - 0x2080U, - 0x2081U, - 0x2082U, - 0x2083U, - 0x2084U, - 0x2085U, - 0x2086U, - 0x2087U, - 0x2088U, - 0x2089U, - 0xF6DFU, - 0xF6E3U, - 0xF6E7U, - 0xF6E1U, - 0xF7E0U, - 0xF7E1U, - 0xF7E2U, - 0xF7E3U, - 0xF7E4U, - 0xF7E5U, - 0xF7E6U, - 0xF7E7U, - 0xF7E8U, - 0xF7E9U, - 0xF7EAU, - 0xF7EBU, - 0xF7ECU, - 0xF7EDU, - 0xF7EEU, - 0xF7EFU, - 0xF7F0U, - 0xF7F1U, - 0xF7F2U, - 0xF7F3U, - 0xF7F4U, - 0xF7F5U, - 0xF7F6U, - 0xF6FAU, - 0xF7F8U, - 0xF7F9U, - 0xF7FAU, - 0xF7FBU, - 0xF7FCU, - 0xF7FDU, - 0xF7FEU, - 0xF7FFU, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - -#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - - 0x01FCU, - 0x01E2U, - 0x0102U, - 0x1EAEU, - 0x04D0U, - 0x1EB6U, - 0x1EB0U, - 0x1EB2U, - 0x1EB4U, - 0x01CDU, - 0x24B6U, - 0x1EA4U, - 0x1EACU, - 0x1EA6U, - 0x1EA8U, - 0x1EAAU, - 0xF6C9U, - 0x0410U, - 0x0200U, - 0x04D2U, - 0x01DEU, - 0x1EA0U, - 0x01E0U, - 0x1EA2U, - 0x04D4U, - 0x0202U, - 0x0391U, - 0x0386U, - 0x0100U, - 0xFF21U, - 0x0104U, - 0x01FAU, - 0x1E00U, - 0x0531U, - 0x24B7U, - 0x1E02U, - 0x1E04U, - 0x0411U, - 0x0532U, - 0x0392U, - 0x0181U, - 0x1E06U, - 0xFF22U, - 0x0182U, - 0x053EU, - 0x0106U, - 0xF6CAU, - 0x010CU, - 0x1E08U, - 0x24B8U, - 0x0108U, - 0x010AU, - 0x010AU, - 0x0549U, - 0x04BCU, - 0x0427U, - 0x04BEU, - 0x04B6U, - 0x04F4U, - 0x0543U, - 0x04CBU, - 0x04B8U, - 0x03A7U, - 0x0187U, - 0xFF23U, - 0x0551U, - 0x01F1U, - 0x01C4U, - 0x0534U, - 0x0189U, - 0x010EU, - 0x1E10U, - 0x24B9U, - 0x1E12U, - 0x0110U, - 0x1E0AU, - 0x1E0CU, - 0x0414U, - 0x03EEU, - 0x2206U, - 0x0394U, - 0x018AU, - 0xF6CBU, - 0xF6CCU, - 0xF6CDU, - 0x03DCU, - 0x0402U, - 0x1E0EU, - 0xFF24U, - 0x0110U, - 0x018BU, - 0x01F2U, - 0x01C5U, - 0x04E0U, - 0x0405U, - 0x040FU, - 0x0114U, - 0x011AU, - 0x1E1CU, - 0x0535U, - 0x24BAU, - 0x1EBEU, - 0x1E18U, - 0x1EC6U, - 0x1EC0U, - 0x1EC2U, - 0x1EC4U, - 0x0404U, - 0x0204U, - 0x0116U, - 0x0116U, - 0x1EB8U, - 0x0424U, - 0x0537U, - 0x1EBAU, - 0x2167U, - 0x0206U, - 0x0464U, - 0x041BU, - 0x216AU, - 0x0112U, - 0x1E16U, - 0x1E14U, - 0x041CU, - 0xFF25U, - 0x041DU, - 0x04A2U, - 0x014AU, - 0x04A4U, - 0x04C7U, - 0x0118U, - 0x0190U, - 0x0395U, - 0x0388U, - 0x0420U, - 0x018EU, - 0x042DU, - 0x0421U, - 0x04AAU, - 0x01A9U, - 0x0397U, - 0x0538U, - 0x0389U, - 0x1EBCU, - 0x1E1AU, - 0x20ACU, - 0x01B7U, - 0x01EEU, - 0x01B8U, - 0x24BBU, - 0x1E1EU, - 0x0556U, - 0x03E4U, - 0x0191U, - 0x0472U, - 0x2164U, - 0xFF26U, - 0x2163U, - 0x3387U, - 0x01F4U, - 0x0393U, - 0x0194U, - 0x03EAU, - 0x011EU, - 0x01E6U, - 0x0122U, - 0x24BCU, - 0x011CU, - 0x0122U, - 0x0120U, - 0x0120U, - 0x0413U, - 0x0542U, - 0x0494U, - 0x0492U, - 0x0490U, - 0x0193U, - 0x0533U, - 0x0403U, - 0x1E20U, - 0xFF27U, - 0xF6CEU, - 0x029BU, - 0x01E4U, - 0x25CFU, - 0x25AAU, - 0x25ABU, - 0x25A1U, - 0x33CBU, - 0x04A8U, - 0x04B2U, - 0x042AU, - 0x0126U, - 0x1E2AU, - 0x1E28U, - 0x24BDU, - 0x0124U, - 0x1E26U, - 0x1E22U, - 0x1E24U, - 0xFF28U, - 0x0540U, - 0x03E8U, - 0xF6CFU, - 0x3390U, - 0x042FU, - 0x0132U, - 0x042EU, - 0x012CU, - 0x01CFU, - 0x24BEU, - 0x0406U, - 0x0208U, - 0x1E2EU, - 0x04E4U, - 0x0130U, - 0x0130U, - 0x1ECAU, - 0x04D6U, - 0x0415U, - 0x2111U, - 0x1EC8U, - 0x0418U, - 0x020AU, - 0x0419U, - 0x012AU, - 0x04E2U, - 0xFF29U, - 0x053BU, - 0x0401U, - 0x012EU, - 0x0399U, - 0x0196U, - 0x03AAU, - 0x038AU, - 0x0197U, - 0x0128U, - 0x1E2CU, - 0x0474U, - 0x0476U, - 0x0541U, - 0x24BFU, - 0x0134U, - 0x0408U, - 0x054BU, - 0xFF2AU, - 0x3385U, - 0x33CDU, - 0x04A0U, - 0x1E30U, - 0x041AU, - 0x049AU, - 0x04C3U, - 0x039AU, - 0x049EU, - 0x049CU, - 0x01E8U, - 0x0136U, - 0x24C0U, - 0x0136U, - 0x1E32U, - 0x0554U, - 0x053FU, - 0x0425U, - 0x03E6U, - 0x0198U, - 0x040CU, - 0x1E34U, - 0xFF2BU, - 0x0480U, - 0x03DEU, - 0x046EU, - 0x01C7U, - 0xF6BFU, - 0x0139U, - 0x039BU, - 0x013DU, - 0x013BU, - 0x24C1U, - 0x1E3CU, - 0x013BU, - 0x013FU, - 0x013FU, - 0x1E36U, - 0x1E38U, - 0x053CU, - 0x01C8U, - 0x0409U, - 0x1E3AU, - 0xFF2CU, - 0x3386U, - 0xF6D0U, - 0x1E3EU, - 0x24C2U, - 0x1E40U, - 0x1E42U, - 0x0544U, - 0xFF2DU, - 0x019CU, - 0x039CU, - 0x01CAU, - 0x0143U, - 0x0147U, - 0x0145U, - 0x24C3U, - 0x1E4AU, - 0x0145U, - 0x1E44U, - 0x1E46U, - 0x019DU, - 0x2168U, - 0x01CBU, - 0x040AU, - 0x1E48U, - 0xFF2EU, - 0x0546U, - 0x039DU, - 0x04E8U, - 0x04EAU, - 0x014EU, - 0x01D1U, - 0x019FU, - 0x24C4U, - 0x1ED0U, - 0x1ED8U, - 0x1ED2U, - 0x1ED4U, - 0x1ED6U, - 0x041EU, - 0x0150U, - 0x020CU, - 0x04E6U, - 0x1ECCU, - 0x0555U, - 0x2126U, - 0x1ECEU, - 0x01A0U, - 0x1EDAU, - 0x1EE2U, - 0x1EDCU, - 0x1EDEU, - 0x1EE0U, - 0x0150U, - 0x01A2U, - 0x020EU, - 0x014CU, - 0x1E52U, - 0x1E50U, - 0x2126U, - 0x0460U, - 0x03A9U, - 0x047AU, - 0x047CU, - 0x038FU, - 0x039FU, - 0x038CU, - 0xFF2FU, - 0x2160U, - 0x01EAU, - 0x01ECU, - 0x0186U, - 0x01FEU, - 0x01FEU, - 0x047EU, - 0x1E4CU, - 0x1E4EU, - 0x1E54U, - 0x24C5U, - 0x1E56U, - 0x041FU, - 0x054AU, - 0x04A6U, - 0x03A6U, - 0x01A4U, - 0x03A0U, - 0x0553U, - 0xFF30U, - 0x03A8U, - 0x0470U, - 0x24C6U, - 0xFF31U, - 0x054CU, - 0x0154U, - 0x0158U, - 0x0156U, - 0x24C7U, - 0x0156U, - 0x0210U, - 0x1E58U, - 0x1E5AU, - 0x1E5CU, - 0x0550U, - 0x211CU, - 0x03A1U, - 0x0212U, - 0x1E5EU, - 0xFF32U, - 0x0281U, - 0x02B6U, - 0x250CU, - 0x2514U, - 0x2510U, - 0x2518U, - 0x253CU, - 0x252CU, - 0x2534U, - 0x251CU, - 0x2524U, - 0x2500U, - 0x2502U, - 0x2561U, - 0x2562U, - 0x2556U, - 0x2555U, - 0x2563U, - 0x2551U, - 0x2557U, - 0x255DU, - 0x255CU, - 0x255BU, - 0x255EU, - 0x255FU, - 0x255AU, - 0x2554U, - 0x2569U, - 0x2566U, - 0x2560U, - 0x2550U, - 0x256CU, - 0x2567U, - 0x2568U, - 0x2564U, - 0x2565U, - 0x2559U, - 0x2558U, - 0x2552U, - 0x2553U, - 0x256BU, - 0x256AU, - 0x015AU, - 0x1E64U, - 0x03E0U, - 0x1E66U, - 0x015EU, - 0x018FU, - 0x04D8U, - 0x04DAU, - 0x24C8U, - 0x015CU, - 0x0218U, - 0x1E60U, - 0x1E62U, - 0x1E68U, - 0x054DU, - 0x2166U, - 0x0547U, - 0x0428U, - 0x0429U, - 0x03E2U, - 0x04BAU, - 0x03ECU, - 0x03A3U, - 0x2165U, - 0xFF33U, - 0x042CU, - 0x03DAU, - 0x03A4U, - 0x0166U, - 0x0164U, - 0x0162U, - 0x24C9U, - 0x1E70U, - 0x0162U, - 0x1E6AU, - 0x1E6CU, - 0x0422U, - 0x04ACU, - 0x2169U, - 0x04B4U, - 0x0398U, - 0x01ACU, - 0x2162U, - 0x054FU, - 0x1E6EU, - 0xFF34U, - 0x0539U, - 0x01BCU, - 0x0184U, - 0x01A7U, - 0x01AEU, - 0x0426U, - 0x040BU, - 0x216BU, - 0x2161U, - 0x016CU, - 0x01D3U, - 0x24CAU, - 0x1E76U, - 0x0423U, - 0x0170U, - 0x0214U, - 0x01D7U, - 0x1E72U, - 0x01D9U, - 0x04F0U, - 0x01DBU, - 0x01D5U, - 0x1EE4U, - 0x1EE6U, - 0x01AFU, - 0x1EE8U, - 0x1EF0U, - 0x1EEAU, - 0x1EECU, - 0x1EEEU, - 0x0170U, - 0x04F2U, - 0x0216U, - 0x0478U, - 0x016AU, - 0x04EEU, - 0x1E7AU, - 0xFF35U, - 0x0172U, - 0x03A5U, - 0x03D2U, - 0x03D3U, - 0x01B1U, - 0x03ABU, - 0x03D4U, - 0x03D2U, - 0x038EU, - 0x016EU, - 0x040EU, - 0x04AEU, - 0x04B0U, - 0x0168U, - 0x1E78U, - 0x1E74U, - 0x24CBU, - 0x1E7EU, - 0x0412U, - 0x054EU, - 0x01B2U, - 0xFF36U, - 0x0548U, - 0x1E7CU, - 0x1E82U, - 0x24CCU, - 0x0174U, - 0x1E84U, - 0x1E86U, - 0x1E88U, - 0x1E80U, - 0xFF37U, - 0x24CDU, - 0x1E8CU, - 0x1E8AU, - 0x053DU, - 0x039EU, - 0xFF38U, - 0x0462U, - 0x24CEU, - 0x0176U, - 0x1E8EU, - 0x1EF4U, - 0x042BU, - 0x04F8U, - 0x1EF2U, - 0x01B3U, - 0x1EF6U, - 0x0545U, - 0x0407U, - 0x0552U, - 0xFF39U, - 0x1EF8U, - 0x046AU, - 0x046CU, - 0x0466U, - 0x0468U, - 0x0536U, - 0x0179U, - 0x24CFU, - 0x1E90U, - 0x017BU, - 0x017BU, - 0x1E92U, - 0x0417U, - 0x0498U, - 0x04DEU, - 0x0396U, - 0x053AU, - 0x04C1U, - 0x0416U, - 0x0496U, - 0x04DCU, - 0x1E94U, - 0xFF3AU, - 0x01B5U, - 0x0986U, - 0x0906U, - 0x0A86U, - 0x0A06U, - 0x0A3EU, - 0x3303U, - 0x09BEU, - 0x093EU, - 0x0ABEU, - 0x055FU, - 0x0970U, - 0x0985U, - 0x311AU, - 0x0103U, - 0x1EAFU, - 0x04D1U, - 0x1EB7U, - 0x1EB1U, - 0x1EB3U, - 0x1EB5U, - 0x01CEU, - 0x24D0U, - 0x1EA5U, - 0x1EADU, - 0x1EA7U, - 0x1EA9U, - 0x1EABU, - 0x0317U, - 0x0301U, - 0x0301U, - 0x0954U, - 0x02CFU, - 0x0341U, - 0x0430U, - 0x0201U, - 0x0A71U, - 0x0905U, - 0x04D3U, - 0x01DFU, - 0x1EA1U, - 0x01E1U, - 0x01FDU, - 0x3150U, - 0x01E3U, - 0x2015U, - 0x20A4U, - 0x0410U, - 0x0411U, - 0x0412U, - 0x0413U, - 0x0414U, - 0x0415U, - 0x0401U, - 0x0416U, - 0x0417U, - 0x0418U, - 0x0419U, - 0x041AU, - 0x041BU, - 0x041CU, - 0x041DU, - 0x041EU, - 0x041FU, - 0x0420U, - 0x0421U, - 0x0422U, - 0x0423U, - 0x0424U, - 0x0425U, - 0x0426U, - 0x0427U, - 0x0428U, - 0x0429U, - 0x042AU, - 0x042BU, - 0x042CU, - 0x042DU, - 0x042EU, - 0x042FU, - 0x0490U, - 0x0402U, - 0x0403U, - 0x0404U, - 0x0405U, - 0x0406U, - 0x0407U, - 0x0408U, - 0x0409U, - 0x040AU, - 0x040BU, - 0x040CU, - 0x040EU, - 0xF6C4U, - 0xF6C5U, - 0x0430U, - 0x0431U, - 0x0432U, - 0x0433U, - 0x0434U, - 0x0435U, - 0x0451U, - 0x0436U, - 0x0437U, - 0x0438U, - 0x0439U, - 0x043AU, - 0x043BU, - 0x043CU, - 0x043DU, - 0x043EU, - 0x043FU, - 0x0440U, - 0x0441U, - 0x0442U, - 0x0443U, - 0x0444U, - 0x0445U, - 0x0446U, - 0x0447U, - 0x0448U, - 0x0449U, - 0x044AU, - 0x044BU, - 0x044CU, - 0x044DU, - 0x044EU, - 0x044FU, - 0x0491U, - 0x0452U, - 0x0453U, - 0x0454U, - 0x0455U, - 0x0456U, - 0x0457U, - 0x0458U, - 0x0459U, - 0x045AU, - 0x045BU, - 0x045CU, - 0x045EU, - 0x040FU, - 0x0462U, - 0x0472U, - 0x0474U, - 0xF6C6U, - 0x045FU, - 0x0463U, - 0x0473U, - 0x0475U, - 0xF6C7U, - 0xF6C8U, - 0x04D9U, - 0x200EU, - 0x200FU, - 0x200DU, - 0x066AU, - 0x060CU, - 0x0660U, - 0x0661U, - 0x0662U, - 0x0663U, - 0x0664U, - 0x0665U, - 0x0666U, - 0x0667U, - 0x0668U, - 0x0669U, - 0x061BU, - 0x061FU, - 0x0621U, - 0x0622U, - 0x0623U, - 0x0624U, - 0x0625U, - 0x0626U, - 0x0627U, - 0x0628U, - 0x0629U, - 0x062AU, - 0x062BU, - 0x062CU, - 0x062DU, - 0x062EU, - 0x062FU, - 0x0630U, - 0x0631U, - 0x0632U, - 0x0633U, - 0x0634U, - 0x0635U, - 0x0636U, - 0x0637U, - 0x0638U, - 0x0639U, - 0x063AU, - 0x0640U, - 0x0641U, - 0x0642U, - 0x0643U, - 0x0644U, - 0x0645U, - 0x0646U, - 0x0648U, - 0x0649U, - 0x064AU, - 0x064BU, - 0x064CU, - 0x064DU, - 0x064EU, - 0x064FU, - 0x0650U, - 0x0651U, - 0x0652U, - 0x0647U, - 0x06A4U, - 0x067EU, - 0x0686U, - 0x0698U, - 0x06AFU, - 0x0679U, - 0x0688U, - 0x0691U, - 0x06BAU, - 0x06D2U, - 0x06D5U, - 0x20AAU, - 0x05BEU, - 0x05C3U, - 0x05D0U, - 0x05D1U, - 0x05D2U, - 0x05D3U, - 0x05D4U, - 0x05D5U, - 0x05D6U, - 0x05D7U, - 0x05D8U, - 0x05D9U, - 0x05DAU, - 0x05DBU, - 0x05DCU, - 0x05DDU, - 0x05DEU, - 0x05DFU, - 0x05E0U, - 0x05E1U, - 0x05E2U, - 0x05E3U, - 0x05E4U, - 0x05E5U, - 0x05E6U, - 0x05E7U, - 0x05E8U, - 0x05E9U, - 0x05EAU, - 0xFB2AU, - 0xFB2BU, - 0xFB4BU, - 0xFB1FU, - 0x05F0U, - 0x05F1U, - 0x05F2U, - 0xFB35U, - 0x05B4U, - 0x05B5U, - 0x05B6U, - 0x05BBU, - 0x05B8U, - 0x05B7U, - 0x05B0U, - 0x05B2U, - 0x05B1U, - 0x05B3U, - 0x05C2U, - 0x05C1U, - 0x05B9U, - 0x05BCU, - 0x05BDU, - 0x05BFU, - 0x05C0U, - 0x02BCU, - 0x2105U, - 0x2113U, - 0x2116U, - 0x202CU, - 0x202DU, - 0x202EU, - 0x200CU, - 0x066DU, - 0x02BDU, - 0x0A85U, - 0x0A05U, - 0x3042U, - 0x1EA3U, - 0x0990U, - 0x311EU, - 0x0910U, - 0x04D5U, - 0x0A90U, - 0x0A10U, - 0x0A48U, - 0x0639U, - 0xFECAU, - 0xFECBU, - 0xFECCU, - 0x0203U, - 0x09C8U, - 0x0948U, - 0x0AC8U, - 0x30A2U, - 0xFF71U, - 0x314FU, - 0x05D0U, - 0x0627U, - 0xFB30U, - 0xFE8EU, - 0x0623U, - 0xFE84U, - 0x0625U, - 0xFE88U, - 0x05D0U, - 0xFB4FU, - 0x0622U, - 0xFE82U, - 0x0649U, - 0xFEF0U, - 0xFEF3U, - 0xFEF4U, - 0xFB2EU, - 0xFB2FU, - 0x2135U, - 0x224CU, - 0x03B1U, - 0x03ACU, - 0x0101U, - 0xFF41U, - 0xFF06U, - 0x33C2U, - 0x3122U, - 0x3124U, - 0x0E5AU, - 0x2220U, - 0x3008U, - 0xFE3FU, - 0x3009U, - 0xFE40U, - 0x2329U, - 0x232AU, - 0x212BU, - 0x0387U, - 0x0952U, - 0x0982U, - 0x0902U, - 0x0A82U, - 0x0105U, - 0x3300U, - 0x249CU, - 0x055AU, - 0x02BCU, - 0xF8FFU, - 0x2250U, - 0x2248U, - 0x2252U, - 0x2245U, - 0x318EU, - 0x318DU, - 0x2312U, - 0x1E9AU, - 0x01FBU, - 0x1E01U, - 0x2194U, - 0x21E3U, - 0x21E0U, - 0x21E2U, - 0x21E1U, - 0x21D4U, - 0x21D3U, - 0x21D0U, - 0x21D2U, - 0x21D1U, - 0x2193U, - 0x2199U, - 0x2198U, - 0x21E9U, - 0x02C5U, - 0x02C2U, - 0x02C3U, - 0x02C4U, - 0xF8E7U, - 0x2190U, - 0x21D0U, - 0x21CDU, - 0x21C6U, - 0x21E6U, - 0x2192U, - 0x21CFU, - 0x279EU, - 0x21C4U, - 0x21E8U, - 0x21E4U, - 0x21E5U, - 0x2191U, - 0x2195U, - 0x21A8U, - 0x21A8U, - 0x2196U, - 0x21C5U, - 0x2197U, - 0x21E7U, - 0xF8E6U, - 0xFF3EU, - 0xFF5EU, - 0x0251U, - 0x0252U, - 0x3041U, - 0x30A1U, - 0xFF67U, - 0x066DU, - 0x066DU, - 0x2217U, - 0xFF0AU, - 0xFE61U, - 0x2042U, - 0x2243U, - 0xFF20U, - 0xFE6BU, - 0x0250U, - 0x0994U, - 0x3120U, - 0x0914U, - 0x0A94U, - 0x0A14U, - 0x09D7U, - 0x0A4CU, - 0x09CCU, - 0x094CU, - 0x0ACCU, - 0x093DU, - 0x0561U, - 0x05E2U, - 0xFB20U, - 0x05E2U, - 0x09ACU, - 0xFF3CU, - 0x092CU, - 0x0AACU, - 0x0A2CU, - 0x3070U, - 0x0E3FU, - 0x30D0U, - 0xFF5CU, - 0x3105U, - 0x24D1U, - 0x1E03U, - 0x1E05U, - 0x266CU, - 0x2235U, - 0x0431U, - 0x0628U, - 0xFE90U, - 0xFE91U, - 0x3079U, - 0xFE92U, - 0xFC9FU, - 0xFC08U, - 0xFC6DU, - 0x30D9U, - 0x0562U, - 0x05D1U, - 0x03B2U, - 0x03D0U, - 0xFB31U, - 0xFB31U, - 0x05D1U, - 0xFB4CU, - 0x09ADU, - 0x092DU, - 0x0AADU, - 0x0A2DU, - 0x0253U, - 0x3073U, - 0x30D3U, - 0x0298U, - 0x0A02U, - 0x3331U, - 0x25CFU, - 0x25C6U, - 0x25BCU, - 0x25C4U, - 0x25C0U, - 0x3010U, - 0xFE3BU, - 0x3011U, - 0xFE3CU, - 0x25E3U, - 0x25E2U, - 0x25ACU, - 0x25BAU, - 0x25B6U, - 0x25AAU, - 0x263BU, - 0x25A0U, - 0x2605U, - 0x25E4U, - 0x25E5U, - 0x25B4U, - 0x25B2U, - 0x2423U, - 0x1E07U, - 0x2588U, - 0xFF42U, - 0x0E1AU, - 0x307CU, - 0x30DCU, - 0x249DU, - 0x33C3U, - 0xF8F4U, - 0xF8F3U, - 0xF8F2U, - 0xFF5BU, - 0xFE5BU, - 0xF8F1U, - 0xFE37U, - 0xF8FEU, - 0xF8FDU, - 0xFF5DU, - 0xFE5CU, - 0xF8FCU, - 0xFE38U, - 0xF8F0U, - 0xF8EFU, - 0xFF3BU, - 0xF8EEU, - 0xF8FBU, - 0xF8FAU, - 0xFF3DU, - 0xF8F9U, - 0x032EU, - 0x0306U, - 0x032FU, - 0x0311U, - 0x0361U, - 0x032AU, - 0x033AU, - 0x0180U, - 0x0183U, - 0x3076U, - 0x30D6U, - 0x25D8U, - 0x2219U, - 0x25CEU, - 0x056EU, - 0x099AU, - 0x0107U, - 0x091AU, - 0x0A9AU, - 0x0A1AU, - 0x3388U, - 0x0981U, - 0x0310U, - 0x0901U, - 0x0A81U, - 0x21EAU, - 0x2105U, - 0x032CU, - 0x030CU, - 0x21B5U, - 0x3118U, - 0x010DU, - 0x1E09U, - 0x24D2U, - 0x0109U, - 0x0255U, - 0x010BU, - 0x010BU, - 0x33C5U, - 0x0327U, - 0x2103U, - 0xFFE0U, - 0x0579U, - 0x099BU, - 0x091BU, - 0x0A9BU, - 0x0A1BU, - 0x3114U, - 0x04BDU, - 0x2713U, - 0x0447U, - 0x04BFU, - 0x04B7U, - 0x04F5U, - 0x0573U, - 0x04CCU, - 0x04B9U, - 0x03C7U, - 0x3277U, - 0x3217U, - 0x3269U, - 0x314AU, - 0x3209U, - 0x0E0AU, - 0x0E08U, - 0x0E09U, - 0x0E0CU, - 0x0188U, - 0x3276U, - 0x3216U, - 0x3268U, - 0x3148U, - 0x3208U, - 0x321CU, - 0x25CBU, - 0x2297U, - 0x2299U, - 0x2295U, - 0x3036U, - 0x25D0U, - 0x25D1U, - 0x032DU, - 0x0302U, - 0x2327U, - 0x01C2U, - 0x01C0U, - 0x01C1U, - 0x01C3U, - 0x2663U, - 0x2663U, - 0x2667U, - 0x33A4U, - 0xFF43U, - 0x33A0U, - 0x0581U, - 0xFF1AU, - 0x20A1U, - 0xFE55U, - 0x02D1U, - 0x02D0U, - 0x0313U, - 0x0315U, - 0xF6C3U, - 0x060CU, - 0x055DU, - 0xFF0CU, - 0x0314U, - 0x02BDU, - 0xFE50U, - 0x0312U, - 0x02BBU, - 0x263CU, - 0x2245U, - 0x222EU, - 0x2303U, - 0x0006U, - 0x0007U, - 0x0008U, - 0x0018U, - 0x000DU, - 0x0011U, - 0x0012U, - 0x0013U, - 0x0014U, - 0x007FU, - 0x0010U, - 0x0019U, - 0x0005U, - 0x0004U, - 0x001BU, - 0x0017U, - 0x0003U, - 0x000CU, - 0x001CU, - 0x001DU, - 0x0009U, - 0x000AU, - 0x0015U, - 0x001EU, - 0x000FU, - 0x000EU, - 0x0002U, - 0x0001U, - 0x001AU, - 0x0016U, - 0x001FU, - 0x000BU, - 0xF8E9U, - 0xF6D9U, - 0x300CU, - 0xFF62U, - 0xFE41U, - 0x300DU, - 0xFF63U, - 0xFE42U, - 0x337FU, - 0x33C7U, - 0x33C6U, - 0x249EU, - 0x20A2U, - 0x0297U, - 0x22CFU, - 0x22CEU, - 0xF6D1U, - 0xF6D2U, - 0xF6D4U, - 0xF6D5U, - 0x0564U, - 0x09A6U, - 0x0636U, - 0x0926U, - 0xFEBEU, - 0xFEBFU, - 0xFEC0U, - 0x05BCU, - 0x05BCU, - 0x0AA6U, - 0x0A26U, - 0x3060U, - 0x30C0U, - 0x062FU, - 0x05D3U, - 0xFB33U, - 0xFB33U, - 0, - 0, - 0, - 0, - 0x05D3U, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0xFEAAU, - 0x064FU, - 0x064FU, - 0x064CU, - 0x064CU, - 0x0964U, - 0x05A7U, - 0x05A7U, - 0x0485U, - 0xF6D3U, - 0x300AU, - 0xFE3DU, - 0x300BU, - 0xFE3EU, - 0x032BU, - 0x21D4U, - 0x21D2U, - 0x0965U, - 0xF6D6U, - 0x030FU, - 0x222CU, - 0x2017U, - 0x0333U, - 0x033FU, - 0x02BAU, - 0x2016U, - 0x030EU, - 0x3109U, - 0x33C8U, - 0x010FU, - 0x1E11U, - 0x24D3U, - 0x1E13U, - 0x0111U, - 0x09A1U, - 0x0921U, - 0x0AA1U, - 0x0A21U, - 0x0688U, - 0xFB89U, - 0x095CU, - 0x09A2U, - 0x0922U, - 0x0AA2U, - 0x0A22U, - 0x1E0BU, - 0x1E0DU, - 0x066BU, - 0x066BU, - 0x0434U, - 0x05ADU, - 0x3067U, - 0x03EFU, - 0x30C7U, - 0x232BU, - 0x2326U, - 0x03B4U, - 0x018DU, - 0x09F8U, - 0x02A4U, - 0x09A7U, - 0x0927U, - 0x0AA7U, - 0x0A27U, - 0x0257U, - 0x0385U, - 0x0344U, - 0x2666U, - 0x2662U, - 0xF6D7U, - 0x0324U, - 0x0308U, - 0xF6D8U, - 0x0385U, - 0x3062U, - 0x30C2U, - 0x3003U, - 0x2223U, - 0x2215U, - 0x0452U, - 0x2593U, - 0x1E0FU, - 0x3397U, - 0x0111U, - 0xFF44U, - 0x2584U, - 0x0E0EU, - 0x0E14U, - 0x3069U, - 0x30C9U, - 0xFF04U, - 0xFE69U, - 0x20ABU, - 0x3326U, - 0x0307U, - 0x0323U, - 0x0323U, - 0x30FBU, - 0xF6BEU, - 0x0284U, - 0x22C5U, - 0x25CCU, - 0xFB1FU, - 0xFB1FU, - 0x031EU, - 0x02D5U, - 0x249FU, - 0x0256U, - 0x018CU, - 0x3065U, - 0x30C5U, - 0x01F3U, - 0x02A3U, - 0x01C6U, - 0x02A5U, - 0x04E1U, - 0x0455U, - 0x045FU, - 0x2641U, - 0x098FU, - 0x311CU, - 0x0115U, - 0x090DU, - 0x0A8DU, - 0x0945U, - 0x0AC5U, - 0x011BU, - 0x1E1DU, - 0x0565U, - 0x0587U, - 0x24D4U, - 0x1EBFU, - 0x1E19U, - 0x1EC7U, - 0x1EC1U, - 0x1EC3U, - 0x1EC5U, - 0x0454U, - 0x0205U, - 0x090FU, - 0x0117U, - 0x0117U, - 0x1EB9U, - 0x0A0FU, - 0x0A47U, - 0x0444U, - 0x0A8FU, - 0x0567U, - 0x311DU, - 0x3048U, - 0x1EBBU, - 0x311FU, - 0x0668U, - 0x09EEU, - 0x2467U, - 0x2791U, - 0x096EU, - 0x2471U, - 0x2485U, - 0x2499U, - 0x0AEEU, - 0x0A6EU, - 0x0668U, - 0x3028U, - 0x266BU, - 0x3227U, - 0xFF18U, - 0x247BU, - 0x248FU, - 0x06F8U, - 0x2177U, - 0x0E58U, - 0x0207U, - 0x0465U, - 0x30A8U, - 0xFF74U, - 0x0A74U, - 0x3154U, - 0x043BU, - 0x2208U, - 0x246AU, - 0x247EU, - 0x2492U, - 0x217AU, - 0x22EEU, - 0x0113U, - 0x1E17U, - 0x1E15U, - 0x043CU, - 0xFE31U, - 0xFF45U, - 0x055BU, - 0x2205U, - 0x3123U, - 0x043DU, - 0xFE32U, - 0x04A3U, - 0x014BU, - 0x3125U, - 0x04A5U, - 0x04C8U, - 0x2002U, - 0x0119U, - 0x3153U, - 0x025BU, - 0x029AU, - 0x025CU, - 0x025EU, - 0x025DU, - 0x24A0U, - 0x03B5U, - 0x03ADU, - 0xFF1DU, - 0xFE66U, - 0x207CU, - 0x2261U, - 0x3126U, - 0x0440U, - 0x0258U, - 0x044DU, - 0x0441U, - 0x04ABU, - 0x0283U, - 0x0286U, - 0x090EU, - 0x0946U, - 0x01AAU, - 0x0285U, - 0x3047U, - 0x30A7U, - 0xFF6AU, - 0x212EU, - 0x03B7U, - 0x0568U, - 0x03AEU, - 0x1EBDU, - 0x1E1BU, - 0x0591U, - 0x0591U, - 0x0591U, - 0x0591U, - 0x01DDU, - 0x3161U, - 0x20ACU, - 0x09C7U, - 0x0947U, - 0x0AC7U, - 0x055CU, - 0x203CU, - 0xFF01U, - 0x2203U, - 0x0292U, - 0x01EFU, - 0x0293U, - 0x01B9U, - 0x01BAU, - 0x095EU, - 0x0A5EU, - 0x2109U, - 0x064EU, - 0x064EU, - 0x064BU, - 0x3108U, - 0x24D5U, - 0x1E1FU, - 0x0641U, - 0x0586U, - 0xFED2U, - 0xFED3U, - 0xFED4U, - 0x03E5U, - 0x2640U, - 0x246EU, - 0x2482U, - 0x2496U, - 0x25A0U, - 0x25ACU, - 0x05DAU, - 0xFB3AU, - 0xFB3AU, - 0x05DAU, - 0, - 0, - 0, - 0, - 0x05DDU, - 0x05DDU, - 0x05DFU, - 0x05DFU, - 0x05E3U, - 0x05E3U, - 0x05E5U, - 0x05E5U, - 0x02C9U, - 0x25C9U, - 0x0473U, - 0x0665U, - 0x09EBU, - 0x2464U, - 0x278EU, - 0x096BU, - 0x0AEBU, - 0x0A6BU, - 0x0665U, - 0x3025U, - 0x3224U, - 0xFF15U, - 0x2478U, - 0x248CU, - 0x06F5U, - 0x2174U, - 0x0E55U, - 0xFF46U, - 0x3399U, - 0x0E1FU, - 0x0E1DU, - 0x0E4FU, - 0x2200U, - 0x0664U, - 0x09EAU, - 0x2463U, - 0x278DU, - 0x096AU, - 0x0AEAU, - 0x0A6AU, - 0x0664U, - 0x3024U, - 0x3223U, - 0xFF14U, - 0x09F7U, - 0x2477U, - 0x248BU, - 0x06F4U, - 0x2173U, - 0x246DU, - 0x2481U, - 0x2495U, - 0x0E54U, - 0x02CBU, - 0x24A1U, - 0x20A3U, - 0x0997U, - 0x01F5U, - 0x0917U, - 0x06AFU, - 0xFB93U, - 0xFB94U, - 0xFB95U, - 0x0A97U, - 0x0A17U, - 0x304CU, - 0x30ACU, - 0x03B3U, - 0x0263U, - 0x02E0U, - 0x03EBU, - 0x310DU, - 0x011FU, - 0x01E7U, - 0x0123U, - 0x24D6U, - 0x011DU, - 0x0123U, - 0x0121U, - 0x0121U, - 0x0433U, - 0x3052U, - 0x30B2U, - 0x2251U, - 0x059CU, - 0x05F3U, - 0x059DU, - 0x059EU, - 0x05F4U, - 0x3013U, - 0x0998U, - 0x0572U, - 0x0918U, - 0x0A98U, - 0x0A18U, - 0x063AU, - 0xFECEU, - 0xFECFU, - 0xFED0U, - 0x0495U, - 0x0493U, - 0x0491U, - 0x095AU, - 0x0A5AU, - 0x0260U, - 0x3393U, - 0x304EU, - 0x30AEU, - 0x0563U, - 0x05D2U, - 0xFB32U, - 0xFB32U, - 0x05D2U, - 0x0453U, - 0x01BEU, - 0x0294U, - 0x0296U, - 0x02C0U, - 0x0295U, - 0x02C1U, - 0x02E4U, - 0x02A1U, - 0x02A2U, - 0x1E21U, - 0xFF47U, - 0x3054U, - 0x30B4U, - 0x24A2U, - 0x33ACU, - 0x2207U, - 0x0316U, - 0x0300U, - 0x0300U, - 0x0953U, - 0x02CEU, - 0xFF40U, - 0x0340U, - 0x2265U, - 0x22DBU, - 0xFF1EU, - 0x2273U, - 0x2277U, - 0x2267U, - 0xFE65U, - 0x0261U, - 0x01E5U, - 0x3050U, - 0x30B0U, - 0x3318U, - 0x33C9U, - 0x04A9U, - 0x06C1U, - 0x09B9U, - 0x04B3U, - 0x0939U, - 0x0AB9U, - 0x0A39U, - 0x062DU, - 0xFEA2U, - 0xFEA3U, - 0x306FU, - 0xFEA4U, - 0x332AU, - 0x30CFU, - 0xFF8AU, - 0x0A4DU, - 0x0621U, - 0, - 0, - 0, - 0, - 0x0621U, - 0, - 0, - 0, - 0x3164U, - 0x044AU, - 0x21BCU, - 0x21C0U, - 0x33CAU, - 0x05B2U, - 0x05B2U, - 0x05B2U, - 0x05B2U, - 0x05B2U, - 0x05B2U, - 0x05B2U, - 0x05B2U, - 0x05B3U, - 0x05B3U, - 0x05B3U, - 0x05B3U, - 0x05B3U, - 0x05B3U, - 0x05B3U, - 0x05B3U, - 0x05B1U, - 0x05B1U, - 0x05B1U, - 0x05B1U, - 0x05B1U, - 0x05B1U, - 0x05B1U, - 0x05B1U, - 0x0127U, - 0x310FU, - 0x1E2BU, - 0x1E29U, - 0x24D7U, - 0x0125U, - 0x1E27U, - 0x1E23U, - 0x1E25U, - 0x05D4U, - 0x2665U, - 0x2665U, - 0x2661U, - 0xFB34U, - 0xFB34U, - 0x06C1U, - 0x0647U, - 0x05D4U, - 0xFBA7U, - 0xFEEAU, - 0xFEEAU, - 0xFBA5U, - 0xFBA4U, - 0xFBA8U, - 0xFEEBU, - 0x3078U, - 0xFBA9U, - 0xFEECU, - 0x337BU, - 0x30D8U, - 0xFF8DU, - 0x3336U, - 0x0267U, - 0x3339U, - 0x05D7U, - 0x05D7U, - 0x0266U, - 0x02B1U, - 0x327BU, - 0x321BU, - 0x326DU, - 0x314EU, - 0x320DU, - 0x3072U, - 0x30D2U, - 0xFF8BU, - 0x05B4U, - 0x05B4U, - 0x05B4U, - 0x05B4U, - 0x05B4U, - 0x05B4U, - 0x05B4U, - 0x05B4U, - 0x1E96U, - 0xFF48U, - 0x0570U, - 0x0E2BU, - 0x307BU, - 0x30DBU, - 0xFF8EU, - 0x05B9U, - 0x05B9U, - 0x05B9U, - 0x05B9U, - 0x05B9U, - 0x05B9U, - 0x05B9U, - 0x05B9U, - 0x0E2EU, - 0x0309U, - 0x0309U, - 0x0321U, - 0x0322U, - 0x3342U, - 0x03E9U, - 0x2015U, - 0x031BU, - 0x2668U, - 0x2302U, - 0x24A3U, - 0x02B0U, - 0x0265U, - 0x3075U, - 0x3333U, - 0x30D5U, - 0xFF8CU, - 0x030BU, - 0x0195U, - 0xFF0DU, - 0xFE63U, - 0x2010U, - 0x044FU, - 0x0987U, - 0x3127U, - 0x012DU, - 0x01D0U, - 0x24D8U, - 0x0456U, - 0x0209U, - 0x328FU, - 0x328BU, - 0x323FU, - 0x323AU, - 0x32A5U, - 0x3006U, - 0x3001U, - 0xFF64U, - 0x3237U, - 0x32A3U, - 0x322FU, - 0x323DU, - 0x329DU, - 0x3240U, - 0x3296U, - 0x3236U, - 0x322BU, - 0x3232U, - 0x32A4U, - 0x3005U, - 0x3298U, - 0x3238U, - 0x32A7U, - 0x32A6U, - 0x32A9U, - 0x322EU, - 0x322AU, - 0x3234U, - 0x3002U, - 0x329EU, - 0x3243U, - 0x3239U, - 0x323EU, - 0x32A8U, - 0x3299U, - 0x3242U, - 0x3233U, - 0x3000U, - 0x3235U, - 0x3231U, - 0x323BU, - 0x3230U, - 0x323CU, - 0x322CU, - 0x322DU, - 0x3007U, - 0x328EU, - 0x328AU, - 0x3294U, - 0x3290U, - 0x328CU, - 0x328DU, - 0x0907U, - 0x1E2FU, - 0x04E5U, - 0x1ECBU, - 0x04D7U, - 0x0435U, - 0x3275U, - 0x3215U, - 0x3267U, - 0x3147U, - 0x3207U, - 0x0A87U, - 0x0A07U, - 0x3044U, - 0x1EC9U, - 0x0988U, - 0x0438U, - 0x0908U, - 0x0A88U, - 0x0A08U, - 0x0A40U, - 0x020BU, - 0x0439U, - 0x09C0U, - 0x0940U, - 0x0AC0U, - 0x0133U, - 0x30A4U, - 0xFF72U, - 0x3163U, - 0x02DCU, - 0x05ACU, - 0x012BU, - 0x04E3U, - 0x2253U, - 0x0A3FU, - 0xFF49U, - 0x2206U, - 0x221EU, - 0x056BU, - 0x222BU, - 0x2321U, - 0x2321U, - 0xF8F5U, - 0x2320U, - 0x2320U, - 0x2229U, - 0x3305U, - 0x25D8U, - 0x25D9U, - 0x263BU, - 0x0451U, - 0x012FU, - 0x03B9U, - 0x03CAU, - 0x0390U, - 0x0269U, - 0x03AFU, - 0x24A4U, - 0x0A72U, - 0x3043U, - 0x30A3U, - 0xFF68U, - 0x09FAU, - 0x0268U, - 0x309DU, - 0x30FDU, - 0x0129U, - 0x1E2DU, - 0x3129U, - 0x044EU, - 0x09BFU, - 0x093FU, - 0x0ABFU, - 0x0475U, - 0x0477U, - 0x0571U, - 0x099CU, - 0x091CU, - 0x0A9CU, - 0x0A1CU, - 0x3110U, - 0x01F0U, - 0x24D9U, - 0x0135U, - 0x029DU, - 0x025FU, - 0x0458U, - 0x062CU, - 0xFE9EU, - 0xFE9FU, - 0xFEA0U, - 0x0698U, - 0xFB8BU, - 0x099DU, - 0x091DU, - 0x0A9DU, - 0x0A1DU, - 0x057BU, - 0x3004U, - 0xFF4AU, - 0x24A5U, - 0x02B2U, - 0x04A1U, - 0x0995U, - 0x1E31U, - 0x043AU, - 0x049BU, - 0x0915U, - 0x05DBU, - 0x0643U, - 0xFB3BU, - 0xFB3BU, - 0xFEDAU, - 0x05DBU, - 0xFEDBU, - 0xFEDCU, - 0xFB4DU, - 0x0A95U, - 0x0A15U, - 0x304BU, - 0x04C4U, - 0x30ABU, - 0xFF76U, - 0x03BAU, - 0x03F0U, - 0x3171U, - 0x3184U, - 0x3178U, - 0x3179U, - 0x330DU, - 0x0640U, - 0x0640U, - 0x30F5U, - 0x3384U, - 0x0650U, - 0x064DU, - 0x049FU, - 0xFF70U, - 0x049DU, - 0x310EU, - 0x3389U, - 0x01E9U, - 0x0137U, - 0x24DAU, - 0x0137U, - 0x1E33U, - 0x0584U, - 0x3051U, - 0x30B1U, - 0xFF79U, - 0x056FU, - 0x30F6U, - 0x0138U, - 0x0996U, - 0x0445U, - 0x0916U, - 0x0A96U, - 0x0A16U, - 0x062EU, - 0xFEA6U, - 0xFEA7U, - 0xFEA8U, - 0x03E7U, - 0x0959U, - 0x0A59U, - 0x3278U, - 0x3218U, - 0x326AU, - 0x314BU, - 0x320AU, - 0x0E02U, - 0x0E05U, - 0x0E03U, - 0x0E04U, - 0x0E5BU, - 0x0199U, - 0x0E06U, - 0x3391U, - 0x304DU, - 0x30ADU, - 0xFF77U, - 0x3315U, - 0x3316U, - 0x3314U, - 0x326EU, - 0x320EU, - 0x3260U, - 0x3131U, - 0x3200U, - 0x3133U, - 0x045CU, - 0x1E35U, - 0x3398U, - 0x33A6U, - 0xFF4BU, - 0x33A2U, - 0x3053U, - 0x33C0U, - 0x0E01U, - 0x30B3U, - 0xFF7AU, - 0x331EU, - 0x0481U, - 0x327FU, - 0x0343U, - 0x24A6U, - 0x33AAU, - 0x046FU, - 0x33CFU, - 0x029EU, - 0x304FU, - 0x30AFU, - 0xFF78U, - 0x33B8U, - 0x33BEU, - 0x09B2U, - 0x013AU, - 0x0932U, - 0x0AB2U, - 0x0A32U, - 0x0E45U, - 0xFEFCU, - 0xFEF8U, - 0xFEF7U, - 0xFEFAU, - 0xFEF9U, - 0xFEFBU, - 0xFEF6U, - 0xFEF5U, - 0x0644U, - 0x03BBU, - 0x019BU, - 0x05DCU, - 0xFB3CU, - 0xFB3CU, - 0x05DCU, - 0, - 0, - 0, - 0, - 0xFEDEU, - 0xFCCAU, - 0xFEDFU, - 0xFCC9U, - 0xFCCBU, - 0xFDF2U, - 0xFEE0U, - 0xFD88U, - 0xFCCCU, - 0, - 0, - 0x25EFU, - 0x019AU, - 0x026CU, - 0x310CU, - 0x013EU, - 0x013CU, - 0x24DBU, - 0x1E3DU, - 0x013CU, - 0x0140U, - 0x0140U, - 0x1E37U, - 0x1E39U, - 0x031AU, - 0x0318U, - 0x2264U, - 0x22DAU, - 0xFF1CU, - 0x2272U, - 0x2276U, - 0x2266U, - 0xFE64U, - 0x026EU, - 0x258CU, - 0x026DU, - 0x20A4U, - 0x056CU, - 0x01C9U, - 0x0459U, - 0xF6C0U, - 0x0933U, - 0x0AB3U, - 0x1E3BU, - 0x0934U, - 0x09E1U, - 0x0961U, - 0x09E3U, - 0x0963U, - 0x026BU, - 0xFF4CU, - 0x33D0U, - 0x0E2CU, - 0x2227U, - 0x2310U, - 0x2228U, - 0x0E25U, - 0x017FU, - 0xFE4EU, - 0x0332U, - 0xFE4DU, - 0x25CAU, - 0x24A7U, - 0x2113U, - 0x2591U, - 0x0E26U, - 0x098CU, - 0x090CU, - 0x09E2U, - 0x0962U, - 0x33D3U, - 0x09AEU, - 0x0331U, - 0x0304U, - 0x02CDU, - 0xFFE3U, - 0x1E3FU, - 0x092EU, - 0x0AAEU, - 0x0A2EU, - 0x05A4U, - 0x05A4U, - 0x307EU, - 0xF895U, - 0xF894U, - 0x0E4BU, - 0xF893U, - 0xF88CU, - 0xF88BU, - 0x0E48U, - 0xF88AU, - 0xF884U, - 0x0E31U, - 0xF889U, - 0x0E47U, - 0xF88FU, - 0xF88EU, - 0x0E49U, - 0xF88DU, - 0xF892U, - 0xF891U, - 0x0E4AU, - 0xF890U, - 0x0E46U, - 0x30DEU, - 0xFF8FU, - 0x2642U, - 0x3347U, - 0x05BEU, - 0x2642U, - 0x05AFU, - 0x3383U, - 0x3107U, - 0x33D4U, - 0x24DCU, - 0x33A5U, - 0x1E41U, - 0x1E43U, - 0x0645U, - 0xFEE2U, - 0xFEE3U, - 0xFEE4U, - 0xFCD1U, - 0xFC48U, - 0x334DU, - 0x3081U, - 0x337EU, - 0x30E1U, - 0xFF92U, - 0x05DEU, - 0xFB3EU, - 0xFB3EU, - 0x05DEU, - 0x0574U, - 0x05A5U, - 0x05A6U, - 0x05A6U, - 0x05A5U, - 0x0271U, - 0x3392U, - 0xFF65U, - 0x00B7U, - 0x3272U, - 0x3212U, - 0x3264U, - 0x3141U, - 0x3170U, - 0x3204U, - 0x316EU, - 0x316FU, - 0x307FU, - 0x30DFU, - 0xFF90U, - 0x0320U, - 0x2296U, - 0x02D7U, - 0x2213U, - 0x2032U, - 0x334AU, - 0x3349U, - 0x0270U, - 0x3396U, - 0x33A3U, - 0xFF4DU, - 0x339FU, - 0x3082U, - 0x33C1U, - 0x30E2U, - 0xFF93U, - 0x33D6U, - 0x0E21U, - 0x33A7U, - 0x33A8U, - 0x24A8U, - 0x33ABU, - 0x33B3U, - 0x026FU, - 0x00B5U, - 0x3382U, - 0x226BU, - 0x226AU, - 0x338CU, - 0x03BCU, - 0x338DU, - 0x3080U, - 0x30E0U, - 0xFF91U, - 0x3395U, - 0x339BU, - 0x05A3U, - 0x05A3U, - 0x266AU, - 0x266BU, - 0x266DU, - 0x266FU, - 0x33B2U, - 0x33B6U, - 0x33BCU, - 0x33B9U, - 0x33B7U, - 0x33BFU, - 0x33BDU, - 0x09A8U, - 0x2207U, - 0x0144U, - 0x0928U, - 0x0AA8U, - 0x0A28U, - 0x306AU, - 0x30CAU, - 0xFF85U, - 0x0149U, - 0x3381U, - 0x310BU, - 0x00A0U, - 0x0148U, - 0x0146U, - 0x24DDU, - 0x1E4BU, - 0x0146U, - 0x1E45U, - 0x1E47U, - 0x306DU, - 0x30CDU, - 0xFF88U, - 0x20AAU, - 0x338BU, - 0x0999U, - 0x0919U, - 0x0A99U, - 0x0A19U, - 0x0E07U, - 0x3093U, - 0x0272U, - 0x0273U, - 0x326FU, - 0x320FU, - 0x3135U, - 0x3261U, - 0x3136U, - 0x3134U, - 0x3168U, - 0x3201U, - 0x3167U, - 0x3166U, - 0x306BU, - 0x30CBU, - 0xFF86U, - 0xF899U, - 0x0E4DU, - 0x0669U, - 0x09EFU, - 0x2468U, - 0x2792U, - 0x096FU, - 0x0AEFU, - 0x0A6FU, - 0x0669U, - 0x3029U, - 0x3228U, - 0xFF19U, - 0x247CU, - 0x2490U, - 0x06F9U, - 0x2178U, - 0x2472U, - 0x2486U, - 0x249AU, - 0x0E59U, - 0x01CCU, - 0x045AU, - 0x30F3U, - 0xFF9DU, - 0x019EU, - 0x1E49U, - 0xFF4EU, - 0x339AU, - 0x09A3U, - 0x0923U, - 0x0AA3U, - 0x0A23U, - 0x0929U, - 0x306EU, - 0x30CEU, - 0xFF89U, - 0x00A0U, - 0x0E13U, - 0x0E19U, - 0x0646U, - 0xFEE6U, - 0x06BAU, - 0xFB9FU, - 0, - 0xFEE7U, - 0xFCD2U, - 0xFC4BU, - 0xFEE8U, - 0xFCD5U, - 0xFC4EU, - 0xFC8DU, - 0x220CU, - 0x2209U, - 0x2209U, - 0x2260U, - 0x226FU, - 0x2271U, - 0x2279U, - 0x2262U, - 0x226EU, - 0x2270U, - 0x2226U, - 0x2280U, - 0x2284U, - 0x2281U, - 0x2285U, - 0x0576U, - 0x24A9U, - 0x33B1U, - 0x03BDU, - 0x306CU, - 0x30CCU, - 0xFF87U, - 0x09BCU, - 0x093CU, - 0x0ABCU, - 0x0A3CU, - 0xFF03U, - 0xFE5FU, - 0x0374U, - 0x0375U, - 0x2116U, - 0x05E0U, - 0xFB40U, - 0xFB40U, - 0x05E0U, - 0x33B5U, - 0x33BBU, - 0x099EU, - 0x091EU, - 0x0A9EU, - 0x0A1EU, - 0x0E2DU, - 0x0275U, - 0x04E9U, - 0x04EBU, - 0x0993U, - 0x311BU, - 0x014FU, - 0x0911U, - 0x0A91U, - 0x0949U, - 0x0AC9U, - 0x01D2U, - 0x24DEU, - 0x1ED1U, - 0x1ED9U, - 0x1ED3U, - 0x1ED5U, - 0x1ED7U, - 0x043EU, - 0x0151U, - 0x020DU, - 0x0913U, - 0x04E7U, - 0x1ECDU, - 0x315AU, - 0x0328U, - 0x0A93U, - 0x0585U, - 0x304AU, - 0x1ECFU, - 0x01A1U, - 0x1EDBU, - 0x1EE3U, - 0x1EDDU, - 0x1EDFU, - 0x1EE1U, - 0x0151U, - 0x01A3U, - 0x020FU, - 0x30AAU, - 0xFF75U, - 0x3157U, - 0x05ABU, - 0x014DU, - 0x1E53U, - 0x1E51U, - 0x0950U, - 0x03C9U, - 0x03D6U, - 0x0461U, - 0x0277U, - 0x047BU, - 0x047DU, - 0x03CEU, - 0x0AD0U, - 0x03BFU, - 0x03CCU, - 0xFF4FU, - 0x0661U, - 0x09E7U, - 0x2460U, - 0x278AU, - 0x0967U, - 0x0AE7U, - 0x0A67U, - 0x0661U, - 0x3021U, - 0x3220U, - 0xFF11U, - 0x09F4U, - 0x2474U, - 0x2488U, - 0x06F1U, - 0x2170U, - 0x0E51U, - 0x01EBU, - 0x01EDU, - 0x0A13U, - 0x0A4BU, - 0x0254U, - 0x24AAU, - 0x25E6U, - 0x2325U, - 0x221FU, - 0x0912U, - 0x094AU, - 0x01FFU, - 0x3049U, - 0x30A9U, - 0xFF6BU, - 0x01FFU, - 0x047FU, - 0x1E4DU, - 0x1E4FU, - 0x3121U, - 0x203EU, - 0xFE4AU, - 0x0305U, - 0xFE49U, - 0xFE4CU, - 0xFE4BU, - 0x00AFU, - 0x09CBU, - 0x094BU, - 0x0ACBU, - 0x3380U, - 0x332BU, - 0x09AAU, - 0x1E55U, - 0x092AU, - 0x21DFU, - 0x21DEU, - 0x0AAAU, - 0x0A2AU, - 0x3071U, - 0x0E2FU, - 0x30D1U, - 0x0484U, - 0x04C0U, - 0x317FU, - 0x2225U, - 0xFD3EU, - 0xF8EDU, - 0xF8ECU, - 0xFF08U, - 0xFE59U, - 0xF8EBU, - 0xFE35U, - 0xFD3FU, - 0xF8F8U, - 0xF8F7U, - 0xFF09U, - 0xFE5AU, - 0xF8F6U, - 0xFE36U, - 0x2202U, - 0x05C0U, - 0x0599U, - 0x33A9U, - 0x05B7U, - 0x05B7U, - 0x05B7U, - 0x05B7U, - 0x05B7U, - 0x05B7U, - 0x05B7U, - 0x05B7U, - 0x05A1U, - 0x3106U, - 0x24DFU, - 0x1E57U, - 0x05E4U, - 0x043FU, - 0xFB44U, - 0xFB44U, - 0x333BU, - 0xFB43U, - 0x067EU, - 0x057AU, - 0x05E4U, - 0xFB57U, - 0xFB58U, - 0x307AU, - 0xFB59U, - 0x30DAU, - 0x04A7U, - 0xFB4EU, - 0x066AU, - 0xFF05U, - 0xFE6AU, - 0x0589U, - 0xFF61U, - 0xFF0EU, - 0xFE52U, - 0x0342U, - 0x22A5U, - 0x20A7U, - 0x338AU, - 0x09ABU, - 0x092BU, - 0x0AABU, - 0x0A2BU, - 0x03C6U, - 0x03D5U, - 0x327AU, - 0x321AU, - 0x326CU, - 0x314DU, - 0x320CU, - 0x0278U, - 0x0E3AU, - 0x03D5U, - 0x01A5U, - 0x0E1EU, - 0x0E1CU, - 0x0E20U, - 0x03C0U, - 0x3273U, - 0x3213U, - 0x3176U, - 0x3265U, - 0x3172U, - 0x3142U, - 0x3205U, - 0x3174U, - 0x3144U, - 0x3175U, - 0x3177U, - 0x3173U, - 0x3074U, - 0x30D4U, - 0x03D6U, - 0x0583U, - 0x031FU, - 0x2295U, - 0x02D6U, - 0xFF0BU, - 0xFE62U, - 0x207AU, - 0xFF50U, - 0x33D8U, - 0x307DU, - 0x261FU, - 0x261CU, - 0x261EU, - 0x261DU, - 0x30DDU, - 0x0E1BU, - 0x3012U, - 0x3020U, - 0x24ABU, - 0x227AU, - 0x211EU, - 0x02B9U, - 0x2035U, - 0x220FU, - 0x2305U, - 0x30FCU, - 0x2318U, - 0x2282U, - 0x2283U, - 0x2237U, - 0x221DU, - 0x03C8U, - 0x0471U, - 0x0486U, - 0x33B0U, - 0x3077U, - 0x30D7U, - 0x33B4U, - 0x33BAU, - 0x0958U, - 0x05A8U, - 0x0642U, - 0xFED6U, - 0xFED7U, - 0xFED8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x05B8U, - 0x059FU, - 0x3111U, - 0x24E0U, - 0x02A0U, - 0xFF51U, - 0x05E7U, - 0xFB47U, - 0xFB47U, - 0, - 0, - 0, - 0, - 0x05E7U, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0x24ACU, - 0x2669U, - 0x05BBU, - 0x05BBU, - 0x05BBU, - 0x05BBU, - 0x05BBU, - 0x05BBU, - 0x05BBU, - 0x05BBU, - 0x061FU, - 0x055EU, - 0x037EU, - 0xFF1FU, - 0xFF02U, - 0x301EU, - 0x301DU, - 0x201BU, - 0x201BU, - 0x0149U, - 0xFF07U, - 0x057CU, - 0x09B0U, - 0x0155U, - 0x0930U, - 0x221AU, - 0xF8E5U, - 0x33AEU, - 0x33AFU, - 0x33ADU, - 0x05BFU, - 0x05BFU, - 0x0AB0U, - 0x0A30U, - 0x3089U, - 0x30E9U, - 0xFF97U, - 0x09F1U, - 0x09F0U, - 0x0264U, - 0x2236U, - 0x3116U, - 0x0159U, - 0x0157U, - 0x24E1U, - 0x0157U, - 0x0211U, - 0x1E59U, - 0x1E5BU, - 0x1E5DU, - 0x203BU, - 0x2286U, - 0x2287U, - 0xF8E8U, - 0xF6DAU, - 0x0631U, - 0x0580U, - 0xFEAEU, - 0x308CU, - 0, - 0x30ECU, - 0xFF9AU, - 0x05E8U, - 0xFB48U, - 0, - 0, - 0, - 0, - 0x05E8U, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0x223DU, - 0x0597U, - 0x0597U, - 0x2310U, - 0x027EU, - 0x027FU, - 0x09DDU, - 0x095DU, - 0x03C1U, - 0x027DU, - 0x027BU, - 0x02B5U, - 0x03F1U, - 0x02DEU, - 0x3271U, - 0x3211U, - 0x3263U, - 0x3140U, - 0x313AU, - 0x3169U, - 0x3139U, - 0x313BU, - 0x316CU, - 0x3203U, - 0x313FU, - 0x313CU, - 0x316BU, - 0x313DU, - 0x313EU, - 0x316AU, - 0x316DU, - 0x221FU, - 0x0319U, - 0x22BFU, - 0x308AU, - 0x30EAU, - 0xFF98U, - 0x0325U, - 0x030AU, - 0x02BFU, - 0x0559U, - 0x031CU, - 0x02D3U, - 0x02BEU, - 0x0339U, - 0x02D2U, - 0x0213U, - 0x3351U, - 0x1E5FU, - 0x027CU, - 0x027AU, - 0xFF52U, - 0x308DU, - 0x30EDU, - 0xFF9BU, - 0x0E23U, - 0x24ADU, - 0x09DCU, - 0x0931U, - 0x0A5CU, - 0x0691U, - 0xFB8DU, - 0x09E0U, - 0x0960U, - 0x0AE0U, - 0x09C4U, - 0x0944U, - 0x0AC4U, - 0x2590U, - 0x0279U, - 0x02B4U, - 0x308BU, - 0x30EBU, - 0xFF99U, - 0x09F2U, - 0x09F3U, - 0x0E24U, - 0x098BU, - 0x090BU, - 0x0A8BU, - 0x09C3U, - 0x0943U, - 0x0AC3U, - 0x09B8U, - 0x015BU, - 0x1E65U, - 0x0635U, - 0x0938U, - 0xFEBAU, - 0xFEBBU, - 0xFEBCU, - 0x0AB8U, - 0x0A38U, - 0x3055U, - 0x30B5U, - 0xFF7BU, - 0xFDFAU, - 0x05E1U, - 0xFB41U, - 0xFB41U, - 0x05E1U, - 0x0E32U, - 0x0E41U, - 0x0E44U, - 0x0E43U, - 0x0E33U, - 0x0E30U, - 0x0E40U, - 0xF886U, - 0x0E35U, - 0xF885U, - 0x0E34U, - 0x0E42U, - 0xF888U, - 0x0E37U, - 0xF887U, - 0x0E36U, - 0x0E38U, - 0x0E39U, - 0x3119U, - 0x1E67U, - 0x015FU, - 0x0259U, - 0x04D9U, - 0x04DBU, - 0x025AU, - 0x24E2U, - 0x015DU, - 0x0219U, - 0x1E61U, - 0x1E63U, - 0x1E69U, - 0x033CU, - 0x2033U, - 0x02CAU, - 0x0633U, - 0xFEB2U, - 0xFEB3U, - 0xFEB4U, - 0x05B6U, - 0x05B6U, - 0x05B6U, - 0x05B6U, - 0x05B6U, - 0x05B6U, - 0x05B6U, - 0x0592U, - 0x05B6U, - 0x057DU, - 0x305BU, - 0x30BBU, - 0xFF7EU, - 0x061BU, - 0xFF1BU, - 0xFE54U, - 0x309CU, - 0xFF9FU, - 0x3322U, - 0x3323U, - 0x0667U, - 0x09EDU, - 0x2466U, - 0x2790U, - 0x096DU, - 0x0AEDU, - 0x0A6DU, - 0x0667U, - 0x3027U, - 0x3226U, - 0xFF17U, - 0x247AU, - 0x248EU, - 0x06F7U, - 0x2176U, - 0x2470U, - 0x2484U, - 0x2498U, - 0x0E57U, - 0x00ADU, - 0x0577U, - 0x09B6U, - 0x0448U, - 0x0651U, - 0xFC61U, - 0xFC5EU, - 0xFC60U, - 0, - 0xFC62U, - 0xFC5FU, - 0x2592U, - 0x2593U, - 0x2591U, - 0x2592U, - 0x0936U, - 0x0AB6U, - 0x0A36U, - 0x0593U, - 0x3115U, - 0x0449U, - 0x0634U, - 0xFEB6U, - 0xFEB7U, - 0xFEB8U, - 0x03E3U, - 0x20AAU, - 0x20AAU, - 0x05B0U, - 0x05B0U, - 0x05B0U, - 0x05B0U, - 0x05B0U, - 0x05B0U, - 0x05B0U, - 0x05B0U, - 0x05B0U, - 0x04BBU, - 0x03EDU, - 0x05E9U, - 0xFB49U, - 0xFB49U, - 0xFB2CU, - 0xFB2CU, - 0xFB2DU, - 0xFB2DU, - 0x05C1U, - 0x05E9U, - 0xFB2AU, - 0xFB2AU, - 0xFB2BU, - 0xFB2BU, - 0x0282U, - 0x03C3U, - 0x03C2U, - 0x03C2U, - 0x03F2U, - 0x3057U, - 0x30B7U, - 0xFF7CU, - 0x05BDU, - 0x05BDU, - 0x223CU, - 0x05C2U, - 0x3274U, - 0x3214U, - 0x317EU, - 0x3266U, - 0x317AU, - 0x3145U, - 0x317BU, - 0x3206U, - 0x317DU, - 0x317CU, - 0x0666U, - 0x09ECU, - 0x2465U, - 0x278FU, - 0x096CU, - 0x0AECU, - 0x0A6CU, - 0x0666U, - 0x3026U, - 0x3225U, - 0xFF16U, - 0x2479U, - 0x248DU, - 0x06F6U, - 0x2175U, - 0x246FU, - 0x09F9U, - 0x2483U, - 0x2497U, - 0x0E56U, - 0xFF0FU, - 0x017FU, - 0x1E9BU, - 0x263AU, - 0xFF53U, - 0x05C3U, - 0x00ADU, - 0x044CU, - 0x305DU, - 0x30BDU, - 0xFF7FU, - 0x0338U, - 0x0337U, - 0x0E29U, - 0x0E28U, - 0x0E0BU, - 0x0E2AU, - 0x0020U, - 0x2660U, - 0x2660U, - 0x2664U, - 0x24AEU, - 0x033BU, - 0x33C4U, - 0x339DU, - 0x25A9U, - 0x25A4U, - 0x338FU, - 0x339EU, - 0x33CEU, - 0x33D1U, - 0x33D2U, - 0x338EU, - 0x33D5U, - 0x339CU, - 0x33A1U, - 0x25A6U, - 0x25A7U, - 0x25A8U, - 0x25A5U, - 0x25A3U, - 0x33DBU, - 0x09B7U, - 0x0937U, - 0x0AB7U, - 0x3149U, - 0x3185U, - 0x3180U, - 0x3132U, - 0x3165U, - 0x3143U, - 0x3146U, - 0x3138U, - 0xFFE1U, - 0x0336U, - 0x0335U, - 0x2282U, - 0x228AU, - 0x2286U, - 0x227BU, - 0x220BU, - 0x3059U, - 0x30B9U, - 0xFF7DU, - 0x0652U, - 0x2211U, - 0x263CU, - 0x2283U, - 0x228BU, - 0x2287U, - 0x33DCU, - 0x337CU, - 0x09A4U, - 0x22A4U, - 0x22A3U, - 0x0924U, - 0x0AA4U, - 0x0A24U, - 0x0637U, - 0xFEC2U, - 0xFEC3U, - 0x305FU, - 0xFEC4U, - 0x337DU, - 0x30BFU, - 0xFF80U, - 0x0640U, - 0x03C4U, - 0x05EAU, - 0xFB4AU, - 0xFB4AU, - 0xFB4AU, - 0x05EAU, - 0x0167U, - 0x310AU, - 0x0165U, - 0x02A8U, - 0x0163U, - 0x0686U, - 0xFB7BU, - 0xFB7CU, - 0xFB7DU, - 0, - 0x24E3U, - 0x1E71U, - 0x0163U, - 0x1E97U, - 0x1E6BU, - 0x1E6DU, - 0x0442U, - 0x04ADU, - 0x062AU, - 0xFE96U, - 0xFCA2U, - 0xFC0CU, - 0xFE97U, - 0x3066U, - 0xFCA1U, - 0xFC0BU, - 0x0629U, - 0xFE94U, - 0xFE98U, - 0xFCA4U, - 0xFC0EU, - 0xFC73U, - 0x30C6U, - 0xFF83U, - 0x2121U, - 0x260EU, - 0x05A0U, - 0x05A9U, - 0x2469U, - 0x3229U, - 0x247DU, - 0x2491U, - 0x2179U, - 0x02A7U, - 0x05D8U, - 0xFB38U, - 0xFB38U, - 0x05D8U, - 0x04B5U, - 0x059BU, - 0x059BU, - 0x09A5U, - 0x0925U, - 0x0AA5U, - 0x0A25U, - 0x0630U, - 0xFEACU, - 0xF898U, - 0xF897U, - 0x0E4CU, - 0xF896U, - 0x062BU, - 0xFE9AU, - 0xFE9BU, - 0xFE9CU, - 0x2203U, - 0x2234U, - 0x03B8U, - 0x03D1U, - 0x03D1U, - 0x3279U, - 0x3219U, - 0x326BU, - 0x314CU, - 0x320BU, - 0x246CU, - 0x2480U, - 0x2494U, - 0x0E11U, - 0x01ADU, - 0x0E12U, - 0x0E17U, - 0x0E10U, - 0x0E18U, - 0x0E16U, - 0x0482U, - 0x066CU, - 0x066CU, - 0x0663U, - 0x09E9U, - 0x2462U, - 0x278CU, - 0x0969U, - 0x0AE9U, - 0x0A69U, - 0x0663U, - 0x3023U, - 0x3222U, - 0xFF13U, - 0x09F6U, - 0x2476U, - 0x248AU, - 0x06F3U, - 0x2172U, - 0x0E53U, - 0x3394U, - 0x3061U, - 0x30C1U, - 0xFF81U, - 0x3270U, - 0x3210U, - 0x3262U, - 0x3137U, - 0x3202U, - 0x0330U, - 0x0303U, - 0x0303U, - 0x0360U, - 0x223CU, - 0x0334U, - 0x033EU, - 0x2297U, - 0x0596U, - 0x0596U, - 0x0A70U, - 0x0483U, - 0x057FU, - 0x1E6FU, - 0xFF54U, - 0x0569U, - 0x3068U, - 0x30C8U, - 0xFF84U, - 0x02E5U, - 0x02E9U, - 0x02E6U, - 0x02E8U, - 0x02E7U, - 0x01BDU, - 0x0185U, - 0x01A8U, - 0x0384U, - 0x3327U, - 0x0E0FU, - 0x3014U, - 0xFE5DU, - 0xFE39U, - 0x3015U, - 0xFE5EU, - 0xFE3AU, - 0x0E15U, - 0x01ABU, - 0x24AFU, - 0xF8EAU, - 0xF6DBU, - 0x0288U, - 0x25BCU, - 0x25C4U, - 0x25BAU, - 0x25B2U, - 0x02A6U, - 0x05E6U, - 0xFB46U, - 0xFB46U, - 0x05E6U, - 0x0446U, - 0x05B5U, - 0x05B5U, - 0x05B5U, - 0x05B5U, - 0x05B5U, - 0x05B5U, - 0x05B5U, - 0x05B5U, - 0x045BU, - 0x099FU, - 0x091FU, - 0x0A9FU, - 0x0A1FU, - 0x0679U, - 0xFB67U, - 0xFB68U, - 0xFB69U, - 0x09A0U, - 0x0920U, - 0x0AA0U, - 0x0A20U, - 0x0287U, - 0x3064U, - 0x30C4U, - 0xFF82U, - 0x3063U, - 0x30C3U, - 0xFF6FU, - 0x246BU, - 0x247FU, - 0x2493U, - 0x217BU, - 0x2473U, - 0x5344U, - 0x2487U, - 0x249BU, - 0x0662U, - 0x09E8U, - 0x2461U, - 0x278BU, - 0x0968U, - 0x2025U, - 0xFE30U, - 0x0AE8U, - 0x0A68U, - 0x0662U, - 0x3022U, - 0x3221U, - 0xFF12U, - 0x09F5U, - 0x2475U, - 0x2489U, - 0x06F2U, - 0x2171U, - 0x01BBU, - 0x0E52U, - 0x0289U, - 0x0989U, - 0x3128U, - 0x016DU, - 0x01D4U, - 0x24E4U, - 0x1E77U, - 0x0443U, - 0x0951U, - 0x0171U, - 0x0215U, - 0x0909U, - 0x01D8U, - 0x1E73U, - 0x01DAU, - 0x04F1U, - 0x01DCU, - 0x01D6U, - 0x1EE5U, - 0x0A89U, - 0x0A09U, - 0x3046U, - 0x1EE7U, - 0x01B0U, - 0x1EE9U, - 0x1EF1U, - 0x1EEBU, - 0x1EEDU, - 0x1EEFU, - 0x0171U, - 0x04F3U, - 0x0217U, - 0x30A6U, - 0xFF73U, - 0x0479U, - 0x315CU, - 0x016BU, - 0x04EFU, - 0x1E7BU, - 0x0A41U, - 0xFF55U, - 0x2017U, - 0xFF3FU, - 0xFE33U, - 0xFE4FU, - 0x222AU, - 0x2200U, - 0x0173U, - 0x24B0U, - 0x2580U, - 0x05C4U, - 0x03C5U, - 0x03CBU, - 0x03B0U, - 0x028AU, - 0x03CDU, - 0x031DU, - 0x02D4U, - 0x0A73U, - 0x016FU, - 0x045EU, - 0x3045U, - 0x30A5U, - 0xFF69U, - 0x04AFU, - 0x04B1U, - 0x0169U, - 0x1E79U, - 0x1E75U, - 0x098AU, - 0x090AU, - 0x0A8AU, - 0x0A0AU, - 0x0A42U, - 0x09C2U, - 0x0942U, - 0x0AC2U, - 0x09C1U, - 0x0941U, - 0x0AC1U, - 0x0935U, - 0x0AB5U, - 0x0A35U, - 0x30F7U, - 0x05D5U, - 0xFB35U, - 0xFB35U, - 0xFB35U, - 0x05D5U, - 0xFB4BU, - 0xFB4BU, - 0x05F0U, - 0x05F1U, - 0x24E5U, - 0x1E7FU, - 0x0432U, - 0x06A4U, - 0xFB6BU, - 0xFB6CU, - 0xFB6DU, - 0x30F9U, - 0x2640U, - 0x007CU, - 0x030DU, - 0x0329U, - 0x02CCU, - 0x02C8U, - 0x057EU, - 0x028BU, - 0x30F8U, - 0x09CDU, - 0x094DU, - 0x0ACDU, - 0x0983U, - 0x0903U, - 0x0A83U, - 0xFF56U, - 0x0578U, - 0x309EU, - 0x30FEU, - 0x309BU, - 0xFF9EU, - 0x30FAU, - 0x24B1U, - 0x1E7DU, - 0x028CU, - 0x3094U, - 0x30F4U, - 0x1E83U, - 0x3159U, - 0x308FU, - 0x30EFU, - 0xFF9CU, - 0x3158U, - 0x308EU, - 0x30EEU, - 0x3357U, - 0x301CU, - 0xFE34U, - 0x0648U, - 0xFEEEU, - 0x0624U, - 0xFE86U, - 0x33DDU, - 0x24E6U, - 0x0175U, - 0x1E85U, - 0x1E87U, - 0x1E89U, - 0x3091U, - 0x2118U, - 0x30F1U, - 0x315EU, - 0x315DU, - 0x1E81U, - 0x25E6U, - 0x25CBU, - 0x25D9U, - 0x300EU, - 0xFE43U, - 0x300FU, - 0xFE44U, - 0x25C7U, - 0x25C8U, - 0x25BFU, - 0x25BDU, - 0x25C3U, - 0x25C1U, - 0x3016U, - 0x3017U, - 0x25B9U, - 0x25B7U, - 0x25ABU, - 0x263AU, - 0x25A1U, - 0x2606U, - 0x260FU, - 0x3018U, - 0x3019U, - 0x25B5U, - 0x25B3U, - 0x3090U, - 0x30F0U, - 0x315FU, - 0xFF57U, - 0x3092U, - 0x30F2U, - 0xFF66U, - 0x20A9U, - 0xFFE6U, - 0x0E27U, - 0x24B2U, - 0x1E98U, - 0x02B7U, - 0x028DU, - 0x01BFU, - 0x033DU, - 0x3112U, - 0x24E7U, - 0x1E8DU, - 0x1E8BU, - 0x056DU, - 0x03BEU, - 0xFF58U, - 0x24B3U, - 0x02E3U, - 0x334EU, - 0x09AFU, - 0x092FU, - 0x3152U, - 0x0AAFU, - 0x0A2FU, - 0x3084U, - 0x30E4U, - 0xFF94U, - 0x3151U, - 0x0E4EU, - 0x3083U, - 0x30E3U, - 0xFF6CU, - 0x0463U, - 0x24E8U, - 0x0177U, - 0x1E8FU, - 0x1EF5U, - 0x064AU, - 0x06D2U, - 0xFBAFU, - 0xFEF2U, - 0x0626U, - 0xFE8AU, - 0xFE8BU, - 0xFE8CU, - 0xFEF3U, - 0xFEF4U, - 0xFCDDU, - 0xFC58U, - 0xFC94U, - 0x06D1U, - 0x3156U, - 0xFFE5U, - 0x3155U, - 0x3186U, - 0x05AAU, - 0x05AAU, - 0x044BU, - 0x04F9U, - 0x3181U, - 0x3183U, - 0x3182U, - 0x059AU, - 0x1EF3U, - 0x01B4U, - 0x1EF7U, - 0x0575U, - 0x0457U, - 0x3162U, - 0x262FU, - 0x0582U, - 0xFF59U, - 0x05D9U, - 0xFB39U, - 0xFB39U, - 0x05D9U, - 0x05F2U, - 0xFB1FU, - 0x3088U, - 0x3189U, - 0x30E8U, - 0xFF96U, - 0x315BU, - 0x3087U, - 0x30E7U, - 0xFF6EU, - 0x03F3U, - 0x3188U, - 0x3187U, - 0x0E22U, - 0x0E0DU, - 0x24B4U, - 0x037AU, - 0x0345U, - 0x01A6U, - 0x1E99U, - 0x02B8U, - 0x1EF9U, - 0x028EU, - 0x3086U, - 0x318CU, - 0x30E6U, - 0xFF95U, - 0x3160U, - 0x046BU, - 0x046DU, - 0x0467U, - 0x0469U, - 0x3085U, - 0x30E5U, - 0xFF6DU, - 0x318BU, - 0x318AU, - 0x09DFU, - 0x095FU, - 0x0566U, - 0x017AU, - 0x095BU, - 0x0A5BU, - 0x0638U, - 0xFEC6U, - 0xFEC7U, - 0x3056U, - 0xFEC8U, - 0x0632U, - 0xFEB0U, - 0x30B6U, - 0x0595U, - 0x0594U, - 0x0598U, - 0x05D6U, - 0xFB36U, - 0xFB36U, - 0x05D6U, - 0x3117U, - 0x24E9U, - 0x1E91U, - 0x0291U, - 0x017CU, - 0x017CU, - 0x1E93U, - 0x0437U, - 0x0499U, - 0x04DFU, - 0x305CU, - 0x30BCU, - 0x0660U, - 0x09E6U, - 0x0966U, - 0x0AE6U, - 0x0A66U, - 0x0660U, - 0xFF10U, - 0x06F0U, - 0x0E50U, - 0xFEFFU, - 0x200CU, - 0x200BU, - 0x03B6U, - 0x3113U, - 0x056AU, - 0x04C2U, - 0x0436U, - 0x0497U, - 0x04DDU, - 0x3058U, - 0x30B8U, - 0x05AEU, - 0x1E95U, - 0xFF5AU, - 0x305EU, - 0x30BEU, - 0x24B5U, - 0x0290U, - 0x01B6U, - 0x305AU, - 0x30BAU, - -#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ - 0 + 253, 261, 267, 274, 283, 294, 301, 309, 319, 330, 340, 351, 360, 365, + 371, 378, 385, 391, 396, 400, 404, 410, 415, 420, 424, 430, 436, 441, + 447, 457, 462, 468, 476, 485, 488, 490, 492, 494, 496, 498, 500, 502, + 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, + 532, 534, 536, 538, 540, 552, 562, 575, 587, 598, 608, 610, 612, 614, + 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642, + 644, 646, 648, 650, 652, 654, 656, 658, 660, 670, 674, 685, 696, 707, + 712, 721, 730, 734, 741, 749, 758, 770, 783, 797, 811, 826, 829, 832, + 839, 846, 856, 871, 881, 888, 903, 916, 930, 945, 954, 966, 979, 985, + 991,1002,1008,1015,1021,1031,1040,1045,1053,1066,1073,1079,1086,1089, + 1101,1108,1115,1118,1131,1134,1143,1150,1157,1160,1171,1183,1194,1197, + 1207,1211,1219,1229,1235,1246,1253,1263,1270,1276,1290,1302,1313,1319, + 1323,1332,1346,1356,1363,1375,1385,1392,1398,1405,1414,1421,1433,1443, + 1450,1457,1469,1479,1486,1493,1500,1512,1522,1529,1536,1543,1550,1562, + 1572,1579,1586,1596,1603,1610,1622,1632,1639,1645,1652,1661,1668,1680, + 1690,1697,1704,1716,1726,1733,1740,1747,1759,1769,1776,1783,1790,1797, + 1809,1819,1826,1833,1843,1850,1862,1880,1895,1910,1925,1936,1954,1973, + 1988,2003,2016,2028,2040,2054,2067,2080,2092,2106,2120,2133,2147,2167, + 2182,2196,2206,2216,2229,2239,2249,2259,2269,2279,2289,2299,2309,2319, + 2329,2332,2336,2340,2358,2377,2393,2408,2419,2426,2433,2440,2447,2454, + 2461,2468,2475,2482,2489,2496,2503,2510,2517,2524,2531,2538,2545,2552, + 2559,2566,2573,2580,2587,2594,2601,2615,2625,2632,2643,2659,2672,2684, + 2696,2708,2722,2733,2744,2759,2771,2782,2797,2809,2819,2832,2850,2860, + 2873,2885,2898,2907,2917,2930,2943,2956,2968,2982,2996,3009,3022,3034, + 3046,3060,3073,3086,3098,3112,3126,3139,3152,3167,3182,3196,3208,3220, + 3237,3249,3264,3275,3283,3297,3309,3321,3338,3353,3365,3377,3394,3409, + 3418,3430,3442,3454,3471,3483,3498,3506,3518,3530,3542,3559,3574,3586, + 3597,3612,3620,3628,3636,3644,3650,3655,3660,3666,3673,3681,3687 }; - - static const unsigned short t1_standard_encoding[257] = + /* the following are indices into the SID name table */ + static const unsigned short t1_standard_encoding[256] = { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 72, - 73, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 82, - 83, - 84, - 85, - 86, - 87, - 88, - 89, - 90, - 91, - 92, - 93, - 94, - 95, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 96, - 97, - 98, - 99, - 100, - 101, - 102, - 103, - 104, - 105, - 106, - 107, - 108, - 109, - 110, - 0, - 111, - 112, - 113, - 114, - 0, - 115, - 116, - 117, - 118, - 119, - 120, - 121, - 122, - 0, - 123, - 0, - 124, - 125, - 126, - 127, - 128, - 129, - 130, - 131, - 0, - 132, - 133, - 0, - 134, - 135, - 136, - 137, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 138, - 0, - 139, - 0, - 0, - 0, - 0, - 140, - 141, - 142, - 143, - 0, - 0, - 0, - 0, - 0, - 144, - 0, - 0, - 0, - 145, - 0, - 0, - 146, - 147, - 148, - 149, - 0, - 0, - 0, - 0, - 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110, + 0,111,112,113,114, 0,115,116,117,118,119,120,121,122, 0,123, + 0,124,125,126,127,128,129,130,131, 0,132,133, 0,134,135,136, + 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0,138, 0,139, 0, 0, 0, 0,140,141,142,143, 0, 0, 0, 0, + 0,144, 0, 0, 0,145, 0, 0,146,147,148,149, 0, 0, 0, 0 }; - static const unsigned short t1_expert_encoding[257] = + /* the following are indices into the SID name table */ + static const unsigned short t1_expert_encoding[256] = { - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 229, - 230, - 0, - 231, - 232, - 233, - 234, - 235, - 236, - 237, - 238, - 13, - 14, - 15, - 99, - 239, - 240, - 241, - 242, - 243, - 244, - 245, - 246, - 247, - 248, - 27, - 28, - 249, - 250, - 251, - 252, - 0, - 253, - 254, - 255, - 256, - 257, - 0, - 0, - 0, - 258, - 0, - 0, - 259, - 260, - 261, - 262, - 0, - 0, - 263, - 264, - 265, - 0, - 266, - 109, - 110, - 267, - 268, - 269, - 0, - 270, - 271, - 272, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 287, - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 304, - 305, - 306, - 0, - 0, - 307, - 308, - 309, - 310, - 311, - 0, - 312, - 0, - 0, - 313, - 0, - 0, - 314, - 315, - 0, - 0, - 316, - 317, - 318, - 0, - 0, - 0, - 158, - 155, - 163, - 319, - 320, - 321, - 322, - 323, - 324, - 325, - 0, - 0, - 326, - 150, - 164, - 169, - 327, - 328, - 329, - 330, - 331, - 332, - 333, - 334, - 335, - 336, - 337, - 338, - 339, - 340, - 341, - 342, - 343, - 344, - 345, - 346, - 347, - 348, - 349, - 350, - 351, - 352, - 353, - 354, - 355, - 356, - 357, - 358, - 359, - 360, - 361, - 362, - 363, - 364, - 365, - 366, - 367, - 368, - 369, - 370, - 371, - 372, - 373, - 374, - 375, - 376, - 377, - 378, - 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1,229,230, 0,231,232,233,234,235,236,237,238, 13, 14, 15, 99, + 239,240,241,242,243,244,245,246,247,248, 27, 28,249,250,251,252, + 0,253,254,255,256,257, 0, 0, 0,258, 0, 0,259,260,261,262, + 0, 0,263,264,265, 0,266,109,110,267,268,269, 0,270,271,272, + 273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288, + 289,290,291,292,293,294,295,296,297,298,299,300,301,302,303, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0,304,305,306, 0, 0,307,308,309,310,311, 0,312, 0, 0,313, + 0, 0,314,315, 0, 0,316,317,318, 0, 0, 0,158,155,163,319, + 320,321,322,323,324,325, 0, 0,326,150,164,169,327,328,329,330, + 331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346, + 347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362, + 363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378 }; + /* + * This table is a compressed version of the Adobe Glyph List (AGL), + * optimized for efficient searching. It has been generated by the + * `glnames.py' python script located in the `src/tools' directory. + * + * The lookup function to get the Unicode value for a given string + * is defined below the table. + */ + static const unsigned char ft_adobe_glyph_list[54791] = + { + 0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23, + 11,137, 12,199, 14,246, 15, 87, 16,233, 17,219, 18,104, 19, 88, + 22,110, 23, 32, 23, 71, 24, 77, 27,156, 29, 73, 31,247, 32,107, + 32,222, 33, 55, 34,154, 35,218, 53, 84, 59,196, 68, 6, 75,183, + 83,178, 88,135, 93,242,101,165,109,185,111, 55,117,254,123, 73, + 130,238,138,206,145, 31,153,182,156,189,163,249,178,221,193, 17, + 197, 99,199,240,204, 27,204,155,210,100, 65,143, 0, 65, 0,140, + 0,175, 0,193, 1, 15, 1,147, 1,233, 1,251, 2, 7, 2, 40, + 2, 57, 2, 82, 2, 91, 2,128, 2,136, 2,154, 69,131, 0,198, + 0,150, 0,158, 0,167,225,227,245,244,101,128, 1,252,237,225, + 227,242,239,110,128, 1,226,243,237,225,236,108,128,247,230,225, + 227,245,244,101,129, 0,193, 0,185,243,237,225,236,108,128,247, + 225,226,242,229,246,101,134, 1, 2, 0,213, 0,221, 0,232, 0, + 243, 0,251, 1, 7,225,227,245,244,101,128, 30,174,227,249,242, + 233,236,236,233, 99,128, 4,208,228,239,244,226,229,236,239,119, + 128, 30,182,231,242,225,246,101,128, 30,176,232,239,239,235,225, + 226,239,246,101,128, 30,178,244,233,236,228,101,128, 30,180, 99, + 4, 1, 25, 1, 32, 1,121, 1,137,225,242,239,110,128, 1,205, + 233,242, 99, 2, 1, 40, 1, 45,236,101,128, 36,182,245,237,230, + 236,229,120,134, 0,194, 1, 66, 1, 74, 1, 85, 1, 93, 1,105, + 1,113,225,227,245,244,101,128, 30,164,228,239,244,226,229,236, + 239,119,128, 30,172,231,242,225,246,101,128, 30,166,232,239,239, + 235,225,226,239,246,101,128, 30,168,243,237,225,236,108,128,247, + 226,244,233,236,228,101,128, 30,170,245,244,101,129,246,201, 1, + 129,243,237,225,236,108,128,247,180,249,242,233,236,236,233, 99, + 128, 4, 16,100, 3, 1,155, 1,165, 1,209,226,236,231,242,225, + 246,101,128, 2, 0,233,229,242,229,243,233,115,131, 0,196, 1, + 181, 1,192, 1,201,227,249,242,233,236,236,233, 99,128, 4,210, + 237,225,227,242,239,110,128, 1,222,243,237,225,236,108,128,247, + 228,239,116, 2, 1,216, 1,224,226,229,236,239,119,128, 30,160, + 237,225,227,242,239,110,128, 1,224,231,242,225,246,101,129, 0, + 192, 1,243,243,237,225,236,108,128,247,224,232,239,239,235,225, + 226,239,246,101,128, 30,162,105, 2, 2, 13, 2, 25,229,227,249, + 242,233,236,236,233, 99,128, 4,212,238,246,229,242,244,229,228, + 226,242,229,246,101,128, 2, 2,236,240,232, 97,129, 3,145, 2, + 49,244,239,238,239,115,128, 3,134,109, 2, 2, 63, 2, 71,225, + 227,242,239,110,128, 1, 0,239,238,239,243,240,225,227,101,128, + 255, 33,239,231,239,238,229,107,128, 1, 4,242,233,238,103,131, + 0,197, 2,104, 2,112, 2,120,225,227,245,244,101,128, 1,250, + 226,229,236,239,119,128, 30, 0,243,237,225,236,108,128,247,229, + 243,237,225,236,108,128,247, 97,244,233,236,228,101,129, 0,195, + 2,146,243,237,225,236,108,128,247,227,249,226,225,242,237,229, + 238,233,225,110,128, 5, 49, 66,137, 0, 66, 2,189, 2,198, 2, + 223, 3, 3, 3, 10, 3, 22, 3, 34, 3, 46, 3, 54,227,233,242, + 227,236,101,128, 36,183,228,239,116, 2, 2,206, 2,215,225,227, + 227,229,238,116,128, 30, 2,226,229,236,239,119,128, 30, 4,101, + 3, 2,231, 2,242, 2,254,227,249,242,233,236,236,233, 99,128, + 4, 17,238,225,242,237,229,238,233,225,110,128, 5, 50,244, 97, + 128, 3,146,232,239,239,107,128, 1,129,236,233,238,229,226,229, + 236,239,119,128, 30, 6,237,239,238,239,243,240,225,227,101,128, + 255, 34,242,229,246,229,243,237,225,236,108,128,246,244,243,237, + 225,236,108,128,247, 98,244,239,240,226,225,114,128, 1,130, 67, + 137, 0, 67, 3, 85, 3,127, 3,193, 3,210, 3,224, 4,171, 4, + 188, 4,200, 4,212, 97, 3, 3, 93, 3,104, 3,111,225,242,237, + 229,238,233,225,110,128, 5, 62,227,245,244,101,128, 1, 6,242, + 239,110,129,246,202, 3,119,243,237,225,236,108,128,246,245, 99, + 3, 3,135, 3,142, 3,171,225,242,239,110,128, 1, 12,229,228, + 233,236,236, 97,130, 0,199, 3,155, 3,163,225,227,245,244,101, + 128, 30, 8,243,237,225,236,108,128,247,231,233,242, 99, 2, 3, + 179, 3,184,236,101,128, 36,184,245,237,230,236,229,120,128, 1, + 8,228,239,116,129, 1, 10, 3,201,225,227,227,229,238,116,128, + 1, 10,229,228,233,236,236,225,243,237,225,236,108,128,247,184, + 104, 4, 3,234, 3,246, 4,161, 4,165,225,225,242,237,229,238, + 233,225,110,128, 5, 73,101, 6, 4, 4, 4, 24, 4, 35, 4,103, + 4,115, 4,136,225,226,235,232,225,243,233,225,238,227,249,242, + 233,236,236,233, 99,128, 4,188,227,249,242,233,236,236,233, 99, + 128, 4, 39,100, 2, 4, 41, 4, 85,229,243,227,229,238,228,229, + 114, 2, 4, 54, 4, 74,225,226,235,232,225,243,233,225,238,227, + 249,242,233,236,236,233, 99,128, 4,190,227,249,242,233,236,236, + 233, 99,128, 4,182,233,229,242,229,243,233,243,227,249,242,233, + 236,236,233, 99,128, 4,244,232,225,242,237,229,238,233,225,110, + 128, 5, 67,235,232,225,235,225,243,243,233,225,238,227,249,242, + 233,236,236,233, 99,128, 4,203,246,229,242,244,233,227,225,236, + 243,244,242,239,235,229,227,249,242,233,236,236,233, 99,128, 4, + 184,105,128, 3,167,239,239,107,128, 1,135,233,242,227,245,237, + 230,236,229,248,243,237,225,236,108,128,246,246,237,239,238,239, + 243,240,225,227,101,128,255, 35,239,225,242,237,229,238,233,225, + 110,128, 5, 81,243,237,225,236,108,128,247, 99, 68,142, 0, 68, + 4,252, 5, 10, 5, 36, 5, 96, 5,121, 5,166, 5,173, 5,231, + 5,244, 6, 0, 6, 12, 6, 28, 6, 48, 6, 57, 90,129, 1,241, + 5, 2,227,225,242,239,110,128, 1,196, 97, 2, 5, 16, 5, 27, + 225,242,237,229,238,233,225,110,128, 5, 52,230,242,233,227,225, + 110,128, 1,137, 99, 4, 5, 46, 5, 53, 5, 62, 5, 89,225,242, + 239,110,128, 1, 14,229,228,233,236,236, 97,128, 30, 16,233,242, + 99, 2, 5, 70, 5, 75,236,101,128, 36,185,245,237,230,236,229, + 248,226,229,236,239,119,128, 30, 18,242,239,225,116,128, 1, 16, + 228,239,116, 2, 5,104, 5,113,225,227,227,229,238,116,128, 30, + 10,226,229,236,239,119,128, 30, 12,101, 3, 5,129, 5,140, 5, + 150,227,249,242,233,236,236,233, 99,128, 4, 20,233,227,239,240, + 244,233, 99,128, 3,238,236,244, 97,129, 34, 6, 5,158,231,242, + 229,229,107,128, 3,148,232,239,239,107,128, 1,138,105, 2, 5, + 179, 5,218,229,242,229,243,233,115,131,246,203, 5,194, 5,202, + 5,210,193,227,245,244,101,128,246,204,199,242,225,246,101,128, + 246,205,243,237,225,236,108,128,247,168,231,225,237,237,225,231, + 242,229,229,107,128, 3,220,234,229,227,249,242,233,236,236,233, + 99,128, 4, 2,236,233,238,229,226,229,236,239,119,128, 30, 14, + 237,239,238,239,243,240,225,227,101,128,255, 36,239,244,225,227, + 227,229,238,244,243,237,225,236,108,128,246,247,115, 2, 6, 34, + 6, 41,236,225,243,104,128, 1, 16,237,225,236,108,128,247,100, + 244,239,240,226,225,114,128, 1,139,122,131, 1,242, 6, 67, 6, + 75, 6,112,227,225,242,239,110,128, 1,197,101, 2, 6, 81, 6, + 101,225,226,235,232,225,243,233,225,238,227,249,242,233,236,236, + 233, 99,128, 4,224,227,249,242,233,236,236,233, 99,128, 4, 5, + 232,229,227,249,242,233,236,236,233, 99,128, 4, 15, 69,146, 0, + 69, 6,165, 6,183, 6,191, 7, 89, 7,153, 7,165, 7,183, 7, + 211, 8, 7, 8, 36, 8, 94, 8,169, 8,189, 8,208, 8,248, 9, + 44, 9,109, 9,115,225,227,245,244,101,129, 0,201, 6,175,243, + 237,225,236,108,128,247,233,226,242,229,246,101,128, 1, 20, 99, + 5, 6,203, 6,210, 6,224, 6,236, 7, 79,225,242,239,110,128, + 1, 26,229,228,233,236,236,225,226,242,229,246,101,128, 30, 28, + 232,225,242,237,229,238,233,225,110,128, 5, 53,233,242, 99, 2, + 6,244, 6,249,236,101,128, 36,186,245,237,230,236,229,120,135, + 0,202, 7, 16, 7, 24, 7, 32, 7, 43, 7, 51, 7, 63, 7, 71, + 225,227,245,244,101,128, 30,190,226,229,236,239,119,128, 30, 24, + 228,239,244,226,229,236,239,119,128, 30,198,231,242,225,246,101, + 128, 30,192,232,239,239,235,225,226,239,246,101,128, 30,194,243, + 237,225,236,108,128,247,234,244,233,236,228,101,128, 30,196,249, + 242,233,236,236,233, 99,128, 4, 4,100, 3, 7, 97, 7,107, 7, + 127,226,236,231,242,225,246,101,128, 2, 4,233,229,242,229,243, + 233,115,129, 0,203, 7,119,243,237,225,236,108,128,247,235,239, + 116,130, 1, 22, 7,136, 7,145,225,227,227,229,238,116,128, 1, + 22,226,229,236,239,119,128, 30,184,230,227,249,242,233,236,236, + 233, 99,128, 4, 36,231,242,225,246,101,129, 0,200, 7,175,243, + 237,225,236,108,128,247,232,104, 2, 7,189, 7,200,225,242,237, + 229,238,233,225,110,128, 5, 55,239,239,235,225,226,239,246,101, + 128, 30,186,105, 3, 7,219, 7,230, 7,245,231,232,244,242,239, + 237,225,110,128, 33,103,238,246,229,242,244,229,228,226,242,229, + 246,101,128, 2, 6,239,244,233,230,233,229,228,227,249,242,233, + 236,236,233, 99,128, 4,100,108, 2, 8, 13, 8, 24,227,249,242, + 233,236,236,233, 99,128, 4, 27,229,246,229,238,242,239,237,225, + 110,128, 33,106,109, 3, 8, 44, 8, 72, 8, 83,225,227,242,239, + 110,130, 1, 18, 8, 56, 8, 64,225,227,245,244,101,128, 30, 22, + 231,242,225,246,101,128, 30, 20,227,249,242,233,236,236,233, 99, + 128, 4, 28,239,238,239,243,240,225,227,101,128,255, 37,110, 4, + 8,104, 8,115, 8,135, 8,154,227,249,242,233,236,236,233, 99, + 128, 4, 29,228,229,243,227,229,238,228,229,242,227,249,242,233, + 236,236,233, 99,128, 4,162,103,129, 1, 74, 8,141,232,229,227, + 249,242,233,236,236,233, 99,128, 4,164,232,239,239,235,227,249, + 242,233,236,236,233, 99,128, 4,199,111, 2, 8,175, 8,183,231, + 239,238,229,107,128, 1, 24,240,229,110,128, 1,144,240,243,233, + 236,239,110,129, 3,149, 8,200,244,239,238,239,115,128, 3,136, + 114, 2, 8,214, 8,225,227,249,242,233,236,236,233, 99,128, 4, + 32,229,246,229,242,243,229,100,129, 1,142, 8,237,227,249,242, + 233,236,236,233, 99,128, 4, 45,115, 4, 9, 2, 9, 13, 9, 33, + 9, 37,227,249,242,233,236,236,233, 99,128, 4, 33,228,229,243, + 227,229,238,228,229,242,227,249,242,233,236,236,233, 99,128, 4, + 170,104,128, 1,169,237,225,236,108,128,247,101,116, 3, 9, 52, + 9, 78, 9, 92, 97,130, 3,151, 9, 60, 9, 70,242,237,229,238, + 233,225,110,128, 5, 56,244,239,238,239,115,128, 3,137,104,129, + 0,208, 9, 84,243,237,225,236,108,128,247,240,233,236,228,101, + 129, 30,188, 9,101,226,229,236,239,119,128, 30, 26,245,242,111, + 128, 32,172,250,104,130, 1,183, 9,124, 9,132,227,225,242,239, + 110,128, 1,238,242,229,246,229,242,243,229,100,128, 1,184, 70, + 136, 0, 70, 9,163, 9,172, 9,184, 9,212, 9,219, 9,248, 10, + 4, 10, 15,227,233,242,227,236,101,128, 36,187,228,239,244,225, + 227,227,229,238,116,128, 30, 30,101, 2, 9,190, 9,202,232,225, + 242,237,229,238,233,225,110,128, 5, 86,233,227,239,240,244,233, + 99,128, 3,228,232,239,239,107,128, 1,145,105, 2, 9,225, 9, + 238,244,225,227,249,242,233,236,236,233, 99,128, 4,114,246,229, + 242,239,237,225,110,128, 33,100,237,239,238,239,243,240,225,227, + 101,128,255, 38,239,245,242,242,239,237,225,110,128, 33, 99,243, + 237,225,236,108,128,247,102, 71,140, 0, 71, 10, 51, 10, 61, 10, + 107, 10,115, 10,176, 10,193, 10,205, 11, 39, 11, 52, 11, 65, 11, + 90, 11,107,194,243,241,245,225,242,101,128, 51,135, 97, 3, 10, + 69, 10, 76, 10, 94,227,245,244,101,128, 1,244,237,237, 97,129, + 3,147, 10, 84,225,230,242,233,227,225,110,128, 1,148,238,231, + 233,225,227,239,240,244,233, 99,128, 3,234,226,242,229,246,101, + 128, 1, 30, 99, 4, 10,125, 10,132, 10,141, 10,163,225,242,239, + 110,128, 1,230,229,228,233,236,236, 97,128, 1, 34,233,242, 99, + 2, 10,149, 10,154,236,101,128, 36,188,245,237,230,236,229,120, + 128, 1, 28,239,237,237,225,225,227,227,229,238,116,128, 1, 34, + 228,239,116,129, 1, 32, 10,184,225,227,227,229,238,116,128, 1, + 32,229,227,249,242,233,236,236,233, 99,128, 4, 19,104, 3, 10, + 213, 10,226, 11, 33,225,228,225,242,237,229,238,233,225,110,128, + 5, 66,101, 3, 10,234, 10,255, 11, 16,237,233,228,228,236,229, + 232,239,239,235,227,249,242,233,236,236,233, 99,128, 4,148,243, + 244,242,239,235,229,227,249,242,233,236,236,233, 99,128, 4,146, + 245,240,244,245,242,238,227,249,242,233,236,236,233, 99,128, 4, + 144,239,239,107,128, 1,147,233,237,225,242,237,229,238,233,225, + 110,128, 5, 51,234,229,227,249,242,233,236,236,233, 99,128, 4, + 3,109, 2, 11, 71, 11, 79,225,227,242,239,110,128, 30, 32,239, + 238,239,243,240,225,227,101,128,255, 39,242,225,246,101,129,246, + 206, 11, 99,243,237,225,236,108,128,247, 96,115, 2, 11,113, 11, + 129,237,225,236,108,129,247,103, 11,122,232,239,239,107,128, 2, + 155,244,242,239,235,101,128, 1,228, 72,140, 0, 72, 11,165, 11, + 190, 11,198, 11,208, 12, 17, 12, 40, 12, 77, 12,117, 12,129, 12, + 157, 12,165, 12,189,177,184, 53, 3, 11,175, 11,180, 11,185,179, + 51,128, 37,207,180, 51,128, 37,170,181, 49,128, 37,171,178,178, + 176,183, 51,128, 37,161,208,243,241,245,225,242,101,128, 51,203, + 97, 3, 11,216, 11,236, 12, 0,225,226,235,232,225,243,233,225, + 238,227,249,242,233,236,236,233, 99,128, 4,168,228,229,243,227, + 229,238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,178, + 242,228,243,233,231,238,227,249,242,233,236,236,233, 99,128, 4, + 42, 98, 2, 12, 23, 12, 28,225,114,128, 1, 38,242,229,246,229, + 226,229,236,239,119,128, 30, 42, 99, 2, 12, 46, 12, 55,229,228, + 233,236,236, 97,128, 30, 40,233,242, 99, 2, 12, 63, 12, 68,236, + 101,128, 36,189,245,237,230,236,229,120,128, 1, 36,100, 2, 12, + 83, 12, 93,233,229,242,229,243,233,115,128, 30, 38,239,116, 2, + 12,100, 12,109,225,227,227,229,238,116,128, 30, 34,226,229,236, + 239,119,128, 30, 36,237,239,238,239,243,240,225,227,101,128,255, + 40,111, 2, 12,135, 12,146,225,242,237,229,238,233,225,110,128, + 5, 64,242,233,227,239,240,244,233, 99,128, 3,232,243,237,225, + 236,108,128,247,104,245,238,231,225,242,245,237,236,225,245,116, + 129,246,207, 12,181,243,237,225,236,108,128,246,248,250,243,241, + 245,225,242,101,128, 51,144, 73,146, 0, 73, 12,239, 12,251, 12, + 255, 13, 11, 13, 29, 13, 37, 13, 94, 13,181, 13,214, 13,224, 13, + 242, 13,254, 14, 48, 14, 86, 14, 99, 14,166, 14,187, 14,205,193, + 227,249,242,233,236,236,233, 99,128, 4, 47, 74,128, 1, 50,213, + 227,249,242,233,236,236,233, 99,128, 4, 46,225,227,245,244,101, + 129, 0,205, 13, 21,243,237,225,236,108,128,247,237,226,242,229, + 246,101,128, 1, 44, 99, 3, 13, 45, 13, 52, 13, 84,225,242,239, + 110,128, 1,207,233,242, 99, 2, 13, 60, 13, 65,236,101,128, 36, + 190,245,237,230,236,229,120,129, 0,206, 13, 76,243,237,225,236, + 108,128,247,238,249,242,233,236,236,233, 99,128, 4, 6,100, 3, + 13,102, 13,112, 13,155,226,236,231,242,225,246,101,128, 2, 8, + 233,229,242,229,243,233,115,131, 0,207, 13,128, 13,136, 13,147, + 225,227,245,244,101,128, 30, 46,227,249,242,233,236,236,233, 99, + 128, 4,228,243,237,225,236,108,128,247,239,239,116,130, 1, 48, + 13,164, 13,173,225,227,227,229,238,116,128, 1, 48,226,229,236, + 239,119,128, 30,202,101, 2, 13,187, 13,203,226,242,229,246,229, + 227,249,242,233,236,236,233, 99,128, 4,214,227,249,242,233,236, + 236,233, 99,128, 4, 21,230,242,225,235,244,245,114,128, 33, 17, + 231,242,225,246,101,129, 0,204, 13,234,243,237,225,236,108,128, + 247,236,232,239,239,235,225,226,239,246,101,128, 30,200,105, 3, + 14, 6, 14, 17, 14, 32,227,249,242,233,236,236,233, 99,128, 4, + 24,238,246,229,242,244,229,228,226,242,229,246,101,128, 2, 10, + 243,232,239,242,244,227,249,242,233,236,236,233, 99,128, 4, 25, + 109, 2, 14, 54, 14, 75,225,227,242,239,110,129, 1, 42, 14, 64, + 227,249,242,233,236,236,233, 99,128, 4,226,239,238,239,243,240, + 225,227,101,128,255, 41,238,233,225,242,237,229,238,233,225,110, + 128, 5, 59,111, 3, 14,107, 14,118, 14,126,227,249,242,233,236, + 236,233, 99,128, 4, 1,231,239,238,229,107,128, 1, 46,244, 97, + 131, 3,153, 14,137, 14,147, 14,158,225,230,242,233,227,225,110, + 128, 1,150,228,233,229,242,229,243,233,115,128, 3,170,244,239, + 238,239,115,128, 3,138,115, 2, 14,172, 14,179,237,225,236,108, + 128,247,105,244,242,239,235,101,128, 1,151,244,233,236,228,101, + 129, 1, 40, 14,197,226,229,236,239,119,128, 30, 44,250,232,233, + 244,243, 97, 2, 14,216, 14,227,227,249,242,233,236,236,233, 99, + 128, 4,116,228,226,236,231,242,225,246,229,227,249,242,233,236, + 236,233, 99,128, 4,118, 74,134, 0, 74, 15, 6, 15, 18, 15, 41, + 15, 53, 15, 67, 15, 79,225,225,242,237,229,238,233,225,110,128, + 5, 65,227,233,242, 99, 2, 15, 27, 15, 32,236,101,128, 36,191, + 245,237,230,236,229,120,128, 1, 52,229,227,249,242,233,236,236, + 233, 99,128, 4, 8,232,229,232,225,242,237,229,238,233,225,110, + 128, 5, 75,237,239,238,239,243,240,225,227,101,128,255, 42,243, + 237,225,236,108,128,247,106, 75,140, 0, 75, 15,115, 15,125, 15, + 135, 16, 18, 16, 65, 16, 76, 16,106, 16,143, 16,156, 16,168, 16, + 180, 16,208,194,243,241,245,225,242,101,128, 51,133,203,243,241, + 245,225,242,101,128, 51,205, 97, 7, 15,151, 15,169, 15,191, 15, + 211, 15,226, 15,232, 15,249,226,225,243,232,235,233,242,227,249, + 242,233,236,236,233, 99,128, 4,160, 99, 2, 15,175, 15,181,245, + 244,101,128, 30, 48,249,242,233,236,236,233, 99,128, 4, 26,228, + 229,243,227,229,238,228,229,242,227,249,242,233,236,236,233, 99, + 128, 4,154,232,239,239,235,227,249,242,233,236,236,233, 99,128, + 4,195,240,240, 97,128, 3,154,243,244,242,239,235,229,227,249, + 242,233,236,236,233, 99,128, 4,158,246,229,242,244,233,227,225, + 236,243,244,242,239,235,229,227,249,242,233,236,236,233, 99,128, + 4,156, 99, 4, 16, 28, 16, 35, 16, 44, 16, 52,225,242,239,110, + 128, 1,232,229,228,233,236,236, 97,128, 1, 54,233,242,227,236, + 101,128, 36,192,239,237,237,225,225,227,227,229,238,116,128, 1, + 54,228,239,244,226,229,236,239,119,128, 30, 50,101, 2, 16, 82, + 16, 94,232,225,242,237,229,238,233,225,110,128, 5, 84,238,225, + 242,237,229,238,233,225,110,128, 5, 63,104, 3, 16,114, 16,126, + 16,137,225,227,249,242,233,236,236,233, 99,128, 4, 37,229,233, + 227,239,240,244,233, 99,128, 3,230,239,239,107,128, 1,152,234, + 229,227,249,242,233,236,236,233, 99,128, 4, 12,236,233,238,229, + 226,229,236,239,119,128, 30, 52,237,239,238,239,243,240,225,227, + 101,128,255, 43,239,240,240, 97, 2, 16,189, 16,200,227,249,242, + 233,236,236,233, 99,128, 4,128,231,242,229,229,107,128, 3,222, + 115, 2, 16,214, 16,226,233,227,249,242,233,236,236,233, 99,128, + 4,110,237,225,236,108,128,247,107, 76,138, 0, 76, 17, 1, 17, + 5, 17, 9, 17, 29, 17, 95, 17,133, 17,147, 17,165, 17,177, 17, + 189, 74,128, 1,199, 76,128,246,191, 97, 2, 17, 15, 17, 22,227, + 245,244,101,128, 1, 57,237,226,228, 97,128, 3,155, 99, 4, 17, + 39, 17, 46, 17, 55, 17, 82,225,242,239,110,128, 1, 61,229,228, + 233,236,236, 97,128, 1, 59,233,242, 99, 2, 17, 63, 17, 68,236, + 101,128, 36,193,245,237,230,236,229,248,226,229,236,239,119,128, + 30, 60,239,237,237,225,225,227,227,229,238,116,128, 1, 59,228, + 239,116,130, 1, 63, 17,105, 17,114,225,227,227,229,238,116,128, + 1, 63,226,229,236,239,119,129, 30, 54, 17,124,237,225,227,242, + 239,110,128, 30, 56,233,247,238,225,242,237,229,238,233,225,110, + 128, 5, 60,106,129, 1,200, 17,153,229,227,249,242,233,236,236, + 233, 99,128, 4, 9,236,233,238,229,226,229,236,239,119,128, 30, + 58,237,239,238,239,243,240,225,227,101,128,255, 44,115, 2, 17, + 195, 17,212,236,225,243,104,129, 1, 65, 17,204,243,237,225,236, + 108,128,246,249,237,225,236,108,128,247,108, 77,137, 0, 77, 17, + 241, 17,251, 18, 24, 18, 33, 18, 58, 18, 71, 18, 83, 18, 91, 18, + 100,194,243,241,245,225,242,101,128, 51,134,225, 99, 2, 18, 2, + 18, 18,242,239,110,129,246,208, 18, 10,243,237,225,236,108,128, + 247,175,245,244,101,128, 30, 62,227,233,242,227,236,101,128, 36, + 194,228,239,116, 2, 18, 41, 18, 50,225,227,227,229,238,116,128, + 30, 64,226,229,236,239,119,128, 30, 66,229,238,225,242,237,229, + 238,233,225,110,128, 5, 68,237,239,238,239,243,240,225,227,101, + 128,255, 45,243,237,225,236,108,128,247,109,244,245,242,238,229, + 100,128, 1,156,117,128, 3,156, 78,141, 0, 78, 18,134, 18,138, + 18,146, 18,212, 18,237, 18,248, 19, 3, 19, 21, 19, 33, 19, 45, + 19, 58, 19, 66, 19, 84, 74,128, 1,202,225,227,245,244,101,128, + 1, 67, 99, 4, 18,156, 18,163, 18,172, 18,199,225,242,239,110, + 128, 1, 71,229,228,233,236,236, 97,128, 1, 69,233,242, 99, 2, + 18,180, 18,185,236,101,128, 36,195,245,237,230,236,229,248,226, + 229,236,239,119,128, 30, 74,239,237,237,225,225,227,227,229,238, + 116,128, 1, 69,228,239,116, 2, 18,220, 18,229,225,227,227,229, + 238,116,128, 30, 68,226,229,236,239,119,128, 30, 70,232,239,239, + 235,236,229,230,116,128, 1,157,233,238,229,242,239,237,225,110, + 128, 33,104,106,129, 1,203, 19, 9,229,227,249,242,233,236,236, + 233, 99,128, 4, 10,236,233,238,229,226,229,236,239,119,128, 30, + 72,237,239,238,239,243,240,225,227,101,128,255, 46,239,247,225, + 242,237,229,238,233,225,110,128, 5, 70,243,237,225,236,108,128, + 247,110,244,233,236,228,101,129, 0,209, 19, 76,243,237,225,236, + 108,128,247,241,117,128, 3,157, 79,141, 0, 79, 19,118, 19,132, + 19,150, 19,203, 20, 78, 20,152, 20,187, 21, 48, 21, 69, 21,213, + 21,223, 21,254, 22, 53, 69,129, 1, 82, 19,124,243,237,225,236, + 108,128,246,250,225,227,245,244,101,129, 0,211, 19,142,243,237, + 225,236,108,128,247,243, 98, 2, 19,156, 19,196,225,242,242,229, + 100, 2, 19,166, 19,177,227,249,242,233,236,236,233, 99,128, 4, + 232,228,233,229,242,229,243,233,243,227,249,242,233,236,236,233, + 99,128, 4,234,242,229,246,101,128, 1, 78, 99, 4, 19,213, 19, + 220, 19,235, 20, 68,225,242,239,110,128, 1,209,229,238,244,229, + 242,229,228,244,233,236,228,101,128, 1,159,233,242, 99, 2, 19, + 243, 19,248,236,101,128, 36,196,245,237,230,236,229,120,134, 0, + 212, 20, 13, 20, 21, 20, 32, 20, 40, 20, 52, 20, 60,225,227,245, + 244,101,128, 30,208,228,239,244,226,229,236,239,119,128, 30,216, + 231,242,225,246,101,128, 30,210,232,239,239,235,225,226,239,246, + 101,128, 30,212,243,237,225,236,108,128,247,244,244,233,236,228, + 101,128, 30,214,249,242,233,236,236,233, 99,128, 4, 30,100, 3, + 20, 86, 20,109, 20,142,226,108, 2, 20, 93, 20,101,225,227,245, + 244,101,128, 1, 80,231,242,225,246,101,128, 2, 12,233,229,242, + 229,243,233,115,130, 0,214, 20,123, 20,134,227,249,242,233,236, + 236,233, 99,128, 4,230,243,237,225,236,108,128,247,246,239,244, + 226,229,236,239,119,128, 30,204,103, 2, 20,158, 20,170,239,238, + 229,235,243,237,225,236,108,128,246,251,242,225,246,101,129, 0, + 210, 20,179,243,237,225,236,108,128,247,242,104, 4, 20,197, 20, + 208, 20,212, 21, 34,225,242,237,229,238,233,225,110,128, 5, 85, + 109,128, 33, 38,111, 2, 20,218, 20,228,239,235,225,226,239,246, + 101,128, 30,206,242,110,133, 1,160, 20,243, 20,251, 21, 6, 21, + 14, 21, 26,225,227,245,244,101,128, 30,218,228,239,244,226,229, + 236,239,119,128, 30,226,231,242,225,246,101,128, 30,220,232,239, + 239,235,225,226,239,246,101,128, 30,222,244,233,236,228,101,128, + 30,224,245,238,231,225,242,245,237,236,225,245,116,128, 1, 80, + 105,129, 1,162, 21, 54,238,246,229,242,244,229,228,226,242,229, + 246,101,128, 2, 14,109, 4, 21, 79, 21,107, 21,184, 21,202,225, + 227,242,239,110,130, 1, 76, 21, 91, 21, 99,225,227,245,244,101, + 128, 30, 82,231,242,225,246,101,128, 30, 80,229,231, 97,132, 33, + 38, 21,121, 21,132, 21,140, 21,156,227,249,242,233,236,236,233, + 99,128, 4, 96,231,242,229,229,107,128, 3,169,242,239,245,238, + 228,227,249,242,233,236,236,233, 99,128, 4,122,116, 2, 21,162, + 21,177,233,244,236,239,227,249,242,233,236,236,233, 99,128, 4, + 124,239,238,239,115,128, 3,143,233,227,242,239,110,129, 3,159, + 21,194,244,239,238,239,115,128, 3,140,239,238,239,243,240,225, + 227,101,128,255, 47,238,229,242,239,237,225,110,128, 33, 96,111, + 2, 21,229, 21,248,231,239,238,229,107,129, 1,234, 21,239,237, + 225,227,242,239,110,128, 1,236,240,229,110,128, 1,134,115, 3, + 22, 6, 22, 33, 22, 40,236,225,243,104,130, 0,216, 22, 17, 22, + 25,225,227,245,244,101,128, 1,254,243,237,225,236,108,128,247, + 248,237,225,236,108,128,247,111,244,242,239,235,229,225,227,245, + 244,101,128, 1,254,116, 2, 22, 59, 22, 70,227,249,242,233,236, + 236,233, 99,128, 4,126,233,236,228,101,131, 0,213, 22, 83, 22, + 91, 22,102,225,227,245,244,101,128, 30, 76,228,233,229,242,229, + 243,233,115,128, 30, 78,243,237,225,236,108,128,247,245, 80,136, + 0, 80, 22,130, 22,138, 22,147, 22,159, 22,211, 22,227, 22,246, + 23, 2,225,227,245,244,101,128, 30, 84,227,233,242,227,236,101, + 128, 36,197,228,239,244,225,227,227,229,238,116,128, 30, 86,101, + 3, 22,167, 22,178, 22,190,227,249,242,233,236,236,233, 99,128, + 4, 31,232,225,242,237,229,238,233,225,110,128, 5, 74,237,233, + 228,228,236,229,232,239,239,235,227,249,242,233,236,236,233, 99, + 128, 4,166,104, 2, 22,217, 22,221,105,128, 3,166,239,239,107, + 128, 1,164,105,129, 3,160, 22,233,247,242,225,242,237,229,238, + 233,225,110,128, 5, 83,237,239,238,239,243,240,225,227,101,128, + 255, 48,115, 2, 23, 8, 23, 25,105,129, 3,168, 23, 14,227,249, + 242,233,236,236,233, 99,128, 4,112,237,225,236,108,128,247,112, + 81,131, 0, 81, 23, 42, 23, 51, 23, 63,227,233,242,227,236,101, + 128, 36,198,237,239,238,239,243,240,225,227,101,128,255, 49,243, + 237,225,236,108,128,247,113, 82,138, 0, 82, 23, 95, 23,119, 23, + 166, 23,217, 23,230, 23,240, 23,245, 24, 19, 24, 31, 24, 43, 97, + 2, 23,101, 23,112,225,242,237,229,238,233,225,110,128, 5, 76, + 227,245,244,101,128, 1, 84, 99, 4, 23,129, 23,136, 23,145, 23, + 153,225,242,239,110,128, 1, 88,229,228,233,236,236, 97,128, 1, + 86,233,242,227,236,101,128, 36,199,239,237,237,225,225,227,227, + 229,238,116,128, 1, 86,100, 2, 23,172, 23,182,226,236,231,242, + 225,246,101,128, 2, 16,239,116, 2, 23,189, 23,198,225,227,227, + 229,238,116,128, 30, 88,226,229,236,239,119,129, 30, 90, 23,208, + 237,225,227,242,239,110,128, 30, 92,229,232,225,242,237,229,238, + 233,225,110,128, 5, 80,230,242,225,235,244,245,114,128, 33, 28, + 232,111,128, 3,161,233,110, 2, 23,252, 24, 5,231,243,237,225, + 236,108,128,246,252,246,229,242,244,229,228,226,242,229,246,101, + 128, 2, 18,236,233,238,229,226,229,236,239,119,128, 30, 94,237, + 239,238,239,243,240,225,227,101,128,255, 50,243,237,225,236,108, + 129,247,114, 24, 53,233,238,246,229,242,244,229,100,129, 2,129, + 24, 66,243,245,240,229,242,233,239,114,128, 2,182, 83,139, 0, + 83, 24,103, 26, 17, 26, 55, 26,182, 26,221, 26,250, 27, 84, 27, + 105, 27,117, 27,135, 27,143, 70, 6, 24,117, 24,209, 24,241, 25, + 77, 25,119, 25,221, 48, 9, 24,137, 24,145, 24,153, 24,161, 24, + 169, 24,177, 24,185, 24,193, 24,201,177,176,176,176, 48,128, 37, + 12,178,176,176,176, 48,128, 37, 20,179,176,176,176, 48,128, 37, + 16,180,176,176,176, 48,128, 37, 24,181,176,176,176, 48,128, 37, + 60,182,176,176,176, 48,128, 37, 44,183,176,176,176, 48,128, 37, + 52,184,176,176,176, 48,128, 37, 28,185,176,176,176, 48,128, 37, + 36, 49, 3, 24,217, 24,225, 24,233,176,176,176,176, 48,128, 37, + 0,177,176,176,176, 48,128, 37, 2,185,176,176,176, 48,128, 37, + 97, 50, 9, 25, 5, 25, 13, 25, 21, 25, 29, 25, 37, 25, 45, 25, + 53, 25, 61, 25, 69,176,176,176,176, 48,128, 37, 98,177,176,176, + 176, 48,128, 37, 86,178,176,176,176, 48,128, 37, 85,179,176,176, + 176, 48,128, 37, 99,180,176,176,176, 48,128, 37, 81,181,176,176, + 176, 48,128, 37, 87,182,176,176,176, 48,128, 37, 93,183,176,176, + 176, 48,128, 37, 92,184,176,176,176, 48,128, 37, 91, 51, 4, 25, + 87, 25, 95, 25,103, 25,111,182,176,176,176, 48,128, 37, 94,183, + 176,176,176, 48,128, 37, 95,184,176,176,176, 48,128, 37, 90,185, + 176,176,176, 48,128, 37, 84, 52, 10, 25,141, 25,149, 25,157, 25, + 165, 25,173, 25,181, 25,189, 25,197, 25,205, 25,213,176,176,176, + 176, 48,128, 37,105,177,176,176,176, 48,128, 37,102,178,176,176, + 176, 48,128, 37, 96,179,176,176,176, 48,128, 37, 80,180,176,176, + 176, 48,128, 37,108,181,176,176,176, 48,128, 37,103,182,176,176, + 176, 48,128, 37,104,183,176,176,176, 48,128, 37,100,184,176,176, + 176, 48,128, 37,101,185,176,176,176, 48,128, 37, 89, 53, 5, 25, + 233, 25,241, 25,249, 26, 1, 26, 9,176,176,176,176, 48,128, 37, + 88,177,176,176,176, 48,128, 37, 82,178,176,176,176, 48,128, 37, + 83,179,176,176,176, 48,128, 37,107,180,176,176,176, 48,128, 37, + 106, 97, 2, 26, 23, 26, 44,227,245,244,101,129, 1, 90, 26, 32, + 228,239,244,225,227,227,229,238,116,128, 30,100,237,240,233,231, + 242,229,229,107,128, 3,224, 99, 5, 26, 67, 26, 98, 26,107, 26, + 147, 26,169,225,242,239,110,130, 1, 96, 26, 78, 26, 90,228,239, + 244,225,227,227,229,238,116,128, 30,102,243,237,225,236,108,128, + 246,253,229,228,233,236,236, 97,128, 1, 94,232,247, 97,130, 1, + 143, 26,117, 26,128,227,249,242,233,236,236,233, 99,128, 4,216, + 228,233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99, + 128, 4,218,233,242, 99, 2, 26,155, 26,160,236,101,128, 36,200, + 245,237,230,236,229,120,128, 1, 92,239,237,237,225,225,227,227, + 229,238,116,128, 2, 24,228,239,116, 2, 26,190, 26,199,225,227, + 227,229,238,116,128, 30, 96,226,229,236,239,119,129, 30, 98, 26, + 209,228,239,244,225,227,227,229,238,116,128, 30,104,101, 2, 26, + 227, 26,239,232,225,242,237,229,238,233,225,110,128, 5, 77,246, + 229,238,242,239,237,225,110,128, 33,102,104, 5, 27, 6, 27, 34, + 27, 48, 27, 59, 27, 72, 97, 2, 27, 12, 27, 23,225,242,237,229, + 238,233,225,110,128, 5, 71,227,249,242,233,236,236,233, 99,128, + 4, 40,227,232,225,227,249,242,233,236,236,233, 99,128, 4, 41, + 229,233,227,239,240,244,233, 99,128, 3,226,232,225,227,249,242, + 233,236,236,233, 99,128, 4,186,233,237,225,227,239,240,244,233, + 99,128, 3,236,105, 2, 27, 90, 27, 96,231,237, 97,128, 3,163, + 248,242,239,237,225,110,128, 33,101,237,239,238,239,243,240,225, + 227,101,128,255, 51,239,230,244,243,233,231,238,227,249,242,233, + 236,236,233, 99,128, 4, 44,243,237,225,236,108,128,247,115,244, + 233,231,237,225,231,242,229,229,107,128, 3,218, 84,141, 0, 84, + 27,186, 27,191, 27,197, 28, 7, 28, 32, 28, 96, 28,147, 28,177, + 28,189, 28,201, 28,246, 29, 6, 29, 46,225,117,128, 3,164,226, + 225,114,128, 1,102, 99, 4, 27,207, 27,214, 27,223, 27,250,225, + 242,239,110,128, 1,100,229,228,233,236,236, 97,128, 1, 98,233, + 242, 99, 2, 27,231, 27,236,236,101,128, 36,201,245,237,230,236, + 229,248,226,229,236,239,119,128, 30,112,239,237,237,225,225,227, + 227,229,238,116,128, 1, 98,228,239,116, 2, 28, 15, 28, 24,225, + 227,227,229,238,116,128, 30,106,226,229,236,239,119,128, 30,108, + 101, 4, 28, 42, 28, 53, 28, 73, 28, 82,227,249,242,233,236,236, + 233, 99,128, 4, 34,228,229,243,227,229,238,228,229,242,227,249, + 242,233,236,236,233, 99,128, 4,172,238,242,239,237,225,110,128, + 33,105,244,243,229,227,249,242,233,236,236,233, 99,128, 4,180, + 104, 3, 28,104, 28,110, 28,136,229,244, 97,128, 3,152,111, 2, + 28,116, 28,121,239,107,128, 1,172,242,110,129, 0,222, 28,128, + 243,237,225,236,108,128,247,254,242,229,229,242,239,237,225,110, + 128, 33, 98,105, 2, 28,153, 28,164,236,228,229,243,237,225,236, + 108,128,246,254,247,238,225,242,237,229,238,233,225,110,128, 5, + 79,236,233,238,229,226,229,236,239,119,128, 30,110,237,239,238, + 239,243,240,225,227,101,128,255, 52,111, 2, 28,207, 28,218,225, + 242,237,229,238,233,225,110,128, 5, 57,238,101, 3, 28,227, 28, + 234, 28,240,230,233,246,101,128, 1,188,243,233,120,128, 1,132, + 244,247,111,128, 1,167,242,229,244,242,239,230,236,229,248,232, + 239,239,107,128, 1,174,115, 3, 29, 14, 29, 26, 29, 39,229,227, + 249,242,233,236,236,233, 99,128, 4, 38,232,229,227,249,242,233, + 236,236,233, 99,128, 4, 11,237,225,236,108,128,247,116,119, 2, + 29, 52, 29, 64,229,236,246,229,242,239,237,225,110,128, 33,107, + 239,242,239,237,225,110,128, 33, 97, 85,142, 0, 85, 29,105, 29, + 123, 29,131, 29,198, 30, 69, 30, 87, 30,198, 30,214, 30,226, 31, + 21, 31, 30, 31,142, 31,149, 31,219,225,227,245,244,101,129, 0, + 218, 29,115,243,237,225,236,108,128,247,250,226,242,229,246,101, + 128, 1,108, 99, 3, 29,139, 29,146, 29,188,225,242,239,110,128, + 1,211,233,242, 99, 2, 29,154, 29,159,236,101,128, 36,202,245, + 237,230,236,229,120,130, 0,219, 29,172, 29,180,226,229,236,239, + 119,128, 30,118,243,237,225,236,108,128,247,251,249,242,233,236, + 236,233, 99,128, 4, 35,100, 3, 29,206, 29,229, 30, 59,226,108, + 2, 29,213, 29,221,225,227,245,244,101,128, 1,112,231,242,225, + 246,101,128, 2, 20,233,229,242,229,243,233,115,134, 0,220, 29, + 251, 30, 3, 30, 11, 30, 34, 30, 42, 30, 51,225,227,245,244,101, + 128, 1,215,226,229,236,239,119,128, 30,114, 99, 2, 30, 17, 30, + 24,225,242,239,110,128, 1,217,249,242,233,236,236,233, 99,128, + 4,240,231,242,225,246,101,128, 1,219,237,225,227,242,239,110, + 128, 1,213,243,237,225,236,108,128,247,252,239,244,226,229,236, + 239,119,128, 30,228,231,242,225,246,101,129, 0,217, 30, 79,243, + 237,225,236,108,128,247,249,104, 2, 30, 93, 30,171,111, 2, 30, + 99, 30,109,239,235,225,226,239,246,101,128, 30,230,242,110,133, + 1,175, 30,124, 30,132, 30,143, 30,151, 30,163,225,227,245,244, + 101,128, 30,232,228,239,244,226,229,236,239,119,128, 30,240,231, + 242,225,246,101,128, 30,234,232,239,239,235,225,226,239,246,101, + 128, 30,236,244,233,236,228,101,128, 30,238,245,238,231,225,242, + 245,237,236,225,245,116,129, 1,112, 30,187,227,249,242,233,236, + 236,233, 99,128, 4,242,233,238,246,229,242,244,229,228,226,242, + 229,246,101,128, 2, 22,235,227,249,242,233,236,236,233, 99,128, + 4,120,109, 2, 30,232, 31, 10,225,227,242,239,110,130, 1,106, + 30,244, 30,255,227,249,242,233,236,236,233, 99,128, 4,238,228, + 233,229,242,229,243,233,115,128, 30,122,239,238,239,243,240,225, + 227,101,128,255, 53,239,231,239,238,229,107,128, 1,114,240,243, + 233,236,239,110,133, 3,165, 31, 49, 31, 53, 31, 90, 31,121, 31, + 134, 49,128, 3,210, 97, 2, 31, 59, 31, 81,227,245,244,229,232, + 239,239,235,243,249,237,226,239,236,231,242,229,229,107,128, 3, + 211,230,242,233,227,225,110,128, 1,177,228,233,229,242,229,243, + 233,115,129, 3,171, 31,103,232,239,239,235,243,249,237,226,239, + 236,231,242,229,229,107,128, 3,212,232,239,239,235,243,249,237, + 226,239,108,128, 3,210,244,239,238,239,115,128, 3,142,242,233, + 238,103,128, 1,110,115, 3, 31,157, 31,172, 31,179,232,239,242, + 244,227,249,242,233,236,236,233, 99,128, 4, 14,237,225,236,108, + 128,247,117,244,242,225,233,231,232,116, 2, 31,191, 31,202,227, + 249,242,233,236,236,233, 99,128, 4,174,243,244,242,239,235,229, + 227,249,242,233,236,236,233, 99,128, 4,176,244,233,236,228,101, + 130, 1,104, 31,231, 31,239,225,227,245,244,101,128, 30,120,226, + 229,236,239,119,128, 30,116, 86,136, 0, 86, 32, 11, 32, 20, 32, + 31, 32, 60, 32, 67, 32, 79, 32, 91, 32, 99,227,233,242,227,236, + 101,128, 36,203,228,239,244,226,229,236,239,119,128, 30,126,101, + 2, 32, 37, 32, 48,227,249,242,233,236,236,233, 99,128, 4, 18, + 247,225,242,237,229,238,233,225,110,128, 5, 78,232,239,239,107, + 128, 1,178,237,239,238,239,243,240,225,227,101,128,255, 54,239, + 225,242,237,229,238,233,225,110,128, 5, 72,243,237,225,236,108, + 128,247,118,244,233,236,228,101,128, 30,124, 87,134, 0, 87, 32, + 123, 32,131, 32,154, 32,194, 32,202, 32,214,225,227,245,244,101, + 128, 30,130,227,233,242, 99, 2, 32,140, 32,145,236,101,128, 36, + 204,245,237,230,236,229,120,128, 1,116,100, 2, 32,160, 32,170, + 233,229,242,229,243,233,115,128, 30,132,239,116, 2, 32,177, 32, + 186,225,227,227,229,238,116,128, 30,134,226,229,236,239,119,128, + 30,136,231,242,225,246,101,128, 30,128,237,239,238,239,243,240, + 225,227,101,128,255, 55,243,237,225,236,108,128,247,119, 88,134, + 0, 88, 32,238, 32,247, 33, 18, 33, 31, 33, 35, 33, 47,227,233, + 242,227,236,101,128, 36,205,100, 2, 32,253, 33, 7,233,229,242, + 229,243,233,115,128, 30,140,239,244,225,227,227,229,238,116,128, + 30,138,229,232,225,242,237,229,238,233,225,110,128, 5, 61,105, + 128, 3,158,237,239,238,239,243,240,225,227,101,128,255, 56,243, + 237,225,236,108,128,247,120, 89,139, 0, 89, 33, 81, 33,116, 33, + 139, 33,189, 33,228, 33,236, 33,253, 34, 40, 34, 52, 34, 60, 34, + 68, 97, 2, 33, 87, 33,104,227,245,244,101,129, 0,221, 33, 96, + 243,237,225,236,108,128,247,253,244,227,249,242,233,236,236,233, + 99,128, 4, 98,227,233,242, 99, 2, 33,125, 33,130,236,101,128, + 36,206,245,237,230,236,229,120,128, 1,118,100, 2, 33,145, 33, + 165,233,229,242,229,243,233,115,129, 1,120, 33,157,243,237,225, + 236,108,128,247,255,239,116, 2, 33,172, 33,181,225,227,227,229, + 238,116,128, 30,142,226,229,236,239,119,128, 30,244,229,114, 2, + 33,196, 33,208,233,227,249,242,233,236,236,233, 99,128, 4, 43, + 245,228,233,229,242,229,243,233,243,227,249,242,233,236,236,233, + 99,128, 4,248,231,242,225,246,101,128, 30,242,232,239,239,107, + 129, 1,179, 33,245,225,226,239,246,101,128, 30,246,105, 3, 34, + 5, 34, 16, 34, 27,225,242,237,229,238,233,225,110,128, 5, 69, + 227,249,242,233,236,236,233, 99,128, 4, 7,247,238,225,242,237, + 229,238,233,225,110,128, 5, 82,237,239,238,239,243,240,225,227, + 101,128,255, 57,243,237,225,236,108,128,247,121,244,233,236,228, + 101,128, 30,248,245,115, 2, 34, 75, 34,113,226,233,103, 2, 34, + 83, 34, 94,227,249,242,233,236,236,233, 99,128, 4,106,233,239, + 244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128, 4, + 108,236,233,244,244,236,101, 2, 34,124, 34,135,227,249,242,233, + 236,236,233, 99,128, 4,102,233,239,244,233,230,233,229,228,227, + 249,242,233,236,236,233, 99,128, 4,104, 90,136, 0, 90, 34,174, + 34,198, 34,243, 35, 14, 35, 81, 35,173, 35,185, 35,197, 97, 2, + 34,180, 34,191,225,242,237,229,238,233,225,110,128, 5, 54,227, + 245,244,101,128, 1,121, 99, 2, 34,204, 34,221,225,242,239,110, + 129, 1,125, 34,213,243,237,225,236,108,128,246,255,233,242, 99, + 2, 34,229, 34,234,236,101,128, 36,207,245,237,230,236,229,120, + 128, 30,144,228,239,116,130, 1,123, 34,253, 35, 6,225,227,227, + 229,238,116,128, 1,123,226,229,236,239,119,128, 30,146,101, 3, + 35, 22, 35, 33, 35, 76,227,249,242,233,236,236,233, 99,128, 4, + 23,100, 2, 35, 39, 35, 58,229,243,227,229,238,228,229,242,227, + 249,242,233,236,236,233, 99,128, 4,152,233,229,242,229,243,233, + 243,227,249,242,233,236,236,233, 99,128, 4,222,244, 97,128, 3, + 150,232,101, 4, 35, 92, 35,103, 35,119, 35,130,225,242,237,229, + 238,233,225,110,128, 5, 58,226,242,229,246,229,227,249,242,233, + 236,236,233, 99,128, 4,193,227,249,242,233,236,236,233, 99,128, + 4, 22,100, 2, 35,136, 35,155,229,243,227,229,238,228,229,242, + 227,249,242,233,236,236,233, 99,128, 4,150,233,229,242,229,243, + 233,243,227,249,242,233,236,236,233, 99,128, 4,220,236,233,238, + 229,226,229,236,239,119,128, 30,148,237,239,238,239,243,240,225, + 227,101,128,255, 58,115, 2, 35,203, 35,210,237,225,236,108,128, + 247,122,244,242,239,235,101,128, 1,181, 97,149, 0, 97, 36, 8, + 36,144, 37, 35, 37,211, 38, 55, 38, 91, 45, 10, 45, 47, 45, 74, + 46, 43, 46, 81, 47,170, 47,242, 48,197, 48,206, 49, 79, 51, 87, + 52, 77, 52,124, 53, 19, 53, 33, 97, 7, 36, 24, 36, 34, 36, 41, + 36, 48, 36, 73, 36, 89, 36,100,226,229,238,231,225,236,105,128, + 9,134,227,245,244,101,128, 0,225,228,229,246, 97,128, 9, 6, + 231,117, 2, 36, 55, 36, 64,234,225,242,225,244,105,128, 10,134, + 242,237,245,235,232,105,128, 10, 6,237,225,244,242,225,231,245, + 242,237,245,235,232,105,128, 10, 62,242,245,243,241,245,225,242, + 101,128, 51, 3,246,239,247,229,236,243,233,231,110, 3, 36,116, + 36,126, 36,133,226,229,238,231,225,236,105,128, 9,190,228,229, + 246, 97,128, 9, 62,231,245,234,225,242,225,244,105,128, 10,190, + 98, 4, 36,154, 36,195, 36,204, 36,214,226,242,229,246,233,225, + 244,233,239,110, 2, 36,169, 36,184,237,225,242,235,225,242,237, + 229,238,233,225,110,128, 5, 95,243,233,231,238,228,229,246, 97, + 128, 9,112,229,238,231,225,236,105,128, 9,133,239,240,239,237, + 239,230,111,128, 49, 26,242,229,246,101,134, 1, 3, 36,233, 36, + 241, 36,252, 37, 7, 37, 15, 37, 27,225,227,245,244,101,128, 30, + 175,227,249,242,233,236,236,233, 99,128, 4,209,228,239,244,226, + 229,236,239,119,128, 30,183,231,242,225,246,101,128, 30,177,232, + 239,239,235,225,226,239,246,101,128, 30,179,244,233,236,228,101, + 128, 30,181, 99, 4, 37, 45, 37, 52, 37,131, 37,201,225,242,239, + 110,128, 1,206,233,242, 99, 2, 37, 60, 37, 65,236,101,128, 36, + 208,245,237,230,236,229,120,133, 0,226, 37, 84, 37, 92, 37,103, + 37,111, 37,123,225,227,245,244,101,128, 30,165,228,239,244,226, + 229,236,239,119,128, 30,173,231,242,225,246,101,128, 30,167,232, + 239,239,235,225,226,239,246,101,128, 30,169,244,233,236,228,101, + 128, 30,171,245,244,101,133, 0,180, 37,147, 37,158, 37,175, 37, + 182, 37,191,226,229,236,239,247,227,237, 98,128, 3, 23, 99, 2, + 37,164, 37,169,237, 98,128, 3, 1,239,237, 98,128, 3, 1,228, + 229,246, 97,128, 9, 84,236,239,247,237,239,100,128, 2,207,244, + 239,238,229,227,237, 98,128, 3, 65,249,242,233,236,236,233, 99, + 128, 4, 48,100, 5, 37,223, 37,233, 37,247, 37,253, 38, 31,226, + 236,231,242,225,246,101,128, 2, 1,228,225,235,231,245,242,237, + 245,235,232,105,128, 10,113,229,246, 97,128, 9, 5,233,229,242, + 229,243,233,115,130, 0,228, 38, 11, 38, 22,227,249,242,233,236, + 236,233, 99,128, 4,211,237,225,227,242,239,110,128, 1,223,239, + 116, 2, 38, 38, 38, 46,226,229,236,239,119,128, 30,161,237,225, + 227,242,239,110,128, 1,225,101,131, 0,230, 38, 65, 38, 73, 38, + 82,225,227,245,244,101,128, 1,253,235,239,242,229,225,110,128, + 49, 80,237,225,227,242,239,110,128, 1,227,230,233,105, 6, 38, + 107, 38,127, 41, 64, 41, 70, 41, 85, 44,185, 48, 2, 38,113, 38, + 120,176,178,176, 56,128, 32, 21,184,185,180, 49,128, 32,164,177, + 48, 3, 38,136, 40,160, 41, 39, 48, 9, 38,156, 38,176, 38,238, + 39, 44, 39,106, 39,168, 39,230, 40, 36, 40, 98, 49, 3, 38,164, + 38,168, 38,172, 55,128, 4, 16, 56,128, 4, 17, 57,128, 4, 18, + 50, 10, 38,198, 38,202, 38,206, 38,210, 38,214, 38,218, 38,222, + 38,226, 38,230, 38,234, 48,128, 4, 19, 49,128, 4, 20, 50,128, + 4, 21, 51,128, 4, 1, 52,128, 4, 22, 53,128, 4, 23, 54,128, + 4, 24, 55,128, 4, 25, 56,128, 4, 26, 57,128, 4, 27, 51, 10, + 39, 4, 39, 8, 39, 12, 39, 16, 39, 20, 39, 24, 39, 28, 39, 32, + 39, 36, 39, 40, 48,128, 4, 28, 49,128, 4, 29, 50,128, 4, 30, + 51,128, 4, 31, 52,128, 4, 32, 53,128, 4, 33, 54,128, 4, 34, + 55,128, 4, 35, 56,128, 4, 36, 57,128, 4, 37, 52, 10, 39, 66, + 39, 70, 39, 74, 39, 78, 39, 82, 39, 86, 39, 90, 39, 94, 39, 98, + 39,102, 48,128, 4, 38, 49,128, 4, 39, 50,128, 4, 40, 51,128, + 4, 41, 52,128, 4, 42, 53,128, 4, 43, 54,128, 4, 44, 55,128, + 4, 45, 56,128, 4, 46, 57,128, 4, 47, 53, 10, 39,128, 39,132, + 39,136, 39,140, 39,144, 39,148, 39,152, 39,156, 39,160, 39,164, + 48,128, 4,144, 49,128, 4, 2, 50,128, 4, 3, 51,128, 4, 4, + 52,128, 4, 5, 53,128, 4, 6, 54,128, 4, 7, 55,128, 4, 8, + 56,128, 4, 9, 57,128, 4, 10, 54, 10, 39,190, 39,194, 39,198, + 39,202, 39,206, 39,210, 39,214, 39,218, 39,222, 39,226, 48,128, + 4, 11, 49,128, 4, 12, 50,128, 4, 14, 51,128,246,196, 52,128, + 246,197, 53,128, 4, 48, 54,128, 4, 49, 55,128, 4, 50, 56,128, + 4, 51, 57,128, 4, 52, 55, 10, 39,252, 40, 0, 40, 4, 40, 8, + 40, 12, 40, 16, 40, 20, 40, 24, 40, 28, 40, 32, 48,128, 4, 53, + 49,128, 4, 81, 50,128, 4, 54, 51,128, 4, 55, 52,128, 4, 56, + 53,128, 4, 57, 54,128, 4, 58, 55,128, 4, 59, 56,128, 4, 60, + 57,128, 4, 61, 56, 10, 40, 58, 40, 62, 40, 66, 40, 70, 40, 74, + 40, 78, 40, 82, 40, 86, 40, 90, 40, 94, 48,128, 4, 62, 49,128, + 4, 63, 50,128, 4, 64, 51,128, 4, 65, 52,128, 4, 66, 53,128, + 4, 67, 54,128, 4, 68, 55,128, 4, 69, 56,128, 4, 70, 57,128, + 4, 71, 57, 10, 40,120, 40,124, 40,128, 40,132, 40,136, 40,140, + 40,144, 40,148, 40,152, 40,156, 48,128, 4, 72, 49,128, 4, 73, + 50,128, 4, 74, 51,128, 4, 75, 52,128, 4, 76, 53,128, 4, 77, + 54,128, 4, 78, 55,128, 4, 79, 56,128, 4,145, 57,128, 4, 82, + 49, 4, 40,170, 40,232, 40,237, 41, 7, 48, 10, 40,192, 40,196, + 40,200, 40,204, 40,208, 40,212, 40,216, 40,220, 40,224, 40,228, + 48,128, 4, 83, 49,128, 4, 84, 50,128, 4, 85, 51,128, 4, 86, + 52,128, 4, 87, 53,128, 4, 88, 54,128, 4, 89, 55,128, 4, 90, + 56,128, 4, 91, 57,128, 4, 92,177, 48,128, 4, 94, 52, 4, 40, + 247, 40,251, 40,255, 41, 3, 53,128, 4, 15, 54,128, 4, 98, 55, + 128, 4,114, 56,128, 4,116, 57, 5, 41, 19, 41, 23, 41, 27, 41, + 31, 41, 35, 50,128,246,198, 51,128, 4, 95, 52,128, 4, 99, 53, + 128, 4,115, 54,128, 4,117, 56, 2, 41, 45, 41, 59, 51, 2, 41, + 51, 41, 55, 49,128,246,199, 50,128,246,200,180, 54,128, 4,217, + 178,185, 57,128, 32, 14,179, 48, 2, 41, 77, 41, 81, 48,128, 32, + 15, 49,128, 32, 13,181, 55, 7, 41,102, 41,172, 42,237, 43, 58, + 44, 15, 44,108, 44,179, 51, 2, 41,108, 41,122, 56, 2, 41,114, + 41,118, 49,128, 6,106, 56,128, 6, 12, 57, 8, 41,140, 41,144, + 41,148, 41,152, 41,156, 41,160, 41,164, 41,168, 50,128, 6, 96, + 51,128, 6, 97, 52,128, 6, 98, 53,128, 6, 99, 54,128, 6,100, + 55,128, 6,101, 56,128, 6,102, 57,128, 6,103, 52, 7, 41,188, + 41,220, 42, 26, 42, 88, 42,120, 42,176, 42,232, 48, 5, 41,200, + 41,204, 41,208, 41,212, 41,216, 48,128, 6,104, 49,128, 6,105, + 51,128, 6, 27, 55,128, 6, 31, 57,128, 6, 33, 49, 10, 41,242, + 41,246, 41,250, 41,254, 42, 2, 42, 6, 42, 10, 42, 14, 42, 18, + 42, 22, 48,128, 6, 34, 49,128, 6, 35, 50,128, 6, 36, 51,128, + 6, 37, 52,128, 6, 38, 53,128, 6, 39, 54,128, 6, 40, 55,128, + 6, 41, 56,128, 6, 42, 57,128, 6, 43, 50, 10, 42, 48, 42, 52, + 42, 56, 42, 60, 42, 64, 42, 68, 42, 72, 42, 76, 42, 80, 42, 84, + 48,128, 6, 44, 49,128, 6, 45, 50,128, 6, 46, 51,128, 6, 47, + 52,128, 6, 48, 53,128, 6, 49, 54,128, 6, 50, 55,128, 6, 51, + 56,128, 6, 52, 57,128, 6, 53, 51, 5, 42,100, 42,104, 42,108, + 42,112, 42,116, 48,128, 6, 54, 49,128, 6, 55, 50,128, 6, 56, + 51,128, 6, 57, 52,128, 6, 58, 52, 9, 42,140, 42,144, 42,148, + 42,152, 42,156, 42,160, 42,164, 42,168, 42,172, 48,128, 6, 64, + 49,128, 6, 65, 50,128, 6, 66, 51,128, 6, 67, 52,128, 6, 68, + 53,128, 6, 69, 54,128, 6, 70, 56,128, 6, 72, 57,128, 6, 73, + 53, 9, 42,196, 42,200, 42,204, 42,208, 42,212, 42,216, 42,220, + 42,224, 42,228, 48,128, 6, 74, 49,128, 6, 75, 50,128, 6, 76, + 51,128, 6, 77, 52,128, 6, 78, 53,128, 6, 79, 54,128, 6, 80, + 55,128, 6, 81, 56,128, 6, 82,183, 48,128, 6, 71, 53, 3, 42, + 245, 43, 21, 43, 53, 48, 5, 43, 1, 43, 5, 43, 9, 43, 13, 43, + 17, 53,128, 6,164, 54,128, 6,126, 55,128, 6,134, 56,128, 6, + 152, 57,128, 6,175, 49, 5, 43, 33, 43, 37, 43, 41, 43, 45, 43, + 49, 49,128, 6,121, 50,128, 6,136, 51,128, 6,145, 52,128, 6, + 186, 57,128, 6,210,179, 52,128, 6,213, 54, 7, 43, 74, 43, 79, + 43, 84, 43, 89, 43,127, 43,189, 43,251,179, 54,128, 32,170,180, + 53,128, 5,190,181, 56,128, 5,195, 54, 6, 43,103, 43,107, 43, + 111, 43,115, 43,119, 43,123, 52,128, 5,208, 53,128, 5,209, 54, + 128, 5,210, 55,128, 5,211, 56,128, 5,212, 57,128, 5,213, 55, + 10, 43,149, 43,153, 43,157, 43,161, 43,165, 43,169, 43,173, 43, + 177, 43,181, 43,185, 48,128, 5,214, 49,128, 5,215, 50,128, 5, + 216, 51,128, 5,217, 52,128, 5,218, 53,128, 5,219, 54,128, 5, + 220, 55,128, 5,221, 56,128, 5,222, 57,128, 5,223, 56, 10, 43, + 211, 43,215, 43,219, 43,223, 43,227, 43,231, 43,235, 43,239, 43, + 243, 43,247, 48,128, 5,224, 49,128, 5,225, 50,128, 5,226, 51, + 128, 5,227, 52,128, 5,228, 53,128, 5,229, 54,128, 5,230, 55, + 128, 5,231, 56,128, 5,232, 57,128, 5,233, 57, 3, 44, 3, 44, + 7, 44, 11, 48,128, 5,234, 52,128,251, 42, 53,128,251, 43, 55, + 4, 44, 25, 44, 39, 44, 59, 44, 64, 48, 2, 44, 31, 44, 35, 48, + 128,251, 75, 53,128,251, 31, 49, 3, 44, 47, 44, 51, 44, 55, 54, + 128, 5,240, 55,128, 5,241, 56,128, 5,242,178, 51,128,251, 53, + 57, 7, 44, 80, 44, 84, 44, 88, 44, 92, 44, 96, 44,100, 44,104, + 51,128, 5,180, 52,128, 5,181, 53,128, 5,182, 54,128, 5,187, + 55,128, 5,184, 56,128, 5,183, 57,128, 5,176, 56, 3, 44,116, + 44,160, 44,165, 48, 7, 44,132, 44,136, 44,140, 44,144, 44,148, + 44,152, 44,156, 48,128, 5,178, 49,128, 5,177, 50,128, 5,179, + 51,128, 5,194, 52,128, 5,193, 54,128, 5,185, 55,128, 5,188, + 179, 57,128, 5,189, 52, 2, 44,171, 44,175, 49,128, 5,191, 50, + 128, 5,192,185,178, 57,128, 2,188, 54, 3, 44,193, 44,252, 45, + 3, 49, 4, 44,203, 44,219, 44,225, 44,246, 50, 2, 44,209, 44, + 214,180, 56,128, 33, 5,184, 57,128, 33, 19,179,181, 50,128, 33, + 22,181, 55, 3, 44,234, 44,238, 44,242, 51,128, 32, 44, 52,128, + 32, 45, 53,128, 32, 46,182,182, 52,128, 32, 12,179,177,182, 55, + 128, 6,109,180,185,179, 55,128, 2,189,103, 2, 45, 16, 45, 23, + 242,225,246,101,128, 0,224,117, 2, 45, 29, 45, 38,234,225,242, + 225,244,105,128, 10,133,242,237,245,235,232,105,128, 10, 5,104, + 2, 45, 53, 45, 63,233,242,225,231,225,238, 97,128, 48, 66,239, + 239,235,225,226,239,246,101,128, 30,163,105, 7, 45, 90, 45,115, + 45,122, 45,134, 45,159, 45,175, 45,255, 98, 2, 45, 96, 45,105, + 229,238,231,225,236,105,128, 9,144,239,240,239,237,239,230,111, + 128, 49, 30,228,229,246, 97,128, 9, 16,229,227,249,242,233,236, + 236,233, 99,128, 4,213,231,117, 2, 45,141, 45,150,234,225,242, + 225,244,105,128, 10,144,242,237,245,235,232,105,128, 10, 16,237, + 225,244,242,225,231,245,242,237,245,235,232,105,128, 10, 72,110, + 5, 45,187, 45,196, 45,210, 45,226, 45,241,225,242,225,226,233, + 99,128, 6, 57,230,233,238,225,236,225,242,225,226,233, 99,128, + 254,202,233,238,233,244,233,225,236,225,242,225,226,233, 99,128, + 254,203,237,229,228,233,225,236,225,242,225,226,233, 99,128,254, + 204,246,229,242,244,229,228,226,242,229,246,101,128, 2, 3,246, + 239,247,229,236,243,233,231,110, 3, 46, 15, 46, 25, 46, 32,226, + 229,238,231,225,236,105,128, 9,200,228,229,246, 97,128, 9, 72, + 231,245,234,225,242,225,244,105,128, 10,200,107, 2, 46, 49, 46, + 73,225,244,225,235,225,238, 97,129, 48,162, 46, 61,232,225,236, + 230,247,233,228,244,104,128,255,113,239,242,229,225,110,128, 49, + 79,108, 3, 46, 89, 47,145, 47,154,101, 2, 46, 95, 47,140,102, + 136, 5,208, 46,115, 46,124, 46,139, 46,153, 46,242, 47, 0, 47, + 111, 47,125,225,242,225,226,233, 99,128, 6, 39,228,225,231,229, + 243,232,232,229,226,242,229,119,128,251, 48,230,233,238,225,236, + 225,242,225,226,233, 99,128,254,142,104, 2, 46,159, 46,234,225, + 237,250, 97, 2, 46,168, 46,201,225,226,239,246,101, 2, 46,178, + 46,187,225,242,225,226,233, 99,128, 6, 35,230,233,238,225,236, + 225,242,225,226,233, 99,128,254,132,226,229,236,239,119, 2, 46, + 211, 46,220,225,242,225,226,233, 99,128, 6, 37,230,233,238,225, + 236,225,242,225,226,233, 99,128,254,136,229,226,242,229,119,128, + 5,208,236,225,237,229,228,232,229,226,242,229,119,128,251, 79, + 237, 97, 2, 47, 7, 47, 43,228,228,225,225,226,239,246,101, 2, + 47, 20, 47, 29,225,242,225,226,233, 99,128, 6, 34,230,233,238, + 225,236,225,242,225,226,233, 99,128,254,130,235,243,245,242, 97, + 4, 47, 57, 47, 66, 47, 80, 47, 96,225,242,225,226,233, 99,128, + 6, 73,230,233,238,225,236,225,242,225,226,233, 99,128,254,240, + 233,238,233,244,233,225,236,225,242,225,226,233, 99,128,254,243, + 237,229,228,233,225,236,225,242,225,226,233, 99,128,254,244,240, + 225,244,225,232,232,229,226,242,229,119,128,251, 46,241,225,237, + 225,244,243,232,229,226,242,229,119,128,251, 47,240,104,128, 33, + 53,236,229,241,245,225,108,128, 34, 76,240,232, 97,129, 3,177, + 47,162,244,239,238,239,115,128, 3,172,109, 4, 47,180, 47,188, + 47,199, 47,233,225,227,242,239,110,128, 1, 1,239,238,239,243, + 240,225,227,101,128,255, 65,240,229,242,243,225,238,100,130, 0, + 38, 47,213, 47,225,237,239,238,239,243,240,225,227,101,128,255, + 6,243,237,225,236,108,128,247, 38,243,241,245,225,242,101,128, + 51,194,110, 4, 47,252, 48, 7, 48,129, 48,139,226,239,240,239, + 237,239,230,111,128, 49, 34,103, 4, 48, 17, 48, 28, 48, 42, 48, + 121,226,239,240,239,237,239,230,111,128, 49, 36,235,232,225,238, + 235,232,245,244,232,225,105,128, 14, 90,236,101,131, 34, 32, 48, + 53, 48,106, 48,113,226,242,225,227,235,229,116, 2, 48, 65, 48, + 85,236,229,230,116,129, 48, 8, 48, 74,246,229,242,244,233,227, + 225,108,128,254, 63,242,233,231,232,116,129, 48, 9, 48, 95,246, + 229,242,244,233,227,225,108,128,254, 64,236,229,230,116,128, 35, + 41,242,233,231,232,116,128, 35, 42,243,244,242,239,109,128, 33, + 43,239,244,229,236,229,233, 97,128, 3,135,117, 2, 48,145, 48, + 157,228,225,244,244,225,228,229,246, 97,128, 9, 82,243,246,225, + 242, 97, 3, 48,169, 48,179, 48,186,226,229,238,231,225,236,105, + 128, 9,130,228,229,246, 97,128, 9, 2,231,245,234,225,242,225, + 244,105,128, 10,130,239,231,239,238,229,107,128, 1, 5,112, 3, + 48,214, 48,238, 49, 12, 97, 2, 48,220, 48,232,225,244,239,243, + 241,245,225,242,101,128, 51, 0,242,229,110,128, 36,156,239,243, + 244,242,239,240,232,101, 2, 48,251, 49, 6,225,242,237,229,238, + 233,225,110,128, 5, 90,237,239,100,128, 2,188,112, 2, 49, 18, + 49, 23,236,101,128,248,255,242,111, 2, 49, 30, 49, 38,225,227, + 232,229,115,128, 34, 80,120, 2, 49, 44, 49, 64,229,241,245,225, + 108,129, 34, 72, 49, 54,239,242,233,237,225,231,101,128, 34, 82, + 233,237,225,244,229,236,249,229,241,245,225,108,128, 34, 69,114, + 4, 49, 89, 49,116, 49,120, 49,165,225,229, 97, 2, 49, 97, 49, + 107,229,235,239,242,229,225,110,128, 49,142,235,239,242,229,225, + 110,128, 49,141, 99,128, 35, 18,105, 2, 49,126, 49,140,231,232, + 244,232,225,236,230,242,233,238,103,128, 30,154,238,103,130, 0, + 229, 49,149, 49,157,225,227,245,244,101,128, 1,251,226,229,236, + 239,119,128, 30, 1,242,239,119, 8, 49,185, 49,192, 50, 65, 50, + 131, 50,181, 50,236, 51, 3, 51, 78,226,239,244,104,128, 33,148, + 100, 3, 49,200, 49,239, 50, 30,225,243,104, 4, 49,212, 49,219, + 49,226, 49,234,228,239,247,110,128, 33,227,236,229,230,116,128, + 33,224,242,233,231,232,116,128, 33,226,245,112,128, 33,225,226, + 108, 5, 49,252, 50, 3, 50, 10, 50, 17, 50, 25,226,239,244,104, + 128, 33,212,228,239,247,110,128, 33,211,236,229,230,116,128, 33, + 208,242,233,231,232,116,128, 33,210,245,112,128, 33,209,239,247, + 110,131, 33,147, 50, 42, 50, 49, 50, 57,236,229,230,116,128, 33, + 153,242,233,231,232,116,128, 33,152,247,232,233,244,101,128, 33, + 233,104, 2, 50, 71, 50,122,229,225,100, 4, 50, 83, 50, 93, 50, + 103, 50,114,228,239,247,238,237,239,100,128, 2,197,236,229,230, + 244,237,239,100,128, 2,194,242,233,231,232,244,237,239,100,128, + 2,195,245,240,237,239,100,128, 2,196,239,242,233,250,229,120, + 128,248,231,236,229,230,116,131, 33,144, 50,144, 50,161, 50,173, + 228,226,108,129, 33,208, 50,152,243,244,242,239,235,101,128, 33, + 205,239,246,229,242,242,233,231,232,116,128, 33,198,247,232,233, + 244,101,128, 33,230,242,233,231,232,116,132, 33,146, 50,197, 50, + 209, 50,217, 50,228,228,226,236,243,244,242,239,235,101,128, 33, + 207,232,229,225,246,121,128, 39,158,239,246,229,242,236,229,230, + 116,128, 33,196,247,232,233,244,101,128, 33,232,244,225, 98, 2, + 50,244, 50,251,236,229,230,116,128, 33,228,242,233,231,232,116, + 128, 33,229,245,112,132, 33,145, 51, 16, 51, 44, 51, 62, 51, 70, + 100, 2, 51, 22, 51, 34,110,129, 33,149, 51, 28,226,243,101,128, + 33,168,239,247,238,226,225,243,101,128, 33,168,236,229,230,116, + 129, 33,150, 51, 53,239,230,228,239,247,110,128, 33,197,242,233, + 231,232,116,128, 33,151,247,232,233,244,101,128, 33,231,246,229, + 242,244,229,120,128,248,230,115, 5, 51, 99, 51,175, 51,220, 52, + 47, 52, 57, 99, 2, 51,105, 51,157,233,105, 2, 51,112, 51,135, + 227,233,242,227,245,109,129, 0, 94, 51,123,237,239,238,239,243, + 240,225,227,101,128,255, 62,244,233,236,228,101,129, 0,126, 51, + 145,237,239,238,239,243,240,225,227,101,128,255, 94,242,233,240, + 116,129, 2, 81, 51,166,244,245,242,238,229,100,128, 2, 82,237, + 225,236,108, 2, 51,184, 51,195,232,233,242,225,231,225,238, 97, + 128, 48, 65,235,225,244,225,235,225,238, 97,129, 48,161, 51,208, + 232,225,236,230,247,233,228,244,104,128,255,103,244,229,242,233, + 115, 2, 51,230, 52, 43,107,131, 0, 42, 51,240, 52, 12, 52, 35, + 97, 2, 51,246, 52, 4,236,244,239,238,229,225,242,225,226,233, + 99,128, 6,109,242,225,226,233, 99,128, 6,109,109, 2, 52, 18, + 52, 24,225,244,104,128, 34, 23,239,238,239,243,240,225,227,101, + 128,255, 10,243,237,225,236,108,128,254, 97,109,128, 32, 66,245, + 240,229,242,233,239,114,128,246,233,249,237,240,244,239,244,233, + 227,225,236,236,249,229,241,245,225,108,128, 34, 67,116,132, 0, + 64, 52, 89, 52, 96, 52,108, 52,116,233,236,228,101,128, 0,227, + 237,239,238,239,243,240,225,227,101,128,255, 32,243,237,225,236, + 108,128,254,107,245,242,238,229,100,128, 2, 80,117, 6, 52,138, + 52,163, 52,170, 52,195, 52,215, 52,231, 98, 2, 52,144, 52,153, + 229,238,231,225,236,105,128, 9,148,239,240,239,237,239,230,111, + 128, 49, 32,228,229,246, 97,128, 9, 20,231,117, 2, 52,177, 52, + 186,234,225,242,225,244,105,128, 10,148,242,237,245,235,232,105, + 128, 10, 20,236,229,238,231,244,232,237,225,242,235,226,229,238, + 231,225,236,105,128, 9,215,237,225,244,242,225,231,245,242,237, + 245,235,232,105,128, 10, 76,246,239,247,229,236,243,233,231,110, + 3, 52,247, 53, 1, 53, 8,226,229,238,231,225,236,105,128, 9, + 204,228,229,246, 97,128, 9, 76,231,245,234,225,242,225,244,105, + 128, 10,204,246,225,231,242,225,232,225,228,229,246, 97,128, 9, + 61,121, 2, 53, 39, 53, 51,226,225,242,237,229,238,233,225,110, + 128, 5, 97,233,110,130, 5,226, 53, 60, 53, 75,225,236,244,239, + 238,229,232,229,226,242,229,119,128,251, 32,232,229,226,242,229, + 119,128, 5,226, 98,144, 0, 98, 53,120, 53,255, 54, 10, 54, 19, + 54, 44, 55, 85, 55,147, 55,220, 57,146, 57,158, 57,201, 57,209, + 57,219, 59, 89, 59,113, 59,122, 97, 7, 53,136, 53,146, 53,170, + 53,177, 53,202, 53,226, 53,237,226,229,238,231,225,236,105,128, + 9,172,227,235,243,236,225,243,104,129, 0, 92, 53,158,237,239, + 238,239,243,240,225,227,101,128,255, 60,228,229,246, 97,128, 9, + 44,231,117, 2, 53,184, 53,193,234,225,242,225,244,105,128, 10, + 172,242,237,245,235,232,105,128, 10, 44,104, 2, 53,208, 53,218, + 233,242,225,231,225,238, 97,128, 48,112,244,244,232,225,105,128, + 14, 63,235,225,244,225,235,225,238, 97,128, 48,208,114,129, 0, + 124, 53,243,237,239,238,239,243,240,225,227,101,128,255, 92,226, + 239,240,239,237,239,230,111,128, 49, 5,227,233,242,227,236,101, + 128, 36,209,228,239,116, 2, 54, 27, 54, 36,225,227,227,229,238, + 116,128, 30, 3,226,229,236,239,119,128, 30, 5,101, 6, 54, 58, + 54, 79, 54,102, 54,244, 54,255, 55, 11,225,237,229,228,243,233, + 248,244,229,229,238,244,232,238,239,244,229,115,128, 38,108, 99, + 2, 54, 85, 54, 92,225,245,243,101,128, 34, 53,249,242,233,236, + 236,233, 99,128, 4, 49,104, 5, 54,114, 54,123, 54,137, 54,167, + 54,226,225,242,225,226,233, 99,128, 6, 40,230,233,238,225,236, + 225,242,225,226,233, 99,128,254,144,105, 2, 54,143, 54,158,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,254,145,242,225, + 231,225,238, 97,128, 48,121,237,101, 2, 54,174, 54,187,228,233, + 225,236,225,242,225,226,233, 99,128,254,146,229,237,105, 2, 54, + 195, 54,210,238,233,244,233,225,236,225,242,225,226,233, 99,128, + 252,159,243,239,236,225,244,229,228,225,242,225,226,233, 99,128, + 252, 8,238,239,239,238,230,233,238,225,236,225,242,225,226,233, + 99,128,252,109,235,225,244,225,235,225,238, 97,128, 48,217,238, + 225,242,237,229,238,233,225,110,128, 5, 98,116,132, 5,209, 55, + 23, 55, 43, 55, 63, 55, 72, 97,129, 3,178, 55, 29,243,249,237, + 226,239,236,231,242,229,229,107,128, 3,208,228,225,231,229,243, + 104,129,251, 49, 55, 54,232,229,226,242,229,119,128,251, 49,232, + 229,226,242,229,119,128, 5,209,242,225,230,229,232,229,226,242, + 229,119,128,251, 76,104, 2, 55, 91, 55,141, 97, 3, 55, 99, 55, + 109, 55,116,226,229,238,231,225,236,105,128, 9,173,228,229,246, + 97,128, 9, 45,231,117, 2, 55,123, 55,132,234,225,242,225,244, + 105,128, 10,173,242,237,245,235,232,105,128, 10, 45,239,239,107, + 128, 2, 83,105, 5, 55,159, 55,170, 55,181, 55,195, 55,209,232, + 233,242,225,231,225,238, 97,128, 48,115,235,225,244,225,235,225, + 238, 97,128, 48,211,236,225,226,233,225,236,227,236,233,227,107, + 128, 2,152,238,228,233,231,245,242,237,245,235,232,105,128, 10, + 2,242,245,243,241,245,225,242,101,128, 51, 49,108, 3, 55,228, + 57,129, 57,140, 97, 2, 55,234, 57,124,227,107, 6, 55,249, 56, + 2, 56, 39, 56,188, 56,243, 57, 39,227,233,242,227,236,101,128, + 37,207,100, 2, 56, 8, 56, 17,233,225,237,239,238,100,128, 37, + 198,239,247,238,240,239,233,238,244,233,238,231,244,242,233,225, + 238,231,236,101,128, 37,188,108, 2, 56, 45, 56,148,101, 2, 56, + 51, 56, 87,230,244,240,239,233,238,244,233,238,103, 2, 56, 66, + 56, 76,240,239,233,238,244,229,114,128, 37,196,244,242,233,225, + 238,231,236,101,128, 37,192,238,244,233,227,245,236,225,242,226, + 242,225,227,235,229,116, 2, 56,107, 56,127,236,229,230,116,129, + 48, 16, 56,116,246,229,242,244,233,227,225,108,128,254, 59,242, + 233,231,232,116,129, 48, 17, 56,137,246,229,242,244,233,227,225, + 108,128,254, 60,239,247,229,114, 2, 56,157, 56,172,236,229,230, + 244,244,242,233,225,238,231,236,101,128, 37,227,242,233,231,232, + 244,244,242,233,225,238,231,236,101,128, 37,226,114, 2, 56,194, + 56,205,229,227,244,225,238,231,236,101,128, 37,172,233,231,232, + 244,240,239,233,238,244,233,238,103, 2, 56,222, 56,232,240,239, + 233,238,244,229,114,128, 37,186,244,242,233,225,238,231,236,101, + 128, 37,182,115, 3, 56,251, 57, 25, 57, 33,109, 2, 57, 1, 57, + 13,225,236,236,243,241,245,225,242,101,128, 37,170,233,236,233, + 238,231,230,225,227,101,128, 38, 59,241,245,225,242,101,128, 37, + 160,244,225,114,128, 38, 5,245,240,112, 2, 57, 47, 57, 85,229, + 114, 2, 57, 54, 57, 69,236,229,230,244,244,242,233,225,238,231, + 236,101,128, 37,228,242,233,231,232,244,244,242,233,225,238,231, + 236,101,128, 37,229,239,233,238,244,233,238,103, 2, 57, 97, 57, + 113,243,237,225,236,236,244,242,233,225,238,231,236,101,128, 37, + 180,244,242,233,225,238,231,236,101,128, 37,178,238,107,128, 36, + 35,233,238,229,226,229,236,239,119,128, 30, 7,239,227,107,128, + 37,136,237,239,238,239,243,240,225,227,101,128,255, 66,111, 3, + 57,166, 57,179, 57,190,226,225,233,237,225,233,244,232,225,105, + 128, 14, 26,232,233,242,225,231,225,238, 97,128, 48,124,235,225, + 244,225,235,225,238, 97,128, 48,220,240,225,242,229,110,128, 36, + 157,241,243,241,245,225,242,101,128, 51,195,114, 4, 57,229, 58, + 223, 59, 40, 59, 79,225, 99, 2, 57,236, 58,130,101, 3, 57,244, + 57,249, 58, 61,229,120,128,248,244,236,229,230,116,133, 0,123, + 58, 10, 58, 15, 58, 37, 58, 45, 58, 50,226,116,128,248,243,109, + 2, 58, 21, 58, 26,233,100,128,248,242,239,238,239,243,240,225, + 227,101,128,255, 91,243,237,225,236,108,128,254, 91,244,112,128, + 248,241,246,229,242,244,233,227,225,108,128,254, 55,242,233,231, + 232,116,133, 0,125, 58, 79, 58, 84, 58,106, 58,114, 58,119,226, + 116,128,248,254,109, 2, 58, 90, 58, 95,233,100,128,248,253,239, + 238,239,243,240,225,227,101,128,255, 93,243,237,225,236,108,128, + 254, 92,244,112,128,248,252,246,229,242,244,233,227,225,108,128, + 254, 56,235,229,116, 2, 58,138, 58,180,236,229,230,116,132, 0, + 91, 58,153, 58,158, 58,163, 58,175,226,116,128,248,240,229,120, + 128,248,239,237,239,238,239,243,240,225,227,101,128,255, 59,244, + 112,128,248,238,242,233,231,232,116,132, 0, 93, 58,196, 58,201, + 58,206, 58,218,226,116,128,248,251,229,120,128,248,250,237,239, + 238,239,243,240,225,227,101,128,255, 61,244,112,128,248,249,229, + 246,101,131, 2,216, 58,235, 58,246, 58,252,226,229,236,239,247, + 227,237, 98,128, 3, 46,227,237, 98,128, 3, 6,233,238,246,229, + 242,244,229,100, 3, 59, 11, 59, 22, 59, 28,226,229,236,239,247, + 227,237, 98,128, 3, 47,227,237, 98,128, 3, 17,228,239,245,226, + 236,229,227,237, 98,128, 3, 97,233,228,231,101, 2, 59, 49, 59, + 60,226,229,236,239,247,227,237, 98,128, 3, 42,233,238,246,229, + 242,244,229,228,226,229,236,239,247,227,237, 98,128, 3, 58,239, + 235,229,238,226,225,114,128, 0,166,115, 2, 59, 95, 59,103,244, + 242,239,235,101,128, 1,128,245,240,229,242,233,239,114,128,246, + 234,244,239,240,226,225,114,128, 1,131,117, 3, 59,130, 59,141, + 59,152,232,233,242,225,231,225,238, 97,128, 48,118,235,225,244, + 225,235,225,238, 97,128, 48,214,236,108, 2, 59,159, 59,189,229, + 116,130, 32, 34, 59,168, 59,178,233,238,246,229,242,243,101,128, + 37,216,239,240,229,242,225,244,239,114,128, 34, 25,243,229,249, + 101,128, 37,206, 99,143, 0, 99, 59,230, 60,179, 60,190, 60,254, + 61, 29, 61,122, 63, 33, 64, 17, 64,117, 64,166, 67,158, 67,166, + 67,176, 67,188, 67,221, 97, 9, 59,250, 60, 5, 60, 15, 60, 22, + 60, 29, 60, 54, 60, 64, 60,116, 60,125,225,242,237,229,238,233, + 225,110,128, 5,110,226,229,238,231,225,236,105,128, 9,154,227, + 245,244,101,128, 1, 7,228,229,246, 97,128, 9, 26,231,117, 2, + 60, 36, 60, 45,234,225,242,225,244,105,128, 10,154,242,237,245, + 235,232,105,128, 10, 26,236,243,241,245,225,242,101,128, 51,136, + 238,228,242,225,226,233,238,228,117, 4, 60, 82, 60, 92, 60, 98, + 60,105,226,229,238,231,225,236,105,128, 9,129,227,237, 98,128, + 3, 16,228,229,246, 97,128, 9, 1,231,245,234,225,242,225,244, + 105,128, 10,129,240,243,236,239,227,107,128, 33,234,114, 3, 60, + 133, 60,139, 60,165,229,239,102,128, 33, 5,239,110,130, 2,199, + 60,148, 60,159,226,229,236,239,247,227,237, 98,128, 3, 44,227, + 237, 98,128, 3, 12,242,233,225,231,229,242,229,244,245,242,110, + 128, 33,181,226,239,240,239,237,239,230,111,128, 49, 24, 99, 4, + 60,200, 60,207, 60,226, 60,248,225,242,239,110,128, 1, 13,229, + 228,233,236,236, 97,129, 0,231, 60,218,225,227,245,244,101,128, + 30, 9,233,242, 99, 2, 60,234, 60,239,236,101,128, 36,210,245, + 237,230,236,229,120,128, 1, 9,245,242,108,128, 2, 85,100, 2, + 61, 4, 61, 20,239,116,129, 1, 11, 61, 11,225,227,227,229,238, + 116,128, 1, 11,243,241,245,225,242,101,128, 51,197,101, 2, 61, + 35, 61, 51,228,233,236,236, 97,129, 0,184, 61, 45,227,237, 98, + 128, 3, 39,238,116,132, 0,162, 61, 64, 61, 88, 61,100, 61,111, + 105, 2, 61, 70, 61, 78,231,242,225,228,101,128, 33, 3,238,230, + 229,242,233,239,114,128,246,223,237,239,238,239,243,240,225,227, + 101,128,255,224,239,236,228,243,244,249,236,101,128,247,162,243, + 245,240,229,242,233,239,114,128,246,224,104, 5, 61,134, 61,197, + 61,208, 62,136, 62,228, 97, 4, 61,144, 61,155, 61,165, 61,172, + 225,242,237,229,238,233,225,110,128, 5,121,226,229,238,231,225, + 236,105,128, 9,155,228,229,246, 97,128, 9, 27,231,117, 2, 61, + 179, 61,188,234,225,242,225,244,105,128, 10,155,242,237,245,235, + 232,105,128, 10, 27,226,239,240,239,237,239,230,111,128, 49, 20, + 101, 6, 61,222, 61,242, 62, 10, 62, 78, 62, 90, 62,111,225,226, + 235,232,225,243,233,225,238,227,249,242,233,236,236,233, 99,128, + 4,189, 99, 2, 61,248, 62, 0,235,237,225,242,107,128, 39, 19, + 249,242,233,236,236,233, 99,128, 4, 71,100, 2, 62, 16, 62, 60, + 229,243,227,229,238,228,229,114, 2, 62, 29, 62, 49,225,226,235, + 232,225,243,233,225,238,227,249,242,233,236,236,233, 99,128, 4, + 191,227,249,242,233,236,236,233, 99,128, 4,183,233,229,242,229, + 243,233,243,227,249,242,233,236,236,233, 99,128, 4,245,232,225, + 242,237,229,238,233,225,110,128, 5,115,235,232,225,235,225,243, + 243,233,225,238,227,249,242,233,236,236,233, 99,128, 4,204,246, + 229,242,244,233,227,225,236,243,244,242,239,235,229,227,249,242, + 233,236,236,233, 99,128, 4,185,105,129, 3,199, 62,142,229,245, + 227,104, 4, 62,155, 62,190, 62,205, 62,214, 97, 2, 62,161, 62, + 176,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,119, + 240,225,242,229,238,235,239,242,229,225,110,128, 50, 23,227,233, + 242,227,236,229,235,239,242,229,225,110,128, 50,105,235,239,242, + 229,225,110,128, 49, 74,240,225,242,229,238,235,239,242,229,225, + 110,128, 50, 9,111, 2, 62,234, 63, 28,227,104, 3, 62,243, 63, + 9, 63, 19,225,110, 2, 62,250, 63, 2,231,244,232,225,105,128, + 14, 10,244,232,225,105,128, 14, 8,233,238,231,244,232,225,105, + 128, 14, 9,239,229,244,232,225,105,128, 14, 12,239,107,128, 1, + 136,105, 2, 63, 39, 63,141,229,245, 99, 5, 63, 53, 63, 88, 63, + 103, 63,112, 63,126, 97, 2, 63, 59, 63, 74,227,233,242,227,236, + 229,235,239,242,229,225,110,128, 50,118,240,225,242,229,238,235, + 239,242,229,225,110,128, 50, 22,227,233,242,227,236,229,235,239, + 242,229,225,110,128, 50,104,235,239,242,229,225,110,128, 49, 72, + 240,225,242,229,238,235,239,242,229,225,110,128, 50, 8,245,240, + 225,242,229,238,235,239,242,229,225,110,128, 50, 28,242, 99, 2, + 63,148, 63,243,236,101,132, 37,203, 63,161, 63,172, 63,177, 63, + 201,237,245,236,244,233,240,236,121,128, 34,151,239,116,128, 34, + 153,112, 2, 63,183, 63,189,236,245,115,128, 34,149,239,243,244, + 225,236,237,225,242,107,128, 48, 54,247,233,244,104, 2, 63,210, + 63,226,236,229,230,244,232,225,236,230,226,236,225,227,107,128, + 37,208,242,233,231,232,244,232,225,236,230,226,236,225,227,107, + 128, 37,209,245,237,230,236,229,120,130, 2,198, 64, 0, 64, 11, + 226,229,236,239,247,227,237, 98,128, 3, 45,227,237, 98,128, 3, + 2,108, 3, 64, 25, 64, 31, 64, 85,229,225,114,128, 35, 39,233, + 227,107, 4, 64, 43, 64, 54, 64, 63, 64, 73,225,236,246,229,239, + 236,225,114,128, 1,194,228,229,238,244,225,108,128, 1,192,236, + 225,244,229,242,225,108,128, 1,193,242,229,244,242,239,230,236, + 229,120,128, 1,195,245, 98,129, 38, 99, 64, 92,243,245,233,116, + 2, 64,101, 64,109,226,236,225,227,107,128, 38, 99,247,232,233, + 244,101,128, 38,103,109, 3, 64,125, 64,139, 64,150,227,245,226, + 229,228,243,241,245,225,242,101,128, 51,164,239,238,239,243,240, + 225,227,101,128,255, 67,243,241,245,225,242,229,228,243,241,245, + 225,242,101,128, 51,160,111, 8, 64,184, 64,195, 65, 26, 65,224, + 66,253, 67, 28, 67,135, 67,144,225,242,237,229,238,233,225,110, + 128, 5,129,236,239,110,131, 0, 58, 64,207, 64,232, 64,251,237, + 239,110, 2, 64,215, 64,223,229,244,225,242,121,128, 32,161,239, + 243,240,225,227,101,128,255, 26,115, 2, 64,238, 64,244,233,231, + 110,128, 32,161,237,225,236,108,128,254, 85,244,242,233,225,238, + 231,245,236,225,114, 2, 65, 10, 65, 20,232,225,236,230,237,239, + 100,128, 2,209,237,239,100,128, 2,208,109, 2, 65, 32, 65,217, + 237, 97,134, 0, 44, 65, 49, 65,113, 65,124, 65,136, 65,166, 65, + 189, 97, 3, 65, 57, 65, 83, 65, 91,226,239,246,101, 2, 65, 66, + 65, 72,227,237, 98,128, 3, 19,242,233,231,232,244,227,237, 98, + 128, 3, 21,227,227,229,238,116,128,246,195,114, 2, 65, 97, 65, + 104,225,226,233, 99,128, 6, 12,237,229,238,233,225,110,128, 5, + 93,233,238,230,229,242,233,239,114,128,246,225,237,239,238,239, + 243,240,225,227,101,128,255, 12,242,229,246,229,242,243,229,100, + 2, 65,149, 65,160,225,226,239,246,229,227,237, 98,128, 3, 20, + 237,239,100,128, 2,189,115, 2, 65,172, 65,179,237,225,236,108, + 128,254, 80,245,240,229,242,233,239,114,128,246,226,244,245,242, + 238,229,100, 2, 65,200, 65,211,225,226,239,246,229,227,237, 98, + 128, 3, 18,237,239,100,128, 2,187,240,225,243,115,128, 38, 60, + 110, 2, 65,230, 65,239,231,242,245,229,238,116,128, 34, 69,116, + 2, 65,245, 66, 3,239,245,242,233,238,244,229,231,242,225,108, + 128, 34, 46,242,239,108,142, 35, 3, 66, 37, 66, 43, 66, 58, 66, + 73, 66,117, 66,162, 66,176, 66,181, 66,186, 66,191, 66,197, 66, + 202, 66,243, 66,248,193,195, 75,128, 0, 6, 66, 2, 66, 49, 66, + 54,197, 76,128, 0, 7, 83,128, 0, 8, 67, 2, 66, 64, 66, 69, + 193, 78,128, 0, 24, 82,128, 0, 13, 68, 3, 66, 81, 66,107, 66, + 112, 67, 4, 66, 91, 66, 95, 66, 99, 66,103, 49,128, 0, 17, 50, + 128, 0, 18, 51,128, 0, 19, 52,128, 0, 20,197, 76,128, 0,127, + 204, 69,128, 0, 16, 69, 5, 66,129, 66,133, 66,138, 66,143, 66, + 148, 77,128, 0, 25,206, 81,128, 0, 5,207, 84,128, 0, 4,211, + 67,128, 0, 27, 84, 2, 66,154, 66,158, 66,128, 0, 23, 88,128, + 0, 3, 70, 2, 66,168, 66,172, 70,128, 0, 12, 83,128, 0, 28, + 199, 83,128, 0, 29,200, 84,128, 0, 9,204, 70,128, 0, 10,206, + 193, 75,128, 0, 21,210, 83,128, 0, 30, 83, 5, 66,214, 66,218, + 66,228, 66,233, 66,238, 73,128, 0, 15, 79,129, 0, 14, 66,224, + 84,128, 0, 2,212, 88,128, 0, 1,213, 66,128, 0, 26,217, 78, + 128, 0, 22,213, 83,128, 0, 31,214, 84,128, 0, 11,240,249,242, + 233,231,232,116,129, 0,169, 67, 9,115, 2, 67, 15, 67, 21,225, + 238,115,128,248,233,229,242,233,102,128,246,217,114, 2, 67, 34, + 67,118,238,229,242,226,242,225,227,235,229,116, 2, 67, 49, 67, + 83,236,229,230,116,130, 48, 12, 67, 60, 67, 72,232,225,236,230, + 247,233,228,244,104,128,255, 98,246,229,242,244,233,227,225,108, + 128,254, 65,242,233,231,232,116,130, 48, 13, 67, 95, 67,107,232, + 225,236,230,247,233,228,244,104,128,255, 99,246,229,242,244,233, + 227,225,108,128,254, 66,240,239,242,225,244,233,239,238,243,241, + 245,225,242,101,128, 51,127,243,241,245,225,242,101,128, 51,199, + 246,229,242,235,231,243,241,245,225,242,101,128, 51,198,240,225, + 242,229,110,128, 36,158,242,245,250,229,233,242,111,128, 32,162, + 243,244,242,229,244,227,232,229,100,128, 2,151,245,114, 2, 67, + 195, 67,213,236,121, 2, 67,202, 67,208,225,238,100,128, 34,207, + 239,114,128, 34,206,242,229,238,227,121,128, 0,164,249,114, 4, + 67,232, 67,240, 67,247, 67,255,194,242,229,246,101,128,246,209, + 198,236,229,120,128,246,210,226,242,229,246,101,128,246,212,230, + 236,229,120,128,246,213,100,146, 0,100, 68, 46, 69,184, 70,208, + 71, 12, 71,188, 72,142, 72,204, 73,133, 73,146, 73,155, 73,181, + 73,206, 73,215, 75, 26, 75, 34, 75, 45, 75, 65, 75, 93, 97, 11, + 68, 70, 68, 81, 68, 91, 68,163, 68,226, 68,237, 68,248, 69, 61, + 69,123, 69,129, 69,159,225,242,237,229,238,233,225,110,128, 5, + 100,226,229,238,231,225,236,105,128, 9,166,100, 5, 68,103, 68, + 112, 68,118, 68,132, 68,148,225,242,225,226,233, 99,128, 6, 54, + 229,246, 97,128, 9, 38,230,233,238,225,236,225,242,225,226,233, + 99,128,254,190,233,238,233,244,233,225,236,225,242,225,226,233, + 99,128,254,191,237,229,228,233,225,236,225,242,225,226,233, 99, + 128,254,192,103, 3, 68,171, 68,188, 68,202,229,243,104,129, 5, + 188, 68,179,232,229,226,242,229,119,128, 5,188,231,229,114,129, + 32, 32, 68,196,228,226,108,128, 32, 33,117, 2, 68,208, 68,217, + 234,225,242,225,244,105,128, 10,166,242,237,245,235,232,105,128, + 10, 38,232,233,242,225,231,225,238, 97,128, 48, 96,235,225,244, + 225,235,225,238, 97,128, 48,192,108, 3, 69, 0, 69, 9, 69, 47, + 225,242,225,226,233, 99,128, 6, 47,229,116,130, 5,211, 69, 18, + 69, 38,228,225,231,229,243,104,129,251, 51, 69, 29,232,229,226, + 242,229,119,128,251, 51,232,229,226,242,229,119,128, 5,211,230, + 233,238,225,236,225,242,225,226,233, 99,128,254,170,237,237, 97, + 3, 69, 71, 69, 80, 69, 92,225,242,225,226,233, 99,128, 6, 79, + 236,239,247,225,242,225,226,233, 99,128, 6, 79,244,225,238, 97, + 2, 69,101, 69,115,236,244,239,238,229,225,242,225,226,233, 99, + 128, 6, 76,242,225,226,233, 99,128, 6, 76,238,228, 97,128, 9, + 100,242,231, 97, 2, 69,137, 69,146,232,229,226,242,229,119,128, + 5,167,236,229,230,244,232,229,226,242,229,119,128, 5,167,243, + 233,225,240,238,229,245,237,225,244,225,227,249,242,233,236,236, + 233,227,227,237, 98,128, 4,133, 98, 3, 69,192, 70,189, 70,199, + 108, 9, 69,212, 69,220, 70, 77, 70, 85, 70,101, 70,112, 70,130, + 70,144, 70,155,199,242,225,246,101,128,246,211, 97, 2, 69,226, + 70, 27,238,231,236,229,226,242,225,227,235,229,116, 2, 69,242, + 70, 6,236,229,230,116,129, 48, 10, 69,251,246,229,242,244,233, + 227,225,108,128,254, 61,242,233,231,232,116,129, 48, 11, 70, 16, + 246,229,242,244,233,227,225,108,128,254, 62,114, 2, 70, 33, 70, + 54,227,232,233,238,246,229,242,244,229,228,226,229,236,239,247, + 227,237, 98,128, 3, 43,242,239,119, 2, 70, 62, 70, 69,236,229, + 230,116,128, 33,212,242,233,231,232,116,128, 33,210,228,225,238, + 228, 97,128, 9,101,231,242,225,246,101,129,246,214, 70, 95,227, + 237, 98,128, 3, 15,233,238,244,229,231,242,225,108,128, 34, 44, + 236,239,247,236,233,238,101,129, 32, 23, 70,124,227,237, 98,128, + 3, 51,239,246,229,242,236,233,238,229,227,237, 98,128, 3, 63, + 240,242,233,237,229,237,239,100,128, 2,186,246,229,242,244,233, + 227,225,108, 2, 70,168, 70,174,226,225,114,128, 32, 22,236,233, + 238,229,225,226,239,246,229,227,237, 98,128, 3, 14,239,240,239, + 237,239,230,111,128, 49, 9,243,241,245,225,242,101,128, 51,200, + 99, 4, 70,218, 70,225, 70,234, 71, 5,225,242,239,110,128, 1, + 15,229,228,233,236,236, 97,128, 30, 17,233,242, 99, 2, 70,242, + 70,247,236,101,128, 36,211,245,237,230,236,229,248,226,229,236, + 239,119,128, 30, 19,242,239,225,116,128, 1, 17,100, 4, 71, 22, + 71,103, 71,113, 71,164, 97, 4, 71, 32, 71, 42, 71, 49, 71, 74, + 226,229,238,231,225,236,105,128, 9,161,228,229,246, 97,128, 9, + 33,231,117, 2, 71, 56, 71, 65,234,225,242,225,244,105,128, 10, + 161,242,237,245,235,232,105,128, 10, 33,108, 2, 71, 80, 71, 89, + 225,242,225,226,233, 99,128, 6,136,230,233,238,225,236,225,242, + 225,226,233, 99,128,251,137,228,232,225,228,229,246, 97,128, 9, + 92,232, 97, 3, 71,122, 71,132, 71,139,226,229,238,231,225,236, + 105,128, 9,162,228,229,246, 97,128, 9, 34,231,117, 2, 71,146, + 71,155,234,225,242,225,244,105,128, 10,162,242,237,245,235,232, + 105,128, 10, 34,239,116, 2, 71,171, 71,180,225,227,227,229,238, + 116,128, 30, 11,226,229,236,239,119,128, 30, 13,101, 8, 71,206, + 72, 3, 72, 10, 72, 35, 72, 45, 72, 56, 72,101, 72,137, 99, 2, + 71,212, 71,249,233,237,225,236,243,229,240,225,242,225,244,239, + 114, 2, 71,230, 71,239,225,242,225,226,233, 99,128, 6,107,240, + 229,242,243,233,225,110,128, 6,107,249,242,233,236,236,233, 99, + 128, 4, 52,231,242,229,101,128, 0,176,232,105, 2, 72, 17, 72, + 26,232,229,226,242,229,119,128, 5,173,242,225,231,225,238, 97, + 128, 48,103,233,227,239,240,244,233, 99,128, 3,239,235,225,244, + 225,235,225,238, 97,128, 48,199,108, 2, 72, 62, 72, 85,229,244, + 101, 2, 72, 70, 72, 77,236,229,230,116,128, 35, 43,242,233,231, + 232,116,128, 35, 38,244, 97,129, 3,180, 72, 92,244,245,242,238, + 229,100,128, 1,141,238,239,237,233,238,225,244,239,242,237,233, + 238,245,243,239,238,229,238,245,237,229,242,225,244,239,242,226, + 229,238,231,225,236,105,128, 9,248,250,104,128, 2,164,104, 2, + 72,148, 72,198, 97, 3, 72,156, 72,166, 72,173,226,229,238,231, + 225,236,105,128, 9,167,228,229,246, 97,128, 9, 39,231,117, 2, + 72,180, 72,189,234,225,242,225,244,105,128, 10,167,242,237,245, + 235,232,105,128, 10, 39,239,239,107,128, 2, 87,105, 6, 72,218, + 73, 11, 73, 71, 73, 82, 73, 93, 73,103, 97, 2, 72,224, 72,246, + 236,249,244,233,235,225,244,239,238,239,115,129, 3,133, 72,240, + 227,237, 98,128, 3, 68,237,239,238,100,129, 38,102, 72,255,243, + 245,233,244,247,232,233,244,101,128, 38, 98,229,242,229,243,233, + 115,133, 0,168, 73, 30, 73, 38, 73, 49, 73, 55, 73, 63,225,227, + 245,244,101,128,246,215,226,229,236,239,247,227,237, 98,128, 3, + 36,227,237, 98,128, 3, 8,231,242,225,246,101,128,246,216,244, + 239,238,239,115,128, 3,133,232,233,242,225,231,225,238, 97,128, + 48, 98,235,225,244,225,235,225,238, 97,128, 48,194,244,244,239, + 237,225,242,107,128, 48, 3,246,105, 2, 73,110, 73,121,228,101, + 129, 0,247, 73,117,115,128, 34, 35,243,233,239,238,243,236,225, + 243,104,128, 34, 21,234,229,227,249,242,233,236,236,233, 99,128, + 4, 82,235,243,232,225,228,101,128, 37,147,108, 2, 73,161, 73, + 172,233,238,229,226,229,236,239,119,128, 30, 15,243,241,245,225, + 242,101,128, 51,151,109, 2, 73,187, 73,195,225,227,242,239,110, + 128, 1, 17,239,238,239,243,240,225,227,101,128,255, 68,238,226, + 236,239,227,107,128, 37,132,111, 10, 73,237, 73,249, 74, 3, 74, + 14, 74, 25, 74, 97, 74,102, 74,113, 74,228, 74,254,227,232,225, + 228,225,244,232,225,105,128, 14, 14,228,229,235,244,232,225,105, + 128, 14, 20,232,233,242,225,231,225,238, 97,128, 48,105,235,225, + 244,225,235,225,238, 97,128, 48,201,236,236,225,114,132, 0, 36, + 74, 40, 74, 51, 74, 63, 74, 74,233,238,230,229,242,233,239,114, + 128,246,227,237,239,238,239,243,240,225,227,101,128,255, 4,239, + 236,228,243,244,249,236,101,128,247, 36,115, 2, 74, 80, 74, 87, + 237,225,236,108,128,254,105,245,240,229,242,233,239,114,128,246, + 228,238,103,128, 32,171,242,245,243,241,245,225,242,101,128, 51, + 38,116, 6, 74,127, 74,144, 74,166, 74,177, 74,209, 74,216,225, + 227,227,229,238,116,129, 2,217, 74,138,227,237, 98,128, 3, 7, + 226,229,236,239,247, 99, 2, 74,155, 74,160,237, 98,128, 3, 35, + 239,237, 98,128, 3, 35,235,225,244,225,235,225,238, 97,128, 48, + 251,236,229,243,115, 2, 74,186, 74,190,105,128, 1, 49,106,129, + 246,190, 74,196,243,244,242,239,235,229,232,239,239,107,128, 2, + 132,237,225,244,104,128, 34,197,244,229,228,227,233,242,227,236, + 101,128, 37,204,245,226,236,229,249,239,228,240,225,244,225,104, + 129,251, 31, 74,245,232,229,226,242,229,119,128,251, 31,247,238, + 244,225,227,107, 2, 75, 9, 75, 20,226,229,236,239,247,227,237, + 98,128, 3, 30,237,239,100,128, 2,213,240,225,242,229,110,128, + 36,159,243,245,240,229,242,233,239,114,128,246,235,116, 2, 75, + 51, 75, 57,225,233,108,128, 2, 86,239,240,226,225,114,128, 1, + 140,117, 2, 75, 71, 75, 82,232,233,242,225,231,225,238, 97,128, + 48,101,235,225,244,225,235,225,238, 97,128, 48,197,122,132, 1, + 243, 75,105, 75,114, 75,133, 75,170,225,236,244,239,238,101,128, + 2,163, 99, 2, 75,120, 75,127,225,242,239,110,128, 1,198,245, + 242,108,128, 2,165,101, 2, 75,139, 75,159,225,226,235,232,225, + 243,233,225,238,227,249,242,233,236,236,233, 99,128, 4,225,227, + 249,242,233,236,236,233, 99,128, 4, 85,232,229,227,249,242,233, + 236,236,233, 99,128, 4, 95,101,151, 0,101, 75,233, 75,252, 76, + 30, 77, 4, 77, 66, 77, 99, 77,111, 77,134, 77,187, 79, 43, 79, + 101, 79,203, 80, 63, 80,198, 81, 17, 81, 48, 81,110, 81,163, 82, + 98, 82,231, 82,251, 83, 39, 83,130, 97, 2, 75,239, 75,246,227, + 245,244,101,128, 0,233,242,244,104,128, 38, 65, 98, 3, 76, 4, + 76, 13, 76, 23,229,238,231,225,236,105,128, 9,143,239,240,239, + 237,239,230,111,128, 49, 28,242,229,246,101,128, 1, 21, 99, 5, + 76, 42, 76,115, 76,129, 76,161, 76,250, 97, 2, 76, 48, 76,109, + 238,228,242, 97, 3, 76, 59, 76, 66, 76, 77,228,229,246, 97,128, + 9, 13,231,245,234,225,242,225,244,105,128, 10,141,246,239,247, + 229,236,243,233,231,110, 2, 76, 91, 76, 98,228,229,246, 97,128, + 9, 69,231,245,234,225,242,225,244,105,128, 10,197,242,239,110, + 128, 1, 27,229,228,233,236,236,225,226,242,229,246,101,128, 30, + 29,104, 2, 76,135, 76,146,225,242,237,229,238,233,225,110,128, + 5,101,249,233,247,238,225,242,237,229,238,233,225,110,128, 5, + 135,233,242, 99, 2, 76,169, 76,174,236,101,128, 36,212,245,237, + 230,236,229,120,134, 0,234, 76,195, 76,203, 76,211, 76,222, 76, + 230, 76,242,225,227,245,244,101,128, 30,191,226,229,236,239,119, + 128, 30, 25,228,239,244,226,229,236,239,119,128, 30,199,231,242, + 225,246,101,128, 30,193,232,239,239,235,225,226,239,246,101,128, + 30,195,244,233,236,228,101,128, 30,197,249,242,233,236,236,233, + 99,128, 4, 84,100, 4, 77, 14, 77, 24, 77, 30, 77, 40,226,236, + 231,242,225,246,101,128, 2, 5,229,246, 97,128, 9, 15,233,229, + 242,229,243,233,115,128, 0,235,239,116,130, 1, 23, 77, 49, 77, + 58,225,227,227,229,238,116,128, 1, 23,226,229,236,239,119,128, + 30,185,101, 2, 77, 72, 77, 83,231,245,242,237,245,235,232,105, + 128, 10, 15,237,225,244,242,225,231,245,242,237,245,235,232,105, + 128, 10, 71,230,227,249,242,233,236,236,233, 99,128, 4, 68,103, + 2, 77,117, 77,124,242,225,246,101,128, 0,232,245,234,225,242, + 225,244,105,128, 10,143,104, 4, 77,144, 77,155, 77,166, 77,176, + 225,242,237,229,238,233,225,110,128, 5,103,226,239,240,239,237, + 239,230,111,128, 49, 29,233,242,225,231,225,238, 97,128, 48, 72, + 239,239,235,225,226,239,246,101,128, 30,187,105, 4, 77,197, 77, + 208, 79, 10, 79, 25,226,239,240,239,237,239,230,111,128, 49, 31, + 231,232,116,142, 0, 56, 77,242, 77,251, 78, 5, 78, 35, 78, 42, + 78, 80, 78,105, 78,150, 78,184, 78,196, 78,207, 78,240, 78,248, + 79, 3,225,242,225,226,233, 99,128, 6,104,226,229,238,231,225, + 236,105,128, 9,238,227,233,242,227,236,101,129, 36,103, 78, 16, + 233,238,246,229,242,243,229,243,225,238,243,243,229,242,233,102, + 128, 39,145,228,229,246, 97,128, 9,110,229,229,110, 2, 78, 50, + 78, 59,227,233,242,227,236,101,128, 36,113,112, 2, 78, 65, 78, + 72,225,242,229,110,128, 36,133,229,242,233,239,100,128, 36,153, + 231,117, 2, 78, 87, 78, 96,234,225,242,225,244,105,128, 10,238, + 242,237,245,235,232,105,128, 10,110,104, 2, 78,111, 78,137, 97, + 2, 78,117, 78,128,227,235,225,242,225,226,233, 99,128, 6,104, + 238,231,250,232,239,117,128, 48, 40,238,239,244,229,226,229,225, + 237,229,100,128, 38,107,105, 2, 78,156, 78,174,228,229,239,231, + 242,225,240,232,233,227,240,225,242,229,110,128, 50, 39,238,230, + 229,242,233,239,114,128, 32,136,237,239,238,239,243,240,225,227, + 101,128,255, 24,239,236,228,243,244,249,236,101,128,247, 56,112, + 2, 78,213, 78,220,225,242,229,110,128, 36,123,229,114, 2, 78, + 227, 78,233,233,239,100,128, 36,143,243,233,225,110,128, 6,248, + 242,239,237,225,110,128, 33,119,243,245,240,229,242,233,239,114, + 128, 32,120,244,232,225,105,128, 14, 88,238,246,229,242,244,229, + 228,226,242,229,246,101,128, 2, 7,239,244,233,230,233,229,228, + 227,249,242,233,236,236,233, 99,128, 4,101,107, 2, 79, 49, 79, + 73,225,244,225,235,225,238, 97,129, 48,168, 79, 61,232,225,236, + 230,247,233,228,244,104,128,255,116,111, 2, 79, 79, 79, 94,238, + 235,225,242,231,245,242,237,245,235,232,105,128, 10,116,242,229, + 225,110,128, 49, 84,108, 3, 79,109, 79,120, 79,181,227,249,242, + 233,236,236,233, 99,128, 4, 59,101, 2, 79,126, 79,133,237,229, + 238,116,128, 34, 8,246,229,110, 3, 79,143, 79,152, 79,173,227, + 233,242,227,236,101,128, 36,106,112, 2, 79,158, 79,165,225,242, + 229,110,128, 36,126,229,242,233,239,100,128, 36,146,242,239,237, + 225,110,128, 33,122,236,233,240,243,233,115,129, 32, 38, 79,192, + 246,229,242,244,233,227,225,108,128, 34,238,109, 5, 79,215, 79, + 243, 79,254, 80, 18, 80, 29,225,227,242,239,110,130, 1, 19, 79, + 227, 79,235,225,227,245,244,101,128, 30, 23,231,242,225,246,101, + 128, 30, 21,227,249,242,233,236,236,233, 99,128, 4, 60,228,225, + 243,104,129, 32, 20, 80, 7,246,229,242,244,233,227,225,108,128, + 254, 49,239,238,239,243,240,225,227,101,128,255, 69,112, 2, 80, + 35, 80, 55,232,225,243,233,243,237,225,242,235,225,242,237,229, + 238,233,225,110,128, 5, 91,244,249,243,229,116,128, 34, 5,110, + 6, 80, 77, 80, 88, 80, 99, 80,143, 80,175, 80,190,226,239,240, + 239,237,239,230,111,128, 49, 35,227,249,242,233,236,236,233, 99, + 128, 4, 61,100, 2, 80,105, 80,124,225,243,104,129, 32, 19, 80, + 113,246,229,242,244,233,227,225,108,128,254, 50,229,243,227,229, + 238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,163,103, + 130, 1, 75, 80,151, 80,162,226,239,240,239,237,239,230,111,128, + 49, 37,232,229,227,249,242,233,236,236,233, 99,128, 4,165,232, + 239,239,235,227,249,242,233,236,236,233, 99,128, 4,200,243,240, + 225,227,101,128, 32, 2,111, 3, 80,206, 80,214, 80,223,231,239, + 238,229,107,128, 1, 25,235,239,242,229,225,110,128, 49, 83,240, + 229,110,130, 2, 91, 80,233, 80,242,227,236,239,243,229,100,128, + 2,154,242,229,246,229,242,243,229,100,130, 2, 92, 81, 1, 81, + 10,227,236,239,243,229,100,128, 2, 94,232,239,239,107,128, 2, + 93,112, 2, 81, 23, 81, 30,225,242,229,110,128, 36,160,243,233, + 236,239,110,129, 3,181, 81, 40,244,239,238,239,115,128, 3,173, + 241,117, 2, 81, 55, 81, 99,225,108,130, 0, 61, 81, 64, 81, 76, + 237,239,238,239,243,240,225,227,101,128,255, 29,115, 2, 81, 82, + 81, 89,237,225,236,108,128,254,102,245,240,229,242,233,239,114, + 128, 32,124,233,246,225,236,229,238,227,101,128, 34, 97,114, 3, + 81,118, 81,129, 81,140,226,239,240,239,237,239,230,111,128, 49, + 38,227,249,242,233,236,236,233, 99,128, 4, 64,229,246,229,242, + 243,229,100,129, 2, 88, 81,152,227,249,242,233,236,236,233, 99, + 128, 4, 77,115, 6, 81,177, 81,188, 81,208, 82, 33, 82, 78, 82, + 88,227,249,242,233,236,236,233, 99,128, 4, 65,228,229,243,227, + 229,238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,171, + 104,132, 2,131, 81,220, 81,227, 82, 2, 82, 17,227,245,242,108, + 128, 2,134,239,242,116, 2, 81,235, 81,242,228,229,246, 97,128, + 9, 14,246,239,247,229,236,243,233,231,238,228,229,246, 97,128, + 9, 70,242,229,246,229,242,243,229,228,236,239,239,112,128, 1, + 170,243,241,245,225,244,242,229,246,229,242,243,229,100,128, 2, + 133,237,225,236,108, 2, 82, 42, 82, 53,232,233,242,225,231,225, + 238, 97,128, 48, 71,235,225,244,225,235,225,238, 97,129, 48,167, + 82, 66,232,225,236,230,247,233,228,244,104,128,255,106,244,233, + 237,225,244,229,100,128, 33, 46,245,240,229,242,233,239,114,128, + 246,236,116, 5, 82,110, 82,136, 82,140, 82,157, 82,223, 97,130, + 3,183, 82,118, 82,128,242,237,229,238,233,225,110,128, 5,104, + 244,239,238,239,115,128, 3,174,104,128, 0,240,233,236,228,101, + 129, 30,189, 82,149,226,229,236,239,119,128, 30, 27,238,225,232, + 244, 97, 3, 82,169, 82,201, 82,210,230,239,245,235,104, 2, 82, + 179, 82,188,232,229,226,242,229,119,128, 5,145,236,229,230,244, + 232,229,226,242,229,119,128, 5,145,232,229,226,242,229,119,128, + 5,145,236,229,230,244,232,229,226,242,229,119,128, 5,145,245, + 242,238,229,100,128, 1,221,117, 2, 82,237, 82,246,235,239,242, + 229,225,110,128, 49, 97,242,111,128, 32,172,246,239,247,229,236, + 243,233,231,110, 3, 83, 11, 83, 21, 83, 28,226,229,238,231,225, + 236,105,128, 9,199,228,229,246, 97,128, 9, 71,231,245,234,225, + 242,225,244,105,128, 10,199,120, 2, 83, 45, 83,118,227,236,225, + 109,132, 0, 33, 83, 60, 83, 71, 83, 98, 83,110,225,242,237,229, + 238,233,225,110,128, 5, 92,100, 2, 83, 77, 83, 82,226,108,128, + 32, 60,239,247,110,129, 0,161, 83, 90,243,237,225,236,108,128, + 247,161,237,239,238,239,243,240,225,227,101,128,255, 1,243,237, + 225,236,108,128,247, 33,233,243,244,229,238,244,233,225,108,128, + 34, 3,250,104,131, 2,146, 83,141, 83,160, 83,171, 99, 2, 83, + 147, 83,154,225,242,239,110,128, 1,239,245,242,108,128, 2,147, + 242,229,246,229,242,243,229,100,128, 1,185,244,225,233,108,128, + 1,186,102,140, 0,102, 83,206, 84, 32, 84, 43, 84, 52, 84, 64, + 84,167, 84,183, 86,191, 86,204, 86,230, 88,107, 88,115, 97, 4, + 83,216, 83,223, 83,234, 83,245,228,229,246, 97,128, 9, 94,231, + 245,242,237,245,235,232,105,128, 10, 94,232,242,229,238,232,229, + 233,116,128, 33, 9,244,232, 97, 3, 83,255, 84, 8, 84, 20,225, + 242,225,226,233, 99,128, 6, 78,236,239,247,225,242,225,226,233, + 99,128, 6, 78,244,225,238,225,242,225,226,233, 99,128, 6, 75, + 226,239,240,239,237,239,230,111,128, 49, 8,227,233,242,227,236, + 101,128, 36,213,228,239,244,225,227,227,229,238,116,128, 30, 31, + 101, 3, 84, 72, 84,150, 84,160,104, 4, 84, 82, 84,105, 84,119, + 84,135,225,114, 2, 84, 89, 84, 96,225,226,233, 99,128, 6, 65, + 237,229,238,233,225,110,128, 5,134,230,233,238,225,236,225,242, + 225,226,233, 99,128,254,210,233,238,233,244,233,225,236,225,242, + 225,226,233, 99,128,254,211,237,229,228,233,225,236,225,242,225, + 226,233, 99,128,254,212,233,227,239,240,244,233, 99,128, 3,229, + 237,225,236,101,128, 38, 64,102,130,251, 0, 84,175, 84,179,105, + 128,251, 3,108,128,251, 4,105,136,251, 1, 84,203, 84,243, 84, + 254, 85, 20, 85,142, 85,159, 85,167, 85,180,230,244,229,229,110, + 2, 84,213, 84,222,227,233,242,227,236,101,128, 36,110,112, 2, + 84,228, 84,235,225,242,229,110,128, 36,130,229,242,233,239,100, + 128, 36,150,231,245,242,229,228,225,243,104,128, 32, 18,236,236, + 229,100, 2, 85, 7, 85, 13,226,239,120,128, 37,160,242,229,227, + 116,128, 37,172,238,225,108, 5, 85, 34, 85, 73, 85, 90, 85,107, + 85,123,235,225,102,130, 5,218, 85, 44, 85, 64,228,225,231,229, + 243,104,129,251, 58, 85, 55,232,229,226,242,229,119,128,251, 58, + 232,229,226,242,229,119,128, 5,218,237,229,109,129, 5,221, 85, + 81,232,229,226,242,229,119,128, 5,221,238,245,110,129, 5,223, + 85, 98,232,229,226,242,229,119,128, 5,223,240,101,129, 5,227, + 85,114,232,229,226,242,229,119,128, 5,227,244,243,225,228,105, + 129, 5,229, 85,133,232,229,226,242,229,119,128, 5,229,242,243, + 244,244,239,238,229,227,232,233,238,229,243,101,128, 2,201,243, + 232,229,249,101,128, 37,201,244,225,227,249,242,233,236,236,233, + 99,128, 4,115,246,101,142, 0, 53, 85,213, 85,222, 85,232, 86, + 6, 86, 13, 86, 23, 86, 48, 86, 75, 86,109, 86,121, 86,132, 86, + 165, 86,173, 86,184,225,242,225,226,233, 99,128, 6,101,226,229, + 238,231,225,236,105,128, 9,235,227,233,242,227,236,101,129, 36, + 100, 85,243,233,238,246,229,242,243,229,243,225,238,243,243,229, + 242,233,102,128, 39,142,228,229,246, 97,128, 9,107,229,233,231, + 232,244,232,115,128, 33, 93,231,117, 2, 86, 30, 86, 39,234,225, + 242,225,244,105,128, 10,235,242,237,245,235,232,105,128, 10,107, + 232, 97, 2, 86, 55, 86, 66,227,235,225,242,225,226,233, 99,128, + 6,101,238,231,250,232,239,117,128, 48, 37,105, 2, 86, 81, 86, + 99,228,229,239,231,242,225,240,232,233,227,240,225,242,229,110, + 128, 50, 36,238,230,229,242,233,239,114,128, 32,133,237,239,238, + 239,243,240,225,227,101,128,255, 21,239,236,228,243,244,249,236, + 101,128,247, 53,112, 2, 86,138, 86,145,225,242,229,110,128, 36, + 120,229,114, 2, 86,152, 86,158,233,239,100,128, 36,140,243,233, + 225,110,128, 6,245,242,239,237,225,110,128, 33,116,243,245,240, + 229,242,233,239,114,128, 32,117,244,232,225,105,128, 14, 85,108, + 129,251, 2, 86,197,239,242,233,110,128, 1,146,109, 2, 86,210, + 86,221,239,238,239,243,240,225,227,101,128,255, 70,243,241,245, + 225,242,101,128, 51,153,111, 4, 86,240, 87, 6, 87, 18, 87, 25, + 230, 97, 2, 86,247, 86,255,238,244,232,225,105,128, 14, 31,244, + 232,225,105,128, 14, 29,238,231,237,225,238,244,232,225,105,128, + 14, 79,242,225,236,108,128, 34, 0,245,114,142, 0, 52, 87, 58, + 87, 67, 87, 77, 87,107, 87,114, 87,139, 87,166, 87,200, 87,212, + 87,231, 87,242, 88, 19, 88, 27, 88, 38,225,242,225,226,233, 99, + 128, 6,100,226,229,238,231,225,236,105,128, 9,234,227,233,242, + 227,236,101,129, 36, 99, 87, 88,233,238,246,229,242,243,229,243, + 225,238,243,243,229,242,233,102,128, 39,141,228,229,246, 97,128, + 9,106,231,117, 2, 87,121, 87,130,234,225,242,225,244,105,128, + 10,234,242,237,245,235,232,105,128, 10,106,232, 97, 2, 87,146, + 87,157,227,235,225,242,225,226,233, 99,128, 6,100,238,231,250, + 232,239,117,128, 48, 36,105, 2, 87,172, 87,190,228,229,239,231, + 242,225,240,232,233,227,240,225,242,229,110,128, 50, 35,238,230, + 229,242,233,239,114,128, 32,132,237,239,238,239,243,240,225,227, + 101,128,255, 20,238,245,237,229,242,225,244,239,242,226,229,238, + 231,225,236,105,128, 9,247,239,236,228,243,244,249,236,101,128, + 247, 52,112, 2, 87,248, 87,255,225,242,229,110,128, 36,119,229, + 114, 2, 88, 6, 88, 12,233,239,100,128, 36,139,243,233,225,110, + 128, 6,244,242,239,237,225,110,128, 33,115,243,245,240,229,242, + 233,239,114,128, 32,116,116, 2, 88, 44, 88, 82,229,229,110, 2, + 88, 52, 88, 61,227,233,242,227,236,101,128, 36,109,112, 2, 88, + 67, 88, 74,225,242,229,110,128, 36,129,229,242,233,239,100,128, + 36,149,104, 2, 88, 88, 88, 93,225,105,128, 14, 84,244,239,238, + 229,227,232,233,238,229,243,101,128, 2,203,240,225,242,229,110, + 128, 36,161,242, 97, 2, 88,122, 88,130,227,244,233,239,110,128, + 32, 68,238, 99,128, 32,163,103,144, 0,103, 88,171, 89,117, 89, + 140, 89,201, 89,218, 90,139, 91,132, 91,217, 91,230, 92, 88, 92, + 113, 92,141, 92,163, 93,108, 93,130, 93,232, 97, 9, 88,191, 88, + 201, 88,208, 88,215, 89, 23, 89, 48, 89, 59, 89, 70, 89,104,226, + 229,238,231,225,236,105,128, 9,151,227,245,244,101,128, 1,245, + 228,229,246, 97,128, 9, 23,102, 4, 88,225, 88,234, 88,248, 89, + 8,225,242,225,226,233, 99,128, 6,175,230,233,238,225,236,225, + 242,225,226,233, 99,128,251,147,233,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,251,148,237,229,228,233,225,236,225,242, + 225,226,233, 99,128,251,149,231,117, 2, 89, 30, 89, 39,234,225, + 242,225,244,105,128, 10,151,242,237,245,235,232,105,128, 10, 23, + 232,233,242,225,231,225,238, 97,128, 48, 76,235,225,244,225,235, + 225,238, 97,128, 48,172,237,237, 97,130, 3,179, 89, 80, 89, 93, + 236,225,244,233,238,243,237,225,236,108,128, 2, 99,243,245,240, + 229,242,233,239,114,128, 2,224,238,231,233,225,227,239,240,244, + 233, 99,128, 3,235, 98, 2, 89,123, 89,133,239,240,239,237,239, + 230,111,128, 49, 13,242,229,246,101,128, 1, 31, 99, 4, 89,150, + 89,157, 89,166, 89,188,225,242,239,110,128, 1,231,229,228,233, + 236,236, 97,128, 1, 35,233,242, 99, 2, 89,174, 89,179,236,101, + 128, 36,214,245,237,230,236,229,120,128, 1, 29,239,237,237,225, + 225,227,227,229,238,116,128, 1, 35,228,239,116,129, 1, 33, 89, + 209,225,227,227,229,238,116,128, 1, 33,101, 6, 89,232, 89,243, + 89,254, 90, 9, 90, 28, 90,130,227,249,242,233,236,236,233, 99, + 128, 4, 51,232,233,242,225,231,225,238, 97,128, 48, 82,235,225, + 244,225,235,225,238, 97,128, 48,178,239,237,229,244,242,233,227, + 225,236,236,249,229,241,245,225,108,128, 34, 81,114, 3, 90, 36, + 90, 85, 90, 95,229,243,104, 3, 90, 46, 90, 61, 90, 70,225,227, + 227,229,238,244,232,229,226,242,229,119,128, 5,156,232,229,226, + 242,229,119,128, 5,243,237,245,241,228,225,237,232,229,226,242, + 229,119,128, 5,157,237,225,238,228,226,236,115,128, 0,223,243, + 232,225,249,233,109, 2, 90,106, 90,121,225,227,227,229,238,244, + 232,229,226,242,229,119,128, 5,158,232,229,226,242,229,119,128, + 5,244,244,225,237,225,242,107,128, 48, 19,104, 5, 90,151, 91, + 28, 91, 91, 91,116, 91,122, 97, 4, 90,161, 90,171, 90,194, 90, + 219,226,229,238,231,225,236,105,128, 9,152,100, 2, 90,177, 90, + 188,225,242,237,229,238,233,225,110,128, 5,114,229,246, 97,128, + 9, 24,231,117, 2, 90,201, 90,210,234,225,242,225,244,105,128, + 10,152,242,237,245,235,232,105,128, 10, 24,233,110, 4, 90,230, + 90,239, 90,253, 91, 13,225,242,225,226,233, 99,128, 6, 58,230, + 233,238,225,236,225,242,225,226,233, 99,128,254,206,233,238,233, + 244,233,225,236,225,242,225,226,233, 99,128,254,207,237,229,228, + 233,225,236,225,242,225,226,233, 99,128,254,208,101, 3, 91, 36, + 91, 57, 91, 74,237,233,228,228,236,229,232,239,239,235,227,249, + 242,233,236,236,233, 99,128, 4,149,243,244,242,239,235,229,227, + 249,242,233,236,236,233, 99,128, 4,147,245,240,244,245,242,238, + 227,249,242,233,236,236,233, 99,128, 4,145,232, 97, 2, 91, 98, + 91,105,228,229,246, 97,128, 9, 90,231,245,242,237,245,235,232, + 105,128, 10, 90,239,239,107,128, 2, 96,250,243,241,245,225,242, + 101,128, 51,147,105, 3, 91,140, 91,151, 91,162,232,233,242,225, + 231,225,238, 97,128, 48, 78,235,225,244,225,235,225,238, 97,128, + 48,174,109, 2, 91,168, 91,179,225,242,237,229,238,233,225,110, + 128, 5, 99,229,108,130, 5,210, 91,188, 91,208,228,225,231,229, + 243,104,129,251, 50, 91,199,232,229,226,242,229,119,128,251, 50, + 232,229,226,242,229,119,128, 5,210,234,229,227,249,242,233,236, + 236,233, 99,128, 4, 83,236,239,244,244,225,108, 2, 91,241, 92, + 2,233,238,246,229,242,244,229,228,243,244,242,239,235,101,128, + 1,190,243,244,239,112,132, 2,148, 92, 17, 92, 28, 92, 34, 92, + 66,233,238,246,229,242,244,229,100,128, 2,150,237,239,100,128, + 2,192,242,229,246,229,242,243,229,100,130, 2,149, 92, 49, 92, + 55,237,239,100,128, 2,193,243,245,240,229,242,233,239,114,128, + 2,228,243,244,242,239,235,101,129, 2,161, 92, 77,242,229,246, + 229,242,243,229,100,128, 2,162,109, 2, 92, 94, 92,102,225,227, + 242,239,110,128, 30, 33,239,238,239,243,240,225,227,101,128,255, + 71,111, 2, 92,119, 92,130,232,233,242,225,231,225,238, 97,128, + 48, 84,235,225,244,225,235,225,238, 97,128, 48,180,240, 97, 2, + 92,148, 92,154,242,229,110,128, 36,162,243,241,245,225,242,101, + 128, 51,172,114, 2, 92,169, 93, 10, 97, 2, 92,175, 92,183,228, + 233,229,238,116,128, 34, 7,246,101,134, 0, 96, 92,200, 92,211, + 92,228, 92,235, 92,244, 93, 0,226,229,236,239,247,227,237, 98, + 128, 3, 22, 99, 2, 92,217, 92,222,237, 98,128, 3, 0,239,237, + 98,128, 3, 0,228,229,246, 97,128, 9, 83,236,239,247,237,239, + 100,128, 2,206,237,239,238,239,243,240,225,227,101,128,255, 64, + 244,239,238,229,227,237, 98,128, 3, 64,229,225,244,229,114,132, + 0, 62, 93, 26, 93, 45, 93, 57, 93,100,229,241,245,225,108,129, + 34,101, 93, 36,239,242,236,229,243,115,128, 34,219,237,239,238, + 239,243,240,225,227,101,128,255, 30,111, 2, 93, 63, 93, 89,114, + 2, 93, 69, 93, 82,229,241,245,233,246,225,236,229,238,116,128, + 34,115,236,229,243,115,128, 34,119,246,229,242,229,241,245,225, + 108,128, 34,103,243,237,225,236,108,128,254,101,115, 2, 93,114, + 93,122,227,242,233,240,116,128, 2, 97,244,242,239,235,101,128, + 1,229,117, 4, 93,140, 93,151, 93,208, 93,219,232,233,242,225, + 231,225,238, 97,128, 48, 80,233,108, 2, 93,158, 93,183,236,229, + 237,239,116, 2, 93,168, 93,175,236,229,230,116,128, 0,171,242, + 233,231,232,116,128, 0,187,243,233,238,231,108, 2, 93,193, 93, + 200,236,229,230,116,128, 32, 57,242,233,231,232,116,128, 32, 58, + 235,225,244,225,235,225,238, 97,128, 48,176,242,225,237,245,243, + 241,245,225,242,101,128, 51, 24,249,243,241,245,225,242,101,128, + 51,201,104,144, 0,104, 94, 22, 96,164, 96,199, 96,236, 97, 20, + 98,164, 98,184, 99,149, 99,161, 99,173,100,241,100,249,101, 4, + 101, 13,101, 93,101, 97, 97, 13, 94, 50, 94, 89, 94, 99, 94,129, + 94,154, 94,232, 94,244, 95, 13, 95, 28, 95, 57, 95, 70, 95,128, + 95,137, 97, 2, 94, 56, 94, 75,226,235,232,225,243,233,225,238, + 227,249,242,233,236,236,233, 99,128, 4,169,236,244,239,238,229, + 225,242,225,226,233, 99,128, 6,193,226,229,238,231,225,236,105, + 128, 9,185,228,101, 2, 94,106, 94,124,243,227,229,238,228,229, + 242,227,249,242,233,236,236,233, 99,128, 4,179,246, 97,128, 9, + 57,231,117, 2, 94,136, 94,145,234,225,242,225,244,105,128, 10, + 185,242,237,245,235,232,105,128, 10, 57,104, 4, 94,164, 94,173, + 94,187, 94,217,225,242,225,226,233, 99,128, 6, 45,230,233,238, + 225,236,225,242,225,226,233, 99,128,254,162,105, 2, 94,193, 94, + 208,238,233,244,233,225,236,225,242,225,226,233, 99,128,254,163, + 242,225,231,225,238, 97,128, 48,111,237,229,228,233,225,236,225, + 242,225,226,233, 99,128,254,164,233,244,245,243,241,245,225,242, + 101,128, 51, 42,235,225,244,225,235,225,238, 97,129, 48,207, 95, + 1,232,225,236,230,247,233,228,244,104,128,255,138,236,225,238, + 244,231,245,242,237,245,235,232,105,128, 10, 77,237,250, 97, 2, + 95, 36, 95, 45,225,242,225,226,233, 99,128, 6, 33,236,239,247, + 225,242,225,226,233, 99,128, 6, 33,238,231,245,236,230,233,236, + 236,229,114,128, 49,100,114, 2, 95, 76, 95, 92,228,243,233,231, + 238,227,249,242,233,236,236,233, 99,128, 4, 74,240,239,239,110, + 2, 95,101, 95,114,236,229,230,244,226,225,242,226,245,112,128, + 33,188,242,233,231,232,244,226,225,242,226,245,112,128, 33,192, + 243,241,245,225,242,101,128, 51,202,244,225,102, 3, 95,147, 95, + 239, 96, 74,240,225,244,225,104,134, 5,178, 95,167, 95,172, 95, + 186, 95,195, 95,210, 95,226,177, 54,128, 5,178, 50, 2, 95,178, + 95,182, 51,128, 5,178,102,128, 5,178,232,229,226,242,229,119, + 128, 5,178,238,225,242,242,239,247,232,229,226,242,229,119,128, + 5,178,241,245,225,242,244,229,242,232,229,226,242,229,119,128, + 5,178,247,233,228,229,232,229,226,242,229,119,128, 5,178,241, + 225,237,225,244,115,135, 5,179, 96, 6, 96, 11, 96, 16, 96, 21, + 96, 30, 96, 45, 96, 61,177, 98,128, 5,179,178, 56,128, 5,179, + 179, 52,128, 5,179,232,229,226,242,229,119,128, 5,179,238,225, + 242,242,239,247,232,229,226,242,229,119,128, 5,179,241,245,225, + 242,244,229,242,232,229,226,242,229,119,128, 5,179,247,233,228, + 229,232,229,226,242,229,119,128, 5,179,243,229,231,239,108,135, + 5,177, 96, 96, 96,101, 96,106, 96,111, 96,120, 96,135, 96,151, + 177, 55,128, 5,177,178, 52,128, 5,177,179, 48,128, 5,177,232, + 229,226,242,229,119,128, 5,177,238,225,242,242,239,247,232,229, + 226,242,229,119,128, 5,177,241,245,225,242,244,229,242,232,229, + 226,242,229,119,128, 5,177,247,233,228,229,232,229,226,242,229, + 119,128, 5,177, 98, 3, 96,172, 96,177, 96,187,225,114,128, 1, + 39,239,240,239,237,239,230,111,128, 49, 15,242,229,246,229,226, + 229,236,239,119,128, 30, 43, 99, 2, 96,205, 96,214,229,228,233, + 236,236, 97,128, 30, 41,233,242, 99, 2, 96,222, 96,227,236,101, + 128, 36,215,245,237,230,236,229,120,128, 1, 37,100, 2, 96,242, + 96,252,233,229,242,229,243,233,115,128, 30, 39,239,116, 2, 97, + 3, 97, 12,225,227,227,229,238,116,128, 30, 35,226,229,236,239, + 119,128, 30, 37,101,136, 5,212, 97, 40, 97, 73, 97, 93, 98, 66, + 98, 82, 98,127, 98,136, 98,149,225,242,116,129, 38,101, 97, 48, + 243,245,233,116, 2, 97, 57, 97, 65,226,236,225,227,107,128, 38, + 101,247,232,233,244,101,128, 38, 97,228,225,231,229,243,104,129, + 251, 52, 97, 84,232,229,226,242,229,119,128,251, 52,104, 6, 97, + 107, 97,135, 97,143, 97,193, 97,239, 98, 32, 97, 2, 97,113, 97, + 127,236,244,239,238,229,225,242,225,226,233, 99,128, 6,193,242, + 225,226,233, 99,128, 6, 71,229,226,242,229,119,128, 5,212,230, + 233,238,225,236, 97, 2, 97,154, 97,185,236,116, 2, 97,161, 97, + 173,239,238,229,225,242,225,226,233, 99,128,251,167,244,247,239, + 225,242,225,226,233, 99,128,254,234,242,225,226,233, 99,128,254, + 234,232,225,237,250,225,225,226,239,246,101, 2, 97,208, 97,222, + 230,233,238,225,236,225,242,225,226,233, 99,128,251,165,233,243, + 239,236,225,244,229,228,225,242,225,226,233, 99,128,251,164,105, + 2, 97,245, 98, 23,238,233,244,233,225,236, 97, 2, 98, 1, 98, + 15,236,244,239,238,229,225,242,225,226,233, 99,128,251,168,242, + 225,226,233, 99,128,254,235,242,225,231,225,238, 97,128, 48,120, + 237,229,228,233,225,236, 97, 2, 98, 44, 98, 58,236,244,239,238, + 229,225,242,225,226,233, 99,128,251,169,242,225,226,233, 99,128, + 254,236,233,243,229,233,229,242,225,243,241,245,225,242,101,128, + 51,123,107, 2, 98, 88, 98,112,225,244,225,235,225,238, 97,129, + 48,216, 98,100,232,225,236,230,247,233,228,244,104,128,255,141, + 245,244,225,225,242,245,243,241,245,225,242,101,128, 51, 54,238, + 231,232,239,239,107,128, 2,103,242,245,244,245,243,241,245,225, + 242,101,128, 51, 57,116,129, 5,215, 98,155,232,229,226,242,229, + 119,128, 5,215,232,239,239,107,129, 2,102, 98,173,243,245,240, + 229,242,233,239,114,128, 2,177,105, 4, 98,194, 99, 23, 99, 34, + 99, 59,229,245,104, 4, 98,206, 98,241, 99, 0, 99, 9, 97, 2, + 98,212, 98,227,227,233,242,227,236,229,235,239,242,229,225,110, + 128, 50,123,240,225,242,229,238,235,239,242,229,225,110,128, 50, + 27,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,109, + 235,239,242,229,225,110,128, 49, 78,240,225,242,229,238,235,239, + 242,229,225,110,128, 50, 13,232,233,242,225,231,225,238, 97,128, + 48,114,235,225,244,225,235,225,238, 97,129, 48,210, 99, 47,232, + 225,236,230,247,233,228,244,104,128,255,139,242,233,113,134, 5, + 180, 99, 77, 99, 82, 99, 96, 99,105, 99,120, 99,136,177, 52,128, + 5,180, 50, 2, 99, 88, 99, 92, 49,128, 5,180,100,128, 5,180, + 232,229,226,242,229,119,128, 5,180,238,225,242,242,239,247,232, + 229,226,242,229,119,128, 5,180,241,245,225,242,244,229,242,232, + 229,226,242,229,119,128, 5,180,247,233,228,229,232,229,226,242, + 229,119,128, 5,180,236,233,238,229,226,229,236,239,119,128, 30, + 150,237,239,238,239,243,240,225,227,101,128,255, 72,111, 9, 99, + 193, 99,204, 99,228, 99,253,100, 85,100, 98,100,184,100,224,100, + 235,225,242,237,229,238,233,225,110,128, 5,112,232,105, 2, 99, + 211, 99,219,240,244,232,225,105,128, 14, 43,242,225,231,225,238, + 97,128, 48,123,235,225,244,225,235,225,238, 97,129, 48,219, 99, + 241,232,225,236,230,247,233,228,244,104,128,255,142,236,225,109, + 135, 5,185,100, 17,100, 22,100, 27,100, 32,100, 41,100, 56,100, + 72,177, 57,128, 5,185,178, 54,128, 5,185,179, 50,128, 5,185, + 232,229,226,242,229,119,128, 5,185,238,225,242,242,239,247,232, + 229,226,242,229,119,128, 5,185,241,245,225,242,244,229,242,232, + 229,226,242,229,119,128, 5,185,247,233,228,229,232,229,226,242, + 229,119,128, 5,185,238,239,235,232,245,235,244,232,225,105,128, + 14, 46,111, 2,100,104,100,174,107, 4,100,114,100,126,100,132, + 100,154,225,226,239,246,229,227,239,237, 98,128, 3, 9,227,237, + 98,128, 3, 9,240,225,236,225,244,225,236,233,250,229,228,226, + 229,236,239,247,227,237, 98,128, 3, 33,242,229,244,242,239,230, + 236,229,248,226,229,236,239,247,227,237, 98,128, 3, 34,238,243, + 241,245,225,242,101,128, 51, 66,114, 2,100,190,100,217,105, 2, + 100,196,100,205,227,239,240,244,233, 99,128, 3,233,250,239,238, + 244,225,236,226,225,114,128, 32, 21,238,227,237, 98,128, 3, 27, + 244,243,240,242,233,238,231,115,128, 38,104,245,243,101,128, 35, + 2,240,225,242,229,110,128, 36,163,243,245,240,229,242,233,239, + 114,128, 2,176,244,245,242,238,229,100,128, 2,101,117, 4,101, + 23,101, 34,101, 47,101, 72,232,233,242,225,231,225,238, 97,128, + 48,117,233,233,244,239,243,241,245,225,242,101,128, 51, 51,235, + 225,244,225,235,225,238, 97,129, 48,213,101, 60,232,225,236,230, + 247,233,228,244,104,128,255,140,238,231,225,242,245,237,236,225, + 245,116,129, 2,221,101, 87,227,237, 98,128, 3, 11,118,128, 1, + 149,249,240,232,229,110,132, 0, 45,101,113,101,124,101,136,101, + 159,233,238,230,229,242,233,239,114,128,246,229,237,239,238,239, + 243,240,225,227,101,128,255, 13,115, 2,101,142,101,149,237,225, + 236,108,128,254, 99,245,240,229,242,233,239,114,128,246,230,244, + 247,111,128, 32, 16,105,149, 0,105,101,211,101,234,102, 12,102, + 59,105,197,106, 61,106, 98,106,125,107, 31,107, 35,107, 73,107, + 95,107,179,108, 88,108,163,108,171,108,184,109, 15,109, 72,109, + 100,109,144,225, 99, 2,101,218,101,224,245,244,101,128, 0,237, + 249,242,233,236,236,233, 99,128, 4, 79, 98, 3,101,242,101,251, + 102, 5,229,238,231,225,236,105,128, 9,135,239,240,239,237,239, + 230,111,128, 49, 39,242,229,246,101,128, 1, 45, 99, 3,102, 20, + 102, 27,102, 49,225,242,239,110,128, 1,208,233,242, 99, 2,102, + 35,102, 40,236,101,128, 36,216,245,237,230,236,229,120,128, 0, + 238,249,242,233,236,236,233, 99,128, 4, 86,100, 4,102, 69,102, + 79,105,154,105,187,226,236,231,242,225,246,101,128, 2, 9,101, + 2,102, 85,105,149,239,231,242,225,240,104, 7,102,106,102,120, + 102,133,105, 62,105, 93,105,106,105,118,229,225,242,244,232,227, + 233,242,227,236,101,128, 50,143,230,233,242,229,227,233,242,227, + 236,101,128, 50,139,233, 99, 14,102,164,102,180,103, 23,103, 77, + 103,143,103,172,103,188,103,245,104, 38,104, 50,104, 77,104,144, + 105, 26,105, 55,225,236,236,233,225,238,227,229,240,225,242,229, + 110,128, 50, 63, 99, 4,102,190,102,201,102,215,102,222,225,236, + 236,240,225,242,229,110,128, 50, 58,229,238,244,242,229,227,233, + 242,227,236,101,128, 50,165,236,239,243,101,128, 48, 6,111, 3, + 102,230,102,245,103, 9,237,237, 97,129, 48, 1,102,238,236,229, + 230,116,128,255,100,238,231,242,225,244,245,236,225,244,233,239, + 238,240,225,242,229,110,128, 50, 55,242,242,229,227,244,227,233, + 242,227,236,101,128, 50,163,101, 3,103, 31,103, 43,103, 60,225, + 242,244,232,240,225,242,229,110,128, 50, 47,238,244,229,242,240, + 242,233,243,229,240,225,242,229,110,128, 50, 61,248,227,229,236, + 236,229,238,244,227,233,242,227,236,101,128, 50,157,102, 2,103, + 83,103, 98,229,243,244,233,246,225,236,240,225,242,229,110,128, + 50, 64,105, 2,103,104,103,133,238,225,238,227,233,225,108, 2, + 103,116,103,125,227,233,242,227,236,101,128, 50,150,240,225,242, + 229,110,128, 50, 54,242,229,240,225,242,229,110,128, 50, 43,104, + 2,103,149,103,160,225,246,229,240,225,242,229,110,128, 50, 50, + 233,231,232,227,233,242,227,236,101,128, 50,164,233,244,229,242, + 225,244,233,239,238,237,225,242,107,128, 48, 5,108, 3,103,196, + 103,222,103,234,225,226,239,114, 2,103,205,103,214,227,233,242, + 227,236,101,128, 50,152,240,225,242,229,110,128, 50, 56,229,230, + 244,227,233,242,227,236,101,128, 50,167,239,247,227,233,242,227, + 236,101,128, 50,166,109, 2,103,251,104, 27,101, 2,104, 1,104, + 16,228,233,227,233,238,229,227,233,242,227,236,101,128, 50,169, + 244,225,236,240,225,242,229,110,128, 50, 46,239,239,238,240,225, + 242,229,110,128, 50, 42,238,225,237,229,240,225,242,229,110,128, + 50, 52,112, 2,104, 56,104, 64,229,242,233,239,100,128, 48, 2, + 242,233,238,244,227,233,242,227,236,101,128, 50,158,114, 2,104, + 83,104,131,101, 3,104, 91,104,102,104,117,225,227,232,240,225, + 242,229,110,128, 50, 67,240,242,229,243,229,238,244,240,225,242, + 229,110,128, 50, 57,243,239,245,242,227,229,240,225,242,229,110, + 128, 50, 62,233,231,232,244,227,233,242,227,236,101,128, 50,168, + 115, 5,104,156,104,185,104,199,104,224,104,252,101, 2,104,162, + 104,175,227,242,229,244,227,233,242,227,236,101,128, 50,153,236, + 230,240,225,242,229,110,128, 50, 66,239,227,233,229,244,249,240, + 225,242,229,110,128, 50, 51,112, 2,104,205,104,211,225,227,101, + 128, 48, 0,229,227,233,225,236,240,225,242,229,110,128, 50, 53, + 116, 2,104,230,104,241,239,227,235,240,225,242,229,110,128, 50, + 49,245,228,249,240,225,242,229,110,128, 50, 59,117, 2,105, 2, + 105, 11,238,240,225,242,229,110,128, 50, 48,240,229,242,246,233, + 243,229,240,225,242,229,110,128, 50, 60,119, 2,105, 32,105, 44, + 225,244,229,242,240,225,242,229,110,128, 50, 44,239,239,228,240, + 225,242,229,110,128, 50, 45,250,229,242,111,128, 48, 7,109, 2, + 105, 68,105, 81,229,244,225,236,227,233,242,227,236,101,128, 50, + 142,239,239,238,227,233,242,227,236,101,128, 50,138,238,225,237, + 229,227,233,242,227,236,101,128, 50,148,243,245,238,227,233,242, + 227,236,101,128, 50,144,119, 2,105,124,105,137,225,244,229,242, + 227,233,242,227,236,101,128, 50,140,239,239,228,227,233,242,227, + 236,101,128, 50,141,246, 97,128, 9, 7,233,229,242,229,243,233, + 115,130, 0,239,105,168,105,176,225,227,245,244,101,128, 30, 47, + 227,249,242,233,236,236,233, 99,128, 4,229,239,244,226,229,236, + 239,119,128, 30,203,101, 3,105,205,105,221,105,232,226,242,229, + 246,229,227,249,242,233,236,236,233, 99,128, 4,215,227,249,242, + 233,236,236,233, 99,128, 4, 53,245,238,103, 4,105,244,106, 23, + 106, 38,106, 47, 97, 2,105,250,106, 9,227,233,242,227,236,229, + 235,239,242,229,225,110,128, 50,117,240,225,242,229,238,235,239, + 242,229,225,110,128, 50, 21,227,233,242,227,236,229,235,239,242, + 229,225,110,128, 50,103,235,239,242,229,225,110,128, 49, 71,240, + 225,242,229,238,235,239,242,229,225,110,128, 50, 7,103, 2,106, + 67,106, 74,242,225,246,101,128, 0,236,117, 2,106, 80,106, 89, + 234,225,242,225,244,105,128, 10,135,242,237,245,235,232,105,128, + 10, 7,104, 2,106,104,106,114,233,242,225,231,225,238, 97,128, + 48, 68,239,239,235,225,226,239,246,101,128, 30,201,105, 8,106, + 143,106,153,106,164,106,171,106,196,106,212,106,227,106,243,226, + 229,238,231,225,236,105,128, 9,136,227,249,242,233,236,236,233, + 99,128, 4, 56,228,229,246, 97,128, 9, 8,231,117, 2,106,178, + 106,187,234,225,242,225,244,105,128, 10,136,242,237,245,235,232, + 105,128, 10, 8,237,225,244,242,225,231,245,242,237,245,235,232, + 105,128, 10, 64,238,246,229,242,244,229,228,226,242,229,246,101, + 128, 2, 11,243,232,239,242,244,227,249,242,233,236,236,233, 99, + 128, 4, 57,246,239,247,229,236,243,233,231,110, 3,107, 3,107, + 13,107, 20,226,229,238,231,225,236,105,128, 9,192,228,229,246, + 97,128, 9, 64,231,245,234,225,242,225,244,105,128, 10,192,106, + 128, 1, 51,107, 2,107, 41,107, 65,225,244,225,235,225,238, 97, + 129, 48,164,107, 53,232,225,236,230,247,233,228,244,104,128,255, + 114,239,242,229,225,110,128, 49, 99,108, 2,107, 79,107, 84,228, + 101,128, 2,220,245,249,232,229,226,242,229,119,128, 5,172,109, + 2,107,101,107,168, 97, 3,107,109,107,129,107,154,227,242,239, + 110,129, 1, 43,107,118,227,249,242,233,236,236,233, 99,128, 4, + 227,231,229,239,242,225,240,240,242,239,248,233,237,225,244,229, + 236,249,229,241,245,225,108,128, 34, 83,244,242,225,231,245,242, + 237,245,235,232,105,128, 10, 63,239,238,239,243,240,225,227,101, + 128,255, 73,110, 5,107,191,107,201,107,210,107,222,108, 50,227, + 242,229,237,229,238,116,128, 34, 6,230,233,238,233,244,121,128, + 34, 30,233,225,242,237,229,238,233,225,110,128, 5,107,116, 2, + 107,228,108, 40,101, 2,107,234,108, 29,231,242,225,108,131, 34, + 43,107,247,108, 9,108, 14, 98, 2,107,253,108, 5,239,244,244, + 239,109,128, 35, 33,116,128, 35, 33,229,120,128,248,245,116, 2, + 108, 20,108, 25,239,112,128, 35, 32,112,128, 35, 32,242,243,229, + 227,244,233,239,110,128, 34, 41,233,243,241,245,225,242,101,128, + 51, 5,118, 3,108, 58,108, 67,108, 76,226,245,236,236,229,116, + 128, 37,216,227,233,242,227,236,101,128, 37,217,243,237,233,236, + 229,230,225,227,101,128, 38, 59,111, 3,108, 96,108,107,108,115, + 227,249,242,233,236,236,233, 99,128, 4, 81,231,239,238,229,107, + 128, 1, 47,244, 97,131, 3,185,108,126,108,147,108,155,228,233, + 229,242,229,243,233,115,129, 3,202,108,139,244,239,238,239,115, + 128, 3,144,236,225,244,233,110,128, 2,105,244,239,238,239,115, + 128, 3,175,240,225,242,229,110,128, 36,164,242,233,231,245,242, + 237,245,235,232,105,128, 10,114,115, 4,108,194,108,239,108,253, + 109, 5,237,225,236,108, 2,108,203,108,214,232,233,242,225,231, + 225,238, 97,128, 48, 67,235,225,244,225,235,225,238, 97,129, 48, + 163,108,227,232,225,236,230,247,233,228,244,104,128,255,104,243, + 232,225,242,226,229,238,231,225,236,105,128, 9,250,244,242,239, + 235,101,128, 2,104,245,240,229,242,233,239,114,128,246,237,116, + 2,109, 21,109, 55,229,242,225,244,233,239,110, 2,109, 33,109, + 44,232,233,242,225,231,225,238, 97,128, 48,157,235,225,244,225, + 235,225,238, 97,128, 48,253,233,236,228,101,129, 1, 41,109, 64, + 226,229,236,239,119,128, 30, 45,117, 2,109, 78,109, 89,226,239, + 240,239,237,239,230,111,128, 49, 41,227,249,242,233,236,236,233, + 99,128, 4, 78,246,239,247,229,236,243,233,231,110, 3,109,116, + 109,126,109,133,226,229,238,231,225,236,105,128, 9,191,228,229, + 246, 97,128, 9, 63,231,245,234,225,242,225,244,105,128, 10,191, + 250,232,233,244,243, 97, 2,109,155,109,166,227,249,242,233,236, + 236,233, 99,128, 4,117,228,226,236,231,242,225,246,229,227,249, + 242,233,236,236,233, 99,128, 4,119,106,138, 0,106,109,209,110, + 16,110, 27,110, 77,110, 93,110,206,111, 19,111, 24,111, 36,111, + 44, 97, 4,109,219,109,230,109,240,109,247,225,242,237,229,238, + 233,225,110,128, 5,113,226,229,238,231,225,236,105,128, 9,156, + 228,229,246, 97,128, 9, 28,231,117, 2,109,254,110, 7,234,225, + 242,225,244,105,128, 10,156,242,237,245,235,232,105,128, 10, 28, + 226,239,240,239,237,239,230,111,128, 49, 16, 99, 3,110, 35,110, + 42,110, 64,225,242,239,110,128, 1,240,233,242, 99, 2,110, 50, + 110, 55,236,101,128, 36,217,245,237,230,236,229,120,128, 1, 53, + 242,239,243,243,229,228,244,225,233,108,128, 2,157,228,239,244, + 236,229,243,243,243,244,242,239,235,101,128, 2, 95,101, 3,110, + 101,110,112,110,177,227,249,242,233,236,236,233, 99,128, 4, 88, + 229,109, 4,110,123,110,132,110,146,110,162,225,242,225,226,233, + 99,128, 6, 44,230,233,238,225,236,225,242,225,226,233, 99,128, + 254,158,233,238,233,244,233,225,236,225,242,225,226,233, 99,128, + 254,159,237,229,228,233,225,236,225,242,225,226,233, 99,128,254, + 160,104, 2,110,183,110,192,225,242,225,226,233, 99,128, 6,152, + 230,233,238,225,236,225,242,225,226,233, 99,128,251,139,104, 2, + 110,212,111, 6, 97, 3,110,220,110,230,110,237,226,229,238,231, + 225,236,105,128, 9,157,228,229,246, 97,128, 9, 29,231,117, 2, + 110,244,110,253,234,225,242,225,244,105,128, 10,157,242,237,245, + 235,232,105,128, 10, 29,229,232,225,242,237,229,238,233,225,110, + 128, 5,123,233,115,128, 48, 4,237,239,238,239,243,240,225,227, + 101,128,255, 74,240,225,242,229,110,128, 36,165,243,245,240,229, + 242,233,239,114,128, 2,178,107,146, 0,107,111, 95,113,184,113, + 195,114, 1,114, 12,114,102,114,116,115,224,116,164,116,177,116, + 203,116,252,117,134,117,156,117,169,117,192,117,234,117,244, 97, + 12,111,121,111,153,111,175,111,205,112, 63,112, 88,112,118,112, + 143,112,249,113, 7,113,130,113,159, 98, 2,111,127,111,144,225, + 243,232,235,233,242,227,249,242,233,236,236,233, 99,128, 4,161, + 229,238,231,225,236,105,128, 9,149, 99, 2,111,159,111,165,245, + 244,101,128, 30, 49,249,242,233,236,236,233, 99,128, 4, 58,228, + 101, 2,111,182,111,200,243,227,229,238,228,229,242,227,249,242, + 233,236,236,233, 99,128, 4,155,246, 97,128, 9, 21,102,135, 5, + 219,111,223,111,232,111,252,112, 10,112, 19,112, 35,112, 50,225, + 242,225,226,233, 99,128, 6, 67,228,225,231,229,243,104,129,251, + 59,111,243,232,229,226,242,229,119,128,251, 59,230,233,238,225, + 236,225,242,225,226,233, 99,128,254,218,232,229,226,242,229,119, + 128, 5,219,233,238,233,244,233,225,236,225,242,225,226,233, 99, + 128,254,219,237,229,228,233,225,236,225,242,225,226,233, 99,128, + 254,220,242,225,230,229,232,229,226,242,229,119,128,251, 77,231, + 117, 2,112, 70,112, 79,234,225,242,225,244,105,128, 10,149,242, + 237,245,235,232,105,128, 10, 21,104, 2,112, 94,112,104,233,242, + 225,231,225,238, 97,128, 48, 75,239,239,235,227,249,242,233,236, + 236,233, 99,128, 4,196,235,225,244,225,235,225,238, 97,129, 48, + 171,112,131,232,225,236,230,247,233,228,244,104,128,255,118,112, + 2,112,149,112,170,240, 97,129, 3,186,112,156,243,249,237,226, + 239,236,231,242,229,229,107,128, 3,240,249,229,239,245,110, 3, + 112,182,112,196,112,230,237,233,229,245,237,235,239,242,229,225, + 110,128, 49,113,112, 2,112,202,112,217,232,233,229,245,240,232, + 235,239,242,229,225,110,128, 49,132,233,229,245,240,235,239,242, + 229,225,110,128, 49,120,243,243,225,238,231,240,233,229,245,240, + 235,239,242,229,225,110,128, 49,121,242,239,242,233,233,243,241, + 245,225,242,101,128, 51, 13,115, 5,113, 19,113, 63,113, 78,113, + 86,113,114,232,233,228,225,225,245,244,111, 2,113, 32,113, 41, + 225,242,225,226,233, 99,128, 6, 64,238,239,243,233,228,229,226, + 229,225,242,233,238,231,225,242,225,226,233, 99,128, 6, 64,237, + 225,236,236,235,225,244,225,235,225,238, 97,128, 48,245,241,245, + 225,242,101,128, 51,132,242, 97, 2,113, 93,113,102,225,242,225, + 226,233, 99,128, 6, 80,244,225,238,225,242,225,226,233, 99,128, + 6, 77,244,242,239,235,229,227,249,242,233,236,236,233, 99,128, + 4,159,244,225,232,233,242,225,240,242,239,236,239,238,231,237, + 225,242,235,232,225,236,230,247,233,228,244,104,128,255,112,246, + 229,242,244,233,227,225,236,243,244,242,239,235,229,227,249,242, + 233,236,236,233, 99,128, 4,157,226,239,240,239,237,239,230,111, + 128, 49, 14, 99, 4,113,205,113,227,113,236,113,244, 97, 2,113, + 211,113,221,236,243,241,245,225,242,101,128, 51,137,242,239,110, + 128, 1,233,229,228,233,236,236, 97,128, 1, 55,233,242,227,236, + 101,128, 36,218,239,237,237,225,225,227,227,229,238,116,128, 1, + 55,228,239,244,226,229,236,239,119,128, 30, 51,101, 4,114, 22, + 114, 49,114, 74,114, 86,104, 2,114, 28,114, 39,225,242,237,229, + 238,233,225,110,128, 5,132,233,242,225,231,225,238, 97,128, 48, + 81,235,225,244,225,235,225,238, 97,129, 48,177,114, 62,232,225, + 236,230,247,233,228,244,104,128,255,121,238,225,242,237,229,238, + 233,225,110,128, 5,111,243,237,225,236,236,235,225,244,225,235, + 225,238, 97,128, 48,246,231,242,229,229,238,236,225,238,228,233, + 99,128, 1, 56,104, 6,114,130,115, 3,115, 14,115, 39,115,126, + 115,214, 97, 5,114,142,114,152,114,163,114,170,114,195,226,229, + 238,231,225,236,105,128, 9,150,227,249,242,233,236,236,233, 99, + 128, 4, 69,228,229,246, 97,128, 9, 22,231,117, 2,114,177,114, + 186,234,225,242,225,244,105,128, 10,150,242,237,245,235,232,105, + 128, 10, 22,104, 4,114,205,114,214,114,228,114,244,225,242,225, + 226,233, 99,128, 6, 46,230,233,238,225,236,225,242,225,226,233, + 99,128,254,166,233,238,233,244,233,225,236,225,242,225,226,233, + 99,128,254,167,237,229,228,233,225,236,225,242,225,226,233, 99, + 128,254,168,229,233,227,239,240,244,233, 99,128, 3,231,232, 97, + 2,115, 21,115, 28,228,229,246, 97,128, 9, 89,231,245,242,237, + 245,235,232,105,128, 10, 89,233,229,245,235,104, 4,115, 53,115, + 88,115,103,115,112, 97, 2,115, 59,115, 74,227,233,242,227,236, + 229,235,239,242,229,225,110,128, 50,120,240,225,242,229,238,235, + 239,242,229,225,110,128, 50, 24,227,233,242,227,236,229,235,239, + 242,229,225,110,128, 50,106,235,239,242,229,225,110,128, 49, 75, + 240,225,242,229,238,235,239,242,229,225,110,128, 50, 10,111, 4, + 115,136,115,185,115,195,115,200,235,104, 4,115,147,115,156,115, + 165,115,175,225,233,244,232,225,105,128, 14, 2,239,238,244,232, + 225,105,128, 14, 5,245,225,244,244,232,225,105,128, 14, 3,247, + 225,233,244,232,225,105,128, 14, 4,237,245,244,244,232,225,105, + 128, 14, 91,239,107,128, 1,153,242,225,235,232,225,238,231,244, + 232,225,105,128, 14, 6,250,243,241,245,225,242,101,128, 51,145, + 105, 4,115,234,115,245,116, 14,116, 63,232,233,242,225,231,225, + 238, 97,128, 48, 77,235,225,244,225,235,225,238, 97,129, 48,173, + 116, 2,232,225,236,230,247,233,228,244,104,128,255,119,242,111, + 3,116, 23,116, 38,116, 54,231,245,242,225,237,245,243,241,245, + 225,242,101,128, 51, 21,237,229,229,244,239,242,245,243,241,245, + 225,242,101,128, 51, 22,243,241,245,225,242,101,128, 51, 20,249, + 229,239,107, 5,116, 78,116,113,116,128,116,137,116,151, 97, 2, + 116, 84,116, 99,227,233,242,227,236,229,235,239,242,229,225,110, + 128, 50,110,240,225,242,229,238,235,239,242,229,225,110,128, 50, + 14,227,233,242,227,236,229,235,239,242,229,225,110,128, 50, 96, + 235,239,242,229,225,110,128, 49, 49,240,225,242,229,238,235,239, + 242,229,225,110,128, 50, 0,243,233,239,243,235,239,242,229,225, + 110,128, 49, 51,234,229,227,249,242,233,236,236,233, 99,128, 4, + 92,108, 2,116,183,116,194,233,238,229,226,229,236,239,119,128, + 30, 53,243,241,245,225,242,101,128, 51,152,109, 3,116,211,116, + 225,116,236,227,245,226,229,228,243,241,245,225,242,101,128, 51, + 166,239,238,239,243,240,225,227,101,128,255, 75,243,241,245,225, + 242,229,228,243,241,245,225,242,101,128, 51,162,111, 5,117, 8, + 117, 34,117, 72,117, 84,117, 98,104, 2,117, 14,117, 24,233,242, + 225,231,225,238, 97,128, 48, 83,237,243,241,245,225,242,101,128, + 51,192,235, 97, 2,117, 41,117, 49,233,244,232,225,105,128, 14, + 1,244,225,235,225,238, 97,129, 48,179,117, 60,232,225,236,230, + 247,233,228,244,104,128,255,122,239,240,239,243,241,245,225,242, + 101,128, 51, 30,240,240,225,227,249,242,233,236,236,233, 99,128, + 4,129,114, 2,117,104,117,124,229,225,238,243,244,225,238,228, + 225,242,228,243,249,237,226,239,108,128, 50,127,239,238,233,243, + 227,237, 98,128, 3, 67,240, 97, 2,117,141,117,147,242,229,110, + 128, 36,166,243,241,245,225,242,101,128, 51,170,243,233,227,249, + 242,233,236,236,233, 99,128, 4,111,116, 2,117,175,117,184,243, + 241,245,225,242,101,128, 51,207,245,242,238,229,100,128, 2,158, + 117, 2,117,198,117,209,232,233,242,225,231,225,238, 97,128, 48, + 79,235,225,244,225,235,225,238, 97,129, 48,175,117,222,232,225, + 236,230,247,233,228,244,104,128,255,120,246,243,241,245,225,242, + 101,128, 51,184,247,243,241,245,225,242,101,128, 51,190,108,146, + 0,108,118, 38,120, 65,120, 94,120,160,120,198,121, 94,121,103, + 121,119,121,143,121,161,122, 23,122, 64,122,199,122,207,122,240, + 122,249,123, 1,123, 63, 97, 7,118, 54,118, 64,118, 71,118, 78, + 118,103,118,119,120, 53,226,229,238,231,225,236,105,128, 9,178, + 227,245,244,101,128, 1, 58,228,229,246, 97,128, 9, 50,231,117, + 2,118, 85,118, 94,234,225,242,225,244,105,128, 10,178,242,237, + 245,235,232,105,128, 10, 50,235,235,232,225,238,231,249,225,239, + 244,232,225,105,128, 14, 69,109, 10,118,141,119, 80,119, 97,119, + 135,119,149,119,168,119,184,119,204,119,224,119,247, 97, 2,118, + 147,119, 72,236,229,102, 4,118,159,118,173,119, 9,119, 26,230, + 233,238,225,236,225,242,225,226,233, 99,128,254,252,232,225,237, + 250, 97, 2,118,183,118,224,225,226,239,246,101, 2,118,193,118, + 207,230,233,238,225,236,225,242,225,226,233, 99,128,254,248,233, + 243,239,236,225,244,229,228,225,242,225,226,233, 99,128,254,247, + 226,229,236,239,119, 2,118,234,118,248,230,233,238,225,236,225, + 242,225,226,233, 99,128,254,250,233,243,239,236,225,244,229,228, + 225,242,225,226,233, 99,128,254,249,233,243,239,236,225,244,229, + 228,225,242,225,226,233, 99,128,254,251,237,225,228,228,225,225, + 226,239,246,101, 2,119, 41,119, 55,230,233,238,225,236,225,242, + 225,226,233, 99,128,254,246,233,243,239,236,225,244,229,228,225, + 242,225,226,233, 99,128,254,245,242,225,226,233, 99,128, 6, 68, + 226,228, 97,129, 3,187,119, 88,243,244,242,239,235,101,128, 1, + 155,229,100,130, 5,220,119,106,119,126,228,225,231,229,243,104, + 129,251, 60,119,117,232,229,226,242,229,119,128,251, 60,232,229, + 226,242,229,119,128, 5,220,230,233,238,225,236,225,242,225,226, + 233, 99,128,254,222,232,225,232,233,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,252,202,233,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,254,223,234,229,229,237,233,238,233,244, + 233,225,236,225,242,225,226,233, 99,128,252,201,235,232,225,232, + 233,238,233,244,233,225,236,225,242,225,226,233, 99,128,252,203, + 236,225,237,232,229,232,233,243,239,236,225,244,229,228,225,242, + 225,226,233, 99,128,253,242,237,101, 2,119,254,120, 11,228,233, + 225,236,225,242,225,226,233, 99,128,254,224,229,109, 2,120, 18, + 120, 37,232,225,232,233,238,233,244,233,225,236,225,242,225,226, + 233, 99,128,253,136,233,238,233,244,233,225,236,225,242,225,226, + 233, 99,128,252,204,242,231,229,227,233,242,227,236,101,128, 37, + 239, 98, 3,120, 73,120, 78,120, 84,225,114,128, 1,154,229,236, + 116,128, 2,108,239,240,239,237,239,230,111,128, 49, 12, 99, 4, + 120,104,120,111,120,120,120,147,225,242,239,110,128, 1, 62,229, + 228,233,236,236, 97,128, 1, 60,233,242, 99, 2,120,128,120,133, + 236,101,128, 36,219,245,237,230,236,229,248,226,229,236,239,119, + 128, 30, 61,239,237,237,225,225,227,227,229,238,116,128, 1, 60, + 228,239,116,130, 1, 64,120,170,120,179,225,227,227,229,238,116, + 128, 1, 64,226,229,236,239,119,129, 30, 55,120,189,237,225,227, + 242,239,110,128, 30, 57,101, 3,120,206,120,244,121, 89,230,116, + 2,120,213,120,229,225,238,231,236,229,225,226,239,246,229,227, + 237, 98,128, 3, 26,244,225,227,235,226,229,236,239,247,227,237, + 98,128, 3, 24,243,115,132, 0, 60,121, 1,121, 23,121, 35,121, + 81,229,241,245,225,108,129, 34,100,121, 11,239,242,231,242,229, + 225,244,229,114,128, 34,218,237,239,238,239,243,240,225,227,101, + 128,255, 28,111, 2,121, 41,121, 70,114, 2,121, 47,121, 60,229, + 241,245,233,246,225,236,229,238,116,128, 34,114,231,242,229,225, + 244,229,114,128, 34,118,246,229,242,229,241,245,225,108,128, 34, + 102,243,237,225,236,108,128,254,100,250,104,128, 2,110,230,226, + 236,239,227,107,128, 37,140,232,239,239,235,242,229,244,242,239, + 230,236,229,120,128, 2,109,105, 2,121,125,121,130,242, 97,128, + 32,164,247,238,225,242,237,229,238,233,225,110,128, 5,108,106, + 129, 1,201,121,149,229,227,249,242,233,236,236,233, 99,128, 4, + 89,108,132,246,192,121,173,121,197,121,208,121,217, 97, 2,121, + 179,121,186,228,229,246, 97,128, 9, 51,231,245,234,225,242,225, + 244,105,128, 10,179,233,238,229,226,229,236,239,119,128, 30, 59, + 236,225,228,229,246, 97,128, 9, 52,246,239,227,225,236,233, 99, + 3,121,231,121,241,121,248,226,229,238,231,225,236,105,128, 9, + 225,228,229,246, 97,128, 9, 97,246,239,247,229,236,243,233,231, + 110, 2,122, 6,122, 16,226,229,238,231,225,236,105,128, 9,227, + 228,229,246, 97,128, 9, 99,109, 3,122, 31,122, 44,122, 55,233, + 228,228,236,229,244,233,236,228,101,128, 2,107,239,238,239,243, + 240,225,227,101,128,255, 76,243,241,245,225,242,101,128, 51,208, + 111, 6,122, 78,122, 90,122,132,122,143,122,149,122,191,227,232, + 245,236,225,244,232,225,105,128, 14, 44,231,233,227,225,108, 3, + 122,102,122,108,122,127,225,238,100,128, 34, 39,238,239,116,129, + 0,172,122,116,242,229,246,229,242,243,229,100,128, 35, 16,239, + 114,128, 34, 40,236,233,238,231,244,232,225,105,128, 14, 37,238, + 231,115,128, 1,127,247,236,233,238,101, 2,122,159,122,182, 99, + 2,122,165,122,177,229,238,244,229,242,236,233,238,101,128,254, + 78,237, 98,128, 3, 50,228,225,243,232,229,100,128,254, 77,250, + 229,238,231,101,128, 37,202,240,225,242,229,110,128, 36,167,115, + 3,122,215,122,222,122,230,236,225,243,104,128, 1, 66,241,245, + 225,242,101,128, 33, 19,245,240,229,242,233,239,114,128,246,238, + 244,243,232,225,228,101,128, 37,145,245,244,232,225,105,128, 14, + 38,246,239,227,225,236,233, 99, 3,123, 15,123, 25,123, 32,226, + 229,238,231,225,236,105,128, 9,140,228,229,246, 97,128, 9, 12, + 246,239,247,229,236,243,233,231,110, 2,123, 46,123, 56,226,229, + 238,231,225,236,105,128, 9,226,228,229,246, 97,128, 9, 98,248, + 243,241,245,225,242,101,128, 51,211,109,144, 0,109,123,109,125, + 218,125,243,126, 14,126, 39,127, 92,127,114,128,169,128,199,128, + 248,129, 99,129,121,129,146,129,155,130,182,130,210, 97, 12,123, + 135,123,145,123,209,123,216,123,241,124, 33,125,125,125,150,125, + 155,125,169,125,181,125,186,226,229,238,231,225,236,105,128, 9, + 174, 99, 2,123,151,123,203,242,239,110,132, 0,175,123,165,123, + 176,123,182,123,191,226,229,236,239,247,227,237, 98,128, 3, 49, + 227,237, 98,128, 3, 4,236,239,247,237,239,100,128, 2,205,237, + 239,238,239,243,240,225,227,101,128,255,227,245,244,101,128, 30, + 63,228,229,246, 97,128, 9, 46,231,117, 2,123,223,123,232,234, + 225,242,225,244,105,128, 10,174,242,237,245,235,232,105,128, 10, + 46,104, 2,123,247,124, 23,225,240,225,235,104, 2,124, 1,124, + 10,232,229,226,242,229,119,128, 5,164,236,229,230,244,232,229, + 226,242,229,119,128, 5,164,233,242,225,231,225,238, 97,128, 48, + 126,105, 5,124, 45,124,114,124,177,124,207,125,113,227,232,225, + 244,244,225,247, 97, 3,124, 60,124, 91,124, 98,236,239,119, 2, + 124, 68,124, 79,236,229,230,244,244,232,225,105,128,248,149,242, + 233,231,232,244,244,232,225,105,128,248,148,244,232,225,105,128, + 14, 75,245,240,240,229,242,236,229,230,244,244,232,225,105,128, + 248,147,229,107, 3,124,123,124,154,124,161,236,239,119, 2,124, + 131,124,142,236,229,230,244,244,232,225,105,128,248,140,242,233, + 231,232,244,244,232,225,105,128,248,139,244,232,225,105,128, 14, + 72,245,240,240,229,242,236,229,230,244,244,232,225,105,128,248, + 138,232,225,238,225,235,225,116, 2,124,189,124,200,236,229,230, + 244,244,232,225,105,128,248,132,244,232,225,105,128, 14, 49,116, + 3,124,215,124,243,125, 50,225,233,235,232,117, 2,124,225,124, + 236,236,229,230,244,244,232,225,105,128,248,137,244,232,225,105, + 128, 14, 71,232,111, 3,124,252,125, 27,125, 34,236,239,119, 2, + 125, 4,125, 15,236,229,230,244,244,232,225,105,128,248,143,242, + 233,231,232,244,244,232,225,105,128,248,142,244,232,225,105,128, + 14, 73,245,240,240,229,242,236,229,230,244,244,232,225,105,128, + 248,141,242,105, 3,125, 59,125, 90,125, 97,236,239,119, 2,125, + 67,125, 78,236,229,230,244,244,232,225,105,128,248,146,242,233, + 231,232,244,244,232,225,105,128,248,145,244,232,225,105,128, 14, + 74,245,240,240,229,242,236,229,230,244,244,232,225,105,128,248, + 144,249,225,237,239,235,244,232,225,105,128, 14, 70,235,225,244, + 225,235,225,238, 97,129, 48,222,125,138,232,225,236,230,247,233, + 228,244,104,128,255,143,236,101,128, 38, 66,238,243,249,239,238, + 243,241,245,225,242,101,128, 51, 71,241,225,230,232,229,226,242, + 229,119,128, 5,190,242,115,128, 38, 66,115, 2,125,192,125,210, + 239,242,225,227,233,242,227,236,229,232,229,226,242,229,119,128, + 5,175,241,245,225,242,101,128, 51,131, 98, 2,125,224,125,234, + 239,240,239,237,239,230,111,128, 49, 7,243,241,245,225,242,101, + 128, 51,212, 99, 2,125,249,126, 1,233,242,227,236,101,128, 36, + 220,245,226,229,228,243,241,245,225,242,101,128, 51,165,228,239, + 116, 2,126, 22,126, 31,225,227,227,229,238,116,128, 30, 65,226, + 229,236,239,119,128, 30, 67,101, 7,126, 55,126,182,126,193,126, + 208,126,233,127, 14,127, 26,101, 2,126, 61,126,169,109, 4,126, + 71,126, 80,126, 94,126,110,225,242,225,226,233, 99,128, 6, 69, + 230,233,238,225,236,225,242,225,226,233, 99,128,254,226,233,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,254,227,237,101, + 2,126,117,126,130,228,233,225,236,225,242,225,226,233, 99,128, + 254,228,229,237,105, 2,126,138,126,153,238,233,244,233,225,236, + 225,242,225,226,233, 99,128,252,209,243,239,236,225,244,229,228, + 225,242,225,226,233, 99,128,252, 72,244,239,242,245,243,241,245, + 225,242,101,128, 51, 77,232,233,242,225,231,225,238, 97,128, 48, + 129,233,250,233,229,242,225,243,241,245,225,242,101,128, 51,126, + 235,225,244,225,235,225,238, 97,129, 48,225,126,221,232,225,236, + 230,247,233,228,244,104,128,255,146,109,130, 5,222,126,241,127, + 5,228,225,231,229,243,104,129,251, 62,126,252,232,229,226,242, + 229,119,128,251, 62,232,229,226,242,229,119,128, 5,222,238,225, + 242,237,229,238,233,225,110,128, 5,116,242,235,232, 97, 3,127, + 37,127, 46,127, 79,232,229,226,242,229,119,128, 5,165,235,229, + 230,245,236, 97, 2,127, 57,127, 66,232,229,226,242,229,119,128, + 5,166,236,229,230,244,232,229,226,242,229,119,128, 5,166,236, + 229,230,244,232,229,226,242,229,119,128, 5,165,104, 2,127, 98, + 127,104,239,239,107,128, 2,113,250,243,241,245,225,242,101,128, + 51,146,105, 6,127,128,127,165,128, 46,128, 57,128, 82,128,139, + 228,100, 2,127,135,127,160,236,229,228,239,244,235,225,244,225, + 235,225,238,225,232,225,236,230,247,233,228,244,104,128,255,101, + 239,116,128, 0,183,229,245,109, 5,127,179,127,214,127,229,127, + 238,128, 33, 97, 2,127,185,127,200,227,233,242,227,236,229,235, + 239,242,229,225,110,128, 50,114,240,225,242,229,238,235,239,242, + 229,225,110,128, 50, 18,227,233,242,227,236,229,235,239,242,229, + 225,110,128, 50,100,235,239,242,229,225,110,128, 49, 65,112, 2, + 127,244,128, 20, 97, 2,127,250,128, 8,238,243,233,239,243,235, + 239,242,229,225,110,128, 49,112,242,229,238,235,239,242,229,225, + 110,128, 50, 4,233,229,245,240,235,239,242,229,225,110,128, 49, + 110,243,233,239,243,235,239,242,229,225,110,128, 49,111,232,233, + 242,225,231,225,238, 97,128, 48,127,235,225,244,225,235,225,238, + 97,129, 48,223,128, 70,232,225,236,230,247,233,228,244,104,128, + 255,144,238,117, 2,128, 89,128,134,115,132, 34, 18,128,101,128, + 112,128,121,128,127,226,229,236,239,247,227,237, 98,128, 3, 32, + 227,233,242,227,236,101,128, 34,150,237,239,100,128, 2,215,240, + 236,245,115,128, 34, 19,244,101,128, 32, 50,242,105, 2,128,146, + 128,160,226,225,225,242,245,243,241,245,225,242,101,128, 51, 74, + 243,241,245,225,242,101,128, 51, 73,108, 2,128,175,128,190,239, + 238,231,236,229,231,244,245,242,238,229,100,128, 2,112,243,241, + 245,225,242,101,128, 51,150,109, 3,128,207,128,221,128,232,227, + 245,226,229,228,243,241,245,225,242,101,128, 51,163,239,238,239, + 243,240,225,227,101,128,255, 77,243,241,245,225,242,229,228,243, + 241,245,225,242,101,128, 51,159,111, 5,129, 4,129, 30,129, 55, + 129, 65,129, 74,104, 2,129, 10,129, 20,233,242,225,231,225,238, + 97,128, 48,130,237,243,241,245,225,242,101,128, 51,193,235,225, + 244,225,235,225,238, 97,129, 48,226,129, 43,232,225,236,230,247, + 233,228,244,104,128,255,147,236,243,241,245,225,242,101,128, 51, + 214,237,225,244,232,225,105,128, 14, 33,246,229,242,243,243,241, + 245,225,242,101,129, 51,167,129, 89,228,243,241,245,225,242,101, + 128, 51,168,240, 97, 2,129,106,129,112,242,229,110,128, 36,168, + 243,241,245,225,242,101,128, 51,171,115, 2,129,127,129,136,243, + 241,245,225,242,101,128, 51,179,245,240,229,242,233,239,114,128, + 246,239,244,245,242,238,229,100,128, 2,111,117,141, 0,181,129, + 185,129,189,129,199,129,223,129,233,129,255,130, 10,130, 35,130, + 58,130, 68,130, 98,130,162,130,172, 49,128, 0,181,225,243,241, + 245,225,242,101,128, 51,130,227,104, 2,129,206,129,216,231,242, + 229,225,244,229,114,128, 34,107,236,229,243,115,128, 34,106,230, + 243,241,245,225,242,101,128, 51,140,103, 2,129,239,129,246,242, + 229,229,107,128, 3,188,243,241,245,225,242,101,128, 51,141,232, + 233,242,225,231,225,238, 97,128, 48,128,235,225,244,225,235,225, + 238, 97,129, 48,224,130, 23,232,225,236,230,247,233,228,244,104, + 128,255,145,108, 2,130, 41,130, 50,243,241,245,225,242,101,128, + 51,149,244,233,240,236,121,128, 0,215,237,243,241,245,225,242, + 101,128, 51,155,238,225,104, 2,130, 76,130, 85,232,229,226,242, + 229,119,128, 5,163,236,229,230,244,232,229,226,242,229,119,128, + 5,163,115, 2,130,104,130,153,233, 99, 3,130,113,130,130,130, + 141,225,236,238,239,244,101,129, 38,106,130,124,228,226,108,128, + 38,107,230,236,225,244,243,233,231,110,128, 38,109,243,232,225, + 242,240,243,233,231,110,128, 38,111,243,241,245,225,242,101,128, + 51,178,246,243,241,245,225,242,101,128, 51,182,247,243,241,245, + 225,242,101,128, 51,188,118, 2,130,188,130,201,237,229,231,225, + 243,241,245,225,242,101,128, 51,185,243,241,245,225,242,101,128, + 51,183,119, 2,130,216,130,229,237,229,231,225,243,241,245,225, + 242,101,128, 51,191,243,241,245,225,242,101,128, 51,189,110,150, + 0,110,131, 30,131,164,131,188,131,254,132, 23,132, 81,132, 91, + 132,158,132,201,134,235,134,253,135, 22,135, 53,135, 79,135,144, + 137,126,137,134,137,159,137,167,138,135,138,145,138,155, 97, 8, + 131, 48,131, 68,131, 75,131, 82,131,107,131,118,131,143,131,155, + 98, 2,131, 54,131, 63,229,238,231,225,236,105,128, 9,168,236, + 97,128, 34, 7,227,245,244,101,128, 1, 68,228,229,246, 97,128, + 9, 40,231,117, 2,131, 89,131, 98,234,225,242,225,244,105,128, + 10,168,242,237,245,235,232,105,128, 10, 40,232,233,242,225,231, + 225,238, 97,128, 48,106,235,225,244,225,235,225,238, 97,129, 48, + 202,131,131,232,225,236,230,247,233,228,244,104,128,255,133,240, + 239,243,244,242,239,240,232,101,128, 1, 73,243,241,245,225,242, + 101,128, 51,129, 98, 2,131,170,131,180,239,240,239,237,239,230, + 111,128, 49, 11,243,240,225,227,101,128, 0,160, 99, 4,131,198, + 131,205,131,214,131,241,225,242,239,110,128, 1, 72,229,228,233, + 236,236, 97,128, 1, 70,233,242, 99, 2,131,222,131,227,236,101, + 128, 36,221,245,237,230,236,229,248,226,229,236,239,119,128, 30, + 75,239,237,237,225,225,227,227,229,238,116,128, 1, 70,228,239, + 116, 2,132, 6,132, 15,225,227,227,229,238,116,128, 30, 69,226, + 229,236,239,119,128, 30, 71,101, 3,132, 31,132, 42,132, 67,232, + 233,242,225,231,225,238, 97,128, 48,109,235,225,244,225,235,225, + 238, 97,129, 48,205,132, 55,232,225,236,230,247,233,228,244,104, + 128,255,136,247,243,232,229,241,229,236,243,233,231,110,128, 32, + 170,230,243,241,245,225,242,101,128, 51,139,103, 2,132, 97,132, + 147, 97, 3,132,105,132,115,132,122,226,229,238,231,225,236,105, + 128, 9,153,228,229,246, 97,128, 9, 25,231,117, 2,132,129,132, + 138,234,225,242,225,244,105,128, 10,153,242,237,245,235,232,105, + 128, 10, 25,239,238,231,245,244,232,225,105,128, 14, 7,104, 2, + 132,164,132,174,233,242,225,231,225,238, 97,128, 48,147,239,239, + 107, 2,132,182,132,189,236,229,230,116,128, 2,114,242,229,244, + 242,239,230,236,229,120,128, 2,115,105, 4,132,211,133,124,133, + 135,133,193,229,245,110, 7,132,229,133, 8,133, 40,133, 54,133, + 63,133, 96,133,109, 97, 2,132,235,132,250,227,233,242,227,236, + 229,235,239,242,229,225,110,128, 50,111,240,225,242,229,238,235, + 239,242,229,225,110,128, 50, 15,227,105, 2,133, 15,133, 27,229, + 245,227,235,239,242,229,225,110,128, 49, 53,242,227,236,229,235, + 239,242,229,225,110,128, 50, 97,232,233,229,245,232,235,239,242, + 229,225,110,128, 49, 54,235,239,242,229,225,110,128, 49, 52,240, + 97, 2,133, 70,133, 84,238,243,233,239,243,235,239,242,229,225, + 110,128, 49,104,242,229,238,235,239,242,229,225,110,128, 50, 1, + 243,233,239,243,235,239,242,229,225,110,128, 49,103,244,233,235, + 229,245,244,235,239,242,229,225,110,128, 49,102,232,233,242,225, + 231,225,238, 97,128, 48,107,107, 2,133,141,133,165,225,244,225, + 235,225,238, 97,129, 48,203,133,153,232,225,236,230,247,233,228, + 244,104,128,255,134,232,225,232,233,116, 2,133,175,133,186,236, + 229,230,244,244,232,225,105,128,248,153,244,232,225,105,128, 14, + 77,238,101,141, 0, 57,133,224,133,233,133,243,134, 17,134, 24, + 134, 49,134, 76,134,110,134,122,134,133,134,166,134,174,134,185, + 225,242,225,226,233, 99,128, 6,105,226,229,238,231,225,236,105, + 128, 9,239,227,233,242,227,236,101,129, 36,104,133,254,233,238, + 246,229,242,243,229,243,225,238,243,243,229,242,233,102,128, 39, + 146,228,229,246, 97,128, 9,111,231,117, 2,134, 31,134, 40,234, + 225,242,225,244,105,128, 10,239,242,237,245,235,232,105,128, 10, + 111,232, 97, 2,134, 56,134, 67,227,235,225,242,225,226,233, 99, + 128, 6,105,238,231,250,232,239,117,128, 48, 41,105, 2,134, 82, + 134,100,228,229,239,231,242,225,240,232,233,227,240,225,242,229, + 110,128, 50, 40,238,230,229,242,233,239,114,128, 32,137,237,239, + 238,239,243,240,225,227,101,128,255, 25,239,236,228,243,244,249, + 236,101,128,247, 57,112, 2,134,139,134,146,225,242,229,110,128, + 36,124,229,114, 2,134,153,134,159,233,239,100,128, 36,144,243, + 233,225,110,128, 6,249,242,239,237,225,110,128, 33,120,243,245, + 240,229,242,233,239,114,128, 32,121,116, 2,134,191,134,229,229, + 229,110, 2,134,199,134,208,227,233,242,227,236,101,128, 36,114, + 112, 2,134,214,134,221,225,242,229,110,128, 36,134,229,242,233, + 239,100,128, 36,154,232,225,105,128, 14, 89,106,129, 1,204,134, + 241,229,227,249,242,233,236,236,233, 99,128, 4, 90,235,225,244, + 225,235,225,238, 97,129, 48,243,135, 10,232,225,236,230,247,233, + 228,244,104,128,255,157,108, 2,135, 28,135, 42,229,231,242,233, + 231,232,244,236,239,238,103,128, 1,158,233,238,229,226,229,236, + 239,119,128, 30, 73,109, 2,135, 59,135, 70,239,238,239,243,240, + 225,227,101,128,255, 78,243,241,245,225,242,101,128, 51,154,110, + 2,135, 85,135,135, 97, 3,135, 93,135,103,135,110,226,229,238, + 231,225,236,105,128, 9,163,228,229,246, 97,128, 9, 35,231,117, + 2,135,117,135,126,234,225,242,225,244,105,128, 10,163,242,237, + 245,235,232,105,128, 10, 35,238,225,228,229,246, 97,128, 9, 41, + 111, 6,135,158,135,169,135,194,135,235,136,187,137,114,232,233, + 242,225,231,225,238, 97,128, 48,110,235,225,244,225,235,225,238, + 97,129, 48,206,135,182,232,225,236,230,247,233,228,244,104,128, + 255,137,110, 3,135,202,135,218,135,227,226,242,229,225,235,233, + 238,231,243,240,225,227,101,128, 0,160,229,238,244,232,225,105, + 128, 14, 19,245,244,232,225,105,128, 14, 25,239,110, 7,135,252, + 136, 5,136, 19,136, 53,136, 69,136,110,136,169,225,242,225,226, + 233, 99,128, 6, 70,230,233,238,225,236,225,242,225,226,233, 99, + 128,254,230,231,232,245,238,238, 97, 2,136, 30,136, 39,225,242, + 225,226,233, 99,128, 6,186,230,233,238,225,236,225,242,225,226, + 233, 99,128,251,159,233,238,233,244,233,225,236,225,242,225,226, + 233, 99,128,254,231,234,229,229,237,105, 2,136, 79,136, 94,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,252,210,243,239, + 236,225,244,229,228,225,242,225,226,233, 99,128,252, 75,237,101, + 2,136,117,136,130,228,233,225,236,225,242,225,226,233, 99,128, + 254,232,229,237,105, 2,136,138,136,153,238,233,244,233,225,236, + 225,242,225,226,233, 99,128,252,213,243,239,236,225,244,229,228, + 225,242,225,226,233, 99,128,252, 78,238,239,239,238,230,233,238, + 225,236,225,242,225,226,233, 99,128,252,141,116, 7,136,203,136, + 214,136,243,137, 22,137, 34,137, 54,137, 80,227,239,238,244,225, + 233,238,115,128, 34, 12,101, 2,136,220,136,236,236,229,237,229, + 238,116,129, 34, 9,136,231,239,102,128, 34, 9,241,245,225,108, + 128, 34, 96,231,242,229,225,244,229,114,129, 34,111,136,255,238, + 239,114, 2,137, 7,137, 15,229,241,245,225,108,128, 34,113,236, + 229,243,115,128, 34,121,233,228,229,238,244,233,227,225,108,128, + 34, 98,236,229,243,115,129, 34,110,137, 43,238,239,242,229,241, + 245,225,108,128, 34,112,112, 2,137, 60,137, 70,225,242,225,236, + 236,229,108,128, 34, 38,242,229,227,229,228,229,115,128, 34,128, + 243,117, 3,137, 89,137, 96,137,105,226,243,229,116,128, 34,132, + 227,227,229,229,228,115,128, 34,129,240,229,242,243,229,116,128, + 34,133,247,225,242,237,229,238,233,225,110,128, 5,118,240,225, + 242,229,110,128, 36,169,115, 2,137,140,137,149,243,241,245,225, + 242,101,128, 51,177,245,240,229,242,233,239,114,128, 32,127,244, + 233,236,228,101,128, 0,241,117,132, 3,189,137,179,137,190,138, + 15,138, 98,232,233,242,225,231,225,238, 97,128, 48,108,107, 2, + 137,196,137,220,225,244,225,235,225,238, 97,129, 48,204,137,208, + 232,225,236,230,247,233,228,244,104,128,255,135,244, 97, 3,137, + 229,137,239,137,246,226,229,238,231,225,236,105,128, 9,188,228, + 229,246, 97,128, 9, 60,231,117, 2,137,253,138, 6,234,225,242, + 225,244,105,128, 10,188,242,237,245,235,232,105,128, 10, 60,109, + 2,138, 21,138, 55,226,229,242,243,233,231,110,130, 0, 35,138, + 35,138, 47,237,239,238,239,243,240,225,227,101,128,255, 3,243, + 237,225,236,108,128,254, 95,229,114, 2,138, 62,138, 94,225,236, + 243,233,231,110, 2,138, 73,138, 81,231,242,229,229,107,128, 3, + 116,236,239,247,229,242,231,242,229,229,107,128, 3,117,111,128, + 33, 22,110,130, 5,224,138,106,138,126,228,225,231,229,243,104, + 129,251, 64,138,117,232,229,226,242,229,119,128,251, 64,232,229, + 226,242,229,119,128, 5,224,246,243,241,245,225,242,101,128, 51, + 181,247,243,241,245,225,242,101,128, 51,187,249, 97, 3,138,164, + 138,174,138,181,226,229,238,231,225,236,105,128, 9,158,228,229, + 246, 97,128, 9, 30,231,117, 2,138,188,138,197,234,225,242,225, + 244,105,128, 10,158,242,237,245,235,232,105,128, 10, 30,111,147, + 0,111,138,248,139, 14,139, 92,140, 6,140, 78,140, 93,140,133, + 141, 0,141, 21,141, 59,141, 70,141,248,143, 82,143,146,143,179, + 143,225,144, 98,144,145,144,157, 97, 2,138,254,139, 5,227,245, + 244,101,128, 0,243,238,231,244,232,225,105,128, 14, 45, 98, 4, + 139, 24,139, 66,139, 75,139, 85,225,242,242,229,100,130, 2,117, + 139, 36,139, 47,227,249,242,233,236,236,233, 99,128, 4,233,228, + 233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99,128, + 4,235,229,238,231,225,236,105,128, 9,147,239,240,239,237,239, + 230,111,128, 49, 27,242,229,246,101,128, 1, 79, 99, 3,139,100, + 139,173,139,252, 97, 2,139,106,139,167,238,228,242, 97, 3,139, + 117,139,124,139,135,228,229,246, 97,128, 9, 17,231,245,234,225, + 242,225,244,105,128, 10,145,246,239,247,229,236,243,233,231,110, + 2,139,149,139,156,228,229,246, 97,128, 9, 73,231,245,234,225, + 242,225,244,105,128, 10,201,242,239,110,128, 1,210,233,242, 99, + 2,139,181,139,186,236,101,128, 36,222,245,237,230,236,229,120, + 133, 0,244,139,205,139,213,139,224,139,232,139,244,225,227,245, + 244,101,128, 30,209,228,239,244,226,229,236,239,119,128, 30,217, + 231,242,225,246,101,128, 30,211,232,239,239,235,225,226,239,246, + 101,128, 30,213,244,233,236,228,101,128, 30,215,249,242,233,236, + 236,233, 99,128, 4, 62,100, 4,140, 16,140, 39,140, 45,140, 68, + 226,108, 2,140, 23,140, 31,225,227,245,244,101,128, 1, 81,231, + 242,225,246,101,128, 2, 13,229,246, 97,128, 9, 19,233,229,242, + 229,243,233,115,129, 0,246,140, 57,227,249,242,233,236,236,233, + 99,128, 4,231,239,244,226,229,236,239,119,128, 30,205,101,129, + 1, 83,140, 84,235,239,242,229,225,110,128, 49, 90,103, 3,140, + 101,140,116,140,123,239,238,229,107,129, 2,219,140,110,227,237, + 98,128, 3, 40,242,225,246,101,128, 0,242,245,234,225,242,225, + 244,105,128, 10,147,104, 4,140,143,140,154,140,164,140,242,225, + 242,237,229,238,233,225,110,128, 5,133,233,242,225,231,225,238, + 97,128, 48, 74,111, 2,140,170,140,180,239,235,225,226,239,246, + 101,128, 30,207,242,110,133, 1,161,140,195,140,203,140,214,140, + 222,140,234,225,227,245,244,101,128, 30,219,228,239,244,226,229, + 236,239,119,128, 30,227,231,242,225,246,101,128, 30,221,232,239, + 239,235,225,226,239,246,101,128, 30,223,244,233,236,228,101,128, + 30,225,245,238,231,225,242,245,237,236,225,245,116,128, 1, 81, + 105,129, 1,163,141, 6,238,246,229,242,244,229,228,226,242,229, + 246,101,128, 2, 15,107, 2,141, 27,141, 51,225,244,225,235,225, + 238, 97,129, 48,170,141, 39,232,225,236,230,247,233,228,244,104, + 128,255,117,239,242,229,225,110,128, 49, 87,236,229,232,229,226, + 242,229,119,128, 5,171,109, 6,141, 84,141,112,141,119,141,208, + 141,219,141,237,225,227,242,239,110,130, 1, 77,141, 96,141,104, + 225,227,245,244,101,128, 30, 83,231,242,225,246,101,128, 30, 81, + 228,229,246, 97,128, 9, 80,229,231, 97,133, 3,201,141,135,141, + 139,141,150,141,164,141,180, 49,128, 3,214,227,249,242,233,236, + 236,233, 99,128, 4, 97,236,225,244,233,238,227,236,239,243,229, + 100,128, 2,119,242,239,245,238,228,227,249,242,233,236,236,233, + 99,128, 4,123,116, 2,141,186,141,201,233,244,236,239,227,249, + 242,233,236,236,233, 99,128, 4,125,239,238,239,115,128, 3,206, + 231,245,234,225,242,225,244,105,128, 10,208,233,227,242,239,110, + 129, 3,191,141,229,244,239,238,239,115,128, 3,204,239,238,239, + 243,240,225,227,101,128,255, 79,238,101,145, 0, 49,142, 31,142, + 40,142, 50,142, 80,142,105,142,114,142,123,142,148,142,182,142, + 216,142,228,142,247,143, 2,143, 35,143, 45,143, 53,143, 64,225, + 242,225,226,233, 99,128, 6, 97,226,229,238,231,225,236,105,128, + 9,231,227,233,242,227,236,101,129, 36, 96,142, 61,233,238,246, + 229,242,243,229,243,225,238,243,243,229,242,233,102,128, 39,138, + 100, 2,142, 86,142, 92,229,246, 97,128, 9,103,239,244,229,238, + 236,229,225,228,229,114,128, 32, 36,229,233,231,232,244,104,128, + 33, 91,230,233,244,244,229,100,128,246,220,231,117, 2,142,130, + 142,139,234,225,242,225,244,105,128, 10,231,242,237,245,235,232, + 105,128, 10,103,232, 97, 3,142,157,142,168,142,173,227,235,225, + 242,225,226,233, 99,128, 6, 97,236,102,128, 0,189,238,231,250, + 232,239,117,128, 48, 33,105, 2,142,188,142,206,228,229,239,231, + 242,225,240,232,233,227,240,225,242,229,110,128, 50, 32,238,230, + 229,242,233,239,114,128, 32,129,237,239,238,239,243,240,225,227, + 101,128,255, 17,238,245,237,229,242,225,244,239,242,226,229,238, + 231,225,236,105,128, 9,244,239,236,228,243,244,249,236,101,128, + 247, 49,112, 2,143, 8,143, 15,225,242,229,110,128, 36,116,229, + 114, 2,143, 22,143, 28,233,239,100,128, 36,136,243,233,225,110, + 128, 6,241,241,245,225,242,244,229,114,128, 0,188,242,239,237, + 225,110,128, 33,112,243,245,240,229,242,233,239,114,128, 0,185, + 244,104, 2,143, 71,143, 76,225,105,128, 14, 81,233,242,100,128, + 33, 83,111, 3,143, 90,143,124,143,140,103, 2,143, 96,143,114, + 239,238,229,107,129, 1,235,143,105,237,225,227,242,239,110,128, + 1,237,245,242,237,245,235,232,105,128, 10, 19,237,225,244,242, + 225,231,245,242,237,245,235,232,105,128, 10, 75,240,229,110,128, + 2, 84,112, 3,143,154,143,161,143,172,225,242,229,110,128, 36, + 170,229,238,226,245,236,236,229,116,128, 37,230,244,233,239,110, + 128, 35, 37,114, 2,143,185,143,214,100, 2,143,191,143,202,230, + 229,237,233,238,233,238,101,128, 0,170,237,225,243,227,245,236, + 233,238,101,128, 0,186,244,232,239,231,239,238,225,108,128, 34, + 31,115, 5,143,237,144, 13,144, 30,144, 75,144, 88,232,239,242, + 116, 2,143,246,143,253,228,229,246, 97,128, 9, 18,246,239,247, + 229,236,243,233,231,238,228,229,246, 97,128, 9, 74,236,225,243, + 104,129, 0,248,144, 22,225,227,245,244,101,128, 1,255,237,225, + 236,108, 2,144, 39,144, 50,232,233,242,225,231,225,238, 97,128, + 48, 73,235,225,244,225,235,225,238, 97,129, 48,169,144, 63,232, + 225,236,230,247,233,228,244,104,128,255,107,244,242,239,235,229, + 225,227,245,244,101,128, 1,255,245,240,229,242,233,239,114,128, + 246,240,116, 2,144,104,144,115,227,249,242,233,236,236,233, 99, + 128, 4,127,233,236,228,101,130, 0,245,144,126,144,134,225,227, + 245,244,101,128, 30, 77,228,233,229,242,229,243,233,115,128, 30, + 79,245,226,239,240,239,237,239,230,111,128, 49, 33,118, 2,144, + 163,144,244,229,114, 2,144,170,144,236,236,233,238,101,131, 32, + 62,144,183,144,206,144,229, 99, 2,144,189,144,201,229,238,244, + 229,242,236,233,238,101,128,254, 74,237, 98,128, 3, 5,100, 2, + 144,212,144,220,225,243,232,229,100,128,254, 73,226,236,247,225, + 246,121,128,254, 76,247,225,246,121,128,254, 75,243,227,239,242, + 101,128, 0,175,239,247,229,236,243,233,231,110, 3,145, 3,145, + 13,145, 20,226,229,238,231,225,236,105,128, 9,203,228,229,246, + 97,128, 9, 75,231,245,234,225,242,225,244,105,128, 10,203,112, + 145, 0,112,145, 69,147,197,147,208,147,217,147,229,149,154,149, + 164,150,156,151,175,152, 9,152, 35,152,166,152,174,153, 76,153, + 134,153,162,153,172, 97, 14,145, 99,145,131,145,141,145,148,145, + 155,145,203,145,214,145,228,145,239,146, 30,146, 44,147, 56,147, + 95,147,185, 97, 2,145,105,145,117,237,240,243,243,241,245,225, + 242,101,128, 51,128,243,229,238,244,239,243,241,245,225,242,101, + 128, 51, 43,226,229,238,231,225,236,105,128, 9,170,227,245,244, + 101,128, 30, 85,228,229,246, 97,128, 9, 42,103, 2,145,161,145, + 179,101, 2,145,167,145,174,228,239,247,110,128, 33,223,245,112, + 128, 33,222,117, 2,145,185,145,194,234,225,242,225,244,105,128, + 10,170,242,237,245,235,232,105,128, 10, 42,232,233,242,225,231, + 225,238, 97,128, 48,113,233,249,225,238,238,239,233,244,232,225, + 105,128, 14, 47,235,225,244,225,235,225,238, 97,128, 48,209,108, + 2,145,245,146, 14,225,244,225,236,233,250,225,244,233,239,238, + 227,249,242,233,236,236,233,227,227,237, 98,128, 4,132,239,227, + 232,235,225,227,249,242,233,236,236,233, 99,128, 4,192,238,243, + 233,239,243,235,239,242,229,225,110,128, 49,127,114, 3,146, 52, + 146, 73,147, 45, 97, 2,146, 58,146, 66,231,242,225,240,104,128, + 0,182,236,236,229,108,128, 34, 37,229,110, 2,146, 80,146,190, + 236,229,230,116,136, 0, 40,146,103,146,118,146,123,146,128,146, + 139,146,151,146,174,146,179,225,236,244,239,238,229,225,242,225, + 226,233, 99,128,253, 62,226,116,128,248,237,229,120,128,248,236, + 233,238,230,229,242,233,239,114,128, 32,141,237,239,238,239,243, + 240,225,227,101,128,255, 8,115, 2,146,157,146,164,237,225,236, + 108,128,254, 89,245,240,229,242,233,239,114,128, 32,125,244,112, + 128,248,235,246,229,242,244,233,227,225,108,128,254, 53,242,233, + 231,232,116,136, 0, 41,146,214,146,229,146,234,146,239,146,250, + 147, 6,147, 29,147, 34,225,236,244,239,238,229,225,242,225,226, + 233, 99,128,253, 63,226,116,128,248,248,229,120,128,248,247,233, + 238,230,229,242,233,239,114,128, 32,142,237,239,238,239,243,240, + 225,227,101,128,255, 9,115, 2,147, 12,147, 19,237,225,236,108, + 128,254, 90,245,240,229,242,233,239,114,128, 32,126,244,112,128, + 248,246,246,229,242,244,233,227,225,108,128,254, 54,244,233,225, + 236,228,233,230,102,128, 34, 2,115, 3,147, 64,147, 75,147, 87, + 229,241,232,229,226,242,229,119,128, 5,192,232,244,225,232,229, + 226,242,229,119,128, 5,153,241,245,225,242,101,128, 51,169,244, + 225,104,134, 5,183,147,113,147,127,147,132,147,141,147,156,147, + 172, 49, 2,147,119,147,123, 49,128, 5,183,100,128, 5,183,178, + 97,128, 5,183,232,229,226,242,229,119,128, 5,183,238,225,242, + 242,239,247,232,229,226,242,229,119,128, 5,183,241,245,225,242, + 244,229,242,232,229,226,242,229,119,128, 5,183,247,233,228,229, + 232,229,226,242,229,119,128, 5,183,250,229,242,232,229,226,242, + 229,119,128, 5,161,226,239,240,239,237,239,230,111,128, 49, 6, + 227,233,242,227,236,101,128, 36,223,228,239,244,225,227,227,229, + 238,116,128, 30, 87,101,137, 5,228,147,251,148, 6,148, 26,148, + 38,148, 58,148,160,148,171,148,192,149,147,227,249,242,233,236, + 236,233, 99,128, 4, 63,228,225,231,229,243,104,129,251, 68,148, + 17,232,229,226,242,229,119,128,251, 68,229,250,233,243,241,245, + 225,242,101,128, 51, 59,230,233,238,225,236,228,225,231,229,243, + 232,232,229,226,242,229,119,128,251, 67,104, 5,148, 70,148, 93, + 148,101,148,115,148,145,225,114, 2,148, 77,148, 84,225,226,233, + 99,128, 6,126,237,229,238,233,225,110,128, 5,122,229,226,242, + 229,119,128, 5,228,230,233,238,225,236,225,242,225,226,233, 99, + 128,251, 87,105, 2,148,121,148,136,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,251, 88,242,225,231,225,238, 97,128, 48, + 122,237,229,228,233,225,236,225,242,225,226,233, 99,128,251, 89, + 235,225,244,225,235,225,238, 97,128, 48,218,237,233,228,228,236, + 229,232,239,239,235,227,249,242,233,236,236,233, 99,128, 4,167, + 114, 5,148,204,148,216,149, 2,149,123,149,136,225,230,229,232, + 229,226,242,229,119,128,251, 78,227,229,238,116,131, 0, 37,148, + 229,148,238,148,250,225,242,225,226,233, 99,128, 6,106,237,239, + 238,239,243,240,225,227,101,128,255, 5,243,237,225,236,108,128, + 254,106,105, 2,149, 8,149,105,239,100,134, 0, 46,149, 25,149, + 36,149, 47,149, 59,149, 70,149, 82,225,242,237,229,238,233,225, + 110,128, 5,137,227,229,238,244,229,242,229,100,128, 0,183,232, + 225,236,230,247,233,228,244,104,128,255, 97,233,238,230,229,242, + 233,239,114,128,246,231,237,239,238,239,243,240,225,227,101,128, + 255, 14,115, 2,149, 88,149, 95,237,225,236,108,128,254, 82,245, + 240,229,242,233,239,114,128,246,232,243,240,239,237,229,238,233, + 231,242,229,229,235,227,237, 98,128, 3, 66,240,229,238,228,233, + 227,245,236,225,114,128, 34,165,244,232,239,245,243,225,238,100, + 128, 32, 48,243,229,244, 97,128, 32,167,230,243,241,245,225,242, + 101,128, 51,138,104, 3,149,172,149,222,150,103, 97, 3,149,180, + 149,190,149,197,226,229,238,231,225,236,105,128, 9,171,228,229, + 246, 97,128, 9, 43,231,117, 2,149,204,149,213,234,225,242,225, + 244,105,128, 10,171,242,237,245,235,232,105,128, 10, 43,105,133, + 3,198,149,236,149,240,150, 70,150, 78,150, 89, 49,128, 3,213, + 229,245,240,104, 4,149,253,150, 32,150, 47,150, 56, 97, 2,150, + 3,150, 18,227,233,242,227,236,229,235,239,242,229,225,110,128, + 50,122,240,225,242,229,238,235,239,242,229,225,110,128, 50, 26, + 227,233,242,227,236,229,235,239,242,229,225,110,128, 50,108,235, + 239,242,229,225,110,128, 49, 77,240,225,242,229,238,235,239,242, + 229,225,110,128, 50, 12,236,225,244,233,110,128, 2,120,238,244, + 232,245,244,232,225,105,128, 14, 58,243,249,237,226,239,236,231, + 242,229,229,107,128, 3,213,111, 3,150,111,150,116,150,142,239, + 107,128, 1,165,240,104, 2,150,123,150,132,225,238,244,232,225, + 105,128, 14, 30,245,238,231,244,232,225,105,128, 14, 28,243,225, + 237,240,232,225,239,244,232,225,105,128, 14, 32,105,133, 3,192, + 150,170,151,126,151,137,151,148,151,162,229,245,112, 6,150,186, + 150,221,150,253,151, 25,151, 39,151, 91, 97, 2,150,192,150,207, + 227,233,242,227,236,229,235,239,242,229,225,110,128, 50,115,240, + 225,242,229,238,235,239,242,229,225,110,128, 50, 19,227,105, 2, + 150,228,150,240,229,245,227,235,239,242,229,225,110,128, 49,118, + 242,227,236,229,235,239,242,229,225,110,128, 50,101,107, 2,151, + 3,151, 17,233,249,229,239,235,235,239,242,229,225,110,128, 49, + 114,239,242,229,225,110,128, 49, 66,240,225,242,229,238,235,239, + 242,229,225,110,128, 50, 5,243,233,239,115, 2,151, 48,151, 76, + 107, 2,151, 54,151, 68,233,249,229,239,235,235,239,242,229,225, + 110,128, 49,116,239,242,229,225,110,128, 49, 68,244,233,235,229, + 245,244,235,239,242,229,225,110,128, 49,117,116, 2,151, 97,151, + 112,232,233,229,245,244,232,235,239,242,229,225,110,128, 49,119, + 233,235,229,245,244,235,239,242,229,225,110,128, 49,115,232,233, + 242,225,231,225,238, 97,128, 48,116,235,225,244,225,235,225,238, + 97,128, 48,212,243,249,237,226,239,236,231,242,229,229,107,128, + 3,214,247,242,225,242,237,229,238,233,225,110,128, 5,131,236, + 245,115,132, 0, 43,151,189,151,200,151,209,151,242,226,229,236, + 239,247,227,237, 98,128, 3, 31,227,233,242,227,236,101,128, 34, + 149,109, 2,151,215,151,222,233,238,245,115,128, 0,177,111, 2, + 151,228,151,232,100,128, 2,214,238,239,243,240,225,227,101,128, + 255, 11,115, 2,151,248,151,255,237,225,236,108,128,254, 98,245, + 240,229,242,233,239,114,128, 32,122,109, 2,152, 15,152, 26,239, + 238,239,243,240,225,227,101,128,255, 80,243,241,245,225,242,101, + 128, 51,216,111, 5,152, 47,152, 58,152,125,152,136,152,146,232, + 233,242,225,231,225,238, 97,128, 48,125,233,238,244,233,238,231, + 233,238,228,229,120, 4,152, 78,152, 90,152,102,152,115,228,239, + 247,238,247,232,233,244,101,128, 38, 31,236,229,230,244,247,232, + 233,244,101,128, 38, 28,242,233,231,232,244,247,232,233,244,101, + 128, 38, 30,245,240,247,232,233,244,101,128, 38, 29,235,225,244, + 225,235,225,238, 97,128, 48,221,240,236,225,244,232,225,105,128, + 14, 27,243,244,225,236,237,225,242,107,129, 48, 18,152,159,230, + 225,227,101,128, 48, 32,240,225,242,229,110,128, 36,171,114, 3, + 152,182,152,208,152,233,101, 2,152,188,152,196,227,229,228,229, + 115,128, 34,122,243,227,242,233,240,244,233,239,110,128, 33, 30, + 233,237,101, 2,152,216,152,222,237,239,100,128, 2,185,242,229, + 246,229,242,243,229,100,128, 32, 53,111, 4,152,243,152,250,153, + 4,153, 17,228,245,227,116,128, 34, 15,234,229,227,244,233,246, + 101,128, 35, 5,236,239,238,231,229,228,235,225,238, 97,128, 48, + 252,112, 2,153, 23,153, 60,101, 2,153, 29,153, 36,236,236,239, + 114,128, 35, 24,242,243,117, 2,153, 44,153, 51,226,243,229,116, + 128, 34,130,240,229,242,243,229,116,128, 34,131,239,242,244,233, + 239,110,129, 34, 55,153, 71,225,108,128, 34, 29,115, 2,153, 82, + 153,125,105,130, 3,200,153, 90,153,101,227,249,242,233,236,236, + 233, 99,128, 4,113,236,233,240,238,229,245,237,225,244,225,227, + 249,242,233,236,236,233,227,227,237, 98,128, 4,134,243,241,245, + 225,242,101,128, 51,176,117, 2,153,140,153,151,232,233,242,225, + 231,225,238, 97,128, 48,119,235,225,244,225,235,225,238, 97,128, + 48,215,246,243,241,245,225,242,101,128, 51,180,247,243,241,245, + 225,242,101,128, 51,186,113,136, 0,113,153,202,154,251,155, 6, + 155, 15,155, 22,155, 34,155, 72,155, 80, 97, 4,153,212,153,235, + 154, 43,154,234,100, 2,153,218,153,224,229,246, 97,128, 9, 88, + 237,225,232,229,226,242,229,119,128, 5,168,102, 4,153,245,153, + 254,154, 12,154, 28,225,242,225,226,233, 99,128, 6, 66,230,233, + 238,225,236,225,242,225,226,233, 99,128,254,214,233,238,233,244, + 233,225,236,225,242,225,226,233, 99,128,254,215,237,229,228,233, + 225,236,225,242,225,226,233, 99,128,254,216,237,225,244,115,136, + 5,184,154, 66,154, 86,154,100,154,105,154,110,154,119,154,134, + 154,221, 49, 3,154, 74,154, 78,154, 82, 48,128, 5,184, 97,128, + 5,184, 99,128, 5,184, 50, 2,154, 92,154, 96, 55,128, 5,184, + 57,128, 5,184,179, 51,128, 5,184,228,101,128, 5,184,232,229, + 226,242,229,119,128, 5,184,238,225,242,242,239,247,232,229,226, + 242,229,119,128, 5,184,113, 2,154,140,154,206,225,244,225,110, + 4,154,153,154,162,154,177,154,193,232,229,226,242,229,119,128, + 5,184,238,225,242,242,239,247,232,229,226,242,229,119,128, 5, + 184,241,245,225,242,244,229,242,232,229,226,242,229,119,128, 5, + 184,247,233,228,229,232,229,226,242,229,119,128, 5,184,245,225, + 242,244,229,242,232,229,226,242,229,119,128, 5,184,247,233,228, + 229,232,229,226,242,229,119,128, 5,184,242,238,229,249,240,225, + 242,225,232,229,226,242,229,119,128, 5,159,226,239,240,239,237, + 239,230,111,128, 49, 17,227,233,242,227,236,101,128, 36,224,232, + 239,239,107,128, 2,160,237,239,238,239,243,240,225,227,101,128, + 255, 81,239,102,130, 5,231,155, 43,155, 63,228,225,231,229,243, + 104,129,251, 71,155, 54,232,229,226,242,229,119,128,251, 71,232, + 229,226,242,229,119,128, 5,231,240,225,242,229,110,128, 36,172, + 117, 4,155, 90,155,102,155,191,156, 22,225,242,244,229,242,238, + 239,244,101,128, 38,105,226,245,244,115,135, 5,187,155,123,155, + 128,155,133,155,138,155,147,155,162,155,178,177, 56,128, 5,187, + 178, 53,128, 5,187,179, 49,128, 5,187,232,229,226,242,229,119, + 128, 5,187,238,225,242,242,239,247,232,229,226,242,229,119,128, + 5,187,241,245,225,242,244,229,242,232,229,226,242,229,119,128, + 5,187,247,233,228,229,232,229,226,242,229,119,128, 5,187,229, + 243,244,233,239,110,133, 0, 63,155,210,155,233,155,250,156, 2, + 156, 14,225,114, 2,155,217,155,224,225,226,233, 99,128, 6, 31, + 237,229,238,233,225,110,128, 5, 94,228,239,247,110,129, 0,191, + 155,242,243,237,225,236,108,128,247,191,231,242,229,229,107,128, + 3,126,237,239,238,239,243,240,225,227,101,128,255, 31,243,237, + 225,236,108,128,247, 63,239,244,101, 4,156, 34,156,105,156,125, + 156,154,228,226,108,133, 0, 34,156, 50,156, 57,156, 64,156, 76, + 156, 97,226,225,243,101,128, 32, 30,236,229,230,116,128, 32, 28, + 237,239,238,239,243,240,225,227,101,128,255, 2,240,242,233,237, + 101,129, 48, 30,156, 86,242,229,246,229,242,243,229,100,128, 48, + 29,242,233,231,232,116,128, 32, 29,236,229,230,116,129, 32, 24, + 156,114,242,229,246,229,242,243,229,100,128, 32, 27,114, 2,156, + 131,156,141,229,246,229,242,243,229,100,128, 32, 27,233,231,232, + 116,129, 32, 25,156,150,110,128, 1, 73,243,233,238,231,108, 2, + 156,164,156,171,226,225,243,101,128, 32, 26,101,129, 0, 39,156, + 177,237,239,238,239,243,240,225,227,101,128,255, 7,114,145, 0, + 114,156,227,157,231,157,242,158, 33,158, 84,159,101,159,125,159, + 220,161,254,162, 35,162, 47,162,101,162,109,163, 15,163, 26,163, + 61,163,161, 97, 11,156,251,157, 6,157, 16,157, 23,157, 88,157, + 104,157,129,157,140,157,165,157,188,157,225,225,242,237,229,238, + 233,225,110,128, 5,124,226,229,238,231,225,236,105,128, 9,176, + 227,245,244,101,128, 1, 85,100, 4,157, 33,157, 39,157, 53,157, + 79,229,246, 97,128, 9, 48,233,227,225,108,129, 34, 26,157, 48, + 229,120,128,248,229,239,246,229,242,243,243,241,245,225,242,101, + 129, 51,174,157, 69,228,243,241,245,225,242,101,128, 51,175,243, + 241,245,225,242,101,128, 51,173,230,101,129, 5,191,157, 95,232, + 229,226,242,229,119,128, 5,191,231,117, 2,157,111,157,120,234, + 225,242,225,244,105,128, 10,176,242,237,245,235,232,105,128, 10, + 48,232,233,242,225,231,225,238, 97,128, 48,137,235,225,244,225, + 235,225,238, 97,129, 48,233,157,153,232,225,236,230,247,233,228, + 244,104,128,255,151,236,239,247,229,242,228,233,225,231,239,238, + 225,236,226,229,238,231,225,236,105,128, 9,241,109, 2,157,194, + 157,217,233,228,228,236,229,228,233,225,231,239,238,225,236,226, + 229,238,231,225,236,105,128, 9,240,243,232,239,242,110,128, 2, + 100,244,233,111,128, 34, 54,226,239,240,239,237,239,230,111,128, + 49, 22, 99, 4,157,252,158, 3,158, 12,158, 20,225,242,239,110, + 128, 1, 89,229,228,233,236,236, 97,128, 1, 87,233,242,227,236, + 101,128, 36,225,239,237,237,225,225,227,227,229,238,116,128, 1, + 87,100, 2,158, 39,158, 49,226,236,231,242,225,246,101,128, 2, + 17,239,116, 2,158, 56,158, 65,225,227,227,229,238,116,128, 30, + 89,226,229,236,239,119,129, 30, 91,158, 75,237,225,227,242,239, + 110,128, 30, 93,101, 6,158, 98,158,143,158,178,158,233,159, 2, + 159, 35,102, 2,158,104,158,117,229,242,229,238,227,229,237,225, + 242,107,128, 32, 59,236,229,248,243,117, 2,158,127,158,134,226, + 243,229,116,128, 34,134,240,229,242,243,229,116,128, 34,135,231, + 233,243,244,229,114, 2,158,154,158,159,229,100,128, 0,174,115, + 2,158,165,158,171,225,238,115,128,248,232,229,242,233,102,128, + 246,218,104, 3,158,186,158,209,158,223,225,114, 2,158,193,158, + 200,225,226,233, 99,128, 6, 49,237,229,238,233,225,110,128, 5, + 128,230,233,238,225,236,225,242,225,226,233, 99,128,254,174,233, + 242,225,231,225,238, 97,128, 48,140,235,225,244,225,235,225,238, + 97,129, 48,236,158,246,232,225,236,230,247,233,228,244,104,128, + 255,154,243,104,130, 5,232,159, 11,159, 26,228,225,231,229,243, + 232,232,229,226,242,229,119,128,251, 72,232,229,226,242,229,119, + 128, 5,232,118, 3,159, 43,159, 56,159, 88,229,242,243,229,228, + 244,233,236,228,101,128, 34, 61,233, 97, 2,159, 63,159, 72,232, + 229,226,242,229,119,128, 5,151,237,245,231,242,225,243,232,232, + 229,226,242,229,119,128, 5,151,236,239,231,233,227,225,236,238, + 239,116,128, 35, 16,230,233,243,232,232,239,239,107,129, 2,126, + 159,114,242,229,246,229,242,243,229,100,128, 2,127,104, 2,159, + 131,159,154, 97, 2,159,137,159,147,226,229,238,231,225,236,105, + 128, 9,221,228,229,246, 97,128, 9, 93,111,131, 3,193,159,164, + 159,193,159,207,239,107,129, 2,125,159,171,244,245,242,238,229, + 100,129, 2,123,159,182,243,245,240,229,242,233,239,114,128, 2, + 181,243,249,237,226,239,236,231,242,229,229,107,128, 3,241,244, + 233,227,232,239,239,235,237,239,100,128, 2,222,105, 6,159,234, + 161, 22,161, 68,161, 79,161,104,161,240,229,245,108, 9,160, 0, + 160, 35,160, 50,160, 64,160,110,160,124,160,210,160,223,161, 2, + 97, 2,160, 6,160, 21,227,233,242,227,236,229,235,239,242,229, + 225,110,128, 50,113,240,225,242,229,238,235,239,242,229,225,110, + 128, 50, 17,227,233,242,227,236,229,235,239,242,229,225,110,128, + 50, 99,232,233,229,245,232,235,239,242,229,225,110,128, 49, 64, + 107, 2,160, 70,160,102,233,249,229,239,107, 2,160, 80,160, 89, + 235,239,242,229,225,110,128, 49, 58,243,233,239,243,235,239,242, + 229,225,110,128, 49,105,239,242,229,225,110,128, 49, 57,237,233, + 229,245,237,235,239,242,229,225,110,128, 49, 59,112, 3,160,132, + 160,164,160,179, 97, 2,160,138,160,152,238,243,233,239,243,235, + 239,242,229,225,110,128, 49,108,242,229,238,235,239,242,229,225, + 110,128, 50, 3,232,233,229,245,240,232,235,239,242,229,225,110, + 128, 49, 63,233,229,245,112, 2,160,188,160,197,235,239,242,229, + 225,110,128, 49, 60,243,233,239,243,235,239,242,229,225,110,128, + 49,107,243,233,239,243,235,239,242,229,225,110,128, 49, 61,116, + 2,160,229,160,244,232,233,229,245,244,232,235,239,242,229,225, + 110,128, 49, 62,233,235,229,245,244,235,239,242,229,225,110,128, + 49,106,249,229,239,242,233,238,232,233,229,245,232,235,239,242, + 229,225,110,128, 49,109,231,232,116, 2,161, 30,161, 38,225,238, + 231,236,101,128, 34, 31,116, 2,161, 44,161, 58,225,227,235,226, + 229,236,239,247,227,237, 98,128, 3, 25,242,233,225,238,231,236, + 101,128, 34,191,232,233,242,225,231,225,238, 97,128, 48,138,235, + 225,244,225,235,225,238, 97,129, 48,234,161, 92,232,225,236,230, + 247,233,228,244,104,128,255,152,110, 2,161,110,161,226,103,131, + 2,218,161,120,161,131,161,137,226,229,236,239,247,227,237, 98, + 128, 3, 37,227,237, 98,128, 3, 10,232,225,236,102, 2,161,146, + 161,192,236,229,230,116,131, 2,191,161,159,161,170,161,181,225, + 242,237,229,238,233,225,110,128, 5, 89,226,229,236,239,247,227, + 237, 98,128, 3, 28,227,229,238,244,229,242,229,100,128, 2,211, + 242,233,231,232,116,130, 2,190,161,204,161,215,226,229,236,239, + 247,227,237, 98,128, 3, 57,227,229,238,244,229,242,229,100,128, + 2,210,246,229,242,244,229,228,226,242,229,246,101,128, 2, 19, + 244,244,239,242,245,243,241,245,225,242,101,128, 51, 81,108, 2, + 162, 4,162, 15,233,238,229,226,229,236,239,119,128, 30, 95,239, + 238,231,236,229,103,129, 2,124,162, 26,244,245,242,238,229,100, + 128, 2,122,237,239,238,239,243,240,225,227,101,128,255, 82,111, + 3,162, 55,162, 66,162, 91,232,233,242,225,231,225,238, 97,128, + 48,141,235,225,244,225,235,225,238, 97,129, 48,237,162, 79,232, + 225,236,230,247,233,228,244,104,128,255,155,242,245,225,244,232, + 225,105,128, 14, 35,240,225,242,229,110,128, 36,173,114, 3,162, + 117,162,153,162,183, 97, 3,162,125,162,135,162,142,226,229,238, + 231,225,236,105,128, 9,220,228,229,246, 97,128, 9, 49,231,245, + 242,237,245,235,232,105,128, 10, 92,229,104, 2,162,160,162,169, + 225,242,225,226,233, 99,128, 6,145,230,233,238,225,236,225,242, + 225,226,233, 99,128,251,141,246,239,227,225,236,233, 99, 4,162, + 199,162,209,162,216,162,227,226,229,238,231,225,236,105,128, 9, + 224,228,229,246, 97,128, 9, 96,231,245,234,225,242,225,244,105, + 128, 10,224,246,239,247,229,236,243,233,231,110, 3,162,243,162, + 253,163, 4,226,229,238,231,225,236,105,128, 9,196,228,229,246, + 97,128, 9, 68,231,245,234,225,242,225,244,105,128, 10,196,243, + 245,240,229,242,233,239,114,128,246,241,116, 2,163, 32,163, 40, + 226,236,239,227,107,128, 37,144,245,242,238,229,100,129, 2,121, + 163, 50,243,245,240,229,242,233,239,114,128, 2,180,117, 4,163, + 71,163, 82,163,107,163,154,232,233,242,225,231,225,238, 97,128, + 48,139,235,225,244,225,235,225,238, 97,129, 48,235,163, 95,232, + 225,236,230,247,233,228,244,104,128,255,153,112, 2,163,113,163, + 148,229,101, 2,163,120,163,134,237,225,242,235,226,229,238,231, + 225,236,105,128, 9,242,243,233,231,238,226,229,238,231,225,236, + 105,128, 9,243,233,225,104,128,246,221,244,232,225,105,128, 14, + 36,246,239,227,225,236,233, 99, 4,163,177,163,187,163,194,163, + 205,226,229,238,231,225,236,105,128, 9,139,228,229,246, 97,128, + 9, 11,231,245,234,225,242,225,244,105,128, 10,139,246,239,247, + 229,236,243,233,231,110, 3,163,221,163,231,163,238,226,229,238, + 231,225,236,105,128, 9,195,228,229,246, 97,128, 9, 67,231,245, + 234,225,242,225,244,105,128, 10,195,115,147, 0,115,164, 35,166, + 5,166, 16,166,142,166,181,169,123,169,134,172, 21,174,159,174, + 205,174,232,175,167,175,234,177, 11,177, 21,177,207,178, 24,178, + 194,178,204, 97, 9,164, 55,164, 65,164, 86,164,158,164,183,164, + 194,164,219,164,251,165, 35,226,229,238,231,225,236,105,128, 9, + 184,227,245,244,101,129, 1, 91,164, 74,228,239,244,225,227,227, + 229,238,116,128, 30,101,100, 5,164, 98,164,107,164,113,164,127, + 164,143,225,242,225,226,233, 99,128, 6, 53,229,246, 97,128, 9, + 56,230,233,238,225,236,225,242,225,226,233, 99,128,254,186,233, + 238,233,244,233,225,236,225,242,225,226,233, 99,128,254,187,237, + 229,228,233,225,236,225,242,225,226,233, 99,128,254,188,231,117, + 2,164,165,164,174,234,225,242,225,244,105,128, 10,184,242,237, + 245,235,232,105,128, 10, 56,232,233,242,225,231,225,238, 97,128, + 48, 85,235,225,244,225,235,225,238, 97,129, 48,181,164,207,232, + 225,236,230,247,233,228,244,104,128,255,123,236,236,225,236,236, + 225,232,239,245,225,236,225,249,232,229,247,225,243,225,236,236, + 225,237,225,242,225,226,233, 99,128,253,250,237,229,235,104,130, + 5,225,165, 6,165, 26,228,225,231,229,243,104,129,251, 65,165, + 17,232,229,226,242,229,119,128,251, 65,232,229,226,242,229,119, + 128, 5,225,242, 97, 5,165, 48,165,122,165,130,165,180,165,188, + 97, 5,165, 60,165, 68,165, 76,165,107,165,115,225,244,232,225, + 105,128, 14, 50,229,244,232,225,105,128, 14, 65,233,237,225,233, + 109, 2,165, 86,165, 97,225,236,225,233,244,232,225,105,128, 14, + 68,245,225,238,244,232,225,105,128, 14, 67,237,244,232,225,105, + 128, 14, 51,244,232,225,105,128, 14, 48,229,244,232,225,105,128, + 14, 64,105, 3,165,138,165,162,165,173,105, 2,165,144,165,155, + 236,229,230,244,244,232,225,105,128,248,134,244,232,225,105,128, + 14, 53,236,229,230,244,244,232,225,105,128,248,133,244,232,225, + 105,128, 14, 52,239,244,232,225,105,128, 14, 66,117, 3,165,196, + 165,246,165,253,101, 3,165,204,165,228,165,239,101, 2,165,210, + 165,221,236,229,230,244,244,232,225,105,128,248,136,244,232,225, + 105,128, 14, 55,236,229,230,244,244,232,225,105,128,248,135,244, + 232,225,105,128, 14, 54,244,232,225,105,128, 14, 56,245,244,232, + 225,105,128, 14, 57,226,239,240,239,237,239,230,111,128, 49, 25, + 99, 5,166, 28,166, 49,166, 58,166,107,166,129,225,242,239,110, + 129, 1, 97,166, 37,228,239,244,225,227,227,229,238,116,128, 30, + 103,229,228,233,236,236, 97,128, 1, 95,232,247, 97,131, 2, 89, + 166, 70,166, 81,166,100,227,249,242,233,236,236,233, 99,128, 4, + 217,228,233,229,242,229,243,233,243,227,249,242,233,236,236,233, + 99,128, 4,219,232,239,239,107,128, 2, 90,233,242, 99, 2,166, + 115,166,120,236,101,128, 36,226,245,237,230,236,229,120,128, 1, + 93,239,237,237,225,225,227,227,229,238,116,128, 2, 25,228,239, + 116, 2,166,150,166,159,225,227,227,229,238,116,128, 30, 97,226, + 229,236,239,119,129, 30, 99,166,169,228,239,244,225,227,227,229, + 238,116,128, 30,105,101, 9,166,201,166,217,166,252,167, 61,167, + 164,167,191,167,216,168, 41,168, 68,225,231,245,236,236,226,229, + 236,239,247,227,237, 98,128, 3, 60, 99, 2,166,223,166,245,239, + 238,100,129, 32, 51,166,231,244,239,238,229,227,232,233,238,229, + 243,101,128, 2,202,244,233,239,110,128, 0,167,229,110, 4,167, + 7,167, 16,167, 30,167, 46,225,242,225,226,233, 99,128, 6, 51, + 230,233,238,225,236,225,242,225,226,233, 99,128,254,178,233,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,254,179,237,229, + 228,233,225,236,225,242,225,226,233, 99,128,254,180,231,239,108, + 135, 5,182,167, 81,167, 95,167,100,167,109,167,124,167,140,167, + 151, 49, 2,167, 87,167, 91, 51,128, 5,182,102,128, 5,182,178, + 99,128, 5,182,232,229,226,242,229,119,128, 5,182,238,225,242, + 242,239,247,232,229,226,242,229,119,128, 5,182,241,245,225,242, + 244,229,242,232,229,226,242,229,119,128, 5,182,244,225,232,229, + 226,242,229,119,128, 5,146,247,233,228,229,232,229,226,242,229, + 119,128, 5,182,104, 2,167,170,167,181,225,242,237,229,238,233, + 225,110,128, 5,125,233,242,225,231,225,238, 97,128, 48, 91,235, + 225,244,225,235,225,238, 97,129, 48,187,167,204,232,225,236,230, + 247,233,228,244,104,128,255,126,237,105, 2,167,223,168, 10,227, + 239,236,239,110,131, 0, 59,167,237,167,246,168, 2,225,242,225, + 226,233, 99,128, 6, 27,237,239,238,239,243,240,225,227,101,128, + 255, 27,243,237,225,236,108,128,254, 84,246,239,233,227,229,228, + 237,225,242,235,235,225,238, 97,129, 48,156,168, 29,232,225,236, + 230,247,233,228,244,104,128,255,159,238,116, 2,168, 48,168, 58, + 233,243,241,245,225,242,101,128, 51, 34,239,243,241,245,225,242, + 101,128, 51, 35,246,229,110,142, 0, 55,168,102,168,111,168,121, + 168,151,168,158,168,168,168,193,168,220,168,254,169, 10,169, 21, + 169, 54,169, 62,169, 73,225,242,225,226,233, 99,128, 6,103,226, + 229,238,231,225,236,105,128, 9,237,227,233,242,227,236,101,129, + 36,102,168,132,233,238,246,229,242,243,229,243,225,238,243,243, + 229,242,233,102,128, 39,144,228,229,246, 97,128, 9,109,229,233, + 231,232,244,232,115,128, 33, 94,231,117, 2,168,175,168,184,234, + 225,242,225,244,105,128, 10,237,242,237,245,235,232,105,128, 10, + 109,232, 97, 2,168,200,168,211,227,235,225,242,225,226,233, 99, + 128, 6,103,238,231,250,232,239,117,128, 48, 39,105, 2,168,226, + 168,244,228,229,239,231,242,225,240,232,233,227,240,225,242,229, + 110,128, 50, 38,238,230,229,242,233,239,114,128, 32,135,237,239, + 238,239,243,240,225,227,101,128,255, 23,239,236,228,243,244,249, + 236,101,128,247, 55,112, 2,169, 27,169, 34,225,242,229,110,128, + 36,122,229,114, 2,169, 41,169, 47,233,239,100,128, 36,142,243, + 233,225,110,128, 6,247,242,239,237,225,110,128, 33,118,243,245, + 240,229,242,233,239,114,128, 32,119,116, 2,169, 79,169,117,229, + 229,110, 2,169, 87,169, 96,227,233,242,227,236,101,128, 36,112, + 112, 2,169,102,169,109,225,242,229,110,128, 36,132,229,242,233, + 239,100,128, 36,152,232,225,105,128, 14, 87,230,244,232,249,240, + 232,229,110,128, 0,173,104, 7,169,150,170,124,170,135,170,149, + 171, 94,171,107,172, 15, 97, 6,169,164,169,175,169,185,169,196, + 170, 83,170,108,225,242,237,229,238,233,225,110,128, 5,119,226, + 229,238,231,225,236,105,128, 9,182,227,249,242,233,236,236,233, + 99,128, 4, 72,100, 2,169,202,170, 42,228, 97, 4,169,213,169, + 222,169,253,170, 11,225,242,225,226,233, 99,128, 6, 81,228,225, + 237,237, 97, 2,169,232,169,241,225,242,225,226,233, 99,128,252, + 97,244,225,238,225,242,225,226,233, 99,128,252, 94,230,225,244, + 232,225,225,242,225,226,233, 99,128,252, 96,235,225,243,242, 97, + 2,170, 21,170, 30,225,242,225,226,233, 99,128,252, 98,244,225, + 238,225,242,225,226,233, 99,128,252, 95,101,132, 37,146,170, 54, + 170, 61,170, 69,170, 78,228,225,242,107,128, 37,147,236,233,231, + 232,116,128, 37,145,237,229,228,233,245,109,128, 37,146,246, 97, + 128, 9, 54,231,117, 2,170, 90,170, 99,234,225,242,225,244,105, + 128, 10,182,242,237,245,235,232,105,128, 10, 54,236,243,232,229, + 236,229,244,232,229,226,242,229,119,128, 5,147,226,239,240,239, + 237,239,230,111,128, 49, 21,227,232,225,227,249,242,233,236,236, + 233, 99,128, 4, 73,101, 4,170,159,170,224,170,234,170,251,229, + 110, 4,170,170,170,179,170,193,170,209,225,242,225,226,233, 99, + 128, 6, 52,230,233,238,225,236,225,242,225,226,233, 99,128,254, + 182,233,238,233,244,233,225,236,225,242,225,226,233, 99,128,254, + 183,237,229,228,233,225,236,225,242,225,226,233, 99,128,254,184, + 233,227,239,240,244,233, 99,128, 3,227,241,229,108,129, 32,170, + 170,242,232,229,226,242,229,119,128, 32,170,246, 97,134, 5,176, + 171, 12,171, 27,171, 41,171, 50,171, 65,171, 81, 49, 2,171, 18, + 171, 23,177, 53,128, 5,176, 53,128, 5,176, 50, 2,171, 33,171, + 37, 50,128, 5,176,101,128, 5,176,232,229,226,242,229,119,128, + 5,176,238,225,242,242,239,247,232,229,226,242,229,119,128, 5, + 176,241,245,225,242,244,229,242,232,229,226,242,229,119,128, 5, + 176,247,233,228,229,232,229,226,242,229,119,128, 5,176,232,225, + 227,249,242,233,236,236,233, 99,128, 4,187,105, 2,171,113,171, + 124,237,225,227,239,240,244,233, 99,128, 3,237,110,131, 5,233, + 171,134,171,217,171,226,100, 2,171,140,171,206,225,231,229,243, + 104,130,251, 73,171,152,171,161,232,229,226,242,229,119,128,251, + 73,115, 2,171,167,171,187,232,233,238,228,239,116,129,251, 44, + 171,178,232,229,226,242,229,119,128,251, 44,233,238,228,239,116, + 129,251, 45,171,197,232,229,226,242,229,119,128,251, 45,239,244, + 232,229,226,242,229,119,128, 5,193,232,229,226,242,229,119,128, + 5,233,115, 2,171,232,171,252,232,233,238,228,239,116,129,251, + 42,171,243,232,229,226,242,229,119,128,251, 42,233,238,228,239, + 116,129,251, 43,172, 6,232,229,226,242,229,119,128,251, 43,239, + 239,107,128, 2,130,105, 8,172, 39,172, 83,172, 94,172,119,172, + 149,172,157,172,170,173, 85,231,237, 97,131, 3,195,172, 51,172, + 55,172, 63, 49,128, 3,194,230,233,238,225,108,128, 3,194,236, + 245,238,225,244,229,243,249,237,226,239,236,231,242,229,229,107, + 128, 3,242,232,233,242,225,231,225,238, 97,128, 48, 87,235,225, + 244,225,235,225,238, 97,129, 48,183,172,107,232,225,236,230,247, + 233,228,244,104,128,255,124,236,245,113, 2,172,127,172,136,232, + 229,226,242,229,119,128, 5,189,236,229,230,244,232,229,226,242, + 229,119,128, 5,189,237,233,236,225,114,128, 34, 60,238,228,239, + 244,232,229,226,242,229,119,128, 5,194,239,115, 6,172,185,172, + 220,172,252,173, 24,173, 38,173, 70, 97, 2,172,191,172,206,227, + 233,242,227,236,229,235,239,242,229,225,110,128, 50,116,240,225, + 242,229,238,235,239,242,229,225,110,128, 50, 20,227,105, 2,172, + 227,172,239,229,245,227,235,239,242,229,225,110,128, 49,126,242, + 227,236,229,235,239,242,229,225,110,128, 50,102,107, 2,173, 2, + 173, 16,233,249,229,239,235,235,239,242,229,225,110,128, 49,122, + 239,242,229,225,110,128, 49, 69,238,233,229,245,238,235,239,242, + 229,225,110,128, 49,123,112, 2,173, 44,173, 57,225,242,229,238, + 235,239,242,229,225,110,128, 50, 6,233,229,245,240,235,239,242, + 229,225,110,128, 49,125,244,233,235,229,245,244,235,239,242,229, + 225,110,128, 49,124,120,141, 0, 54,173,115,173,124,173,134,173, + 164,173,171,173,196,173,223,174, 1,174, 13,174, 24,174, 57,174, + 65,174, 76,225,242,225,226,233, 99,128, 6,102,226,229,238,231, + 225,236,105,128, 9,236,227,233,242,227,236,101,129, 36,101,173, + 145,233,238,246,229,242,243,229,243,225,238,243,243,229,242,233, + 102,128, 39,143,228,229,246, 97,128, 9,108,231,117, 2,173,178, + 173,187,234,225,242,225,244,105,128, 10,236,242,237,245,235,232, + 105,128, 10,108,232, 97, 2,173,203,173,214,227,235,225,242,225, + 226,233, 99,128, 6,102,238,231,250,232,239,117,128, 48, 38,105, + 2,173,229,173,247,228,229,239,231,242,225,240,232,233,227,240, + 225,242,229,110,128, 50, 37,238,230,229,242,233,239,114,128, 32, + 134,237,239,238,239,243,240,225,227,101,128,255, 22,239,236,228, + 243,244,249,236,101,128,247, 54,112, 2,174, 30,174, 37,225,242, + 229,110,128, 36,121,229,114, 2,174, 44,174, 50,233,239,100,128, + 36,141,243,233,225,110,128, 6,246,242,239,237,225,110,128, 33, + 117,243,245,240,229,242,233,239,114,128, 32,118,116, 2,174, 82, + 174,153,229,229,110, 2,174, 90,174,132, 99, 2,174, 96,174,104, + 233,242,227,236,101,128, 36,111,245,242,242,229,238,227,249,228, + 229,238,239,237,233,238,225,244,239,242,226,229,238,231,225,236, + 105,128, 9,249,112, 2,174,138,174,145,225,242,229,110,128, 36, + 131,229,242,233,239,100,128, 36,151,232,225,105,128, 14, 86,108, + 2,174,165,174,185,225,243,104,129, 0, 47,174,173,237,239,238, + 239,243,240,225,227,101,128,255, 15,239,238,103,129, 1,127,174, + 193,228,239,244,225,227,227,229,238,116,128, 30,155,109, 2,174, + 211,174,221,233,236,229,230,225,227,101,128, 38, 58,239,238,239, + 243,240,225,227,101,128,255, 83,111, 6,174,246,175, 40,175, 51, + 175, 76,175,121,175,132,102, 2,174,252,175, 10,240,225,243,245, + 241,232,229,226,242,229,119,128, 5,195,116, 2,175, 16,175, 25, + 232,249,240,232,229,110,128, 0,173,243,233,231,238,227,249,242, + 233,236,236,233, 99,128, 4, 76,232,233,242,225,231,225,238, 97, + 128, 48, 93,235,225,244,225,235,225,238, 97,129, 48,189,175, 64, + 232,225,236,230,247,233,228,244,104,128,255,127,236,233,228,245, + 115, 2,175, 86,175,103,236,239,238,231,239,246,229,242,236,225, + 249,227,237, 98,128, 3, 56,243,232,239,242,244,239,246,229,242, + 236,225,249,227,237, 98,128, 3, 55,242,245,243,233,244,232,225, + 105,128, 14, 41,115, 3,175,140,175,150,175,158,225,236,225,244, + 232,225,105,128, 14, 40,239,244,232,225,105,128, 14, 11,245,225, + 244,232,225,105,128, 14, 42,240, 97, 3,175,176,175,196,175,228, + 227,101,129, 0, 32,175,183,232,225,227,235,225,242,225,226,233, + 99,128, 0, 32,228,101,129, 38, 96,175,203,243,245,233,116, 2, + 175,212,175,220,226,236,225,227,107,128, 38, 96,247,232,233,244, + 101,128, 38,100,242,229,110,128, 36,174,241,245,225,242,101, 11, + 176, 6,176, 17,176, 31,176, 56,176, 73,176, 99,176,114,176,147, + 176,174,176,230,176,245,226,229,236,239,247,227,237, 98,128, 3, + 59, 99, 2,176, 23,176, 27, 99,128, 51,196,109,128, 51,157,228, + 233,225,231,239,238,225,236,227,242,239,243,243,232,225,244,227, + 232,230,233,236,108,128, 37,169,232,239,242,233,250,239,238,244, + 225,236,230,233,236,108,128, 37,164,107, 2,176, 79,176, 83,103, + 128, 51,143,109,129, 51,158,176, 89,227,225,240,233,244,225,108, + 128, 51,206,108, 2,176,105,176,109,110,128, 51,209,239,103,128, + 51,210,109, 4,176,124,176,128,176,133,176,137,103,128, 51,142, + 233,108,128, 51,213,109,128, 51,156,243,241,245,225,242,229,100, + 128, 51,161,239,242,244,232,239,231,239,238,225,236,227,242,239, + 243,243,232,225,244,227,232,230,233,236,108,128, 37,166,245,240, + 240,229,114, 2,176,184,176,207,236,229,230,244,244,239,236,239, + 247,229,242,242,233,231,232,244,230,233,236,108,128, 37,167,242, + 233,231,232,244,244,239,236,239,247,229,242,236,229,230,244,230, + 233,236,108,128, 37,168,246,229,242,244,233,227,225,236,230,233, + 236,108,128, 37,165,247,232,233,244,229,247,233,244,232,243,237, + 225,236,236,226,236,225,227,107,128, 37,163,242,243,241,245,225, + 242,101,128, 51,219,115, 2,177, 27,177,197, 97, 4,177, 37,177, + 47,177, 54,177, 65,226,229,238,231,225,236,105,128, 9,183,228, + 229,246, 97,128, 9, 55,231,245,234,225,242,225,244,105,128, 10, + 183,238,103, 8,177, 84,177, 98,177,112,177,126,177,141,177,155, + 177,169,177,182,227,233,229,245,227,235,239,242,229,225,110,128, + 49, 73,232,233,229,245,232,235,239,242,229,225,110,128, 49,133, + 233,229,245,238,231,235,239,242,229,225,110,128, 49,128,235,233, + 249,229,239,235,235,239,242,229,225,110,128, 49, 50,238,233,229, + 245,238,235,239,242,229,225,110,128, 49,101,240,233,229,245,240, + 235,239,242,229,225,110,128, 49, 67,243,233,239,243,235,239,242, + 229,225,110,128, 49, 70,244,233,235,229,245,244,235,239,242,229, + 225,110,128, 49, 56,245,240,229,242,233,239,114,128,246,242,116, + 2,177,213,177,236,229,242,236,233,238,103,129, 0,163,177,224, + 237,239,238,239,243,240,225,227,101,128,255,225,242,239,235,101, + 2,177,245,178, 6,236,239,238,231,239,246,229,242,236,225,249, + 227,237, 98,128, 3, 54,243,232,239,242,244,239,246,229,242,236, + 225,249,227,237, 98,128, 3, 53,117, 7,178, 40,178, 72,178, 94, + 178,105,178,146,178,156,178,160,226,243,229,116,130, 34,130,178, + 51,178, 62,238,239,244,229,241,245,225,108,128, 34,138,239,242, + 229,241,245,225,108,128, 34,134, 99, 2,178, 78,178, 86,227,229, + 229,228,115,128, 34,123,232,244,232,225,116,128, 34, 11,232,233, + 242,225,231,225,238, 97,128, 48, 89,107, 2,178,111,178,135,225, + 244,225,235,225,238, 97,129, 48,185,178,123,232,225,236,230,247, + 233,228,244,104,128,255,125,245,238,225,242,225,226,233, 99,128, + 6, 82,237,237,225,244,233,239,110,128, 34, 17,110,128, 38, 60, + 240,229,242,243,229,116,130, 34,131,178,173,178,184,238,239,244, + 229,241,245,225,108,128, 34,139,239,242,229,241,245,225,108,128, + 34,135,246,243,241,245,225,242,101,128, 51,220,249,239,245,247, + 225,229,242,225,243,241,245,225,242,101,128, 51,124,116,144, 0, + 116,179, 1,180, 10,180, 31,180,174,180,214,183, 6,186,144,187, + 219,187,231,187,243,189, 20,189, 45,189,131,190, 55,190,239,191, + 73, 97, 10,179, 23,179, 33,179, 54,179, 61,179, 86,179,164,179, + 181,179,206,179,220,179,224,226,229,238,231,225,236,105,128, 9, + 164,227,107, 2,179, 40,179, 47,228,239,247,110,128, 34,164,236, + 229,230,116,128, 34,163,228,229,246, 97,128, 9, 36,231,117, 2, + 179, 68,179, 77,234,225,242,225,244,105,128, 10,164,242,237,245, + 235,232,105,128, 10, 36,104, 4,179, 96,179,105,179,119,179,149, + 225,242,225,226,233, 99,128, 6, 55,230,233,238,225,236,225,242, + 225,226,233, 99,128,254,194,105, 2,179,125,179,140,238,233,244, + 233,225,236,225,242,225,226,233, 99,128,254,195,242,225,231,225, + 238, 97,128, 48, 95,237,229,228,233,225,236,225,242,225,226,233, + 99,128,254,196,233,243,249,239,245,229,242,225,243,241,245,225, + 242,101,128, 51,125,235,225,244,225,235,225,238, 97,129, 48,191, + 179,194,232,225,236,230,247,233,228,244,104,128,255,128,244,247, + 229,229,236,225,242,225,226,233, 99,128, 6, 64,117,128, 3,196, + 118,130, 5,234,179,232,180, 1,228,225,231,229,115,129,251, 74, + 179,242,104,129,251, 74,179,248,232,229,226,242,229,119,128,251, + 74,232,229,226,242,229,119,128, 5,234, 98, 2,180, 16,180, 21, + 225,114,128, 1,103,239,240,239,237,239,230,111,128, 49, 10, 99, + 6,180, 45,180, 52,180, 59,180, 68,180,134,180,161,225,242,239, + 110,128, 1,101,227,245,242,108,128, 2,168,229,228,233,236,236, + 97,128, 1, 99,232,229,104, 4,180, 80,180, 89,180,103,180,119, + 225,242,225,226,233, 99,128, 6,134,230,233,238,225,236,225,242, + 225,226,233, 99,128,251,123,233,238,233,244,233,225,236,225,242, + 225,226,233, 99,128,251,124,237,229,228,233,225,236,225,242,225, + 226,233, 99,128,251,125,233,242, 99, 2,180,142,180,147,236,101, + 128, 36,227,245,237,230,236,229,248,226,229,236,239,119,128, 30, + 113,239,237,237,225,225,227,227,229,238,116,128, 1, 99,100, 2, + 180,180,180,190,233,229,242,229,243,233,115,128, 30,151,239,116, + 2,180,197,180,206,225,227,227,229,238,116,128, 30,107,226,229, + 236,239,119,128, 30,109,101, 9,180,234,180,245,181, 9,182, 19, + 182, 44,182,108,182,175,182,180,182,232,227,249,242,233,236,236, + 233, 99,128, 4, 66,228,229,243,227,229,238,228,229,242,227,249, + 242,233,236,236,233, 99,128, 4,173,104, 7,181, 25,181, 34,181, + 48,181, 88,181,118,181,159,182, 1,225,242,225,226,233, 99,128, + 6, 42,230,233,238,225,236,225,242,225,226,233, 99,128,254,150, + 232,225,232,105, 2,181, 57,181, 72,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,252,162,243,239,236,225,244,229,228,225, + 242,225,226,233, 99,128,252, 12,105, 2,181, 94,181,109,238,233, + 244,233,225,236,225,242,225,226,233, 99,128,254,151,242,225,231, + 225,238, 97,128, 48,102,234,229,229,237,105, 2,181,128,181,143, + 238,233,244,233,225,236,225,242,225,226,233, 99,128,252,161,243, + 239,236,225,244,229,228,225,242,225,226,233, 99,128,252, 11,109, + 2,181,165,181,199,225,242,226,245,244, 97, 2,181,176,181,185, + 225,242,225,226,233, 99,128, 6, 41,230,233,238,225,236,225,242, + 225,226,233, 99,128,254,148,101, 2,181,205,181,218,228,233,225, + 236,225,242,225,226,233, 99,128,254,152,229,237,105, 2,181,226, + 181,241,238,233,244,233,225,236,225,242,225,226,233, 99,128,252, + 164,243,239,236,225,244,229,228,225,242,225,226,233, 99,128,252, + 14,238,239,239,238,230,233,238,225,236,225,242,225,226,233, 99, + 128,252,115,235,225,244,225,235,225,238, 97,129, 48,198,182, 32, + 232,225,236,230,247,233,228,244,104,128,255,131,108, 2,182, 50, + 182, 69,229,240,232,239,238,101,129, 33, 33,182, 61,226,236,225, + 227,107,128, 38, 14,233,243,232, 97, 2,182, 78,182, 93,231,229, + 228,239,236,225,232,229,226,242,229,119,128, 5,160,241,229,244, + 225,238,225,232,229,226,242,229,119,128, 5,169,110, 4,182,118, + 182,127,182,146,182,167,227,233,242,227,236,101,128, 36,105,233, + 228,229,239,231,242,225,240,232,233,227,240,225,242,229,110,128, + 50, 41,112, 2,182,152,182,159,225,242,229,110,128, 36,125,229, + 242,233,239,100,128, 36,145,242,239,237,225,110,128, 33,121,243, + 104,128, 2,167,116,131, 5,216,182,190,182,210,182,219,228,225, + 231,229,243,104,129,251, 56,182,201,232,229,226,242,229,119,128, + 251, 56,232,229,226,242,229,119,128, 5,216,243,229,227,249,242, + 233,236,236,233, 99,128, 4,181,246,233,114, 2,182,240,182,249, + 232,229,226,242,229,119,128, 5,155,236,229,230,244,232,229,226, + 242,229,119,128, 5,155,104, 6,183, 20,183,172,184, 38,184,170, + 185, 77,186,134, 97, 5,183, 32,183, 42,183, 49,183, 74,183,103, + 226,229,238,231,225,236,105,128, 9,165,228,229,246, 97,128, 9, + 37,231,117, 2,183, 56,183, 65,234,225,242,225,244,105,128, 10, + 165,242,237,245,235,232,105,128, 10, 37,108, 2,183, 80,183, 89, + 225,242,225,226,233, 99,128, 6, 48,230,233,238,225,236,225,242, + 225,226,233, 99,128,254,172,238,244,232,225,235,232,225,116, 3, + 183,118,183,149,183,156,236,239,119, 2,183,126,183,137,236,229, + 230,244,244,232,225,105,128,248,152,242,233,231,232,244,244,232, + 225,105,128,248,151,244,232,225,105,128, 14, 76,245,240,240,229, + 242,236,229,230,244,244,232,225,105,128,248,150,101, 3,183,180, + 183,244,184, 11,104, 4,183,190,183,199,183,213,183,229,225,242, + 225,226,233, 99,128, 6, 43,230,233,238,225,236,225,242,225,226, + 233, 99,128,254,154,233,238,233,244,233,225,236,225,242,225,226, + 233, 99,128,254,155,237,229,228,233,225,236,225,242,225,226,233, + 99,128,254,156,242,101, 2,183,251,184, 4,229,248,233,243,244, + 115,128, 34, 3,230,239,242,101,128, 34, 52,244, 97,130, 3,184, + 184, 20,184, 24, 49,128, 3,209,243,249,237,226,239,236,231,242, + 229,229,107,128, 3,209,105, 2,184, 44,184,130,229,245,244,104, + 4,184, 57,184, 92,184,107,184,116, 97, 2,184, 63,184, 78,227, + 233,242,227,236,229,235,239,242,229,225,110,128, 50,121,240,225, + 242,229,238,235,239,242,229,225,110,128, 50, 25,227,233,242,227, + 236,229,235,239,242,229,225,110,128, 50,107,235,239,242,229,225, + 110,128, 49, 76,240,225,242,229,238,235,239,242,229,225,110,128, + 50, 11,242,244,229,229,110, 2,184,140,184,149,227,233,242,227, + 236,101,128, 36,108,112, 2,184,155,184,162,225,242,229,110,128, + 36,128,229,242,233,239,100,128, 36,148,111, 6,184,184,184,201, + 184,206,184,220,184,225,185, 22,238,225,238,231,237,239,238,244, + 232,239,244,232,225,105,128, 14, 17,239,107,128, 1,173,240,232, + 245,244,232,225,239,244,232,225,105,128, 14, 18,242,110,128, 0, + 254,244,104, 3,184,234,185, 2,185, 12, 97, 2,184,240,184,250, + 232,225,238,244,232,225,105,128, 14, 23,238,244,232,225,105,128, + 14, 16,239,238,231,244,232,225,105,128, 14, 24,245,238,231,244, + 232,225,105,128, 14, 22,245,243,225,238,100, 2,185, 32,185, 43, + 227,249,242,233,236,236,233, 99,128, 4,130,243,243,229,240,225, + 242,225,244,239,114, 2,185, 58,185, 67,225,242,225,226,233, 99, + 128, 6,108,240,229,242,243,233,225,110,128, 6,108,242,229,101, + 144, 0, 51,185,115,185,124,185,134,185,164,185,171,185,181,185, + 206,185,233,186, 11,186, 23,186, 42,186, 53,186, 86,186,108,186, + 116,186,127,225,242,225,226,233, 99,128, 6, 99,226,229,238,231, + 225,236,105,128, 9,233,227,233,242,227,236,101,129, 36, 98,185, + 145,233,238,246,229,242,243,229,243,225,238,243,243,229,242,233, + 102,128, 39,140,228,229,246, 97,128, 9,105,229,233,231,232,244, + 232,115,128, 33, 92,231,117, 2,185,188,185,197,234,225,242,225, + 244,105,128, 10,233,242,237,245,235,232,105,128, 10,105,232, 97, + 2,185,213,185,224,227,235,225,242,225,226,233, 99,128, 6, 99, + 238,231,250,232,239,117,128, 48, 35,105, 2,185,239,186, 1,228, + 229,239,231,242,225,240,232,233,227,240,225,242,229,110,128, 50, + 34,238,230,229,242,233,239,114,128, 32,131,237,239,238,239,243, + 240,225,227,101,128,255, 19,238,245,237,229,242,225,244,239,242, + 226,229,238,231,225,236,105,128, 9,246,239,236,228,243,244,249, + 236,101,128,247, 51,112, 2,186, 59,186, 66,225,242,229,110,128, + 36,118,229,114, 2,186, 73,186, 79,233,239,100,128, 36,138,243, + 233,225,110,128, 6,243,241,245,225,242,244,229,242,115,129, 0, + 190,186, 99,229,237,228,225,243,104,128,246,222,242,239,237,225, + 110,128, 33,114,243,245,240,229,242,233,239,114,128, 0,179,244, + 232,225,105,128, 14, 83,250,243,241,245,225,242,101,128, 51,148, + 105, 7,186,160,186,171,187, 30,187,128,187,140,187,189,187,206, + 232,233,242,225,231,225,238, 97,128, 48, 97,107, 2,186,177,186, + 201,225,244,225,235,225,238, 97,129, 48,193,186,189,232,225,236, + 230,247,233,228,244,104,128,255,129,229,245,116, 4,186,213,186, + 248,187, 7,187, 16, 97, 2,186,219,186,234,227,233,242,227,236, + 229,235,239,242,229,225,110,128, 50,112,240,225,242,229,238,235, + 239,242,229,225,110,128, 50, 16,227,233,242,227,236,229,235,239, + 242,229,225,110,128, 50, 98,235,239,242,229,225,110,128, 49, 55, + 240,225,242,229,238,235,239,242,229,225,110,128, 50, 2,236,228, + 101,133, 2,220,187, 46,187, 57,187, 74,187, 86,187,114,226,229, + 236,239,247,227,237, 98,128, 3, 48, 99, 2,187, 63,187, 68,237, + 98,128, 3, 3,239,237, 98,128, 3, 3,228,239,245,226,236,229, + 227,237, 98,128, 3, 96,111, 2,187, 92,187,102,240,229,242,225, + 244,239,114,128, 34, 60,246,229,242,236,225,249,227,237, 98,128, + 3, 52,246,229,242,244,233,227,225,236,227,237, 98,128, 3, 62, + 237,229,243,227,233,242,227,236,101,128, 34,151,112, 2,187,146, + 187,176,229,232, 97, 2,187,154,187,163,232,229,226,242,229,119, + 128, 5,150,236,229,230,244,232,229,226,242,229,119,128, 5,150, + 240,233,231,245,242,237,245,235,232,105,128, 10,112,244,236,239, + 227,249,242,233,236,236,233,227,227,237, 98,128, 4,131,247,238, + 225,242,237,229,238,233,225,110,128, 5,127,236,233,238,229,226, + 229,236,239,119,128, 30,111,237,239,238,239,243,240,225,227,101, + 128,255, 84,111, 7,188, 3,188, 14,188, 25,188, 50,188,170,188, + 182,189, 10,225,242,237,229,238,233,225,110,128, 5,105,232,233, + 242,225,231,225,238, 97,128, 48,104,235,225,244,225,235,225,238, + 97,129, 48,200,188, 38,232,225,236,230,247,233,228,244,104,128, + 255,132,110, 3,188, 58,188,156,188,161,101, 4,188, 68,188,137, + 188,144,188,150,226,225,114, 4,188, 80,188,109,188,119,188,128, + 229,248,244,242, 97, 2,188, 90,188,100,232,233,231,232,237,239, + 100,128, 2,229,236,239,247,237,239,100,128, 2,233,232,233,231, + 232,237,239,100,128, 2,230,236,239,247,237,239,100,128, 2,232, + 237,233,228,237,239,100,128, 2,231,230,233,246,101,128, 1,189, + 243,233,120,128, 1,133,244,247,111,128, 1,168,239,115,128, 3, + 132,243,241,245,225,242,101,128, 51, 39,240,225,244,225,235,244, + 232,225,105,128, 14, 15,242,244,239,233,243,229,243,232,229,236, + 236,226,242,225,227,235,229,116, 2,188,205,188,235,236,229,230, + 116,130, 48, 20,188,216,188,224,243,237,225,236,108,128,254, 93, + 246,229,242,244,233,227,225,108,128,254, 57,242,233,231,232,116, + 130, 48, 21,188,247,188,255,243,237,225,236,108,128,254, 94,246, + 229,242,244,233,227,225,108,128,254, 58,244,225,239,244,232,225, + 105,128, 14, 21,240, 97, 2,189, 27,189, 39,236,225,244,225,236, + 232,239,239,107,128, 1,171,242,229,110,128, 36,175,114, 3,189, + 53,189, 84,189, 99,225,228,229,237,225,242,107,129, 33, 34,189, + 65,115, 2,189, 71,189, 77,225,238,115,128,248,234,229,242,233, + 102,128,246,219,229,244,242,239,230,236,229,248,232,239,239,107, + 128, 2,136,233,225,103, 4,189,111,189,116,189,121,189,126,228, + 110,128, 37,188,236,102,128, 37,196,242,116,128, 37,186,245,112, + 128, 37,178,115,132, 2,166,189,143,189,182,190, 32,190, 45,225, + 228,105,130, 5,230,189,153,189,173,228,225,231,229,243,104,129, + 251, 70,189,164,232,229,226,242,229,119,128,251, 70,232,229,226, + 242,229,119,128, 5,230,101, 2,189,188,189,199,227,249,242,233, + 236,236,233, 99,128, 4, 70,242,101,134, 5,181,189,216,189,230, + 189,235,189,244,190, 3,190, 19, 49, 2,189,222,189,226, 50,128, + 5,181,101,128, 5,181,178, 98,128, 5,181,232,229,226,242,229, + 119,128, 5,181,238,225,242,242,239,247,232,229,226,242,229,119, + 128, 5,181,241,245,225,242,244,229,242,232,229,226,242,229,119, + 128, 5,181,247,233,228,229,232,229,226,242,229,119,128, 5,181, + 232,229,227,249,242,233,236,236,233, 99,128, 4, 91,245,240,229, + 242,233,239,114,128,246,243,116, 4,190, 65,190,115,190,180,190, + 231, 97, 3,190, 73,190, 83,190, 90,226,229,238,231,225,236,105, + 128, 9,159,228,229,246, 97,128, 9, 31,231,117, 2,190, 97,190, + 106,234,225,242,225,244,105,128, 10,159,242,237,245,235,232,105, + 128, 10, 31,229,104, 4,190,126,190,135,190,149,190,165,225,242, + 225,226,233, 99,128, 6,121,230,233,238,225,236,225,242,225,226, + 233, 99,128,251,103,233,238,233,244,233,225,236,225,242,225,226, + 233, 99,128,251,104,237,229,228,233,225,236,225,242,225,226,233, + 99,128,251,105,232, 97, 3,190,189,190,199,190,206,226,229,238, + 231,225,236,105,128, 9,160,228,229,246, 97,128, 9, 32,231,117, + 2,190,213,190,222,234,225,242,225,244,105,128, 10,160,242,237, + 245,235,232,105,128, 10, 32,245,242,238,229,100,128, 2,135,117, + 3,190,247,191, 2,191, 27,232,233,242,225,231,225,238, 97,128, + 48,100,235,225,244,225,235,225,238, 97,129, 48,196,191, 15,232, + 225,236,230,247,233,228,244,104,128,255,130,243,237,225,236,108, + 2,191, 37,191, 48,232,233,242,225,231,225,238, 97,128, 48, 99, + 235,225,244,225,235,225,238, 97,129, 48,195,191, 61,232,225,236, + 230,247,233,228,244,104,128,255,111,119, 2,191, 79,191,184,101, + 2,191, 85,191,133,236,246,101, 3,191, 95,191,104,191,125,227, + 233,242,227,236,101,128, 36,107,112, 2,191,110,191,117,225,242, + 229,110,128, 36,127,229,242,233,239,100,128, 36,147,242,239,237, + 225,110,128, 33,123,238,244,121, 3,191,143,191,152,191,163,227, + 233,242,227,236,101,128, 36,115,232,225,238,231,250,232,239,117, + 128, 83, 68,112, 2,191,169,191,176,225,242,229,110,128, 36,135, + 229,242,233,239,100,128, 36,155,111,142, 0, 50,191,216,191,225, + 191,235,192, 9,192, 61,192, 86,192,113,192,147,192,159,192,178, + 192,189,192,222,192,230,192,254,225,242,225,226,233, 99,128, 6, + 98,226,229,238,231,225,236,105,128, 9,232,227,233,242,227,236, + 101,129, 36, 97,191,246,233,238,246,229,242,243,229,243,225,238, + 243,243,229,242,233,102,128, 39,139,100, 2,192, 15,192, 21,229, + 246, 97,128, 9,104,239,116, 2,192, 28,192, 39,229,238,236,229, + 225,228,229,114,128, 32, 37,236,229,225,228,229,114,129, 32, 37, + 192, 50,246,229,242,244,233,227,225,108,128,254, 48,231,117, 2, + 192, 68,192, 77,234,225,242,225,244,105,128, 10,232,242,237,245, + 235,232,105,128, 10,104,232, 97, 2,192, 93,192,104,227,235,225, + 242,225,226,233, 99,128, 6, 98,238,231,250,232,239,117,128, 48, + 34,105, 2,192,119,192,137,228,229,239,231,242,225,240,232,233, + 227,240,225,242,229,110,128, 50, 33,238,230,229,242,233,239,114, + 128, 32,130,237,239,238,239,243,240,225,227,101,128,255, 18,238, + 245,237,229,242,225,244,239,242,226,229,238,231,225,236,105,128, + 9,245,239,236,228,243,244,249,236,101,128,247, 50,112, 2,192, + 195,192,202,225,242,229,110,128, 36,117,229,114, 2,192,209,192, + 215,233,239,100,128, 36,137,243,233,225,110,128, 6,242,242,239, + 237,225,110,128, 33,113,115, 2,192,236,192,244,244,242,239,235, + 101,128, 1,187,245,240,229,242,233,239,114,128, 0,178,244,104, + 2,193, 5,193, 10,225,105,128, 14, 82,233,242,228,115,128, 33, + 84,117,145, 0,117,193, 55,193, 63,193,104,193,161,194, 43,194, + 80,194,203,194,219,195, 14,195, 84,195,165,195,174,196, 37,196, + 61,196,169,196,197,197, 55,225,227,245,244,101,128, 0,250, 98, + 4,193, 73,193, 78,193, 87,193, 97,225,114,128, 2,137,229,238, + 231,225,236,105,128, 9,137,239,240,239,237,239,230,111,128, 49, + 40,242,229,246,101,128, 1,109, 99, 3,193,112,193,119,193,151, + 225,242,239,110,128, 1,212,233,242, 99, 2,193,127,193,132,236, + 101,128, 36,228,245,237,230,236,229,120,129, 0,251,193,143,226, + 229,236,239,119,128, 30,119,249,242,233,236,236,233, 99,128, 4, + 67,100, 5,193,173,193,184,193,207,193,213,194, 33,225,244,244, + 225,228,229,246, 97,128, 9, 81,226,108, 2,193,191,193,199,225, + 227,245,244,101,128, 1,113,231,242,225,246,101,128, 2, 21,229, + 246, 97,128, 9, 9,233,229,242,229,243,233,115,133, 0,252,193, + 233,193,241,193,249,194, 16,194, 24,225,227,245,244,101,128, 1, + 216,226,229,236,239,119,128, 30,115, 99, 2,193,255,194, 6,225, + 242,239,110,128, 1,218,249,242,233,236,236,233, 99,128, 4,241, + 231,242,225,246,101,128, 1,220,237,225,227,242,239,110,128, 1, + 214,239,244,226,229,236,239,119,128, 30,229,103, 2,194, 49,194, + 56,242,225,246,101,128, 0,249,117, 2,194, 62,194, 71,234,225, + 242,225,244,105,128, 10,137,242,237,245,235,232,105,128, 10, 9, + 104, 3,194, 88,194, 98,194,176,233,242,225,231,225,238, 97,128, + 48, 70,111, 2,194,104,194,114,239,235,225,226,239,246,101,128, + 30,231,242,110,133, 1,176,194,129,194,137,194,148,194,156,194, + 168,225,227,245,244,101,128, 30,233,228,239,244,226,229,236,239, + 119,128, 30,241,231,242,225,246,101,128, 30,235,232,239,239,235, + 225,226,239,246,101,128, 30,237,244,233,236,228,101,128, 30,239, + 245,238,231,225,242,245,237,236,225,245,116,129, 1,113,194,192, + 227,249,242,233,236,236,233, 99,128, 4,243,233,238,246,229,242, + 244,229,228,226,242,229,246,101,128, 2, 23,107, 3,194,227,194, + 251,195, 6,225,244,225,235,225,238, 97,129, 48,166,194,239,232, + 225,236,230,247,233,228,244,104,128,255,115,227,249,242,233,236, + 236,233, 99,128, 4,121,239,242,229,225,110,128, 49, 92,109, 2, + 195, 20,195, 73, 97, 2,195, 26,195, 59,227,242,239,110,130, 1, + 107,195, 37,195, 48,227,249,242,233,236,236,233, 99,128, 4,239, + 228,233,229,242,229,243,233,115,128, 30,123,244,242,225,231,245, + 242,237,245,235,232,105,128, 10, 65,239,238,239,243,240,225,227, + 101,128,255, 85,110, 2,195, 90,195,145,228,229,242,243,227,239, + 242,101,132, 0, 95,195,109,195,115,195,127,195,138,228,226,108, + 128, 32, 23,237,239,238,239,243,240,225,227,101,128,255, 63,246, + 229,242,244,233,227,225,108,128,254, 51,247,225,246,121,128,254, + 79,105, 2,195,151,195,156,239,110,128, 34, 42,246,229,242,243, + 225,108,128, 34, 0,239,231,239,238,229,107,128, 1,115,112, 5, + 195,186,195,193,195,201,195,216,196, 11,225,242,229,110,128, 36, + 176,226,236,239,227,107,128, 37,128,240,229,242,228,239,244,232, + 229,226,242,229,119,128, 5,196,243,233,236,239,110,131, 3,197, + 195,230,195,251,196, 3,228,233,229,242,229,243,233,115,129, 3, + 203,195,243,244,239,238,239,115,128, 3,176,236,225,244,233,110, + 128, 2,138,244,239,238,239,115,128, 3,205,244,225,227,107, 2, + 196, 20,196, 31,226,229,236,239,247,227,237, 98,128, 3, 29,237, + 239,100,128, 2,212,114, 2,196, 43,196, 55,225,231,245,242,237, + 245,235,232,105,128, 10,115,233,238,103,128, 1,111,115, 3,196, + 69,196, 84,196,129,232,239,242,244,227,249,242,233,236,236,233, + 99,128, 4, 94,237,225,236,108, 2,196, 93,196,104,232,233,242, + 225,231,225,238, 97,128, 48, 69,235,225,244,225,235,225,238, 97, + 129, 48,165,196,117,232,225,236,230,247,233,228,244,104,128,255, + 105,244,242,225,233,231,232,116, 2,196,141,196,152,227,249,242, + 233,236,236,233, 99,128, 4,175,243,244,242,239,235,229,227,249, + 242,233,236,236,233, 99,128, 4,177,244,233,236,228,101,130, 1, + 105,196,181,196,189,225,227,245,244,101,128, 30,121,226,229,236, + 239,119,128, 30,117,117, 5,196,209,196,219,196,226,196,251,197, + 11,226,229,238,231,225,236,105,128, 9,138,228,229,246, 97,128, + 9, 10,231,117, 2,196,233,196,242,234,225,242,225,244,105,128, + 10,138,242,237,245,235,232,105,128, 10, 10,237,225,244,242,225, + 231,245,242,237,245,235,232,105,128, 10, 66,246,239,247,229,236, + 243,233,231,110, 3,197, 27,197, 37,197, 44,226,229,238,231,225, + 236,105,128, 9,194,228,229,246, 97,128, 9, 66,231,245,234,225, + 242,225,244,105,128, 10,194,246,239,247,229,236,243,233,231,110, + 3,197, 71,197, 81,197, 88,226,229,238,231,225,236,105,128, 9, + 193,228,229,246, 97,128, 9, 65,231,245,234,225,242,225,244,105, + 128, 10,193,118,139, 0,118,197,125,198, 17,198, 26,198, 37,198, + 222,198,229,199, 71,199, 83,199,183,199,191,199,212, 97, 4,197, + 135,197,142,197,167,197,178,228,229,246, 97,128, 9, 53,231,117, + 2,197,149,197,158,234,225,242,225,244,105,128, 10,181,242,237, + 245,235,232,105,128, 10, 53,235,225,244,225,235,225,238, 97,128, + 48,247,118,132, 5,213,197,190,197,217,197,249,198, 5,228,225, + 231,229,243,104,130,251, 53,197,203,197,208,182, 53,128,251, 53, + 232,229,226,242,229,119,128,251, 53,104, 2,197,223,197,231,229, + 226,242,229,119,128, 5,213,239,236,225,109,129,251, 75,197,240, + 232,229,226,242,229,119,128,251, 75,246,225,246,232,229,226,242, + 229,119,128, 5,240,249,239,228,232,229,226,242,229,119,128, 5, + 241,227,233,242,227,236,101,128, 36,229,228,239,244,226,229,236, + 239,119,128, 30,127,101, 6,198, 51,198, 62,198,126,198,137,198, + 143,198,210,227,249,242,233,236,236,233, 99,128, 4, 50,104, 4, + 198, 72,198, 81,198, 95,198,111,225,242,225,226,233, 99,128, 6, + 164,230,233,238,225,236,225,242,225,226,233, 99,128,251,107,233, + 238,233,244,233,225,236,225,242,225,226,233, 99,128,251,108,237, + 229,228,233,225,236,225,242,225,226,233, 99,128,251,109,235,225, + 244,225,235,225,238, 97,128, 48,249,238,245,115,128, 38, 64,242, + 244,233,227,225,108, 2,198,154,198,160,226,225,114,128, 0,124, + 236,233,238,101, 4,198,173,198,184,198,195,198,204,225,226,239, + 246,229,227,237, 98,128, 3, 13,226,229,236,239,247,227,237, 98, + 128, 3, 41,236,239,247,237,239,100,128, 2,204,237,239,100,128, + 2,200,247,225,242,237,229,238,233,225,110,128, 5,126,232,239, + 239,107,128, 2,139,105, 3,198,237,198,248,199, 31,235,225,244, + 225,235,225,238, 97,128, 48,248,242,225,237, 97, 3,199, 3,199, + 13,199, 20,226,229,238,231,225,236,105,128, 9,205,228,229,246, + 97,128, 9, 77,231,245,234,225,242,225,244,105,128, 10,205,243, + 225,242,231, 97, 3,199, 43,199, 53,199, 60,226,229,238,231,225, + 236,105,128, 9,131,228,229,246, 97,128, 9, 3,231,245,234,225, + 242,225,244,105,128, 10,131,237,239,238,239,243,240,225,227,101, + 128,255, 86,111, 3,199, 91,199,102,199,172,225,242,237,229,238, + 233,225,110,128, 5,120,233,227,229,100, 2,199,111,199,147,233, + 244,229,242,225,244,233,239,110, 2,199,125,199,136,232,233,242, + 225,231,225,238, 97,128, 48,158,235,225,244,225,235,225,238, 97, + 128, 48,254,237,225,242,235,235,225,238, 97,129, 48,155,199,160, + 232,225,236,230,247,233,228,244,104,128,255,158,235,225,244,225, + 235,225,238, 97,128, 48,250,240,225,242,229,110,128, 36,177,116, + 2,199,197,199,204,233,236,228,101,128, 30,125,245,242,238,229, + 100,128, 2,140,117, 2,199,218,199,229,232,233,242,225,231,225, + 238, 97,128, 48,148,235,225,244,225,235,225,238, 97,128, 48,244, + 119,143, 0,119,200, 18,200,251,201, 5,201, 28,201, 68,201,135, + 201,143,203,114,203,155,203,167,203,242,203,250,204, 1,204, 12, + 204, 21, 97, 8,200, 36,200, 43,200, 53,200, 64,200,102,200,134, + 200,146,200,182,227,245,244,101,128, 30,131,229,235,239,242,229, + 225,110,128, 49, 89,232,233,242,225,231,225,238, 97,128, 48,143, + 107, 2,200, 70,200, 94,225,244,225,235,225,238, 97,129, 48,239, + 200, 82,232,225,236,230,247,233,228,244,104,128,255,156,239,242, + 229,225,110,128, 49, 88,243,237,225,236,108, 2,200,112,200,123, + 232,233,242,225,231,225,238, 97,128, 48,142,235,225,244,225,235, + 225,238, 97,128, 48,238,244,244,239,243,241,245,225,242,101,128, + 51, 87,118, 2,200,152,200,160,229,228,225,243,104,128, 48, 28, + 249,245,238,228,229,242,243,227,239,242,229,246,229,242,244,233, + 227,225,108,128,254, 52,119, 3,200,190,200,199,200,213,225,242, + 225,226,233, 99,128, 6, 72,230,233,238,225,236,225,242,225,226, + 233, 99,128,254,238,232,225,237,250,225,225,226,239,246,101, 2, + 200,228,200,237,225,242,225,226,233, 99,128, 6, 36,230,233,238, + 225,236,225,242,225,226,233, 99,128,254,134,226,243,241,245,225, + 242,101,128, 51,221,227,233,242, 99, 2,201, 14,201, 19,236,101, + 128, 36,230,245,237,230,236,229,120,128, 1,117,100, 2,201, 34, + 201, 44,233,229,242,229,243,233,115,128, 30,133,239,116, 2,201, + 51,201, 60,225,227,227,229,238,116,128, 30,135,226,229,236,239, + 119,128, 30,137,101, 4,201, 78,201, 89,201,101,201,125,232,233, + 242,225,231,225,238, 97,128, 48,145,233,229,242,243,244,242,225, + 243,115,128, 33, 24,107, 2,201,107,201,117,225,244,225,235,225, + 238, 97,128, 48,241,239,242,229,225,110,128, 49, 94,239,235,239, + 242,229,225,110,128, 49, 93,231,242,225,246,101,128, 30,129,232, + 233,244,101, 8,201,164,201,173,202, 1,202, 91,202,175,202,220, + 203, 16,203, 72,226,245,236,236,229,116,128, 37,230, 99, 2,201, + 179,201,199,233,242,227,236,101,129, 37,203,201,189,233,238,246, + 229,242,243,101,128, 37,217,239,242,238,229,242,226,242,225,227, + 235,229,116, 2,201,216,201,236,236,229,230,116,129, 48, 14,201, + 225,246,229,242,244,233,227,225,108,128,254, 67,242,233,231,232, + 116,129, 48, 15,201,246,246,229,242,244,233,227,225,108,128,254, + 68,100, 2,202, 7,202, 48,233,225,237,239,238,100,129, 37,199, + 202, 18,227,239,238,244,225,233,238,233,238,231,226,236,225,227, + 235,243,237,225,236,236,228,233,225,237,239,238,100,128, 37,200, + 239,247,238,240,239,233,238,244,233,238,103, 2,202, 64,202, 80, + 243,237,225,236,236,244,242,233,225,238,231,236,101,128, 37,191, + 244,242,233,225,238,231,236,101,128, 37,189,236,101, 2,202, 98, + 202,140,230,244,240,239,233,238,244,233,238,103, 2,202,113,202, + 129,243,237,225,236,236,244,242,233,225,238,231,236,101,128, 37, + 195,244,242,233,225,238,231,236,101,128, 37,193,238,244,233,227, + 245,236,225,242,226,242,225,227,235,229,116, 2,202,160,202,167, + 236,229,230,116,128, 48, 22,242,233,231,232,116,128, 48, 23,242, + 233,231,232,244,240,239,233,238,244,233,238,103, 2,202,193,202, + 209,243,237,225,236,236,244,242,233,225,238,231,236,101,128, 37, + 185,244,242,233,225,238,231,236,101,128, 37,183,115, 3,202,228, + 203, 2,203, 10,109, 2,202,234,202,246,225,236,236,243,241,245, + 225,242,101,128, 37,171,233,236,233,238,231,230,225,227,101,128, + 38, 58,241,245,225,242,101,128, 37,161,244,225,114,128, 38, 6, + 116, 2,203, 22,203, 33,229,236,229,240,232,239,238,101,128, 38, + 15,239,242,244,239,233,243,229,243,232,229,236,236,226,242,225, + 227,235,229,116, 2,203, 57,203, 64,236,229,230,116,128, 48, 24, + 242,233,231,232,116,128, 48, 25,245,240,240,239,233,238,244,233, + 238,103, 2,203, 87,203,103,243,237,225,236,236,244,242,233,225, + 238,231,236,101,128, 37,181,244,242,233,225,238,231,236,101,128, + 37,179,105, 2,203,120,203,131,232,233,242,225,231,225,238, 97, + 128, 48,144,107, 2,203,137,203,147,225,244,225,235,225,238, 97, + 128, 48,240,239,242,229,225,110,128, 49, 95,237,239,238,239,243, + 240,225,227,101,128,255, 87,111, 4,203,177,203,188,203,213,203, + 231,232,233,242,225,231,225,238, 97,128, 48,146,235,225,244,225, + 235,225,238, 97,129, 48,242,203,201,232,225,236,230,247,233,228, + 244,104,128,255,102,110,129, 32,169,203,219,237,239,238,239,243, + 240,225,227,101,128,255,230,247,225,229,238,244,232,225,105,128, + 14, 39,240,225,242,229,110,128, 36,178,242,233,238,103,128, 30, + 152,243,245,240,229,242,233,239,114,128, 2,183,244,245,242,238, + 229,100,128, 2,141,249,238,110,128, 1,191,120,137, 0,120,204, + 49,204, 60,204, 71,204, 80,204,107,204,120,204,124,204,136,204, + 144,225,226,239,246,229,227,237, 98,128, 3, 61,226,239,240,239, + 237,239,230,111,128, 49, 18,227,233,242,227,236,101,128, 36,231, + 100, 2,204, 86,204, 96,233,229,242,229,243,233,115,128, 30,141, + 239,244,225,227,227,229,238,116,128, 30,139,229,232,225,242,237, + 229,238,233,225,110,128, 5,109,105,128, 3,190,237,239,238,239, + 243,240,225,227,101,128,255, 88,240,225,242,229,110,128, 36,179, + 243,245,240,229,242,233,239,114,128, 2,227,121,143, 0,121,204, + 189,205,148,205,171,205,211,207,177,207,185,207,202,208, 10,208, + 22,209, 19,209, 59,209, 71,209, 82,209,103,210, 76, 97, 11,204, + 213,204,225,204,235,204,242,204,249,205, 3,205, 28,205, 39,205, + 77,205, 90,205,136,225,228,239,243,241,245,225,242,101,128, 51, + 78,226,229,238,231,225,236,105,128, 9,175,227,245,244,101,128, + 0,253,228,229,246, 97,128, 9, 47,229,235,239,242,229,225,110, + 128, 49, 82,231,117, 2,205, 10,205, 19,234,225,242,225,244,105, + 128, 10,175,242,237,245,235,232,105,128, 10, 47,232,233,242,225, + 231,225,238, 97,128, 48,132,107, 2,205, 45,205, 69,225,244,225, + 235,225,238, 97,129, 48,228,205, 57,232,225,236,230,247,233,228, + 244,104,128,255,148,239,242,229,225,110,128, 49, 81,237,225,235, + 235,225,238,244,232,225,105,128, 14, 78,243,237,225,236,108, 2, + 205,100,205,111,232,233,242,225,231,225,238, 97,128, 48,131,235, + 225,244,225,235,225,238, 97,129, 48,227,205,124,232,225,236,230, + 247,233,228,244,104,128,255,108,244,227,249,242,233,236,236,233, + 99,128, 4, 99,227,233,242, 99, 2,205,157,205,162,236,101,128, + 36,232,245,237,230,236,229,120,128, 1,119,100, 2,205,177,205, + 187,233,229,242,229,243,233,115,128, 0,255,239,116, 2,205,194, + 205,203,225,227,227,229,238,116,128, 30,143,226,229,236,239,119, + 128, 30,245,101, 7,205,227,206,235,206,244,207, 6,207, 38,207, + 114,207,165,104, 8,205,245,205,254,206, 32,206, 46,206,119,206, + 135,206,194,206,212,225,242,225,226,233, 99,128, 6, 74,226,225, + 242,242,229,101, 2,206, 9,206, 18,225,242,225,226,233, 99,128, + 6,210,230,233,238,225,236,225,242,225,226,233, 99,128,251,175, + 230,233,238,225,236,225,242,225,226,233, 99,128,254,242,232,225, + 237,250,225,225,226,239,246,101, 4,206, 65,206, 74,206, 88,206, + 104,225,242,225,226,233, 99,128, 6, 38,230,233,238,225,236,225, + 242,225,226,233, 99,128,254,138,233,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,254,139,237,229,228,233,225,236,225,242, + 225,226,233, 99,128,254,140,233,238,233,244,233,225,236,225,242, + 225,226,233, 99,128,254,243,237,101, 2,206,142,206,155,228,233, + 225,236,225,242,225,226,233, 99,128,254,244,229,237,105, 2,206, + 163,206,178,238,233,244,233,225,236,225,242,225,226,233, 99,128, + 252,221,243,239,236,225,244,229,228,225,242,225,226,233, 99,128, + 252, 88,238,239,239,238,230,233,238,225,236,225,242,225,226,233, + 99,128,252,148,244,232,242,229,229,228,239,244,243,226,229,236, + 239,247,225,242,225,226,233, 99,128, 6,209,235,239,242,229,225, + 110,128, 49, 86,110,129, 0,165,206,250,237,239,238,239,243,240, + 225,227,101,128,255,229,111, 2,207, 12,207, 21,235,239,242,229, + 225,110,128, 49, 85,242,233,238,232,233,229,245,232,235,239,242, + 229,225,110,128, 49,134,114, 3,207, 46,207, 82,207, 94,225,232, + 226,229,238,249,239,237,111, 2,207, 60,207, 69,232,229,226,242, + 229,119,128, 5,170,236,229,230,244,232,229,226,242,229,119,128, + 5,170,233,227,249,242,233,236,236,233, 99,128, 4, 75,245,228, + 233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99,128, + 4,249,243,233,229,245,238,103, 3,207,127,207,136,207,152,235, + 239,242,229,225,110,128, 49,129,240,225,238,243,233,239,243,235, + 239,242,229,225,110,128, 49,131,243,233,239,243,235,239,242,229, + 225,110,128, 49,130,244,233,246,232,229,226,242,229,119,128, 5, + 154,231,242,225,246,101,128, 30,243,232,239,239,107,129, 1,180, + 207,194,225,226,239,246,101,128, 30,247,105, 5,207,214,207,225, + 207,236,207,245,207,253,225,242,237,229,238,233,225,110,128, 5, + 117,227,249,242,233,236,236,233, 99,128, 4, 87,235,239,242,229, + 225,110,128, 49, 98,238,249,225,238,103,128, 38, 47,247,238,225, + 242,237,229,238,233,225,110,128, 5,130,237,239,238,239,243,240, + 225,227,101,128,255, 89,111, 7,208, 38,208,108,208,119,208,129, + 208,167,208,213,208,222,100,131, 5,217,208, 48,208, 68,208, 77, + 228,225,231,229,243,104,129,251, 57,208, 59,232,229,226,242,229, + 119,128,251, 57,232,229,226,242,229,119,128, 5,217,249,239,100, + 2,208, 85,208, 94,232,229,226,242,229,119,128, 5,242,240,225, + 244,225,232,232,229,226,242,229,119,128,251, 31,232,233,242,225, + 231,225,238, 97,128, 48,136,233,235,239,242,229,225,110,128, 49, + 137,107, 2,208,135,208,159,225,244,225,235,225,238, 97,129, 48, + 232,208,147,232,225,236,230,247,233,228,244,104,128,255,150,239, + 242,229,225,110,128, 49, 91,243,237,225,236,108, 2,208,177,208, + 188,232,233,242,225,231,225,238, 97,128, 48,135,235,225,244,225, + 235,225,238, 97,129, 48,231,208,201,232,225,236,230,247,233,228, + 244,104,128,255,110,244,231,242,229,229,107,128, 3,243,121, 2, + 208,228,209, 9, 97, 2,208,234,208,244,229,235,239,242,229,225, + 110,128, 49,136,107, 2,208,250,209, 2,239,242,229,225,110,128, + 49,135,244,232,225,105,128, 14, 34,233,238,231,244,232,225,105, + 128, 14, 13,112, 2,209, 25,209, 32,225,242,229,110,128, 36,180, + 239,231,229,231,242,225,237,237,229,238,105,129, 3,122,209, 48, + 231,242,229,229,235,227,237, 98,128, 3, 69,114,129, 1,166,209, + 65,233,238,103,128, 30,153,243,245,240,229,242,233,239,114,128, + 2,184,116, 2,209, 88,209, 95,233,236,228,101,128, 30,249,245, + 242,238,229,100,128, 2,142,117, 5,209,115,209,126,209,136,209, + 174,210, 50,232,233,242,225,231,225,238, 97,128, 48,134,233,235, + 239,242,229,225,110,128, 49,140,107, 2,209,142,209,166,225,244, + 225,235,225,238, 97,129, 48,230,209,154,232,225,236,230,247,233, + 228,244,104,128,255,149,239,242,229,225,110,128, 49, 96,115, 3, + 209,182,209,220,210, 5,226,233,103, 2,209,190,209,201,227,249, + 242,233,236,236,233, 99,128, 4,107,233,239,244,233,230,233,229, + 228,227,249,242,233,236,236,233, 99,128, 4,109,236,233,244,244, + 236,101, 2,209,231,209,242,227,249,242,233,236,236,233, 99,128, + 4,103,233,239,244,233,230,233,229,228,227,249,242,233,236,236, + 233, 99,128, 4,105,237,225,236,108, 2,210, 14,210, 25,232,233, + 242,225,231,225,238, 97,128, 48,133,235,225,244,225,235,225,238, + 97,129, 48,229,210, 38,232,225,236,230,247,233,228,244,104,128, + 255,109,249,101, 2,210, 57,210, 66,235,239,242,229,225,110,128, + 49,139,239,235,239,242,229,225,110,128, 49,138,249, 97, 2,210, + 83,210, 93,226,229,238,231,225,236,105,128, 9,223,228,229,246, + 97,128, 9, 95,122,142, 0,122,210,132,211,140,211,151,211,194, + 211,221,213, 0,213,108,213,150,213,162,213,174,213,202,213,210, + 213,226,213,235, 97, 10,210,154,210,165,210,172,210,179,210,190, + 211, 12,211, 42,211, 53,211, 89,211,101,225,242,237,229,238,233, + 225,110,128, 5,102,227,245,244,101,128, 1,122,228,229,246, 97, + 128, 9, 91,231,245,242,237,245,235,232,105,128, 10, 91,104, 4, + 210,200,210,209,210,223,210,253,225,242,225,226,233, 99,128, 6, + 56,230,233,238,225,236,225,242,225,226,233, 99,128,254,198,105, + 2,210,229,210,244,238,233,244,233,225,236,225,242,225,226,233, + 99,128,254,199,242,225,231,225,238, 97,128, 48, 86,237,229,228, + 233,225,236,225,242,225,226,233, 99,128,254,200,233,110, 2,211, + 19,211, 28,225,242,225,226,233, 99,128, 6, 50,230,233,238,225, + 236,225,242,225,226,233, 99,128,254,176,235,225,244,225,235,225, + 238, 97,128, 48,182,241,229,102, 2,211, 61,211, 75,231,225,228, + 239,236,232,229,226,242,229,119,128, 5,149,241,225,244,225,238, + 232,229,226,242,229,119,128, 5,148,242,241,225,232,229,226,242, + 229,119,128, 5,152,249,233,110,130, 5,214,211,111,211,131,228, + 225,231,229,243,104,129,251, 54,211,122,232,229,226,242,229,119, + 128,251, 54,232,229,226,242,229,119,128, 5,214,226,239,240,239, + 237,239,230,111,128, 49, 23, 99, 3,211,159,211,166,211,188,225, + 242,239,110,128, 1,126,233,242, 99, 2,211,174,211,179,236,101, + 128, 36,233,245,237,230,236,229,120,128, 30,145,245,242,108,128, + 2,145,228,239,116,130, 1,124,211,204,211,213,225,227,227,229, + 238,116,128, 1,124,226,229,236,239,119,128, 30,147,101, 6,211, + 235,211,246,212, 33,212, 44,212, 55,212,251,227,249,242,233,236, + 236,233, 99,128, 4, 55,100, 2,211,252,212, 15,229,243,227,229, + 238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,153,233, + 229,242,229,243,233,243,227,249,242,233,236,236,233, 99,128, 4, + 223,232,233,242,225,231,225,238, 97,128, 48, 92,235,225,244,225, + 235,225,238, 97,128, 48,188,242,111,140, 0, 48,212, 84,212, 93, + 212,103,212,110,212,135,212,148,212,159,212,171,212,182,212,192, + 212,203,212,210,225,242,225,226,233, 99,128, 6, 96,226,229,238, + 231,225,236,105,128, 9,230,228,229,246, 97,128, 9,102,231,117, + 2,212,117,212,126,234,225,242,225,244,105,128, 10,230,242,237, + 245,235,232,105,128, 10,102,232,225,227,235,225,242,225,226,233, + 99,128, 6, 96,233,238,230,229,242,233,239,114,128, 32,128,237, + 239,238,239,243,240,225,227,101,128,255, 16,239,236,228,243,244, + 249,236,101,128,247, 48,240,229,242,243,233,225,110,128, 6,240, + 243,245,240,229,242,233,239,114,128, 32,112,244,232,225,105,128, + 14, 80,247,233,228,244,104, 3,212,222,212,231,212,243,234,239, + 233,238,229,114,128,254,255,238,239,238,234,239,233,238,229,114, + 128, 32, 12,243,240,225,227,101,128, 32, 11,244, 97,128, 3,182, + 104, 2,213, 6,213, 17,226,239,240,239,237,239,230,111,128, 49, + 19,101, 4,213, 27,213, 38,213, 54,213, 65,225,242,237,229,238, + 233,225,110,128, 5,106,226,242,229,246,229,227,249,242,233,236, + 236,233, 99,128, 4,194,227,249,242,233,236,236,233, 99,128, 4, + 54,100, 2,213, 71,213, 90,229,243,227,229,238,228,229,242,227, + 249,242,233,236,236,233, 99,128, 4,151,233,229,242,229,243,233, + 243,227,249,242,233,236,236,233, 99,128, 4,221,105, 3,213,116, + 213,127,213,138,232,233,242,225,231,225,238, 97,128, 48, 88,235, + 225,244,225,235,225,238, 97,128, 48,184,238,239,242,232,229,226, + 242,229,119,128, 5,174,236,233,238,229,226,229,236,239,119,128, + 30,149,237,239,238,239,243,240,225,227,101,128,255, 90,111, 2, + 213,180,213,191,232,233,242,225,231,225,238, 97,128, 48, 94,235, + 225,244,225,235,225,238, 97,128, 48,190,240,225,242,229,110,128, + 36,181,242,229,244,242,239,230,236,229,248,232,239,239,107,128, + 2,144,243,244,242,239,235,101,128, 1,182,117, 2,213,241,213, + 252,232,233,242,225,231,225,238, 97,128, 48, 90,235,225,244,225, + 235,225,238, 97,128, 48,186 + }; + + + /* + * This function searches the compressed table efficiently. + */ + static unsigned long + ft_get_adobe_glyph_index( const char* name, + const char* limit ) + { + int c = 0; + int count, min, max; + const unsigned char* p = ft_adobe_glyph_list; + + + if ( name == 0 || name >= limit ) + goto NotFound; + + c = *name++; + count = p[1]; + p += 2; + + min = 0; + max = count; + + while ( min < max ) + { + int mid = ( min + max ) >> 1; + const unsigned char* q = p + mid * 2; + int c2; + + + q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] ); + + c2 = q[0] & 127; + if ( c2 == c ) + { + p = q; + goto Found; + } + if ( c2 < c ) + min = mid + 1; + else + max = mid; + } + goto NotFound; + + Found: + for (;;) + { + /* assert (*p & 127) == c */ + + if ( name >= limit ) + { + if ( (p[0] & 128) == 0 && + (p[1] & 128) != 0 ) + return (unsigned long)( ( (int)p[2] << 8 ) | p[3] ); + + goto NotFound; + } + c = *name++; + if ( p[0] & 128 ) + { + p++; + if ( c != (p[0] & 127) ) + goto NotFound; + + continue; + } + + p++; + count = p[0] & 127; + if ( p[0] & 128 ) + p += 2; + + p++; + + for ( ; count > 0; count--, p += 2 ) + { + int offset = ( (int)p[0] << 8 ) | p[1]; + const unsigned char* q = ft_adobe_glyph_list + offset; + + if ( c == ( q[0] & 127 ) ) + { + p = q; + goto NextIter; + } + } + goto NotFound; + + NextIter: + ; + } + + NotFound: + return 0; + } + + /* END */ diff --git a/src/libs/freetype2/raster/ftmisc.h b/src/libs/freetype2/raster/ftmisc.h new file mode 100644 index 0000000000..c5dbd50d00 --- /dev/null +++ b/src/libs/freetype2/raster/ftmisc.h @@ -0,0 +1,83 @@ +/***************************************************************************/ +/* */ +/* ftmisc.h */ +/* */ +/* Miscellaneous macros for stand-alone rasterizer (specification */ +/* only). */ +/* */ +/* Copyright 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used */ +/* modified and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + + /***************************************************/ + /* */ + /* This file is *not* portable! You have to adapt */ + /* its definitions to your platform. */ + /* */ + /***************************************************/ + +#ifndef __FTMISC_H__ +#define __FTMISC_H__ + +#include <string.h> /* memset */ + +#define FT_BEGIN_HEADER +#define FT_END_HEADER + +#define FT_LOCAL_DEF( x ) static x + + /* from include/freetype2/fttypes.h */ + + typedef unsigned char FT_Byte; + typedef signed int FT_Int; + typedef unsigned int FT_UInt; + typedef signed long FT_Long; + typedef unsigned long FT_ULong; + typedef signed long FT_F26Dot6; + typedef int FT_Error; + +#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ + ( ( (FT_ULong)_x1 << 24 ) | \ + ( (FT_ULong)_x2 << 16 ) | \ + ( (FT_ULong)_x3 << 8 ) | \ + (FT_ULong)_x4 ) + + + /* from src/ftcalc.c */ + +#include <inttypes.h> + + typedef int64_t FT_Int64; + + static FT_Long + FT_MulDiv( FT_Long a, + FT_Long b, + FT_Long c ) + { + FT_Int s; + FT_Long d; + + + s = 1; + if ( a < 0 ) { a = -a; s = -1; } + if ( b < 0 ) { b = -b; s = -s; } + if ( c < 0 ) { c = -c; s = -s; } + + d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c + : 0x7FFFFFFFL ); + + return ( s > 0 ) ? d : -d; + } + +#endif /* __FTMISC_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/raster/ftraster.c b/src/libs/freetype2/raster/ftraster.c index 757cba758c..cb9f946e56 100644 --- a/src/libs/freetype2/raster/ftraster.c +++ b/src/libs/freetype2/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,15 +17,49 @@ /*************************************************************************/ /* */ - /* This is a rewrite of the FreeType 1.x scan-line converter */ + /* This file can be compiled without the rest of the FreeType engine, by */ + /* defining the _STANDALONE_ macro when compiling it. You also need to */ + /* put the files `ftimage.h' and `ftmisc.h' into the $(incdir) */ + /* directory. Typically, you should do something like */ + /* */ + /* - copy `src/raster/ftraster.c' (this file) to your current directory */ + /* */ + /* - copy `include/freetype/ftimage.h' and `src/raster/ftmisc.h' */ + /* to your current directory */ + /* */ + /* - compile `ftraster' with the _STANDALONE_ macro defined, as in */ + /* */ + /* cc -c -D_STANDALONE_ ftraster.c */ + /* */ + /* The renderer can be initialized with a call to */ + /* `ft_standard_raster.raster_new'; a bitmap can be generated */ + /* with a call to `ft_standard_raster.raster_render'. */ + /* */ + /* See the comments and documentation in the file `ftimage.h' for more */ + /* details on how the raster works. */ /* */ /*************************************************************************/ + /*************************************************************************/ + /* */ + /* This is a rewrite of the FreeType 1.x scan-line converter */ + /* */ + /*************************************************************************/ + +#ifdef _STANDALONE_ + +#include "ftmisc.h" +#include "ftimage.h" + +#else /* !_STANDALONE_ */ + #include <ft2build.h> #include "ftraster.h" #include FT_INTERNAL_CALC_H /* for FT_MulDiv only */ +#endif /* !_STANDALONE_ */ + /*************************************************************************/ /* */ @@ -108,9 +142,6 @@ /* define DEBUG_RASTER if you want to compile a debugging version */ #define xxxDEBUG_RASTER - /* The default render pool size in bytes */ -#define RASTER_RENDER_POOL 8192 - /* undefine FT_RASTER_OPTION_ANTI_ALIASING if you do not want to support */ /* 5-levels anti-aliasing */ #ifdef FT_CONFIG_OPTION_5_GRAY_LEVELS @@ -156,7 +187,9 @@ #endif #ifndef FT_TRACE -#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */ +#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */ +#define FT_TRACE1( x ) do ; while ( 0 ) /* nothing */ +#define FT_TRACE6( x ) do ; while ( 0 ) /* nothing */ #endif #define Raster_Err_None 0 @@ -166,6 +199,7 @@ #define Raster_Err_Invalid -4 #define Raster_Err_Unsupported -5 +#define ft_memset memset #else /* _STANDALONE_ */ @@ -190,6 +224,9 @@ #define FT_MEM_SET( d, s, c ) ft_memset( d, s, c ) #endif +#ifndef FT_MEM_ZERO +#define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count ) +#endif /* FMulDiv means `Fast MulDiv'; it is used in case where `b' is */ /* typically a small value and the result of a*b is known to fit into */ @@ -251,6 +288,16 @@ typedef unsigned char Byte, *PByte; typedef char Bool; + + typedef union Alignment_ + { + long l; + void* p; + void (*f)(void); + + } Alignment, *PAlignment; + + typedef struct TPoint_ { Long x; @@ -313,10 +360,10 @@ #define AlignProfileSize \ - ( ( sizeof ( TProfile ) + sizeof ( long ) - 1 ) / sizeof ( long ) ) + ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) ) -#ifdef TT_STATIC_RASTER +#ifdef FT_STATIC_RASTER #define RAS_ARGS /* void */ @@ -328,7 +375,7 @@ #define FT_UNUSED_RASTER do ; while ( 0 ) -#else /* TT_STATIC_RASTER */ +#else /* FT_STATIC_RASTER */ #define RAS_ARGS TRaster_Instance* raster, @@ -340,7 +387,7 @@ #define FT_UNUSED_RASTER FT_UNUSED( raster ) -#endif /* TT_STATIC_RASTER */ +#endif /* FT_STATIC_RASTER */ typedef struct TRaster_Instance_ TRaster_Instance; @@ -488,7 +535,7 @@ }; -#ifdef FT_CONFIG_OPTION_STATIC_RASTER +#ifdef FT_STATIC_RASTER static TRaster_Instance cur_ras; #define ras cur_ras @@ -497,7 +544,7 @@ #define ras (*raster) -#endif /* FT_CONFIG_OPTION_STATIC_RASTER */ +#endif /* FT_STATIC_RASTER */ /*************************************************************************/ @@ -1248,10 +1295,10 @@ /* */ /* <Input> */ /* x :: The x-coordinate of the segment's end point (its start point */ - /* is stored in `LastX'). */ + /* is stored in `lastX'). */ /* */ /* y :: The y-coordinate of the segment's end point (its start point */ - /* is stored in `LastY'). */ + /* is stored in `lastY'). */ /* */ /* <Return> */ /* SUCCESS on success, FAILURE on render pool overflow or incorrect */ @@ -1342,10 +1389,10 @@ /* cy :: The y-coordinate of the arc's new control point. */ /* */ /* x :: The x-coordinate of the arc's end point (its start point is */ - /* stored in `LastX'). */ + /* stored in `lastX'). */ /* */ /* y :: The y-coordinate of the arc's end point (its start point is */ - /* stored in `LastY'). */ + /* stored in `lastY'). */ /* */ /* <Return> */ /* SUCCESS on success, FAILURE on render pool overflow or incorrect */ @@ -1456,10 +1503,10 @@ /* cy2 :: The y-coordinate of the arc's second new control point. */ /* */ /* x :: The x-coordinate of the arc's end point (its start point is */ - /* stored in `LastX'). */ + /* stored in `lastX'). */ /* */ /* y :: The y-coordinate of the arc's end point (its start point is */ - /* stored in `LastY'). */ + /* stored in `lastY'). */ /* */ /* <Return> */ /* SUCCESS on success, FAILURE on render pool overflow or incorrect */ @@ -2243,7 +2290,7 @@ Short* max ) { /* nothing, really */ - FT_UNUSED( raster ); + FT_UNUSED_RASTER; FT_UNUSED( min ); FT_UNUSED( max ); } @@ -2392,7 +2439,7 @@ Horizontal_Sweep_Step( RAS_ARG ) { /* Nothing, really */ - FT_UNUSED( raster ); + FT_UNUSED_RASTER; } @@ -2539,7 +2586,7 @@ PProfile right ) { /* nothing, really */ - FT_UNUSED( raster ); + FT_UNUSED_RASTER; FT_UNUSED( y ); FT_UNUSED( x1 ); FT_UNUSED( x2 ); @@ -2974,6 +3021,9 @@ Set_High_Precision( RAS_VARS ras.outline.flags & FT_OUTLINE_HIGH_PRECISION ); ras.scale_shift = ras.precision_shift; + /* Drop-out mode 2 is hard-coded since this is the only mode used */ + /* on Windows platforms. Using other modes, as specified by the */ + /* font, results in misplaced pixels. */ ras.dropOutControl = 2; ras.second_pass = (FT_Byte)( !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS ) ); @@ -3010,7 +3060,7 @@ return error; } - return Raster_Err_Ok; + return Raster_Err_None; } @@ -3038,6 +3088,9 @@ Set_High_Precision( RAS_VARS ras.outline.flags & FT_OUTLINE_HIGH_PRECISION ); ras.scale_shift = ras.precision_shift + 1; + /* Drop-out mode 2 is hard-coded since this is the only mode used */ + /* on Windows platforms. Using other modes, as specified by the */ + /* font, results in misplaced pixels. */ ras.dropOutControl = 2; ras.second_pass = !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS ); @@ -3083,7 +3136,7 @@ return error; } - return Raster_Err_Ok; + return Raster_Err_None; } #else /* !FT_RASTER_OPTION_ANTI_ALIASING */ @@ -3093,7 +3146,7 @@ { FT_UNUSED_RASTER; - return Raster_Err_Cannot_Render_Glyph; + return Raster_Err_Unsupported; } #endif /* !FT_RASTER_OPTION_ANTI_ALIASING */ @@ -3116,7 +3169,7 @@ ( ( c << 2 ) & 0x0030 ) | (c & 0x0003 ); - raster->count_table[n] = (UInt)c; + ras.count_table[n] = (UInt)c; } #ifdef FT_RASTER_OPTION_ANTI_ALIASING @@ -3125,7 +3178,7 @@ for ( n = 0; n < 5; n++ ) raster->grays[n] = n * 255 / 4; - raster->gray_width = RASTER_GRAY_LINES / 2; + ras.gray_width = RASTER_GRAY_LINES / 2; #endif } @@ -3142,10 +3195,10 @@ ft_black_new( void* memory, FT_Raster *araster ) { - static FT_RasterRec_ the_raster; + static TRaster_Instance the_raster; - *araster = &the_raster; + *araster = (FT_Raster)&the_raster; FT_MEM_ZERO( &the_raster, sizeof ( the_raster ) ); ft_black_init( &the_raster ); @@ -3157,7 +3210,7 @@ ft_black_done( FT_Raster raster ) { /* nothing */ - raster->init = 0; + FT_UNUSED( raster ); } @@ -3198,14 +3251,14 @@ static void ft_black_reset( TRaster_Instance* raster, - const char* pool_base, + char* pool_base, long pool_size ) { - if ( raster && pool_base && pool_size >= 4096 ) + if ( (&ras) && pool_base && pool_size >= 4096 ) { /* save the pool */ - raster->buff = (PLong)pool_base; - raster->sizeBuff = raster->buff + pool_size / sizeof ( Long ); + ras.buff = (PLong)pool_base; + ras.sizeBuff = ras.buff + pool_size / sizeof ( Long ); } } @@ -3220,11 +3273,11 @@ if ( mode == FT_MAKE_TAG( 'p', 'a', 'l', '5' ) ) { /* set 5-levels gray palette */ - raster->grays[0] = palette[0]; - raster->grays[1] = palette[1]; - raster->grays[2] = palette[2]; - raster->grays[3] = palette[3]; - raster->grays[4] = palette[4]; + ras.grays[0] = palette[0]; + ras.grays[1] = palette[1]; + ras.grays[2] = palette[2]; + ras.grays[3] = palette[3]; + ras.grays[4] = palette[4]; } #else @@ -3238,14 +3291,14 @@ static int - ft_black_render( TRaster_Instance* raster, - FT_Raster_Params* params ) + ft_black_render( TRaster_Instance* raster, + const FT_Raster_Params* params ) { - FT_Outline* outline = (FT_Outline*)params->source; - FT_Bitmap* target_map = params->target; + const FT_Outline* outline = (const FT_Outline*)params->source; + const FT_Bitmap* target_map = params->target; - if ( !raster || !raster->buff || !raster->sizeBuff ) + if ( !(&ras) || !ras.buff || !ras.sizeBuff ) return Raster_Err_Not_Ini; /* return immediately if the outline is empty */ @@ -3269,8 +3322,8 @@ ras.target = *target_map; return ( ( params->flags & FT_RASTER_FLAG_AA ) - ? Render_Gray_Glyph( raster ) - : Render_Glyph( raster ) ); + ? Render_Gray_Glyph( RAS_VAR ) + : Render_Glyph( RAS_VAR ) ); } diff --git a/src/libs/freetype2/raster/ftrend1.c b/src/libs/freetype2/raster/ftrend1.c index a17ef9b613..ed75fb6055 100644 --- a/src/libs/freetype2/raster/ftrend1.c +++ b/src/libs/freetype2/raster/ftrend1.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -55,10 +55,10 @@ /* transform a given glyph image */ static FT_Error - ft_raster1_transform( FT_Renderer render, - FT_GlyphSlot slot, - FT_Matrix* matrix, - FT_Vector* delta ) + ft_raster1_transform( FT_Renderer render, + FT_GlyphSlot slot, + const FT_Matrix* matrix, + const FT_Vector* delta ) { FT_Error error = Raster_Err_Ok; @@ -95,10 +95,10 @@ /* convert a slot's glyph image into a bitmap */ static FT_Error - ft_raster1_render( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - FT_Vector* origin ) + ft_raster1_render( FT_Renderer render, + FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ) { FT_Error error; FT_Outline* outline; diff --git a/src/libs/freetype2/sfnt/Jamfile b/src/libs/freetype2/sfnt/Jamfile index 0399b6d245..5b7dd98f2c 100644 --- a/src/libs/freetype2/sfnt/Jamfile +++ b/src/libs/freetype2/sfnt/Jamfile @@ -10,7 +10,7 @@ UseFreeTypeHeaders ; if $(FT2_MULTI) { - _sources = sfobjs sfdriver ttcmap0 ttpost ttload ttsbit ; + _sources = sfobjs sfdriver ttcmap ttpost ttload ttsbit ttkern ; } else { diff --git a/src/libs/freetype2/sfnt/rules.mk b/src/libs/freetype2/sfnt/rules.mk index f132385491..e15681b21b 100644 --- a/src/libs/freetype2/sfnt/rules.mk +++ b/src/libs/freetype2/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003 by +# Copyright 1996-2000, 2002, 2003, 2004, 2005 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -26,9 +26,10 @@ SFNT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SFNT_DIR)) # SFNT driver sources (i.e., C files) # SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c \ - $(SFNT_DIR)/ttcmap0.c \ + $(SFNT_DIR)/ttcmap.c \ $(SFNT_DIR)/ttsbit.c \ $(SFNT_DIR)/ttpost.c \ + $(SFNT_DIR)/ttkern.c \ $(SFNT_DIR)/sfobjs.c \ $(SFNT_DIR)/sfdriver.c diff --git a/src/libs/freetype2/sfnt/sfdriver.c b/src/libs/freetype2/sfnt/sfdriver.c index 7da53d2f15..96a312dfa5 100644 --- a/src/libs/freetype2/sfnt/sfdriver.c +++ b/src/libs/freetype2/sfnt/sfdriver.c @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -34,7 +34,8 @@ #include "ttpost.h" #endif -#include "ttcmap0.h" +#include "ttcmap.h" +#include "ttkern.h" #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_POSTSCRIPT_NAME_H @@ -92,10 +93,30 @@ } + static FT_Error + sfnt_table_info( TT_Face face, + FT_UInt idx, + FT_ULong *tag, + FT_ULong *length ) + { + if ( !tag || !length ) + return SFNT_Err_Invalid_Argument; + + if ( idx >= face->num_tables ) + return SFNT_Err_Table_Missing; + + *tag = face->dir_tables[idx].Tag; + *length = face->dir_tables[idx].Length; + + return SFNT_Err_Ok; + } + + static const FT_Service_SFNT_TableRec sfnt_service_sfnt_table = { (FT_SFNT_TableLoadFunc)tt_face_load_any, - (FT_SFNT_TableGetFunc) get_sfnt_table + (FT_SFNT_TableGetFunc) get_sfnt_table, + (FT_SFNT_TableInfoFunc)sfnt_table_info }; @@ -346,8 +367,8 @@ /* see `ttsbit.h' and `sfnt.h' */ tt_face_set_sbit_strike, tt_face_load_sbit_strikes, - tt_find_sbit_image, - tt_load_sbit_metrics, + 0 /* tt_find_sbit_image */, + 0 /* tt_load_sbit_metrics */, tt_face_load_sbit_image, tt_face_free_sbit_strikes, @@ -356,8 +377,8 @@ 0, 0, 0, - 0, - 0, + 0, + 0, 0, 0, @@ -365,6 +386,9 @@ #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES + /* see `ttkern.h' */ + tt_face_get_kerning, + /* see `ttpost.h' */ tt_face_get_ps_name, tt_face_free_ps_names, diff --git a/src/libs/freetype2/sfnt/sferrors.h b/src/libs/freetype2/sfnt/sferrors.h index fd2736b6c8..27f90de285 100644 --- a/src/libs/freetype2/sfnt/sferrors.h +++ b/src/libs/freetype2/sfnt/sferrors.h @@ -4,7 +4,7 @@ /* */ /* SFNT error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,6 +32,8 @@ #define FT_ERR_PREFIX SFNT_Err_ #define FT_ERR_BASE FT_Mod_Err_SFNT +#define FT_KEEP_ERR_PREFIX + #include FT_ERRORS_H #endif /* __SFERRORS_H__ */ diff --git a/src/libs/freetype2/sfnt/sfnt.c b/src/libs/freetype2/sfnt/sfnt.c index 90c1bee911..798f923fa8 100644 --- a/src/libs/freetype2/sfnt/sfnt.c +++ b/src/libs/freetype2/sfnt/sfnt.c @@ -4,7 +4,7 @@ /* */ /* Single object library component. */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,7 +20,8 @@ #include <ft2build.h> #include "ttload.c" -#include "ttcmap0.c" +#include "ttcmap.c" +#include "ttkern.c" #include "sfobjs.c" #include "sfdriver.c" diff --git a/src/libs/freetype2/sfnt/sfobjs.c b/src/libs/freetype2/sfnt/sfobjs.c index cb304fdc18..e2d2a17c6d 100644 --- a/src/libs/freetype2/sfnt/sfobjs.c +++ b/src/libs/freetype2/sfnt/sfobjs.c @@ -4,7 +4,7 @@ /* */ /* SFNT object management (base). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,7 +19,8 @@ #include <ft2build.h> #include "sfobjs.h" #include "ttload.h" -#include "ttcmap0.h" +#include "ttcmap.h" +#include "ttkern.h" #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H @@ -160,6 +161,8 @@ FT_Int found_win = -1; FT_Int found_unicode = -1; + FT_Bool is_english = 0; + TT_NameEntry_ConvertFunc convert; @@ -205,7 +208,8 @@ case TT_MS_ID_SYMBOL_CS: case TT_MS_ID_UNICODE_CS: case TT_MS_ID_UCS_4: - found_win = n; + is_english = FT_BOOL( ( rec->languageID & 0x3FF ) == 0x009 ); + found_win = n; break; default: @@ -222,9 +226,10 @@ /* some fonts contain invalid Unicode or Macintosh formatted entries; */ /* we will thus favor names encoded in Windows formats if available */ + /* (provided it is an English name) */ /* */ convert = NULL; - if ( found_win >= 0 ) + if ( found_win >= 0 && !( found_apple >= 0 && !is_english ) ) { rec = face->name_table.names + found_win; switch ( rec->encodingID ) @@ -263,7 +268,7 @@ FT_UNUSED( error ); - if ( FT_NEW_ARRAY ( rec->string, rec->stringLength ) || + if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) || FT_STREAM_SEEK( rec->stringOffset ) || FT_STREAM_READ( rec->string, rec->stringLength ) ) { @@ -431,11 +436,11 @@ /* do we have outlines in there? */ #ifdef FT_CONFIG_OPTION_INCREMENTAL has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 || - tt_face_lookup_table( face, TTAG_glyf ) != 0 || - tt_face_lookup_table( face, TTAG_CFF ) != 0 ); + tt_face_lookup_table( face, TTAG_glyf ) != 0 || + tt_face_lookup_table( face, TTAG_CFF ) != 0 ); #else has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 || - tt_face_lookup_table( face, TTAG_CFF ) != 0 ); + tt_face_lookup_table( face, TTAG_CFF ) != 0 ); #endif is_apple_sbit = 0; @@ -499,31 +504,39 @@ #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ if ( LOAD_( hdmx ) || - LOAD_( gasp ) || - LOAD_( kerning ) || LOAD_( pclt ) ) goto Exit; + /* consider the kerning and gasp tables as optional */ + (void)LOAD_( gasp ); + (void)LOAD_( kerning ); + + error = SFNT_Err_Ok; + face->root.family_name = tt_face_get_name( face, - TT_NAME_ID_FONT_FAMILY ); - face->root.style_name = tt_face_get_name( face, - TT_NAME_ID_FONT_SUBFAMILY ); + TT_NAME_ID_PREFERRED_FAMILY ); + if ( !face->root.family_name ) + face->root.family_name = tt_face_get_name( face, + TT_NAME_ID_FONT_FAMILY ); + + face->root.style_name = tt_face_get_name( face, + TT_NAME_ID_PREFERRED_SUBFAMILY ); + if ( !face->root.style_name ) + face->root.style_name = tt_face_get_name( face, + TT_NAME_ID_FONT_SUBFAMILY ); /* now set up root fields */ { FT_Face root = &face->root; - FT_Int32 flags = 0; - FT_Memory memory; + FT_Int32 flags = root->face_flags; - memory = root->memory; - /*********************************************************************/ /* */ /* Compute face flags. */ /* */ if ( has_outline == TRUE ) - flags = FT_FACE_FLAG_SCALABLE; /* scalable outlines */ + flags |= FT_FACE_FLAG_SCALABLE; /* scalable outlines */ flags |= FT_FACE_FLAG_SFNT | /* SFNT file format */ FT_FACE_FLAG_HORIZONTAL; /* horizontal data */ @@ -542,9 +555,20 @@ if ( face->vertical_info ) flags |= FT_FACE_FLAG_VERTICAL; +#if 0 /* kerning available ? */ - if ( face->kern_pairs ) + if ( TT_FACE_HAS_KERNING( face ) ) flags |= FT_FACE_FLAG_KERNING; +#endif + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + /* Don't bother to load the tables unless somebody asks for them. */ + /* No need to do work which will (probably) not be used. */ + if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 && + tt_face_lookup_table( face, TTAG_fvar ) != 0 && + tt_face_lookup_table( face, TTAG_gvar ) != 0 ) + flags |= FT_FACE_FLAG_MULTIPLE_MASTERS; +#endif root->face_flags = flags; @@ -610,59 +634,6 @@ } -#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - - if ( face->num_sbit_strikes ) - { - FT_ULong n; - - - root->face_flags |= FT_FACE_FLAG_FIXED_SIZES; - -#if 0 - /* XXX: I don't know criteria whether layout is horizontal */ - /* or vertical. */ - if ( has_outline.... ) - { - ... - root->face_flags |= FT_FACE_FLAG_VERTICAL; - } -#endif - root->num_fixed_sizes = (FT_Int)face->num_sbit_strikes; - - if ( FT_NEW_ARRAY( root->available_sizes, face->num_sbit_strikes ) ) - goto Exit; - - for ( n = 0 ; n < face->num_sbit_strikes ; n++ ) - { - FT_Bitmap_Size* bsize = root->available_sizes + n; - TT_SBit_Strike strike = face->sbit_strikes + n; - FT_UShort fupem = face->header.Units_Per_EM; - FT_Short height = (FT_Short)( face->horizontal.Ascender - - face->horizontal.Descender + - face->horizontal.Line_Gap ); - FT_Short avg = face->os2.xAvgCharWidth; - - - /* assume 72dpi */ - bsize->height = - (FT_Short)( ( height * strike->y_ppem + fupem/2 ) / fupem ); - bsize->width = - (FT_Short)( ( avg * strike->y_ppem + fupem/2 ) / fupem ); - bsize->size = strike->y_ppem << 6; - bsize->x_ppem = strike->x_ppem << 6; - bsize->y_ppem = strike->y_ppem << 6; - } - } - else - -#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ - - { - root->num_fixed_sizes = 0; - root->available_sizes = 0; - } - /*********************************************************************/ /* */ /* Set up metrics. */ @@ -782,8 +753,7 @@ } /* freeing the kerning table */ - FT_FREE( face->kern_pairs ); - face->num_kern_pairs = 0; + tt_face_done_kern( face ); /* freeing the collection table */ FT_FREE( face->ttc_header.offsets ); @@ -803,8 +773,20 @@ } /* freeing the horizontal metrics */ +#ifdef FT_OPTIMIZE_MEMORY + { + FT_Stream stream = FT_FACE_STREAM( face ); + + + FT_FRAME_RELEASE( face->horz_metrics ); + FT_FRAME_RELEASE( face->vert_metrics ); + face->horz_metrics_size = 0; + face->vert_metrics_size = 0; + } +#else FT_FREE( face->horizontal.long_metrics ); FT_FREE( face->horizontal.short_metrics ); +#endif /* freeing the vertical ones, if any */ if ( face->vertical_info ) @@ -829,9 +811,10 @@ FT_FREE( face->root.style_name ); /* freeing sbit size table */ + FT_FREE( face->root.available_sizes ); face->root.num_fixed_sizes = 0; - if ( face->root.available_sizes ) - FT_FREE( face->root.available_sizes ); + + FT_FREE( face->postscript_name ); face->sfnt = 0; } diff --git a/src/libs/freetype2/sfnt/ttcmap.c b/src/libs/freetype2/sfnt/ttcmap.c new file mode 100644 index 0000000000..0f3a3241ce --- /dev/null +++ b/src/libs/freetype2/sfnt/ttcmap.c @@ -0,0 +1,2214 @@ +/***************************************************************************/ +/* */ +/* ttcmap.c */ +/* */ +/* TrueType character mapping table (cmap) support (body). */ +/* */ +/* Copyright 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + +#include "sferrors.h" /* must come before FT_INTERNAL_VALIDATE_H */ + +#include FT_INTERNAL_VALIDATE_H +#include FT_INTERNAL_STREAM_H +#include "ttload.h" +#include "ttcmap.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_ttcmap + + +#define TT_PEEK_SHORT FT_PEEK_SHORT +#define TT_PEEK_USHORT FT_PEEK_USHORT +#define TT_PEEK_LONG FT_PEEK_LONG +#define TT_PEEK_ULONG FT_PEEK_ULONG + +#define TT_NEXT_SHORT FT_NEXT_SHORT +#define TT_NEXT_USHORT FT_NEXT_USHORT +#define TT_NEXT_LONG FT_NEXT_LONG +#define TT_NEXT_ULONG FT_NEXT_ULONG + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap_init( TT_CMap cmap, + FT_Byte* table ) + { + cmap->data = table; + return SFNT_Err_Ok; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FORMAT 0 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* TABLE OVERVIEW */ + /* -------------- */ + /* */ + /* NAME OFFSET TYPE DESCRIPTION */ + /* */ + /* format 0 USHORT must be 0 */ + /* length 2 USHORT table length in bytes */ + /* language 4 USHORT Mac language code */ + /* glyph_ids 6 BYTE[256] array of glyph indices */ + /* 262 */ + /* */ + +#ifdef TT_CONFIG_CMAP_FORMAT_0 + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap0_validate( FT_Byte* table, + FT_Validator valid ) + { + FT_Byte* p = table + 2; + FT_UInt length = TT_NEXT_USHORT( p ); + + + if ( table + length > valid->limit || length < 262 ) + FT_INVALID_TOO_SHORT; + + /* check glyph indices whenever necessary */ + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + FT_UInt n, idx; + + + p = table + 6; + for ( n = 0; n < 256; n++ ) + { + idx = *p++; + if ( idx >= TT_VALID_GLYPH_COUNT( valid ) ) + FT_INVALID_GLYPH_ID; + } + } + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap0_char_index( TT_CMap cmap, + FT_UInt32 char_code ) + { + FT_Byte* table = cmap->data; + + + return char_code < 256 ? table[6 + char_code] : 0; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap0_char_next( TT_CMap cmap, + FT_UInt32 *pchar_code ) + { + FT_Byte* table = cmap->data; + FT_UInt32 charcode = *pchar_code; + FT_UInt32 result = 0; + FT_UInt gindex = 0; + + + table += 6; /* go to glyph ids */ + while ( ++charcode < 256 ) + { + gindex = table[charcode]; + if ( gindex != 0 ) + { + result = charcode; + break; + } + } + + *pchar_code = result; + return gindex; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap0_get_info( TT_CMap cmap, + TT_CMapInfo *cmap_info ) + { + FT_Byte* p = cmap->data + 4; + + + cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_TABLE_DEF + const TT_CMap_ClassRec tt_cmap0_class_rec = + { + { + sizeof ( TT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap0_char_index, + (FT_CMap_CharNextFunc) tt_cmap0_char_next + }, + 0, + (TT_CMap_ValidateFunc) tt_cmap0_validate, + (TT_CMap_Info_GetFunc) tt_cmap0_get_info + }; + +#endif /* TT_CONFIG_CMAP_FORMAT_0 */ + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FORMAT 2 *****/ + /***** *****/ + /***** This is used for certain CJK encodings that encode text in a *****/ + /***** mixed 8/16 bits encoding along the following lines: *****/ + /***** *****/ + /***** * Certain byte values correspond to an 8-bit character code *****/ + /***** (typically in the range 0..127 for ASCII compatibility). *****/ + /***** *****/ + /***** * Certain byte values signal the first byte of a 2-byte *****/ + /***** character code (but these values are also valid as the *****/ + /***** second byte of a 2-byte character). *****/ + /***** *****/ + /***** The following charmap lookup and iteration functions all *****/ + /***** assume that the value "charcode" correspond to following: *****/ + /***** *****/ + /***** - For one byte characters, "charcode" is simply the *****/ + /***** character code. *****/ + /***** *****/ + /***** - For two byte characters, "charcode" is the 2-byte *****/ + /***** character code in big endian format. More exactly: *****/ + /***** *****/ + /***** (charcode >> 8) is the first byte value *****/ + /***** (charcode & 0xFF) is the second byte value *****/ + /***** *****/ + /***** Note that not all values of "charcode" are valid according *****/ + /***** to these rules, and the function moderately check the *****/ + /***** arguments. *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* TABLE OVERVIEW */ + /* -------------- */ + /* */ + /* NAME OFFSET TYPE DESCRIPTION */ + /* */ + /* format 0 USHORT must be 2 */ + /* length 2 USHORT table length in bytes */ + /* language 4 USHORT Mac language code */ + /* keys 6 USHORT[256] sub-header keys */ + /* subs 518 SUBHEAD[NSUBS] sub-headers array */ + /* glyph_ids 518+NSUB*8 USHORT[] glyph id array */ + /* */ + /* The `keys' table is used to map charcode high-bytes to sub-headers. */ + /* The value of `NSUBS' is the number of sub-headers defined in the */ + /* table and is computed by finding the maximum of the `keys' table. */ + /* */ + /* Note that for any n, `keys[n]' is a byte offset within the `subs' */ + /* table, i.e., it is the corresponding sub-header index multiplied */ + /* by 8. */ + /* */ + /* Each sub-header has the following format: */ + /* */ + /* NAME OFFSET TYPE DESCRIPTION */ + /* */ + /* first 0 USHORT first valid low-byte */ + /* count 2 USHORT number of valid low-bytes */ + /* delta 4 SHORT see below */ + /* offset 6 USHORT see below */ + /* */ + /* A sub-header defines, for each high-byte, the range of valid */ + /* low-bytes within the charmap. Note that the range defined by `first' */ + /* and `count' must be completely included in the interval [0..255] */ + /* according to the specification. */ + /* */ + /* If a character code is contained within a given sub-header, then */ + /* mapping it to a glyph index is done as follows: */ + /* */ + /* * The value of `offset' is read. This is a _byte_ distance from the */ + /* location of the `offset' field itself into a slice of the */ + /* `glyph_ids' table. Let's call it `slice' (it's a USHORT[] too). */ + /* */ + /* * The value `slice[char.lo - first]' is read. If it is 0, there is */ + /* no glyph for the charcode. Otherwise, the value of `delta' is */ + /* added to it (modulo 65536) to form a new glyph index. */ + /* */ + /* It is up to the validation routine to check that all offsets fall */ + /* within the glyph ids table (and not within the `subs' table itself or */ + /* outside of the CMap). */ + /* */ + +#ifdef TT_CONFIG_CMAP_FORMAT_2 + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap2_validate( FT_Byte* table, + FT_Validator valid ) + { + FT_Byte* p = table + 2; /* skip format */ + FT_UInt length = TT_PEEK_USHORT( p ); + FT_UInt n, max_subs; + FT_Byte* keys; /* keys table */ + FT_Byte* subs; /* sub-headers */ + FT_Byte* glyph_ids; /* glyph id array */ + + + if ( table + length > valid->limit || length < 6 + 512 ) + FT_INVALID_TOO_SHORT; + + keys = table + 6; + + /* parse keys to compute sub-headers count */ + p = keys; + max_subs = 0; + for ( n = 0; n < 256; n++ ) + { + FT_UInt idx = TT_NEXT_USHORT( p ); + + + /* value must be multiple of 8 */ + if ( valid->level >= FT_VALIDATE_PARANOID && ( idx & 7 ) != 0 ) + FT_INVALID_DATA; + + idx >>= 3; + + if ( idx > max_subs ) + max_subs = idx; + } + + FT_ASSERT( p == table + 518 ); + + subs = p; + glyph_ids = subs + (max_subs + 1) * 8; + if ( glyph_ids > valid->limit ) + FT_INVALID_TOO_SHORT; + + /* parse sub-headers */ + for ( n = 0; n <= max_subs; n++ ) + { + FT_UInt first_code, code_count, offset; + FT_Int delta; + FT_Byte* ids; + + + first_code = TT_NEXT_USHORT( p ); + code_count = TT_NEXT_USHORT( p ); + delta = TT_NEXT_SHORT( p ); + offset = TT_NEXT_USHORT( p ); + + /* check range within 0..255 */ + if ( valid->level >= FT_VALIDATE_PARANOID ) + { + if ( first_code >= 256 || first_code + code_count > 256 ) + FT_INVALID_DATA; + } + + /* check offset */ + if ( offset != 0 ) + { + ids = p - 2 + offset; + if ( ids < glyph_ids || ids + code_count*2 > table + length ) + FT_INVALID_OFFSET; + + /* check glyph ids */ + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + FT_Byte* limit = p + code_count * 2; + FT_UInt idx; + + + for ( ; p < limit; ) + { + idx = TT_NEXT_USHORT( p ); + if ( idx != 0 ) + { + idx = ( idx + delta ) & 0xFFFFU; + if ( idx >= TT_VALID_GLYPH_COUNT( valid ) ) + FT_INVALID_GLYPH_ID; + } + } + } + } + } + + return SFNT_Err_Ok; + } + + + /* return sub header corresponding to a given character code */ + /* NULL on invalid charcode */ + static FT_Byte* + tt_cmap2_get_subheader( FT_Byte* table, + FT_UInt32 char_code ) + { + FT_Byte* result = NULL; + + + if ( char_code < 0x10000UL ) + { + FT_UInt char_lo = (FT_UInt)( char_code & 0xFF ); + FT_UInt char_hi = (FT_UInt)( char_code >> 8 ); + FT_Byte* p = table + 6; /* keys table */ + FT_Byte* subs = table + 518; /* subheaders table */ + FT_Byte* sub; + + + if ( char_hi == 0 ) + { + /* an 8-bit character code -- we use subHeader 0 in this case */ + /* to test whether the character code is in the charmap */ + /* */ + sub = subs; /* jump to first sub-header */ + + /* check that the sub-header for this byte is 0, which */ + /* indicates that it's really a valid one-byte value */ + /* Otherwise, return 0 */ + /* */ + p += char_lo * 2; + if ( TT_PEEK_USHORT( p ) != 0 ) + goto Exit; + } + else + { + /* a 16-bit character code */ + + /* jump to key entry */ + p += char_hi * 2; + /* jump to sub-header */ + sub = subs + ( FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 8 ) ); + + /* check that the high byte isn't a valid one-byte value */ + if ( sub == subs ) + goto Exit; + } + result = sub; + } + Exit: + return result; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap2_char_index( TT_CMap cmap, + FT_UInt32 char_code ) + { + FT_Byte* table = cmap->data; + FT_UInt result = 0; + FT_Byte* subheader; + + + subheader = tt_cmap2_get_subheader( table, char_code ); + if ( subheader ) + { + FT_Byte* p = subheader; + FT_UInt idx = (FT_UInt)(char_code & 0xFF); + FT_UInt start, count; + FT_Int delta; + FT_UInt offset; + + + start = TT_NEXT_USHORT( p ); + count = TT_NEXT_USHORT( p ); + delta = TT_NEXT_SHORT ( p ); + offset = TT_PEEK_USHORT( p ); + + idx -= start; + if ( idx < count && offset != 0 ) + { + p += offset + 2 * idx; + idx = TT_PEEK_USHORT( p ); + + if ( idx != 0 ) + result = (FT_UInt)( idx + delta ) & 0xFFFFU; + } + } + return result; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap2_char_next( TT_CMap cmap, + FT_UInt32 *pcharcode ) + { + FT_Byte* table = cmap->data; + FT_UInt gindex = 0; + FT_UInt32 result = 0; + FT_UInt32 charcode = *pcharcode + 1; + FT_Byte* subheader; + + + while ( charcode < 0x10000UL ) + { + subheader = tt_cmap2_get_subheader( table, charcode ); + if ( subheader ) + { + FT_Byte* p = subheader; + FT_UInt start = TT_NEXT_USHORT( p ); + FT_UInt count = TT_NEXT_USHORT( p ); + FT_Int delta = TT_NEXT_SHORT ( p ); + FT_UInt offset = TT_PEEK_USHORT( p ); + FT_UInt char_lo = (FT_UInt)( charcode & 0xFF ); + FT_UInt pos, idx; + + + if ( offset == 0 ) + goto Next_SubHeader; + + if ( char_lo < start ) + { + char_lo = start; + pos = 0; + } + else + pos = (FT_UInt)( char_lo - start ); + + p += offset + pos * 2; + charcode = FT_PAD_FLOOR( charcode, 256 ) + char_lo; + + for ( ; pos < count; pos++, charcode++ ) + { + idx = TT_NEXT_USHORT( p ); + + if ( idx != 0 ) + { + gindex = ( idx + delta ) & 0xFFFFU; + if ( gindex != 0 ) + { + result = charcode; + goto Exit; + } + } + } + } + + /* jump to next sub-header, i.e. higher byte value */ + Next_SubHeader: + charcode = FT_PAD_FLOOR( charcode, 256 ) + 256; + } + + Exit: + *pcharcode = result; + + return gindex; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap2_get_info( TT_CMap cmap, + TT_CMapInfo *cmap_info ) + { + FT_Byte* p = cmap->data + 4; + + + cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_TABLE_DEF + const TT_CMap_ClassRec tt_cmap2_class_rec = + { + { + sizeof ( TT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap2_char_index, + (FT_CMap_CharNextFunc) tt_cmap2_char_next + }, + 2, + (TT_CMap_ValidateFunc) tt_cmap2_validate, + (TT_CMap_Info_GetFunc) tt_cmap2_get_info + }; + +#endif /* TT_CONFIG_CMAP_FORMAT_2 */ + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FORMAT 4 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* TABLE OVERVIEW */ + /* -------------- */ + /* */ + /* NAME OFFSET TYPE DESCRIPTION */ + /* */ + /* format 0 USHORT must be 4 */ + /* length 2 USHORT table length */ + /* in bytes */ + /* language 4 USHORT Mac language code */ + /* */ + /* segCountX2 6 USHORT 2*NUM_SEGS */ + /* searchRange 8 USHORT 2*(1 << LOG_SEGS) */ + /* entrySelector 10 USHORT LOG_SEGS */ + /* rangeShift 12 USHORT segCountX2 - */ + /* searchRange */ + /* */ + /* endCount 14 USHORT[NUM_SEGS] end charcode for */ + /* each segment; last */ + /* is 0xFFFF */ + /* */ + /* pad 14+NUM_SEGS*2 USHORT padding */ + /* */ + /* startCount 16+NUM_SEGS*2 USHORT[NUM_SEGS] first charcode for */ + /* each segment */ + /* */ + /* idDelta 16+NUM_SEGS*4 SHORT[NUM_SEGS] delta for each */ + /* segment */ + /* idOffset 16+NUM_SEGS*6 SHORT[NUM_SEGS] range offset for */ + /* each segment; can be */ + /* zero */ + /* */ + /* glyphIds 16+NUM_SEGS*8 USHORT[] array of glyph id */ + /* ranges */ + /* */ + /* Character codes are modelled by a series of ordered (increasing) */ + /* intervals called segments. Each segment has start and end codes, */ + /* provided by the `startCount' and `endCount' arrays. Segments must */ + /* not be overlapping and the last segment should always contain the */ + /* `0xFFFF' endCount. */ + /* */ + /* The fields `searchRange', `entrySelector' and `rangeShift' are better */ + /* ignored (they are traces of over-engineering in the TrueType */ + /* specification). */ + /* */ + /* Each segment also has a signed `delta', as well as an optional offset */ + /* within the `glyphIds' table. */ + /* */ + /* If a segment's idOffset is 0, the glyph index corresponding to any */ + /* charcode within the segment is obtained by adding the value of */ + /* `idDelta' directly to the charcode, modulo 65536. */ + /* */ + /* Otherwise, a glyph index is taken from the glyph ids sub-array for */ + /* the segment, and the value of `idDelta' is added to it. */ + /* */ + /* */ + /* Finally, note that certain fonts contain invalid charmaps that */ + /* contain end=0xFFFF, start=0xFFFF, delta=0x0001, offset=0xFFFF at the */ + /* of their charmaps (e.g. opens___.ttf which comes with OpenOffice.org) */ + /* we need special code to deal with them correctly... */ + /* */ + +#ifdef TT_CONFIG_CMAP_FORMAT_4 + +#define OPT_CMAP4 + +#ifdef OPT_CMAP4 + + typedef struct TT_CMap4Rec_ + { + TT_CMapRec cmap; + FT_UInt32 old_charcode; /* old charcode */ + FT_UInt32 cur_charcode; /* current charcode */ + FT_UInt cur_gindex; /* current glyph index */ + + FT_UInt table_length; + FT_UInt num_ranges; + FT_UInt cur_range; + FT_UInt cur_start; + FT_UInt cur_end; + FT_Int cur_delta; + FT_Byte* cur_values; + + } TT_CMap4Rec, *TT_CMap4; + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap4_init( TT_CMap4 cmap, + FT_Byte* table ) + { + FT_Byte* p; + + + cmap->cmap.data = table; + + p = table + 2; + cmap->table_length = FT_PEEK_USHORT( p ); + + p = table + 6; + cmap->num_ranges = FT_PEEK_USHORT( p ) >> 1; + cmap->cur_range = cmap->num_ranges; + cmap->old_charcode = 0xFFFFFFFFUL; + cmap->cur_charcode = 0; + cmap->cur_gindex = 0; + + return SFNT_Err_Ok; + } + + + static FT_Int + tt_cmap4_set_range( TT_CMap4 cmap, + FT_UInt range_index ) + { + FT_Byte* table = cmap->cmap.data; + FT_Byte* p; + FT_UInt num_ranges = cmap->num_ranges; + + + while ( range_index < num_ranges ) + { + FT_UInt offset; + + + p = table + 14 + range_index * 2; + cmap->cur_end = FT_PEEK_USHORT( p ); + + p += 2 + num_ranges * 2; + cmap->cur_start = FT_PEEK_USHORT( p ); + + p += num_ranges * 2; + cmap->cur_delta = FT_PEEK_SHORT( p ); + + p += num_ranges * 2; + offset = FT_PEEK_USHORT( p ); + + if ( offset != 0xFFFFU ) + { + cmap->cur_values = offset ? p + offset : NULL; + cmap->cur_range = range_index; + return 0; + } + + /* we skip empty segments */ + range_index++; + } + + cmap->old_charcode = 0xFFFFFFFFUL; + cmap->cur_charcode = 0; + cmap->cur_gindex = 0; + cmap->cur_range = num_ranges; + return -1; + } + + + static void + tt_cmap4_next( TT_CMap4 cmap ) + { + FT_UInt charcode = cmap->cur_charcode + 1; + + + cmap->old_charcode = cmap->cur_charcode; + + for ( ;; ) + { + FT_Byte* values = cmap->cur_values; + FT_UInt end = cmap->cur_end; + FT_Int delta = cmap->cur_delta; + + + if ( charcode <= end ) + { + if ( values ) + { + FT_Byte* p = values + 2 * ( charcode - cmap->cur_start ); + + + do + { + FT_UInt gindex = FT_NEXT_USHORT( p ); + + + if ( gindex != 0 ) + { + gindex = (FT_UInt)( ( gindex + delta ) & 0xFFFFU ); + if ( gindex != 0 ) + { + cmap->cur_charcode = charcode; + cmap->cur_gindex = gindex; + return; + } + } + } while ( ++charcode <= end ); + } + else + { + do + { + FT_UInt gindex = (FT_UInt)( ( charcode + delta ) & 0xFFFFU ); + + + if ( gindex != 0 ) + { + cmap->cur_charcode = charcode; + cmap->cur_gindex = gindex; + return; + } + } while ( ++charcode <= end ); + } + } + + /* we need to find another range */ + if ( tt_cmap4_set_range( cmap, cmap->cur_range + 1 ) < 0 ) + break; + + charcode = cmap->cur_start; + } + } + + + static void + tt_cmap4_reset( TT_CMap4 cmap, + FT_UInt code, + FT_UInt range_index ) + { + if ( tt_cmap4_set_range( cmap, range_index ) >= 0 ) + { + cmap->cur_charcode = code; + tt_cmap4_next( cmap ); + } + } + +#endif /* OPT_CMAP4 */ + + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap4_validate( FT_Byte* table, + FT_Validator valid ) + { + FT_Byte* p = table + 2; /* skip format */ + FT_UInt length = TT_NEXT_USHORT( p ); + FT_Byte *ends, *starts, *offsets, *deltas, *glyph_ids; + FT_UInt num_segs; + FT_Error error = SFNT_Err_Ok; + + + /* in certain fonts, the `length' field is invalid and goes */ + /* out of bound. We try to correct this here... */ + if ( length < 16 ) + FT_INVALID_TOO_SHORT; + + if ( table + length > valid->limit ) + { + if ( valid->level >= FT_VALIDATE_TIGHT ) + FT_INVALID_TOO_SHORT; + + length = (FT_UInt)( valid->limit - table ); + } + + p = table + 6; + num_segs = TT_NEXT_USHORT( p ); /* read segCountX2 */ + + if ( valid->level >= FT_VALIDATE_PARANOID ) + { + /* check that we have an even value here */ + if ( num_segs & 1 ) + FT_INVALID_DATA; + } + + num_segs /= 2; + + /* check the search parameters - even though we never use them */ + /* */ + if ( valid->level >= FT_VALIDATE_PARANOID ) + { + /* check the values of 'searchRange', 'entrySelector', 'rangeShift' */ + FT_UInt search_range = TT_NEXT_USHORT( p ); + FT_UInt entry_selector = TT_NEXT_USHORT( p ); + FT_UInt range_shift = TT_NEXT_USHORT( p ); + + + if ( ( search_range | range_shift ) & 1 ) /* must be even values */ + FT_INVALID_DATA; + + search_range /= 2; + range_shift /= 2; + + /* `search range' is the greatest power of 2 that is <= num_segs */ + + if ( search_range > num_segs || + search_range * 2 < num_segs || + search_range + range_shift != num_segs || + search_range != ( 1U << entry_selector ) ) + FT_INVALID_DATA; + } + + ends = table + 14; + starts = table + 16 + num_segs * 2; + deltas = starts + num_segs * 2; + offsets = deltas + num_segs * 2; + glyph_ids = offsets + num_segs * 2; + + if ( glyph_ids > table + length ) + FT_INVALID_TOO_SHORT; + + /* check last segment, its end count must be FFFF */ + if ( valid->level >= FT_VALIDATE_PARANOID ) + { + p = ends + ( num_segs - 1 ) * 2; + if ( TT_PEEK_USHORT( p ) != 0xFFFFU ) + FT_INVALID_DATA; + } + + /* check that segments are sorted in increasing order and do not */ + /* overlap; check also the offsets */ + { + FT_UInt start, end, last = 0, offset, n; + FT_Int delta; + + + for ( n = 0; n < num_segs; n++ ) + { + p = starts + n * 2; + start = TT_PEEK_USHORT( p ); + p = ends + n * 2; + end = TT_PEEK_USHORT( p ); + p = deltas + n * 2; + delta = TT_PEEK_SHORT( p ); + p = offsets + n * 2; + offset = TT_PEEK_USHORT( p ); + + if ( start > end ) + FT_INVALID_DATA; + + /* this test should be performed at default validation level; */ + /* unfortunately, some popular Asian fonts present overlapping */ + /* ranges in their charmaps */ + /* */ + if ( n > 0 && start <= last ) + { + if ( valid->level >= FT_VALIDATE_TIGHT ) + FT_INVALID_DATA; + else + error = SFNT_Err_Invalid_CharMap_Format; + } + + if ( offset && offset != 0xFFFFU ) + { + p += offset; /* start of glyph id array */ + + /* check that we point within the glyph ids table only */ + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + if ( p < glyph_ids || + p + ( end - start + 1 ) * 2 > table + length ) + FT_INVALID_DATA; + } + else + { + if ( p < glyph_ids || + p + ( end - start + 1 ) * 2 > valid->limit ) + FT_INVALID_DATA; + } + + /* check glyph indices within the segment range */ + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + FT_UInt i, idx; + + + for ( i = start; i < end; i++ ) + { + idx = FT_NEXT_USHORT( p ); + if ( idx != 0 ) + { + idx = (FT_UInt)( idx + delta ) & 0xFFFFU; + + if ( idx >= TT_VALID_GLYPH_COUNT( valid ) ) + FT_INVALID_GLYPH_ID; + } + } + } + } + else if ( offset == 0xFFFFU ) + { + /* Some fonts (erroneously?) use a range offset of 0xFFFF */ + /* to mean missing glyph in cmap table */ + /* */ + if ( valid->level >= FT_VALIDATE_PARANOID || + n != num_segs - 1 || + !( start == 0xFFFFU && end == 0xFFFFU && delta == 0x1U ) ) + FT_INVALID_DATA; + } + + last = end; + } + } + + return error; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap4_char_index( TT_CMap cmap, + FT_UInt32 char_code ) + { + FT_Byte* table = cmap->data; + FT_UInt result = 0; + + + if ( char_code < 0x10000UL ) + { + FT_UInt idx, num_segs2; + FT_Int delta; + FT_UInt code = (FT_UInt)char_code; + FT_Byte* p; + + p = table + 6; + num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 ); /* be paranoid! */ + + if ( !cmap->unsorted ) + { + /* Some fonts have more than 170 segments in their charmaps! */ + /* We changed this function to use a more efficient binary */ + /* search for improving performance */ + FT_UInt min = 0; + FT_UInt max = num_segs2 >> 1; + FT_UInt mid, start, end, offset; + + + while ( min < max ) + { + mid = ( min + max ) >> 1; + p = table + 14 + mid * 2; + end = TT_NEXT_USHORT( p ); + p += num_segs2; + start = TT_PEEK_USHORT( p); + + if ( code < start ) + max = mid; + else if ( code > end ) + min = mid + 1; + else + { + /* we found the segment */ + idx = code; + + p += num_segs2; + delta = TT_PEEK_SHORT( p ); + + p += num_segs2; + offset = TT_PEEK_USHORT( p ); + + if ( offset == 0xFFFFU ) + goto Exit; + + if ( offset != 0 ) + { + p += offset + 2 * ( idx - start ); + idx = TT_PEEK_USHORT( p ); + } + + if ( idx != 0 ) + result = (FT_UInt)( idx + delta ) & 0xFFFFU; + + goto Exit; + } + } + } + else + { + FT_UInt n; + FT_Byte* q; + + + p = table + 14; /* ends table */ + q = table + 16 + num_segs2; /* starts table */ + + + for ( n = 0; n < num_segs2; n += 2 ) + { + FT_UInt end = TT_NEXT_USHORT( p ); + FT_UInt start = TT_NEXT_USHORT( q ); + FT_UInt offset; + + + if ( code < start ) + break; + + if ( code <= end ) + { + idx = code; + + p = q + num_segs2 - 2; + delta = TT_PEEK_SHORT( p ); + p += num_segs2; + offset = TT_PEEK_USHORT( p ); + + if ( offset == 0xFFFFU ) + goto Exit; + + if ( offset != 0 ) + { + p += offset + 2 * ( idx - start ); + idx = TT_PEEK_USHORT( p ); + } + + if ( idx != 0 ) + result = (FT_UInt)( idx + delta ) & 0xFFFFU; + } + } + } + } + + Exit: + return result; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap4_char_next( TT_CMap cmap, + FT_UInt32 *pchar_code ) + { + FT_Byte* table = cmap->data; + FT_UInt32 result = 0; + FT_UInt gindex = 0; + FT_UInt32 char_code = *pchar_code; + FT_Byte* p; + FT_UInt code, num_segs2; + + + if ( char_code >= 0xFFFFUL ) + goto Exit; + +#ifdef OPT_CMAP4 + { + TT_CMap4 cmap4 = (TT_CMap4)cmap; + + + if ( char_code == cmap4->old_charcode ) + { + result = cmap4->cur_charcode; + gindex = cmap4->cur_gindex; + if ( result != 0 ) + { + tt_cmap4_next( cmap4 ); + goto Exit; + } + } + } +#endif /* OPT_CMAP4 */ + + code = (FT_UInt)char_code + 1; + p = table + 6; + num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 ); /* ensure even-ness */ + + if ( !cmap->unsorted ) + { + for (;;) + { + /* Some fonts have more than 170 segments in their charmaps! */ + /* We changed this function to use a more efficient binary */ + /* search */ + FT_UInt offset; + FT_Int delta; + FT_UInt min = 0; + FT_UInt max = num_segs2 >> 1; + FT_UInt mid, start, end; + FT_UInt hi; + + + /* we begin by finding the segment which end is + closer to our code point */ + hi = max + 1; + while ( min < max ) + { + mid = ( min + max ) >> 1; + p = table + 14 + mid * 2; + end = TT_PEEK_USHORT( p ); + + if ( end < code ) + min = mid + 1; + else + { + hi = mid; + max = mid; + } + } + + if ( hi > max ) + { + /* the point is behind the last segment; + we will exit right now */ + goto Exit; + } + + p = table + 14 + hi * 2; + end = TT_PEEK_USHORT( p ); + + p += 2 + num_segs2; + start = TT_PEEK_USHORT( p ); + + if ( code < start ) + code = start; + + p += num_segs2; + delta = TT_PEEK_USHORT( p ); + + p += num_segs2; + offset = TT_PEEK_USHORT( p ); + + if ( offset != 0 && offset != 0xFFFFU ) + { + /* parse the glyph ids array for non-zero index */ + p += offset + ( code - start ) * 2; + while ( code <= end ) + { + gindex = TT_NEXT_USHORT( p ); + if ( gindex != 0 ) + { + gindex = (FT_UInt)( gindex + delta ) & 0xFFFFU; + if ( gindex != 0 ) + { + result = code; +#ifdef OPT_CMAP4 + tt_cmap4_reset( (TT_CMap4)cmap, code, hi ); +#endif + goto Exit; + } + } + code++; + } + } + else if ( offset == 0xFFFFU ) + { + /* an offset of 0xFFFF means an empty segment in certain fonts! */ + code = end + 1; + } + else /* offset == 0 */ + { + gindex = (FT_UInt)( code + delta ) & 0xFFFFU; + if ( gindex != 0 ) + { + result = code; +#ifdef OPT_CMAP4 + tt_cmap4_reset( (TT_CMap4)cmap, code, hi ); +#endif + goto Exit; + } + code++; + } + } + } + else + { + for ( ;; ) + { + FT_UInt offset, n; + FT_Int delta; + FT_Byte* q; + + + p = table + 14; /* ends table */ + q = table + 16 + num_segs2; /* starts table */ + + for ( n = 0; n < num_segs2; n += 2 ) + { + FT_UInt end = TT_NEXT_USHORT( p ); + FT_UInt start = TT_NEXT_USHORT( q ); + + + if ( code < start ) + code = start; + + if ( code <= end ) + { + p = q + num_segs2 - 2; + delta = TT_PEEK_SHORT( p ); + p += num_segs2; + offset = TT_PEEK_USHORT( p ); + + if ( offset != 0 && offset != 0xFFFFU ) + { + /* parse the glyph ids array for non-0 index */ + p += offset + ( code - start ) * 2; + while ( code <= end ) + { + gindex = TT_NEXT_USHORT( p ); + if ( gindex != 0 ) + { + gindex = (FT_UInt)( gindex + delta ) & 0xFFFFU; + if ( gindex != 0 ) + break; + } + code++; + } + } + else if ( offset == 0xFFFFU ) + { + /* an offset of 0xFFFF means an empty glyph in certain fonts! */ + code = end; + break; + } + else + gindex = (FT_UInt)( code + delta ) & 0xFFFFU; + + if ( gindex == 0 ) + break; + + result = code; + goto Exit; + } + } + /* loop to next trial charcode */ + if ( code >= 0xFFFFU ) + break; + + code++; + } + } + + Exit: + *pchar_code = result; + return gindex; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap4_get_info( TT_CMap cmap, + TT_CMapInfo *cmap_info ) + { + FT_Byte* p = cmap->data + 4; + + + cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_TABLE_DEF + const TT_CMap_ClassRec tt_cmap4_class_rec = + { + { +#ifdef OPT_CMAP4 + sizeof ( TT_CMap4Rec ), + (FT_CMap_InitFunc) tt_cmap4_init, +#else + sizeof ( TT_CMapRec ), + (FT_CMap_InitFunc) tt_cmap_init, +#endif + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap4_char_index, + (FT_CMap_CharNextFunc) tt_cmap4_char_next + }, + 4, + (TT_CMap_ValidateFunc) tt_cmap4_validate, + (TT_CMap_Info_GetFunc) tt_cmap4_get_info + }; + +#endif /* TT_CONFIG_CMAP_FORMAT_4 */ + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FORMAT 6 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* TABLE OVERVIEW */ + /* -------------- */ + /* */ + /* NAME OFFSET TYPE DESCRIPTION */ + /* */ + /* format 0 USHORT must be 4 */ + /* length 2 USHORT table length in bytes */ + /* language 4 USHORT Mac language code */ + /* */ + /* first 6 USHORT first segment code */ + /* count 8 USHORT segment size in chars */ + /* glyphIds 10 USHORT[count] glyph ids */ + /* */ + /* A very simplified segment mapping. */ + /* */ + +#ifdef TT_CONFIG_CMAP_FORMAT_6 + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap6_validate( FT_Byte* table, + FT_Validator valid ) + { + FT_Byte* p; + FT_UInt length, count; + + + if ( table + 10 > valid->limit ) + FT_INVALID_TOO_SHORT; + + p = table + 2; + length = TT_NEXT_USHORT( p ); + + p = table + 8; /* skip language and start index */ + count = TT_NEXT_USHORT( p ); + + if ( table + length > valid->limit || length < 10 + count * 2 ) + FT_INVALID_TOO_SHORT; + + /* check glyph indices */ + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + FT_UInt gindex; + + + for ( ; count > 0; count-- ) + { + gindex = TT_NEXT_USHORT( p ); + if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) ) + FT_INVALID_GLYPH_ID; + } + } + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap6_char_index( TT_CMap cmap, + FT_UInt32 char_code ) + { + FT_Byte* table = cmap->data; + FT_UInt result = 0; + FT_Byte* p = table + 6; + FT_UInt start = TT_NEXT_USHORT( p ); + FT_UInt count = TT_NEXT_USHORT( p ); + FT_UInt idx = (FT_UInt)( char_code - start ); + + + if ( idx < count ) + { + p += 2 * idx; + result = TT_PEEK_USHORT( p ); + } + return result; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap6_char_next( TT_CMap cmap, + FT_UInt32 *pchar_code ) + { + FT_Byte* table = cmap->data; + FT_UInt32 result = 0; + FT_UInt32 char_code = *pchar_code + 1; + FT_UInt gindex = 0; + + FT_Byte* p = table + 6; + FT_UInt start = TT_NEXT_USHORT( p ); + FT_UInt count = TT_NEXT_USHORT( p ); + FT_UInt idx; + + + if ( char_code >= 0x10000UL ) + goto Exit; + + if ( char_code < start ) + char_code = start; + + idx = (FT_UInt)( char_code - start ); + p += 2 * idx; + + for ( ; idx < count; idx++ ) + { + gindex = TT_NEXT_USHORT( p ); + if ( gindex != 0 ) + { + result = char_code; + break; + } + char_code++; + } + + Exit: + *pchar_code = result; + return gindex; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap6_get_info( TT_CMap cmap, + TT_CMapInfo *cmap_info ) + { + FT_Byte* p = cmap->data + 4; + + + cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_TABLE_DEF + const TT_CMap_ClassRec tt_cmap6_class_rec = + { + { + sizeof ( TT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap6_char_index, + (FT_CMap_CharNextFunc) tt_cmap6_char_next + }, + 6, + (TT_CMap_ValidateFunc) tt_cmap6_validate, + (TT_CMap_Info_GetFunc) tt_cmap6_get_info + }; + +#endif /* TT_CONFIG_CMAP_FORMAT_6 */ + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FORMAT 8 *****/ + /***** *****/ + /***** It's hard to completely understand what the OpenType spec *****/ + /***** says about this format, but here is my conclusion. *****/ + /***** *****/ + /***** The purpose of this format is to easily map UTF-16 text to *****/ + /***** glyph indices. Basically, the `char_code' must be in one of *****/ + /***** the following formats: *****/ + /***** *****/ + /***** - A 16-bit value that isn't part of the Unicode Surrogates *****/ + /***** Area (i.e. U+D800-U+DFFF). *****/ + /***** *****/ + /***** - A 32-bit value, made of two surrogate values, i.e.. if *****/ + /***** `char_code = (char_hi << 16) | char_lo', then both *****/ + /***** `char_hi' and `char_lo' must be in the Surrogates Area. *****/ + /***** Area. *****/ + /***** *****/ + /***** The 'is32' table embedded in the charmap indicates whether a *****/ + /***** given 16-bit value is in the surrogates area or not. *****/ + /***** *****/ + /***** So, for any given `char_code', we can assert the following: *****/ + /***** *****/ + /***** If `char_hi == 0' then we must have `is32[char_lo] == 0'. *****/ + /***** *****/ + /***** If `char_hi != 0' then we must have both *****/ + /***** `is32[char_hi] != 0' and `is32[char_lo] != 0'. *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* TABLE OVERVIEW */ + /* -------------- */ + /* */ + /* NAME OFFSET TYPE DESCRIPTION */ + /* */ + /* format 0 USHORT must be 8 */ + /* reseved 2 USHORT reserved */ + /* length 4 ULONG length in bytes */ + /* language 8 ULONG Mac language code */ + /* is32 12 BYTE[8192] 32-bitness bitmap */ + /* count 8204 ULONG number of groups */ + /* */ + /* This header is followed by 'count' groups of the following format: */ + /* */ + /* start 0 ULONG first charcode */ + /* end 4 ULONG last charcode */ + /* startId 8 ULONG start glyph id for the group */ + /* */ + +#ifdef TT_CONFIG_CMAP_FORMAT_8 + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap8_validate( FT_Byte* table, + FT_Validator valid ) + { + FT_Byte* p = table + 4; + FT_Byte* is32; + FT_UInt32 length; + FT_UInt32 num_groups; + + + if ( table + 16 + 8192 > valid->limit ) + FT_INVALID_TOO_SHORT; + + length = TT_NEXT_ULONG( p ); + if ( table + length > valid->limit || length < 8208 ) + FT_INVALID_TOO_SHORT; + + is32 = table + 12; + p = is32 + 8192; /* skip `is32' array */ + num_groups = TT_NEXT_ULONG( p ); + + if ( p + num_groups * 12 > valid->limit ) + FT_INVALID_TOO_SHORT; + + /* check groups, they must be in increasing order */ + { + FT_UInt32 n, start, end, start_id, count, last = 0; + + + for ( n = 0; n < num_groups; n++ ) + { + FT_UInt hi, lo; + + + start = TT_NEXT_ULONG( p ); + end = TT_NEXT_ULONG( p ); + start_id = TT_NEXT_ULONG( p ); + + if ( start > end ) + FT_INVALID_DATA; + + if ( n > 0 && start <= last ) + FT_INVALID_DATA; + + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ) + FT_INVALID_GLYPH_ID; + + count = (FT_UInt32)( end - start + 1 ); + + if ( start & ~0xFFFFU ) + { + /* start_hi != 0; check that is32[i] is 1 for each i in */ + /* the `hi' and `lo' of the range [start..end] */ + for ( ; count > 0; count--, start++ ) + { + hi = (FT_UInt)( start >> 16 ); + lo = (FT_UInt)( start & 0xFFFFU ); + + if ( (is32[hi >> 3] & ( 0x80 >> ( hi & 7 ) ) ) == 0 ) + FT_INVALID_DATA; + + if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) == 0 ) + FT_INVALID_DATA; + } + } + else + { + /* start_hi == 0; check that is32[i] is 0 for each i in */ + /* the range [start..end] */ + + /* end_hi cannot be != 0! */ + if ( end & ~0xFFFFU ) + FT_INVALID_DATA; + + for ( ; count > 0; count--, start++ ) + { + lo = (FT_UInt)( start & 0xFFFFU ); + + if ( (is32[lo >> 3] & ( 0x80 >> ( lo & 7 ) ) ) != 0 ) + FT_INVALID_DATA; + } + } + } + + last = end; + } + } + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap8_char_index( TT_CMap cmap, + FT_UInt32 char_code ) + { + FT_Byte* table = cmap->data; + FT_UInt result = 0; + FT_Byte* p = table + 8204; + FT_UInt32 num_groups = TT_NEXT_ULONG( p ); + FT_UInt32 start, end, start_id; + + + for ( ; num_groups > 0; num_groups-- ) + { + start = TT_NEXT_ULONG( p ); + end = TT_NEXT_ULONG( p ); + start_id = TT_NEXT_ULONG( p ); + + if ( char_code < start ) + break; + + if ( char_code <= end ) + { + result = (FT_UInt)( start_id + char_code - start ); + break; + } + } + return result; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap8_char_next( TT_CMap cmap, + FT_UInt32 *pchar_code ) + { + FT_UInt32 result = 0; + FT_UInt32 char_code = *pchar_code + 1; + FT_UInt gindex = 0; + FT_Byte* table = cmap->data; + FT_Byte* p = table + 8204; + FT_UInt32 num_groups = TT_NEXT_ULONG( p ); + FT_UInt32 start, end, start_id; + + + p = table + 8208; + + for ( ; num_groups > 0; num_groups-- ) + { + start = TT_NEXT_ULONG( p ); + end = TT_NEXT_ULONG( p ); + start_id = TT_NEXT_ULONG( p ); + + if ( char_code < start ) + char_code = start; + + if ( char_code <= end ) + { + gindex = (FT_UInt)( char_code - start + start_id ); + if ( gindex != 0 ) + { + result = char_code; + goto Exit; + } + } + } + + Exit: + *pchar_code = result; + return gindex; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap8_get_info( TT_CMap cmap, + TT_CMapInfo *cmap_info ) + { + FT_Byte* p = cmap->data + 8; + + + cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_TABLE_DEF + const TT_CMap_ClassRec tt_cmap8_class_rec = + { + { + sizeof ( TT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap8_char_index, + (FT_CMap_CharNextFunc) tt_cmap8_char_next + }, + 8, + (TT_CMap_ValidateFunc) tt_cmap8_validate, + (TT_CMap_Info_GetFunc) tt_cmap8_get_info + }; + +#endif /* TT_CONFIG_CMAP_FORMAT_8 */ + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FORMAT 10 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* TABLE OVERVIEW */ + /* -------------- */ + /* */ + /* NAME OFFSET TYPE DESCRIPTION */ + /* */ + /* format 0 USHORT must be 10 */ + /* reserved 2 USHORT reserved */ + /* length 4 ULONG length in bytes */ + /* language 8 ULONG Mac language code */ + /* */ + /* start 12 ULONG first char in range */ + /* count 16 ULONG number of chars in range */ + /* glyphIds 20 USHORT[count] glyph indices covered */ + /* */ + +#ifdef TT_CONFIG_CMAP_FORMAT_10 + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap10_validate( FT_Byte* table, + FT_Validator valid ) + { + FT_Byte* p = table + 4; + FT_ULong length, count; + + + if ( table + 20 > valid->limit ) + FT_INVALID_TOO_SHORT; + + length = TT_NEXT_ULONG( p ); + p = table + 16; + count = TT_NEXT_ULONG( p ); + + if ( table + length > valid->limit || length < 20 + count * 2 ) + FT_INVALID_TOO_SHORT; + + /* check glyph indices */ + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + FT_UInt gindex; + + + for ( ; count > 0; count-- ) + { + gindex = TT_NEXT_USHORT( p ); + if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) ) + FT_INVALID_GLYPH_ID; + } + } + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap10_char_index( TT_CMap cmap, + FT_UInt32 char_code ) + { + FT_Byte* table = cmap->data; + FT_UInt result = 0; + FT_Byte* p = table + 12; + FT_UInt32 start = TT_NEXT_ULONG( p ); + FT_UInt32 count = TT_NEXT_ULONG( p ); + FT_UInt32 idx = (FT_ULong)( char_code - start ); + + + if ( idx < count ) + { + p += 2 * idx; + result = TT_PEEK_USHORT( p ); + } + return result; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap10_char_next( TT_CMap cmap, + FT_UInt32 *pchar_code ) + { + FT_Byte* table = cmap->data; + FT_UInt32 char_code = *pchar_code + 1; + FT_UInt gindex = 0; + FT_Byte* p = table + 12; + FT_UInt32 start = TT_NEXT_ULONG( p ); + FT_UInt32 count = TT_NEXT_ULONG( p ); + FT_UInt32 idx; + + + if ( char_code < start ) + char_code = start; + + idx = (FT_UInt32)( char_code - start ); + p += 2 * idx; + + for ( ; idx < count; idx++ ) + { + gindex = TT_NEXT_USHORT( p ); + if ( gindex != 0 ) + break; + char_code++; + } + + *pchar_code = char_code; + return gindex; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap10_get_info( TT_CMap cmap, + TT_CMapInfo *cmap_info ) + { + FT_Byte* p = cmap->data + 8; + + + cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_TABLE_DEF + const TT_CMap_ClassRec tt_cmap10_class_rec = + { + { + sizeof ( TT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap10_char_index, + (FT_CMap_CharNextFunc) tt_cmap10_char_next + }, + 10, + (TT_CMap_ValidateFunc) tt_cmap10_validate, + (TT_CMap_Info_GetFunc) tt_cmap10_get_info + }; + +#endif /* TT_CONFIG_CMAP_FORMAT_10 */ + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** FORMAT 12 *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /*************************************************************************/ + /* */ + /* TABLE OVERVIEW */ + /* -------------- */ + /* */ + /* NAME OFFSET TYPE DESCRIPTION */ + /* */ + /* format 0 USHORT must be 12 */ + /* reserved 2 USHORT reserved */ + /* length 4 ULONG length in bytes */ + /* language 8 ULONG Mac language code */ + /* count 12 ULONG number of groups */ + /* 16 */ + /* */ + /* This header is followed by `count' groups of the following format: */ + /* */ + /* start 0 ULONG first charcode */ + /* end 4 ULONG last charcode */ + /* startId 8 ULONG start glyph id for the group */ + /* */ + +#ifdef TT_CONFIG_CMAP_FORMAT_12 + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap12_validate( FT_Byte* table, + FT_Validator valid ) + { + FT_Byte* p; + FT_ULong length; + FT_ULong num_groups; + + + if ( table + 16 > valid->limit ) + FT_INVALID_TOO_SHORT; + + p = table + 4; + length = TT_NEXT_ULONG( p ); + + p = table + 12; + num_groups = TT_NEXT_ULONG( p ); + + if ( table + length > valid->limit || length < 16 + 12 * num_groups ) + FT_INVALID_TOO_SHORT; + + /* check groups, they must be in increasing order */ + { + FT_ULong n, start, end, start_id, last = 0; + + + for ( n = 0; n < num_groups; n++ ) + { + start = TT_NEXT_ULONG( p ); + end = TT_NEXT_ULONG( p ); + start_id = TT_NEXT_ULONG( p ); + + if ( start > end ) + FT_INVALID_DATA; + + if ( n > 0 && start <= last ) + FT_INVALID_DATA; + + if ( valid->level >= FT_VALIDATE_TIGHT ) + { + if ( start_id + end - start >= TT_VALID_GLYPH_COUNT( valid ) ) + FT_INVALID_GLYPH_ID; + } + + last = end; + } + } + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap12_char_index( TT_CMap cmap, + FT_UInt32 char_code ) + { + FT_UInt result = 0; + FT_Byte* table = cmap->data; + FT_Byte* p = table + 12; + FT_UInt32 num_groups = TT_NEXT_ULONG( p ); + FT_UInt32 start, end, start_id; + + + for ( ; num_groups > 0; num_groups-- ) + { + start = TT_NEXT_ULONG( p ); + end = TT_NEXT_ULONG( p ); + start_id = TT_NEXT_ULONG( p ); + + if ( char_code < start ) + break; + + if ( char_code <= end ) + { + result = (FT_UInt)( start_id + char_code - start ); + break; + } + } + return result; + } + + + FT_CALLBACK_DEF( FT_UInt ) + tt_cmap12_char_next( TT_CMap cmap, + FT_UInt32 *pchar_code ) + { + FT_Byte* table = cmap->data; + FT_UInt32 result = 0; + FT_UInt32 char_code = *pchar_code + 1; + FT_UInt gindex = 0; + FT_Byte* p = table + 12; + FT_UInt32 num_groups = TT_NEXT_ULONG( p ); + FT_UInt32 start, end, start_id; + + + p = table + 16; + + for ( ; num_groups > 0; num_groups-- ) + { + start = TT_NEXT_ULONG( p ); + end = TT_NEXT_ULONG( p ); + start_id = TT_NEXT_ULONG( p ); + + if ( char_code < start ) + char_code = start; + + if ( char_code <= end ) + { + gindex = (FT_UInt)(char_code - start + start_id); + if ( gindex != 0 ) + { + result = char_code; + goto Exit; + } + } + } + + Exit: + *pchar_code = result; + return gindex; + } + + + FT_CALLBACK_DEF( FT_Error ) + tt_cmap12_get_info( TT_CMap cmap, + TT_CMapInfo *cmap_info ) + { + FT_Byte* p = cmap->data + 8; + + + cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); + + return SFNT_Err_Ok; + } + + + FT_CALLBACK_TABLE_DEF + const TT_CMap_ClassRec tt_cmap12_class_rec = + { + { + sizeof ( TT_CMapRec ), + + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap12_char_index, + (FT_CMap_CharNextFunc) tt_cmap12_char_next + }, + 12, + (TT_CMap_ValidateFunc) tt_cmap12_validate, + (TT_CMap_Info_GetFunc) tt_cmap12_get_info + }; + + +#endif /* TT_CONFIG_CMAP_FORMAT_12 */ + + + static const TT_CMap_Class tt_cmap_classes[] = + { +#ifdef TT_CONFIG_CMAP_FORMAT_0 + &tt_cmap0_class_rec, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_2 + &tt_cmap2_class_rec, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_4 + &tt_cmap4_class_rec, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_6 + &tt_cmap6_class_rec, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_8 + &tt_cmap8_class_rec, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_10 + &tt_cmap10_class_rec, +#endif + +#ifdef TT_CONFIG_CMAP_FORMAT_12 + &tt_cmap12_class_rec, +#endif + + NULL, + }; + + + /* parse the `cmap' table and build the corresponding TT_CMap objects */ + /* in the current face */ + /* */ + FT_LOCAL_DEF( FT_Error ) + tt_face_build_cmaps( TT_Face face ) + { + FT_Byte* table = face->cmap_table; + FT_Byte* limit = table + face->cmap_size; + FT_UInt volatile num_cmaps; + FT_Byte* volatile p = table; + + + if ( p + 4 > limit ) + return SFNT_Err_Invalid_Table; + + /* only recognize format 0 */ + if ( TT_NEXT_USHORT( p ) != 0 ) + { + p -= 2; + FT_ERROR(( "tt_face_build_cmaps: unsupported `cmap' table format = %d\n", + TT_PEEK_USHORT( p ) )); + return SFNT_Err_Invalid_Table; + } + + num_cmaps = TT_NEXT_USHORT( p ); + + for ( ; num_cmaps > 0 && p + 8 <= limit; num_cmaps-- ) + { + FT_CharMapRec charmap; + FT_UInt32 offset; + + + charmap.platform_id = TT_NEXT_USHORT( p ); + charmap.encoding_id = TT_NEXT_USHORT( p ); + charmap.face = FT_FACE( face ); + charmap.encoding = FT_ENCODING_NONE; /* will be filled later */ + offset = TT_NEXT_ULONG( p ); + + if ( offset && + table + offset + 2 < limit && + table + offset >= table ) + { + FT_Byte* cmap = table + offset; + volatile FT_UInt format = TT_PEEK_USHORT( cmap ); + const TT_CMap_Class* volatile pclazz = tt_cmap_classes; + TT_CMap_Class clazz; + + + for ( ; *pclazz; pclazz++ ) + { + clazz = *pclazz; + if ( clazz->format == format ) + { + volatile TT_ValidatorRec valid; + FT_Error error = SFNT_Err_Ok; + + + ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit, + FT_VALIDATE_DEFAULT ); + + valid.num_glyphs = (FT_UInt)face->root.num_glyphs; + + if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer ) == 0 ) + { + /* validate this cmap sub-table */ + error = clazz->validate( cmap, FT_VALIDATOR( &valid ) ); + } + + if ( valid.validator.error == 0 ) + { + (void)FT_CMap_New( (FT_CMap_Class)clazz, cmap, &charmap, NULL ); + + /* it is simpler to directly set the `unsorted' flag instead */ + /* of adding a parameter to FT_CMap_New */ + ((TT_CMap)(face->root.charmaps + [face->root.num_charmaps - 1]))->unsorted = + FT_BOOL( error ); + } + else + { + FT_ERROR(( "tt_face_build_cmaps:" )); + FT_ERROR(( " broken cmap sub-table ignored!\n" )); + } + break; + } + } + } + } + + return SFNT_Err_Ok; + } + + + FT_LOCAL( FT_Error ) + tt_get_cmap_info( FT_CharMap charmap, + TT_CMapInfo *cmap_info ) + { + FT_CMap cmap = (FT_CMap)charmap; + TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz; + + + return clazz->get_cmap_info( charmap, cmap_info ); + } + + +/* END */ diff --git a/src/libs/freetype2/sfnt/ttcmap.h b/src/libs/freetype2/sfnt/ttcmap.h new file mode 100644 index 0000000000..5f758a46d2 --- /dev/null +++ b/src/libs/freetype2/sfnt/ttcmap.h @@ -0,0 +1,81 @@ +/***************************************************************************/ +/* */ +/* ttcmap.h */ +/* */ +/* TrueType character mapping table (cmap) support (specification). */ +/* */ +/* Copyright 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTCMAP_H__ +#define __TTCMAP_H__ + + +#include <ft2build.h> +#include FT_INTERNAL_TRUETYPE_TYPES_H +#include FT_INTERNAL_VALIDATE_H +#include FT_SERVICE_TT_CMAP_H + +FT_BEGIN_HEADER + + typedef struct TT_CMapRec_ + { + FT_CMapRec cmap; + FT_Byte* data; /* pointer to in-memory cmap table */ + FT_Bool unsorted; /* for format 4 only */ + + } TT_CMapRec, *TT_CMap; + + typedef const struct TT_CMap_ClassRec_* TT_CMap_Class; + + + typedef FT_Error + (*TT_CMap_ValidateFunc)( FT_Byte* data, + FT_Validator valid ); + + typedef struct TT_CMap_ClassRec_ + { + FT_CMap_ClassRec clazz; + FT_UInt format; + TT_CMap_ValidateFunc validate; + TT_CMap_Info_GetFunc get_cmap_info; + + } TT_CMap_ClassRec; + + + typedef struct TT_ValidatorRec_ + { + FT_ValidatorRec validator; + FT_UInt num_glyphs; + + } TT_ValidatorRec, *TT_Validator; + + +#define TT_VALIDATOR( x ) ((TT_Validator)( x )) +#define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs + + + FT_LOCAL( FT_Error ) + tt_face_build_cmaps( TT_Face face ); + + /* used in tt-cmaps service */ + FT_LOCAL( FT_Error ) + tt_get_cmap_info( FT_CharMap charmap, + TT_CMapInfo *cmap_info ); + + +FT_END_HEADER + +#endif /* __TTCMAP_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/sfnt/ttkern.c b/src/libs/freetype2/sfnt/ttkern.c new file mode 100644 index 0000000000..805efa5c3b --- /dev/null +++ b/src/libs/freetype2/sfnt/ttkern.c @@ -0,0 +1,491 @@ +/***************************************************************************/ +/* */ +/* ttkern.c */ +/* */ +/* Load the basic TrueType kerning table. This doesn't handle */ +/* kerning data within the GPOS table at the moment. */ +/* */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_TRUETYPE_TAGS_H +#include "ttkern.h" +#include "ttload.h" + +#include "sferrors.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_ttkern + + +#undef TT_KERN_INDEX +#define TT_KERN_INDEX( g1, g2 ) ( ( (FT_ULong)(g1) << 16 ) | (g2) ) + + +#ifdef FT_OPTIMIZE_MEMORY + + FT_LOCAL_DEF( FT_Error ) + tt_face_load_kern( TT_Face face, + FT_Stream stream ) + { + FT_Error error; + FT_ULong table_size; + FT_Byte* p; + FT_Byte* p_limit; + FT_UInt nn, num_tables; + FT_UInt32 avail = 0, ordered = 0; + + + /* the kern table is optional; exit silently if it is missing */ + error = face->goto_table( face, TTAG_kern, stream, &table_size ); + if ( error ) + goto Exit; + + if ( table_size < 4 ) /* the case of a malformed table */ + { + FT_ERROR(( "kerning table is too small - ignored\n" )); + error = SFNT_Err_Table_Missing; + goto Exit; + } + + if ( FT_FRAME_EXTRACT( table_size, face->kern_table ) ) + { + FT_ERROR(( "could not extract kerning table\n" )); + goto Exit; + } + + face->kern_table_size = table_size; + + p = face->kern_table; + p_limit = p + table_size; + + p += 2; /* skip version */ + num_tables = FT_NEXT_USHORT( p ); + + if ( num_tables > 32 ) /* we only support up to 32 sub-tables */ + num_tables = 32; + + for ( nn = 0; nn < num_tables; nn++ ) + { + FT_UInt num_pairs, version, length, coverage; + FT_Byte* p_next; + FT_UInt32 mask = 1UL << nn; + + + if ( p + 6 > p_limit ) + break; + + p_next = p; + + version = FT_NEXT_USHORT( p ); + length = FT_NEXT_USHORT( p ); + coverage = FT_NEXT_USHORT( p ); + + if ( length <= 6 ) + break; + + p_next += length; + + /* only use horizontal kerning tables */ + if ( ( coverage & ~8 ) != 0x0001 || + p + 8 > p_limit ) + goto NextTable; + + num_pairs = FT_NEXT_USHORT( p ); + p += 6; + + if ( p + 6 * num_pairs > p_limit ) + goto NextTable; + + avail |= mask; + + /* + * Now check whether the pairs in this table are ordered. + * We then can use binary search. + */ + if ( num_pairs > 0 ) + { + FT_UInt count; + FT_UInt old_pair; + + + old_pair = FT_NEXT_ULONG( p ); + p += 2; + + for ( count = num_pairs - 1; count > 0; count-- ) + { + FT_UInt32 cur_pair; + + + cur_pair = FT_NEXT_ULONG( p ); + if ( cur_pair <= old_pair ) + break; + + p += 2; + old_pair = cur_pair; + } + + if ( count == 0 ) + ordered |= mask; + } + + NextTable: + p = p_next; + } + + face->num_kern_tables = nn; + face->kern_avail_bits = avail; + face->kern_order_bits = ordered; + + Exit: + return error; + } + + + FT_LOCAL_DEF( void ) + tt_face_done_kern( TT_Face face ) + { + FT_Stream stream = face->root.stream; + + + FT_FRAME_RELEASE( face->kern_table ); + face->kern_table_size = 0; + face->num_kern_tables = 0; + face->kern_avail_bits = 0; + face->kern_order_bits = 0; + } + + + FT_LOCAL_DEF( FT_Int ) + tt_face_get_kerning( TT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph ) + { + FT_Int result = 0; + FT_UInt count, mask = 1; + FT_Byte* p = face->kern_table; + + + p += 4; + mask = 0x0001; + + for ( count = face->num_kern_tables; count > 0; count--, mask <<= 1 ) + { + FT_Byte* base = p; + FT_Byte* next = base; + FT_UInt version = FT_NEXT_USHORT( p ); + FT_UInt length = FT_NEXT_USHORT( p ); + FT_UInt coverage = FT_NEXT_USHORT( p ); + FT_Int value = 0; + + FT_UNUSED( version ); + + + next = base + length; + + if ( ( face->kern_avail_bits & mask ) == 0 ) + goto NextTable; + + if ( p + 8 > next ) + goto NextTable; + + switch ( coverage >> 8 ) + { + case 0: + { + FT_UInt num_pairs = FT_NEXT_USHORT( p ); + FT_ULong key0 = TT_KERN_INDEX( left_glyph, right_glyph ); + + + p += 6; + + if ( face->kern_order_bits & mask ) /* binary search */ + { + FT_UInt min = 0; + FT_UInt max = num_pairs; + + + while ( min < max ) + { + FT_UInt mid = ( min + max ) >> 1; + FT_Byte* q = p + 6 * mid; + FT_ULong key; + + + key = FT_NEXT_ULONG( q ); + + if ( key == key0 ) + { + value = FT_PEEK_SHORT( q ); + goto Found; + } + if ( key < key0 ) + min = mid + 1; + else + max = mid; + } + } + else /* linear search */ + { + for ( count = num_pairs; count > 0; count-- ) + { + FT_ULong key = FT_NEXT_ULONG( p ); + + + if ( key == key0 ) + { + value = FT_PEEK_SHORT( p ); + goto Found; + } + p += 2; + } + } + } + break; + + /* + * We don't support format 2 because we've never seen a single font + * using it in real life... + */ + + default: + ; + } + + goto NextTable; + + Found: + if ( coverage & 8 ) /* overide or add */ + result = value; + else + result += value; + + NextTable: + p = next; + } + + return result; + } + +#else /* !OPTIMIZE_MEMORY */ + + FT_CALLBACK_DEF( int ) + tt_kern_pair_compare( const void* a, + const void* b ); + + + FT_LOCAL_DEF( FT_Error ) + tt_face_load_kern( TT_Face face, + FT_Stream stream ) + { + FT_Error error; + FT_Memory memory = stream->memory; + + FT_UInt n, num_tables; + + + /* the kern table is optional; exit silently if it is missing */ + error = face->goto_table( face, TTAG_kern, stream, 0 ); + if ( error ) + return SFNT_Err_Ok; + + if ( FT_FRAME_ENTER( 4L ) ) + goto Exit; + + (void)FT_GET_USHORT(); /* version */ + num_tables = FT_GET_USHORT(); + + FT_FRAME_EXIT(); + + for ( n = 0; n < num_tables; n++ ) + { + FT_UInt coverage; + FT_UInt length; + + + if ( FT_FRAME_ENTER( 6L ) ) + goto Exit; + + (void)FT_GET_USHORT(); /* version */ + length = FT_GET_USHORT() - 6; /* substract header length */ + coverage = FT_GET_USHORT(); + + FT_FRAME_EXIT(); + + if ( coverage == 0x0001 ) + { + FT_UInt num_pairs; + TT_Kern0_Pair pair; + TT_Kern0_Pair limit; + + + /* found a horizontal format 0 kerning table! */ + if ( FT_FRAME_ENTER( 8L ) ) + goto Exit; + + num_pairs = FT_GET_USHORT(); + + /* skip the rest */ + + FT_FRAME_EXIT(); + + /* allocate array of kerning pairs */ + if ( FT_QNEW_ARRAY( face->kern_pairs, num_pairs ) || + FT_FRAME_ENTER( 6L * num_pairs ) ) + goto Exit; + + pair = face->kern_pairs; + limit = pair + num_pairs; + for ( ; pair < limit; pair++ ) + { + pair->left = FT_GET_USHORT(); + pair->right = FT_GET_USHORT(); + pair->value = FT_GET_USHORT(); + } + + FT_FRAME_EXIT(); + + face->num_kern_pairs = num_pairs; + face->kern_table_index = n; + + /* ensure that the kerning pair table is sorted (yes, some */ + /* fonts have unsorted tables!) */ + + if ( num_pairs > 0 ) + { + TT_Kern0_Pair pair0 = face->kern_pairs; + FT_ULong prev = TT_KERN_INDEX( pair0->left, pair0->right ); + + + for ( pair0++; pair0 < limit; pair0++ ) + { + FT_ULong next = TT_KERN_INDEX( pair0->left, pair0->right ); + + + if ( next < prev ) + goto SortIt; + + prev = next; + } + goto Exit; + + SortIt: + ft_qsort( (void*)face->kern_pairs, (int)num_pairs, + sizeof ( TT_Kern0_PairRec ), tt_kern_pair_compare ); + } + + goto Exit; + } + + if ( FT_STREAM_SKIP( length ) ) + goto Exit; + } + + /* no kern table found -- doesn't matter */ + face->kern_table_index = -1; + face->num_kern_pairs = 0; + face->kern_pairs = NULL; + + Exit: + return error; + } + + + FT_CALLBACK_DEF( int ) + tt_kern_pair_compare( const void* a, + const void* b ) + { + TT_Kern0_Pair pair1 = (TT_Kern0_Pair)a; + TT_Kern0_Pair pair2 = (TT_Kern0_Pair)b; + + FT_ULong index1 = TT_KERN_INDEX( pair1->left, pair1->right ); + FT_ULong index2 = TT_KERN_INDEX( pair2->left, pair2->right ); + + return index1 < index2 ? -1 + : ( index1 > index2 ? 1 + : 0 ); + } + + + FT_LOCAL_DEF( void ) + tt_face_done_kern( TT_Face face ) + { + FT_Memory memory = face->root.stream->memory; + + + FT_FREE( face->kern_pairs ); + face->num_kern_pairs = 0; + } + + + FT_LOCAL_DEF( FT_Int ) + tt_face_get_kerning( TT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph ) + { + FT_Int result = 0; + TT_Kern0_Pair pair; + + + if ( face && face->kern_pairs ) + { + /* there are some kerning pairs in this font file! */ + FT_ULong search_tag = TT_KERN_INDEX( left_glyph, right_glyph ); + FT_Long left, right; + + + left = 0; + right = face->num_kern_pairs - 1; + + while ( left <= right ) + { + FT_Long middle = left + ( ( right - left ) >> 1 ); + FT_ULong cur_pair; + + + pair = face->kern_pairs + middle; + cur_pair = TT_KERN_INDEX( pair->left, pair->right ); + + if ( cur_pair == search_tag ) + goto Found; + + if ( cur_pair < search_tag ) + left = middle + 1; + else + right = middle - 1; + } + } + + Exit: + return result; + + Found: + result = pair->value; + goto Exit; + } + +#endif /* !OPTIMIZE_MEMORY */ + + +#undef TT_KERN_INDEX + +/* END */ diff --git a/src/libs/freetype2/sfnt/ttkern.h b/src/libs/freetype2/sfnt/ttkern.h new file mode 100644 index 0000000000..18b1381b4e --- /dev/null +++ b/src/libs/freetype2/sfnt/ttkern.h @@ -0,0 +1,56 @@ +/***************************************************************************/ +/* */ +/* ttkern.h */ +/* */ +/* Load the basic TrueType kerning table. This doesn't handle */ +/* kerning data within the GPOS table at the moment. */ +/* */ +/* Copyright 1996-2001, 2002, 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTKERN_H__ +#define __TTKERN_H__ + + +#include <ft2build.h> +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_TRUETYPE_TYPES_H + + +FT_BEGIN_HEADER + + + FT_LOCAL( FT_Error ) + tt_face_load_kern( TT_Face face, + FT_Stream stream ); + + FT_LOCAL( void ) + tt_face_done_kern( TT_Face face ); + + FT_LOCAL( FT_Int ) + tt_face_get_kerning( TT_Face face, + FT_UInt left_glyph, + FT_UInt right_glyph ); + +#ifdef FT_OPTIMIZE_MEMORY +# define TT_FACE_HAS_KERNING( face ) ( (face)->kern_avail_bits != 0 ) +#else +# define TT_FACE_HAS_KERNING( face ) ( (face)->kern_pairs != NULL ) +#endif + + +FT_END_HEADER + +#endif /* __TTKERN_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/sfnt/ttload.c b/src/libs/freetype2/sfnt/ttload.c index d1b0b208b1..0f91984020 100644 --- a/src/libs/freetype2/sfnt/ttload.c +++ b/src/libs/freetype2/sfnt/ttload.c @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -134,22 +134,22 @@ } - /* In theory, we should check the values of `search_range', */ - /* `entry_selector', and `range_shift' to detect non-SFNT based files */ - /* whose header might also start with 0x100000L (yes, these exist). */ - /* */ - /* Very unfortunately, many TrueType fonts don't have these fields */ - /* set correctly and we must ignore them to support them. An alternative */ - /* way to check the font file is thus to: */ - /* */ - /* - check that `num_tables' is valid */ - /* - look for a "head" table, check its size, and parse it to */ - /* see if its "magic" field is correctly set */ - /* */ - /* When checking directory entries, ignore the tables `glyx' and `locx' */ - /* which are hacked-out versions of `glyf' and `loca' in some PostScript */ - /* Type 42 fonts, and will generally be invalid. */ - /* */ + /* In theory, we should check the values of `search_range', */ + /* `entry_selector', and `range_shift' to detect non-SFNT based files */ + /* whose header might also start with 0x100000L (yes, these exist). */ + /* */ + /* Very unfortunately, many TrueType fonts don't have these fields */ + /* set correctly and we must ignore them to support them. An */ + /* alternative way to check the font file is thus to: */ + /* */ + /* - check that `num_tables' is valid */ + /* - look for a "head" table, check its size, and parse it to */ + /* see if its "magic" field is correctly set */ + /* */ + /* When checking directory entries, ignore the tables `glyx' and `locx' */ + /* which are hacked-out versions of `glyf' and `loca' in some PostScript */ + /* Type 42 fonts, and will generally be invalid. */ + /* */ static FT_Error sfnt_dir_check( FT_Stream stream, FT_ULong offset, @@ -207,6 +207,10 @@ FT_UInt32 magic; +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + head_retry: +#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ + has_head = 1; /* The table length should be 0x36, but certain font tools @@ -225,13 +229,17 @@ if ( FT_STREAM_SEEK( offset + 28 + 16*nn ) ) goto Bad_Format; } +#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS + else if ( table.Tag == TTAG_bhed ) + goto head_retry; +#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ } if ( has_head == 0 ) goto Bad_Format; Exit: - return error; + return error; Bad_Format: error = SFNT_Err_Unknown_File_Format; @@ -425,7 +433,7 @@ face->num_tables = sfnt->num_tables; - if ( FT_NEW_ARRAY( face->dir_tables, face->num_tables ) ) + if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) ) goto Exit; if ( FT_STREAM_SEEK( sfnt->offset + 12 ) || @@ -715,6 +723,8 @@ if ( FT_STREAM_READ_FIELDS( maxp_fields, maxProfile ) ) goto Exit; + face->root.num_glyphs = maxProfile->numGlyphs; + maxProfile->maxPoints = 0; maxProfile->maxContours = 0; maxProfile->maxCompositePoints = 0; @@ -743,8 +753,6 @@ if ( maxProfile->maxFunctionDefs == 0 ) maxProfile->maxFunctionDefs = 64; - face->root.num_glyphs = maxProfile->numGlyphs; - face->root.internal->max_points = (FT_UShort)FT_MAX( maxProfile->maxCompositePoints, maxProfile->maxPoints ); @@ -792,6 +800,83 @@ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ +#ifdef FT_OPTIMIZE_MEMORY + + static FT_Error + tt_face_load_metrics( TT_Face face, + FT_Stream stream, + FT_Bool vertical ) + { + FT_Error error; + FT_ULong table_size; + FT_Byte** ptable; + FT_ULong* ptable_size; + + + FT_TRACE2(( "TT_Load_%s_Metrics: %08p\n", vertical ? "Vertical" + : "Horizontal", + face )); + + if ( vertical ) + { + ptable = &face->vert_metrics; + ptable_size = &face->vert_metrics_size; + + /* The table is optional, quit silently if it wasn't found. */ + /* */ + /* XXX: Some fonts have a valid vertical header with a non-null */ + /* `number_of_VMetrics' fields, but no corresponding `vmtx' */ + /* table to get the metrics from (e.g. mingliu). */ + /* */ + /* For safety, we set the field to 0! */ + /* */ + error = face->goto_table( face, TTAG_vmtx, stream, &table_size ); + if ( error ) + { + /* Set number_Of_VMetrics to 0! */ + FT_TRACE2(( " no vertical header in file.\n" )); + error = SFNT_Err_Ok; + goto Exit; + } + } + else + { + ptable = &face->horz_metrics; + ptable_size = &face->horz_metrics_size; + + error = face->goto_table( face, TTAG_hmtx, stream, &table_size ); + if ( error ) + { +#ifdef FT_CONFIG_OPTION_INCREMENTAL + /* If this is an incrementally loaded font and there are */ + /* overriding metrics, tolerate a missing `hmtx' table. */ + if ( face->root.internal->incremental_interface && + face->root.internal->incremental_interface->funcs-> + get_glyph_metrics ) + { + face->horizontal.number_Of_HMetrics = 0; + error = SFNT_Err_Ok; + goto Exit; + } +#endif + + FT_ERROR(( " no horizontal metrics in file!\n" )); + error = SFNT_Err_Hmtx_Table_Missing; + goto Exit; + } + } + + if ( FT_FRAME_EXTRACT( table_size, *ptable ) ) + goto Exit; + + *ptable_size = table_size; + + Exit: + return error; + } + +#else /* !OPTIMIZE_MEMORY */ + static FT_Error tt_face_load_metrics( TT_Face face, FT_Stream stream, @@ -813,7 +898,7 @@ if ( vertical ) { - /* The table is optional, quit silently if it wasn't found */ + /* The table is optional, quit silently if it wasn't found. */ /* */ /* XXX: Some fonts have a valid vertical header with a non-null */ /* `number_of_VMetrics' fields, but no corresponding `vmtx' */ @@ -843,10 +928,10 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL /* If this is an incrementally loaded font and there are */ - /* overriding metrics tolerate a missing 'hmtx' table. */ - if ( face->root.internal->incremental_interface && + /* overriding metrics, tolerate a missing `hmtx' table. */ + if ( face->root.internal->incremental_interface && face->root.internal->incremental_interface->funcs-> - get_glyph_metrics ) + get_glyph_metrics ) { face->horizontal.number_Of_HMetrics = 0; error = SFNT_Err_Ok; @@ -880,8 +965,8 @@ goto Exit; } - if ( FT_NEW_ARRAY( *longs, num_longs ) || - FT_NEW_ARRAY( *shorts, num_shorts ) ) + if ( FT_QNEW_ARRAY( *longs, num_longs ) || + FT_QNEW_ARRAY( *shorts, num_shorts ) ) goto Exit; if ( FT_FRAME_ENTER( table_len ) ) @@ -909,9 +994,9 @@ for ( ; cur < limit; cur++ ) *cur = FT_GET_SHORT(); - /* we fill up the missing left side bearings with the */ + /* We fill up the missing left side bearings with the */ /* last valid value. Since this will occur for buggy CJK */ - /* fonts usually only, nothing serious will happen */ + /* fonts usually only, nothing serious will happen. */ if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 ) { FT_Short val = (*shorts)[num_shorts_checked - 1]; @@ -931,6 +1016,8 @@ return error; } +#endif /* !FT_OPTIMIZE_METRICS */ + /*************************************************************************/ /* */ @@ -1198,14 +1285,17 @@ FT_UInt count = table->numNameRecords; - for ( ; count > 0; count--, entry++ ) + if ( table->names ) { - FT_FREE( entry->string ); - entry->stringLength = 0; - } + for ( ; count > 0; count--, entry++ ) + { + FT_FREE( entry->string ); + entry->stringLength = 0; + } - /* free strings table */ - FT_FREE( table->names ); + /* free strings table */ + FT_FREE( table->names ); + } table->numNameRecords = 0; table->format = 0; @@ -1575,7 +1665,7 @@ num_ranges = face->gasp.numRanges; FT_TRACE3(( "number of ranges = %d\n", num_ranges )); - if ( FT_NEW_ARRAY( gaspranges, num_ranges ) || + if ( FT_QNEW_ARRAY( gaspranges, num_ranges ) || FT_FRAME_ENTER( num_ranges * 4L ) ) goto Exit; @@ -1600,164 +1690,6 @@ } - FT_CALLBACK_DEF( int ) - tt_kern_pair_compare( const void* a, - const void* b ); - - - /*************************************************************************/ - /* */ - /* <Function> */ - /* tt_face_load_kern */ - /* */ - /* <Description> */ - /* Loads the first kerning table with format 0 in the font. Only */ - /* accepts the first horizontal kerning table. Developers should use */ - /* the `ftxkern' extension to access other kerning tables in the font */ - /* file, if they really want to. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL_DEF( FT_Error ) - tt_face_load_kern( TT_Face face, - FT_Stream stream ) - { - FT_Error error; - FT_Memory memory = stream->memory; - - FT_UInt n, num_tables; - - - /* the kern table is optional; exit silently if it is missing */ - error = face->goto_table( face, TTAG_kern, stream, 0 ); - if ( error ) - return SFNT_Err_Ok; - - if ( FT_FRAME_ENTER( 4L ) ) - goto Exit; - - (void)FT_GET_USHORT(); /* version */ - num_tables = FT_GET_USHORT(); - - FT_FRAME_EXIT(); - - for ( n = 0; n < num_tables; n++ ) - { - FT_UInt coverage; - FT_UInt length; - - - if ( FT_FRAME_ENTER( 6L ) ) - goto Exit; - - (void)FT_GET_USHORT(); /* version */ - length = FT_GET_USHORT() - 6; /* substract header length */ - coverage = FT_GET_USHORT(); - - FT_FRAME_EXIT(); - - if ( coverage == 0x0001 ) - { - FT_UInt num_pairs; - TT_Kern0_Pair pair; - TT_Kern0_Pair limit; - - - /* found a horizontal format 0 kerning table! */ - if ( FT_FRAME_ENTER( 8L ) ) - goto Exit; - - num_pairs = FT_GET_USHORT(); - - /* skip the rest */ - - FT_FRAME_EXIT(); - - /* allocate array of kerning pairs */ - if ( FT_NEW_ARRAY( face->kern_pairs, num_pairs ) || - FT_FRAME_ENTER( 6L * num_pairs ) ) - goto Exit; - - pair = face->kern_pairs; - limit = pair + num_pairs; - for ( ; pair < limit; pair++ ) - { - pair->left = FT_GET_USHORT(); - pair->right = FT_GET_USHORT(); - pair->value = FT_GET_USHORT(); - } - - FT_FRAME_EXIT(); - - face->num_kern_pairs = num_pairs; - face->kern_table_index = n; - - /* ensure that the kerning pair table is sorted (yes, some */ - /* fonts have unsorted tables!) */ - { - FT_UInt i; - TT_Kern0_Pair pair0; - - - pair0 = face->kern_pairs; - - for ( i = 1; i < num_pairs; i++, pair0++ ) - { - if ( tt_kern_pair_compare( pair0, pair0 + 1 ) != -1 ) - { - ft_qsort( (void*)face->kern_pairs, (int)num_pairs, - sizeof ( TT_Kern0_PairRec ), tt_kern_pair_compare ); - break; - } - } - } - - goto Exit; - } - - if ( FT_STREAM_SKIP( length ) ) - goto Exit; - } - - /* no kern table found -- doesn't matter */ - face->kern_table_index = -1; - face->num_kern_pairs = 0; - face->kern_pairs = NULL; - - Exit: - return error; - } - - -#undef TT_KERN_INDEX -#define TT_KERN_INDEX( g1, g2 ) ( ( (FT_ULong)g1 << 16 ) | g2 ) - - - FT_CALLBACK_DEF( int ) - tt_kern_pair_compare( const void* a, - const void* b ) - { - TT_Kern0_Pair pair1 = (TT_Kern0_Pair)a; - TT_Kern0_Pair pair2 = (TT_Kern0_Pair)b; - - FT_ULong index1 = TT_KERN_INDEX( pair1->left, pair1->right ); - FT_ULong index2 = TT_KERN_INDEX( pair2->left, pair2->right ); - - - return ( index1 < index2 ? -1 : - ( index1 > index2 ? 1 : 0 )); - } - - -#undef TT_KERN_INDEX - - /*************************************************************************/ /* */ /* <Function> */ @@ -1774,6 +1706,79 @@ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ +#ifdef FT_OPTIMIZE_MEMORY + + FT_LOCAL_DEF( FT_Error ) + tt_face_load_hdmx( TT_Face face, + FT_Stream stream ) + { + FT_Error error; + FT_Memory memory = stream->memory; + FT_UInt version, nn, num_records; + FT_ULong table_size, record_size; + FT_Byte* p; + FT_Byte* limit; + + + /* this table is optional */ + error = face->goto_table( face, TTAG_hdmx, stream, &table_size ); + if ( error || table_size < 8 ) + return SFNT_Err_Ok; + + if ( FT_FRAME_EXTRACT( table_size, face->hdmx_table ) ) + goto Exit; + + p = face->hdmx_table; + limit = p + table_size; + + version = FT_NEXT_USHORT( p ); + num_records = FT_NEXT_USHORT( p ); + record_size = FT_NEXT_ULONG( p ); + + if ( version != 0 || num_records > 255 || record_size > 0x40000 ) + { + error = SFNT_Err_Invalid_File_Format; + goto Fail; + } + + if ( FT_NEW_ARRAY( face->hdmx_record_sizes, num_records ) ) + goto Fail; + + for ( nn = 0; nn < num_records; nn++ ) + { + if ( p + record_size > limit ) + break; + + face->hdmx_record_sizes[nn] = p[0]; + p += record_size; + } + + face->hdmx_record_count = nn; + face->hdmx_table_size = table_size; + + Exit: + return error; + + Fail: + FT_FRAME_RELEASE( face->hdmx_table ); + face->hdmx_table_size = 0; + goto Exit; + } + + + FT_LOCAL_DEF( void ) + tt_face_free_hdmx( TT_Face face ) + { + FT_Stream stream = face->root.stream; + FT_Memory memory = stream->memory; + + + FT_FREE( face->hdmx_record_sizes ); + FT_FRAME_RELEASE( face->hdmx_table ); + } + +#else /* !FT_OPTIMIZE_MEMORY */ + FT_LOCAL_DEF( FT_Error ) tt_face_load_hdmx( TT_Face face, FT_Stream stream ) @@ -1799,22 +1804,27 @@ if ( FT_FRAME_ENTER( 8L ) ) goto Exit; - hdmx->version = FT_GET_USHORT(); - num_records = FT_GET_SHORT(); - record_size = FT_GET_LONG(); + hdmx->version = FT_GET_USHORT(); + num_records = FT_GET_SHORT(); + record_size = FT_GET_LONG(); FT_FRAME_EXIT(); + if ( record_size < 0 || num_records < 0 ) + return SFNT_Err_Invalid_File_Format; + /* Only recognize format 0 */ if ( hdmx->version != 0 ) goto Exit; + /* we can't use FT_QNEW_ARRAY here; otherwise tt_face_free_hdmx */ + /* could fail during deallocation */ if ( FT_NEW_ARRAY( hdmx->records, num_records ) ) goto Exit; hdmx->num_records = num_records; - num_glyphs = face->root.num_glyphs; - record_size -= num_glyphs + 2; + num_glyphs = face->root.num_glyphs; + record_size -= num_glyphs + 2; { TT_HdmxEntry cur = hdmx->records; @@ -1828,13 +1838,13 @@ FT_READ_BYTE( cur->max_width ) ) goto Exit; - if ( FT_ALLOC( cur->widths, num_glyphs ) || + if ( FT_QALLOC( cur->widths, num_glyphs ) || FT_STREAM_READ( cur->widths, num_glyphs ) ) goto Exit; /* skip padding bytes */ if ( record_size > 0 && FT_STREAM_SKIP( record_size ) ) - goto Exit; + goto Exit; } } @@ -1843,17 +1853,6 @@ } - /*************************************************************************/ - /* */ - /* <Function> */ - /* tt_face_free_hdmx */ - /* */ - /* <Description> */ - /* Frees the horizontal device metrics table. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ FT_LOCAL_DEF( void ) tt_face_free_hdmx( TT_Face face ) { @@ -1871,5 +1870,7 @@ } } +#endif /* !OPTIMIZE_MEMORY */ + /* END */ diff --git a/src/libs/freetype2/sfnt/ttload.h b/src/libs/freetype2/sfnt/ttload.h index 27c41b50b9..d1a61ca7f1 100644 --- a/src/libs/freetype2/sfnt/ttload.h +++ b/src/libs/freetype2/sfnt/ttload.h @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (specification). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -111,11 +111,6 @@ FT_BEGIN_HEADER tt_face_free_hdmx ( TT_Face face ); - FT_LOCAL( FT_Error ) - tt_face_load_kern( TT_Face face, - FT_Stream stream ); - - FT_LOCAL( FT_Error ) tt_face_load_gasp( TT_Face face, FT_Stream stream ); diff --git a/src/libs/freetype2/sfnt/ttsbit.c b/src/libs/freetype2/sfnt/ttsbit.c index 444c27acc0..610b63bcc0 100644 --- a/src/libs/freetype2/sfnt/ttsbit.c +++ b/src/libs/freetype2/sfnt/ttsbit.c @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -15,6 +15,14 @@ /* */ /***************************************************************************/ +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_TRUETYPE_TAGS_H + +#ifdef FT_OPTIMIZE_MEMORY +#include "ttsbit0.c" +#else /* !OPTIMIZE_MEMORY */ #include <ft2build.h> #include FT_INTERNAL_DEBUG_H @@ -185,7 +193,7 @@ } - const FT_Frame_Field sbit_metrics_fields[] = + static const FT_Frame_Field sbit_metrics_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_SBit_MetricsRec @@ -334,6 +342,13 @@ FT_Bool large = FT_BOOL( range->index_format == 1 ); + + if ( range->last_glyph < range->first_glyph ) + { + error = SFNT_Err_Invalid_File_Format; + goto Exit; + } + num_glyphs = range->last_glyph - range->first_glyph + 1L; range->num_glyphs = num_glyphs; num_glyphs++; /* XXX: BEWARE - see spec */ @@ -400,7 +415,7 @@ FT_ULong num_strikes; FT_ULong table_base; - const FT_Frame_Field sbit_line_metrics_fields[] = + static const FT_Frame_Field sbit_line_metrics_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_SBit_LineMetricsRec @@ -423,7 +438,7 @@ FT_FRAME_END }; - const FT_Frame_Field strike_start_fields[] = + static const FT_Frame_Field strike_start_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_SBit_StrikeRec @@ -436,7 +451,7 @@ FT_FRAME_END }; - const FT_Frame_Field strike_end_fields[] = + static const FT_Frame_Field strike_end_fields[] = { /* no FT_FRAME_START */ FT_FRAME_USHORT( start_glyph ), @@ -519,14 +534,14 @@ FT_ULong count2 = strike->num_ranges; - if ( FT_NEW_ARRAY( strike->sbit_ranges, strike->num_ranges ) ) - goto Exit; - /* read each range */ if ( FT_STREAM_SEEK( table_base + strike->ranges_offset ) || FT_FRAME_ENTER( strike->num_ranges * 8L ) ) goto Exit; + if ( FT_NEW_ARRAY( strike->sbit_ranges, strike->num_ranges ) ) + goto Exit; + range = strike->sbit_ranges; while ( count2 > 0 ) { @@ -569,6 +584,41 @@ } } + /* now set up the root fields to indicate the strikes */ + if ( face->num_sbit_strikes ) + { + FT_ULong n; + FT_Face root = FT_FACE( face ); + + + if ( FT_NEW_ARRAY( root->available_sizes, face->num_sbit_strikes ) ) + goto Exit; + + for ( n = 0 ; n < face->num_sbit_strikes ; n++ ) + { + FT_Bitmap_Size* bsize = root->available_sizes + n; + TT_SBit_Strike strike = face->sbit_strikes + n; + FT_UShort fupem = face->header.Units_Per_EM; + FT_Short height = (FT_Short)( face->horizontal.Ascender - + face->horizontal.Descender + + face->horizontal.Line_Gap ); + FT_Short avg = face->os2.xAvgCharWidth; + + + /* assume 72dpi */ + bsize->height = + (FT_Short)( ( height * strike->y_ppem + fupem / 2 ) / fupem ); + bsize->width = + (FT_Short)( ( avg * strike->y_ppem + fupem / 2 ) / fupem ); + bsize->size = strike->y_ppem << 6; + bsize->x_ppem = strike->x_ppem << 6; + bsize->y_ppem = strike->y_ppem << 6; + } + + root->face_flags |= FT_FACE_FLAG_FIXED_SIZES; + root->num_fixed_sizes = (FT_Int)face->num_sbit_strikes; + } + Exit: return error; } @@ -1429,7 +1479,7 @@ error = face->goto_table( face, TTAG_EBDT, stream, 0 ); if ( error ) error = face->goto_table( face, TTAG_bdat, stream, 0 ); - if (error) + if ( error ) goto Exit; ebdt_pos = FT_STREAM_POS(); @@ -1463,5 +1513,7 @@ return error; } +#endif /* !OPTIMIZE_MEMORY */ + /* END */ diff --git a/src/libs/freetype2/sfnt/ttsbit.h b/src/libs/freetype2/sfnt/ttsbit.h index f1b63b7ec4..d2734dd810 100644 --- a/src/libs/freetype2/sfnt/ttsbit.h +++ b/src/libs/freetype2/sfnt/ttsbit.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -41,6 +41,7 @@ FT_BEGIN_HEADER FT_UInt y_ppem, FT_ULong *astrike_index ); +#ifndef FT_OPTIMIZE_MEMORY FT_LOCAL( FT_Error ) tt_find_sbit_image( TT_Face face, FT_UInt glyph_index, @@ -53,6 +54,7 @@ FT_BEGIN_HEADER tt_load_sbit_metrics( FT_Stream stream, TT_SBit_Range range, TT_SBit_Metrics metrics ); +#endif /* !FT_OPTIMIZE_MEMORY */ FT_LOCAL( FT_Error ) tt_face_load_sbit_image( TT_Face face, diff --git a/src/libs/freetype2/sfnt/ttsbit0.c b/src/libs/freetype2/sfnt/ttsbit0.c new file mode 100644 index 0000000000..31c77856f3 --- /dev/null +++ b/src/libs/freetype2/sfnt/ttsbit0.c @@ -0,0 +1,967 @@ +/***************************************************************************/ +/* */ +/* ttsbit0.c */ +/* */ +/* TrueType and OpenType embedded bitmap support (body). */ +/* This is a heap-optimized version. */ +/* */ +/* Copyright 2005 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_TRUETYPE_TAGS_H +#include "ttsbit.h" + +#include "sferrors.h" + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_ttsbit + + + static const FT_Frame_Field tt_sbit_line_metrics_fields[] = + { +#undef FT_STRUCTURE +#define FT_STRUCTURE TT_SBit_LineMetricsRec + + /* no FT_FRAME_START */ + FT_FRAME_CHAR( ascender ), + FT_FRAME_CHAR( descender ), + FT_FRAME_BYTE( max_width ), + + FT_FRAME_CHAR( caret_slope_numerator ), + FT_FRAME_CHAR( caret_slope_denominator ), + FT_FRAME_CHAR( caret_offset ), + + FT_FRAME_CHAR( min_origin_SB ), + FT_FRAME_CHAR( min_advance_SB ), + FT_FRAME_CHAR( max_before_BL ), + FT_FRAME_CHAR( min_after_BL ), + FT_FRAME_CHAR( pads[0] ), + FT_FRAME_CHAR( pads[1] ), + FT_FRAME_END + }; + + static const FT_Frame_Field tt_strike_start_fields[] = + { +#undef FT_STRUCTURE +#define FT_STRUCTURE TT_SBit_StrikeRec + + /* no FT_FRAME_START */ + FT_FRAME_ULONG( ranges_offset ), + FT_FRAME_SKIP_LONG, + FT_FRAME_ULONG( num_ranges ), + FT_FRAME_ULONG( color_ref ), + FT_FRAME_END + }; + + static const FT_Frame_Field tt_strike_end_fields[] = + { + /* no FT_FRAME_START */ + FT_FRAME_USHORT( start_glyph ), + FT_FRAME_USHORT( end_glyph ), + FT_FRAME_BYTE ( x_ppem ), + FT_FRAME_BYTE ( y_ppem ), + FT_FRAME_BYTE ( bit_depth ), + FT_FRAME_CHAR ( flags ), + FT_FRAME_END + }; + + + FT_LOCAL_DEF( FT_Error ) + tt_face_load_sbit_strikes( TT_Face face, + FT_Stream stream ) + { + FT_Error error = SFNT_Err_Ok; + FT_Fixed version; + FT_ULong num_strikes, table_size; + FT_Byte* p; + FT_Byte* p_limit; + FT_UInt nn, count; + + + face->sbit_num_strikes = 0; + + /* this table is optional */ + error = face->goto_table( face, TTAG_EBLC, stream, &table_size ); + if ( error ) + error = face->goto_table( face, TTAG_bloc, stream, &table_size ); + if ( error ) + goto Exit; + + if ( table_size < 8 ) + { + FT_ERROR(( "%s: table too short!\n", "tt_face_load_sbit_strikes" )); + error = SFNT_Err_Invalid_File_Format; + goto Exit; + } + + if ( FT_FRAME_EXTRACT( table_size, face->sbit_table ) ) + goto Exit; + + face->sbit_table_size = table_size; + + p = face->sbit_table; + p_limit = p + table_size; + + version = FT_NEXT_ULONG( p ); + num_strikes = FT_NEXT_ULONG( p ); + + if ( version != 0x00020000UL || num_strikes >= 0x10000UL ) + { + FT_ERROR(( "%s: invalid table version!\n", + "tt_face_load_sbit_strikes" )); + error = SFNT_Err_Invalid_File_Format; + goto Fail; + } + + /* + * Count the number of strikes available in the table. We are a bit + * paranoid there and don't trust the data. + */ + count = (FT_UInt)num_strikes; + if ( 8 +48UL * count > table_size ) + count = (FT_UInt)( ( p_limit - p ) / 48 ); + + face->sbit_num_strikes = count; + + /* + * Now allocate the root array of FT_Bitmap_Size records and + * populate them. Unfortunately, it isn't possible to indicate bit + * depths in the FT_Bitmap_Size record. This is a design error. + */ + { + FT_Memory memory = face->root.stream->memory; + FT_UInt em_size = (FT_UInt) face->header.Units_Per_EM; + FT_Short height = (FT_Short)( face->horizontal.Ascender - + face->horizontal.Descender + + face->horizontal.Line_Gap ); + + FT_Short avgwidth = face->os2.xAvgCharWidth; + + + if ( FT_NEW_ARRAY( face->root.available_sizes, count ) ) + goto Fail; + + for ( nn = 0; nn < count; nn++ ) + { + FT_Bitmap_Size* bsize = face->root.available_sizes + nn; + FT_UInt x_ppem, y_ppem; + + + x_ppem = p[44]; + y_ppem = p[45]; + + bsize->x_ppem = (FT_Pos)(x_ppem << 6); + bsize->y_ppem = (FT_Pos)(y_ppem << 6); + + bsize->height = (FT_Short)( height*y_ppem + em_size / 2 ) / em_size; + bsize->width = (FT_Short)( avgwidth*y_ppem + em_size / 2 ) / em_size; + bsize->size = bsize->y_ppem; + + p += 48; + } + + face->root.face_flags |= FT_FACE_FLAG_FIXED_SIZES; + face->root.num_fixed_sizes = count; + } + + Exit: + return error; + + Fail: + FT_FRAME_RELEASE( face->sbit_table ); + face->sbit_table_size = 0; + goto Exit; + } + + + FT_LOCAL_DEF( void ) + tt_face_free_sbit_strikes( TT_Face face ) + { + FT_Stream stream = face->root.stream; + + + FT_FRAME_RELEASE( face->sbit_table ); + face->sbit_table_size = 0; + face->sbit_num_strikes = 0; + } + + + FT_LOCAL_DEF( FT_Error ) + tt_face_set_sbit_strike( TT_Face face, + FT_UInt x_ppem, + FT_UInt y_ppem, + FT_ULong *astrike_index ) + { + FT_UInt nn, count; + FT_Byte* p; + FT_Byte* p_limit; + + + if ( x_ppem > 255 || + y_ppem < 1 || y_ppem > 255 ) + return SFNT_Err_Invalid_PPem; + + p = face->sbit_table + 8; + p_limit = p + face->sbit_table_size; + count = face->sbit_num_strikes; + + for ( nn = 0; nn < count; nn++ ) + { + if ( x_ppem == (FT_UInt)p[44] && y_ppem == (FT_UInt)p[45] ) + { + *astrike_index = (FT_ULong)nn; + return SFNT_Err_Ok; + } + p += 48; + } + + return SFNT_Err_Invalid_PPem; + } + + + typedef struct + { + TT_Face face; + FT_Stream stream; + FT_Bitmap* bitmap; + TT_SBit_Metrics metrics; + FT_Bool metrics_loaded; + FT_Bool bitmap_allocated; + FT_Byte bit_depth; + + FT_ULong ebdt_start; + FT_ULong ebdt_size; + + FT_ULong strike_index_array; + FT_ULong strike_index_count; + FT_Byte* eblc_base; + FT_Byte* eblc_limit; + + } TT_SBitDecoderRec, *TT_SBitDecoder; + + + static FT_Error + tt_sbit_decoder_init( TT_SBitDecoder decoder, + TT_Face face, + FT_ULong strike_index, + TT_SBit_MetricsRec* metrics ) + { + FT_Error error; + FT_Stream stream = face->root.stream; + FT_ULong ebdt_size; + + + error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size ); + if ( error ) + error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size ); + if ( error ) + goto Exit; + + decoder->face = face; + decoder->stream = stream; + decoder->bitmap = &face->root.glyph->bitmap; + decoder->metrics = metrics; + + decoder->metrics_loaded = 0; + decoder->bitmap_allocated = 0; + + decoder->ebdt_start = FT_STREAM_POS(); + decoder->ebdt_size = ebdt_size; + + decoder->eblc_base = face->sbit_table; + decoder->eblc_limit = face->sbit_table + face->sbit_table_size; + + /* now find the strike corresponding to the index */ + { + FT_Byte* p = decoder->eblc_base + 8 + 48 * strike_index; + + + decoder->strike_index_array = FT_NEXT_ULONG( p ); + p += 4; + decoder->strike_index_count = FT_NEXT_ULONG( p ); + p += 34; + decoder->bit_depth = *p; + } + + Exit: + return error; + } + + + static void + tt_sbit_decoder_done( TT_SBitDecoder decoder ) + { + FT_UNUSED( decoder ); + } + + + static FT_Error + tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder decoder ) + { + FT_Error error = SFNT_Err_Ok; + FT_UInt width, height; + FT_Bitmap* map = decoder->bitmap; + FT_Long size; + + + if ( !decoder->metrics_loaded ) + { + error = SFNT_Err_Invalid_Argument; + goto Exit; + } + + width = decoder->metrics->width; + height = decoder->metrics->height; + + map->width = (int)width; + map->rows = (int)height; + + switch ( decoder->bit_depth ) + { + case 1: + map->pixel_mode = FT_PIXEL_MODE_MONO; + map->pitch = ( map->width + 7 ) >> 3; + break; + + case 2: + map->pixel_mode = FT_PIXEL_MODE_GRAY2; + map->pitch = ( map->width + 3 ) >> 2; + break; + + case 4: + map->pixel_mode = FT_PIXEL_MODE_GRAY4; + map->pitch = ( map->width + 1 ) >> 1; + break; + + case 8: + map->pixel_mode = FT_PIXEL_MODE_GRAY; + map->pitch = map->width; + break; + + default: + error = SFNT_Err_Invalid_File_Format; + goto Exit; + } + + size = map->rows * map->pitch; + + /* check that there is no empty image */ + if ( size == 0 ) + goto Exit; /* exit successfully! */ + + error = ft_glyphslot_alloc_bitmap( decoder->face->root.glyph, size ); + if ( error ) + goto Exit; + + decoder->bitmap_allocated = 1; + + Exit: + return error; + } + + + static FT_Error + tt_sbit_decoder_load_metrics( TT_SBitDecoder decoder, + FT_Byte* *pp, + FT_Byte* limit, + FT_Bool big ) + { + FT_Byte* p = *pp; + TT_SBit_Metrics metrics = decoder->metrics; + + + if ( p + 5 > limit ) + goto Fail; + + if ( !decoder->metrics_loaded ) + { + metrics->height = p[0]; + metrics->width = p[1]; + metrics->horiBearingX = (FT_Char)p[2]; + metrics->horiBearingY = (FT_Char)p[3]; + metrics->horiAdvance = p[4]; + } + + p += 5; + if ( big ) + { + if ( p + 3 > limit ) + goto Fail; + + if ( !decoder->metrics_loaded ) + { + metrics->vertBearingX = (FT_Char)p[0]; + metrics->vertBearingY = (FT_Char)p[1]; + metrics->vertAdvance = p[2]; + } + + p += 3; + } + + decoder->metrics_loaded = 1; + *pp = p; + return 0; + + Fail: + return SFNT_Err_Invalid_Argument; + } + + + /* forward declaration */ + static FT_Error + tt_sbit_decoder_load_image( TT_SBitDecoder decoder, + FT_UInt glyph_index, + FT_Int x_pos, + FT_Int y_pos ); + + typedef FT_Error (*TT_SBitDecoder_LoadFunc)( TT_SBitDecoder decoder, + FT_Byte* p, + FT_Byte* plimit, + FT_Int x_pos, + FT_Int y_pos ); + + + static FT_Error + tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder decoder, + FT_Byte* p, + FT_Byte* limit, + FT_Int x_pos, + FT_Int y_pos ) + { + FT_Error error = SFNT_Err_Ok; + FT_Byte* line; + FT_Int bit_height, bit_width, pitch, width, height, h; + FT_Bitmap* bitmap; + + + if ( !decoder->bitmap_allocated ) + { + error = tt_sbit_decoder_alloc_bitmap( decoder ); + if ( error ) + goto Exit; + } + + /* check that we can write the glyph into the bitmap */ + bitmap = decoder->bitmap; + bit_width = bitmap->width; + bit_height = bitmap->rows; + pitch = bitmap->pitch; + line = bitmap->buffer; + + width = decoder->metrics->width; + height = decoder->metrics->height; + + if ( x_pos < 0 || x_pos + width > bit_width || + y_pos < 0 || y_pos + height > bit_height ) + { + error = SFNT_Err_Invalid_File_Format; + goto Exit; + } + + if ( p + ( ( width + 7 ) >> 3 ) * height > limit ) + { + error = SFNT_Err_Invalid_File_Format; + goto Exit; + } + + /* now do the blit */ + line += y_pos * pitch + ( x_pos >> 3 ); + x_pos &= 7; + + if ( x_pos == 0 ) /* the easy one */ + { + for ( h = height; h > 0; h--, line += pitch ) + { + FT_Byte* write = line; + FT_Int w; + + + for ( w = width; w >= 8; w -= 8 ) + { + write[0] = (FT_Byte)( write[0] | *p++ ); + write += 1; + } + + if ( w > 0 ) + write[0] = (FT_Byte)( write[0] | ( *p++ & ( 0xFF00U >> w ) ) ); + } + } + else /* x_pos > 0 */ + { + for ( h = height; h > 0; h--, line += pitch ) + { + FT_Byte* write = line; + FT_Int w; + FT_UInt wval = 0; + + + for ( w = width; w >= 8; w -= 8 ) + { + wval = (FT_UInt)( wval | *p++ ); + write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) ); + write += 1; + wval <<= 8; + } + + if ( w > 0 ) + wval = (FT_UInt)(wval | ( *p++ & ( 0xFF00U >> w ) ) ); + + write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) ); + } + } + + Exit: + return error; + } + + + static FT_Error + tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder decoder, + FT_Byte* p, + FT_Byte* limit, + FT_Int x_pos, + FT_Int y_pos ) + { + FT_Error error = SFNT_Err_Ok; + FT_Byte* line; + FT_Int bit_height, bit_width, pitch, width, height, h; + FT_Bitmap* bitmap; + FT_UInt32 rval; + + + if ( !decoder->bitmap_allocated ) + { + error = tt_sbit_decoder_alloc_bitmap( decoder ); + if ( error ) + goto Exit; + } + + /* check that we can write the glyph into the bitmap */ + bitmap = decoder->bitmap; + bit_width = bitmap->width; + bit_height = bitmap->rows; + pitch = bitmap->pitch; + line = bitmap->buffer; + + width = decoder->metrics->width; + height = decoder->metrics->height; + + if ( x_pos < 0 || x_pos + width > bit_width || + y_pos < 0 || y_pos + height > bit_height ) + { + error = SFNT_Err_Invalid_File_Format; + goto Exit; + } + + if ( p + ( ( width + 7 ) >> 3 ) * height > limit ) + { + error = SFNT_Err_Invalid_File_Format; + goto Exit; + } + + /* now do the blit */ + line += y_pos * pitch + ( x_pos >> 3 ); + x_pos &= 7; + rval = 0x10000UL; + + for ( h = height; h > 0; h--, line += pitch ) + { + FT_Byte* write = line; + FT_UInt32 wval = 0x100 << x_pos; + FT_Int w; + + + for ( w = width; w >= 8; w -= 8 ) + { + if ( rval & 0x10000UL ) + rval = 0x100 | *p++; + + wval |= rval & 0x80; + + wval <<= 1; + rval <<= 1; + + if ( wval & 0x10000UL ) + { + write[0] = (FT_Byte)( write[0] | ( wval >> 8 ) ); + write += 1; + wval = 0x100; + } + } + + if ( wval != 0x100 ) + { + while ( wval > 0x1FF ) + wval >>= 1; + + write[0] = (FT_Byte)( write[0] | wval ); + } + } + + Exit: + return error; + } + + + static FT_Error + tt_sbit_decoder_load_compound( TT_SBitDecoder decoder, + FT_Byte* p, + FT_Byte* limit, + FT_Int x_pos, + FT_Int y_pos ) + { + FT_Error error = SFNT_Err_Ok; + FT_UInt num_components, nn; + + + if ( p + 2 > limit ) + goto Fail; + + num_components = FT_NEXT_USHORT( p ); + if ( p + 4 * num_components > limit ) + goto Fail; + + for ( nn = 0; nn < num_components; nn++ ) + { + FT_UInt gindex = FT_NEXT_USHORT( p ); + FT_Byte dx = FT_NEXT_BYTE( p ); + FT_Byte dy = FT_NEXT_BYTE( p ); + + + /* NB: a recursive call */ + error = tt_sbit_decoder_load_image( decoder, gindex, + x_pos + dx, y_pos + dy ); + if ( error ) + break; + } + + Exit: + return error; + + Fail: + error = SFNT_Err_Invalid_File_Format; + goto Exit; + } + + + static FT_Error + tt_sbit_decoder_load_bitmap( TT_SBitDecoder decoder, + FT_UInt glyph_format, + FT_ULong glyph_start, + FT_ULong glyph_size, + FT_Int x_pos, + FT_Int y_pos ) + { + FT_Error error; + FT_Stream stream = decoder->stream; + FT_Byte* p; + FT_Byte* p_limit; + FT_Byte* data; + + + /* seek into the EBDT table now */ + if ( glyph_start + glyph_size > decoder->ebdt_size ) + { + error = SFNT_Err_Invalid_Argument; + goto Exit; + } + + if ( FT_STREAM_SEEK( decoder->ebdt_start + glyph_start ) || + FT_FRAME_EXTRACT( glyph_size, data ) ) + goto Exit; + + p = data; + p_limit = p + glyph_size; + + /* read the data, depending on the glyph format */ + switch ( glyph_format ) + { + case 1: + case 2: + case 8: + error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 0 ); + break; + + case 6: + case 7: + case 9: + error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ); + break; + + default: + error = SFNT_Err_Ok; + } + + if ( error ) + goto Fail; + + { + TT_SBitDecoder_LoadFunc loader; + + + switch ( glyph_format ) + { + case 1: + case 6: + loader = tt_sbit_decoder_load_byte_aligned; + break; + + case 2: + case 5: + case 7: + loader = tt_sbit_decoder_load_bit_aligned; + break; + + case 8: + if ( p + 1 > p_limit ) + goto Fail; + + p += 1; /* skip padding */ + /* fall-through */ + + case 9: + loader = tt_sbit_decoder_load_compound; + break; + + default: + goto Fail; + } + + error = loader( decoder, p, p_limit, x_pos, y_pos ); + } + + Fail: + FT_FRAME_RELEASE( data ); + + Exit: + return error; + } + + + static FT_Error + tt_sbit_decoder_load_image( TT_SBitDecoder decoder, + FT_UInt glyph_index, + FT_Int x_pos, + FT_Int y_pos ) + { + /* + * First, we find the correct strike range that applies to this + * glyph index. + */ + + FT_Byte* p = decoder->eblc_base + decoder->strike_index_array; + FT_Byte* p_limit = decoder->eblc_limit; + FT_ULong num_ranges = decoder->strike_index_count; + FT_UInt start, end, index_format, image_format; + FT_ULong image_start = 0, image_end = 0, image_offset; + + + if ( p + 8 * num_ranges > p_limit ) + goto NoBitmap; + + for ( ; num_ranges > 0; num_ranges-- ) + { + start = FT_NEXT_USHORT( p ); + end = FT_NEXT_USHORT( p ); + + if ( glyph_index >= start && glyph_index <= end ) + goto FoundRange; + + p += 4; /* ignore index offset */ + } + goto NoBitmap; + + FoundRange: + image_offset = FT_NEXT_ULONG( p ); + p = decoder->eblc_base + decoder->strike_index_array + image_offset; + if ( p + 8 > p_limit ) + goto NoBitmap; + + /* now find the glyph's location and extend within the ebdt table */ + index_format = FT_NEXT_USHORT( p ); + image_format = FT_NEXT_USHORT( p ); + image_offset = FT_NEXT_ULONG ( p ); + + switch ( index_format ) + { + case 1: /* 4-byte offsets relative to `image_offset' */ + { + p += 4 * ( glyph_index - start ); + if ( p + 8 > p_limit ) + goto NoBitmap; + + image_start = FT_NEXT_ULONG( p ); + image_end = FT_NEXT_ULONG( p ); + + if ( image_start == image_end ) /* missing glyph */ + goto NoBitmap; + } + break; + + case 2: /* big metrics, constant image size */ + { + FT_ULong image_size; + + + if ( p + 12 > p_limit ) + goto NoBitmap; + + image_size = FT_NEXT_ULONG( p ); + + if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) ) + goto NoBitmap; + + image_start = image_offset + image_size * ( glyph_index - start ); + image_end = image_start + image_size; + } + break; + + case 3: /* 2-byte offsets relative to 'image_offset' */ + { + p += 2 * ( glyph_index - start ); + if ( p + 4 > p_limit ) + goto NoBitmap; + + image_start = FT_NEXT_USHORT( p ); + image_end = FT_NEXT_USHORT( p ); + + if ( image_start == image_end ) /* missing glyph */ + goto NoBitmap; + } + break; + + case 4: /* sparse glyph array with (glyph,offset) pairs */ + { + FT_ULong mm, num_glyphs; + + + if ( p + 4 > p_limit ) + goto NoBitmap; + + num_glyphs = FT_NEXT_ULONG( p ); + if ( p + ( num_glyphs + 1 ) * 4 > p_limit ) + goto NoBitmap; + + for ( mm = 0; mm < num_glyphs; mm++ ) + { + FT_UInt gindex = FT_NEXT_USHORT( p ); + + + if ( gindex == glyph_index ) + { + image_start = FT_NEXT_USHORT( p ); + p += 2; + image_end = FT_PEEK_USHORT( p ); + break; + } + p += 2; + } + + if ( mm >= num_glyphs ) + goto NoBitmap; + } + break; + + case 5: /* constant metrics with sparse glyph codes */ + { + FT_ULong image_size, mm, num_glyphs; + + + if ( p + 16 > p_limit ) + goto NoBitmap; + + image_size = FT_NEXT_ULONG( p ); + + if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) ) + goto NoBitmap; + + num_glyphs = FT_NEXT_ULONG( p ); + if ( p + 2 * num_glyphs > p_limit ) + goto NoBitmap; + + for ( mm = 0; mm < num_glyphs; mm++ ) + { + FT_UInt gindex = FT_NEXT_USHORT( p ); + + + if ( gindex == glyph_index ) + break; + } + + if ( mm >= num_glyphs ) + goto NoBitmap; + + image_start = image_offset + image_size*mm; + image_end = image_start + image_size; + } + break; + + default: + goto NoBitmap; + } + + if ( image_start > image_end ) + goto NoBitmap; + + image_end -= image_start; + image_start = image_offset + image_start; + + return tt_sbit_decoder_load_bitmap( decoder, + image_format, + image_start, + image_end, + x_pos, + y_pos ); + + NoBitmap: + return SFNT_Err_Invalid_Argument; + } + + + FT_LOCAL( FT_Error ) + tt_face_load_sbit_image( TT_Face face, + FT_ULong strike_index, + FT_UInt glyph_index, + FT_UInt load_flags, + FT_Stream stream, + FT_Bitmap *map, + TT_SBit_MetricsRec *metrics ) + { + TT_SBitDecoderRec decoder[1]; + FT_Error error; + + FT_UNUSED( load_flags ); + FT_UNUSED( stream ); + FT_UNUSED( map ); + + + error = tt_sbit_decoder_init( decoder, face, strike_index, metrics ); + if ( !error ) + { + error = tt_sbit_decoder_load_image( decoder, glyph_index, 0, 0 ); + tt_sbit_decoder_done( decoder ); + } + + return error; + } + +/* EOF */ diff --git a/src/libs/freetype2/sfnt/ttsbit0.h b/src/libs/freetype2/sfnt/ttsbit0.h new file mode 100644 index 0000000000..396ddc555e --- /dev/null +++ b/src/libs/freetype2/sfnt/ttsbit0.h @@ -0,0 +1,7 @@ +/* + * ttsbit0.h + * + * This is a dummy file, used to please the build system. It is never + * included by the sfnt sources. + * + */ diff --git a/src/libs/freetype2/smooth/ftgrays.c b/src/libs/freetype2/smooth/ftgrays.c index 499cc8cb57..99119159db 100644 --- a/src/libs/freetype2/smooth/ftgrays.c +++ b/src/libs/freetype2/smooth/ftgrays.c @@ -4,7 +4,7 @@ /* */ /* A new `perfect' anti-aliasing renderer (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003 by */ +/* Copyright 2000-2001, 2002, 2003, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -235,8 +235,8 @@ typedef long TPos; /* sub-pixel coordinate */ /* determine the type used to store cell areas. This normally takes at */ - /* least PIXEL_BYTES*2 + 1. On 16-bit systems, we need to use `long' */ - /* instead of `int', otherwise bad things happen */ + /* least PIXEL_BITS*2 + 1 bits. On 16-bit systems, we need to use */ + /* `long' instead of `int', otherwise bad things happen */ #if PIXEL_BITS <= 7 @@ -457,7 +457,7 @@ } /* record the previous cell if needed (i.e., if we changed the cell */ - /* position, of changed the `invalid' flag) */ + /* position, or changed the `invalid' flag) */ if ( ras.invalid != invalid || record ) gray_record_cell( RAS_VAR ); @@ -782,8 +782,8 @@ static void - gray_render_conic( RAS_ARG_ FT_Vector* control, - FT_Vector* to ) + gray_render_conic( RAS_ARG_ const FT_Vector* control, + const FT_Vector* to ) { TPos dx, dy; int top, level; @@ -917,9 +917,9 @@ static void - gray_render_cubic( RAS_ARG_ FT_Vector* control1, - FT_Vector* control2, - FT_Vector* to ) + gray_render_cubic( RAS_ARG_ const FT_Vector* control1, + const FT_Vector* control2, + const FT_Vector* to ) { TPos dx, dy, da, db; int top, level; @@ -1229,8 +1229,8 @@ static int - gray_move_to( FT_Vector* to, - FT_Raster raster ) + gray_move_to( const FT_Vector* to, + FT_Raster raster ) { TPos x, y; @@ -1251,8 +1251,8 @@ static int - gray_line_to( FT_Vector* to, - FT_Raster raster ) + gray_line_to( const FT_Vector* to, + FT_Raster raster ) { gray_render_line( (PRaster)raster, UPSCALE( to->x ), UPSCALE( to->y ) ); @@ -1261,9 +1261,9 @@ static int - gray_conic_to( FT_Vector* control, - FT_Vector* to, - FT_Raster raster ) + gray_conic_to( const FT_Vector* control, + const FT_Vector* to, + FT_Raster raster ) { gray_render_conic( (PRaster)raster, control, to ); return 0; @@ -1271,10 +1271,10 @@ static int - gray_cubic_to( FT_Vector* control1, - FT_Vector* control2, - FT_Vector* to, - FT_Raster raster ) + gray_cubic_to( const FT_Vector* control1, + const FT_Vector* control2, + const FT_Vector* to, + FT_Raster raster ) { gray_render_cubic( (PRaster)raster, control1, control2, to ); return 0; @@ -1282,10 +1282,10 @@ static void - gray_render_span( int y, - int count, - FT_Span* spans, - PRaster raster ) + gray_render_span( int y, + int count, + const FT_Span* spans, + PRaster raster ) { unsigned char* p; FT_Bitmap* map = &raster->target; @@ -1447,7 +1447,7 @@ static void - gray_sweep( RAS_ARG_ FT_Bitmap* target ) + gray_sweep( RAS_ARG_ const FT_Bitmap* target ) { TCoord x, y, cover; TArea area; @@ -1578,7 +1578,7 @@ /* Error code. 0 means sucess. */ /* */ static - int FT_Outline_Decompose( FT_Outline* outline, + int FT_Outline_Decompose( const FT_Outline* outline, const FT_Outline_Funcs* func_interface, void* user ) { @@ -1960,11 +1960,11 @@ extern int - gray_raster_render( PRaster raster, - FT_Raster_Params* params ) + gray_raster_render( PRaster raster, + const FT_Raster_Params* params ) { - FT_Outline* outline = (FT_Outline*)params->source; - FT_Bitmap* target_map = params->target; + const FT_Outline* outline = (const FT_Outline*)params->source; + const FT_Bitmap* target_map = params->target; if ( !raster || !raster->cells || !raster->max_cells ) @@ -2131,7 +2131,7 @@ static void gray_raster_reset( FT_Raster raster, - const char* pool_base, + char* pool_base, long pool_size ) { PRaster rast = (PRaster)raster; diff --git a/src/libs/freetype2/smooth/ftsmooth.c b/src/libs/freetype2/smooth/ftsmooth.c index af8783e296..54bf9e7575 100644 --- a/src/libs/freetype2/smooth/ftsmooth.c +++ b/src/libs/freetype2/smooth/ftsmooth.c @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -54,10 +54,10 @@ /* transform a given glyph image */ static FT_Error - ft_smooth_transform( FT_Renderer render, - FT_GlyphSlot slot, - FT_Matrix* matrix, - FT_Vector* delta ) + ft_smooth_transform( FT_Renderer render, + FT_GlyphSlot slot, + const FT_Matrix* matrix, + const FT_Vector* delta ) { FT_Error error = Smooth_Err_Ok; @@ -94,13 +94,13 @@ /* convert a slot's glyph image into a bitmap */ static FT_Error - ft_smooth_render_generic( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - FT_Vector* origin, - FT_Render_Mode required_mode, - FT_Int hmul, - FT_Int vmul ) + ft_smooth_render_generic( FT_Renderer render, + FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin, + FT_Render_Mode required_mode, + FT_Int hmul, + FT_Int vmul ) { FT_Error error; FT_Outline* outline = NULL; @@ -231,10 +231,10 @@ /* convert a slot's glyph image into a bitmap */ static FT_Error - ft_smooth_render( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - FT_Vector* origin ) + ft_smooth_render( FT_Renderer render, + FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ) { if ( mode == FT_RENDER_MODE_LIGHT ) mode = FT_RENDER_MODE_NORMAL; @@ -247,10 +247,10 @@ /* convert a slot's glyph image into a horizontal LCD bitmap */ static FT_Error - ft_smooth_render_lcd( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - FT_Vector* origin ) + ft_smooth_render_lcd( FT_Renderer render, + FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ) { FT_Error error; @@ -266,10 +266,10 @@ /* convert a slot's glyph image into a vertical LCD bitmap */ static FT_Error - ft_smooth_render_lcd_v( FT_Renderer render, - FT_GlyphSlot slot, - FT_Render_Mode mode, - FT_Vector* origin ) + ft_smooth_render_lcd_v( FT_Renderer render, + FT_GlyphSlot slot, + FT_Render_Mode mode, + const FT_Vector* origin ) { FT_Error error; diff --git a/src/libs/freetype2/tools/cordic.py b/src/libs/freetype2/tools/cordic.py index bb1a238e01..1906b6b1f8 100755 --- a/src/libs/freetype2/tools/cordic.py +++ b/src/libs/freetype2/tools/cordic.py @@ -1,7 +1,8 @@ # compute arctangent table for CORDIC computations in fttrigon.c import sys, math -units = 64*65536.0 # don't change !! +#units = 64*65536.0 # don't change !! +units = 256 scale = units/math.pi shrink = 1.0 comma = "" @@ -23,7 +24,7 @@ def print_val( n, x ): errlo = abs( alo - ax ) errhi = abs( ahi - ax ) - + if ( errlo < errhi ): hi = lo @@ -44,8 +45,8 @@ for n in r: x = 1.0/(2.0**n) # tangent value else: x = 2.0**(-n) - - angle = math.atan(x) # arctangent + + angle = math.atan(x) # arctangent angle2 = angle*scale # arctangent in FT_Angle units # determine which integer value for angle gives the best tangent @@ -63,12 +64,12 @@ for n in r: if angle2 <= 0: break - + sys.stdout.write( comma + repr( int(angle2) ) ) comma = ", " - + shrink = shrink * math.cos( angle2/scale) - + print print "shrink factor = " + repr( shrink ) diff --git a/src/libs/freetype2/tools/docmaker/sources.py b/src/libs/freetype2/tools/docmaker/sources.py index 4923005624..1928ae1fed 100644 --- a/src/libs/freetype2/tools/docmaker/sources.py +++ b/src/libs/freetype2/tools/docmaker/sources.py @@ -93,7 +93,7 @@ start = r''' column = r''' \s* # any number of whitespace - \*{1} # followed by precisely one asterisk + \*{1}(?!/) # followed by precisely one asterisk not followed by `/' (.*) # then anything (group1) ''' diff --git a/src/libs/freetype2/tools/glnames.py b/src/libs/freetype2/tools/glnames.py index e8e80ec6cf..6131098e12 100755 --- a/src/libs/freetype2/tools/glnames.py +++ b/src/libs/freetype2/tools/glnames.py @@ -6,7 +6,7 @@ # -# Copyright 1996-2000, 2003 by +# Copyright 1996-2000, 2003, 2005 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -20,20 +20,23 @@ usage: %s <output-file> - This very simple python script is used to generate the glyph names - tables defined in the PSNames module. + This python script generates the glyph names tables defined in the + PSNames module. Its single argument is the name of the header file to be created. """ -import sys, string +import sys, string, struct, re, os.path -# This table is used to name the glyphs according to the Macintosh -# specification. It is used by the TrueType Postscript names table. +# This table lists the glyphs according to the Macintosh specification. +# It is used by the TrueType Postscript names table. +# +# See +# +# http://fonts.apple.com/TTRefMan/RM06/Chap6post.html # -# See http://fonts.apple.com/TTRefMan/RM06/Chap6post.html # for the official list. # mac_standard_names = \ @@ -145,9 +148,10 @@ mac_standard_names = \ ] -# The list of standard "SID" glyph names. For the official list, +# The list of standard `SID' glyph names. For the official list, # see Annex A of document at -# http://partners.adobe.com/asn/developer/pdfs/tn/5176.CFF.pdf. +# +# http://partners.adobe.com/asn/developer/pdfs/tn/5176.CFF.pdf. # sid_standard_names = \ [ @@ -412,6 +416,7 @@ t1_expert_encoding = \ # version 2.0, 22 Sept 2002. It is available from # # http://partners.adobe.com/asn/developer/typeforum/unicodegn.html +# http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt # adobe_glyph_list = """\ A;0041 @@ -4698,23 +4703,250 @@ zukatakana;30BA """ -t1_bias = 0 -glyph_list = [] +# string table management +# +class StringTable: + def __init__( self, name_list, master_table_name ): + self.names = name_list + self.master_table = master_table_name + self.indices = {} + index = 0 + + for name in name_list: + self.indices[name] = index + index += len( name ) + 1 + + self.total = index + + def dump( self, file ): + write = file.write + write( " static const char " + self.master_table + + "[" + repr( self.total ) + "] =\n" ) + write( " {\n" ) + + line = "" + for name in self.names: + line += " '" + line += string.join( ( re.findall( ".", name ) ), "','" ) + line += "', 0,\n" + + write( line + " };\n\n\n" ) + + def dump_sublist( self, file, table_name, macro_name, sublist ): + write = file.write + write( "#define " + macro_name + " " + repr( len( sublist ) ) + "\n\n" ) + + write( " /* Values are offsets into the `" + + self.master_table + "' table */\n\n" ) + write( " static const short " + table_name + + "[" + macro_name + "] =\n" ) + write( " {\n" ) + + line = " " + comma = "" + col = 0 + + for name in sublist: + line += comma + line += "%4d" % self.indices[name] + col += 1 + comma = "," + if col == 14: + col = 0 + comma = ",\n " + + write( line + "\n };\n\n\n" ) -def adobe_glyph_names(): - """return the list of glyph names from the adobe list""" +# We now store the Adobe Glyph List in compressed form. The list is put +# into a data structure called `trie' (because it has a tree-like +# appearance). Consider, for example, that you want to store the +# following name mapping: +# +# A => 1 +# Aacute => 6 +# Abalon => 2 +# Abstract => 4 +# +# It is possible to store the entries as follows. +# +# A => 1 +# | +# +-acute => 6 +# | +# +-b +# | +# +-alon => 2 +# | +# +-stract => 4 +# +# We see that each node in the trie has: +# +# - one or more `letters' +# - an optional value +# - zero or more child nodes +# +# The first step is to call +# +# root = StringNode( "", 0 ) +# for word in map.values(): +# root.add( word, map[word] ) +# +# which creates a large trie where each node has only one children. +# +# Executing +# +# root = root.optimize() +# +# optimizes the trie by merging the letters of successive nodes whenever +# possible. +# +# Each node of the trie is stored as follows. +# +# - First the node's letter, according to the following scheme. We +# use the fact that in the AGL no name contains character codes > 127. +# +# name bitsize description +# ---------------------------------------------------------------- +# notlast 1 Set to 1 if this is not the last letter +# in the word. +# ascii 7 The letter's ASCII value. +# +# - The letter is followed by a children count and the value of the +# current key (if any). Again we can do some optimization because all +# AGL entries are from the BMP; this means that 16 bits are sufficient +# to store its Unicode values. Additionally, no node has more than +# 127 children. +# +# name bitsize description +# ----------------------------------------- +# hasvalue 1 Set to 1 if a 16-bit Unicode value follows. +# num_children 7 Number of childrens. Can be 0 only if +# `hasvalue' is set to 1. +# value 16 Optional Unicode value. +# +# - A node is finished by a list of 16bit absolute offsets to the +# children, which must be sorted in increasing order of their first +# letter. +# +# For simplicity, all 16bit quantities are stored in big-endian order. +# +# The root node has first letter = 0, and no value. +# +class StringNode: + def __init__( self, letter, value ): + self.letter = letter + self.value = value + self.children = {} - lines = string.split( adobe_glyph_list, '\n' ) - glyphs = [] + def __cmp__( self, other ): + return ord( self.letter[0] ) - ord( other.letter[0] ) - for line in lines: - if line: - fields = string.split( line, ';' ) -# print fields[1] + ' - ' + fields[0] - glyphs.append( fields[0] ) + def add( self, word, value ): + if len( word ) == 0: + self.value = value + return - return glyphs + letter = word[0] + word = word[1:] + + if self.children.has_key( letter ): + child = self.children[letter] + else: + child = StringNode( letter, 0 ) + self.children[letter] = child + + child.add( word, value ) + + def optimize( self ): + # optimize all children first + children = self.children.values() + self.children = {} + + for child in children: + self.children[child.letter[0]] = child.optimize() + + # don't optimize if there's a value, + # if we don't have any child or if we + # have more than one child + if ( self.value != 0 ) or ( not children ) or len( children ) > 1: + return self + + child = children[0] + + self.letter += child.letter + self.value = child.value + self.children = child.children + + return self + + def dump_debug( self, write, margin ): + # this is used during debugging + line = margin + "+-" + if len( self.letter ) == 0: + line += "<NOLETTER>" + else: + line += self.letter + + if self.value: + line += " => " + repr( self.value ) + + write( line + "\n" ) + + if self.children: + margin += "| " + for child in self.children.values(): + child.dump_debug( write, margin ) + + def locate( self, index ): + self.index = index + if len( self.letter ) > 0: + index += len( self.letter ) + 1 + else: + index += 2 + + if self.value != 0: + index += 2 + + children = self.children.values() + children.sort() + + index += 2 * len( children ) + for child in children: + index = child.locate( index ) + + return index + + def store( self, storage ): + # write the letters + l = len( self.letter ) + if l == 0: + storage += struct.pack( "B", 0 ) + else: + for n in range( l ): + val = ord( self.letter[n] ) + if n < l - 1: + val += 128 + storage += struct.pack( "B", val ) + + # write the count + children = self.children.values() + children.sort() + + count = len( children ) + + if self.value != 0: + storage += struct.pack( "!BH", count + 128, self.value ) + else: + storage += struct.pack( "B", count ) + + for child in children: + storage += struct.pack( "!H", child.index ) + + for child in children: + storage = child.store( storage ) + + return storage def adobe_glyph_values(): @@ -4737,7 +4969,7 @@ def adobe_glyph_values(): def filter_glyph_names( alist, filter ): - """filter 'alist' by taking _out_ all glyph names that are in 'filter'""" + """filter `alist' by taking _out_ all glyph names that are in `filter'""" count = 0 extras = [] @@ -4751,107 +4983,56 @@ def filter_glyph_names( alist, filter ): return extras -def dump_mac_indices( file, all_glyphs ): - write = file.write - - write( " static const unsigned short mac_standard_names[" + \ - repr( len( mac_standard_names ) + 1 ) + "] =\n" ) - write( " {\n" ) - - for name in mac_standard_names: - write( " " + repr( all_glyphs.index( name ) ) + ",\n" ) - - write( " 0\n" ) - write( " };\n" ) - write( "\n" ) - write( "\n" ) - - -def dump_glyph_list( file, base_list, adobe_list ): - write = file.write - - name_list = [] - - write( " static const char* const ps_glyph_names[] =\n" ) - write( " {\n" ) - - for name in base_list: - write( ' "' + name + '",\n' ) - name_list.append( name ) - - write( "\n" ) - write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" ) - write( "\n" ) - - for name in adobe_list: - write( ' "' + name + '",\n' ) - name_list.append( name ) - - write( "\n" ) - write( "#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n" ) - write( "\n" ) - write( " NULL\n" ) - write( " };\n" ) - write( "\n" ) - write( "\n" ) - - return name_list - - -def dump_unicode_values( file, sid_list, adobe_list ): - """build the glyph names to unicode values table""" - - write = file.write - - agl_names, agl_unicodes = adobe_glyph_values() - - write( "\n" ) - write( " static const unsigned short ps_names_to_unicode[" + \ - repr( len( sid_list ) + len( adobe_list ) + 1 ) + "] =\n" ) - write( " {\n" ) - - for name in sid_list: - try: - index = agl_names.index( name ) - write( " 0x" + agl_unicodes[index] + "U,\n" ) - except: - write( " 0,\n" ) - - write( "\n" ) - write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" ) - write( "\n" ) - - for name in adobe_list: - try: - index = agl_names.index( name ) - write( " 0x" + agl_unicodes[index] + "U,\n" ) - except: - write( " 0,\n" ) - - write( "\n" ) - write( "#endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */\n" ) - write( " 0\n" ) - write( " };\n" ) - write( "\n" ) - write( "\n" ) - write( "\n" ) - - def dump_encoding( file, encoding_name, encoding_list ): + """dump a given encoding""" + + write = file.write + write( " /* the following are indices into the SID name table */\n" ) + write( " static const unsigned short " + encoding_name + + "[" + repr( len( encoding_list ) ) + "] =\n" ) + write( " {\n" ) + + line = " " + comma = "" + col = 0 + for value in encoding_list: + line += comma + line += "%3d" % value + comma = "," + col += 1 + if col == 16: + col = 0 + comma = ",\n " + + write( line + "\n };\n\n\n" ) + + +def dump_array( the_array, write, array_name ): """dumps a given encoding""" - write = file.write - - write( " static const unsigned short " + encoding_name + "[" + \ - repr( len( encoding_list ) + 1 ) + "] =\n" ) + write( " static const unsigned char " + array_name + + "[" + repr( len( the_array ) ) + "] =\n" ) write( " {\n" ) - for value in encoding_list: - write( " " + repr( value ) + ",\n" ) - write( " 0\n" ) - write( " };\n" ) - write( "\n" ) - write( "\n" ) + line = "" + comma = " " + col = 0 + + for value in the_array: + line += comma + line += "%3d" % ord( value ) + comma = "," + col += 1 + + if col == 16: + col = 0 + comma = ",\n " + + if len( line ) > 1024: + write( line ) + line = "" + + write( line + "\n };\n\n\n" ) def main(): @@ -4866,37 +5047,27 @@ def main(): count_sid = len( sid_standard_names ) - # 'mac_extras' contains the list of glyph names in the Macintosh standard - # encoding which are not in either the Adobe Glyph List or the SID - # Standard Names. + # `mac_extras' contains the list of glyph names in the Macintosh standard + # encoding which are not in the SID Standard Names. # - mac_extras = filter_glyph_names( mac_standard_names, adobe_glyph_names() ) - mac_extras = filter_glyph_names( mac_extras, sid_standard_names ) + mac_extras = filter_glyph_names( mac_standard_names, sid_standard_names ) - # 'base_list' contains the first names of our final glyph names table. - # It consists of the 'mac_extras' glyph names, followed by the SID - # Standard names. + # `base_list' contains the names of our final glyph names table. + # It consists of the `mac_extras' glyph names, followed by the SID + # standard names. # mac_extras_count = len( mac_extras ) - t1_bias = mac_extras_count base_list = mac_extras + sid_standard_names - # 'adobe_list' contains the glyph names that are in the AGL, but not in - # the base_list; they will be placed after base_list glyph names in - # our final table. - # - adobe_list = filter_glyph_names( adobe_glyph_names(), base_list ) - adobe_count = len( adobe_list ) - write( "/***************************************************************************/\n" ) write( "/* */\n" ) - write( "/* %-71s*/\n" % sys.argv[1] ) + write( "/* %-71s*/\n" % os.path.basename( sys.argv[1] ) ) write( "/* */\n" ) - write( "/* PostScript glyph names (specification only). */\n" ) + write( "/* PostScript glyph names. */\n" ) write( "/* */\n" ) - write( "/* Copyright 2000-2001, 2003 by */\n" ) + write( "/* Copyright 2005 by */\n" ) write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" ) write( "/* */\n" ) write( "/* This file is part of the FreeType project, and may only be used, */\n" ) @@ -4908,42 +5079,199 @@ def main(): write( "/***************************************************************************/\n" ) write( "\n" ) write( "\n" ) - write( " /* this file has been generated automatically -- do not edit! */\n" ) + write( " /* This file has been generated automatically -- do not edit! */\n" ) write( "\n" ) write( "\n" ) - # dump final glyph list (mac extras + sid standard names + AGL glyph names) + # dump final glyph list (mac extras + sid standard names) # - name_list = dump_glyph_list( file, base_list, adobe_list ) + st = StringTable( base_list, "ft_standard_glyph_names" ) - # dump t1_standard_list - write( " static const char* const * const sid_standard_names = " \ - + "ps_glyph_names + " + repr( t1_bias ) + ";\n" ) - write( "\n" ) - write( "\n" ) - - write( "#define NUM_SID_GLYPHS " + repr( len( sid_standard_names ) ) + "\n" ) - write( "\n" ) - write( "#ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST\n" ) - write( "#define NUM_ADOBE_GLYPHS " + \ - repr( len( base_list ) + len( adobe_list ) - t1_bias ) + "\n" ) - write( "#else\n" ) - write( "#define NUM_ADOBE_GLYPHS " + \ - repr( len( base_list ) - t1_bias ) + "\n" ) - write( "#endif\n" ) - write( "\n" ) - write( "\n" ) - - # dump mac indices table - dump_mac_indices( file, name_list ) - - # dump unicode values table - dump_unicode_values( file, sid_standard_names, adobe_list ) + st.dump( file ) + st.dump_sublist( file, "ft_mac_names", + "FT_NUM_MAC_NAMES", mac_standard_names ) + st.dump_sublist( file, "ft_sid_names", + "FT_NUM_SID_NAMES", sid_standard_names ) dump_encoding( file, "t1_standard_encoding", t1_standard_encoding ) dump_encoding( file, "t1_expert_encoding", t1_expert_encoding ) - write( "/* END */\n" ) + # dump the AGL in its compressed form + # + agl_glyphs, agl_values = adobe_glyph_values() + dict = StringNode( "", 0 ) + + for g in range( len( agl_glyphs ) ): + dict.add( agl_glyphs[g], eval( "0x" + agl_values[g] ) ) + + dict = dict.optimize() + dict_len = dict.locate( 0 ) + dict_array = dict.store( "" ) + + write( """\ + /* + * This table is a compressed version of the Adobe Glyph List (AGL), + * optimized for efficient searching. It has been generated by the + * `glnames.py' python script located in the `src/tools' directory. + * + * The lookup function to get the Unicode value for a given string + * is defined below the table. + */ +""" ) + + dump_array( dict_array, write, "ft_adobe_glyph_list" ) + + # write the lookup routine now + # + write( """\ + /* + * This function searches the compressed table efficiently. + */ + static unsigned long + ft_get_adobe_glyph_index( const char* name, + const char* limit ) + { + int c = 0; + int count, min, max; + const unsigned char* p = ft_adobe_glyph_list; + + + if ( name == 0 || name >= limit ) + goto NotFound; + + c = *name++; + count = p[1]; + p += 2; + + min = 0; + max = count; + + while ( min < max ) + { + int mid = ( min + max ) >> 1; + const unsigned char* q = p + mid * 2; + int c2; + + + q = ft_adobe_glyph_list + ( ( (int)q[0] << 8 ) | q[1] ); + + c2 = q[0] & 127; + if ( c2 == c ) + { + p = q; + goto Found; + } + if ( c2 < c ) + min = mid + 1; + else + max = mid; + } + goto NotFound; + + Found: + for (;;) + { + /* assert (*p & 127) == c */ + + if ( name >= limit ) + { + if ( (p[0] & 128) == 0 && + (p[1] & 128) != 0 ) + return (unsigned long)( ( (int)p[2] << 8 ) | p[3] ); + + goto NotFound; + } + c = *name++; + if ( p[0] & 128 ) + { + p++; + if ( c != (p[0] & 127) ) + goto NotFound; + + continue; + } + + p++; + count = p[0] & 127; + if ( p[0] & 128 ) + p += 2; + + p++; + + for ( ; count > 0; count--, p += 2 ) + { + int offset = ( (int)p[0] << 8 ) | p[1]; + const unsigned char* q = ft_adobe_glyph_list + offset; + + if ( c == ( q[0] & 127 ) ) + { + p = q; + goto NextIter; + } + } + goto NotFound; + + NextIter: + ; + } + + NotFound: + return 0; + } + +""" ) + + if 0: # generate unit test, or don't + # + # now write the unit test to check that everything works OK + # + write( "#ifdef TEST\n\n" ) + + write( "static const char* const the_names[] = {\n" ) + for name in agl_glyphs: + write( ' "' + name + '",\n' ) + write( " 0\n};\n" ) + + write( "static const unsigned long the_values[] = {\n" ) + for val in agl_values: + write( ' 0x' + val + ',\n' ) + write( " 0\n};\n" ) + + write( """ +#include <stdlib.h> +#include <stdio.h> + + int + main( void ) + { + int result = 0; + const char* const* names = the_names; + const unsigned long* values = the_values; + + + for ( ; *names; names++, values++ ) + { + const char* name = *names; + unsigned long reference = *values; + unsigned long value; + + + value = ft_get_adobe_glyph_index( name, name + strlen( name ) ); + if ( value != reference ) + { + result = 1; + fprintf( stderr, "name '%s' => %04x instead of %04x\\n", + name, value, reference ); + } + } + + return result; + } +""" ) + + write( "#endif /* TEST */\n" ) + + write("\n/* END */\n") # Now run the main routine diff --git a/src/libs/freetype2/truetype/Jamfile b/src/libs/freetype2/truetype/Jamfile index 31acb47784..3bd324f851 100644 --- a/src/libs/freetype2/truetype/Jamfile +++ b/src/libs/freetype2/truetype/Jamfile @@ -10,7 +10,7 @@ UseFreeTypeHeaders ; if $(FT2_MULTI) { - _sources = ttdriver ttobjs ttpload ttgload ttinterp ; + _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ; } else { diff --git a/src/libs/freetype2/truetype/rules.mk b/src/libs/freetype2/truetype/rules.mk index bbb0c9f8ec..74684260ed 100644 --- a/src/libs/freetype2/truetype/rules.mk +++ b/src/libs/freetype2/truetype/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003 by +# Copyright 1996-2000, 2001, 2003, 2004 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -29,6 +29,7 @@ TT_DRV_SRC := $(TT_DIR)/ttobjs.c \ $(TT_DIR)/ttpload.c \ $(TT_DIR)/ttgload.c \ $(TT_DIR)/ttinterp.c \ + $(TT_DIR)/ttgxvar.c \ $(TT_DIR)/ttdriver.c # TrueType driver headers diff --git a/src/libs/freetype2/truetype/truetype.c b/src/libs/freetype2/truetype/truetype.c index 1ed3cebc99..4abb01ec5c 100644 --- a/src/libs/freetype2/truetype/truetype.c +++ b/src/libs/freetype2/truetype/truetype.c @@ -4,7 +4,7 @@ /* */ /* FreeType TrueType driver component (body only). */ /* */ -/* Copyright 1996-2001 by */ +/* Copyright 1996-2001, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,14 +19,18 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> -#include "ttdriver.c" /* driver interface */ -#include "ttpload.c" /* tables loader */ -#include "ttgload.c" /* glyph loader */ -#include "ttobjs.c" /* object manager */ +#include "ttdriver.c" /* driver interface */ +#include "ttpload.c" /* tables loader */ +#include "ttgload.c" /* glyph loader */ +#include "ttobjs.c" /* object manager */ #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #include "ttinterp.c" #endif +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include "ttgxvar.c" /* gx distortable font */ +#endif + /* END */ diff --git a/src/libs/freetype2/truetype/ttdriver.c b/src/libs/freetype2/truetype/ttdriver.c index a5b800d538..c981dfdec9 100644 --- a/src/libs/freetype2/truetype/ttdriver.c +++ b/src/libs/freetype2/truetype/ttdriver.c @@ -4,7 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,9 +23,18 @@ #include FT_TRUETYPE_IDS_H #include FT_SERVICE_XFREE86_NAME_H +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include FT_MULTIPLE_MASTERS_H +#include FT_SERVICE_MULTIPLE_MASTERS_H +#endif + #include "ttdriver.h" #include "ttgload.h" +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include "ttgxvar.h" +#endif + #include "tterrors.h" @@ -60,7 +69,7 @@ /*************************************************************************/ /* */ /* <Function> */ - /* Get_Kerning */ + /* tt_get_kerning */ /* */ /* <Description> */ /* A driver method used to return the kerning vector between two */ @@ -90,55 +99,22 @@ /* They can be implemented by format-specific interfaces. */ /* */ static FT_Error - Get_Kerning( TT_Face face, - FT_UInt left_glyph, - FT_UInt right_glyph, - FT_Vector* kerning ) + tt_get_kerning( FT_Face ttface, /* TT_Face */ + FT_UInt left_glyph, + FT_UInt right_glyph, + FT_Vector* kerning ) { - TT_Kern0_Pair pair; + TT_Face face = (TT_Face)ttface; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; - if ( !face ) - return TT_Err_Invalid_Face_Handle; - kerning->x = 0; kerning->y = 0; - if ( face->kern_pairs ) - { - /* there are some kerning pairs in this font file! */ - FT_ULong search_tag = PAIR_TAG( left_glyph, right_glyph ); - FT_Long left, right; - - - left = 0; - right = face->num_kern_pairs - 1; - - while ( left <= right ) - { - FT_Long middle = left + ( ( right - left ) >> 1 ); - FT_ULong cur_pair; - - - pair = face->kern_pairs + middle; - cur_pair = PAIR_TAG( pair->left, pair->right ); - - if ( cur_pair == search_tag ) - goto Found; - - if ( cur_pair < search_tag ) - left = middle + 1; - else - right = middle - 1; - } - } - - Exit: - return TT_Err_Ok; - - Found: - kerning->x = pair->value; - goto Exit; + if ( sfnt ) + kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); + + return 0; } @@ -185,12 +161,13 @@ /* FreeType error code. 0 means success. */ /* */ static FT_Error - Set_Char_Sizes( TT_Size size, + Set_Char_Sizes( FT_Size ttsize, /* TT_Size */ FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution ) { + TT_Size size = (TT_Size)ttsize; FT_Size_Metrics* metrics = &size->root.metrics; FT_Size_Metrics* metrics2 = &size->metrics; TT_Face face = (TT_Face)size->root.face; @@ -250,8 +227,16 @@ /* FreeType error code. 0 means success. */ /* */ static FT_Error - Set_Pixel_Sizes( TT_Size size ) + Set_Pixel_Sizes( FT_Size ttsize, /* TT_Size */ + FT_UInt pixel_width, + FT_UInt pixel_height ) { + TT_Size size = (TT_Size)ttsize; + + FT_UNUSED( pixel_width ); + FT_UNUSED( pixel_height ); + + /* many things have been pre-computed by the base layer */ size->metrics = size->root.metrics; @@ -291,12 +276,14 @@ /* FreeType error code. 0 means success. */ /* */ static FT_Error - Load_Glyph( TT_GlyphSlot slot, - TT_Size size, + Load_Glyph( FT_GlyphSlot ttslot, /* TT_GlyphSlot */ + FT_Size ttsize, /* TT_Size */ FT_UInt glyph_index, FT_Int32 load_flags ) { - FT_Error error; + TT_GlyphSlot slot = (TT_GlyphSlot)ttslot; + TT_Size size = (TT_Size)ttsize; + FT_Error error; if ( !slot ) @@ -345,14 +332,30 @@ /*************************************************************************/ /*************************************************************************/ +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + static const FT_Service_MultiMastersRec tt_service_gx_multi_masters = + { + (FT_Get_MM_Func) NULL, + (FT_Set_MM_Design_Func) NULL, + (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, + (FT_Get_MM_Var_Func) TT_Get_MM_Var, + (FT_Set_Var_Design_Func)TT_Set_Var_Design + }; +#endif + + static const FT_ServiceDescRec tt_services[] = { - { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE }, + { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE }, +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + { FT_SERVICE_ID_MULTI_MASTERS, &tt_service_gx_multi_masters }, +#endif { NULL, NULL } }; - static FT_Module_Interface - tt_get_interface( TT_Driver driver, + + FT_CALLBACK_DEF( FT_Module_Interface ) + tt_get_interface( FT_Module driver, /* TT_Driver */ const char* tt_interface ) { FT_Module_Interface result; @@ -365,12 +368,12 @@ return result; /* only return the default interface from the SFNT module */ - sfntd = FT_Get_Module( driver->root.root.library, "sfnt" ); + sfntd = FT_Get_Module( driver->library, "sfnt" ); if ( sfntd ) { sfnt = (SFNT_Service)( sfntd->clazz->module_interface ); if ( sfnt ) - return sfnt->get_interface( FT_MODULE( driver ), tt_interface ); + return sfnt->get_interface( driver, tt_interface ); } return 0; @@ -399,30 +402,29 @@ (void*)0, /* driver specific interface */ - (FT_Module_Constructor)tt_driver_init, - (FT_Module_Destructor) tt_driver_done, - (FT_Module_Requester) tt_get_interface, + tt_driver_init, + tt_driver_done, + tt_get_interface, }, sizeof ( TT_FaceRec ), sizeof ( TT_SizeRec ), sizeof ( FT_GlyphSlotRec ), + tt_face_init, + tt_face_done, + tt_size_init, + tt_size_done, + 0, /* FT_Slot_InitFunc */ + 0, /* FT_Slot_DoneFunc */ - (FT_Face_InitFunc) tt_face_init, - (FT_Face_DoneFunc) tt_face_done, - (FT_Size_InitFunc) tt_size_init, - (FT_Size_DoneFunc) tt_size_done, - (FT_Slot_InitFunc) 0, - (FT_Slot_DoneFunc) 0, + Set_Char_Sizes, + Set_Pixel_Sizes, + Load_Glyph, - (FT_Size_ResetPointsFunc)Set_Char_Sizes, - (FT_Size_ResetPixelsFunc)Set_Pixel_Sizes, - (FT_Slot_LoadFunc) Load_Glyph, - - (FT_Face_GetKerningFunc) Get_Kerning, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc)0 + tt_get_kerning, + 0, /* FT_Face_AttachFunc */ + 0 /* FT_Face_GetAdvancesFunc */ }; diff --git a/src/libs/freetype2/truetype/ttgload.c b/src/libs/freetype2/truetype/ttgload.c index 00da0c2240..d1ad181b87 100644 --- a/src/libs/freetype2/truetype/ttgload.c +++ b/src/libs/freetype2/truetype/ttgload.c @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,6 +25,11 @@ #include FT_OUTLINE_H #include "ttgload.h" +#include "ttpload.h" + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include "ttgxvar.h" +#endif #include "tterrors.h" @@ -70,7 +75,7 @@ /*************************************************************************/ /* */ /* <Function> */ - /* TT_Get_Metrics */ + /* tt_face_get_metrics */ /* */ /* <Description> */ /* Returns the horizontal or vertical metrics in font units for a */ @@ -92,35 +97,105 @@ /* This function will much probably move to another component in the */ /* near future, but I haven't decided which yet. */ /* */ - FT_LOCAL_DEF( void ) - TT_Get_Metrics( TT_HoriHeader* header, - FT_UInt idx, - FT_Short* bearing, - FT_UShort* advance ) +#ifdef FT_OPTIMIZE_MEMORY + + static void + tt_face_get_metrics( TT_Face face, + FT_Bool vertical, + FT_UInt idx, + FT_Short *abearing, + FT_UShort *aadvance ) { + TT_HoriHeader* header; + FT_Byte* p; + FT_Byte* limit; + FT_UShort k; + + + if ( vertical ) + { + header = (TT_HoriHeader*)&face->vertical; + p = face->vert_metrics; + limit = p + face->vert_metrics_size; + } + else + { + header = &face->horizontal; + p = face->horz_metrics; + limit = p + face->horz_metrics_size; + } + + k = header->number_Of_HMetrics; + + if ( k > 0 ) + { + if ( idx < (FT_UInt)k ) + { + p += 4 * idx; + if ( p + 4 > limit ) + goto NoData; + + *aadvance = FT_NEXT_USHORT( p ); + *abearing = FT_NEXT_SHORT( p ); + } + else + { + p += 4 * ( k - 1 ); + if ( p + 4 > limit ) + goto NoData; + + *aadvance = FT_NEXT_USHORT( p ); + p += 2 + 2 * ( idx - k ); + if ( p + 2 > limit ) + *abearing = 0; + else + *abearing = FT_PEEK_SHORT( p ); + } + } + else + { + NoData: + *abearing = 0; + *aadvance = 0; + } + } + +#else /* !FT_OPTIMIZE_MEMORY */ + + static void + tt_face_get_metrics( TT_Face face, + FT_Bool vertical, + FT_UInt idx, + FT_Short *abearing, + FT_UShort *aadvance ) + { + TT_HoriHeader* header = vertical ? (TT_HoriHeader*)&face->vertical + : &face->horizontal; TT_LongMetrics longs_m; - FT_UShort k = header->number_Of_HMetrics; + FT_UShort k = header->number_Of_HMetrics; if ( k == 0 ) { - *bearing = *advance = 0; + *abearing = *aadvance = 0; return; } if ( idx < (FT_UInt)k ) { - longs_m = (TT_LongMetrics )header->long_metrics + idx; - *bearing = longs_m->bearing; - *advance = longs_m->advance; + longs_m = (TT_LongMetrics)header->long_metrics + idx; + *abearing = longs_m->bearing; + *aadvance = longs_m->advance; } else { - *bearing = ((TT_ShortMetrics*)header->short_metrics)[idx - k]; - *advance = ((TT_LongMetrics )header->long_metrics)[k - 1].advance; + *abearing = ((TT_ShortMetrics*)header->short_metrics)[idx - k]; + *aadvance = ((TT_LongMetrics)header->long_metrics)[k - 1].advance; } } +#endif /* !FT_OPTIMIZE_MEMORY */ + /*************************************************************************/ /* */ @@ -135,7 +210,7 @@ FT_Short* lsb, FT_UShort* aw ) { - TT_Get_Metrics( &face->horizontal, idx, lsb, aw ); + tt_face_get_metrics( face, 0, idx, lsb, aw ); if ( check && face->postscript.isFixedPitch ) *aw = face->horizontal.advance_Width_Max; @@ -148,17 +223,41 @@ /* in the font's `hdmx' table (if any). */ /* */ static FT_Byte* - Get_Advance_Widths( TT_Face face, - FT_UShort ppem ) + Get_Advance_WidthPtr( TT_Face face, + FT_Int ppem, + FT_UInt gindex ) { +#ifdef FT_OPTIMIZE_MEMORY + + FT_UInt nn; + FT_Byte* result = NULL; + FT_ULong record_size = face->hdmx_record_size; + FT_Byte* record = face->hdmx_table + 8; + + + for ( nn = 0; nn < face->hdmx_record_count; nn++ ) + if ( face->hdmx_record_sizes[nn] == ppem ) + { + gindex += 2; + if ( gindex < record_size ) + result = record + gindex; + break; + } + + return result; + +#else + FT_UShort n; for ( n = 0; n < face->hdmx.num_records; n++ ) if ( face->hdmx.records[n].ppem == ppem ) - return face->hdmx.records[n].widths; + return &face->hdmx.records[n].widths[gindex]; return NULL; + +#endif } @@ -185,7 +284,7 @@ FT_UNUSED( check ); if ( face->vertical_info ) - TT_Get_Metrics( (TT_HoriHeader *)&face->vertical, idx, tsb, ah ); + tt_face_get_metrics( face, 1, idx, tsb, ah ); #if 1 /* Emperically determined, at variance with what MS said */ @@ -202,7 +301,7 @@ *tsb = face->os2.sTypoAscender; *ah = face->os2.sTypoAscender - face->os2.sTypoDescender; } - else + else { *tsb = face->horizontal.Ascender; *ah = face->horizontal.Ascender - face->horizontal.Descender; @@ -352,7 +451,7 @@ FT_Short *cont, *cont_limit; - /* reading the contours endpoints & number of points */ + /* reading the contours' endpoints & number of points */ cont = gloader->current.outline.contours; cont_limit = cont + n_contours; @@ -422,6 +521,8 @@ flag = (FT_Byte*)outline->tags; flag_limit = flag + n_points; + FT_ASSERT( flag != NULL ); + while ( flag < flag_limit ) { if ( --byte_len < 0 ) @@ -724,11 +825,48 @@ outline->tags[n_points + 3] = 0; } - /* Note that we return two more points that are not */ - /* part of the glyph outline. */ + /* Note that we return four more points that are not */ + /* part of the glyph outline. */ n_points += 4; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + + if ( ((TT_Face)load->face)->doblend ) + { + /* Deltas apply to the unscaled data. */ + FT_Vector* deltas; + FT_Memory memory = load->face->memory; + FT_StreamRec saved_stream = *(load->stream); + FT_UInt i; + + + /* TT_Vary_Get_Glyph_Deltas uses a frame, thus we have to save */ + /* (and restore) the current one */ + load->stream->cursor = 0; + load->stream->limit = 0; + + error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(load->face), + load->glyph_index, + &deltas, + n_points ); + + *(load->stream) = saved_stream; + + if ( error ) + goto Exit; + + for ( i = 0; i < n_points; ++i ) + { + outline->points[i].x += deltas[i].x; + outline->points[i].y += deltas[i].y; + } + + FT_FREE( deltas ); + } + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + /* set up zone for hinting */ tt_prepare_zone( zone, &gloader->current, 0, 0 ); @@ -737,9 +875,8 @@ { FT_Vector* vec = zone->cur; FT_Vector* limit = vec + n_points; - FT_Fixed x_scale = load->size->metrics.x_scale; - FT_Fixed y_scale = load->size->metrics.y_scale; - + FT_Fixed x_scale = ((TT_Size)load->size)->metrics.x_scale; + FT_Fixed y_scale = ((TT_Size)load->size)->metrics.y_scale; /* first scale the glyph points */ for ( ; vec < limit; vec++ ) @@ -755,12 +892,10 @@ if ( IS_HINTED( load->load_flags ) ) { FT_Pos x = zone->org[n_points-4].x; - FT_Pos y = zone->org[n_points-2].y; x = FT_PIX_ROUND( x ) - x; - y = FT_PIX_ROUND( y ) - y; - translate_array( n_points, zone->org, x, y ); + translate_array( n_points, zone->org, x, 0 ); org_to_cur( n_points, zone ); @@ -778,8 +913,6 @@ goto Exit; load->exec->is_composite = FALSE; - load->exec->pedantic_hinting = (FT_Bool)( load->load_flags & - FT_LOAD_PEDANTIC ); load->exec->pts = *zone; load->exec->pts.n_points += 4; @@ -803,9 +936,11 @@ load->pp4 = zone->cur[n_points - 1]; } -#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER +#if defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER ) || \ + defined( TT_CONFIG_OPTION_GX_VAR_SUPPORT ) Exit: #endif + return error; } @@ -830,7 +965,7 @@ #endif FT_Error error; - TT_Face face = (TT_Face)loader->face; + TT_Face face = (TT_Face)loader->face; FT_ULong offset; FT_Int contours_count; FT_UInt num_points, count; @@ -839,9 +974,13 @@ FT_Bool opened_frame = 0; #ifdef FT_CONFIG_OPTION_INCREMENTAL - struct FT_StreamRec_ inc_stream; - FT_Data glyph_data; - FT_Bool glyph_data_loaded = 0; + FT_StreamRec inc_stream; + FT_Data glyph_data; + FT_Bool glyph_data_loaded = 0; +#endif + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + FT_Vector *deltas; #endif @@ -865,8 +1004,8 @@ y_scale = 0x10000L; if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) { - x_scale = loader->size->metrics.x_scale; - y_scale = loader->size->metrics.y_scale; + x_scale = ((TT_Size)loader->size)->metrics.x_scale; + y_scale = ((TT_Size)loader->size)->metrics.y_scale; } /* get metrics, horizontal and vertical */ @@ -975,13 +1114,7 @@ #endif /* FT_CONFIG_OPTION_INCREMENTAL */ - { - offset = face->glyph_locations[glyph_index]; - count = 0; - - if ( glyph_index < (FT_UInt)face->num_locations - 1 ) - count = (FT_UInt)( face->glyph_locations[glyph_index + 1] - offset ); - } + offset = tt_face_get_location( face, glyph_index, &count ); if ( count == 0 ) { @@ -997,6 +1130,27 @@ loader->pp3.y = 0; loader->pp4.y = loader->pp3.y-loader->vadvance; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( ((TT_Face)(loader->face))->doblend ) + { + /* this must be done before scaling */ + FT_Memory memory = loader->face->memory; + + + error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(loader->face), + glyph_index, &deltas, 4 ); + if ( error ) + goto Exit; + + loader->pp1.x += deltas[0].x; loader->pp1.y += deltas[0].y; + loader->pp2.x += deltas[1].x; loader->pp2.y += deltas[1].y; + loader->pp3.x += deltas[2].x; loader->pp3.y += deltas[2].y; + loader->pp4.x += deltas[3].x; loader->pp4.y += deltas[3].y; + + FT_FREE( deltas ); + } +#endif + if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) { loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); @@ -1044,14 +1198,6 @@ loader->pp4.x = 0; loader->pp4.y = loader->pp3.y - loader->vadvance; - if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) - { - loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale ); - loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); - loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale ); - loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); - } - /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ @@ -1125,6 +1271,56 @@ face->forget_glyph_frame( loader ); opened_frame = 0; +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + + if ( face->doblend ) + { + FT_Int i, limit; + FT_SubGlyph subglyph; + FT_Memory memory = face->root.memory; + + + /* this provides additional offsets */ + /* for each component's translation */ + + if ( (error = TT_Vary_Get_Glyph_Deltas( + face, + glyph_index, + &deltas, + gloader->current.num_subglyphs + 4 )) != 0 ) + goto Exit; + + /* Note: No subglyph reallocation here, our pointers are stable. */ + subglyph = gloader->current.subglyphs + gloader->base.num_subglyphs; + limit = gloader->current.num_subglyphs; + + for ( i = 0; i < limit; ++i, ++subglyph ) + { + if ( subglyph->flags & ARGS_ARE_XY_VALUES ) + { + subglyph->arg1 += deltas[i].x; + subglyph->arg2 += deltas[i].y; + } + } + + loader->pp1.x += deltas[i + 0].x; loader->pp1.y += deltas[i + 0].y; + loader->pp2.x += deltas[i + 1].x; loader->pp2.y += deltas[i + 1].y; + loader->pp3.x += deltas[i + 2].x; loader->pp3.y += deltas[i + 2].y; + loader->pp4.x += deltas[i + 3].x; loader->pp4.y += deltas[i + 3].y; + + FT_FREE( deltas ); + } + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) + { + loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale ); + loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); + loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale ); + loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); + } + /* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */ /* `as is' in the glyph slot (the client application will be */ /* responsible for interpreting these data)... */ @@ -1439,8 +1635,6 @@ if ( IS_HINTED( loader->load_flags ) && n_ins > 0 ) { exec->is_composite = TRUE; - exec->pedantic_hinting = - (FT_Bool)( loader->load_flags & FT_LOAD_PEDANTIC ); error = TT_Run_Context( exec, ((TT_Size)loader->size)->debug ); if ( error && exec->pedantic_hinting ) goto Fail; @@ -1566,13 +1760,13 @@ FT_Pos top; /* scaled vertical top side bearing */ FT_Pos advance; /* scaled vertical advance height */ + /* Get the unscaled top bearing and advance height. */ if ( face->vertical_info && face->vertical.number_Of_VMetrics > 0 ) { - advance_height = loader->pp4.y - loader->pp3.y; - top_bearing = loader->pp3.y - bbox.yMax; - + advance_height = (FT_UShort)( loader->pp4.y - loader->pp3.y ); + top_bearing = (FT_Short)( loader->pp3.y - bbox.yMax ); } else { @@ -1618,7 +1812,7 @@ face->root.internal->incremental_interface->funcs->get_glyph_metrics ) { FT_Incremental_MetricsRec metrics; - FT_Error error = 0; + FT_Error error = TT_Err_Ok; metrics.bearing_x = 0; @@ -1683,12 +1877,13 @@ if ( !face->postscript.isFixedPitch && size && IS_HINTED( loader->load_flags ) ) { - FT_Byte* widths = Get_Advance_Widths( face, - size->root.metrics.x_ppem ); + FT_Byte* widthp = Get_Advance_WidthPtr( face, + size->root.metrics.x_ppem, + glyph_index ); - if ( widths ) - glyph->metrics.horiAdvance = widths[glyph_index] << 6; + if ( widthp ) + glyph->metrics.horiAdvance = *widthp << 6; } /* set glyph dimensions */ @@ -1742,7 +1937,7 @@ face = (TT_Face)glyph->face; sfnt = (SFNT_Service)face->sfnt; stream = face->root.stream; - error = 0; + error = TT_Err_Ok; if ( !size || ( load_flags & FT_LOAD_NO_SCALE ) || ( load_flags & FT_LOAD_NO_RECURSE ) ) @@ -1838,7 +2033,7 @@ /* update the glyph zone bounds */ { - FT_GlyphLoader gloader = FT_FACE_DRIVER(face)->glyph_loader; + FT_GlyphLoader gloader = FT_FACE_DRIVER( face )->glyph_loader; loader.gloader = gloader; @@ -1864,6 +2059,12 @@ /* load default graphics state - if needed */ if ( size->GS.instruct_control & 2 ) loader.exec->GS = tt_default_graphics_state; + + loader.exec->pedantic_hinting = + FT_BOOL( load_flags & FT_LOAD_PEDANTIC ); + + loader.exec->grayscale = + FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != FT_LOAD_TARGET_MONO ); } #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ diff --git a/src/libs/freetype2/truetype/ttgload.h b/src/libs/freetype2/truetype/ttgload.h index dfa2a60a5c..665c224878 100644 --- a/src/libs/freetype2/truetype/ttgload.h +++ b/src/libs/freetype2/truetype/ttgload.h @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,12 +31,6 @@ FT_BEGIN_HEADER - FT_LOCAL( void ) - TT_Get_Metrics( TT_HoriHeader* header, - FT_UInt idx, - FT_Short* bearing, - FT_UShort* advance ); - FT_LOCAL( void ) TT_Init_Glyph_Loading( TT_Face face ); diff --git a/src/libs/freetype2/truetype/ttgxvar.c b/src/libs/freetype2/truetype/ttgxvar.c new file mode 100644 index 0000000000..fe5eaa312b --- /dev/null +++ b/src/libs/freetype2/truetype/ttgxvar.c @@ -0,0 +1,1534 @@ +/***************************************************************************/ +/* */ +/* ttgxvar.c */ +/* */ +/* TrueType GX Font Variation loader */ +/* */ +/* Copyright 2004, 2005 by */ +/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* Apple documents the `fvar', `gvar', `cvar', and `avar' tables at */ +/* */ +/* http://developer.apple.com/fonts/TTRefMan/RM06/Chap6[fgca]var.html */ +/* */ +/* The documentation for `fvar' is inconsistant. At one point it says */ +/* that `countSizePairs' should be 3, at another point 2. It should be 2. */ +/* */ +/* The documentation for `gvar' is not intelligible; `cvar' refers you to */ +/* `gvar' and is thus also incomprehensible. */ +/* */ +/* The documentation for `avar' appears correct, but Apple has no fonts */ +/* with an `avar' table, so it is hard to test. */ +/* */ +/* Many thanks to John Jenkins (at Apple) in figuring this out. */ +/* */ +/* */ +/* Apple's `kern' table has some references to tuple indices, but as there */ +/* is no indication where these indices are defined, nor how to */ +/* interpolate the kerning values (different tuples have different */ +/* classes) this issue is ignored. */ +/* */ +/***************************************************************************/ + + +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H +#include FT_CONFIG_CONFIG_H +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_SFNT_H +#include FT_TRUETYPE_IDS_H +#include FT_TRUETYPE_TAGS_H +#include FT_MULTIPLE_MASTERS_H + +#include "ttdriver.h" +#include "ttpload.h" +#include "ttgxvar.h" + +#include "tterrors.h" + + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + + +#define FT_Stream_FTell( stream ) \ + ( (stream)->cursor - (stream)->base ) +#define FT_Stream_SeekSet( stream, off ) \ + ( (stream)->cursor = (stream)->base+(off) ) + + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_ttgxvar + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** Internal Routines *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* The macro ALL_POINTS is used in `ft_var_readpackedpoints'. It */ + /* indicates that there is a delta for every point without needing to */ + /* enumerate all of them. */ + /* */ +#define ALL_POINTS (FT_UShort*)( -1 ) + + + enum + { + GX_PT_POINTS_ARE_WORDS = 0x80, + GX_PT_POINT_RUN_COUNT_MASK = 0x7F + }; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* ft_var_readpackedpoints */ + /* */ + /* <Description> */ + /* Read a set of points to which the following deltas will apply. */ + /* Points are packed with a run length encoding. */ + /* */ + /* <Input> */ + /* stream :: The data stream. */ + /* */ + /* <Output> */ + /* point_cnt :: The number of points read. A zero value means that */ + /* all points in the glyph will be affected, without */ + /* enumerating them individually. */ + /* */ + /* <Return> */ + /* An array of FT_UShort containing the affected points or the */ + /* special value ALL_POINTS. */ + /* */ + static FT_UShort* + ft_var_readpackedpoints( FT_Stream stream, + FT_UInt *point_cnt ) + { + FT_UShort *points; + FT_Int n; + FT_Int runcnt; + FT_Int i; + FT_Int j; + FT_Int first; + FT_Memory memory = stream->memory; + FT_Error error = TT_Err_Ok; + + FT_UNUSED( error ); + + + *point_cnt = n = FT_GET_BYTE(); + if ( n == 0 ) + return ALL_POINTS; + + if ( n & GX_PT_POINTS_ARE_WORDS ) + n = FT_GET_BYTE() | ( ( n & GX_PT_POINT_RUN_COUNT_MASK ) << 8 ); + + if ( FT_NEW_ARRAY( points, n ) ) + return NULL; + + i = 0; + while ( i < n ) + { + runcnt = FT_GET_BYTE(); + if ( runcnt & GX_PT_POINTS_ARE_WORDS ) + { + runcnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK; + first = points[i++] = FT_GET_USHORT(); + + /* first point not included in runcount */ + for ( j = 0; j < runcnt; ++j ) + points[i++] = (FT_UShort)( first += FT_GET_USHORT() ); + } + else + { + first = points[i++] = FT_GET_BYTE(); + + for ( j = 0; j < runcnt; ++j ) + points[i++] = (FT_UShort)( first += FT_GET_BYTE() ); + } + } + + return points; + } + + + enum + { + GX_DT_DELTAS_ARE_ZERO = 0x80, + GX_DT_DELTAS_ARE_WORDS = 0x40, + GX_DT_DELTA_RUN_COUNT_MASK = 0x3F + }; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* ft_var_readpackeddeltas */ + /* */ + /* <Description> */ + /* Read a set of deltas. These are packed slightly differently than */ + /* points. In particular there is no overall count. */ + /* */ + /* <Input> */ + /* stream :: The data stream. */ + /* */ + /* delta_cnt :: The number of to be read. */ + /* */ + /* <Return> */ + /* An array of FT_Short containing the deltas for the affected */ + /* points. (This only gets the deltas for one dimension. It will */ + /* generally be called twice, once for x, once for y. When used in */ + /* cvt table, it will only be called once.) */ + /* */ + static FT_Short* + ft_var_readpackeddeltas( FT_Stream stream, + FT_Int delta_cnt ) + { + FT_Short *deltas; + FT_Int runcnt; + FT_Int i; + FT_Int j; + FT_Memory memory = stream->memory; + FT_Error error = TT_Err_Ok; + + FT_UNUSED( error ); + + + if ( FT_NEW_ARRAY( deltas, delta_cnt ) ) + return NULL; + + i = 0; + while ( i < delta_cnt ) + { + runcnt = FT_GET_BYTE(); + if ( runcnt & GX_DT_DELTAS_ARE_ZERO ) + { + /* runcnt zeroes get added */ + for ( j = 0; + j <= ( runcnt & GX_DT_DELTA_RUN_COUNT_MASK ) && i < delta_cnt; + ++j ) + deltas[i++] = 0; + } + else if ( runcnt & GX_DT_DELTAS_ARE_WORDS ) + { + /* runcnt shorts from the stack */ + for ( j = 0; + j <= ( runcnt & GX_DT_DELTA_RUN_COUNT_MASK ) && i < delta_cnt; + ++j ) + deltas[i++] = FT_GET_SHORT(); + } + else + { + /* runcnt signed bytes from the stack */ + for ( j = 0; + j <= ( runcnt & GX_DT_DELTA_RUN_COUNT_MASK ) && i < delta_cnt; + ++j ) + deltas[i++] = FT_GET_CHAR(); + } + + if ( j <= ( runcnt & GX_DT_DELTA_RUN_COUNT_MASK ) ) + { + /* Bad format */ + FT_FREE( deltas ); + return NULL; + } + } + + return deltas; + } + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* ft_var_load_avar */ + /* */ + /* <Description> */ + /* Parse the `avar' table if present. It need not be, so we return */ + /* nothing. */ + /* */ + /* <InOut> */ + /* face :: The font face. */ + /* */ + static void + ft_var_load_avar( TT_Face face ) + { + FT_Stream stream = FT_FACE_STREAM(face); + FT_Memory memory = stream->memory; + GX_Blend blend = face->blend; + GX_AVarSegment segment; + FT_Error error = TT_Err_Ok; + FT_ULong version; + FT_Long axisCount; + FT_Int i, j; + FT_ULong table_len; + + FT_UNUSED( error ); + + + blend->avar_checked = TRUE; + if ( (error = face->goto_table( face, TTAG_avar, stream, &table_len )) != 0 ) + return; + + if ( FT_FRAME_ENTER( table_len ) ) + return; + + version = FT_GET_LONG(); + axisCount = FT_GET_LONG(); + + if ( version != 0x00010000L || + axisCount != (FT_Long)blend->mmvar->num_axis ) + goto Exit; + + if ( FT_NEW_ARRAY( blend->avar_segment, axisCount ) ) + goto Exit; + + segment = &blend->avar_segment[0]; + for ( i = 0; i < axisCount; ++i, ++segment ) + { + segment->pairCount = FT_GET_USHORT(); + if ( FT_NEW_ARRAY( segment->correspondence, segment->pairCount ) ) + { + /* Failure. Free everything we have done so far. We must do */ + /* it right now since loading the `avar' table is optional. */ + + for ( j = i - 1; j >= 0; --j ) + FT_FREE( blend->avar_segment[j].correspondence ); + + FT_FREE( blend->avar_segment ); + blend->avar_segment = NULL; + goto Exit; + } + + for ( j = 0; j < segment->pairCount; ++j ) + { + segment->correspondence[j].fromCoord = + FT_GET_SHORT() << 2; /* convert to Fixed */ + segment->correspondence[j].toCoord = + FT_GET_SHORT()<<2; /* convert to Fixed */ + } + } + + Exit: + FT_FRAME_EXIT(); + } + + + typedef struct GX_GVar_Head_ { + FT_Long version; + FT_UShort axisCount; + FT_UShort globalCoordCount; + FT_ULong offsetToCoord; + FT_UShort glyphCount; + FT_UShort flags; + FT_ULong offsetToData; + + } GX_GVar_Head; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* ft_var_load_gvar */ + /* */ + /* <Description> */ + /* Parses the `gvar' table if present. If `fvar' is there, `gvar' */ + /* had better be there too. */ + /* */ + /* <InOut> */ + /* face :: The font face. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + static FT_Error + ft_var_load_gvar( TT_Face face ) + { + FT_Stream stream = FT_FACE_STREAM(face); + FT_Memory memory = stream->memory; + GX_Blend blend = face->blend; + FT_Error error; + FT_UInt i, j; + FT_ULong table_len; + FT_ULong gvar_start; + FT_ULong offsetToData; + GX_GVar_Head gvar_head; + + static const FT_Frame_Field gvar_fields[] = + { + +#undef FT_STRUCTURE +#define FT_STRUCTURE GX_GVar_Head + + FT_FRAME_START( 20 ), + FT_FRAME_LONG ( version ), + FT_FRAME_USHORT( axisCount ), + FT_FRAME_USHORT( globalCoordCount ), + FT_FRAME_ULONG ( offsetToCoord ), + FT_FRAME_USHORT( glyphCount ), + FT_FRAME_USHORT( flags ), + FT_FRAME_ULONG ( offsetToData ), + FT_FRAME_END + }; + + if ( (error = face->goto_table( face, TTAG_gvar, stream, &table_len )) != 0 ) + goto Exit; + + gvar_start = FT_STREAM_POS( ); + if ( FT_STREAM_READ_FIELDS( gvar_fields, &gvar_head ) ) + goto Exit; + + blend->tuplecount = gvar_head.globalCoordCount; + blend->gv_glyphcnt = gvar_head.glyphCount; + offsetToData = gvar_start + gvar_head.offsetToData; + + if ( gvar_head.version != (FT_Long)0x00010000L || + gvar_head.axisCount != (FT_UShort)blend->mmvar->num_axis ) + { + error = TT_Err_Invalid_Table; + goto Exit; + } + + if ( FT_NEW_ARRAY( blend->glyphoffsets, blend->gv_glyphcnt + 1 ) ) + goto Exit; + + if ( gvar_head.flags & 1 ) + { + /* long offsets (one more offset than glyphs, to mark size of last) */ + if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 4L ) ) + goto Exit; + + for ( i = 0; i <= blend->gv_glyphcnt; ++i ) + blend->glyphoffsets[i] = offsetToData + FT_GET_LONG(); + + FT_FRAME_EXIT(); + } + else + { + /* short offsets (one more offset than glyphs, to mark size of last) */ + if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 2L ) ) + goto Exit; + + for ( i = 0; i <= blend->gv_glyphcnt; ++i ) + blend->glyphoffsets[i] = offsetToData + FT_GET_USHORT() * 2; + /* XXX: Undocumented: `*2'! */ + + FT_FRAME_EXIT(); + } + + if ( blend->tuplecount != 0 ) + { + if ( FT_NEW_ARRAY( blend->tuplecoords, + gvar_head.axisCount * blend->tuplecount ) ) + goto Exit; + + if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) || + FT_FRAME_ENTER( blend->tuplecount * gvar_head.axisCount * 2L ) ) + goto Exit; + + for ( i = 0; i < blend->tuplecount; ++i ) + for ( j = 0 ; j < (FT_UInt)gvar_head.axisCount; ++j ) + blend->tuplecoords[i * gvar_head.axisCount + j] = + FT_GET_SHORT() << 2; /* convert to FT_Fixed */ + + FT_FRAME_EXIT(); + } + + Exit: + return error; + } + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* ft_var_apply_tuple */ + /* */ + /* <Description> */ + /* Figure out whether a given tuple (design) applies to the current */ + /* blend, and if so, what is the scaling factor. */ + /* */ + /* <Input> */ + /* blend :: The current blend of the font. */ + /* */ + /* tupleIndex :: A flag saying whether this is an intermediate */ + /* tuple or not. */ + /* */ + /* tuple_coords :: The coordinates of the tuple in normalized axis */ + /* units. */ + /* */ + /* im_start_coords :: The initial coordinates where this tuple starts */ + /* to apply (for intermediate coordinates). */ + /* */ + /* im_end_coords :: The final coordinates after which this tuple no */ + /* longer applies (for intermediate coordinates). */ + /* */ + /* <Return> */ + /* An FT_Fixed value containing the scaling factor. */ + /* */ + static FT_Fixed + ft_var_apply_tuple( GX_Blend blend, + FT_UShort tupleIndex, + FT_Fixed* tuple_coords, + FT_Fixed* im_start_coords, + FT_Fixed* im_end_coords ) + { + FT_UInt i; + FT_Fixed apply; + FT_Fixed temp; + + + apply = 0x10000L; + for ( i = 0; i < blend->num_axis; ++i ) + { + if ( tuple_coords[i] == 0 ) + /* It's not clear why (for intermediate tuples) we don't need */ + /* to check against start/end -- the documentation says we don't. */ + /* Similarly, it's unclear why we don't need to scale along the */ + /* axis. */ + continue; + + else if ( blend->normalizedcoords[i] == 0 || + ( blend->normalizedcoords[i] < 0 && tuple_coords[i] > 0 ) || + ( blend->normalizedcoords[i] > 0 && tuple_coords[i] < 0 ) ) + { + apply = 0; + break; + } + + else if ( !( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) ) + /* not an intermediate tuple */ + apply = FT_MulDiv( apply, + blend->normalizedcoords[i] > 0 + ? blend->normalizedcoords[i] + : -blend->normalizedcoords[i], + 0x10000L ); + + else if ( blend->normalizedcoords[i] <= im_start_coords[i] || + blend->normalizedcoords[i] >= im_end_coords[i] ) + { + apply = 0; + break; + } + + else if ( blend->normalizedcoords[i] < tuple_coords[i] ) + { + temp = FT_MulDiv( blend->normalizedcoords[i] - im_start_coords[i], + 0x10000L, + tuple_coords[i] - im_start_coords[i]); + apply = FT_MulDiv( apply, temp, 0x10000L ); + } + + else + { + temp = FT_MulDiv( im_end_coords[i] - blend->normalizedcoords[i], + 0x10000L, + im_end_coords[i] - tuple_coords[i] ); + apply = FT_MulDiv( apply, temp, 0x10000L ); + } + } + + return apply; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** MULTIPLE MASTERS SERVICE FUNCTIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + typedef struct GX_FVar_Head_ { + FT_Long version; + FT_UShort offsetToData; + FT_UShort countSizePairs; + FT_UShort axisCount; + FT_UShort axisSize; + FT_UShort instanceCount; + FT_UShort instanceSize; + + } GX_FVar_Head; + + + typedef struct fvar_axis { + FT_ULong axisTag; + FT_ULong minValue; + FT_ULong defaultValue; + FT_ULong maxValue; + FT_UShort flags; + FT_UShort nameID; + + } GX_FVar_Axis; + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* TT_Get_MM_Var */ + /* */ + /* <Description> */ + /* Check that the font's `fvar' table is valid, parse it, and return */ + /* those data. */ + /* */ + /* <InOut> */ + /* face :: The font face. */ + /* TT_Get_MM_Var initializes the blend structure. */ + /* */ + /* <Output> */ + /* master :: The `fvar' data (must be freed by caller). */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Get_MM_Var( TT_Face face, + FT_MM_Var* *master ) + { + FT_Stream stream = face->root.stream; + FT_Memory memory = face->root.memory; + FT_ULong table_len; + FT_Error error = TT_Err_Ok; + FT_ULong fvar_start; + FT_Int i, j; + FT_MM_Var* mmvar; + FT_Fixed* next_coords; + FT_String* next_name; + FT_Var_Axis* a; + FT_Var_Named_Style* ns; + GX_FVar_Head fvar_head; + + static const FT_Frame_Field fvar_fields[] = + { + +#undef FT_STRUCTURE +#define FT_STRUCTURE GX_FVar_Head + + FT_FRAME_START( 16 ), + FT_FRAME_LONG ( version ), + FT_FRAME_USHORT( offsetToData ), + FT_FRAME_USHORT( countSizePairs ), + FT_FRAME_USHORT( axisCount ), + FT_FRAME_USHORT( axisSize ), + FT_FRAME_USHORT( instanceCount ), + FT_FRAME_USHORT( instanceSize ), + FT_FRAME_END + }; + + static const FT_Frame_Field fvaraxis_fields[] = + { + +#undef FT_STRUCTURE +#define FT_STRUCTURE GX_FVar_Axis + + FT_FRAME_START( 20 ), + FT_FRAME_ULONG ( axisTag ), + FT_FRAME_ULONG ( minValue ), + FT_FRAME_ULONG ( defaultValue ), + FT_FRAME_ULONG ( maxValue ), + FT_FRAME_USHORT( flags ), + FT_FRAME_USHORT( nameID ), + FT_FRAME_END + }; + + + if ( face->blend == NULL ) + { + /* both `fvar' and `gvar' must be present */ + if ( (error = face->goto_table( face, TTAG_gvar, + stream, &table_len )) != 0 ) + goto Exit; + + if ( (error = face->goto_table( face, TTAG_fvar, + stream, &table_len )) != 0 ) + goto Exit; + + fvar_start = FT_STREAM_POS( ); + + if ( FT_STREAM_READ_FIELDS( fvar_fields, &fvar_head ) ) + goto Exit; + + if ( fvar_head.version != (FT_Long)0x00010000L || + fvar_head.countSizePairs != 2 || + fvar_head.axisSize != 20 || + fvar_head.instanceSize != 4 + 4 * fvar_head.axisCount || + fvar_head.offsetToData + fvar_head.axisCount * 20U + + fvar_head.instanceCount * fvar_head.instanceSize > table_len ) + { + error = TT_Err_Invalid_Table; + goto Exit; + } + + if ( FT_ALLOC( face->blend, sizeof ( GX_BlendRec ) ) ) + goto Exit; + + face->blend->mmvar_len = + sizeof ( FT_MM_Var ) + + fvar_head.axisCount * sizeof ( FT_Var_Axis ) + + fvar_head.instanceCount * sizeof ( FT_Var_Named_Style ) + + fvar_head.instanceCount * fvar_head.axisCount * sizeof ( FT_Fixed ) + + 5 * fvar_head.axisCount; + if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) ) + goto Exit; + face->blend->mmvar = mmvar; + + mmvar->num_axis = + fvar_head.axisCount; + mmvar->num_designs = + (FT_UInt)-1; /* meaningless in this context; each glyph */ + /* may have a different number of designs */ + /* (or tuples, as called by Apple) */ + mmvar->num_namedstyles = + fvar_head.instanceCount; + mmvar->axis = + (FT_Var_Axis*)&(mmvar[1]); + mmvar->namedstyle = + (FT_Var_Named_Style*)&(mmvar->axis[fvar_head.axisCount]); + + next_coords = + (FT_Fixed*)&(mmvar->namedstyle[fvar_head.instanceCount]); + for ( i = 0; i < fvar_head.instanceCount; ++i ) + { + mmvar->namedstyle[i].coords = next_coords; + next_coords += fvar_head.axisCount; + } + + next_name = (FT_String*)next_coords; + for ( i = 0; i < fvar_head.axisCount; ++i ) + { + mmvar->axis[i].name = next_name; + next_name += 5; + } + + if ( FT_STREAM_SEEK( fvar_start + fvar_head.offsetToData ) ) + goto Exit; + + a = mmvar->axis; + for ( i = 0; i < fvar_head.axisCount; ++i ) + { + GX_FVar_Axis axis_rec; + + + if ( FT_STREAM_READ_FIELDS( fvaraxis_fields, &axis_rec ) ) + goto Exit; + a->tag = axis_rec.axisTag; + a->minimum = axis_rec.minValue; /* A Fixed */ + a->def = axis_rec.defaultValue; /* A Fixed */ + a->maximum = axis_rec.maxValue; /* A Fixed */ + a->strid = axis_rec.nameID; + + a->name[0] = (FT_String)( a->tag >> 24 ); + a->name[1] = (FT_String)( ( a->tag >> 16 ) & 0xFF ); + a->name[2] = (FT_String)( ( a->tag >> 8 ) & 0xFF ); + a->name[3] = (FT_String)( ( a->tag ) & 0xFF ); + a->name[4] = 0; + + ++a; + } + + ns = mmvar->namedstyle; + for ( i = 0; i < fvar_head.instanceCount; ++i ) + { + if ( FT_FRAME_ENTER( 4L + 4L * fvar_head.axisCount ) ) + goto Exit; + + ns->strid = FT_GET_USHORT(); + (void) /* flags = */ FT_GET_USHORT(); + + for ( j = 0; j < fvar_head.axisCount; ++j ) + ns->coords[j] = FT_GET_ULONG(); /* A Fixed */ + + FT_FRAME_EXIT(); + } + } + + if ( master != NULL ) + { + FT_UInt n; + + + if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) ) + goto Exit; + FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len ); + + mmvar->axis = + (FT_Var_Axis*)&(mmvar[1]); + mmvar->namedstyle = + (FT_Var_Named_Style*)&(mmvar->axis[mmvar->num_axis]); + next_coords = + (FT_Fixed*)&(mmvar->namedstyle[mmvar->num_namedstyles]); + + for ( n = 0; n < mmvar->num_namedstyles; ++n ) + { + mmvar->namedstyle[n].coords = next_coords; + next_coords += mmvar->num_axis; + } + + a = mmvar->axis; + next_name = (FT_String*)next_coords; + for ( n = 0; n < mmvar->num_axis; ++n ) + { + a->name = next_name; + + /* standard PostScript names for some standard apple tags */ + if ( a->tag == TTAG_wght ) + a->name = (char *)"Weight"; + else if ( a->tag == TTAG_wdth ) + a->name = (char *)"Width"; + else if ( a->tag == TTAG_opsz ) + a->name = (char *)"OpticalSize"; + else if ( a->tag == TTAG_slnt ) + a->name = (char *)"Slant"; + + next_name += 5; + ++a; + } + + *master = mmvar; + } + + Exit: + return error; + } + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* TT_Set_MM_Blend */ + /* */ + /* <Description> */ + /* Set the blend (normalized) coordinates for this instance of the */ + /* font. Check that the `gvar' table is reasonable and does some */ + /* initial preparation. */ + /* */ + /* <InOut> */ + /* face :: The font. */ + /* Initialize the blend structure with `gvar' data. */ + /* */ + /* <Input> */ + /* num_coords :: Must be the axis count of the font. */ + /* */ + /* coords :: An array of num_coords, each between [-1,1]. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Set_MM_Blend( TT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Error error = TT_Err_Ok; + GX_Blend blend; + FT_MM_Var* mmvar; + FT_UInt i; + FT_Memory memory = face->root.memory; + + enum + { + mcvt_retain, + mcvt_modify, + mcvt_load + + } manageCvt; + + + face->doblend = FALSE; + + if ( face->blend == NULL ) + { + if ( (error = TT_Get_MM_Var( face, NULL)) != 0 ) + goto Exit; + } + + blend = face->blend; + mmvar = blend->mmvar; + + if ( num_coords != mmvar->num_axis ) + { + error = TT_Err_Invalid_Argument; + goto Exit; + } + + for ( i = 0; i < num_coords; ++i ) + if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L ) + { + error = TT_Err_Invalid_Argument; + goto Exit; + } + + if ( blend->glyphoffsets == NULL ) + if ( (error = ft_var_load_gvar( face )) != 0 ) + goto Exit; + + if ( blend->normalizedcoords == NULL ) + { + if ( FT_NEW_ARRAY( blend->normalizedcoords, num_coords ) ) + goto Exit; + + manageCvt = mcvt_modify; + + /* If we have not set the blend coordinates before this, then the */ + /* cvt table will still be what we read from the `cvt ' table and */ + /* we don't need to reload it. We may need to change it though... */ + } + else + { + for ( i = 0; + i < num_coords && blend->normalizedcoords[i] == coords[i]; + ++i ); + if ( i == num_coords ) + manageCvt = mcvt_retain; + else + manageCvt = mcvt_load; + + /* If we don't change the blend coords then we don't need to do */ + /* anything to the cvt table. It will be correct. Otherwise we */ + /* no longer have the original cvt (it was modified when we set */ + /* the blend last time), so we must reload and then modify it. */ + } + + blend->num_axis = num_coords; + FT_MEM_COPY( blend->normalizedcoords, + coords, + num_coords * sizeof ( FT_Fixed ) ); + + face->doblend = TRUE; + + if ( face->cvt != NULL ) + { + switch ( manageCvt ) + { + case mcvt_load: + /* The cvt table has been loaded already; every time we change the */ + /* blend we may need to reload and remodify the cvt table. */ + FT_FREE( face->cvt ); + face->cvt = NULL; + + tt_face_load_cvt( face, face->root.stream ); + break; + + case mcvt_modify: + /* The original cvt table is in memory. All we need to do is */ + /* apply the `cvar' table (if any). */ + tt_face_vary_cvt( face, face->root.stream ); + break; + + case mcvt_retain: + /* The cvt table is correct for this set of coordinates. */ + break; + } + } + + Exit: + return error; + } + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* TT_Set_Var_Design */ + /* */ + /* <Description> */ + /* Set the coordinates for the instance, measured in the user */ + /* coordinate system. Parse the `avar' table (if present) to convert */ + /* from user to normalized coordinates. */ + /* */ + /* <InOut> */ + /* face :: The font face. */ + /* Initialize the blend struct with `gvar' data. */ + /* */ + /* <Input> */ + /* num_coords :: This must be the axis count of the font. */ + /* */ + /* coords :: A coordinate array with `num_coords' elements. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Set_Var_Design( TT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Error error = TT_Err_Ok; + FT_Fixed* normalized = NULL; + GX_Blend blend; + FT_MM_Var* mmvar; + FT_UInt i, j; + FT_Var_Axis* a; + GX_AVarSegment av; + FT_Memory memory = face->root.memory; + + + if ( face->blend == NULL ) + { + if ( (error = TT_Get_MM_Var( face, NULL )) != 0 ) + goto Exit; + } + + blend = face->blend; + mmvar = blend->mmvar; + + if ( num_coords != mmvar->num_axis ) + { + error = TT_Err_Invalid_Argument; + goto Exit; + } + + /* Axis normalization is a two stage process. First we normalize */ + /* based on the [min,def,max] values for the axis to be [-1,0,1]. */ + /* Then, if there's an `avar' table, we renormalize this range. */ + + if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) + goto Exit; + + a = mmvar->axis; + for ( i = 0; i < mmvar->num_axis; ++i, ++a ) + { + if ( coords[i] > a->maximum || coords[i] < a->minimum ) + { + error = TT_Err_Invalid_Argument; + goto Exit; + } + + if ( coords[i] < a->def ) + { + normalized[i] = -FT_MulDiv( coords[i] - a->def, + 0x10000L, + a->minimum - a->def ); + } + else if ( a->maximum == a->def ) + normalized[i] = 0; + else + { + normalized[i] = FT_MulDiv( coords[i] - a->def, + 0x10000L, + a->maximum - a->def ); + } + } + + if ( !blend->avar_checked ) + ft_var_load_avar( face ); + + if ( blend->avar_segment != NULL ) + { + av = blend->avar_segment; + for ( i = 0; i < mmvar->num_axis; ++i, ++av ) + { + for ( j = 1; j < (FT_UInt)av->pairCount; ++j ) + if ( normalized[i] < av->correspondence[j].fromCoord ) + { + normalized[i] = + FT_MulDiv( + FT_MulDiv( + normalized[i] - av->correspondence[j - 1].fromCoord, + 0x10000L, + av->correspondence[j].fromCoord - + av->correspondence[j - 1].fromCoord ), + av->correspondence[j].toCoord - + av->correspondence[j - 1].toCoord, + 0x10000L ) + + av->correspondence[j - 1].toCoord; + break; + } + } + } + + error = TT_Set_MM_Blend( face, num_coords, normalized ); + + Exit: + FT_FREE( normalized ); + return error; + } + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** GX VAR PARSING ROUTINES *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* tt_face_vary_cvt */ + /* */ + /* <Description> */ + /* Modify the loaded cvt table according to the `cvar' table and the */ + /* font's blend. */ + /* */ + /* <InOut> */ + /* face :: A handle to the target face object. */ + /* */ + /* <Input> */ + /* stream :: A handle to the input stream. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + /* Most errors are ignored. It is perfectly valid not to have a */ + /* `cvar' table even if there is a `gvar' and `fvar' table. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + tt_face_vary_cvt( TT_Face face, + FT_Stream stream ) + { + FT_Error error; + FT_Memory memory = stream->memory; + FT_ULong table_start; + FT_ULong table_len; + FT_UInt tupleCount; + FT_ULong offsetToData; + FT_ULong here; + FT_UInt i, j; + FT_Fixed* tuple_coords = NULL; + FT_Fixed* im_start_coords = NULL; + FT_Fixed* im_end_coords = NULL; + GX_Blend blend = face->blend; + FT_UInt point_count; + FT_UShort* localpoints; + FT_Short* deltas; + + + FT_TRACE2(( "CVAR " )); + + if ( blend == NULL ) + { + FT_TRACE2(( "no blend specified!\n" )); + + error = TT_Err_Ok; + goto Exit; + } + + if ( face->cvt == NULL ) + { + FT_TRACE2(( "no `cvt ' table!\n" )); + + error = TT_Err_Ok; + goto Exit; + } + + error = face->goto_table( face, TTAG_cvar, stream, &table_len ); + if ( error ) + { + FT_TRACE2(( "is missing!\n" )); + + error = TT_Err_Ok; + goto Exit; + } + + if ( FT_FRAME_ENTER( table_len ) ) + { + error = TT_Err_Ok; + goto Exit; + } + + table_start = FT_Stream_FTell( stream ); + if ( FT_GET_LONG() != 0x00010000L ) + { + FT_TRACE2(( "bad table version!\n" )); + + error = TT_Err_Ok; + goto FExit; + } + + if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) || + FT_NEW_ARRAY( im_start_coords, blend->num_axis ) || + FT_NEW_ARRAY( im_end_coords, blend->num_axis ) ) + goto FExit; + + tupleCount = FT_GET_USHORT(); + offsetToData = table_start + FT_GET_USHORT(); + + /* The documentation implies there are flags packed into the */ + /* tuplecount, but John Jenkins says that shared points don't apply */ + /* to `cvar', and no other flags are defined. */ + + for ( i = 0; i < ( tupleCount & 0xFFF ); ++i ) + { + FT_UInt tupleDataSize; + FT_UInt tupleIndex; + FT_Fixed apply; + + + tupleDataSize = FT_GET_USHORT(); + tupleIndex = FT_GET_USHORT(); + + /* There is no provision here for a global tuple coordinate section, */ + /* so John says. There are no tuple indices, just embedded tuples. */ + + if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) + { + for ( j = 0; j < blend->num_axis; ++j ) + tuple_coords[j] = FT_GET_SHORT() << 2; /* convert from */ + /* short frac to fixed */ + } + else + { + /* skip this tuple; it makes no sense */ + + if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) + for ( j = 0; j < 2 * blend->num_axis; ++j ) + (void)FT_GET_SHORT(); + + offsetToData += tupleDataSize; + continue; + } + + if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) + { + for ( j = 0; j < blend->num_axis; ++j ) + im_start_coords[j] = FT_GET_SHORT() << 2; + for ( j = 0; j < blend->num_axis; ++j ) + im_end_coords[j] = FT_GET_SHORT() << 2; + } + + apply = ft_var_apply_tuple( blend, + (FT_UShort)tupleIndex, + tuple_coords, + im_start_coords, + im_end_coords ); + if ( /* tuple isn't active for our blend */ + apply == 0 || + /* global points not allowed, */ + /* if they aren't local, makes no sense */ + !( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) ) + { + offsetToData += tupleDataSize; + continue; + } + + here = FT_Stream_FTell( stream ); + + FT_Stream_SeekSet( stream, offsetToData ); + + localpoints = ft_var_readpackedpoints( stream, &point_count ); + deltas = ft_var_readpackeddeltas( stream, + point_count == 0 ? face->cvt_size + : point_count ); + if ( localpoints == NULL || deltas == NULL ) + /* failure, ignore it */; + + else if ( localpoints == ALL_POINTS ) + { + /* this means that there are deltas for every entry in cvt */ + for ( j = 0; j < face->cvt_size; ++j ) + face->cvt[j] = (FT_Short)( face->cvt[j] + + FT_MulFix( deltas[j], apply ) ); + } + + else + { + for ( j = 0; j < point_count; ++j ) + { + int pindex = localpoints[j]; + + face->cvt[pindex] = (FT_Short)( face->cvt[pindex] + + FT_MulFix( deltas[j], apply ) ); + } + } + + if ( localpoints != ALL_POINTS ) + FT_FREE( localpoints ); + FT_FREE( deltas ); + + offsetToData += tupleDataSize; + + FT_Stream_SeekSet( stream, here ); + } + + FExit: + FT_FRAME_EXIT(); + + Exit: + FT_FREE( tuple_coords ); + FT_FREE( im_start_coords ); + FT_FREE( im_end_coords ); + + return error; + } + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* TT_Vary_Get_Glyph_Deltas */ + /* */ + /* <Description> */ + /* Load the appropriate deltas for the current glyph. */ + /* */ + /* <Input> */ + /* face :: A handle to the target face object. */ + /* */ + /* glyph_index :: The index of the glyph being modified. */ + /* */ + /* n_points :: The number of the points in the glyph, including */ + /* phantom points. */ + /* */ + /* <Output> */ + /* deltas :: The array of points to change. */ + /* */ + /* <Return> */ + /* FreeType error code. 0 means success. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + TT_Vary_Get_Glyph_Deltas( TT_Face face, + FT_UInt glyph_index, + FT_Vector* *deltas, + FT_UInt n_points ) + { + FT_Stream stream = face->root.stream; + FT_Memory memory = stream->memory; + GX_Blend blend = face->blend; + FT_Vector* delta_xy; + + FT_Error error; + FT_ULong glyph_start; + FT_UInt tupleCount; + FT_ULong offsetToData; + FT_ULong here; + FT_UInt i, j; + FT_Fixed* tuple_coords = NULL; + FT_Fixed* im_start_coords = NULL; + FT_Fixed* im_end_coords = NULL; + FT_UInt point_count, spoint_count = 0; + FT_UShort* sharedpoints = NULL; + FT_UShort* localpoints = NULL; + FT_UShort* points; + FT_Short *deltas_x, *deltas_y; + + + if ( !face->doblend || blend == NULL ) + return TT_Err_Invalid_Argument; + + /* to be freed by the caller */ + if ( FT_NEW_ARRAY( delta_xy, n_points ) ) + goto Exit; + *deltas = delta_xy; + + if ( glyph_index >= blend->gv_glyphcnt || + blend->glyphoffsets[glyph_index] == + blend->glyphoffsets[glyph_index + 1] ) + return TT_Err_Ok; /* no variation data for this glyph */ + + if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) || + FT_FRAME_ENTER( blend->glyphoffsets[glyph_index + 1] - + blend->glyphoffsets[glyph_index] ) ) + goto Fail1; + + glyph_start = FT_Stream_FTell( stream ); + + /* each set of glyph variation data is formatted similarly to `cvar' */ + /* (except we get shared points and global tuples) */ + + if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) || + FT_NEW_ARRAY( im_start_coords, blend->num_axis ) || + FT_NEW_ARRAY( im_end_coords, blend->num_axis ) ) + goto Fail2; + + tupleCount = FT_GET_USHORT(); + offsetToData = glyph_start + FT_GET_USHORT(); + + if ( tupleCount & GX_TC_TUPLES_SHARE_POINT_NUMBERS ) + { + here = FT_Stream_FTell( stream ); + + FT_Stream_SeekSet( stream, offsetToData ); + + sharedpoints = ft_var_readpackedpoints( stream, &spoint_count ); + offsetToData = FT_Stream_FTell( stream ); + + FT_Stream_SeekSet( stream, here ); + } + + for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); ++i ) + { + FT_UInt tupleDataSize; + FT_UInt tupleIndex; + FT_Fixed apply; + + + tupleDataSize = FT_GET_USHORT(); + tupleIndex = FT_GET_USHORT(); + + if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD ) + { + for ( j = 0; j < blend->num_axis; ++j ) + tuple_coords[j] = FT_GET_SHORT() << 2; /* convert from */ + /* short frac to fixed */ + } + else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount ) + { + error = TT_Err_Invalid_Table; + goto Fail3; + } + else + { + FT_MEM_COPY( + tuple_coords, + &blend->tuplecoords[(tupleIndex & 0xFFF) * blend->num_axis], + blend->num_axis * sizeof ( FT_Fixed ) ); + } + + if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) + { + for ( j = 0; j < blend->num_axis; ++j ) + im_start_coords[j] = FT_GET_SHORT() << 2; + for ( j = 0; j < blend->num_axis; ++j ) + im_end_coords[j] = FT_GET_SHORT() << 2; + } + + apply = ft_var_apply_tuple( blend, + (FT_UShort)tupleIndex, + tuple_coords, + im_start_coords, + im_end_coords ); + + if ( apply == 0 ) /* tuple isn't active for our blend */ + { + offsetToData += tupleDataSize; + continue; + } + + here = FT_Stream_FTell( stream ); + + if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS ) + { + FT_Stream_SeekSet( stream, offsetToData ); + + localpoints = ft_var_readpackedpoints( stream, &point_count ); + points = localpoints; + } + else + { + points = sharedpoints; + point_count = spoint_count; + } + + deltas_x = ft_var_readpackeddeltas( stream, + point_count == 0 ? n_points + : point_count ); + deltas_y = ft_var_readpackeddeltas( stream, + point_count == 0 ? n_points + : point_count ); + + if ( points == NULL || deltas_y == NULL || deltas_x == NULL ) + ; /* failure, ignore it */ + + else if ( points == ALL_POINTS ) + { + /* this means that there are deltas for every point in the glyph */ + for ( j = 0; j < n_points; ++j ) + { + delta_xy[j].x += FT_MulFix( deltas_x[j], apply ); + delta_xy[j].y += FT_MulFix( deltas_y[j], apply ); + } + } + + else + { + for ( j = 0; j < point_count; ++j ) + { + delta_xy[localpoints[j]].x += FT_MulFix( deltas_x[j], apply ); + delta_xy[localpoints[j]].y += FT_MulFix( deltas_y[j], apply ); + } + } + + if ( localpoints != ALL_POINTS ) + FT_FREE( localpoints ); + FT_FREE( deltas_x ); + FT_FREE( deltas_y ); + + offsetToData += tupleDataSize; + + FT_Stream_SeekSet( stream, here ); + } + + Fail3: + FT_FREE( tuple_coords ); + FT_FREE( im_start_coords ); + FT_FREE( im_end_coords ); + + Fail2: + FT_FRAME_EXIT(); + + Fail1: + if ( error ) + { + FT_FREE( delta_xy ); + *deltas = NULL; + } + + Exit: + return error; + } + + + /*************************************************************************/ + /* */ + /* <Function> */ + /* tt_done_blend */ + /* */ + /* <Description> */ + /* Frees the blend internal data structure. */ + /* */ + FT_LOCAL_DEF( void ) + tt_done_blend( FT_Memory memory, + GX_Blend blend ) + { + if ( blend != NULL ) + { + FT_UInt i; + + + FT_FREE( blend->normalizedcoords ); + FT_FREE( blend->mmvar ); + + if ( blend->avar_segment != NULL ) + { + for ( i = 0; i < blend->num_axis; ++i ) + FT_FREE( blend->avar_segment[i].correspondence ); + FT_FREE( blend->avar_segment ); + } + + FT_FREE( blend->tuplecoords ); + FT_FREE( blend->glyphoffsets ); + FT_FREE( blend ); + } + } + +#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + + +/* END */ diff --git a/src/libs/freetype2/truetype/ttgxvar.h b/src/libs/freetype2/truetype/ttgxvar.h new file mode 100644 index 0000000000..e86c7eeccb --- /dev/null +++ b/src/libs/freetype2/truetype/ttgxvar.h @@ -0,0 +1,182 @@ +/***************************************************************************/ +/* */ +/* ttgxvar.h */ +/* */ +/* TrueType GX Font Variation loader (specification) */ +/* */ +/* Copyright 2004 by */ +/* David Turner, Robert Wilhelm, Werner Lemberg and George Williams. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __TTGXVAR_H__ +#define __TTGXVAR_H__ + + +#include <ft2build.h> +#include "ttobjs.h" + + +FT_BEGIN_HEADER + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* GX_AVarCorrespondenceRec */ + /* */ + /* <Description> */ + /* A data structure representing `shortFracCorrespondence' in `avar' */ + /* table according to the specifications from Apple. */ + /* */ + typedef struct GX_AVarCorrespondenceRec_ + { + FT_Fixed fromCoord; + FT_Fixed toCoord; + + } GX_AVarCorrespondenceRec_, *GX_AVarCorrespondence; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* GX_AVarRec */ + /* */ + /* <Description> */ + /* Data from the segment field of `avar' table. */ + /* There is one of these for each axis. */ + /* */ + typedef struct GX_AVarSegmentRec_ + { + FT_UShort pairCount; + GX_AVarCorrespondence correspondence; /* array with pairCount entries */ + + } GX_AVarSegmentRec, *GX_AVarSegment; + + + /*************************************************************************/ + /* */ + /* <Struct> */ + /* GX_BlendRec */ + /* */ + /* <Description> */ + /* Data for interpolating a font from a distortable font specified */ + /* by the GX *var tables ([fgca]var). */ + /* */ + /* <Fields> */ + /* num_axis :: The number of axes along which interpolation */ + /* may happen */ + /* */ + /* normalizedcoords :: A normalized value (between [-1,1]) indicating */ + /* the contribution along each axis to the final */ + /* interpolated font. */ + /* */ + typedef struct GX_BlendRec_ + { + FT_UInt num_axis; + FT_Fixed* normalizedcoords; + + FT_MM_Var* mmvar; + FT_Int mmvar_len; + + FT_Bool avar_checked; + GX_AVarSegment avar_segment; + + FT_UInt tuplecount; /* shared tuples in `gvar' */ + FT_Fixed* tuplecoords; /* tuplecoords[tuplecount][num_axis] */ + + FT_UInt gv_glyphcnt; + FT_ULong* glyphoffsets; + + } GX_BlendRec; + + + /*************************************************************************/ + /* */ + /* <enum> */ + /* GX_TupleCountFlags */ + /* */ + /* <Description> */ + /* Flags used within the `TupleCount' field of the `gvar' table. */ + /* */ + typedef enum GX_TupleCountFlags_ + { + GX_TC_TUPLES_SHARE_POINT_NUMBERS = 0x8000, + GX_TC_RESERVED_TUPLE_FLAGS = 0x7000, + GX_TC_TUPLE_COUNT_MASK = 0x0FFF + + } GX_TupleCountFlags; + + + /*************************************************************************/ + /* */ + /* <enum> */ + /* GX_TupleIndexFlags */ + /* */ + /* <Description> */ + /* Flags used within the `TupleIndex' field of the `gvar' and `cvar' */ + /* tables. */ + /* */ + typedef enum GX_TupleIndexFlags_ + { + GX_TI_EMBEDDED_TUPLE_COORD = 0x8000, + GX_TI_INTERMEDIATE_TUPLE = 0x4000, + GX_TI_PRIVATE_POINT_NUMBERS = 0x2000, + GX_TI_RESERVED_TUPLE_FLAG = 0x1000, + GX_TI_TUPLE_INDEX_MASK = 0x0FFF + + } GX_TupleIndexFlags; + + +#define TTAG_wght FT_MAKE_TAG( 'w', 'g', 'h', 't' ) +#define TTAG_wdth FT_MAKE_TAG( 'w', 'd', 't', 'h' ) +#define TTAG_opsz FT_MAKE_TAG( 'o', 'p', 's', 'z' ) +#define TTAG_slnt FT_MAKE_TAG( 's', 'l', 'n', 't' ) + + + FT_LOCAL( FT_Error ) + TT_Set_MM_Blend( TT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + FT_LOCAL( FT_Error ) + TT_Set_Var_Design( TT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + + FT_LOCAL( FT_Error ) + TT_Get_MM_Var( TT_Face face, + FT_MM_Var* *master ); + + + FT_LOCAL( FT_Error ) + tt_face_vary_cvt( TT_Face face, + FT_Stream stream ); + + + FT_LOCAL( FT_Error ) + TT_Vary_Get_Glyph_Deltas( TT_Face face, + FT_UInt glyph_index, + FT_Vector* *deltas, + FT_UInt n_points ); + + + FT_LOCAL( void ) + tt_done_blend( FT_Memory memory, + GX_Blend blend ); + + +FT_END_HEADER + + +#endif /* __TTGXVAR_H__ */ + + +/* END */ diff --git a/src/libs/freetype2/truetype/ttinterp.c b/src/libs/freetype2/truetype/ttinterp.c index 889ebbf4f2..ec8daae510 100644 --- a/src/libs/freetype2/truetype/ttinterp.c +++ b/src/libs/freetype2/truetype/ttinterp.c @@ -844,22 +844,17 @@ /*************************************************************************/ /* */ /* Before an opcode is executed, the interpreter verifies that there are */ - /* enough arguments on the stack, with the help of the Pop_Push_Count */ + /* enough arguments on the stack, with the help of the `Pop_Push_Count' */ /* table. */ /* */ /* For each opcode, the first column gives the number of arguments that */ /* are popped from the stack; the second one gives the number of those */ /* that are pushed in result. */ /* */ - /* Note that for opcodes with a varying number of parameters, either 0 */ - /* or 1 arg is verified before execution, depending on the nature of the */ - /* instruction: */ - /* */ - /* - if the number of arguments is given by the bytecode stream or the */ - /* loop variable, 0 is chosen. */ - /* */ - /* - if the first argument is a count n that is followed by arguments */ - /* a1 .. an, then 1 is chosen. */ + /* Opcodes which have a varying number of parameters in the data stream */ + /* (NPUSHB, NPUSHW) are handled specially; they have a negative value in */ + /* the `opcode_length' table, and the value in `Pop_Push_Count' is set */ + /* to zero. */ /* */ /*************************************************************************/ @@ -1156,7 +1151,7 @@ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - -1,-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + -1,-2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -2474,7 +2469,7 @@ W = Vx * Vx + Vy * Vy; /* Now, we want that Sqrt( W ) = 0x4000 */ - /* Or 0x1000000 <= W < 0x1004000 */ + /* Or 0x10000000 <= W < 0x10004000 */ if ( Vx < 0 ) { @@ -2492,7 +2487,7 @@ else S2 = FALSE; - while ( W < 0x1000000L ) + while ( W < 0x10000000L ) { /* We need to increase W by a minimal amount */ if ( Vx < Vy ) @@ -2503,7 +2498,7 @@ W = Vx * Vx + Vy * Vy; } - while ( W >= 0x1004000L ) + while ( W >= 0x10004000L ) { /* We need to decrease W by a minimal amount */ if ( Vx < Vy ) @@ -4161,7 +4156,7 @@ { if ( CUR.IP + 1 > CUR.codeSize ) goto Fail_Overflow; - CUR.length = CUR.code[CUR.IP + 1] + 2; + CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1]; } if ( CUR.IP + CUR.length <= CUR.codeSize ) @@ -6617,8 +6612,6 @@ /* Opcode range: 0x88 */ /* Stack: uint32 --> uint32 */ /* */ - /* XXX: According to Apple specs, bits 1 & 2 of the argument ought to be */ - /* consulted before rotated/stretched info is returned. */ static void Ins_GETINFO( INS_ARG ) { @@ -6627,18 +6620,21 @@ K = 0; - /* We return then Windows 3.1 version number */ - /* for the font scaler */ + /* We return MS rasterizer version 1.7 for the font scaler. */ if ( ( args[0] & 1 ) != 0 ) - K = 3; + K = 35; - /* Has the glyph been rotated ? */ - if ( CUR.tt_metrics.rotated ) + /* Has the glyph been rotated? */ + if ( ( args[0] & 2 ) != 0 && CUR.tt_metrics.rotated ) K |= 0x80; - /* Has the glyph been stretched ? */ - if ( CUR.tt_metrics.stretched ) - K |= 0x100; + /* Has the glyph been stretched? */ + if ( ( args[0] & 4 ) != 0 && CUR.tt_metrics.stretched ) + K |= 1 << 8; + + /* Are we hinting for grayscale? */ + if ( ( args[0] & 32 ) != 0 && CUR.grayscale ) + K |= (1 << 12); args[0] = K; } @@ -7043,7 +7039,7 @@ if ( CUR.IP + 1 > CUR.codeSize ) goto LErrorCodeOverflow_; - CUR.length = CUR.code[CUR.IP + 1] + 2; + CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1]; } if ( CUR.IP + CUR.length > CUR.codeSize ) diff --git a/src/libs/freetype2/truetype/ttinterp.h b/src/libs/freetype2/truetype/ttinterp.h index eb0bb0bb60..43f662c047 100644 --- a/src/libs/freetype2/truetype/ttinterp.h +++ b/src/libs/freetype2/truetype/ttinterp.h @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,7 +27,7 @@ FT_BEGIN_HEADER -#ifndef TT_CONFIG_OPTION_STATIC_INTEPRETER /* indirect implementation */ +#ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER /* indirect implementation */ #define EXEC_OP_ TT_ExecContext exc, #define EXEC_OP TT_ExecContext exc @@ -219,6 +219,8 @@ FT_BEGIN_HEADER FT_ULong loadSize; TT_SubGlyph_Stack loadStack; /* loading subglyph stack */ + FT_Bool grayscale; /* are we hinting for grayscale? */ + } TT_ExecContextRec; diff --git a/src/libs/freetype2/truetype/ttobjs.c b/src/libs/freetype2/truetype/ttobjs.c index d5210f2cd0..05e673dbc3 100644 --- a/src/libs/freetype2/truetype/ttobjs.c +++ b/src/libs/freetype2/truetype/ttobjs.c @@ -4,7 +4,7 @@ /* */ /* Objects manager (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -35,6 +35,10 @@ #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING #include FT_TRUETYPE_UNPATENTED_H +#endif + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include "ttgxvar.h" #endif /*************************************************************************/ @@ -161,7 +165,7 @@ /* */ FT_LOCAL_DEF( FT_Error ) tt_face_init( FT_Stream stream, - TT_Face face, + FT_Face ttface, /* TT_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) @@ -169,6 +173,7 @@ FT_Error error; FT_Library library; SFNT_Service sfnt; + TT_Face face = (TT_Face)ttface; library = face->root.driver->root.library; @@ -185,8 +190,11 @@ if ( error ) goto Exit; - /* We must also be able to accept Mac/GX fonts, as well as OT ones */ + /* We must also be able to accept Mac/GX fonts, as well as OT ones. */ + /* The 0x00020000 tag is completely undocumented; some fonts from */ + /* Arphic made for Chinese Windows 3.1 have this. */ if ( face->format_tag != 0x00010000L && /* MS fonts */ + face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ face->format_tag != TTAG_true ) /* Mac fonts */ { FT_TRACE2(( "[not a valid TTF font]\n" )); @@ -210,8 +218,11 @@ if ( !face->root.internal->incremental_interface ) error = tt_face_load_loca( face, stream ); if ( !error ) - error = tt_face_load_cvt( face, stream ) || - tt_face_load_fpgm( face, stream ); + { + error = tt_face_load_cvt( face, stream ); + if ( !error ) + error = tt_face_load_fpgm( face, stream ); + } #else @@ -265,8 +276,9 @@ /* face :: A pointer to the face object to destroy. */ /* */ FT_LOCAL_DEF( void ) - tt_face_done( TT_Face face ) + tt_face_done( FT_Face ttface ) /* TT_Face */ { + TT_Face face = (TT_Face)ttface; FT_Memory memory = face->root.memory; FT_Stream stream = face->root.stream; @@ -281,8 +293,7 @@ sfnt->done_face( face ); /* freeing the locations table */ - FT_FREE( face->glyph_locations ); - face->num_locations = 0; + tt_face_done_loca( face ); /* freeing the CVT */ FT_FREE( face->cvt ); @@ -293,6 +304,11 @@ FT_FRAME_RELEASE( face->cvt_program ); face->font_program_size = 0; face->cvt_program_size = 0; + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + tt_done_blend( memory, face->blend ); + face->blend = NULL; +#endif } @@ -318,8 +334,9 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - tt_size_init( TT_Size size ) + tt_size_init( FT_Size ttsize ) /* TT_Size */ { + TT_Size size = (TT_Size)ttsize; FT_Error error = TT_Err_Ok; @@ -476,7 +493,7 @@ Fail_Memory: - tt_size_done( size ); + tt_size_done( ttsize ); return error; #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ @@ -496,8 +513,9 @@ /* size :: A handle to the target size object. */ /* */ FT_LOCAL_DEF( void ) - tt_size_done( TT_Size size ) + tt_size_done( FT_Size ttsize ) /* TT_Size */ { + TT_Size size = (TT_Size)ttsize; #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER @@ -731,33 +749,42 @@ if ( !error ) { + /* XXX: TODO: move this code to the SFNT module where it belongs */ + +#ifdef FT_OPTIMIZE_MEMORY + FT_Byte* strike = face->sbit_table + 8 + strike_index*48; + + sbit_metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */ + sbit_metrics->descender = (FT_Char)strike[17] << 6; /* hori.descender */ + + /* XXX: Is this correct? */ + sbit_metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */ + strike[18] + /* max_width */ + (FT_Char)strike[23] /* min_advance_SB */ + ) << 6; + +#else /* !FT_OPTIMIZE_MEMORY */ + TT_SBit_Strike strike = face->sbit_strikes + strike_index; - sbit_metrics->x_ppem = metrics->x_ppem; - sbit_metrics->y_ppem = metrics->y_ppem; -#if 0 - /* - * sbit_metrics->?_scale - * are not used now. - */ - sbit_metrics->x_scale = 1 << 16; - sbit_metrics->y_scale = 1 << 16; -#endif - sbit_metrics->ascender = strike->hori.ascender << 6; sbit_metrics->descender = strike->hori.descender << 6; - /* XXX: Is this correct? */ - sbit_metrics->height = sbit_metrics->ascender - - sbit_metrics->descender; - /* XXX: Is this correct? */ sbit_metrics->max_advance = ( strike->hori.min_origin_SB + strike->hori.max_width + strike->hori.min_advance_SB ) << 6; - size->strike_index = (FT_UInt)strike_index; +#endif /* !FT_OPTIMIZE_MEMORY */ + + /* XXX: Is this correct? */ + sbit_metrics->height = sbit_metrics->ascender - + sbit_metrics->descender; + + sbit_metrics->x_ppem = metrics->x_ppem; + sbit_metrics->y_ppem = metrics->y_ppem; + size->strike_index = (FT_UInt)strike_index; } else { @@ -842,7 +869,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - tt_driver_init( TT_Driver driver ) + tt_driver_init( FT_Module driver ) /* TT_Driver */ { FT_Error error; @@ -866,9 +893,11 @@ /* driver :: A handle to the target TrueType driver. */ /* */ FT_LOCAL_DEF( void ) - tt_driver_done( TT_Driver driver ) + tt_driver_done( FT_Module ttdriver ) /* TT_Driver */ { #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER + TT_Driver driver = (TT_Driver)ttdriver; + /* destroy the execution context */ if ( driver->context ) @@ -877,7 +906,7 @@ driver->context = NULL; } #else - FT_UNUSED( driver ); + FT_UNUSED( ttdriver ); #endif } diff --git a/src/libs/freetype2/truetype/ttobjs.h b/src/libs/freetype2/truetype/ttobjs.h index 30cf1cb369..423d3f0056 100644 --- a/src/libs/freetype2/truetype/ttobjs.h +++ b/src/libs/freetype2/truetype/ttobjs.h @@ -380,19 +380,28 @@ FT_BEGIN_HEADER } TT_DriverRec; + /* Note: All of the functions below (except tt_size_reset()) are used */ + /* as function pointers in a FT_Driver_ClassRec. Therefore their */ + /* parameters are of types FT_Face, FT_Size, etc., rather than TT_Face, */ + /* TT_Size, etc., so that the compiler can confirm that the types and */ + /* number of parameters are correct. In all cases the FT_xxx types are */ + /* cast to their TT_xxx counterparts inside the functions since FreeType */ + /* will always use the TT driver to create them. */ + + /*************************************************************************/ /* */ /* Face functions */ /* */ FT_LOCAL( FT_Error ) tt_face_init( FT_Stream stream, - TT_Face face, + FT_Face ttface, /* TT_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ); FT_LOCAL( void ) - tt_face_done( TT_Face face ); + tt_face_done( FT_Face ttface ); /* TT_Face */ /*************************************************************************/ @@ -400,10 +409,10 @@ FT_BEGIN_HEADER /* Size functions */ /* */ FT_LOCAL( FT_Error ) - tt_size_init( TT_Size size ); + tt_size_init( FT_Size ttsize ); /* TT_Size */ FT_LOCAL( void ) - tt_size_done( TT_Size size ); + tt_size_done( FT_Size ttsize ); /* TT_Size */ FT_LOCAL( FT_Error ) tt_size_reset( TT_Size size ); @@ -414,10 +423,10 @@ FT_BEGIN_HEADER /* Driver functions */ /* */ FT_LOCAL( FT_Error ) - tt_driver_init( TT_Driver driver ); + tt_driver_init( FT_Module ttdriver ); /* TT_Driver */ FT_LOCAL( void ) - tt_driver_done( TT_Driver driver ); + tt_driver_done( FT_Module ttdriver ); /* TT_Driver */ FT_END_HEADER diff --git a/src/libs/freetype2/truetype/ttpload.c b/src/libs/freetype2/truetype/ttpload.c index 4066cd7c28..b9c83e1a45 100644 --- a/src/libs/freetype2/truetype/ttpload.c +++ b/src/libs/freetype2/truetype/ttpload.c @@ -4,7 +4,7 @@ /* */ /* TrueType glyph data/program tables loader (body). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,6 +24,10 @@ #include "ttpload.h" +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include "ttgxvar.h" +#endif + #include "tterrors.h" @@ -54,6 +58,134 @@ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ +#ifdef FT_OPTIMIZE_MEMORY + + FT_LOCAL_DEF( FT_Error ) + tt_face_load_loca( TT_Face face, + FT_Stream stream ) + { + FT_Error error; + FT_ULong table_len; + + + /* we need the size of the `glyf' table for malformed `loca' tables */ + error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len ); + if ( error ) + goto Exit; + + FT_TRACE2(( "Locations " )); + error = face->goto_table( face, TTAG_loca, stream, &table_len ); + if ( error ) + { + error = TT_Err_Locations_Missing; + goto Exit; + } + + if ( face->header.Index_To_Loc_Format != 0 ) + { + if ( table_len >= 0x40000 ) + { + FT_TRACE2(( "table too large!\n" )); + error = TT_Err_Invalid_Table; + goto Exit; + } + face->num_locations = (FT_UInt)( table_len >> 2 ); + } + else + { + if ( table_len >= 0x20000 ) + { + FT_TRACE2(( "table too large!\n" )); + error = TT_Err_Invalid_Table; + goto Exit; + } + face->num_locations = (FT_UInt)( table_len >> 1 ); + } + + /* + * Extract the frame. We don't need to decompress it since + * we are able to parse it directly. + */ + if ( FT_FRAME_EXTRACT( table_len, face->glyph_locations ) ) + goto Exit; + + FT_TRACE2(( "loaded\n" )); + + Exit: + return error; + } + + + FT_LOCAL_DEF( FT_ULong ) + tt_face_get_location( TT_Face face, + FT_UInt gindex, + FT_UInt *asize ) + { + FT_ULong pos1, pos2; + FT_Byte* p; + FT_Byte* p_limit; + + + pos1 = pos2 = 0; + + if ( gindex < face->num_locations ) + { + if ( face->header.Index_To_Loc_Format != 0 ) + { + p = face->glyph_locations + gindex * 4; + p_limit = face->glyph_locations + face->num_locations * 4; + + pos1 = FT_NEXT_ULONG( p ); + pos2 = pos1; + + if ( p + 4 <= p_limit ) + pos2 = FT_NEXT_ULONG( p ); + } + else + { + p = face->glyph_locations + gindex * 2; + p_limit = face->glyph_locations + face->num_locations * 2; + + pos1 = FT_NEXT_USHORT( p ); + pos2 = pos1; + + if ( p + 2 <= p_limit ) + pos2 = FT_NEXT_USHORT( p ); + + pos1 <<= 1; + pos2 <<= 1; + } + } + + /* It isn't mentioned explicitly that the `loca' table must be */ + /* ordered, but implicitly it refers to the length of an entry */ + /* as the difference between the current and the next position. */ + /* Anyway, there do exist (malformed) fonts which don't obey */ + /* this rule, so we are only able to provide an upper bound for */ + /* the size. */ + if ( pos2 >= pos1 ) + *asize = (FT_UInt)( pos2 - pos1 ); + else + *asize = (FT_UInt)( face->glyf_len - pos1 ); + + return pos1; + } + + + FT_LOCAL_DEF( void ) + tt_face_done_loca( TT_Face face ) + { + FT_Stream stream = face->root.stream; + + + FT_FRAME_RELEASE( face->glyph_locations ); + face->num_locations = 0; + } + + +#else /* !FT_OPTIMIZE_MEMORY */ + + FT_LOCAL_DEF( FT_Error ) tt_face_load_loca( TT_Face face, FT_Stream stream ) @@ -64,6 +196,11 @@ FT_ULong table_len; + /* we need the size of the `glyf' table for malformed `loca' tables */ + error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len ); + if ( error ) + goto Exit; + FT_TRACE2(( "Locations " )); LongOffsets = face->header.Index_To_Loc_Format; @@ -108,6 +245,7 @@ if ( FT_FRAME_ENTER( face->num_locations * 2L ) ) goto Exit; + { FT_Long* loc = face->glyph_locations; FT_Long* limit = loc + face->num_locations; @@ -116,6 +254,7 @@ for ( ; loc < limit; loc++ ) *loc = (FT_Long)( (FT_ULong)FT_GET_USHORT() * 2 ); } + FT_FRAME_EXIT(); } @@ -126,6 +265,54 @@ } + FT_LOCAL_DEF( FT_ULong ) + tt_face_get_location( TT_Face face, + FT_UInt gindex, + FT_UInt *asize ) + { + FT_ULong offset; + FT_UInt count; + + + offset = face->glyph_locations[gindex]; + count = 0; + + if ( gindex < (FT_UInt)face->num_locations - 1 ) + { + FT_ULong offset1 = face->glyph_locations[gindex + 1]; + + + /* It isn't mentioned explicitly that the `loca' table must be */ + /* ordered, but implicitly it refers to the length of an entry */ + /* as the difference between the current and the next position. */ + /* Anyway, there do exist (malformed) fonts which don't obey */ + /* this rule, so we are only able to provide an upper bound for */ + /* the size. */ + if ( offset1 >= offset ) + count = (FT_UInt)( offset1 - offset ); + else + count = (FT_UInt)( face->glyf_len - offset ); + } + + *asize = count; + return offset; + } + + + FT_LOCAL_DEF( void ) + tt_face_done_loca( TT_Face face ) + { + FT_Memory memory = face->root.memory; + + + FT_FREE( face->glyph_locations ); + face->num_locations = 0; + } + + +#endif /* !FT_OPTIMIZE_MEMORY */ + + /*************************************************************************/ /* */ /* <Function> */ @@ -147,6 +334,8 @@ tt_face_load_cvt( TT_Face face, FT_Stream stream ) { +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER + FT_Error error; FT_Memory memory = stream->memory; FT_ULong table_len; @@ -186,8 +375,22 @@ FT_FRAME_EXIT(); FT_TRACE2(( "loaded\n" )); +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + if ( face->doblend ) + error = tt_face_vary_cvt( face, stream ); +#endif + Exit: return error; + +#else /* !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ + + FT_UNUSED( face ); + FT_UNUSED( stream ); + + return TT_Err_Ok; + +#endif } @@ -212,6 +415,8 @@ tt_face_load_fpgm( TT_Face face, FT_Stream stream ) { +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER + FT_Error error; FT_ULong table_len; @@ -258,6 +463,15 @@ Exit: return error; + +#else /* !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ + + FT_UNUSED( face ); + FT_UNUSED( stream ); + + return TT_Err_Ok; + +#endif } diff --git a/src/libs/freetype2/truetype/ttpload.h b/src/libs/freetype2/truetype/ttpload.h index 3f8cd64ff7..2acb4b360a 100644 --- a/src/libs/freetype2/truetype/ttpload.h +++ b/src/libs/freetype2/truetype/ttpload.h @@ -4,7 +4,7 @@ /* */ /* TrueType glyph data/program tables loader (specification). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,6 +31,14 @@ FT_BEGIN_HEADER tt_face_load_loca( TT_Face face, FT_Stream stream ); + FT_LOCAL( FT_ULong ) + tt_face_get_location( TT_Face face, + FT_UInt gindex, + FT_UInt *asize ); + + FT_LOCAL( void ) + tt_face_done_loca( TT_Face face ); + FT_LOCAL( FT_Error ) tt_face_load_cvt( TT_Face face, FT_Stream stream ); diff --git a/src/libs/freetype2/type1/t1afm.c b/src/libs/freetype2/type1/t1afm.c index 9945ebdf6d..bef8251e19 100644 --- a/src/libs/freetype2/type1/t1afm.c +++ b/src/libs/freetype2/type1/t1afm.c @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,6 +18,7 @@ #include <ft2build.h> #include "t1afm.h" +#include "t1errors.h" #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_TYPE1_TYPES_H @@ -33,8 +34,8 @@ FT_LOCAL_DEF( void ) - T1_Done_AFM( FT_Memory memory, - T1_AFM* afm ) + T1_Done_Metrics( FT_Memory memory, + T1_AFM* afm ) { FT_FREE( afm->kern_pairs ); afm->num_pairs = 0; @@ -63,13 +64,13 @@ /* skip whitespace */ - while ( ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' ) && - p < limit ) + while ( p < limit && + ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' ) ) p++; *start = p; /* now, read glyph name */ - while ( IS_ALPHANUM( *p ) && p < limit ) + while ( p < limit && IS_ALPHANUM( *p ) ) p++; len = p - *start; @@ -153,11 +154,11 @@ /* parse an AFM file -- for now, only read the kerning pairs */ - FT_LOCAL_DEF( FT_Error ) + static FT_Error T1_Read_AFM( FT_Face t1_face, FT_Stream stream ) { - FT_Error error; + FT_Error error = T1_Err_Ok; FT_Memory memory = stream->memory; FT_Byte* start; FT_Byte* limit; @@ -168,9 +169,6 @@ T1_AFM* afm = 0; - if ( FT_FRAME_ENTER( stream->size ) ) - return error; - start = (FT_Byte*)stream->cursor; limit = (FT_Byte*)stream->limit; p = start; @@ -233,6 +231,173 @@ if ( error ) FT_FREE( afm ); + return error; + } + + +#define LITTLE_ENDIAN_USHORT( p ) (FT_UShort)( ( (p)[0] ) | \ + ( (p)[1] << 8 ) ) + +#define LITTLE_ENDIAN_UINT( p ) (FT_UInt)( ( (p)[0] ) | \ + ( (p)[1] << 8 ) | \ + ( (p)[2] << 16 ) | \ + ( (p)[3] << 24 ) ) + + + /* parse a PFM file -- for now, only read the kerning pairs */ + static FT_Error + T1_Read_PFM( FT_Face t1_face, + FT_Stream stream ) + { + FT_Error error = T1_Err_Ok; + FT_Memory memory = stream->memory; + FT_Byte* start; + FT_Byte* limit; + FT_Byte* p; + FT_Int kern_count = 0; + T1_Kern_Pair* pair; + T1_AFM* afm = 0; + FT_Int width_table_length; + FT_CharMap oldcharmap; + FT_CharMap charmap; + FT_Int n; + + + start = (FT_Byte*)stream->cursor; + limit = (FT_Byte*)stream->limit; + p = start; + + /* Figure out how long the width table is. */ + /* This info is a little-endian short at offset 99. */ + p = start + 99; + if ( p + 2 > limit ) + { + error = T1_Err_Unknown_File_Format; + goto Exit; + } + width_table_length = LITTLE_ENDIAN_USHORT( p ); + + p += 18 + width_table_length; + if ( p + 0x12 > limit || LITTLE_ENDIAN_USHORT( p ) < 0x12 ) + /* extension table is probably optional */ + goto Exit; + + /* Kerning offset is 14 bytes from start of extensions table. */ + p += 14; + p = start + LITTLE_ENDIAN_UINT( p ); + if ( p + 2 > limit ) + { + error = T1_Err_Unknown_File_Format; + goto Exit; + } + + kern_count = LITTLE_ENDIAN_USHORT( p ); + p += 2; + if ( p + 4 * kern_count > limit ) + { + error = T1_Err_Unknown_File_Format; + goto Exit; + } + + /* Actually, kerning pairs are simply optional! */ + if ( kern_count == 0 ) + goto Exit; + + /* allocate the pairs */ + if ( FT_NEW( afm ) || FT_NEW_ARRAY( afm->kern_pairs, kern_count ) ) + goto Exit; + + /* save in face object */ + ((T1_Face)t1_face)->afm_data = afm; + + t1_face->face_flags |= FT_FACE_FLAG_KERNING; + + /* now, read each kern pair */ + pair = afm->kern_pairs; + afm->num_pairs = kern_count; + limit = p + 4 * kern_count; + + /* PFM kerning data are stored by encoding rather than glyph index, */ + /* so find the PostScript charmap of this font and install it */ + /* temporarily. If we find no PostScript charmap, then just use */ + /* the default and hope it is the right one. */ + oldcharmap = t1_face->charmap; + charmap = NULL; + + for ( n = 0; n < t1_face->num_charmaps; n++ ) + { + charmap = t1_face->charmaps[n]; + /* check against PostScript pseudo platform */ + if ( charmap->platform_id == 7 ) + { + error = FT_Set_Charmap( t1_face, charmap ); + if ( error ) + goto Exit; + break; + } + } + + /* Kerning info is stored as: */ + /* */ + /* encoding of first glyph (1 byte) */ + /* encoding of second glyph (1 byte) */ + /* offset (little-endian short) */ + for ( ; p < limit ; p+=4 ) + { + pair->glyph1 = FT_Get_Char_Index( t1_face, p[0] ); + pair->glyph2 = FT_Get_Char_Index( t1_face, p[1] ); + + pair->kerning.x = (FT_Short)LITTLE_ENDIAN_USHORT(p + 2); + pair->kerning.y = 0; + + pair++; + } + + if ( oldcharmap != NULL ) + error = FT_Set_Charmap( t1_face, oldcharmap ); + if ( error ) + goto Exit; + + /* now, sort the kern pairs according to their glyph indices */ + ft_qsort( afm->kern_pairs, kern_count, sizeof ( T1_Kern_Pair ), + compare_kern_pairs ); + + Exit: + if ( error ) + FT_FREE( afm ); + + return error; + } + + + /* parse a metrics file -- either AFM or PFM depending on what */ + /* it turns out to be */ + FT_LOCAL_DEF( FT_Error ) + T1_Read_Metrics( FT_Face t1_face, + FT_Stream stream ) + { + FT_Error error; + FT_Byte* start; + + + if ( FT_FRAME_ENTER( stream->size ) ) + return error; + + start = (FT_Byte*)stream->cursor; + + if ( stream->size >= ft_strlen( "StartFontMetrics" ) && + ft_strncmp( (const char*)start, "StartFontMetrics", + ft_strlen( "StartFontMetrics" ) ) == 0 ) + error = T1_Read_AFM( t1_face, stream ); + + else if ( stream->size > 6 && + start[0] == 0x00 && start[1] == 0x01 && + LITTLE_ENDIAN_UINT( start + 2 ) == stream->size ) + error = T1_Read_PFM( t1_face, stream ); + + else + error = T1_Err_Unknown_File_Format; + FT_FRAME_EXIT(); return error; diff --git a/src/libs/freetype2/type1/t1afm.h b/src/libs/freetype2/type1/t1afm.h index 77cc6a6e95..5aaeb67a74 100644 --- a/src/libs/freetype2/type1/t1afm.h +++ b/src/libs/freetype2/type1/t1afm.h @@ -44,12 +44,12 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - T1_Read_AFM( FT_Face face, - FT_Stream stream ); + T1_Read_Metrics( FT_Face face, + FT_Stream stream ); FT_LOCAL( void ) - T1_Done_AFM( FT_Memory memory, - T1_AFM* afm ); + T1_Done_Metrics( FT_Memory memory, + T1_AFM* afm ); FT_LOCAL( void ) T1_Get_Kerning( T1_AFM* afm, diff --git a/src/libs/freetype2/type1/t1driver.c b/src/libs/freetype2/type1/t1driver.c index fd201db8e3..dbcdb2a5f9 100644 --- a/src/libs/freetype2/type1/t1driver.c +++ b/src/libs/freetype2/type1/t1driver.c @@ -4,7 +4,7 @@ /* */ /* Type 1 driver interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -129,9 +129,11 @@ #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT static const FT_Service_MultiMastersRec t1_service_multi_masters = { - (FT_Get_MM_Func) T1_Get_Multi_Master, - (FT_Set_MM_Design_Func)T1_Set_MM_Design, - (FT_Set_MM_Blend_Func) T1_Set_MM_Blend + (FT_Get_MM_Func) T1_Get_Multi_Master, + (FT_Set_MM_Design_Func) T1_Set_MM_Design, + (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, + (FT_Get_MM_Var_Func) T1_Get_MM_Var, + (FT_Set_Var_Design_Func)T1_Set_Var_Design }; #endif @@ -158,10 +160,20 @@ } + static FT_Error + t1_ps_get_font_private( FT_Face face, + PS_PrivateRec* afont_private ) + { + *afont_private = ((T1_Face)face)->type1.private_dict; + return 0; + } + + static const FT_Service_PsInfoRec t1_service_ps_info = { - (PS_GetFontInfoFunc) t1_ps_get_font_info, - (PS_HasGlyphNamesFunc)t1_ps_has_glyph_names + (PS_GetFontInfoFunc) t1_ps_get_font_info, + (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names, + (PS_GetFontPrivateFunc)t1_ps_get_font_private, }; @@ -292,7 +304,7 @@ (FT_Face_AttachFunc) 0, #else (FT_Face_GetKerningFunc) Get_Kerning, - (FT_Face_AttachFunc) T1_Read_AFM, + (FT_Face_AttachFunc) T1_Read_Metrics, #endif (FT_Face_GetAdvancesFunc) 0 }; diff --git a/src/libs/freetype2/type1/t1gload.c b/src/libs/freetype2/type1/t1gload.c index 98f8194b97..f45a83b406 100644 --- a/src/libs/freetype2/type1/t1gload.c +++ b/src/libs/freetype2/type1/t1gload.c @@ -60,7 +60,7 @@ { T1_Face face = (T1_Face)decoder->builder.face; T1_Font type1 = &face->type1; - FT_Error error = 0; + FT_Error error = T1_Err_Ok; decoder->font_matrix = type1->font_matrix; diff --git a/src/libs/freetype2/type1/t1load.c b/src/libs/freetype2/type1/t1load.c index 16a0341554..2080a76674 100644 --- a/src/libs/freetype2/type1/t1load.c +++ b/src/libs/freetype2/type1/t1load.c @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -211,6 +211,159 @@ } +#define FT_INT_TO_FIXED( a ) ( (a) << 16 ) +#define FT_FIXED_TO_INT( a ) ( FT_RoundFix( a ) >> 16 ) + + + /*************************************************************************/ + /* */ + /* Given a normalized (blend) coordinate, figure out the design */ + /* coordinate appropriate for that value. */ + /* */ + FT_LOCAL_DEF( FT_Fixed ) + mm_axis_unmap( PS_DesignMap axismap, + FT_Fixed ncv ) + { + int j; + + + if ( ncv <= axismap->blend_points[0] ) + return axismap->design_points[0]; + + for ( j = 1; j < axismap->num_points; ++j ) + { + if ( ncv <= axismap->blend_points[j] ) + { + FT_Fixed t = FT_MulDiv( ncv - axismap->blend_points[j - 1], + 0x10000L, + axismap->blend_points[j] - + axismap->blend_points[j - 1] ); + + + return axismap->design_points[j - 1] + + FT_MulDiv( t, + axismap->design_points[j] - + axismap->design_points[j - 1], + 1L ); + } + } + + return axismap->design_points[axismap->num_points - 1]; + } + + + /*************************************************************************/ + /* */ + /* Given a vector of weights, one for each design, figure out the */ + /* normalized axis coordinates which gave rise to those weights. */ + /* */ + FT_LOCAL_DEF( void ) + mm_weights_unmap( FT_Fixed* weights, + FT_Fixed* axiscoords, + FT_UInt axis_count ) + { + FT_ASSERT( axis_count <= T1_MAX_MM_AXIS ); + + if ( axis_count == 1 ) + axiscoords[0] = weights[1]; + + else if ( axis_count == 2 ) + { + axiscoords[0] = weights[3] + weights[1]; + axiscoords[1] = weights[3] + weights[2]; + } + + else if ( axis_count == 3 ) + { + axiscoords[0] = weights[7] + weights[5] + weights[3] + weights[1]; + axiscoords[1] = weights[7] + weights[6] + weights[3] + weights[2]; + axiscoords[2] = weights[7] + weights[6] + weights[5] + weights[4]; + } + + else + { + axiscoords[0] = weights[15] + weights[13] + weights[11] + weights[9] + + weights[7] + weights[5] + weights[3] + weights[1]; + axiscoords[1] = weights[15] + weights[14] + weights[11] + weights[10] + + weights[7] + weights[6] + weights[3] + weights[2]; + axiscoords[2] = weights[15] + weights[14] + weights[13] + weights[12] + + weights[7] + weights[6] + weights[5] + weights[4]; + axiscoords[3] = weights[15] + weights[14] + weights[13] + weights[12] + + weights[11] + weights[10] + weights[9] + weights[8]; + } + } + + + /*************************************************************************/ + /* */ + /* Just a wrapper around T1_Get_Multi_Master to support the different */ + /* arguments needed by the GX var distortable fonts. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + T1_Get_MM_Var( T1_Face face, + FT_MM_Var* *master ) + { + FT_Memory memory = face->root.memory; + FT_MM_Var *mmvar; + FT_Multi_Master mmaster; + FT_Error error; + FT_UInt i; + FT_Fixed axiscoords[T1_MAX_MM_AXIS]; + PS_Blend blend = face->blend; + + + error = T1_Get_Multi_Master( face, &mmaster ); + if ( error ) + goto Exit; + if ( FT_ALLOC( mmvar, + sizeof ( FT_MM_Var ) + + mmaster.num_axis * sizeof ( FT_Var_Axis ) ) ) + goto Exit; + + mmvar->num_axis = mmaster.num_axis; + mmvar->num_designs = mmaster.num_designs; + mmvar->num_namedstyles = (FT_UInt)-1; /* Does not apply */ + mmvar->axis = (FT_Var_Axis*)&mmvar[1]; + /* Point to axes after MM_Var struct */ + mmvar->namedstyle = NULL; + + for ( i = 0 ; i < mmaster.num_axis; ++i ) + { + mmvar->axis[i].name = mmaster.axis[i].name; + mmvar->axis[i].minimum = FT_INT_TO_FIXED( mmaster.axis[i].minimum); + mmvar->axis[i].maximum = FT_INT_TO_FIXED( mmaster.axis[i].maximum); + mmvar->axis[i].def = ( mmvar->axis[i].minimum + + mmvar->axis[i].maximum ) / 2; + /* Does not apply. But this value is in range */ + mmvar->axis[i].strid = 0xFFFFFFFFLU; /* Does not apply */ + mmvar->axis[i].tag = 0xFFFFFFFFLU; /* Does not apply */ + + if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 ) + mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' ); + else if ( ft_strcmp( mmvar->axis[i].name, "Width" ) == 0 ) + mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'd', 't', 'h' ); + else if ( ft_strcmp( mmvar->axis[i].name, "OpticalSize" ) == 0 ) + mmvar->axis[i].tag = FT_MAKE_TAG( 'o', 'p', 's', 'z' ); + } + + if ( blend->num_designs == 1U << blend->num_axis ) + { + mm_weights_unmap( blend->default_weight_vector, + axiscoords, + blend->num_axis ); + + for ( i = 0; i < mmaster.num_axis; ++i ) + mmvar->axis[i].def = mm_axis_unmap( &blend->design_map[i], + axiscoords[i] ); + } + + *master = mmvar; + + Exit: + return error; + } + + FT_LOCAL_DEF( FT_Error ) T1_Set_MM_Blend( T1_Face face, FT_UInt num_coords, @@ -280,14 +433,14 @@ FT_Long design = coords[n]; FT_Fixed the_blend; PS_DesignMap map = blend->design_map + n; - FT_Fixed* designs = map->design_points; + FT_Long* designs = map->design_points; FT_Fixed* blends = map->blend_points; FT_Int before = -1, after = -1; for ( p = 0; p < (FT_UInt)map->num_points; p++ ) { - FT_Fixed p_design = designs[p]; + FT_Long p_design = designs[p]; /* exact match? */ @@ -329,6 +482,33 @@ } + /*************************************************************************/ + /* */ + /* Just a wrapper around T1_Set_MM_Design to support the different */ + /* arguments needed by the GX var distortable fonts. */ + /* */ + FT_LOCAL_DEF( FT_Error ) + T1_Set_Var_Design( T1_Face face, + FT_UInt num_coords, + FT_Fixed* coords ) + { + FT_Long lcoords[4]; /* maximum axis count is 4 */ + FT_UInt i; + FT_Error error; + + + error = T1_Err_Invalid_Argument; + if ( num_coords <= 4 && num_coords > 0 ) + { + for ( i = 0; i < num_coords; ++i ) + lcoords[i] = FT_FIXED_TO_INT( coords[i] ); + error = T1_Set_MM_Design( face, num_coords, lcoords ); + } + + return error; + } + + FT_LOCAL_DEF( void ) T1_Done_Blend( T1_Face face ) { @@ -828,7 +1008,7 @@ *base = parser->root.cursor + 1; parser->root.cursor += *size + 1; - return 1; + return !parser->root.error; } FT_ERROR(( "read_binary_data: invalid size field\n" )); @@ -1022,6 +1202,8 @@ parser->root.cursor = cur; T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + return; len = parser->root.cursor - cur; @@ -1097,7 +1279,9 @@ /* position the parser right before the `dup' of the first subr */ T1_Skip_PS_Token( parser ); /* `array' */ - T1_Skip_Spaces ( parser ); + if ( parser->root.error ) + return; + T1_Skip_Spaces( parser ); /* initialize subrs array -- with synthetic fonts it is possible */ /* we get here twice */ @@ -1135,6 +1319,8 @@ /* `noaccess' & `put'. We position the parser right */ /* before the next `dup', if any. */ T1_Skip_PS_Token( parser ); /* `NP' or `|' or `noaccess' */ + if ( parser->root.error ) + return; T1_Skip_Spaces ( parser ); if ( ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) @@ -1262,7 +1448,20 @@ if ( cur[0] == 'd' && cur[1] == 'e' && cur[2] == 'f' ) - break; + { + /* There are fonts which have this: */ + /* */ + /* /CharStrings 118 dict def */ + /* Private begin */ + /* CharStrings begin */ + /* ... */ + /* */ + /* To catch this we ignore `def' if */ + /* no charstring has actually been */ + /* seen. */ + if ( n ) + break; + } if ( cur[0] == 'e' && cur[1] == 'n' && @@ -1271,6 +1470,8 @@ } T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + return; if ( *cur == '/' ) { @@ -1543,7 +1744,9 @@ break; T1_Skip_PS_Token( parser ); - T1_Skip_Spaces ( parser ); + if ( parser->root.error ) + goto Exit; + T1_Skip_Spaces( parser ); cur = parser->root.cursor; } @@ -1579,6 +1782,8 @@ { start_binary = cur; T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + goto Exit; have_integer = 1; } @@ -1621,6 +1826,8 @@ parser->root.cursor = cur; T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + goto Exit; len = parser->root.cursor - cur; @@ -1640,9 +1847,9 @@ if ( !name ) break; - if ( cur[0] == name[0] && - len == ft_strlen( (const char *)name ) && - ft_memcmp( cur, name, len ) == 0 ) + if ( cur[0] == name[0] && + len == (FT_PtrDist)ft_strlen( (const char *)name ) && + ft_memcmp( cur, name, len ) == 0 ) { /* We found it -- run the parsing callback! */ /* We only record the first instance of any */ diff --git a/src/libs/freetype2/type1/t1load.h b/src/libs/freetype2/type1/t1load.h index 804a010450..9823f53e0b 100644 --- a/src/libs/freetype2/type1/t1load.h +++ b/src/libs/freetype2/type1/t1load.h @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (specification). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -60,6 +60,10 @@ FT_BEGIN_HEADER T1_Get_Multi_Master( T1_Face face, FT_Multi_Master* master ); + FT_LOCAL_DEF( FT_Error ) + T1_Get_MM_Var( T1_Face face, + FT_MM_Var* *master ); + FT_LOCAL( FT_Error ) T1_Set_MM_Blend( T1_Face face, FT_UInt num_coords, @@ -70,6 +74,11 @@ FT_BEGIN_HEADER FT_UInt num_coords, FT_Long* coords ); + FT_LOCAL_DEF( FT_Error ) + T1_Set_Var_Design( T1_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); + FT_LOCAL( void ) T1_Done_Blend( T1_Face face ); diff --git a/src/libs/freetype2/type1/t1objs.c b/src/libs/freetype2/type1/t1objs.c index a832ee0002..519fa08d9c 100644 --- a/src/libs/freetype2/type1/t1objs.c +++ b/src/libs/freetype2/type1/t1objs.c @@ -233,7 +233,7 @@ #ifndef T1_CONFIG_OPTION_NO_AFM /* release afm data if present */ if ( face->afm_data ) - T1_Done_AFM( memory, (T1_AFM*)face->afm_data ); + T1_Done_Metrics( memory, (T1_AFM*)face->afm_data ); #endif /* release unicode map, if any */ diff --git a/src/libs/freetype2/type1/t1parse.c b/src/libs/freetype2/type1/t1parse.c index 544aa093f8..db1a613cbb 100644 --- a/src/libs/freetype2/type1/t1parse.c +++ b/src/libs/freetype2/type1/t1parse.c @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -93,6 +93,41 @@ } + static FT_Error + check_type1_format( FT_Stream stream, + const char* header_string, + size_t header_length ) + { + FT_Error error; + FT_UShort tag; + FT_Long size; + + + if ( FT_STREAM_SEEK( 0 ) ) + goto Exit; + + error = read_pfb_tag( stream, &tag, &size ); + if ( error ) + goto Exit; + + if ( tag != 0x8001U && FT_STREAM_SEEK( 0 ) ) + goto Exit; + + if ( !FT_FRAME_ENTER( header_length ) ) + { + error = 0; + + if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 ) + error = T1_Err_Unknown_File_Format; + + FT_FRAME_EXIT(); + } + + Exit: + return error; + } + + FT_LOCAL_DEF( FT_Error ) T1_New_Parser( T1_Parser parser, FT_Stream stream, @@ -115,6 +150,21 @@ parser->in_memory = 0; parser->single_block = 0; + /* check the header format */ + error = check_type1_format( stream, "%!PS-AdobeFont", 14 ); + if ( error ) + { + if ( error != T1_Err_Unknown_File_Format ) + goto Exit; + + error = check_type1_format( stream, "%!FontType", 10 ); + if ( error ) + { + FT_TRACE2(( "[not a Type1 font]\n" )); + goto Exit; + } + } + /******************************************************************/ /* */ /* Here a short summary of what is going on: */ @@ -167,32 +217,16 @@ } else { - /* read segment in memory */ - if ( FT_ALLOC( parser->base_dict, size ) || + /* read segment in memory - this is clumsy, but so does the format */ + if ( FT_ALLOC( parser->base_dict, size ) || FT_STREAM_READ( parser->base_dict, size ) ) goto Exit; parser->base_len = size; } - /* Now check font format; we must see `%!PS-AdobeFont-1' */ - /* or `%!FontType' */ - { - if ( size <= 16 || - ( ft_strncmp( (const char*)parser->base_dict, - "%!PS-AdobeFont-1", 16 ) && - ft_strncmp( (const char*)parser->base_dict, - "%!FontType", 10 ) ) ) - { - FT_TRACE2(( "[not a Type1 font]\n" )); - error = T1_Err_Unknown_File_Format; - } - else - { - parser->root.base = parser->base_dict; - parser->root.cursor = parser->base_dict; - parser->root.limit = parser->root.cursor + parser->base_len; - } - } + parser->root.base = parser->base_dict; + parser->root.cursor = parser->base_dict; + parser->root.limit = parser->root.cursor + parser->base_len; Exit: if ( error && !parser->in_memory ) @@ -337,6 +371,8 @@ goto Found; T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + break; T1_Skip_Spaces ( parser ); cur = parser->root.cursor; } diff --git a/src/libs/freetype2/type42/t42drivr.c b/src/libs/freetype2/type42/t42drivr.c index 2afe2db84b..c87c3f2aa5 100644 --- a/src/libs/freetype2/type42/t42drivr.c +++ b/src/libs/freetype2/type42/t42drivr.c @@ -139,7 +139,7 @@ PS_FontInfoRec* afont_info ) { *afont_info = ((T42_Face)face)->type1.font_info; - return 0; + return T42_Err_Ok; } @@ -151,10 +151,20 @@ } + static FT_Error + t42_ps_get_font_private( FT_Face face, + PS_PrivateRec* afont_private ) + { + *afont_private = ((T42_Face)face)->type1.private_dict; + return T42_Err_Ok; + } + + static const FT_Service_PsInfoRec t42_service_ps_info = { - (PS_GetFontInfoFunc) t42_ps_get_font_info, - (PS_HasGlyphNamesFunc)t42_ps_has_glyph_names + (PS_GetFontInfoFunc) t42_ps_get_font_info, + (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names, + (PS_GetFontPrivateFunc)t42_ps_get_font_private }; diff --git a/src/libs/freetype2/type42/t42objs.c b/src/libs/freetype2/type42/t42objs.c index 8837136ff2..d51a91cd51 100644 --- a/src/libs/freetype2/type42/t42objs.c +++ b/src/libs/freetype2/type42/t42objs.c @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (body). */ /* */ -/* Copyright 2002, 2003, 2004 by Roberto Alameda. */ +/* Copyright 2002, 2003, 2004, 2005 by Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -515,21 +515,7 @@ FT_LOCAL_DEF( void ) T42_GlyphSlot_Done( T42_GlyphSlot slot ) { - FT_Face face = slot->root.face; - T42_Face t42face = (T42_Face)face; - FT_GlyphSlot cur = t42face->ttf_face->glyph; - - - while ( cur ) - { - if ( cur == slot->ttslot ) - { - FT_Done_GlyphSlot( slot->ttslot ); - break; - } - - cur = cur->next; - } + FT_Done_GlyphSlot( slot->ttslot ); } diff --git a/src/libs/freetype2/type42/t42parse.c b/src/libs/freetype2/type42/t42parse.c index ff53a3eb44..80e7547b90 100644 --- a/src/libs/freetype2/type42/t42parse.c +++ b/src/libs/freetype2/type42/t42parse.c @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (body). */ /* */ -/* Copyright 2002, 2003, 2004 by Roberto Alameda. */ +/* Copyright 2002, 2003, 2004, 2005 by Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -159,7 +159,19 @@ /* parser->in_memory is set if we have a memory stream. */ /* */ - if ( FT_STREAM_SEEK( 0L ) ) + if ( FT_STREAM_SEEK( 0L ) || + FT_FRAME_ENTER( 17 ) ) + goto Exit; + + if ( ft_memcmp( stream->cursor, "%!PS-TrueTypeFont", 17 ) != 0 ) + { + FT_TRACE2(( "not a Type42 font\n" )); + error = T42_Err_Unknown_File_Format; + } + + FT_FRAME_EXIT(); + + if ( error || FT_STREAM_SEEK( 0 ) ) goto Exit; size = stream->size; @@ -188,17 +200,9 @@ parser->base_len = size; } - /* Now check font format; we must see `%!PS-TrueTypeFont' */ - if ( size <= 17 || - ( ft_strncmp( (const char*)parser->base_dict, - "%!PS-TrueTypeFont", 17 ) ) ) - error = T42_Err_Unknown_File_Format; - else - { - parser->root.base = parser->base_dict; - parser->root.cursor = parser->base_dict; - parser->root.limit = parser->root.cursor + parser->base_len; - } + parser->root.base = parser->base_dict; + parser->root.cursor = parser->base_dict; + parser->root.limit = parser->root.cursor + parser->base_len; Exit: if ( error && !parser->in_memory ) @@ -412,14 +416,16 @@ parser->root.cursor = cur; T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + return; len = parser->root.cursor - cur; parser->root.error = T1_Add_Table( char_table, charcode, cur, len + 1 ); - char_table->elements[charcode][len] = '\0'; if ( parser->root.error ) return; + char_table->elements[charcode][len] = '\0'; n++; } @@ -550,6 +556,8 @@ string_size = T1_ToInt( parser ); T1_Skip_PS_Token( parser ); /* `RD' */ + if ( parser->root.error ) + return; string_buf = parser->root.cursor + 1; /* one space after `RD' */ @@ -691,6 +699,8 @@ T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + return; T1_Skip_Spaces( parser ); cur = parser->root.cursor; @@ -705,6 +715,8 @@ break; } T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + return; T1_Skip_Spaces( parser ); } } @@ -767,6 +779,8 @@ break; T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + return; if ( *cur == '/' ) { @@ -1003,6 +1017,8 @@ break; T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + goto Exit; T1_Skip_Spaces ( parser ); cur = parser->root.cursor; } @@ -1033,6 +1049,8 @@ parser->root.cursor = cur; T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + goto Exit; len = parser->root.cursor - cur; @@ -1053,9 +1071,9 @@ if ( !name ) continue; - if ( cur[0] == name[0] && - len == ft_strlen( (const char *)name ) && - ft_memcmp( cur, name, len ) == 0 ) + if ( cur[0] == name[0] && + len == (FT_PtrDist)ft_strlen( (const char *)name ) && + ft_memcmp( cur, name, len ) == 0 ) { /* we found it -- run the parsing callback! */ parser->root.error = t42_load_keyword( face, @@ -1069,11 +1087,16 @@ } } else + { T1_Skip_PS_Token( parser ); + if ( parser->root.error ) + goto Exit; + } T1_Skip_Spaces( parser ); } + Exit: return parser->root.error; } diff --git a/src/libs/freetype2/winfonts/winfnt.c b/src/libs/freetype2/winfonts/winfnt.c index 26e4930654..92174aedb0 100644 --- a/src/libs/freetype2/winfonts/winfnt.c +++ b/src/libs/freetype2/winfonts/winfnt.c @@ -466,12 +466,8 @@ bsize->height = (FT_Short)( font->header.pixel_height + font->header.external_leading ); bsize->size = font->header.nominal_point_size << 6; - bsize->x_ppem = - (FT_Pos)( ( font->header.horizontal_resolution * bsize->size + 36 ) - / 72 ); - bsize->y_ppem = - (FT_Pos)( ( font->header.vertical_resolution* bsize->size + 36 ) - / 72 ); + bsize->x_ppem = font->header.pixel_width << 6; + bsize->y_ppem = font->header.pixel_height << 6; } { @@ -553,7 +549,7 @@ FT_Face root = FT_FACE( face ); - if ( size->metrics.y_ppem == root->available_sizes->height ) + if ( size->metrics.y_ppem == root->available_sizes->y_ppem >> 6 ) { FNT_Font font = face->font; @@ -658,6 +654,8 @@ slot->format = FT_GLYPH_FORMAT_BITMAP; /* now set up metrics */ + slot->metrics.width = bitmap->width << 6; + slot->metrics.height = bitmap->rows << 6; slot->metrics.horiAdvance = bitmap->width << 6; slot->metrics.horiBearingX = 0; slot->metrics.horiBearingY = slot->bitmap_top << 6;