Index: xc/ChangeLog =================================================================== RCS file: /cvs/xorg/xc/ChangeLog,v retrieving revision 1.798 diff -u -2 -0 -r1.798 ChangeLog --- xc/ChangeLog 6 Mar 2005 01:39:31 -0000 1.798 +++ xc/ChangeLog 7 Mar 2005 18:52:58 -0000 @@ -1,20 +1,135 @@ +2005-03-07 Roland Mainz + * xc/config/cf/X11.tmpl + * xc/extras/freetype2/ChangeLog + * xc/extras/freetype2/Jamfile + * xc/extras/freetype2/README + * xc/extras/freetype2/builds/freetype.mk + * xc/extras/freetype2/builds/unix/configure + * xc/extras/freetype2/builds/unix/configure.ac + * xc/extras/freetype2/builds/win32/visualc/freetype.dsp + * xc/extras/freetype2/builds/win32/visualc/freetype.vcproj + * xc/extras/freetype2/builds/win32/visualc/index.html + * xc/extras/freetype2/devel/ftoption.h + * xc/extras/freetype2/docs/CHANGES + * xc/extras/freetype2/docs/VERSION.DLL + * xc/extras/freetype2/docs/formats.txt + * xc/extras/freetype2/include/freetype/cache/ftcmru.h + * xc/extras/freetype2/include/freetype/config/ftmodule.h + * xc/extras/freetype2/include/freetype/config/ftoption.h + * xc/extras/freetype2/include/freetype/freetype.h + * xc/extras/freetype2/include/freetype/ftcache.h + * xc/extras/freetype2/include/freetype/ftmm.h + * xc/extras/freetype2/include/freetype/internal/ftmemory.h + * xc/extras/freetype2/include/freetype/internal/ftstream.h + * xc/extras/freetype2/include/freetype/internal/fttrace.h + * xc/extras/freetype2/include/freetype/internal/psaux.h + * xc/extras/freetype2/include/freetype/internal/services/svmm.h + * xc/extras/freetype2/include/freetype/internal/tttypes.h + * xc/extras/freetype2/include/freetype/t1tables.h + * xc/extras/freetype2/include/freetype/tttables.h + * xc/extras/freetype2/include/freetype/tttags.h + * xc/extras/freetype2/src/autofit/afangles.c + * xc/extras/freetype2/src/autofit/afdummy.c + * xc/extras/freetype2/src/autofit/afglobal.c + * xc/extras/freetype2/src/autofit/afhints.c + * xc/extras/freetype2/src/autofit/afhints.h + * xc/extras/freetype2/src/autofit/aflatin.c + * xc/extras/freetype2/src/autofit/aflatin.h + * xc/extras/freetype2/src/autofit/afloader.c + * xc/extras/freetype2/src/autofit/afmodule.c + * xc/extras/freetype2/src/autofit/aftypes.h + * xc/extras/freetype2/src/autohint/ahhint.c + * xc/extras/freetype2/src/autohint/ahmodule.c + * xc/extras/freetype2/src/base/ftbbox.c + * xc/extras/freetype2/src/base/ftdbgmem.c + * xc/extras/freetype2/src/base/ftexcept.c + * xc/extras/freetype2/src/base/ftgloadr.c + * xc/extras/freetype2/src/base/ftglyph.c + * xc/extras/freetype2/src/base/fthash.c + * xc/extras/freetype2/src/base/ftlist.c + * xc/extras/freetype2/src/base/ftmm.c + * xc/extras/freetype2/src/base/ftobject.c + * xc/extras/freetype2/src/base/ftobjs.c + * xc/extras/freetype2/src/base/ftstream.c + * xc/extras/freetype2/src/base/ftsysio.c + * xc/extras/freetype2/src/base/ftsysmem.c + * xc/extras/freetype2/src/base/ftutil.c + * xc/extras/freetype2/src/bdf/bdf.h + * xc/extras/freetype2/src/bdf/bdfdrivr.c + * xc/extras/freetype2/src/bdf/bdfdrivr.h + * xc/extras/freetype2/src/bdf/bdflib.c + * xc/extras/freetype2/src/cache/ftcbasic.c + * xc/extras/freetype2/src/cache/ftccache.c + * xc/extras/freetype2/src/cache/ftccback.h + * xc/extras/freetype2/src/cache/ftccmap.c + * xc/extras/freetype2/src/cache/ftcglyph.c + * xc/extras/freetype2/src/cache/ftcimage.c + * xc/extras/freetype2/src/cache/ftcmanag.c + * xc/extras/freetype2/src/cache/ftcsbits.c + * xc/extras/freetype2/src/cff/cffdrivr.c + * xc/extras/freetype2/src/cff/cffgload.c + * xc/extras/freetype2/src/cff/cffgload.h + * xc/extras/freetype2/src/cff/cffload.c + * xc/extras/freetype2/src/cff/cffobjs.c + * xc/extras/freetype2/src/cff/cffobjs.h + * xc/extras/freetype2/src/cff/cffparse.c + * xc/extras/freetype2/src/cid/cidgload.c + * xc/extras/freetype2/src/cid/cidgload.h + * xc/extras/freetype2/src/cid/cidobjs.c + * xc/extras/freetype2/src/cid/cidobjs.h + * xc/extras/freetype2/src/cid/cidriver.c + * xc/extras/freetype2/src/gzip/ftgzip.c + * xc/extras/freetype2/src/lzw/zopen.c + * xc/extras/freetype2/src/pcf/pcfdrivr.c + * xc/extras/freetype2/src/pcf/pcfread.c + * xc/extras/freetype2/src/pcf/pcfutil.c + * xc/extras/freetype2/src/pcf/pcfutil.h + * xc/extras/freetype2/src/pfr/pfrdrivr.c + * xc/extras/freetype2/src/pfr/pfrobjs.c + * xc/extras/freetype2/src/pfr/pfrobjs.h + * xc/extras/freetype2/src/psaux/psobjs.c + * xc/extras/freetype2/src/psaux/t1decode.c + * xc/extras/freetype2/src/raster/ftraster.c + * xc/extras/freetype2/src/sfnt/sfobjs.c + * xc/extras/freetype2/src/sfnt/ttload.c + * xc/extras/freetype2/src/tools/cordic.py + * xc/extras/freetype2/src/truetype/Jamfile + * xc/extras/freetype2/src/truetype/rules.mk + * xc/extras/freetype2/src/truetype/truetype.c + * xc/extras/freetype2/src/truetype/ttdriver.c + * xc/extras/freetype2/src/truetype/ttgload.c + * xc/extras/freetype2/src/truetype/ttgxvar.c + * xc/extras/freetype2/src/truetype/ttgxvar.h + * xc/extras/freetype2/src/truetype/ttobjs.c + * xc/extras/freetype2/src/truetype/ttobjs.h + * xc/extras/freetype2/src/truetype/ttpload.c + * xc/extras/freetype2/src/type1/t1driver.c + * xc/extras/freetype2/src/type1/t1gload.c + * xc/extras/freetype2/src/type1/t1load.c + * xc/extras/freetype2/src/type1/t1load.h + * xc/extras/freetype2/src/winfonts/winfnt.c + Bugzilla #878 (https://bugs.freedesktop.org/show_bug.cgi?id=878) + attachment #xxx (https://bugs.freedesktop.org/attachment.cgi?id=xxx): + Update Freetype2 version in xc/extras/freetype2/ from V2.1.8 to + V2.1.9. + 2005-03-06 Branden Robinson * xc/config/cf/linux.cf Shut up (tons of) Imake warnings on Debian systems by testing for variable being defined before testing its value. (Presumably the fallback definition of NothingOutsideProjectRoot in Imake.tmpl was intended to prevent this, but it apparently is not in effect yet when linux.cf is parsed.) 2005-03-06 Felix Kuehling * programs/Xserver/hw/xfree86/drivers/savage/savage.man: * programs/Xserver/hw/xfree86/drivers/savage/savage_dri.c: (SAVAGEDRIAgpInit), (SAVAGEDRIMapInit), (SAVAGEDRIBuffersInit), (SAVAGEDRIKernelInit), (SAVAGEDRIScreenInit), (SAVAGEDRIFinishScreenInit): * programs/Xserver/hw/xfree86/drivers/savage/savage_dri.h: * programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c: (SavagePreInit): * programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h: Index: xc/config/cf/X11.tmpl =================================================================== RCS file: /cvs/xorg/xc/config/cf/X11.tmpl,v retrieving revision 1.42 diff -u -2 -0 -r1.42 X11.tmpl --- xc/config/cf/X11.tmpl 18 Feb 2005 12:34:44 -0000 1.42 +++ xc/config/cf/X11.tmpl 7 Mar 2005 18:52:59 -0000 @@ -3279,81 +3279,78 @@ #endif #ifndef DebugLibXpm #define DebugLibXpm NO #endif #ifndef ProfileLibXpm #define ProfileLibXpm NO #endif XPMLIBSRC = $(LIBSRC)/Xpm #if SharedLibXpm #ifndef SharedXpmRev #define SharedXpmRev 4.11 #endif SharedLibReferences(XPM,Xpm,$(XPMLIBSRC),SOXPMREV,SharedXpmRev) #else ProjectUnsharedLibReferences(XPM,Xpm,$(XPMLIBSRC),XBuildLibDir) #endif #if UseFreetype2 #if BuildFreetype2Library -#warning Building your own FreeType library is deprecated and can be harmful. -#warning If your distribution supplies a FreeType library, you are urged to -#warning consider using it instead. #ifndef SharedLibFreetype2 #define SharedLibFreetype2 HasSharedLibraries #endif #ifndef NormalLibFreetype2 #define NormalLibFreetype2 (!SharedLibFreetype2 | ForceNormalLib) #endif #ifndef DebugLibFreetype2 #define DebugLibFreetype2 NO #endif #ifndef ProfileLibFreetype2 #define ProfileLibFreetype2 NO #endif FREETYPE2LIBSRC = $(LIBSRC)/freetype2 /* - * FreeType 2.1.4 + * FreeType 2.1.8 * * Get the library version information from version_info in * in xc/extras/freetype2/builds/unix/configure.ac. * - * current:revision:age = 9:5:3 + * current:revision:age = 9:7:3 * * The LibtoolMinorVersions revision is "(current - age).age". * The !LibtoolMinorVersions revision is "current.0". * Freetype2Version should be set to "current.revision.age" */ #ifndef Freetype2Version -#define Freetype2Version 9.6.3 +#define Freetype2Version 9.7.3 #endif #if SharedLibFreetype2 #ifndef SharedLibtoolFreetype2Rev -#define SharedLibtoolFreetype2Rev 9:6:3 +#define SharedLibtoolFreetype2Rev 9:7:3 #endif #ifndef SharedFreetype2Rev #if LibtoolMinorVersions -#define SharedFreetype2Rev 6.3.5 +#define SharedFreetype2Rev 6.3.8 #else #define SharedFreetype2Rev 9.0 #endif #endif SharedLibReferences(FREETYPE2,freetype,$(FREETYPE2LIBSRC),SOFREETYPE2REV,SharedFreetype2Rev) #else ProjectUnsharedLibReferences(FREETYPE2,freetype,$(FREETYPE2LIBSRC),XBuildLibDir) #endif #ifdef UseInstalled FREETYPE2INCDIR=$(INCDIR) #else FREETYPE2INCDIR=$(BUILDINCDIR) #endif #else /* BuildFreetype2Library */ #if HasFreetype2 #ifndef Freetype2Dir Index: xc/extras/freetype2/ChangeLog =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/ChangeLog,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ChangeLog --- xc/extras/freetype2/ChangeLog 28 Apr 2004 10:38:57 -0000 1.3 +++ xc/extras/freetype2/ChangeLog 7 Mar 2005 18:53:18 -0000 @@ -1,55 +1,642 @@ -2004-04-21 David Turner +2004-06-23 Werner Lemberg - * src/cff/cffobjs.c (cff_face_init): fixed a small memory leak + * include/freetype/internal/ftmemory.h [FT_DEBUG_MEMORY]: Declare + FT_QAlloc_Debug and FT_QRealloc_Debug. - * src/autofit/afloader.c, src/autofit/afmodule.c, src/base/ftdebug.c: - removed compiler warnings + * src/base/ftutil.c (FT_QAlloc): Fix error and debug messages. + (FT_QRealloc): Call FT_QAlloc if original pointer is NULL. + Fix error message. - * src/autofit/aftypes.h, src/lzw/zopen.c, src/pcf/pcfdrivr.c, - src/pcf/pcfread.c, src/psaux/psobjs.c, src/type42/t42drivr.c: - changed data arrays to "const" to avoid populating the ".data" - segment +2004-06-23 David Turner + + * include/freetype/internal/ftmemory.h, src/base/ftutil.c + (FT_QAlloc, FT_QRealloc), src/base/ftdbgmem.c (FT_QAlloc_Debug, + FT_QRealloc_Debug): New functions that perform allocation without + zero-ing out the corresponding blocks. + + * include/freetype/internal/ftmemory.h (FT_MEM_QALLOC, + FT_MEM_QREALLOC, FT_MEM_QNEW, FT_MEM_QNEW_ARRAY, + FT_MEM_QRENEW_ARRAY, FT_QALLOC, FT_QREALLOC, FT_QNEW, FT_QNEW_ARRAY, + FT_QRENEW_ARRAY): New macros. + + * src/base/ftstream.c (FT_Stream_EnterFrame): Use FT_QALLOC. + * src/gzip/ftgzip.c (FT_Stream_OpenGzip): Use FT_QNEW_ARRAY. + * src/sfnt/sfobjs.c (tt_face_get_name): Use FT_QNEW_ARRAY. + + * src/sfnt/ttload.c (tt_face_load_directory, tt_face_load_metrics, + tt_face_load_gasp): Use FT_QNEW_ARRAY. + (tt_face_load_kern): Use FT_QNEW_ARRAY. + Small optimization in the kerning table verifier; this speeds up + TrueType face opening by about 7%. + (tt_face_load_hdmx): Use FT_QNEW_ARRAY and FT_QALLOC. + + * include/freetype/config/ftmodule.h: Changed the order of modules, + putting TrueType and Type 1 first. This dramatically improves the + performance of face open/close operations. For example, putting the + TrueType driver first in the list results in a 5x speedup when + opening `Vera.ttf'. + + The very problem is that both the PCF and BDF drivers do a lot more + than necessary to detect that they cannot handle a font file. + +2004-06-22 Werner Lemberg + + * src/pcf/pcfread.c (pcf_read_TOC, pcf_get_properties, + pcf_get_metrics, pcf_get_bitmaps, pcf_get_encodings): Improve + debugging messages. + + * src/pcf/pcfdrivr.c (FT_COMPOMENT): Move up. + (PCF_Face_Init): Simplify code. + + * src/bdf/bdfdrivr.h (BDF_FaceRec): New element `default_glyph'. + + * src/bdf/bdflib.c (_bdf_add_property, _bdf_parse_start), + src/bdf/bdf.h (bdf_font_t): s/default_glyph/default_char/. + + * src/bdf/bdfdrivr.c (BDF_Face_Init): Fix number of glyphs. + Set `default_glyph'. + (BDF_Glyph_Load): Use `default_glyph' for undefined glyph. + + * docs/CHANGES: Updated. + +2004-06-21 Werner Lemberg + + * docs/CHANGES: Updated. + +2004-06-21 David Turner + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph, + load_truetype_glyph): Don't access (unrounded) + `TT_Size.root.metrics' but (rounded) `TT_Size.metrics'. This fixes + a scaling bug that caused incorrect rendering when the bytecode + interpreter was enabled. + +2004-06-14 Huw D M Davies + + * src/winfonts/winfnt.c (FNT_Face_Init): Set x_ppem and y_ppem + based on pixel_width and pixel_height. + (FNT_Size_Set_Pixels): Updated. + +2004-06-14 Werner Lemberg + + * src/lzw/zopen.c: Comment out inclusion of signal.h and unistd.h. + Reported by Hyvärinen Jyrki Juhani. + +2004-06-11 Werner Lemberg + + * docs/CHANGES: Updated. + +2004-06-10 David Turner + + * src/base/ftobject.c, src/base/fthash.c, src/base/ftexcept.c, + src/base/ftsysio.c, src/base/ftsysmem.c, src/base/ftlist.c: Removed. + Obsolete. + + * src/raster/ftraster.c (Alignment, PAlignment): New union to fix + problems with 64bit systems. + (AlignProfileSize): Use it. + +2004-06-08 David Turner + + * include/freetype/freetype.h (FT_GlyphMetrics): Move `lsb_delta' + and `rsb_delta' elements to... + (FT_GlyphSlotRec): Here to retain binary compatibility with older + FreeType versions. + Update all users. + + * src/sfnt/sfobjs.c (tt_face_get_name): Remove compiler warning. + + * src/winfonts/winfnt.c (FNT_Load_Glyph): Add missing initialization + of slot->metrics.width and slot->metrics.height when loading a + Windows FNT glyph. Thanks to Huw Davies. + + * include/freetype/cache/ftcmru.h (FTC_MruNode_CompareFunc): Change + return type to FT_Bool. + + * src/cache/ftbasic.c (ftc_basic_family_compare): Change return + type to FT_Bool. + + * src/cache/ftccache.c (FTC_Cache_Init, ftc_cache_init): Make + the former call the latter, not vice versa. + (FTC_Cache_Done, ftc_cache_done): Ditto. + + * src/cache/ftcglyph.c (FTC_GNode_Compare, ftc_gnode_compare): Make + the former call the latter, not vice versa. + (FTC_GCache_Init, ftc_gcache_init): Ditto. + (FTC_GCache_Done, ftc_gcache_done): Ditto. + + * src/cache/ftcimage.c (FTC_INode_Free, ftc_inode_free): Make the + former call the latter, not vice versa. + (FTC_INode_Weight, ftc_inode_weight): Ditto. + + * src/cache/ftcmanag.c (ftc_size_node_compare, + ftc_size_node_compare_faceid, ftc_face_node_compare): Change return + type to FT_Bool. + + * src/cache/ftcsbits.c (FTC_SNode_Free, ftc_snode_free): Make the + former call the latter, not vice versa. + (FTC_SNode_Weight, ftc_snode_weight): Ditto. + (FTC_SNode_Compare, ftc_snode_compare): Ditto. + + * src/cache/ftcsbits.c: Fix some bugs and inefficiencies in the cache + sub-system. + +2004-06-05 Werner Lemberg + + * src/autofit/afloader.c (af_loader_load_g): Set `lsb_delta' and + `rsb_delta' in slot->metrics and tune side bearings slightly. + +2004-06-04 Werner Lemberg + + * docs/CHANGES: Updated. + +2004-06-04 David Chester + + Improve inter-letter spacing for autohinted glyphs. + + * include/freetype/freetype.h (FT_Glyph_Metrics): Add elements + `lsb_delta' and `rsb_delta'. + + * src/autohint/ahhint.c (ah_hinter_load): Set `lsb_delta' and + `rsb_delta' in slot->metrics and tune side bearings slightly. + +2004-06-04 David Turner + + * src/autofit/*: Important fixes to the auto-fitter. The output + now seems to be 100% equivalent to the auto-hinter, while being + about 2% faster (which proves that script-specific algorithm + selection isn't a performance problem). + + To test it, change `autohint' to `autofit' in + and recompile. + + A few more testing is needed before making this the official + auto-hinting module. + +2004-06-02 Werner Lemberg + + * src/truetype/ttgload.c (compute_glyph_metrics): Fix compiler + warnings. + +2004-06-01 Werner Lemberg + + * src/sfnt/sfobjs.c (tt_face_get_name): Make sure that an English + name record for the Apple platform is preferred to a non-English + entry for the Microsoft platform. Problem reported by HANDA + Ken'ichi. + +2004-05-19 George Williams + + * src/type1/t1load.c (mm_axis_unmap, mm_weights_unmap): New + auxiliary functions. + (T1_Get_MM_Var): Provide axis tags. + Use mm_axis_unmap and mm_weights_unmap to provide default values + for design and normalized axis coordinates. + + * include/freetype/t1tables.h (PS_DesignMapRec): Change type of + `design_points' to FT_Long. + Update all users. + +2004-05-17 Werner Lemberg + + * src/base/ftbbox.c (BBox_Conic_Check): Fix boundary cases. + Reported by Mikey Anbary . + +2004-05-15 Werner Lemberg + + * src/sfnt/sfobjs.c (sfnt_done_face): Free face->postscript_name. + +2004-05-15 George Williams + + * src/sfnt/ttload.c (tt_face_load_max_profile): Always set + face->root.num_glyphs. + +2004-05-14 Masatake YAMATO + George Williams + + * src/sfnt/ttload.c (sfnt_dir_check): Handle `bhed' properly. + +2004-05-14 Werner Lemberg + + * src/cache/ftcbasic.c (ftc_basic_family_compare, + ftc_basic_family_init, ftc_basic_family_get_count, + ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph, + ftc_basic_gnode_compare_faceid): Adjust parameters and return types + to prototypes given in header files from include/freetype/cache. + Use casts to proper types locally. + (ftc_basic_image_family_class, ftc_basic_image_cache_class, + ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove + casts. + + * src/cache/ftccback.h: Adjust parameters and return types to + prototypes given in header files from include/freetype/cache. + + * src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new, + ftc_inode_weight): Adjust parameters and return types to prototypes + given in header files from include/freetype/cache. Use casts to + proper types locally. + + * src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new, + ftc_snode_weight, ftc_snode_compare): Adjust parameters and return + types to prototypes given in header files from + include/freetype/cache. Use casts to proper types locally. + + * src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new, + ftc_cmap_node_weight, ftc_cmap_node_compare, + ftc_cmap_node_remove_faceid): Adjust parameters and return types to + prototypes given in header files from include/freetype/cache. Use + casts to proper types locally. + (ftc_cmap_cache_class): Remove casts. + + * src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init, + ftc_gcache_done): Adjust parameters and return types to prototypes + given in header files from include/freetype/cache. Use casts to + proper types locally. + + * src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare, + ftc_size_node_init, ftc_size_node_reset, + ftc_size_node_compare_faceid, ftc_face_node_init, + ftc_face_node_done, ftc_face_node_compare: Adjust parameters and + return types to prototypes given in header files from + include/freetype/cache. Use casts to proper types locally. + + (ftc_size_list_class, ftc_face_list_class): Remove casts. + +2004-05-13 Werner Lemberg + + * src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done): + Use FT_Module as parameter and do a cast to FT_AutoHinter locally. + (autohint_module_class): Remove casts. + + * src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy, + ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init, + ft_outline_glyph_done, ft_outline_glyph_copy, + ft_outline_glyph_transform, ft_outline_glyph_bbox, + ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast + to FT_XXXGlyph locally. + Use FT_CALLBACK_DEF throughout. + (ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts. + + * src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done, + bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter + and do a cast to BDF_CMap locally. + (bdf_cmap_class): Remove casts. + +2004-05-12 Werner Lemberg + + * src/cff/cffgload.h (CFF_Builder): Remove `error'. + * src/cff/cffgload.c (cff_decoder_parse_charstrings): Replace + `Memory_Error' with `Fail' und update all users. + +2004-05-11 Werner Lemberg + + * include/freetype/internal/psaux.h (T1_ParseState): New + enumeration. + (T1_BuilderRec): Replace `path_begun' with `parse_state'. + Remove `error'. + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Replace + `Memory_Error' with `Fail' and update all users. + Don't use `builder->error'. + Replace `path_begun' with `parse_state' and check parsing states. + + * src/psaux/psobjs.c (t1_builder_init, t1_builder_start_point): + Replace `path_begun' with `parse_state' and check parsing states. + +2004-05-10 George Williams + + * src/truetype/ttxgvar.c (ft_var_load_avar): Do free arrays in case + of error -- `avar' is optional so we can't rely on tt_done_blend + being called automatically. + +2004-05-09 George Williams + + * src/truetype/ttxgvar.c (ft_var_load_avar, ft_var_load_gvar): Fix + error handling. + +2004-05-07 Werner Lemberg + + * src/pfr/pfrobjs.c, src/pfr/pfrobjs.h (pfr_face_init, + pfr_face_done, pfr_face_get_kerning, pfr_slot_init, pfr_slot_done, + pfr_slot_load): Don't use PFR_XXX but FT_XXX arguments which are + typecast to the proper PFR_XXX types within the function. + Update code accordingly. + + * src/pfr/pfrdrivr.c (pfr_get_kerning, pfr_get_advance, + pfr_get_metrics, pfr_get_service): Don't use PFR_XXX but FT_XXX + arguments which are typecast to the proper PFR_XXX types within the + function. + Update code accordingly. + Use FT_CALLBACK_DEF throughout. + (pfr_metrics_service_rec, pfr_driver_class): Remove casts. + +2004-05-06 Masatake YAMATO + + * src/truetype/ttgxvar.c (ft_var_load_gvar): Use FT_FACE_STREAM. + (*): Rename local variable OffsetToData to offsetToData. + +2004-05-06 Werner Lemberg + + * src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset, + cff_slot_done, cff_slot_init, cff_face_init, cff_face_done): Access + root fields directly. + * src/cff/cffdrivr.c (Load_Glyph): Access root fields directly. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Save current + frame before calling TT_Vary_Get_Glyph_Deltas. + + * src/pcf/pcfdrivr.c (PCF_CMapRec): Rename `cmap' to `root' for + consistency. + (pcf_cmap_init, pcf_cmap_done, pcf_cmap_char_index, + pcf_cmap_char_next): Don't use PCF_XXX but FT_XXX arguments which + are typecast to the proper PCF_XXX types within the function. + Update code accordingly. + (pcf_cmap_class): Remove casts. + (PCF_Face_Done, PCF_Face_Init, PCF_Set_Pixel_Size): Don't use + PCF_XXX but FT_XXX arguments which are typecast to the proper + PCF_XXX types within the function. + Update code accordingly. + Use FT_CALLBACK_DEF throughout. + (PCF_Set_Point_Size): New wrapper function. + (PCF_Glyph_Load, pcf_driver_requester): Use FT_CALLBACK_DEF. + (pcf_driver_class): Remove casts. + +2004-05-04 Steve Hartwell + + * src/truetype/ttobjs.c (tt_driver_done): Fix typo. + +2004-05-04 Werner Lemberg + + * src/bdf/bdfdrivr.c (BDF_Face_Done, BDF_Face_Init, + BDF_Set_Pixel_Size): Don't use BDF_XXX but FT_XXX arguments which + are typecast to the proper BDF_XXX types within the function. + Update code accordingly. + Use FT_CALLBACK_DEF throughout. + (BDF_Set_Point_Size): New wrapper function. + (bdf_driver_class): Remove casts. + + * src/cff/cffdrivr.c (Get_Kerning, Load_Glyph, cff_get_interface): + Don't use CFF_XXX but FT_XXX arguments which are typecast to the + proper CFF_XXX types within the function. + Update code accordingly. + Use FT_CALLBACK_DEF throughout. + (cff_driver_class): Remove casts. + + * src/cff/cffobjs.h, src/cff/cffobjs.c (cff_size_done, + cff_size_init, cff_size_reset, cff_slot_done, cff_slot_init, + cff_face_init, cff_face_done, cff_driver_init, cff_driver_done): + Don't use CFF_XXX but FT_XXX arguments which are typecast to the + proper CFF_XXX types within the function. + Update code accordingly. + (cff_point_size_reset): New wrapper function. + + * src/cid/cidobjs.h, src/cid/cidobjs.c (cid_slot_done, + cid_slot_init, cid_size_done, cid_size_init, cid_size_reset, + cid_face_done, cid_face_init, cid_driver_init, cid_driver_done): + Don't use CID_XXX but FT_XXX arguments which are typecast to the + proper CID_XXX types within the function. + Update code accordingly. + (cid_point_size_reset): New wrapper function. + + * src/cid/cidgload.c, src/cid/cidgload.h (cid_slot_load_glyph): + Don't use CID_XXX but FT_XXX arguments which are typecast to the + proper CID_XXX types within the function. + Update code accordingly. + + * src/cid/cidriver.c (cid_get_interface): + Don't use CID_XXX but FT_XXX arguments which are typecast to the + proper CID_XXX types within the function. + Update code accordingly. + Use FT_CALLBACK_DEF. + (t1cid_driver_class): Remove casts. + + * src/truetype/ttdriver.c (tt_get_interface): Use FT_CALLBACK_DEF. + * src/truetype/ttgxvar.c (ft_var_load_avar): Don't free non-local + variables (this is done later). + (ft_var_load_avar): Fix call to FT_FRAME_ENTER. + (TT_Get_MM_Var): Fix size for `fvar_fields'. + (TT_Vary_Get_Glyph_Deltas): Handle deallocation of local variables + correctly. + + * src/base/ftdbgmem.c (ft_mem_debug_realloc): Don't abort if + current size is zero. + +2004-05-03 Steve Hartwell + + * src/truetype/ttobjs.h, src/truetype/ttobjs.c (tt_face_init, + tt_face_done, tt_size_init, tt_size_done, tt_driver_init, + tt_driver_done): Don't use TT_XXX but FT_XXX arguments which are + typecast to the proper TT_XXX types within the function. + Update code accordingly. + + * src/truetype/ttdriver.c (Get_Kerning, Set_Char_Sizes, + Set_Pixel_Sizes, Load_Glyph, tt_get_interface): Don't use TT_XXX but + FT_XXX arguments which are typecast to the proper TT_XXX types + within the function. + Update code accordingly. + (tt_driver_class): Remove casts. + +2004-05-02 Werner Lemberg + + * src/sfnt/ttload.c (tt_face_free_names): Check that `table->names' + is not NULL. Reported by Gordon Childs . + +2004-04-29 Werner Lemberg + + * docs/formats.txt: Add more information on PFR format. + +2004-04-28 Werner Lemberg + + * docs/formats.txt: New file. + * docs/CHANGES: Updated. + +2004-04-28 Masatake YAMATO + + * include/freetype/internal/tttypes.h (GX_BlendRec_) + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Fix a typo. + + * src/truetype/ttgxvar.h (GX_BlendRec_): Fix a typo. + +2004-04-27 Masatake YAMATO + + * src/truetype/ttgxvar.h: Use FT_LOCAL instead of FT_LOCAL_DEF + for function declarations. + +2004-04-25 George Williams + + * src/truetype/ttgxvar.c (ft_var_apply_tuple): Fix typo. + +2004-04-25 Werner Lemberg + + * src/truetype/Jamfile, docs/CHANGES: Updated. + +2004-04-24 Werner Lemberg + + * src/pcf/pcfdrivr.c: Revert change from 2004-04-17. + * src/pcf/pcfutil.c: Use FT_LOCAL_DEF. + * src/pcf/pcfutil.h: Include FT_CONFIG_CONFIG_H. + Use FT_BEGIN_HEADER and FT_END_HEADER. + Use FT_LOCAL. + +2004-04-24 George Williams + + Add support for Apple's distortable font technology (in GX fonts). + + * devel/ftoption.h, include/freetype/config/ftoption.h + (TT_CONFIG_OPTION_GX_VAR_SUPPORT): New macro. + + * include/freetype/ftmm.h (FT_Var_Axis, FT_Var_Named_Style, + FT_MM_Var): New structures. + (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, + FT_Set_Var_Blend_Coordinates): New function declarations. + + * include/freetype/internal/services/svmm.h (FT_Get_MM_Var_Func, + FT_Set_Var_Design_Func): New typedefs. + Update MultiMasters service. + + * include/freetype/internal/tttypes.h + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include FT_MULTIPLE_MASTERS_H. + (GX_Blend) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New typedef. + (TT_Face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: New members `doblend' + and `blend'. + + * include/freetype/tttags.h (TTAG_avar, TTAG_cvar, TTAG_gvar): New + macros. + + * include/freetype/internal/fttrace.h: Add `ttgxvar'. + + * src/base/ftmm.c (FT_Get_MM_Var, FT_Set_Var_Design_Coordinates, + FT_Set_Var_Blend_Coordinates): New functions. + + * src/sfnt/sfobjs.c (sfnt_load_face) + [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Set FT_FACE_FLAG_MULTIPLE_MASTERS + flag for GX var fonts. + + * src/truetype/ttgxvar.c, src/truetype/ttgxvar.h: New files. + + * src/truetype/truetype.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + ttgxvar.c. + + * src/truetype/ttdriver.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + FT_MULTIPLE_MASTERS_H, FT_SERVICE_MULTIPLE_MASTERS_H, and ttgxvar.h. + (tt_service_gx_multi_masters) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: + New service. + (tt_services) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Updated. + + * src/truetype/ttgload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + ttgxvar.h. + (TT_Process_Simple_Glyph, load_truetype_glyph) + [TT_CONFIG_OPTION_GX_VAR_SUPPORT] :Support GX var fonts. + + * src/truetype/ttobjs.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + ttgxvar.h. + (tt_done_face) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call + tt_done_blend. + + * src/truetype/ttpload.c [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Include + ttgxvar.h. + (tt_face_load_cvt) [TT_CONFIG_OPTION_GX_VAR_SUPPORT]: Call + tt_face_vary_cvt. + + * src/truetype/rules.mk (TT_DRV_SRC): Add ttgxvar.c. + + * src/type1/t1driver.c (t1_service_multi_masters): Add T1_Get_MM_Var + and T1_Set_Var_Design. + + * src/type1/t1load.c (FT_INT_TO_FIXED, FT_FIXED_TO_INT): New macros. + (T1_Get_MM_Var, T1_Set_Var_Design): New functions. + + * src/type1/t1load.h (T1_Get_MM_Var, T1_Set_Var_Design): New + function declarations. + +2004-04-23 Werner Lemberg + + * include/freetype/ftcache.h (FT_Get_CharMap_Index): Rename + declaration and move to... + * include/freetype/freetype.h (FT_Get_Charmap_Index): Here. + (FREETYPE_PATCH): Set to 9. + + * src/base/ftobjs.c (FT_Get_Charmap_Index): New function. + + * builds/unix/configure.ac (version_info): Set to 9:7:3. + * builds/unix/configure: Updated. + + * builds/win32/visualc/index.html, + builds/win32/visualc/freetype.dsp, + builds/win32/visualc/freetype.vcproj: s/218/219/. + + * builds/freetype.mk (refdoc), README, Jamfile (RefDoc): + s/2.1.8/2.1.9/. + + * docs/CHANGES, docs/VERSION.DLL: Updated. + +2004-04-21 Werner Lemberg + + * src/cff/cffparse.c (cff_parser_run), src/psaux/psobjs.c + (ps_parser_load_field): Use FT_CHAR_BIT. + +2004-04-21 David Turner + + + * Version 2.1.8 released. + ========================= + + + * src/cff/cffobjs.c (cff_face_init): Fix a small memory leak. + + * src/autofit/afloader.c (af_loader_load_g), src/autofit/afmodule.c + (af_autofitter_load_glyph), src/base/ftdebug.c (FT_Trace_Get_Name): + Remove compiler warnings. + + * src/autofit/aftypes.h: Undefine AF_DEBUG. + + * src/lzw/zopen.c (rmask), src/pcf/pcfdrivr.c (pcf_service_bdf, + pcf_services), src/pcf/pcfread.c (tableNames), src/psaux/psobjs.c + (ft_char_table), src/type42/t42drivr.c (t42_service_glyph_dict, + t42_service_ps_font_name): Decorate data arrays with `const' to + avoid populating the `.data' segment. + + * src/lzw/Jamfile: New file. 2004-04-20 Werner Lemberg * src/psaux/psobjs.c (T1Radix): Renamed to... (ps_radix): This. Update current cursor position. * docs/CHANGES: Updated. 2004-04-18 Werner Lemberg * src/truetype/ttgload.c, src/truetype/ttgload.h (TT_Load_Glyph), src/ttdriver.c (Load_Glyph): Change type of `glyph_index' to FT_UInt. From Lex Warners. 2004-04-17 Chisato Yamauchi * src/sfnt/ttload.c (tt_face_load_sfnt_header): Really fix change from 2004-03-19. * src/bdf/bdfdrivr.c (BDF_Face_Init): Use `ft_strlen'. * src/pcf/pcfutil.c, src/pcf/pcfutil.h: Decorate functions with - `static.'. + `static'. Remove unused function `RepadBitmap'. * src/pcf/pcfdrivr.c: Don't include pcfutil.h. 2004-04-16 Werner Lemberg * builds/unix/freetype-config.in (usage): Fix and improve usage information. 2004-04-15 Werner Lemberg * builds/unix/ftconfig.in, builds/vms/ftconfig.h: Define FT_CHAR_BIT. * src/base/ftobjs.c (FT_Load_Glyph): Don't apply autohinting if glyph is vertically distorted or mirrored. * src/cff/cffgload.c (cff_slot_load): Handle zero `size' properly for embedded bitmaps. * docs/CHANGES: Updated. @@ -133,42 +720,42 @@ * builds/unix/configure: Regenerated with autoconf 2.59a. 2004-04-01 Werner Lemberg * builds/unix/ft-munmap.m4 (FT_MUNMAP_PARAM): Fix arguments of AC_COMPILE_IFELSE. * builds/unix/aclocal.m4: Regenerated with `aclocal -I .' from automake 1.8a. * builds/unix/configure: Regenerated with autoconf 2.59a. * builds/unix/config.guess, builds/unix/config.sub: Updated from `config' CVS module at subversions.gnu.org * builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from `texinfo' CVS module at subversions.gnu.org. * builds/freetype.mk (refdoc): Updated. 2004-03-31 Werner Lemberg Handle broken FNT files which don't have a trailing NULL byte in the face name string. - * src/winfnt/winfnt.h (FNT_FontRec): New member `family_name'. - * src/winfnt/winfnt.c (fnt_font_done): Free font->family_name. + * src/winfonts/winfnt.h (FNT_FontRec): New member `family_name'. + * src/winfonts/winfnt.c (fnt_font_done): Free font->family_name. (FNT_Face_Init): Append a final zero byte to the font face name. 2004-03-30 Werner Lemberg * src/sfnt/ttload.c (tt_face_load_sfnt_header): Fix change from 2004-03-19. 2004-03-27 Werner Lemberg * src/base/descrip.mms (OBJS): Add ftbbox.obj. 2004-03-26 George Williams Add vertical phantom points. * include/freetype/internal/tttypes.h (TT_LoaderRec): Add `top_bearing', `vadvance', `pp3, and `pp4'. * src/autofit/afloader.c (af_loader_load_g): Handle two more points. @@ -1220,41 +1807,41 @@ Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45): Fix rounding of value zero. (DO_DIV): Don't use TT_MULDIV. (Ins_SHC): This instruction actually touches the points. (Ins_MSIRP): Fix undocumented behaviour. * src/truetype/ttinterp.h (TT_ExecContextRec): Updated. 2003-11-22 Werner Lemberg * docs/VERSION.DLL, docs/CHANGES: Updated. * src/base/ftobjs.c (FT_Set_Char_Size): Make metrics->x_scale and metrics->y_scale really precise. (FT_Load_Glyph): Update computation of linearHoriAdvance and linearVertAdvance. - * src/true/type/ttinterp.c (Update_Max): Use FT_REALLOC. + * src/truetype/ttinterp.c (Update_Max): Use FT_REALLOC. 2003-11-22 David Turner * src/autofit/*: More updates. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 8. * builds/unix/configure.ac (version_info): Set to 9:6:3. * README: Updated. 2003-11-13 John A. Boyd Jr. * src/bdf/bdfdrivr.c (bdf_interpret_style), src/pcf/pcfread.c (pcf_interpret_style): Replace spaces with dashes in properties SETWIDTH_NAME and ADD_STYLE_NAME to simplify parsing. 2003-11-11 Werner Lemberg * docs/CHANGES: Updated. 2003-11-11 John A. Boyd Jr. @@ -6924,41 +7511,41 @@ (TT_CMapTable): Use it. * src/base/ftobjs.c (FT_Get_Next_Char): New function, implementing high-level API. * src/cff/cffdrivr.c (cff_get_next_char): New function. (cff_driver_class): Add it. * src/cid/cidriver.c (Cid_Get_Next_Char): New function. (t1cid_driver_class): Add it. * src/pcf/pcfdriver.c (PCF_Get_Next_Char): New function. (pcf_driver_class): Add it. * src/psnames/psmodule.c (PS_Next_Unicode): New function. (psnames_interface): Add it. * src/sfnt/ttcmap.c (code_to_next0, code_to_next2, code_to_next4, code_to_next6, code_to_next_8_12, code_to_next_10): New auxiliary functions. (TT_CharMap_Load): Use them. * src/truetype/ttdriver.c (Get_Next_Char): New function. (tt_driver_class): Add it. * src/type1/t1driver.c (Get_Next_Char): New function. (t1_driver_class): Add it. - * src/winfnt/winfnt.c (FNT_Get_Next_Char): New function. + * src/winfonts/winfnt.c (FNT_Get_Next_Char): New function. (winfnt_driver_class): Add it. * src/pcf/pcfread.c (pcf_load_font): For now, report Unicode for Unicode and Latin 1 encodings. 2002-02-02 Keith Packard * builds/unix/freetype-config.in: Add missing `fi'. * Version 2.0.7 released. ========================= 2002-02-01 David Turner * include/freetype/freetype.h: Increasing FREETYPE_PATCH to 7 for the new release. 2002-01-31 David Turner Index: xc/extras/freetype2/Jamfile =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/Jamfile,v retrieving revision 1.3 diff -u -2 -0 -r1.3 Jamfile --- xc/extras/freetype2/Jamfile 28 Apr 2004 10:38:58 -0000 1.3 +++ xc/extras/freetype2/Jamfile 7 Mar 2005 18:53:18 -0000 @@ -131,27 +131,27 @@ # HDRMACRO [ FT2_SubDir include freetype config ftheader.h ] ; HDRMACRO [ FT2_SubDir include freetype internal internal.h ] ; # Now include the Jamfile in "freetype2/src", used to drive the compilation # of each FreeType 2 component and/or module. # SubInclude FT2_TOP $(FT2_SRC_DIR) ; # Test files (hinter debugging). Only used by FreeType developers. # if $(DEBUG_HINTER) { SubInclude FT2_TOP tests ; } actions RefDoc { - python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.1.8 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h $(FT2_INCLUDE)/freetype/cache/*.h + python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.1.9 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h $(FT2_INCLUDE)/freetype/cache/*.h } RefDoc refdoc ; # end of top Jamfile Index: xc/extras/freetype2/README =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/README,v retrieving revision 1.3 diff -u -2 -0 -r1.3 README --- xc/extras/freetype2/README 28 Apr 2004 10:38:58 -0000 1.3 +++ xc/extras/freetype2/README 7 Mar 2005 18:53:18 -0000 @@ -1,39 +1,39 @@ Special notes to Unix users =========================== Please read the file "docs/UPGRADE.UNX". It contains important information regarding the installation of FreeType on Unix systems, especially GNU based operating systems like GNU/Linux. FreeType 2's library is called `libfreetype', FreeType 1's library is called `libttf'. They are *not* compatible! - FreeType 2.1.8 + FreeType 2.1.9 ============== Please read the docs/CHANGES file, it contains IMPORTANT INFORMATION. Read the files "docs/INSTALL" for installation instructions. Note that the FreeType 2 documentation is now available as a separate package from our sites. See: - ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.8.tar.bz2 - ftp://ftp.freetype.org/pub/freetype2/ftdocs-2.1.8.tar.gz - ftp://ftp.freetype.org/pub/freetype2/ftdoc218.zip + ftp://ftp.freetype.org/freetype/freetype2/ftdocs-2.1.9.tar.bz2 + ftp://ftp.freetype.org/freetype/freetype2/ftdocs-2.1.9.tar.gz + ftp://ftp.freetype.org/freetype/freetype2/ftdoc219.zip Bugs ==== Please report bugs by e-mail to `devel@freetype.org'. Don't forget to send a detailed explanation of the problem -- there is nothing worse than receiving a terse message that only says "it doesn't work". Enjoy! The FreeType Team Index: xc/extras/freetype2/builds/freetype.mk =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/builds/freetype.mk,v retrieving revision 1.3 diff -u -2 -0 -r1.3 freetype.mk --- xc/extras/freetype2/builds/freetype.mk 28 Apr 2004 10:38:58 -0000 1.3 +++ xc/extras/freetype2/builds/freetype.mk 7 Mar 2005 18:53:18 -0000 @@ -237,41 +237,41 @@ # BASE_OBJECTS := $(OBJECTS_LIST) ifneq ($(findstring multi,$(MAKECMDGOALS)),) OBJECTS_LIST += $(OBJ_M) else OBJECTS_LIST += $(OBJ_S) endif objects: $(OBJECTS_LIST) library: $(PROJECT_LIBRARY) .c.$O: $(FT_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $<) refdoc: python $(SRC_DIR)/tools/docmaker/docmaker.py \ --prefix=ft2 \ - --title=FreeType-2.1.8 \ + --title=FreeType-2.1.9 \ --output=$(DOC_DIR) \ $(PUBLIC_DIR)/*.h \ $(PUBLIC_DIR)/config/*.h \ $(PUBLIC_DIR)/cache/*.h .PHONY: clean_project_std distclean_project_std # Standard cleaning and distclean rules. These are not accepted # on all systems though. # clean_project_std: -$(DELETE) $(BASE_OBJECTS) $(OBJ_M) $(OBJ_S) $(CLEAN) distclean_project_std: clean_project_std -$(DELETE) $(PROJECT_LIBRARY) -$(DELETE) *.orig *~ core *.core $(DISTCLEAN) .PHONY: clean_project_dos distclean_project_dos Index: xc/extras/freetype2/builds/unix/configure =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/builds/unix/configure,v retrieving revision 1.3 diff -u -2 -0 -r1.3 configure --- xc/extras/freetype2/builds/unix/configure 28 Apr 2004 10:38:58 -0000 1.3 +++ xc/extras/freetype2/builds/unix/configure 7 Mar 2005 18:53:28 -0000 @@ -1703,41 +1703,41 @@ # Don't forget to update docs/VERSION.DLL! -version_info='9:6:3' +version_info='9:7:3' ft_version=`echo $version_info | tr : .` # checks for system type ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" Index: xc/extras/freetype2/builds/unix/configure.ac =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/builds/unix/configure.ac,v retrieving revision 1.3 diff -u -2 -0 -r1.3 configure.ac --- xc/extras/freetype2/builds/unix/configure.ac 28 Apr 2004 10:38:58 -0000 1.3 +++ xc/extras/freetype2/builds/unix/configure.ac 7 Mar 2005 18:53:29 -0000 @@ -1,31 +1,31 @@ # This file is part of the FreeType project. # # Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([ftconfig.in]) # Don't forget to update docs/VERSION.DLL! -version_info='9:6:3' +version_info='9:7:3' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) # checks for system type AC_CANONICAL_TARGET # checks for programs AC_PROG_CC AC_PROG_CPP # get compiler flags right if test "x$CC" = xgcc; then XX_CFLAGS="-Wall" Index: xc/extras/freetype2/builds/win32/visualc/freetype.dsp =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/builds/win32/visualc/freetype.dsp,v retrieving revision 1.2 diff -u -2 -0 -r1.2 freetype.dsp --- xc/extras/freetype2/builds/win32/visualc/freetype.dsp 28 Apr 2004 10:38:59 -0000 1.2 +++ xc/extras/freetype2/builds/win32/visualc/freetype.dsp 7 Mar 2005 18:53:29 -0000 @@ -37,165 +37,165 @@ # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\..\objs\release" # PROP Intermediate_Dir "..\..\..\objs\release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /MD /Za /W4 /GX /Zi /O2 /I "..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /c # SUBTRACT CPP /nologo /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype219.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\..\..\objs\debug" # PROP Intermediate_Dir "..\..\..\objs\debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /MDd /Za /W4 /GX /Zi /Od /I "..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "FT_DEBUG_LEVEL_ERROR" /D "FT_DEBUG_LEVEL_TRACE" /FD /GZ /c # SUBTRACT CPP /nologo /X /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype219_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "freetype___Win32_Debug_Multithreaded" # PROP BASE Intermediate_Dir "freetype___Win32_Debug_Multithreaded" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\..\..\objs\debug_mt" # PROP Intermediate_Dir "..\..\..\objs\debug_mt" # PROP Target_Dir "" # ADD BASE CPP /nologo /Za /W3 /Gm /GX /ZI /Od /I "..\freetype\include\\" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "FT_FLAT_COMPILE" /YX /FD /GZ /c # SUBTRACT BASE CPP /X # ADD CPP /MTd /Za /W4 /GX /Zi /Od /I "..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "FT_DEBUG_LEVEL_ERROR" /D "FT_DEBUG_LEVEL_TRACE" /FD /GZ /c # SUBTRACT CPP /nologo /X /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:"lib\freetype200b8_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218MT_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype219MT_D.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "freetype___Win32_Release_Multithreaded" # PROP BASE Intermediate_Dir "freetype___Win32_Release_Multithreaded" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\..\objs\release_mt" # PROP Intermediate_Dir "..\..\..\objs\release_mt" # PROP Target_Dir "" # ADD BASE CPP /nologo /Za /W3 /GX /O2 /I "..\freetype\include\\" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "FT_FLAT_COMPILE" /YX /FD /c # ADD CPP /MT /Za /W4 /GX /Zi /O2 /I "..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /c # SUBTRACT CPP /nologo /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:"lib\freetype200b8.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218MT.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype219MT.lib" !ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "freetype___Win32_Release_Singlethreaded" # PROP BASE Intermediate_Dir "freetype___Win32_Release_Singlethreaded" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "..\..\..\objs\release_st" # PROP Intermediate_Dir "..\..\..\objs\release_st" # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /Za /W4 /GX /Zi /O2 /I "..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /c # SUBTRACT BASE CPP /YX # ADD CPP /Za /W4 /GX /Zi /O2 /I "..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /c # SUBTRACT CPP /nologo /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype206.lib" -# ADD LIB32 /out:"..\..\..\objs\freetype218ST.lib" +# ADD LIB32 /out:"..\..\..\objs\freetype219ST.lib" # SUBTRACT LIB32 /nologo !ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "freetype___Win32_Debug_Singlethreaded" # PROP BASE Intermediate_Dir "freetype___Win32_Debug_Singlethreaded" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "..\..\..\objs\debug_st" # PROP Intermediate_Dir "..\..\..\objs\debug_st" # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /Za /W4 /Gm /GX /Zi /Od /I "..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "FT_DEBUG_LEVEL_ERROR" /D "FT_DEBUG_LEVEL_TRACE" /FD /GZ /c # SUBTRACT BASE CPP /X /YX # ADD CPP /Za /W4 /GX /Zi /Od /I "..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "FT_DEBUG_LEVEL_ERROR" /D "FT_DEBUG_LEVEL_TRACE" /FD /GZ /c # SUBTRACT CPP /nologo /X /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype206_D.lib" -# ADD LIB32 /nologo /out:"..\..\..\objs\freetype218ST_D.lib" +# ADD LIB32 /nologo /out:"..\..\..\objs\freetype219ST_D.lib" !ENDIF # Begin Target # Name "freetype - Win32 Release" # Name "freetype - Win32 Debug" # Name "freetype - Win32 Debug Multithreaded" # Name "freetype - Win32 Release Multithreaded" # Name "freetype - Win32 Release Singlethreaded" # Name "freetype - Win32 Debug Singlethreaded" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\..\..\src\autohint\autohint.c # SUBTRACT CPP /Fr # End Source File # Begin Source File Index: xc/extras/freetype2/builds/win32/visualc/freetype.vcproj =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/builds/win32/visualc/freetype.vcproj,v retrieving revision 1.1 diff -u -2 -0 -r1.1 freetype.vcproj --- xc/extras/freetype2/builds/win32/visualc/freetype.vcproj 28 Apr 2004 10:38:59 -0000 1.1 +++ xc/extras/freetype2/builds/win32/visualc/freetype.vcproj 7 Mar 2005 18:53:29 -0000 @@ -24,41 +24,41 @@ Optimization="2" InlineFunctionExpansion="1" ImproveFloatingPointConsistency="TRUE" AdditionalIncludeDirectories="..\..\..\include" PreprocessorDefinitions="NDEBUG;WIN32;_LIB" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" DisableLanguageExtensions="TRUE" PrecompiledHeaderFile=".\..\..\..\objs\release/freetype.pch" AssemblerListingLocation=".\..\..\..\objs\release/" ObjectFile=".\..\..\..\objs\release/" ProgramDataBaseFileName=".\..\..\..\objs\release/" WarningLevel="4" DebugInformationFormat="3" CompileAs="0"/> + OutputFile="..\..\..\objs\freetype219ST.lib"/> @@ -180,41 +180,41 @@
FreeType 2 Project Files for Visual C++ and VS.NET 2003

FreeType 2 Project Files for Visual C++ and VS.NET 2003

This directory contains a project files for Visual C++, named freetype.dsp, and Visual Studio, called freetype.sln. It -will compile the following libraries from the FreeType 2.1.8 sources:

+will compile the following libraries from the FreeType 2.1.9 sources:

    -    freetype218.lib     - release build; single threaded
    -    freetype218_D.lib   - debug build;   single threaded
    -    freetype218MT.lib   - release build; multi-threaded
    -    freetype218MT_D.lib - debug build;   multi-threaded
    + freetype219.lib - release build; single threaded + freetype219_D.lib - debug build; single threaded + freetype219MT.lib - release build; multi-threaded + freetype219MT_D.lib - debug build; multi-threaded

Be sure to extract the files with the Windows (CR+LF) line endings. ZIP archives are already stored this way, so no further step is required. If you use some .tar.*z archives, be sure to configure your extracting tool to convert the line endings. For example, with WinZip, you should activate the TAR file smart CR/LF Conversion option. Alternatively, you may consider using the unix2dos or u2d utilities that are floating around, which specifically deal with this particular problem.

Build directories are placed in the top-level objs directory.

Index: xc/extras/freetype2/devel/ftoption.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/devel/ftoption.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftoption.h --- xc/extras/freetype2/devel/ftoption.h 28 Apr 2004 10:38:59 -0000 1.3 +++ xc/extras/freetype2/devel/ftoption.h 7 Mar 2005 18:53:30 -0000 @@ -467,40 +467,50 @@ /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ /* TrueType glyph loader to use Apple's definition of how to handle */ /* component offsets in composite glyphs. */ /* */ /* Apple and MS disagree on the default behavior of component offsets */ /* in composites. Apple says that they should be scaled by the scale */ /* factors in the transformation matrix (roughly, it's more complex) */ /* while MS says they should not. OpenType defines two bits in the */ /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ /* http://partners.adobe.com/asn/developer/opentype/glyf.html */ /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ + /* support for Apple's distortable font technology (fvar, gvar, cvar, */ + /* and avar tables). This has many similarities to Type 1 Multiple */ + /* Masters support. */ + /* */ +#define TT_CONFIG_OPTION_GX_VAR_SUPPORT + + + /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ /* required. */ /* */ #define T1_MAX_DICT_DEPTH 5 /*************************************************************************/ /* */ /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ Index: xc/extras/freetype2/docs/CHANGES =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/docs/CHANGES,v retrieving revision 1.3 diff -u -2 -0 -r1.3 CHANGES --- xc/extras/freetype2/docs/CHANGES 28 Apr 2004 10:38:59 -0000 1.3 +++ xc/extras/freetype2/docs/CHANGES 7 Mar 2005 18:53:32 -0000 @@ -1,21 +1,68 @@ +LATEST CHANGES BETWEEN 2.1.9 and 2.1.8 + + I. IMPORTANT BUG FIXES + + - The function `FT_Get_CharMap_Index' was only declared, without + any real code. For consistency, it has been renamed to + `FT_Get_Charmap_Index'. (This function is needed to implement + cmap caches.) + + - `FT_Outline_Get_BBox' sometimes returned incorrect values for + conic outlines (e.g., for TrueType fonts). + + - Handling of `bhed' table has been fixed. + + - The TrueType driver with enabled byte code interpreter sometimes + returned artifacts due to incorrect rounding. This bug has been + introduced after version 2.1.4. + + - The BDF driver dropped the last glyph in the font. + + - The BDF driver now uses the DEFAULT_CHAR property (if available) + to select a glyph shape for the undefined glyph. + + + II. IMPORTANT CHANGES + + - George Williams contributed code to handle Apple's font + distortion technology found in GX fonts (`avar', `cvar', `fvar', + and `gvar' tables; the Multiple Masters API has been slightly + extended to cope with the new functionality). + + - The `FT_GlyphSlotRec' structure has been extended: The elements + `lsb_delta' and `rsb_delta' give the difference between hinted + and unhinted left and right side bearings if autohinting is + active. Using those values can improve the inter-letter spacing + considerably. See the documentation of `FT_GlyphSlotRec' and + the `ftstring' demo program how to use it. + + + III. MISCELLANEOUS + + - A new documentation file `formats.txt' describes various font + formats supported (and not supported) by FreeType. + + +====================================================================== + LATEST CHANGES BETWEEN 2.1.8 and 2.1.7 I. IMPORTANT BUG FIXES - The native TrueType hinter contained some bugs which prevented some fonts to be rendered correctly, most notably Legendum.otf. - The PostScript hinter now produces improved results. - The linear advance width and height values were incorrectly rounded, making them virtually unusable if not loaded with FT_LOAD_LINEAR_DESIGN. - Indexing CID-keyed CFF fonts is now working: The glyph index is correctly treated as a CID, similar to FreeType's CID driver module. Note that CID CMap support is still missing. - The FT_FACE_FLAGS_GLYPH_NAMES flag is now set correctly for all font formats. Index: xc/extras/freetype2/docs/VERSION.DLL =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/docs/VERSION.DLL,v retrieving revision 1.3 diff -u -2 -0 -r1.3 VERSION.DLL --- xc/extras/freetype2/docs/VERSION.DLL 28 Apr 2004 10:38:59 -0000 1.3 +++ xc/extras/freetype2/docs/VERSION.DLL 7 Mar 2005 18:53:32 -0000 @@ -35,40 +35,41 @@ - FREETYPE_MAJOR : major release number - FREETYPE_MINOR : minor release number - FREETYPE_PATCH : patch release number See below for a small autoconf fragment. The release number is also available at *runtime* through the "FT_Library_Version" API. Unfortunately, this one wasn't available or working correctly before the 2.1.3 official release. 2. History ---------- The following table gives, for each official release, the corresponding libtool number, as well as the shared object number found on _most_ systems, but not all of them: release libtool so ------------------------------- + 2.1.9 9.7.3 6.3.7 2.1.8 9.6.3 6.3.6 2.1.7 9.5.3 6.3.5 2.1.6 9.5.3 6.3.5 2.1.5 9.4.3 6.3.4 2.1.4 9.3.3 6.3.3 2.1.3 9.2.3 6.3.2 2.1.2 9.1.3 6.3.1 2.1.1 9.0.3 ? 2.1.0 8.0.2 ? 2.0.9 9.0.3 ? 2.0.8 8.0.2 ? 2.0.4 7.0.1 ? 2.0.1 6.1.0 ? The libtool numbers are a bit inconsistent due to the library's history: - 2.1.0 was created as a development branch from 2.0.8 (hence the same libtool numbers). - 2.0.9 was a bug-fix release of the "stable" branch, and we Index: xc/extras/freetype2/docs/formats.txt =================================================================== RCS file: xc/extras/freetype2/docs/formats.txt diff -N xc/extras/freetype2/docs/formats.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/extras/freetype2/docs/formats.txt 7 Mar 2005 18:53:32 -0000 @@ -0,0 +1,139 @@ +This file contains a list of various font formats. It gives the +reference document and whether it is supported in FreeType 2. + + + file type: + The only special case is `MAC'; on older Mac OS versions, a `file' + is stored as a data and a resource fork, this is, within two + separate data chunks. In all other cases, the font data is stored + in a single file. + + wrapper format: + The format used to represent the font data. In the table below it + is used only if the font format differs. Possible values are + `SFNT' (binary), `PS' (a text header, followed by binary or text + data), and `LZW' (compressed with either `gzip' or `compress'). + + font format: + How the font is to be accessed, possibly after converting the file + type and wrapper format into a generic form. Bitmap formats are + `BDF', `PCF', and one form of `WINFNT'; all others are vector + formats. + + font type: + Sub-formats of the font format. `SBIT' and `MACSBIT' are bitmap + formats, `MM' and `VAR' support optical axes. + + glyph access: + If not specified, the glyph access is `standard' to the font + format. Values are `CID' for CID-keyed fonts, `SYNTHETIC' for + fonts which are modified versions of other fonts by means of a + transformation matrix, `COLLECTION' for collecting multiple fonts + (sharing most of the data) into a single file, and `TYPE_0' for PS + fonts which are to be accessed in a tree-like structure. + + FreeType driver: + The module in the FreeType library which handles the specific font + format. A missing entry means that FreeType doesn't support the + font format (yet). + + +Please send additions and/or corrections to wl@gnu.org or to the +FreeType developer's list at devel@freetype (for subscribers only). If +you can provide a font example for a format which isn't supported yet +please send a mail too. + + +file wrapper font font glyph FreeType reference +type format format type access driver documents +---------------------------------------------------------------------------- + +--- --- BDF --- --- bdf 5005.BDF_Spec.pdf, X11 + + +--- SFNT PS TYPE_1 --- --- Type 1 GX Font Format + (for the Mac) +MAC SFNT PS TYPE_1 --- --- Type 1 GX Font Format + (for the Mac) +--- SFNT PS TYPE_1 CID --- 5180.sfnt.pdf (for the Mac) +MAC SFNT PS TYPE_1 CID --- 5180.sfnt.pdf (for the Mac) +--- SFNT PS CFF --- cff OT spec, 5176.CFF.pdf + (`OTTO' format) +MAC SFNT PS CFF --- cff OT spec, 5176.CFF.pdf + (`OTTO' format) +--- SFNT PS CFF CID cff OT spec, 5176.CFF.pdf +MAC SFNT PS CFF CID cff OT spec, 5176.CFF.pdf +--- SFNT PS CFF SYNTHETIC --- OT spec, 5176.CFF.pdf +MAC SFNT PS CFF SYNTHETIC --- OT spec, 5176.CFF.pdf +--- SFNT TT SBIT --- --- XFree86? (bitmaps only; + `head' table) +--- SFNT TT MACSBIT --- sfnt OT spec (for the Mac; + bitmaps only; `bhed' table) +MAC SFNT TT MACSBIT --- sfnt OT spec (for the Mac; + bitmaps only; `bhed' table) +--- SFNT TT --- --- truetype OT spec (`normal' TT font) +MAC SFNT TT --- --- truetype OT spec (`normal' TT font) +MAC SFNT TT VAR --- truetype GX spec (`?var' tables) +--- SFNT TT --- COLLECTION truetype OT spec (this can't be CFF) +MAC SFNT TT --- COLLECTION truetype OT spec (this can't be CFF) + + +--- --- PS TYPE_1 --- type1 T1_SPEC.pdf + (`normal' Type 1 font) +MAC --- PS TYPE_1 --- type1 T1_SPEC.pdf + (`normal' Type 1 font) +--- --- PS TYPE_1 CID cid PLRM.pdf (CID Font Type 0; + Type 9 font) +--- --- PS MM --- type1 5015.Type1_Supp.pdf + (Multiple Masters) +--- --- PS CFF --- cff 5176.CFF.pdf (`pure' CFF) +--- --- PS CFF CID cff 5176.CFF.pdf (`pure' CFF) +--- --- PS CFF SYNTHETIC --- 5176.CFF.pdf (`pure' CFF) +--- PS PS CFF --- --- PLRM.pdf (Type 2) [1] +--- PS PS CFF CID --- PLRM.pdf (Type 2) [1] +--- PS PS CFF SYNTHETIC --- PLRM.pdf (Type 2) [1] +--- --- PS --- TYPE_0 --- PLRM.pdf +--- --- PS TYPE_3 --- --- PLRM.pdf (never supported) +--- --- PS TYPE_3 CID --- PLRM.pdf (CID Font Type 1; + Type 10 font; never supported) +--- PS PS TYPE_14 --- --- PLRM.pdf (Chameleon font; + Type 14 font; never supported?) +--- --- PS TYPE_32 CID --- PLRM.pdf (CID Font Type 4; + Type 32 font; never supported?) +--- PS TT --- --- type42 5012.Type42_Spec.pdf + (Type 42 font) +--- PS TT --- CID --- PLRM.pdf (CID Font Type 2; + Type 11 font) + + +--- ? ? CEF ? cff ? + + +--- --- PCF --- --- pcf X11 +--- LZW PCF --- --- pcf X11 + + +--- --- PFR PFR0 --- pfr [2] +--- --- PFR PFR1 --- --- (undocumented, proprietary; + probably never supported) + + +--- --- WINFNT --- --- winfonts MS Windows 3 Developer's Notes +--- --- WINFNT VECTOR --- --- MS Windows 3 Developer's Notes + + +[1] Support should be rather simple since this is identical to `CFF' + but in a PS wrapper. + +[2] Official PFR specification: + + http://www.bitstream.com/categories/developer/truedoc/pfrspec.html + http://www.bitstream.com/categories/developer/truedoc/pfrspec1.2.pdf + + The syntax of the auxiliary data is not defined there, but is partially + defined in MHP 1.0.3 (also called ETSI TS 101812 V1.3.1) section 7.4. + + http://www.etsi.org/ + http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=18799 + + (free registration required). Index: xc/extras/freetype2/include/freetype/freetype.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/freetype.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 freetype.h --- xc/extras/freetype2/include/freetype/freetype.h 28 Apr 2004 10:38:59 -0000 1.3 +++ xc/extras/freetype2/include/freetype/freetype.h 7 Mar 2005 18:53:35 -0000 @@ -27,41 +27,41 @@ #ifndef __FREETYPE_H__ #define __FREETYPE_H__ /*************************************************************************/ /* */ /* The `raster' component duplicates some of the declarations in */ /* freetype.h for stand-alone use if _FREETYPE_ isn't defined. */ /* */ /*************************************************************************/ /* */ /* The FREETYPE_MAJOR and FREETYPE_MINOR macros are used to version the */ /* new FreeType design, which is able to host several kinds of font */ /* drivers. It starts at 2.0. */ /* */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 1 -#define FREETYPE_PATCH 8 +#define FREETYPE_PATCH 9 #include #include FT_CONFIG_CONFIG_H #include FT_ERRORS_H #include FT_TYPES_H FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ /* */ /* B A S I C T Y P E S */ /* */ /*************************************************************************/ /*************************************************************************/ @@ -155,134 +155,144 @@ /* FT_LOAD_FORCE_AUTOHINT */ /* FT_LOAD_NO_RECURSE */ /* FT_LOAD_PEDANTIC */ /* */ /* FT_LOAD_TARGET_NORMAL */ /* FT_LOAD_TARGET_LIGHT */ /* FT_LOAD_TARGET_MONO */ /* FT_LOAD_TARGET_LCD */ /* FT_LOAD_TARGET_LCD_V */ /* */ /* FT_Render_Glyph */ /* FT_Render_Mode */ /* FT_Get_Kerning */ /* FT_Kerning_Mode */ /* FT_Get_Glyph_Name */ /* FT_Get_Postscript_Name */ /* */ /* FT_CharMapRec */ /* FT_Select_Charmap */ /* FT_Set_Charmap */ + /* FT_Get_Charmap_Index */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* */ /* FT_Glyph_Metrics */ /* */ /* */ /* A structure used to model the metrics of a single glyph. The */ /* values are expressed in 26.6 fractional pixel format; if the flag */ /* FT_LOAD_NO_SCALE is used, values are returned in font units */ /* 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 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 horiBearingX; + FT_Pos horiBearingY; + FT_Pos horiAdvance; + + FT_Pos vertBearingX; + FT_Pos vertBearingY; + FT_Pos vertAdvance; } FT_Glyph_Metrics; /*************************************************************************/ /* */ /* */ /* FT_Bitmap_Size */ /* */ /* */ /* This structure models the size of a bitmap strike (i.e., a bitmap */ /* instance of the font for a given resolution) in a fixed-size font */ /* face. It is used for the `available_sizes' field of the */ /* @FT_FaceRec structure. */ /* */ /* */ /* height :: The (vertical) baseline-to-baseline distance in pixels. */ /* It makes most sense to define the height of a bitmap */ /* font in this way. */ /* */ /* width :: The average width of the font (in pixels). Since the */ /* algorithms to compute this value are different for the */ /* various bitmap formats, it can only give an additional */ /* hint if the `height' value isn't sufficient to select */ /* the proper font. For monospaced fonts the average width */ /* is the same as the maximum width. */ /* */ /* size :: The point size in 26.6 fractional format this font shall */ /* represent (for a given vertical resolution). */ /* */ /* 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 */ /* the font doesn't provide a parameter it is set to zero to indicate */ /* that the information is not available. */ /* */ /* The following formula converts from dpi to ppem: */ /* */ /* ppem = size * dpi / 72 */ /* */ /* 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 */ /* bitmap strike itself. They are computed from the global font */ /* parameters. */ /* */ typedef struct FT_Bitmap_Size_ { FT_Short height; FT_Short width; FT_Pos size; FT_Pos x_ppem; FT_Pos y_ppem; } FT_Bitmap_Size; /*************************************************************************/ @@ -1442,86 +1452,125 @@ /* For now this is internal to FreeType. */ /* */ /* subglyphs :: An array of subglyph descriptors for */ /* composite glyphs. There are `num_subglyphs' */ /* elements in there. Currently internal to */ /* FreeType. */ /* */ /* control_data :: Certain font drivers can also return the */ /* control data for a given glyph image (e.g. */ /* TrueType bytecode, Type 1 charstrings, etc.). */ /* This field is a pointer to such data. */ /* */ /* control_len :: This is the length in bytes of the control */ /* data. */ /* */ /* other :: Really wicked formats can use this pointer to */ /* present their own glyph image to client apps. */ /* 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 */ /* its native format (e.g. a vectorial outline for TrueType and */ /* Type 1 formats). */ /* */ /* This image can later be converted into a bitmap by calling */ /* @FT_Render_Glyph. This function finds the current renderer for */ /* the native image's format then invokes it. */ /* */ /* The renderer is in charge of transforming the native image through */ /* the slot's face transformation fields, then convert it into a */ /* bitmap that is returned in `slot->bitmap'. */ /* */ /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */ /* to specify the position of the bitmap relative to the current pen */ /* 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; FT_Face face; FT_GlyphSlot next; FT_UInt reserved; /* retained for binary compatibility */ FT_Generic generic; FT_Glyph_Metrics metrics; FT_Fixed linearHoriAdvance; FT_Fixed linearVertAdvance; FT_Vector advance; FT_Glyph_Format format; FT_Bitmap bitmap; FT_Int bitmap_left; FT_Int bitmap_top; FT_Outline outline; FT_UInt num_subglyphs; FT_SubGlyph subglyphs; void* control_data; long control_len; + FT_Pos lsb_delta; + FT_Pos rsb_delta; + void* other; FT_Slot_Internal internal; } FT_GlyphSlotRec; /*************************************************************************/ /*************************************************************************/ /* */ /* F U N C T I O N S */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* */ /* FT_Init_FreeType */ @@ -2657,40 +2706,59 @@ /* face :: A handle to the source face object. */ /* */ /* */ /* charmap :: A handle to the selected charmap. */ /* */ /* */ /* FreeType error code. 0 means success. */ /* */ /* */ /* This function will return an error if the charmap is not part of */ /* the face (i.e., if it is not listed in the face->charmaps[] */ /* table). */ /* */ FT_EXPORT( FT_Error ) FT_Set_Charmap( FT_Face face, 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 ); + + + /*************************************************************************/ + /* */ /* */ /* FT_Get_Char_Index */ /* */ /* */ /* Returns the glyph index of a given character code. This function */ /* uses a charmap object to do the translation. */ /* */ /* */ /* face :: A handle to the source face object. */ /* */ /* charcode :: The character code. */ /* */ /* */ /* The glyph index. 0 means `undefined character code'. */ /* */ /* */ /* FreeType computes its own glyph indices which are not necessarily */ /* the same as used in the font in case the font is based on glyph */ /* indices. Reason for this behaviour is to assure that index 0 is */ /* never used, representing the missing glyph. */ Index: xc/extras/freetype2/include/freetype/ftcache.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/ftcache.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftcache.h --- xc/extras/freetype2/include/freetype/ftcache.h 28 Apr 2004 10:38:59 -0000 1.3 +++ xc/extras/freetype2/include/freetype/ftcache.h 7 Mar 2005 18:53:35 -0000 @@ -38,65 +38,71 @@ #include #include FT_GLYPH_H FT_BEGIN_HEADER /*************************************************************************/ /* */ /*
*/ /* cache_subsystem */ /* */ /* */ /* Cache Sub-System */ /* */ /* <Abstract> */ /* How to cache face, size, and glyph data with FreeType 2. */ /* */ /* <Description> */ /* This section describes the FreeType 2 cache sub-system which is */ - /* stile in beta. */ + /* still in beta. */ /* */ /* <Order> */ /* FTC_Manager */ /* FTC_FaceID */ /* 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 */ /* FTC_ImageCache */ /* FTC_ImageCache_New */ /* FTC_ImageCache_Lookup */ /* */ /* FTC_SBit */ /* FTC_SBitCache */ /* FTC_SBitCache_New */ /* FTC_SBitCache_Lookup */ /* */ + /* FTC_CMapCache */ + /* FTC_CMapCache_New */ + /* FTC_CMapCache_Lookup */ + /* */ /* */ /* FTC_Image_Desc */ /* FTC_Image_Cache */ /* FTC_Image_Cache_Lookup */ /* */ /* FTC_SBit_Cache */ /* FTC_SBit_Cache_Lookup */ /* */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** BASIC TYPE DEFINITIONS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -485,60 +491,55 @@ /* Create a new charmap cache. */ /* */ /* @input: */ /* manager :: A handle to the cache manager. */ /* */ /* @output: */ /* acache :: A new cache handle. NULL in case of error. */ /* */ /* @return: */ /* FreeType error code. 0 means success. */ /* */ /* @note: */ /* Like all other caches, this one will be destroyed with the cache */ /* manager. */ /* */ FT_EXPORT( FT_Error ) FTC_CMapCache_New( FTC_Manager manager, FTC_CMapCache *acache ); - /* retrieve the index of a given charmap */ - FT_EXPORT( FT_Int ) - FT_Get_CharMap_Index( FT_CharMap charmap ); - - /*************************************************************************/ /* */ /* @function: */ /* FTC_CMapCache_Lookup */ /* */ /* @description: */ /* Translate a character code into a glyph index, using the charmap */ /* cache. */ /* */ /* @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). */ /* */ /* @return: */ /* Glyph index. 0 means `no glyph'. */ /* */ FT_EXPORT( FT_UInt ) FTC_CMapCache_Lookup( FTC_CMapCache cache, FTC_FaceID face_id, FT_Int cmap_index, FT_UInt32 char_code ); /*************************************************************************/ /* */ /* <Section> */ /* cache_subsystem */ /* */ /*************************************************************************/ Index: xc/extras/freetype2/include/freetype/ftmm.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/ftmm.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftmm.h --- xc/extras/freetype2/include/freetype/ftmm.h 23 Apr 2004 18:42:45 -0000 1.2 +++ xc/extras/freetype2/include/freetype/ftmm.h 7 Mar 2005 18:53:35 -0000 @@ -1,188 +1,378 @@ /***************************************************************************/ /* */ /* ftmm.h */ /* */ /* 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, */ /* 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 __FTMM_H__ #define __FTMM_H__ #include <ft2build.h> #include FT_TYPE1_TABLES_H FT_BEGIN_HEADER /*************************************************************************/ /* */ /* <Section> */ /* multiple_masters */ /* */ /* <Title> */ /* Multiple Masters */ /* */ /* <Abstract> */ /* How to manage Multiple Masters fonts. */ /* */ /* <Description> */ /* The following types and functions are used to manage Multiple */ /* 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. */ + /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Struct> */ /* FT_MM_Axis */ /* */ /* <Description> */ /* 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. */ /* */ /* minimum :: The axis's minimum design coordinate. */ /* */ /* maximum :: The axis's maximum design coordinate. */ /* */ typedef struct FT_MM_Axis_ { FT_String* name; FT_Long minimum; FT_Long maximum; } FT_MM_Axis; /*************************************************************************/ /* */ /* <Struct> */ /* FT_Multi_Master */ /* */ /* <Description> */ /* 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. */ /* */ /* num_designs :: Number of designs; should ne normally 2^num_axis */ /* even though the Type 1 specification strangely */ /* allows for intermediate designs to be present. This */ /* number cannot exceed 16. */ /* */ /* axis :: A table of axis descriptors. */ /* */ typedef struct FT_Multi_Master_ { FT_UInt num_axis; FT_UInt num_designs; FT_MM_Axis axis[T1_MAX_MM_AXIS]; } 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> */ /* FT_Get_Multi_Master */ /* */ /* <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. */ /* */ /* <Output> */ /* amaster :: The Multiple Masters descriptor. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT( FT_Error ) FT_Get_Multi_Master( FT_Face face, 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> */ /* FT_Set_MM_Design_Coordinates */ /* */ /* <Description> */ /* 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. */ /* */ /* <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_MM_Design_Coordinates( FT_Face face, FT_UInt num_coords, 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. */ /* */ /* <Input> */ /* num_coords :: The number of design coordinates (must be equal to */ /* the number of axes in the font). */ /* */ /* coords :: The design coordinates array (each element must be */ /* between 0 and 1.0). */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ FT_EXPORT( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, 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 ); + + /* */ FT_END_HEADER #endif /* __FTMM_H__ */ /* END */ Index: xc/extras/freetype2/include/freetype/t1tables.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/t1tables.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 t1tables.h --- xc/extras/freetype2/include/freetype/t1tables.h 28 Apr 2004 10:38:59 -0000 1.3 +++ xc/extras/freetype2/include/freetype/t1tables.h 7 Mar 2005 18:53:36 -0000 @@ -209,41 +209,41 @@ #define t1_blend_family_blues T1_BLEND_FAMILY_BLUES #define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES #define t1_blend_force_bold T1_BLEND_FORCE_BOLD #define t1_blend_max T1_BLEND_MAX /* maximum number of Multiple Masters designs, as defined in the spec */ #define T1_MAX_MM_DESIGNS 16 /* maximum number of Multiple Masters axes, as defined in the spec */ #define T1_MAX_MM_AXIS 4 /* maximum number of elements in a design map */ #define T1_MAX_MM_MAP_POINTS 20 /* this structure is used to store the BlendDesignMap entry for an axis */ typedef struct PS_DesignMap_ { FT_Byte num_points; - FT_Fixed* design_points; + FT_Long* design_points; FT_Fixed* blend_points; } PS_DesignMapRec, *PS_DesignMap; /* backwards-compatible definition */ typedef PS_DesignMapRec T1_DesignMap; typedef struct PS_BlendRec_ { FT_UInt num_designs; FT_UInt num_axis; FT_String* axis_names[T1_MAX_MM_AXIS]; FT_Fixed* design_pos[T1_MAX_MM_DESIGNS]; PS_DesignMapRec design_map[T1_MAX_MM_AXIS]; FT_Fixed* weight_vector; FT_Fixed* default_weight_vector; Index: xc/extras/freetype2/include/freetype/tttables.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/tttables.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 tttables.h --- xc/extras/freetype2/include/freetype/tttables.h 28 Apr 2004 10:38:59 -0000 1.3 +++ xc/extras/freetype2/include/freetype/tttables.h 7 Mar 2005 18:53:36 -0000 @@ -1,28 +1,28 @@ /***************************************************************************/ /* */ /* tttables.h */ /* */ /* 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, */ /* 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 __TTTABLES_H__ #define __TTTABLES_H__ #include <ft2build.h> #include FT_FREETYPE_H #ifdef FREETYPE_H #error "freetype.h of FreeType 1 has been loaded!" @@ -499,46 +499,45 @@ /* maxTwilightPoints :: The maximum number of points in the */ /* twilight zone used for glyph hinting. */ /* */ /* maxStorage :: The maximum number of elements in the */ /* storage area used for glyph hinting. */ /* */ /* maxFunctionDefs :: The maximum number of function */ /* definitions in the TrueType bytecode for */ /* this font. */ /* */ /* maxInstructionDefs :: The maximum number of instruction */ /* definitions in the TrueType bytecode for */ /* this font. */ /* */ /* maxStackElements :: The maximum number of stack elements used */ /* during bytecode interpretation. */ /* */ /* 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. */ /* */ typedef struct TT_MaxProfile_ { FT_Fixed version; FT_UShort numGlyphs; FT_UShort maxPoints; FT_UShort maxContours; FT_UShort maxCompositePoints; FT_UShort maxCompositeContours; FT_UShort maxZones; FT_UShort maxTwilightPoints; FT_UShort maxStorage; FT_UShort maxFunctionDefs; FT_UShort maxInstructionDefs; FT_UShort maxStackElements; FT_UShort maxSizeOfInstructions; FT_UShort maxComponentElements; Index: xc/extras/freetype2/include/freetype/tttags.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/tttags.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 tttags.h --- xc/extras/freetype2/include/freetype/tttags.h 23 Apr 2004 18:42:45 -0000 1.2 +++ xc/extras/freetype2/include/freetype/tttags.h 7 Mar 2005 18:53:36 -0000 @@ -1,80 +1,83 @@ /***************************************************************************/ /* */ /* tttags.h */ /* */ /* Tags for TrueType 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, */ /* 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 __TTAGS_H__ #define __TTAGS_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 +#define TTAG_avar FT_MAKE_TAG( 'a', 'v', 'a', 'r' ) +#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_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_bdat FT_MAKE_TAG( 'b', 'd', 'a', 't' ) -#define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) #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_glyf FT_MAKE_TAG( 'g', 'l', 'y', 'f' ) #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_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' ) #define TTAG_PCLT FT_MAKE_TAG( 'P', 'C', 'L', 'T' ) #define TTAG_post FT_MAKE_TAG( 'p', 'o', 's', 't' ) #define TTAG_prep FT_MAKE_TAG( 'p', 'r', 'e', 'p' ) #define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' ) #define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' ) #define TTAG_ttcf FT_MAKE_TAG( 't', 't', 'c', 'f' ) #define TTAG_VDMX FT_MAKE_TAG( 'V', 'D', 'M', 'X' ) #define TTAG_vhea FT_MAKE_TAG( 'v', 'h', 'e', 'a' ) #define TTAG_vmtx FT_MAKE_TAG( 'v', 'm', 't', 'x' ) FT_END_HEADER #endif /* __TTAGS_H__ */ /* END */ Index: xc/extras/freetype2/include/freetype/cache/ftcmru.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/cache/ftcmru.h,v retrieving revision 1.1 diff -u -2 -0 -r1.1 ftcmru.h --- xc/extras/freetype2/include/freetype/cache/ftcmru.h 28 Apr 2004 10:39:00 -0000 1.1 +++ xc/extras/freetype2/include/freetype/cache/ftcmru.h 7 Mar 2005 18:53:36 -0000 @@ -69,41 +69,41 @@ FT_EXPORT( void ) FTC_MruNode_Prepend( FTC_MruNode *plist, FTC_MruNode node ); FT_EXPORT( void ) FTC_MruNode_Up( FTC_MruNode *plist, FTC_MruNode node ); FT_EXPORT( void ) FTC_MruNode_Remove( FTC_MruNode *plist, FTC_MruNode node ); typedef struct FTC_MruListRec_* FTC_MruList; typedef struct FTC_MruListClassRec_ const * FTC_MruListClass; - typedef FT_Int + typedef FT_Bool (*FTC_MruNode_CompareFunc)( FTC_MruNode node, FT_Pointer key ); typedef FT_Error (*FTC_MruNode_InitFunc)( FTC_MruNode node, FT_Pointer key, FT_Pointer data ); typedef FT_Error (*FTC_MruNode_ResetFunc)( FTC_MruNode node, FT_Pointer key, FT_Pointer data ); typedef void (*FTC_MruNode_DoneFunc)( FTC_MruNode node, FT_Pointer data ); typedef struct FTC_MruListClassRec_ { @@ -137,41 +137,41 @@ FT_EXPORT( void ) FTC_MruList_Reset( FTC_MruList list ); FT_EXPORT( void ) FTC_MruList_Done( FTC_MruList list ); FT_EXPORT( FTC_MruNode ) FTC_MruList_Find( FTC_MruList list, FT_Pointer key ); FT_EXPORT( FT_Error ) FTC_MruList_New( FTC_MruList list, FT_Pointer key, FTC_MruNode *anode ); FT_EXPORT( FT_Error ) FTC_MruList_Lookup( FTC_MruList list, FT_Pointer key, FTC_MruNode *pnode ); - + FT_EXPORT( void ) FTC_MruList_Remove( FTC_MruList list, FTC_MruNode node ); FT_EXPORT( void ) FTC_MruList_RemoveSelection( FTC_MruList list, FTC_MruNode_CompareFunc selection, FT_Pointer key ); #ifdef FTC_INLINE #define FTC_MRULIST_LOOKUP_CMP( list, key, compare, node, error ) \ FT_BEGIN_STMNT \ FTC_MruNode* _pfirst = &(list)->nodes; \ FTC_MruNode_CompareFunc _compare = (FTC_MruNode_CompareFunc)(compare); \ FTC_MruNode _first, _node; \ \ \ @@ -191,41 +191,41 @@ \ *(FTC_MruNode*)&(node) = _node; \ goto _MruOk; \ } \ _node = _node->next; \ \ } while ( _node != _first) ; \ } \ \ error = FTC_MruList_New( (list), (key), (FTC_MruNode*)&(node) ); \ _MruOk: \ ; \ FT_END_STMNT #define FTC_MRULIST_LOOKUP( list, key, node, error ) \ FTC_MRULIST_LOOKUP_CMP( list, key, (list)->clazz.node_compare, node, error ) #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 */ #define FTC_MRULIST_LOOP( list, node ) \ FT_BEGIN_STMNT \ FTC_MruNode _first = (list)->nodes; \ \ \ if ( _first ) \ { \ FTC_MruNode _node = _first; \ \ \ do \ { \ *(FTC_MruNode*)&(node) = _node; #define FTC_MRULIST_LOOP_END() \ Index: xc/extras/freetype2/include/freetype/config/ftmodule.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/config/ftmodule.h,v retrieving revision 1.1.1.2 diff -u -2 -0 -r1.1.1.2 ftmodule.h --- xc/extras/freetype2/include/freetype/config/ftmodule.h 25 Nov 2003 19:27:18 -0000 1.1.1.2 +++ xc/extras/freetype2/include/freetype/config/ftmodule.h 7 Mar 2005 18:53:36 -0000 @@ -1,19 +1,19 @@ FT_USE_MODULE(autohint_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(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) FT_USE_MODULE(ft_raster1_renderer_class) 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) Index: xc/extras/freetype2/include/freetype/config/ftoption.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/config/ftoption.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftoption.h --- xc/extras/freetype2/include/freetype/config/ftoption.h 28 Apr 2004 10:39:00 -0000 1.3 +++ xc/extras/freetype2/include/freetype/config/ftoption.h 7 Mar 2005 18:53:37 -0000 @@ -467,40 +467,50 @@ /*************************************************************************/ /* */ /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */ /* TrueType glyph loader to use Apple's definition of how to handle */ /* component offsets in composite glyphs. */ /* */ /* Apple and MS disagree on the default behavior of component offsets */ /* in composites. Apple says that they should be scaled by the scale */ /* factors in the transformation matrix (roughly, it's more complex) */ /* while MS says they should not. OpenType defines two bits in the */ /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ /* http://partners.adobe.com/asn/developer/opentype/glyf.html */ /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED /*************************************************************************/ + /* */ + /* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */ + /* support for Apple's distortable font technology (fvar, gvar, cvar, */ + /* and avar tables). This has many similarities to Type 1 Multiple */ + /* Masters support. */ + /* */ +#define TT_CONFIG_OPTION_GX_VAR_SUPPORT + + + /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ /* required. */ /* */ #define T1_MAX_DICT_DEPTH 5 /*************************************************************************/ /* */ /* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */ Index: xc/extras/freetype2/include/freetype/internal/ftmemory.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/internal/ftmemory.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftmemory.h --- xc/extras/freetype2/include/freetype/internal/ftmemory.h 28 Apr 2004 10:39:00 -0000 1.3 +++ xc/extras/freetype2/include/freetype/internal/ftmemory.h 7 Mar 2005 18:53:37 -0000 @@ -48,119 +48,147 @@ /*************************************************************************/ /**** ****/ /**** ****/ /**** M E M O R Y ****/ /**** ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ #ifdef FT_DEBUG_MEMORY FT_BASE( FT_Error ) FT_Alloc_Debug( FT_Memory memory, FT_Long size, void* *P, 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, FT_Long size, void* *P, 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, const char* file_name, FT_Long line_no ); #endif /*************************************************************************/ /* */ /* <Function> */ /* FT_Alloc */ /* */ /* <Description> */ /* Allocates a new block of memory. The returned area is always */ /* zero-filled; this is a strong convention in many FreeType parts. */ /* */ /* <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_Alloc( FT_Memory memory, FT_Long size, void* *P ); + FT_BASE( FT_Error ) + FT_QAlloc( FT_Memory memory, + FT_Long size, + void* *p ); + + /*************************************************************************/ /* */ /* <Function> */ /* FT_Realloc */ /* */ /* <Description> */ /* Reallocates a block of memory pointed to by `*P' to `Size' bytes */ /* from the heap, possibly changing `*P'. */ /* */ /* <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_Realloc( FT_Memory memory, FT_Long current, FT_Long size, void* *P ); + FT_BASE( FT_Error ) + FT_QRealloc( FT_Memory memory, + FT_Long current, + FT_Long size, + void* *p ); + + /*************************************************************************/ /* */ /* <Function> */ /* FT_Free */ /* */ /* <Description> */ /* Releases a given block of memory allocated through FT_Alloc(). */ /* */ /* <Input> */ /* memory :: A handle to a given `memory object' which handles */ /* memory deallocation */ /* */ /* P :: This is the _address_ of a _pointer_ which points to the */ /* allocated block. It is always set to NULL on exit. */ /* */ /* <Note> */ /* If P or *P is NULL, this function should return successfully. */ /* This is a strong convention within all of FreeType and its */ /* drivers. */ /* */ @@ -187,113 +215,153 @@ FT_MEM_MOVE( dest, source, (count) * sizeof( *(dest) ) ) /*************************************************************************/ /* */ /* We first define FT_MEM_ALLOC, FT_MEM_REALLOC, and FT_MEM_FREE. All */ /* macros use an _implicit_ `memory' parameter to access the current */ /* memory allocator. */ /* */ #ifdef FT_DEBUG_MEMORY #define FT_MEM_ALLOC( _pointer_, _size_ ) \ FT_Alloc_Debug( memory, _size_, \ (void**)&(_pointer_), __FILE__, __LINE__ ) #define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ FT_Realloc_Debug( memory, _current_, _size_, \ (void**)&(_pointer_), __FILE__, __LINE__ ) +#define FT_MEM_QALLOC( _pointer_, _size_ ) \ + FT_QAlloc_Debug( memory, _size_, \ + (void**)&(_pointer_), __FILE__, __LINE__ ) + +#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ + FT_QRealloc_Debug( memory, _current_, _size_, \ + (void**)&(_pointer_), __FILE__, __LINE__ ) + #define FT_MEM_FREE( _pointer_ ) \ FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ ) #else /* !FT_DEBUG_MEMORY */ #define FT_MEM_ALLOC( _pointer_, _size_ ) \ FT_Alloc( memory, _size_, (void**)&(_pointer_) ) #define FT_MEM_FREE( _pointer_ ) \ FT_Free( memory, (void**)&(_pointer_) ) #define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \ FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) ) +#define FT_MEM_QALLOC( _pointer_, _size_ ) \ + FT_QAlloc( memory, _size_, (void**)&(_pointer_) ) + +#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \ + FT_QRealloc( memory, _current_, _size_, (void**)&(_pointer_) ) #endif /* !FT_DEBUG_MEMORY */ /*************************************************************************/ /* */ /* The following functions macros expect that their pointer argument is */ /* _typed_ in order to automatically compute array element sizes. */ /* */ #define FT_MEM_NEW( _pointer_ ) \ FT_MEM_ALLOC( _pointer_, sizeof ( *(_pointer_) ) ) #define FT_MEM_NEW_ARRAY( _pointer_, _count_ ) \ FT_MEM_ALLOC( _pointer_, (_count_) * sizeof ( *(_pointer_) ) ) #define FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) \ 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_) ) ) + /*************************************************************************/ /* */ /* the following macros are obsolete but kept for compatibility reasons */ /* */ #define FT_MEM_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ FT_MEM_ALLOC( _pointer_, (_count_) * sizeof ( _type_ ) ) #define FT_MEM_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \ FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( _type ), \ (_new_) * sizeof ( _type_ ) ) /*************************************************************************/ /* */ /* The following macros are variants of their FT_MEM_XXXX equivalents; */ /* they are used to set an _implicit_ `error' variable and return TRUE */ /* if an error occured (i.e. if 'error != 0'). */ /* */ #define FT_ALLOC( _pointer_, _size_ ) \ FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, _size_ ) ) #define FT_REALLOC( _pointer_, _current_, _size_ ) \ FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, _current_, _size_ ) ) #define FT_FREE( _pointer_ ) \ FT_MEM_FREE( _pointer_ ) +#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_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_RENEW_ARRAY( _pointer_, _old_, _new_ ) \ FT_SET_ERROR( FT_MEM_RENEW_ARRAY( _pointer_, _old_, _new_ ) ) +#define FT_QNEW( _pointer_ ) \ + FT_SET_ERROR( FT_MEM_QNEW( _pointer_ ) ) + +#define FT_QNEW_ARRAY( _pointer_, _count_ ) \ + FT_SET_ERROR( FT_MEM_QNEW_ARRAY( _pointer_, _count_ ) ) + +#define FT_QRENEW_ARRAY( _pointer_, _old_, _new_ ) \ + FT_SET_ERROR( FT_MEM_QRENEW_ARRAY( _pointer_, _old_, _new_ ) ) + + #define FT_ALLOC_ARRAY( _pointer_, _count_, _type_ ) \ FT_SET_ERROR( FT_MEM_ALLOC( _pointer_, \ (_count_) * sizeof ( _type_ ) ) ) #define FT_REALLOC_ARRAY( _pointer_, _old_, _new_, _type_ ) \ FT_SET_ERROR( FT_MEM_REALLOC( _pointer_, \ (_old_) * sizeof ( _type_ ), \ (_new_) * sizeof ( _type_ ) ) ) /* */ FT_END_HEADER #endif /* __FTMEMORY_H__ */ /* END */ Index: xc/extras/freetype2/include/freetype/internal/ftstream.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/internal/ftstream.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftstream.h --- xc/extras/freetype2/include/freetype/internal/ftstream.h 28 Apr 2004 10:39:00 -0000 1.2 +++ xc/extras/freetype2/include/freetype/internal/ftstream.h 7 Mar 2005 18:53:37 -0000 @@ -252,56 +252,76 @@ #define FT_NEXT_USHORT_LE( buffer ) \ ( (unsigned short)( buffer += 2, FT_PEEK_USHORT_LE( buffer - 2 ) ) ) #define FT_NEXT_OFF3_LE( buffer ) \ ( (long)( buffer += 3, FT_PEEK_OFF3_LE( buffer - 3 ) ) ) #define FT_NEXT_UOFF3_LE( buffer ) \ ( (unsigned long)( buffer += 3, FT_PEEK_UOFF3_LE( buffer - 3 ) ) ) #define FT_NEXT_LONG_LE( buffer ) \ ( (long)( buffer += 4, FT_PEEK_LONG_LE( buffer - 4 ) ) ) #define FT_NEXT_ULONG_LE( buffer ) \ ( (unsigned long)( buffer += 4, FT_PEEK_ULONG_LE( buffer - 4 ) ) ) /*************************************************************************/ /* */ /* 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 ) #define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte ) #define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_Short ) #define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort ) #define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long ) #define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong ) #define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetLong, FT_Long ) #define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) #define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) #define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short ) #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 ), \ error != FT_Err_Ok ) #define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var ) #define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var ) #define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var ) #define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var ) #define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var ) #define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var ) #define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var ) #define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var ) #define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var ) #define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var ) #define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var ) #define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var ) Index: xc/extras/freetype2/include/freetype/internal/fttrace.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/internal/fttrace.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 fttrace.h --- xc/extras/freetype2/include/freetype/internal/fttrace.h 28 Apr 2004 10:39:00 -0000 1.2 +++ xc/extras/freetype2/include/freetype/internal/fttrace.h 7 Mar 2005 18:53:37 -0000 @@ -36,40 +36,41 @@ 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 */ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ /* SFNT driver components */ FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */ FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.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 */ 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 */ FT_TRACE_DEF( t1driver ) FT_TRACE_DEF( t1gload ) FT_TRACE_DEF( t1hint ) FT_TRACE_DEF( t1load ) FT_TRACE_DEF( t1objs ) FT_TRACE_DEF( t1parse ) /* PostScript helper module `psaux' */ FT_TRACE_DEF( t1decode ) FT_TRACE_DEF( psobjs ) /* PostScript hinting module `pshinter' */ FT_TRACE_DEF( pshrec ) FT_TRACE_DEF( pshalgo1 ) FT_TRACE_DEF( pshalgo2 ) /* Type 2 driver components */ FT_TRACE_DEF( cffdriver ) Index: xc/extras/freetype2/include/freetype/internal/psaux.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/internal/psaux.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 psaux.h --- xc/extras/freetype2/include/freetype/internal/psaux.h 28 Apr 2004 10:39:00 -0000 1.3 +++ xc/extras/freetype2/include/freetype/internal/psaux.h 7 Mar 2005 18:53:38 -0000 @@ -1,28 +1,28 @@ /***************************************************************************/ /* */ /* psaux.h */ /* */ /* 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, */ /* 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 __PSAUX_H__ #define __PSAUX_H__ #include <ft2build.h> #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_TYPE1_TYPES_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H @@ -461,40 +461,51 @@ void (*init)( T1_Builder builder, FT_Face face, FT_Size size, FT_GlyphSlot slot, FT_Bool hinting ); void (*done)( T1_Builder builder ); T1_Builder_Check_Points_Func check_points; T1_Builder_Add_Point_Func add_point; T1_Builder_Add_Point1_Func add_point1; T1_Builder_Add_Contour_Func add_contour; T1_Builder_Start_Point_Func start_point; T1_Builder_Close_Contour_Func close_contour; } 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> */ /* T1_BuilderRec */ /* */ /* <Description> */ /* A structure used during glyph loading to store its outline. */ /* */ /* <Fields> */ /* memory :: The current memory object. */ /* */ /* face :: The current face object. */ /* */ /* glyph :: The current glyph slot. */ /* */ /* loader :: XXX */ /* */ /* base :: The base glyph outline. */ /* */ /* current :: The current glyph outline. */ @@ -502,82 +513,79 @@ /* max_points :: maximum points in builder outline */ /* */ /* max_contours :: Maximal number of contours in builder outline. */ /* */ /* last :: The last point position. */ /* */ /* scale_x :: The horizontal scale (FUnits to sub-pixels). */ /* */ /* scale_y :: The vertical scale (FUnits to sub-pixels). */ /* */ /* pos_x :: The horizontal translation (if composite glyph). */ /* */ /* pos_y :: The vertical translation (if composite glyph). */ /* */ /* left_bearing :: The left side bearing point. */ /* */ /* advance :: The horizontal advance vector. */ /* */ /* 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. */ /* */ /* funcs :: An array of function pointers for the builder. */ /* */ typedef struct T1_BuilderRec_ { FT_Memory memory; FT_Face face; FT_GlyphSlot glyph; FT_GlyphLoader loader; FT_Outline* base; FT_Outline* current; FT_Vector last; FT_Fixed scale_x; FT_Fixed scale_y; FT_Pos pos_x; FT_Pos pos_y; FT_Vector left_bearing; 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 */ void* hints_globals; /* hinter-specific */ T1_Builder_FuncsRec funcs; } T1_BuilderRec; /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** T1 DECODER *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ #if 0 Index: xc/extras/freetype2/include/freetype/internal/tttypes.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/internal/tttypes.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 tttypes.h --- xc/extras/freetype2/include/freetype/internal/tttypes.h 28 Apr 2004 10:39:00 -0000 1.3 +++ xc/extras/freetype2/include/freetype/internal/tttypes.h 7 Mar 2005 18:53:39 -0000 @@ -1,47 +1,51 @@ /***************************************************************************/ /* */ /* tttypes.h */ /* */ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* 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, */ /* 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 __TTTYPES_H__ #define __TTTYPES_H__ #include <ft2build.h> #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 /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*** ***/ /*** ***/ /*** REQUIRED TRUETYPE/OPENTYPE TABLES DEFINITIONS ***/ /*** ***/ /*** ***/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* <Struct> */ @@ -806,40 +810,58 @@ /* */ typedef struct TT_Post_NamesRec_ { FT_Bool loaded; union { TT_Post_20Rec format_20; TT_Post_25Rec format_25; } names; } TT_Post_NamesRec, *TT_Post_Names; /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*** ***/ /*** ***/ + /*** GX VARIATION TABLE SUPPORT ***/ + /*** ***/ + /*** ***/ + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + + +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + typedef struct GX_BlendRec_ *GX_Blend; +#endif + + + /*************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /*** ***/ + /*** ***/ /*** ORIGINAL TT_FACE CLASS DEFINITION ***/ /*** ***/ /*** ***/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /* */ /* This structure/class is defined here because it is common to the */ /* following formats: TTF, OpenType-TT, and OpenType-CFF. */ /* */ /* Note, however, that the classes TT_Size and TT_GlyphSlot are not */ /* shared between font drivers, and are thus defined in `ttobjs.h'. */ /* */ /*************************************************************************/ /*************************************************************************/ @@ -1135,42 +1157,52 @@ /* units. Comes from the `cvt ' table. */ /* Ignored for Type 2 fonts. */ /* */ /* num_kern_pairs :: The number of kerning pairs present in the */ /* font file. The engine only loads the */ /* first horizontal format 0 kern table it */ /* finds in the font file. Ignored for */ /* Type 2 fonts. */ /* */ /* kern_table_index :: The index of the kerning table in the font */ /* kerning directory. Ignored for Type 2 */ /* fonts. */ /* */ /* interpreter :: A pointer to the TrueType bytecode */ /* interpreters field is also used to hook */ /* the debugger in `ttdebug'. */ /* */ /* 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; TTC_HeaderRec ttc_header; FT_ULong format_tag; FT_UShort num_tables; TT_Table dir_tables; TT_Header header; /* TrueType header table */ TT_HoriHeader horizontal; /* TrueType horizontal header */ TT_MaxProfile max_profile; FT_ULong max_components; FT_Bool vertical_info; TT_VertHeader vertical; /* TT Vertical header, if present */ FT_UShort num_names; /* number of name records */ @@ -1244,40 +1276,45 @@ FT_Byte* cvt_program; /* the original, unscaled, control value table */ FT_ULong cvt_size; FT_Short* cvt; /* the format 0 kerning table, if any */ FT_Int num_kern_pairs; FT_Int kern_table_index; TT_Kern0_Pair kern_pairs; /* A pointer to the bytecode interpreter to use. This is also */ /* used to hook the debugger for the `ttdebug' utility. */ TT_Interpreter interpreter; #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING /* Use unpatented hinting only. */ 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 */ /* OpenType. */ /* */ /***********************************************************************/ FT_Generic extra; const char* postscript_name; } TT_FaceRec; /*************************************************************************/ /* */ /* <Struct> */ /* TT_GlyphZoneRec */ /* */ /* <Description> */ Index: xc/extras/freetype2/include/freetype/internal/services/svmm.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/include/freetype/internal/services/svmm.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 svmm.h --- xc/extras/freetype2/include/freetype/internal/services/svmm.h 23 Apr 2004 18:42:46 -0000 1.2 +++ xc/extras/freetype2/include/freetype/internal/services/svmm.h 7 Mar 2005 18:53:39 -0000 @@ -1,68 +1,79 @@ /***************************************************************************/ /* */ /* 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, */ /* 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 __SVMM_H__ #define __SVMM_H__ #include FT_INTERNAL_SERVICE_H FT_BEGIN_HEADER /* * A service used to manage multiple-masters data in a given face. * * See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H). * */ #define FT_SERVICE_ID_MULTI_MASTERS "multi-masters" typedef FT_Error (*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, FT_Long* coords ); 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; }; /* */ FT_END_HEADER #endif /* __SVMM_H__ */ /* END */ Index: xc/extras/freetype2/src/autofit/afangles.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/afangles.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 afangles.c --- xc/extras/freetype2/src/autofit/afangles.c 28 Apr 2004 10:39:02 -0000 1.3 +++ xc/extras/freetype2/src/autofit/afangles.c 7 Mar 2005 18:53:39 -0000 @@ -1,25 +1,74 @@ #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] = { 90, 64, 38, 20, 10, 5, 3, 1, 1 }; static FT_Int af_angle_prenorm( FT_Vector* vec ) { FT_Fixed x, y, z; FT_Int shift; x = vec->x; y = vec->y; z = ( ( x >= 0 ) ? x : - x ) | ( (y >= 0) ? y : -y ); shift = 0; @@ -52,41 +101,41 @@ static void af_angle_pseudo_polarize( FT_Vector* vec ) { FT_Fixed theta; FT_Fixed yi, i; FT_Fixed x, y; const FT_Fixed *arctanptr; x = vec->x; y = vec->y; /* Get the vector into the right half plane */ theta = 0; if ( x < 0 ) { x = -x; y = -y; - theta = 2 * AF_ANGLE_PI2; + theta = AF_ANGLE_PI; } if ( y > 0 ) theta = - theta; arctanptr = af_angle_arctan_table; if ( y < 0 ) { /* Rotate positive */ yi = y + ( x << 1 ); x = x - ( y << 1 ); y = yi; theta -= *arctanptr++; /* Subtract angle */ } else { /* Rotate negative */ yi = y - ( x << 1 ); x = x + ( y << 1 ); @@ -98,45 +147,47 @@ do { if ( y < 0 ) { /* Rotate positive */ yi = y + ( x >> i ); x = x - ( y >> i ); y = yi; theta -= *arctanptr++; } else { /* Rotate negative */ yi = y - ( x >> i ); x = x + ( y >> i ); y = yi; theta += *arctanptr++; } } 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 */ FT_LOCAL_DEF( AF_Angle ) af_angle_atan( FT_Fixed dx, FT_Fixed dy ) { FT_Vector v; if ( dx == 0 && dy == 0 ) return 0; v.x = dx; v.y = dy; @@ -195,20 +246,57 @@ af_sort_widths( FT_UInt count, AF_Width table ) { FT_UInt i, j; AF_WidthRec swap; for ( i = 1; i < count; i++ ) { for ( j = i; j > 0; j-- ) { if ( table[j].org > table[j - 1].org ) break; swap = table[j]; table[j] = table[j - 1]; table[j - 1] = swap; } } } + + +#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 Index: xc/extras/freetype2/src/autofit/afdummy.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/afdummy.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 afdummy.c --- xc/extras/freetype2/src/autofit/afdummy.c 28 Apr 2004 10:39:02 -0000 1.1 +++ xc/extras/freetype2/src/autofit/afdummy.c 7 Mar 2005 18:53:39 -0000 @@ -1,35 +1,37 @@ #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 = { 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 }; Index: xc/extras/freetype2/src/autofit/afglobal.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/afglobal.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 afglobal.c --- xc/extras/freetype2/src/autofit/afglobal.c 28 Apr 2004 10:39:02 -0000 1.1 +++ xc/extras/freetype2/src/autofit/afglobal.c 7 Mar 2005 18:53:39 -0000 @@ -1,35 +1,35 @@ #include "afglobal.h" #include "afdummy.h" #include "aflatin.h" /* populate this list when you add new scripts */ static AF_ScriptClass const af_script_classes[] = { & 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_DEFAULT 1 /* index of default script in 'af_script_classes' */ #define AF_SCRIPT_LIST_NONE 255 /* indicates an uncovered glyph */ /* * 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; AF_ScriptMetrics metrics[ AF_SCRIPT_MAX ]; } AF_FaceGlobalsRec; Index: xc/extras/freetype2/src/autofit/afhints.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/afhints.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 afhints.c --- xc/extras/freetype2/src/autofit/afhints.c 28 Apr 2004 10:39:02 -0000 1.3 +++ xc/extras/freetype2/src/autofit/afhints.c 7 Mar 2005 18:53:39 -0000 @@ -1,37 +1,37 @@ #include "afhints.h" #ifdef AF_DEBUG #include <stdio.h> static const char* af_dir_str( AF_Direction dir ) { const char* result; 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_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"; + default: result = "none"; } return result; } #define AF_INDEX_NUM(ptr,base) ( (ptr) ? ((ptr)-(base)) : -1 ) void af_glyph_hints_dump_points( AF_GlyphHints hints ) { AF_Point points = hints->points; 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" ); 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", point - points, point->fx, @@ -94,41 +94,41 @@ { FT_Int dimension; for ( dimension = 1; dimension >= 0; 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 */ printf ( "Table of %s edges:\n", dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" ); printf ( " [ index | pos | dir | link |" " serif | blue | opos | pos ]\n" ); 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 ), AF_INDEX_NUM( edge->link, edges ), AF_INDEX_NUM( edge->serif, edges ), edge->blue_edge ? 'y' : 'n', edge->opos / 64.0, edge->pos / 64.0 ); } printf( "\n" ); } } #endif /* AF_DEBUG */ /* compute the direction value of a given vector */ @@ -297,60 +297,63 @@ axis->num_segments = 0; axis->num_edges = 0; axis->segments = NULL; axis->edges = NULL; } FT_FREE( hints->contours ); hints->max_contours = 0; hints->num_contours = 0; FT_FREE( hints->points ); hints->num_points = 0; hints->max_points = 0; hints->memory = NULL; } } + 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; + 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->scaler_flags = scaler->flags; 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; old_max = hints->max_contours; if ( new_max > old_max ) { new_max = (new_max + 3) & ~3; if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) ) goto Exit; hints->max_contours = new_max; Index: xc/extras/freetype2/src/autofit/afhints.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/afhints.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 afhints.h --- xc/extras/freetype2/src/autofit/afhints.h 28 Apr 2004 10:39:02 -0000 1.3 +++ xc/extras/freetype2/src/autofit/afhints.h 7 Mar 2005 18:53:40 -0000 @@ -197,45 +197,47 @@ !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) FT_LOCAL( AF_Direction ) af_direction_compute( FT_Pos dx, FT_Pos dy ); 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 */ + 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 ); FT_LOCAL( void ) af_glyph_hints_align_edge_points( AF_GlyphHints hints, AF_Dimension dim ); FT_LOCAL( void ) af_glyph_hints_align_strong_points( AF_GlyphHints hints, AF_Dimension dim ); FT_LOCAL( void ) af_glyph_hints_align_weak_points( AF_GlyphHints hints, AF_Dimension dim ); FT_LOCAL( void ) af_glyph_hints_done( AF_GlyphHints hints ); Index: xc/extras/freetype2/src/autofit/aflatin.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/aflatin.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 aflatin.c --- xc/extras/freetype2/src/autofit/aflatin.c 28 Apr 2004 10:39:02 -0000 1.3 +++ xc/extras/freetype2/src/autofit/aflatin.c 7 Mar 2005 18:53:40 -0000 @@ -8,60 +8,62 @@ /***************************************************************************/ /***************************************************************************/ static void af_latin_metrics_init_widths( AF_LatinMetrics metrics, FT_Face face ) { /* 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; /* 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]; - + AF_ScriptMetricsRec dummy[1]; + AF_Scaler scaler = &dummy->scaler; glyph_index = FT_Get_Char_Index( face, 'o' ); if ( glyph_index == 0 ) goto Exit; error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); 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->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_Segment seg, limit, link; 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 ); seg = axhints->segments; limit = seg + axhints->num_segments; for ( ; seg < limit; seg++ ) { link = seg->link; @@ -307,40 +309,47 @@ } /* there are sometimes problems: if the overshoot position of top */ /* zones is under its reference position, or the opposite for bottom */ /* zones. We must thus check everything there and correct the errors */ if ( *blue_shoot != *blue_ref ) { FT_Pos ref = *blue_ref; FT_Pos shoot = *blue_shoot; FT_Bool over_ref = FT_BOOL( shoot > ref ); if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref ) *blue_shoot = *blue_ref = ( shoot + ref ) / 2; } blue->flags = 0; 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 )); } return; } FT_LOCAL_DEF( FT_Error ) af_latin_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { FT_Error error; FT_CharMap oldmap = face->charmap; /* 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; @@ -365,95 +374,158 @@ if ( dim == AF_DIMENSION_HORZ ) { scale = scaler->x_scale; delta = scaler->x_delta; } else { scale = scaler->y_scale; delta = scaler->y_delta; } axis = & metrics->axis[ dim ]; if ( axis->org_scale == scale && axis->org_delta == delta ) return; 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; + FT_UInt nn; + + 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; if ( dim == AF_DIMENSION_HORZ ) { metrics->root.scaler.x_scale = scale; metrics->root.scaler.x_delta = delta; } else { metrics->root.scaler.y_scale = scale; metrics->root.scaler.y_delta = delta; } /* 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 */ for ( nn = 0; nn < axis->blue_count; 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 */ 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 delta, delta2; + + delta = blue->shoot.org - blue->ref.org; + delta2 = delta; + if ( delta < 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 ( delta < 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; + } } } } FT_LOCAL_DEF( void ) af_latin_metrics_scale( AF_LatinMetrics metrics, AF_Scaler scaler ) { + if ( AF_SCALER_EQUAL_SCALES( scaler, &metrics->root.scaler ) ) + return; + af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT ); } /***************************************************************************/ /***************************************************************************/ /***** *****/ /***** L A T I N G L Y P H A N A L Y S I S *****/ /***** *****/ /***************************************************************************/ /***************************************************************************/ FT_LOCAL_DEF( void ) 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; @@ -774,75 +846,76 @@ seg2 = seg1->link; if ( seg2 ) { seg2->num_linked++; if ( seg2->link != seg1 ) { seg1->link = 0; seg1->serif = seg2->link; } } } } FT_LOCAL_DEF( void ) af_latin_hints_compute_edges( AF_GlyphHints hints, AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; + AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; AF_Edge edges = axis->edges; AF_Edge edge, edge_limit; AF_Segment segments = axis->segments; AF_Segment segment_limit = segments + axis->num_segments; AF_Segment seg; AF_Direction up_dir; FT_Fixed scale; FT_Pos edge_distance_threshold; scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale : hints->y_scale; up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP : AF_DIR_RIGHT; /*********************************************************************/ /* */ /* We will begin by generating a sorted table of edges for the */ /* current direction. To do so, we simply scan each segment and try */ /* to find an edge in our table that corresponds to its position. */ /* */ /* If no edge is found, we create and insert a new edge in the */ /* sorted table. Otherwise, we simply add the segment to the edge's */ /* list which will be processed in the second step to compute the */ /* edge's properties. */ /* */ /* Note that the edges table is sorted along the segment/edge */ /* position. */ /* */ /*********************************************************************/ - 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; edge_distance_threshold = FT_DivFix( edge_distance_threshold, scale ); edge_limit = edges; for ( seg = segments; seg < segment_limit; seg++ ) { AF_Edge found = 0; /* look for an edge corresponding to the segment */ for ( edge = edges; edge < edge_limit; edge++ ) { FT_Pos dist; dist = seg->pos - edge->fpos; @@ -1121,92 +1194,83 @@ dist = FT_MulFix( dist, scale ); if ( dist < best_dist ) { best_dist = dist; best_blue = & blue->shoot; } } } } } if ( best_blue ) edge->blue_edge = best_blue; } } 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 ); + /* 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. */ 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. */ if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V ) hints->other_flags |= AF_LATIN_HINTS_VERT_SNAP; /* XXX */ 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 ); + return 0; + } - 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; - } /***************************************************************************/ /***************************************************************************/ /***** *****/ /***** 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, FT_Pos width ) { int n; FT_Pos best = 64 + 32 + 2; FT_Pos reference = width; FT_Pos scaled; @@ -1721,69 +1785,87 @@ edge->flags |= AF_EDGE_DONE; if ( edge > edges && edge->pos < edge[-1].pos ) edge->pos = edge[-1].pos; if ( edge + 1 < edge_limit && edge[1].flags & AF_EDGE_DONE && edge->pos > edge[1].pos ) edge->pos = edge[1].pos; } } } static FT_Error af_latin_hints_apply( AF_GlyphHints hints, FT_Outline* outline, AF_LatinMetrics metrics ) { + FT_Error error; AF_Dimension dim; - FT_UNUSED( metrics ); + error = af_glyph_hints_reload( hints, outline ); + if ( error ) + goto Exit; + + /* 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 ); + } + /* 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)) ) { 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_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 *****/ /***** *****/ /***************************************************************************/ /***************************************************************************/ 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 = { 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 }; Index: xc/extras/freetype2/src/autofit/aflatin.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/aflatin.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 aflatin.h --- xc/extras/freetype2/src/autofit/aflatin.h 28 Apr 2004 10:39:02 -0000 1.3 +++ xc/extras/freetype2/src/autofit/aflatin.h 7 Mar 2005 18:53:41 -0000 @@ -34,43 +34,44 @@ { AF_LATIN_BLUE_CAPITAL_TOP, AF_LATIN_BLUE_CAPITAL_BOTTOM, AF_LATIN_BLUE_SMALL_F_TOP, AF_LATIN_BLUE_SMALL_TOP, AF_LATIN_BLUE_SMALL_BOTTOM, AF_LATIN_BLUE_SMALL_MINOR, 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 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_ { AF_WidthRec ref; AF_WidthRec shoot; FT_UInt flags; } AF_LatinBlueRec, *AF_LatinBlue; typedef struct AF_LatinAxisRec_ { FT_Fixed scale; FT_Pos delta; FT_UInt width_count; AF_WidthRec widths[ AF_LATIN_MAX_WIDTHS ]; Index: xc/extras/freetype2/src/autofit/afloader.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/afloader.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 afloader.c --- xc/extras/freetype2/src/autofit/afloader.c 28 Apr 2004 10:39:02 -0000 1.1 +++ xc/extras/freetype2/src/autofit/afloader.c 7 Mar 2005 18:53:41 -0000 @@ -88,50 +88,43 @@ loader->trans_matrix = internal->glyph_matrix; loader->trans_delta = internal->glyph_delta; inverse = loader->trans_matrix; FT_Matrix_Invert( &inverse ); FT_Vector_Transform( &loader->trans_delta, &inverse ); } /* set linear metrics */ slot->linearHoriAdvance = slot->metrics.horiAdvance; slot->linearVertAdvance = slot->metrics.vertAdvance; switch ( slot->format ) { case FT_GLYPH_FORMAT_OUTLINE: /* translate the loaded glyph when an internal transform * is needed */ if ( loader->transformed ) - { - 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; - } - } + 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 ); @@ -140,72 +133,94 @@ 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; + 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 */ + AF_Edge edge1 = axis->edges; /* leftmost edge */ + AF_Edge edge2 = edge1 + + axis->num_edges - 1; /* rightmost edge */ + + + if ( edge2 > edge1 ) + { + old_advance = loader->pp2.x; + old_rsb = old_advance - edge2->opos; + old_lsb = edge1->opos; + new_lsb = edge1->pos; + + /* 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; - old_advance = loader->pp2.x; - old_rsb = old_advance - edge2->opos; - old_lsb = edge1->opos; - new_lsb = edge1->pos; + if ( old_rsb < 24 ) + pp2x_uh += 5; - loader->pp1.x = FT_PIX_ROUND( new_lsb - old_lsb ); - loader->pp2.x = FT_PIX_ROUND( edge2->pos + old_rsb ); + 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; + /* try to fix certain bad advance computations */ + if ( loader->pp2.x + loader->pp1.x == edge2->pos && old_rsb > 4 ) + loader->pp2.x += 64; #endif + } + 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: { FT_UInt nn, num_subglyphs = slot->num_subglyphs; FT_UInt num_base_subgs, start_point; FT_SubGlyph subglyph; start_point = gloader->base.outline.n_points; /* first of all, copy the subglyph descriptors in the glyph loader */ error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs ); if ( error ) goto Exit; @@ -349,41 +364,47 @@ 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; slot->metrics.horiBearingX = bbox.xMin; slot->metrics.horiBearingY = bbox.yMax; /* for mono-width fonts (like Andale, Courier, etc.) we need */ /* to keep the original rounded advance width */ #if 0 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, x_scale ); #else - slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; + /* for mono-width fonts (like Andale, Courier, etc.) we need */ + /* to keep the original rounded advance width */ + 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 ); /* now copy outline into glyph slot */ FT_GlyphLoader_Rewind( internal->loader ); error = FT_GlyphLoader_CopyPoints( internal->loader, gloader ); if ( error ) goto Exit; slot->outline = internal->loader->base.outline; slot->format = FT_GLYPH_FORMAT_OUTLINE; } #ifdef DEBUG_HINTER af_debug_hinter = hinter; #endif Exit: return error; @@ -417,25 +438,30 @@ scaler.flags = 0; /* XXX: fix this */ error = af_loader_reset( loader, face ); if ( !error ) { AF_ScriptMetrics 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 ); 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; } Index: xc/extras/freetype2/src/autofit/afmodule.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/afmodule.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 afmodule.c --- xc/extras/freetype2/src/autofit/afmodule.c 28 Apr 2004 10:39:02 -0000 1.1 +++ xc/extras/freetype2/src/autofit/afmodule.c 7 Mar 2005 18:53:41 -0000 @@ -14,41 +14,41 @@ af_autofitter_init( FT_Autofitter module ) { return af_loader_init( module->loader, module->root.library->memory ); } FT_CALLBACK_DEF( void ) af_autofitter_done( FT_Autofitter module ) { af_loader_done( module->loader ); } FT_CALLBACK_DEF( FT_Error ) af_autofitter_load_glyph( FT_Autofitter module, FT_GlyphSlot slot, FT_Size size, 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_CALLBACK_TABLE_DEF const FT_Module_Class autofit_module_class = { Index: xc/extras/freetype2/src/autofit/aftypes.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autofit/aftypes.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 aftypes.h --- xc/extras/freetype2/src/autofit/aftypes.h 28 Apr 2004 10:39:02 -0000 1.3 +++ xc/extras/freetype2/src/autofit/aftypes.h 7 Mar 2005 18:53:41 -0000 @@ -1,20 +1,37 @@ +/*************************************************************************** + * + * FreeType auto-fitter + * + * (c) 2004 David Turner + * + * 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 *****/ /***** *****/ /**************************************************************************/ /**************************************************************************/ #define xxAF_DEBUG @@ -56,41 +73,41 @@ AF_Width widths ); /**************************************************************************/ /**************************************************************************/ /***** *****/ /***** 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) * */ typedef FT_Int AF_Angle; -#define AF_ANGLE_PI 128 +#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 ] * */ FT_LOCAL( AF_Angle ) af_angle_diff( AF_Angle angle1, @@ -147,40 +164,46 @@ AF_SCALER_FLAG_NO_HORIZONTAL = 1, /* disable horizontal hinting */ AF_SCALER_FLAG_NO_VERTICAL = 2, /* disable vertical hinting */ AF_SCALER_FLAG_NO_ADVANCE = 4 /* disable advance hinting */ } AF_ScalerFlags; 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 */ } 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 @@ -211,41 +234,40 @@ { 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 ); typedef void (*AF_Script_ScaleMetricsFunc)( AF_ScriptMetrics metrics, AF_Scaler scaler ); typedef void (*AF_Script_DoneMetricsFunc)( AF_ScriptMetrics metrics ); typedef FT_Error (*AF_Script_InitHintsFunc)( 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_ { FT_UInt32 first; FT_UInt32 last; } AF_Script_UniRangeRec; typedef const AF_Script_UniRangeRec * AF_Script_UniRange; typedef struct AF_ScriptClassRec_ { AF_Script script; AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ Index: xc/extras/freetype2/src/autohint/ahhint.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autohint/ahhint.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ahhint.c --- xc/extras/freetype2/src/autohint/ahhint.c 28 Apr 2004 10:39:03 -0000 1.3 +++ xc/extras/freetype2/src/autohint/ahhint.c 7 Mar 2005 18:53:42 -0000 @@ -1525,53 +1525,69 @@ /* perform feature detection */ ah_outline_detect_features( outline ); if ( hinter->do_vert_hints ) { ah_outline_compute_blue_edges( outline, hinter->globals ); ah_outline_scale_blue_edges( outline, hinter->globals ); } /* perform alignment control */ ah_hinter_hint_edges( hinter ); ah_hinter_align( hinter ); /* now save the current outline into the loader's current table */ ah_outline_save( outline, gloader ); /* we now need to hint the metrics according to the change in */ /* width/positioning that occured during the hinting process */ if ( outline->num_vedges > 0 ) { - FT_Pos old_advance, old_rsb, old_lsb, new_lsb; + FT_Pos old_advance, old_rsb, old_lsb, new_lsb, pp1x_uh, pp2x_uh; AH_Edge edge1 = outline->vert_edges; /* leftmost edge */ AH_Edge edge2 = edge1 + outline->num_vedges - 1; /* rightmost edge */ old_advance = hinter->pp2.x; old_rsb = old_advance - edge2->opos; old_lsb = edge1->opos; new_lsb = edge1->pos; - hinter->pp1.x = FT_PIX_ROUND( new_lsb - old_lsb ); - hinter->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; + + hinter->pp1.x = FT_PIX_ROUND( pp1x_uh ); + hinter->pp2.x = FT_PIX_ROUND( pp2x_uh ); + + slot->lsb_delta = hinter->pp1.x - pp1x_uh; + slot->rsb_delta = hinter->pp2.x - pp2x_uh; #if 0 /* try to fix certain bad advance computations */ if ( hinter->pp2.x + hinter->pp1.x == edge2->pos && old_rsb > 4 ) hinter->pp2.x += 64; #endif } else { hinter->pp1.x = ( hinter->pp1.x + 32 ) & -64; hinter->pp2.x = ( hinter->pp2.x + 32 ) & -64; } /* good, we simply add the glyph to our loader's base */ ah_loader_add( gloader ); break; case FT_GLYPH_FORMAT_COMPOSITE: { Index: xc/extras/freetype2/src/autohint/ahmodule.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/autohint/ahmodule.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ahmodule.c --- xc/extras/freetype2/src/autohint/ahmodule.c 23 Apr 2004 18:42:47 -0000 1.2 +++ xc/extras/freetype2/src/autohint/ahmodule.c 7 Mar 2005 18:53:42 -0000 @@ -1,79 +1,85 @@ /***************************************************************************/ /* */ /* ahmodule.c */ /* */ /* Auto-hinting module implementation (declaration). */ /* */ -/* Copyright 2000-2001, 2002, 2003 Catharon Productions Inc. */ +/* Copyright 2000-2001, 2002, 2003, 2004 Catharon Productions Inc. */ /* Author: David Turner */ /* */ /* This file is part of the Catharon Typography Project and shall only */ /* be used, modified, and distributed under the terms of the Catharon */ /* Open Source License that should come with this file under the name */ /* `CatharonLicense.txt'. By continuing to use, modify, or distribute */ /* this file you indicate that you have read the license and */ /* understand and accept it fully. */ /* */ /* Note that this license is compatible with the FreeType license. */ /* */ /***************************************************************************/ #include <ft2build.h> #include FT_MODULE_H #include "ahhint.h" #ifdef DEBUG_HINTER AH_Hinter ah_debug_hinter = NULL; FT_Bool ah_debug_disable_horz = 0; FT_Bool ah_debug_disable_vert = 0; #endif typedef struct FT_AutoHinterRec_ { FT_ModuleRec root; AH_Hinter hinter; } FT_AutoHinterRec; FT_CALLBACK_DEF( FT_Error ) - ft_autohinter_init( FT_AutoHinter module ) + ft_autohinter_init( FT_Module module ) /* FT_AutoHinter */ { - FT_Error error; + FT_AutoHinter autohinter = (FT_AutoHinter)module; + FT_Error error; - error = ah_hinter_new( module->root.library, &module->hinter ); + error = ah_hinter_new( module->library, &autohinter->hinter ); + #ifdef DEBUG_HINTER if ( !error ) - ah_debug_hinter = module->hinter; + ah_debug_hinter = autohinter->hinter; #endif + return error; } FT_CALLBACK_DEF( void ) - ft_autohinter_done( FT_AutoHinter module ) + ft_autohinter_done( FT_Module module ) { - ah_hinter_done( module->hinter ); + FT_AutoHinter autohinter = (FT_AutoHinter)module; + + + ah_hinter_done( autohinter->hinter ); #ifdef DEBUG_HINTER ah_debug_hinter = NULL; #endif } FT_CALLBACK_DEF( FT_Error ) ft_autohinter_load_glyph( FT_AutoHinter module, FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags ) { return ah_hinter_load_glyph( module->hinter, slot, size, glyph_index, load_flags ); } FT_CALLBACK_DEF( void ) @@ -111,27 +117,27 @@ { ft_autohinter_reset_globals, ft_autohinter_get_globals, ft_autohinter_done_globals, ft_autohinter_load_glyph }; FT_CALLBACK_TABLE_DEF const FT_Module_Class autohint_module_class = { FT_MODULE_HINTER, sizeof ( FT_AutoHinterRec ), "autohinter", 0x10000L, /* version 1.0 of the autohinter */ 0x20000L, /* requires FreeType 2.0 or above */ (const void*) &ft_autohinter_service, - (FT_Module_Constructor)ft_autohinter_init, - (FT_Module_Destructor) ft_autohinter_done, - (FT_Module_Requester) 0 + ft_autohinter_init, + ft_autohinter_done, + 0 /* FT_Module_Requester */ }; /* END */ Index: xc/extras/freetype2/src/base/ftbbox.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftbbox.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftbbox.c --- xc/extras/freetype2/src/base/ftbbox.c 23 Apr 2004 18:42:47 -0000 1.2 +++ xc/extras/freetype2/src/base/ftbbox.c 7 Mar 2005 18:53:42 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* ftbbox.c */ /* */ /* 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 */ /* 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 component has a _single_ role: to compute exact outline bounding */ /* boxes. */ /* */ /*************************************************************************/ #include <ft2build.h> @@ -31,299 +31,308 @@ #include FT_INTERNAL_CALC_H typedef struct TBBox_Rec_ { FT_Vector last; FT_BBox bbox; } TBBox_Rec; /*************************************************************************/ /* */ /* <Function> */ /* BBox_Move_To */ /* */ /* <Description> */ /* 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. */ /* */ /* <InOut> */ /* user :: A pointer to the current walk context. */ /* */ /* <Return> */ /* Always 0. Needed for the interface only. */ /* */ static int BBox_Move_To( FT_Vector* to, TBBox_Rec* user ) { user->last = *to; return 0; } #define CHECK_X( p, bbox ) \ ( p->x < bbox.xMin || p->x > bbox.xMax ) #define CHECK_Y( p, bbox ) \ ( p->y < bbox.yMin || p->y > bbox.yMax ) /*************************************************************************/ /* */ /* <Function> */ /* BBox_Conic_Check */ /* */ /* <Description> */ /* Finds the extrema of a 1-dimensional conic Bezier curve and update */ /* a bounding range. This version uses direct computation, as it */ /* doesn't need square roots. */ /* */ /* <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 BBox_Conic_Check( FT_Pos y1, FT_Pos y2, FT_Pos y3, FT_Pos* min, FT_Pos* max ) { - if ( y1 <= y3 ) - { - if ( y2 == y1 ) /* Flat arc */ - goto Suite; - } - else if ( y1 < y3 ) + if ( y1 <= y3 && y2 == y1 ) /* flat arc */ + goto Suite; + + 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; y3 = y2; goto Suite; } } y1 = y3 = y1 - FT_MulDiv( y2 - y1, y2 - y1, y1 - 2*y2 + y3 ); Suite: if ( y1 < *min ) *min = y1; if ( y3 > *max ) *max = y3; } /*************************************************************************/ /* */ /* <Function> */ /* BBox_Conic_To */ /* */ /* <Description> */ /* This function is used as a `conic_to' emitter during */ /* FT_Raster_Decompose(). It checks a conic Bezier curve with the */ /* current bounding box, and computes its extrema if necessary to */ /* update it. */ /* */ /* <Input> */ /* control :: A pointer to a control point. */ + /* */ /* to :: A pointer to the destination vector. */ /* */ /* <InOut> */ /* user :: The address of the current walk context. */ /* */ /* <Return> */ /* Always 0. Needed for the interface only. */ /* */ /* <Note> */ /* In the case of a non-monotonous arc, we compute directly the */ /* extremum coordinates, as it is sufficiently fast. */ /* */ static int BBox_Conic_To( FT_Vector* control, FT_Vector* to, TBBox_Rec* user ) { /* we don't need to check `to' since it is always an `on' point, thus */ /* within the bbox */ if ( CHECK_X( control, user->bbox ) ) - BBox_Conic_Check( user->last.x, control->x, to->x, &user->bbox.xMin, &user->bbox.xMax ); if ( CHECK_Y( control, user->bbox ) ) - BBox_Conic_Check( user->last.y, control->y, to->y, &user->bbox.yMin, &user->bbox.yMax ); user->last = *to; return 0; } /*************************************************************************/ /* */ /* <Function> */ /* BBox_Cubic_Check */ /* */ /* <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, FT_Pos p3, FT_Pos p4, FT_Pos* min, FT_Pos* max ) { FT_Pos stack[32*3 + 1], *arc; arc = stack; arc[0] = p1; arc[1] = p2; arc[2] = p3; arc[3] = p4; do { FT_Pos y1 = arc[0]; FT_Pos y2 = arc[1]; FT_Pos y3 = arc[2]; FT_Pos y4 = arc[3]; 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; y4 = y2; goto Test; } } - /* 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; y2 = ( y2 + y3 ) / 2; arc[2] = y1 = ( y1 + y2 ) / 2; arc[4] = y4 = ( y4 + y2 ) / 2; arc[3] = ( y1 + y4 ) / 2; arc += 3; goto Suite; Test: if ( y1 < *min ) *min = y1; if ( y4 > *max ) *max = y4; arc -= 3; Suite: ; } while ( arc >= stack ); } + #else static void test_cubic_extrema( FT_Pos y1, FT_Pos y2, FT_Pos y3, FT_Pos y4, FT_Fixed u, FT_Pos* min, FT_Pos* max ) { /* FT_Pos a = y4 - 3*y3 + 3*y2 - y1; */ FT_Pos b = y3 - 2*y2 + y1; FT_Pos c = y2 - y1; FT_Pos d = y1; FT_Pos y; FT_Fixed uu; 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 ) { uu = FT_MulFix( u, u ); y = d + FT_MulFix( c, 2*u ) + FT_MulFix( b, uu ); if ( y < *min ) *min = y; if ( y > *max ) *max = y; } } static void BBox_Cubic_Check( FT_Pos y1, FT_Pos y2, FT_Pos y3, FT_Pos y4, FT_Pos* min, FT_Pos* max ) { @@ -340,230 +349,227 @@ /* flat or ascending arc test */ if ( y1 <= y2 && y2 <= y4 && y1 <= y3 && y3 <= y4 ) return; } else /* y1 > y4 */ { /* descending arc test */ if ( y1 >= y2 && y2 >= y4 && y1 >= y3 && y3 >= y4 ) return; } /* There are some split points. Find them. */ { FT_Pos a = y4 - 3*y3 + 3*y2 - y1; FT_Pos b = y3 - 2*y2 + y1; FT_Pos c = y2 - y1; FT_Pos d; 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; if ( t1 > 0x7FFFFFUL ) { do { 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; } else if ( t1 < 0x400000UL ) { do { shift++; t1 <<= 1; + } while ( t1 < 0x400000UL ); a <<= shift; b <<= shift; c <<= shift; } } /* handle a == 0 */ if ( a == 0 ) { if ( b != 0 ) { t = - FT_DivFix( c, b ) / 2; test_cubic_extrema( y1, y2, y3, y4, t, min, max ); } } else { /* solve the equation now */ d = FT_MulFix( b, b ) - FT_MulFix( a, c ); if ( d < 0 ) return; if ( d == 0 ) { /* there is a single split point at -b/a */ t = - FT_DivFix( b, a ); test_cubic_extrema( y1, y2, y3, y4, t, min, max ); } 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 ); t = - FT_DivFix( b + d, a ); test_cubic_extrema( y1, y2, y3, y4, t, min, max ); } } } } #endif /*************************************************************************/ /* */ /* <Function> */ /* BBox_Cubic_To */ /* */ /* <Description> */ /* This function is used as a `cubic_to' emitter during */ /* FT_Raster_Decompose(). It checks a cubic Bezier curve with the */ /* current bounding box, and computes its extrema if necessary to */ /* update it. */ /* */ /* <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> */ /* user :: The address of the current walk context. */ /* */ /* <Return> */ /* Always 0. Needed for the interface only. */ /* */ /* <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, FT_Vector* control2, FT_Vector* to, TBBox_Rec* user ) { /* we don't need to check `to' since it is always an `on' point, thus */ /* within the bbox */ 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; return 0; } /* documentation is in ftbbox.h */ FT_EXPORT_DEF( FT_Error ) FT_Outline_Get_BBox( FT_Outline* outline, FT_BBox *abbox ) { FT_BBox cbox; FT_BBox bbox; FT_Vector* vec; FT_UShort n; if ( !abbox ) Index: xc/extras/freetype2/src/base/ftdbgmem.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftdbgmem.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftdbgmem.c --- xc/extras/freetype2/src/base/ftdbgmem.c 28 Apr 2004 10:39:03 -0000 1.3 +++ xc/extras/freetype2/src/base/ftdbgmem.c 7 Mar 2005 18:53:43 -0000 @@ -523,44 +523,49 @@ /* we never really free the block */ table->file_name = NULL; table->line_no = 0; } extern FT_Pointer ft_mem_debug_realloc( FT_Memory memory, FT_Long cur_size, FT_Long new_size, FT_Pointer block ) { FT_MemTable table = (FT_MemTable)memory->user; FT_MemNode node, *pnode; FT_Pointer new_block; const char* file_name = FT_FILENAME( table->file_name ); 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 code shouldn't be in 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 */ pnode = ft_mem_table_get_nodep( table, (FT_Byte*)block ); node = *pnode; if ( !node ) ft_mem_debug_panic( "trying to reallocate unknown block at %p in (%s:%ld)", block, file_name, line_no ); if ( node->size <= 0 ) ft_mem_debug_panic( "trying to reallocate freed block at %p in (%s:%ld)", block, file_name, line_no ); if ( node->size != cur_size ) ft_mem_debug_panic( "invalid ft_realloc request for %p. cur_size is " @@ -672,40 +677,80 @@ FT_BASE_DEF( FT_Error ) FT_Realloc_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_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, 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; } FT_Free( memory, (void **)block ); } #else /* !FT_DEBUG_MEMORY */ Index: xc/extras/freetype2/src/base/ftexcept.c =================================================================== RCS file: xc/extras/freetype2/src/base/ftexcept.c diff -N xc/extras/freetype2/src/base/ftexcept.c --- xc/extras/freetype2/src/base/ftexcept.c 14 Nov 2003 16:48:24 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,197 +0,0 @@ -#include <ft2build.h> -#include FT_EXCEPT_H - - - FT_BASE_DEF( void ) - ft_cleanup_stack_init( FT_CleanupStack stack, - FT_Memory memory ) - { - stack->chunk = &stack->chunk_0; - stack->top = stack->chunk->items; - stack->limit = stack->top + FT_CLEANUP_CHUNK_SIZE; - stack->chunk_0.link = NULL; - - stack->memory = memory; - } - - - - FT_BASE_DEF( void ) - ft_cleanup_stack_done( FT_CleanupStack stack ) - { - FT_Memory memory = stack->memory; - FT_CleanupChunk chunk, next; - - for (;;) - { - chunk = stack->chunk; - if ( chunk == &stack->chunk_0 ) - break; - - stack->chunk = chunk->link; - - FT_Free( chunk, memory ); - } - - stack->memory = NULL; - } - - - - FT_BASE_DEF( void ) - ft_cleanup_stack_push( FT_CleanupStack stack, - FT_Pointer item, - FT_CleanupFunc item_func, - FT_Pointer item_data ) - { - FT_CleanupItem top; - - - FT_ASSERT( stack && stack->chunk && stack->top ); - FT_ASSERT( item && item_func ); - - top = stack->top; - - top->item = item; - top->item_func = item_func; - top->item_data = item_data; - - top ++; - - if ( top == stack->limit ) - { - FT_CleanupChunk chunk; - - chunk = FT_QAlloc( sizeof(*chunk), stack->memory ); - - chunk->link = stack->chunk; - stack->chunk = chunk; - stack->limit = chunk->items + FT_CLEANUP_CHUNK_SIZE; - top = chunk->items; - } - - stack->top = top; - } - - - - FT_BASE_DEF( void ) - ft_cleanup_stack_pop( FT_CleanupStack stack, - FT_Int destroy ) - { - FT_CleanupItem top; - - - FT_ASSERT( stack && stack->chunk && stack->top ); - top = stack->top; - - if ( top == stack->chunk->items ) - { - FT_CleanupChunk chunk; - - chunk = stack->chunk; - - if ( chunk == &stack->chunk_0 ) - { - FT_ERROR(( "cleanup.pop: empty cleanup stack !!\n" )); - ft_cleanup_throw( stack, FT_Err_EmptyCleanupStack ); - } - - chunk = chunk->link; - FT_QFree( stack->chunk, stack->memory ); - - stack->chunk = chunk; - stack->limit = chunk->items + FT_CLEANUP_CHUNK_SIZE; - top = stack->limit; - } - - top --; - - if ( destroy ) - top->item_func( top->item, top->item_data ); - - top->item = NULL; - top->item_func = NULL; - top->item_data = NULL; - - stack->top = top; - } - - - - FT_BASE_DEF( FT_CleanupItem ) - ft_cleanup_stack_peek( FT_CleanupStack stack ) - { - FT_CleanupItem top; - FT_CleanupChunk chunk; - - - FT_ASSERT( stack && stack->chunk && stack->top ); - - top = stack->top; - chunk = stack->chunk; - - if ( top > chunk->items ) - top--; - else - { - chunk = chunk->link; - top = NULL; - if ( chunk != NULL ) - top = chunk->items + FT_CLEANUP_CHUNK_SIZE - 1; - } - return top; - } - - - - FT_BASE_DEF( void ) - ft_xhandler_enter( FT_XHandler xhandler, - FT_Memory memory ) - { - FT_CleanupStack stack = FT_MEMORY__CLEANUP(memory); - - xhandler->previous = stack->xhandler; - xhandler->cleanup = stack->top; - xhandler->error = 0; - stack->xhandler = xhandler; - } - - - - FT_BASE_DEF( void ) - ft_xhandler_exit( FT_XHandler xhandler ) - { - FT_CleanupStack stack = FT_MEMORY__CLEANUP(memory); - - stack->xhandler = xhandler->previous; - xhandler->previous = NULL; - xhandler->error = error; - xhandler->cleanup = NULL; - } - - - - FT_BASE_DEF( void ) - ft_cleanup_throw( FT_CleanupStack stack, - FT_Error error ) - { - FT_XHandler xhandler = stack->xhandler; - - if ( xhandler == NULL ) - { - /* no exception handler was registered. this */ - /* means that we have an un-handled exception */ - /* the only thing we can do is _PANIC_ and */ - /* halt the current program.. */ - /* */ - FT_ERROR(( "FREETYPE PANIC: An un-handled exception occured. Program aborted" )); - ft_exit(1); - } - - /* cleanup the stack until we reach the handler's */ - /* starting stack location.. */ - - xhandler->error = error; - longmp( xhandler->jump_buffer, 1 ); - } \ No newline at end of file Index: xc/extras/freetype2/src/base/ftgloadr.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftgloadr.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftgloadr.c --- xc/extras/freetype2/src/base/ftgloadr.c 28 Apr 2004 10:39:03 -0000 1.2 +++ xc/extras/freetype2/src/base/ftgloadr.c 7 Mar 2005 18:53:43 -0000 @@ -165,48 +165,48 @@ { loader->use_extra = 1; FT_GlyphLoader_Adjust_Points( loader ); } return error; } /* re-adjust the `current' subglyphs field */ static void FT_GlyphLoader_Adjust_Subglyphs( FT_GlyphLoader loader ) { FT_GlyphLoad base = &loader->base; FT_GlyphLoad current = &loader->current; current->subglyphs = base->subglyphs + base->num_subglyphs; } - /* 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; FT_Outline* base = &loader->base.outline; FT_Outline* current = &loader->current.outline; FT_Bool adjust = 1; FT_UInt new_max, old_max; /* check points & tags */ new_max = base->n_points + current->n_points + n_points; old_max = loader->max_points; if ( new_max > old_max ) { new_max = FT_PAD_CEIL( new_max, 8 ); if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) || FT_RENEW_ARRAY( base->tags, old_max, new_max ) ) Index: xc/extras/freetype2/src/base/ftglyph.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftglyph.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftglyph.c --- xc/extras/freetype2/src/base/ftglyph.c 28 Apr 2004 10:39:03 -0000 1.3 +++ xc/extras/freetype2/src/base/ftglyph.c 7 Mar 2005 18:53:43 -0000 @@ -121,239 +121,261 @@ { 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_CALLBACK_DEF( FT_Error ) + ft_bitmap_glyph_init( FT_Glyph bitmap_glyph, + FT_GlyphSlot slot ) + { + FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; + FT_Error error = FT_Err_Ok; + FT_Library library = FT_GLYPH( glyph )->library; + FT_Memory memory = library->memory; if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) { error = FT_Err_Invalid_Glyph_Format; 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; if ( slot->internal->flags & FT_GLYPH_OWN_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 ); } Exit: return error; } - static FT_Error - ft_bitmap_glyph_copy( FT_BitmapGlyph source, - FT_BitmapGlyph target ) - { - FT_Memory memory = source->root.library->memory; + FT_CALLBACK_DEF( FT_Error ) + ft_bitmap_glyph_copy( FT_Glyph bitmap_source, + FT_Glyph bitmap_target ) + { + FT_BitmapGlyph source = (FT_BitmapGlyph)bitmap_source; + FT_BitmapGlyph target = (FT_BitmapGlyph)bitmap_target; + FT_Memory memory = bitmap_source->library->memory; target->left = source->left; target->top = source->top; return ft_bitmap_copy( memory, &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_Memory memory = FT_GLYPH( glyph )->library->memory; FT_FREE( glyph->bitmap.buffer ); } - 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; cbox->yMin = cbox->yMax - ( glyph->bitmap.rows << 6 ); } 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 */ }; /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** FT_OutlineGlyph support ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ - static FT_Error - ft_outline_glyph_init( FT_OutlineGlyph 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_CALLBACK_DEF( FT_Error ) + ft_outline_glyph_init( FT_Glyph outline_glyph, + FT_GlyphSlot slot ) + { + 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 */ if ( slot->format != FT_GLYPH_FORMAT_OUTLINE ) { error = FT_Err_Invalid_Glyph_Format; goto Exit; } /* allocate new outline */ error = FT_Outline_New( library, source->n_points, source->n_contours, &glyph->outline ); 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; 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_Error error; - FT_Library library = FT_GLYPH( source )->library; + FT_CALLBACK_DEF( FT_Error ) + ft_outline_glyph_copy( FT_Glyph outline_source, + FT_Glyph outline_target ) + { + 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, source->outline.n_contours, &target->outline ); if ( !error ) FT_Outline_Copy( &source->outline, &target->outline ); return error; } - 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, + FT_Matrix* matrix, + FT_Vector* delta ) { + FT_OutlineGlyph glyph = (FT_OutlineGlyph)outline_glyph; + + if ( matrix ) FT_Outline_Transform( &glyph->outline, matrix ); if ( delta ) FT_Outline_Translate( &glyph->outline, delta->x, delta->y ); } - 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; return FT_Err_Ok; } 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 }; /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** FT_Glyph class and API ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ static FT_Error ft_new_glyph( FT_Library library, const FT_Glyph_Class* clazz, FT_Glyph* aglyph ) { FT_Memory memory = library->memory; FT_Error error; FT_Glyph glyph; @@ -627,41 +649,41 @@ error = clazz->glyph_prepare( glyph, &dummy ); if ( !error ) error = FT_Render_Glyph_Internal( glyph->library, &dummy, render_mode ); #if 1 if ( !destroy && origin ) { FT_Vector v; v.x = -origin->x; v.y = -origin->y; FT_Glyph_Transform( glyph, 0, &v ); } #endif if ( error ) 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; /* copy advance */ bitmap->root.advance = glyph->advance; if ( destroy ) FT_Done_Glyph( glyph ); *the_glyph = FT_GLYPH( bitmap ); Exit: if ( error && bitmap ) FT_Done_Glyph( FT_GLYPH( bitmap ) ); return error; Bad: error = FT_Err_Invalid_Argument; goto Exit; Index: xc/extras/freetype2/src/base/fthash.c =================================================================== RCS file: xc/extras/freetype2/src/base/fthash.c diff -N xc/extras/freetype2/src/base/fthash.c --- xc/extras/freetype2/src/base/fthash.c 25 Nov 2003 19:27:19 -0000 1.1.1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,246 +0,0 @@ -#include <ft2build.h> -#include FT_TYPES_H -#include FT_INTERNAL_HASH_H -#include FT_INTERNAL_MEMORY_H -#include FT_INTERNAL_DEBUG_H - -#define FT_HASH_MAX_LOAD 2 -#define FT_HASH_MIN_LOAD 1 -#define FT_HASH_SUB_LOAD (FT_HASH_MAX_LOAD-FT_HASH_MIN_LOAD) - -/* this one _must_ be a power of 2 !! */ -#define FT_HASH_INITIAL_SIZE 8 - - - FT_BASE_DEF( void ) - ft_hash_done( FT_Hash table, - FT_Hash_ForeachFunc node_func, - const FT_Pointer node_data ) - { - if ( table ) - { - FT_Memory memory = table->memory; - - if ( node_func ) - ft_hash_foreach( table, node_func, node_data ); - - FT_FREE( table->buckets ); - table->p = 0; - table->mask = 0; - table->slack = 0; - - table->node_equal = NULL; - } - } - - - FT_BASE_DEF( FT_UInt ) - ft_hash_get_size( FT_Hash table ) - { - FT_UInt result = 0; - - if ( table ) - result = (table->p + table->mask + 1)*FT_HASH_MAX_LOAD - table->slack; - - return result; - } - - - - FT_BASE_DEF( FT_Error ) - ft_hash_init( FT_Hash table, - FT_Hash_EqualFunc equal, - FT_Memory memory ) - { - FT_Error error; - - table->memory = memory; - table->p = 0; - table->mask = FT_HASH_INITIAL_SIZE-1; - table->slack = FT_HASH_INITIAL_SIZE*FT_HASH_MAX_LOAD; - table->node_equal = equal; - - (void)FT_NEW_ARRAY( table->buckets, FT_HASH_INITIAL_SIZE*2 ); - - return error; - } - - - - FT_BASE_DEF( void ) - ft_hash_foreach( FT_Hash table, - FT_Hash_ForeachFunc foreach_func, - const FT_Pointer foreach_data ) - { - FT_UInt count = table->p + table->mask + 1; - FT_HashNode* pnode = table->buckets; - FT_HashNode node, next; - - for ( ; count > 0; count--, pnode++ ) - { - node = *pnode; - while ( node ) - { - next = node->link; - foreach_func( node, foreach_data ); - node = next; - } - } - } - - - - FT_BASE_DEF( FT_HashLookup ) - ft_hash_lookup( FT_Hash table, - FT_HashNode keynode ) - { - FT_UInt index; - FT_UInt32 hash = keynode->hash; - FT_HashNode node, *pnode; - - index = (FT_UInt)(hash & table->mask); - if ( index < table->p ) - index = (FT_UInt)(hash & (2*table->mask+1)); - - pnode = &table->buckets[index]; - for (;;) - { - node = *pnode; - if ( node == NULL ) - break; - - if ( node->hash == hash && table->node_equal( node, keynode ) ) - break; - - pnode = &node->link; - } - - return pnode; - } - - - - - FT_BASE_DEF( FT_Error ) - ft_hash_add( FT_Hash table, - FT_HashLookup lookup, - FT_HashNode new_node ) - { - FT_Error error = 0; - - /* add it to the hash table */ - new_node->link = *lookup; - *lookup = new_node; - - if ( --table->slack < 0 ) - { - FT_UInt p = table->p; - FT_UInt mask = table->mask; - FT_HashNode new_list, node, *pnode; - - /* split a single bucket */ - new_list = NULL; - pnode = table->buckets + p; - for (;;) - { - node = *pnode; - if ( node == NULL ) - break; - - if ( node->hash & mask ) - { - *pnode = node->link; - node->link = new_list; - new_list = node; - } - else - pnode = &node->link; - } - - table->buckets[ p + mask + 1 ] = new_list; - - table->slack += FT_HASH_MAX_LOAD; - - if ( p >= mask ) - { - FT_Memory memory = table->memory; - - - if (FT_RENEW_ARRAY( table->buckets, (mask+1)*2, (mask+1)*4 )) - goto Exit; - - table->mask = 2*mask + 1; - table->p = 0; - } - else - table->p = p + 1; - } - Exit: - return error; - } - - - - FT_BASE_DEF( FT_Error ) - ft_hash_remove( FT_Hash table, - FT_HashLookup lookup ) - { - FT_HashNode node; - FT_UInt num_buckets; - FT_Error error = 0; - - FT_ASSERT( pnode != NULL && node != NULL ); - - node = *lookup; - *lookup = node->link; - node->link = NULL; - - num_buckets = ( table->p + table->mask + 1) ; - - if ( ++ table->slack > (FT_Long)num_buckets*FT_HASH_SUB_LOAD ) - { - FT_UInt p = table->p; - FT_UInt mask = table->mask; - FT_UInt old_index = p + mask; - FT_HashNode* pnode; - FT_HashNode* pold; - - if ( old_index < FT_HASH_INITIAL_SIZE ) - goto Exit; - - if ( p == 0 ) - { - FT_Memory memory = table->memory; - - table->mask >>= 1; - p = table->mask; - - if ( FT_RENEW_ARRAY( table->buckets, (mask+1)*2, (mask+1) ) ) - { - /* this should never happen normally, but who knows :-) */ - /* we need to re-inject the node in the hash table before */ - /* returning there, since it's safer */ - pnode = table->buckets; - node->link = *pnode; - *pnode = node; - - goto Exit; - } - } - else - p--; - - pnode = table->buckets + p; - while ( *pnode ) - pnode = &(*pnode)->link; - - pold = table->buckets + old_index; - *pnode = *pold; - *pold = NULL; - - table->slack -= FT_HASH_MAX_LOAD; - table->p = p; - } - Exit: - return error; - } Index: xc/extras/freetype2/src/base/ftlist.c =================================================================== RCS file: xc/extras/freetype2/src/base/ftlist.c diff -N xc/extras/freetype2/src/base/ftlist.c --- xc/extras/freetype2/src/base/ftlist.c 14 Nov 2003 16:48:24 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,217 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftlist.c */ -/* */ -/* Generic list support for FreeType (body). */ -/* */ -/* Copyright 1996-2001, 2002 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 implements functions relative to list processing. Its */ - /* data structures are defined in `freetype/internal/ftlist.h'. */ - /* */ - /*************************************************************************/ - - -#include <ft2build.h> -#include FT_LIST_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_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_list - - - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( FT_ListNode ) - FT_List_Find( FT_List list, - void* data ) - { - FT_ListNode cur; - - - cur = list->head; - while ( cur ) - { - if ( cur->data == data ) - return cur; - - cur = cur->next; - } - - return (FT_ListNode)0; - } - - - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( void ) - FT_List_Add( FT_List list, - FT_ListNode node ) - { - FT_ListNode before = list->tail; - - - node->next = 0; - node->prev = before; - - if ( before ) - before->next = node; - else - list->head = node; - - list->tail = node; - } - - - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( void ) - FT_List_Insert( FT_List list, - FT_ListNode node ) - { - FT_ListNode after = list->head; - - - node->next = after; - node->prev = 0; - - if ( !after ) - list->tail = node; - else - after->prev = node; - - list->head = node; - } - - - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( void ) - FT_List_Remove( FT_List list, - FT_ListNode node ) - { - FT_ListNode before, after; - - - before = node->prev; - after = node->next; - - if ( before ) - before->next = after; - else - list->head = after; - - if ( after ) - after->prev = before; - else - list->tail = before; - } - - - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( void ) - FT_List_Up( FT_List list, - FT_ListNode node ) - { - FT_ListNode before, after; - - - before = node->prev; - after = node->next; - - /* check whether we are already on top of the list */ - if ( !before ) - return; - - before->next = after; - - if ( after ) - after->prev = before; - else - list->tail = before; - - node->prev = 0; - node->next = list->head; - list->head->prev = node; - list->head = node; - } - - - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_List_Iterate( FT_List list, - FT_List_Iterator iterator, - void* user ) - { - FT_ListNode cur = list->head; - FT_Error error = FT_Err_Ok; - - - while ( cur ) - { - FT_ListNode next = cur->next; - - - error = iterator( cur, user ); - if ( error ) - break; - - cur = next; - } - - return error; - } - - - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( void ) - FT_List_Finalize( FT_List list, - FT_List_Destructor destroy, - FT_Memory memory, - void* user ) - { - FT_ListNode cur; - - - cur = list->head; - while ( cur ) - { - FT_ListNode next = cur->next; - void* data = cur->data; - - - if ( destroy ) - destroy( memory, data, user ); - - FT_FREE( cur ); - cur = next; - } - - list->head = 0; - list->tail = 0; - } - - -/* END */ Index: xc/extras/freetype2/src/base/ftmm.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftmm.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftmm.c --- xc/extras/freetype2/src/base/ftmm.c 23 Apr 2004 18:42:47 -0000 1.2 +++ xc/extras/freetype2/src/base/ftmm.c 7 Mar 2005 18:53:43 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* ftmm.c */ /* */ /* 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, */ /* 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_MULTIPLE_MASTERS_H #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_MULTIPLE_MASTERS_H /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -68,64 +68,135 @@ { 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 ) error = service->get_mm( face, amaster ); } return error; } /* 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 ) FT_Set_MM_Design_Coordinates( FT_Face face, FT_UInt num_coords, FT_Long* 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_design ) error = service->set_mm_design( face, num_coords, coords ); } return error; } /* 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 ) FT_Set_MM_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; } + /* 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 */ Index: xc/extras/freetype2/src/base/ftobject.c =================================================================== RCS file: xc/extras/freetype2/src/base/ftobject.c diff -N xc/extras/freetype2/src/base/ftobject.c --- xc/extras/freetype2/src/base/ftobject.c 25 Nov 2003 19:27:19 -0000 1.1.1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,396 +0,0 @@ -#include <ft2build.h> -#include FT_INTERNAL_OBJECT_H -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_OBJECTS_H - -#define FT_MAGIC_DEATH 0xDEADdead -#define FT_MAGIC_CLASS 0x12345678 - -#define FT_TYPE_HASH(x) (( (FT_UInt32)(x) >> 2 )^( (FT_UInt32)(x) >> 10 )) - -#define FT_OBJECT_CHECK(o) \ - ( FT_OBJECT(o) != NULL && \ - FT_OBJECT(o)->clazz != NULL && \ - FT_OBJECT(o)->ref_count >= 1 && \ - FT_OBJECT(o)->clazz->magic == FT_MAGIC_CLASS ) - -#define FT_CLASS_CHECK(c) \ - ( FT_CLASS(c) != NULL && FT_CLASS(c)->magic == FT_MAGIC_CLASS ) - -#define FT_ASSERT_IS_CLASS(c) FT_ASSERT( FT_CLASS_CHECK(c) ) - - /*******************************************************************/ - /*******************************************************************/ - /***** *****/ - /***** *****/ - /***** M E T A - C L A S S *****/ - /***** *****/ - /***** *****/ - /*******************************************************************/ - /*******************************************************************/ - - /* forward declaration */ - FT_BASE_DEF( FT_Error ) - ft_metaclass_init( FT_MetaClass meta, - FT_Library library ); - - /* forward declaration */ - FT_BASE_DEF( void ) - ft_metaclass_done( FT_MetaClass meta ); - - - /* class type for the meta-class itself */ - static const FT_TypeRec ft_meta_class_type = - { - "FT2.MetaClass", - NULL, - - sizeof( FT_MetaClassRec ), - (FT_Object_InitFunc) ft_metaclass_init, - (FT_Object_DoneFunc) ft_metaclass_done, - - sizeof( FT_ClassRec ), - (FT_Object_InitFunc) NULL, - (FT_Object_DoneFunc) NULL - }; - - - - - /* destroy a given class */ - static void - ft_class_hnode_destroy( FT_ClassHNode node ) - { - FT_Class clazz = node->clazz; - FT_Memory memory = clazz->memory; - - if ( clazz->class_done ) - clazz->class_done( (FT_Object) clazz ); - - FT_FREE( clazz ); - - node->clazz = NULL; - node->type = NULL; - - FT_FREE( node ); - } - - - static FT_Int - ft_type_equal( FT_Type type1, - FT_Type type2 ) - { - if ( type1 == type2 ) - goto Ok; - - if ( type1 == NULL || type2 == NULL ) - goto Fail; - - /* compare parent types */ - if ( type1->super != type2->super ) - { - if ( type1->super == NULL || - type2->super == NULL || - !ft_type_equal( type1, type2 ) ) - goto Fail; - } - - /* compare type names */ - if ( type1->name != type2->name ) - { - if ( type1->name == NULL || - type2->name == NULL || - ft_strcmp( type1->name, type2->name ) != 0 ) - goto Fail; - } - - /* compare the other type fields */ - if ( type1->class_size != type2->class_size || - type1->class_init != type2->class_init || - type1->class_done != type2->class_done || - type1->obj_size != type2->obj_size || - type1->obj_init != type2->obj_init || - type1->obj_done != type2->obj_done ) - goto Fail; - - Ok: - return 1; - - Fail: - return 0; - } - - - static FT_Int - ft_class_hnode_equal( const FT_ClassHNode node1, - const FT_ClassHNode node2 ) - { - FT_Type type1 = node1->type; - FT_Type type2 = node2->type; - - /* comparing the pointers should work in 99% of cases */ - return ( type1 == type2 ) ? 1 : ft_type_equal( type1, type2 ); - } - - - FT_BASE_DEF( void ) - ft_metaclass_done( FT_MetaClass meta ) - { - /* clear all classes */ - ft_hash_done( &meta->type_to_class, - (FT_Hash_ForeachFunc) ft_class_hnode_destroy, - NULL ); - - meta->clazz.object.clazz = NULL; - meta->clazz.object.ref_count = 0; - meta->clazz.magic = FT_MAGIC_DEATH; - } - - - FT_BASE_DEF( FT_Error ) - ft_metaclass_init( FT_MetaClass meta, - FT_Library library ) - { - FT_ClassRec* clazz = (FT_ClassRec*) &meta->clazz; - - /* the meta-class is its OWN class !! */ - clazz->object.clazz = (FT_Class) clazz; - clazz->object.ref_count = 1; - clazz->magic = FT_MAGIC_CLASS; - clazz->library = library; - clazz->memory = library->memory; - clazz->type = &ft_meta_class_type; - clazz->info = NULL; - - clazz->class_done = (FT_Object_DoneFunc) ft_metaclass_done; - - clazz->obj_size = sizeof( FT_ClassRec ); - clazz->obj_init = NULL; - clazz->obj_done = NULL; - - return ft_hash_init( &meta->type_to_class, - (FT_Hash_EqualFunc) ft_class_hnode_equal, - library->memory ); - } - - - /* find or create the class corresponding to a given type */ - /* note that this function will retunr NULL in case of */ - /* memory overflow */ - /* */ - static FT_Class - ft_metaclass_get_class( FT_MetaClass meta, - FT_Type ctype ) - { - FT_ClassHNodeRec keynode, *node, **pnode; - FT_Memory memory; - FT_ClassRec* clazz; - FT_Class parent; - FT_Error error; - - keynode.hnode.hash = FT_TYPE_HASH( ctype ); - keynode.type = ctype; - - pnode = (FT_ClassHNode*) ft_hash_lookup( &meta->type_to_class, - (FT_HashNode) &keynode ); - node = *pnode; - if ( node != NULL ) - { - clazz = (FT_ClassRec*) node->clazz; - goto Exit; - } - - memory = FT_CLASS__MEMORY(meta); - clazz = NULL; - parent = NULL; - if ( ctype->super != NULL ) - { - FT_ASSERT( ctype->super->class_size <= ctype->class_size ); - FT_ASSERT( ctype->super->obj_size <= ctype->obj_size ); - - parent = ft_metaclass_get_class( meta, ctype->super ); - } - - if ( !FT_NEW( node ) ) - { - if ( !FT_ALLOC( clazz, ctype->class_size ) ) - { - if ( parent ) - FT_MEM_COPY( (FT_ClassRec*)clazz, parent, parent->type->class_size ); - - clazz->object.clazz = (FT_Class) meta; - clazz->object.ref_count = 1; - - clazz->memory = memory; - clazz->library = FT_CLASS__LIBRARY(meta); - clazz->super = parent; - clazz->type = ctype; - clazz->info = NULL; - clazz->magic = FT_MAGIC_CLASS; - - clazz->class_done = ctype->class_done; - clazz->obj_size = ctype->obj_size; - clazz->obj_init = ctype->obj_init; - clazz->obj_done = ctype->obj_done; - - if ( parent ) - { - if ( clazz->class_done == NULL ) - clazz->class_done = parent->class_done; - - if ( clazz->obj_init == NULL ) - clazz->obj_init = parent->obj_init; - - if ( clazz->obj_done == NULL ) - clazz->obj_done = parent->obj_done; - } - - /* find class initializer, if any */ - { - FT_Type ztype = ctype; - FT_Object_InitFunc cinit = NULL; - - do - { - cinit = ztype->class_init; - if ( cinit != NULL ) - break; - - ztype = ztype->super; - } - while ( ztype != NULL ); - - /* then call it when needed */ - if ( cinit != NULL ) - error = cinit( (FT_Object) clazz, NULL ); - } - } - - if (error) - { - if ( clazz ) - { - /* we always call the class destructor when */ - /* an error was detected in the constructor !! */ - if ( clazz->class_done ) - clazz->class_done( (FT_Object) clazz ); - - FT_FREE( clazz ); - } - FT_FREE( node ); - } - } - - Exit: - return (FT_Class) clazz; - } - - - - - - - - - - - - - - - FT_BASE_DEF( FT_Int ) - ft_object_check( FT_Pointer obj ) - { - return FT_OBJECT_CHECK(obj); - } - - - FT_BASE_DEF( FT_Int ) - ft_object_is_a( FT_Pointer obj, - FT_Class clazz ) - { - if ( FT_OBJECT_CHECK(obj) ) - { - FT_Class c = FT_OBJECT__CLASS(obj); - - do - { - if ( c == clazz ) - return 1; - - c = c->super; - } - while ( c == NULL ); - - return (clazz == NULL); - } - return 0; - } - - - FT_BASE_DEF( FT_Error ) - ft_object_create( FT_Object *pobject, - FT_Class clazz, - FT_Pointer init_data ) - { - FT_Memory memory; - FT_Error error; - FT_Object obj; - - FT_ASSERT_IS_CLASS(clazz); - - memory = FT_CLASS__MEMORY(clazz); - if ( !FT_ALLOC( obj, clazz->obj_size ) ) - { - obj->clazz = clazz; - obj->ref_count = 1; - - if ( clazz->obj_init ) - { - error = clazz->obj_init( obj, init_data ); - if ( error ) - { - /* IMPORTANT: call the destructor when an error */ - /* was detected in the constructor !! */ - if ( clazz->obj_done ) - clazz->obj_done( obj ); - - FT_FREE( obj ); - } - } - } - *pobject = obj; - return error; - } - - - FT_BASE_DEF( FT_Class ) - ft_class_find_by_type( FT_Type type, - FT_Library library ) - { - FT_MetaClass meta = &library->meta_class; - - return ft_metaclass_get_class( meta, type ); - } - - - FT_BASE_DEF( FT_Error ) - ft_object_create_from_type( FT_Object *pobject, - FT_Type type, - FT_Pointer init_data, - FT_Library library ) - { - FT_Class clazz; - FT_Error error; - - clazz = ft_class_find_by_type( type, library ); - if ( clazz ) - error = ft_object_create( pobject, clazz, init_data ); - else - { - *pobject = NULL; - error = FT_Err_Out_Of_Memory; - } - - return error; - } Index: xc/extras/freetype2/src/base/ftobjs.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftobjs.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftobjs.c --- xc/extras/freetype2/src/base/ftobjs.c 28 Apr 2004 10:39:03 -0000 1.3 +++ xc/extras/freetype2/src/base/ftobjs.c 7 Mar 2005 18:53:45 -0000 @@ -1982,49 +1982,48 @@ clazz = driver->clazz; if ( !char_width ) char_width = char_height; else if ( !char_height ) char_height = char_width; if ( !horz_resolution ) horz_resolution = 72; if ( !vert_resolution ) vert_resolution = 72; /* default processing -- this can be overridden by the driver */ if ( char_width < 1 * 64 ) char_width = 1 * 64; 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; { FT_UShort x_ppem = (FT_UShort)( ( dim_x + 32 ) >> 6 ); FT_UShort y_ppem = (FT_UShort)( ( dim_y + 32 ) >> 6 ); - if ( x_ppem == metrics->x_ppem && y_ppem == metrics->y_ppem ) return FT_Err_Ok; metrics->x_ppem = x_ppem; metrics->y_ppem = y_ppem; } metrics->x_scale = 0x10000L; metrics->y_scale = 0x10000L; if ( face->face_flags & FT_FACE_FLAG_SCALABLE ) { metrics->x_scale = FT_DivFix( dim_x, face->units_per_EM ); metrics->y_scale = FT_DivFix( dim_y, face->units_per_EM ); ft_recompute_scaled_metrics( face, metrics ); } if ( clazz->set_char_sizes ) error = clazz->set_char_sizes( face->size, @@ -2198,40 +2197,58 @@ return FT_Err_Invalid_Face_Handle; cur = face->charmaps; if ( !cur ) return FT_Err_Invalid_CharMap_Handle; limit = cur + face->num_charmaps; for ( ; cur < limit; cur++ ) { if ( cur[0] == charmap ) { face->charmap = cur[0]; return 0; } } return FT_Err_Invalid_Argument; } + /* 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; + } + + 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); if ( clazz->done ) clazz->done( cmap ); FT_FREE( cmap ); } } FT_BASE_DEF( FT_Error ) FT_CMap_New( FT_CMap_Class clazz, Index: xc/extras/freetype2/src/base/ftstream.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftstream.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftstream.c --- xc/extras/freetype2/src/base/ftstream.c 28 Apr 2004 10:39:03 -0000 1.2 +++ xc/extras/freetype2/src/base/ftstream.c 7 Mar 2005 18:53:45 -0000 @@ -193,41 +193,41 @@ } FT_BASE_DEF( FT_Error ) FT_Stream_EnterFrame( FT_Stream stream, FT_ULong count ) { FT_Error error = FT_Err_Ok; FT_ULong read_bytes; /* check for nested frame access */ FT_ASSERT( stream && stream->cursor == 0 ); if ( stream->read ) { /* allocate the frame in memory */ FT_Memory memory = stream->memory; - if ( FT_ALLOC( stream->base, count ) ) + if ( FT_QALLOC( stream->base, count ) ) goto Exit; /* read it */ read_bytes = stream->read( stream, stream->pos, stream->base, count ); if ( read_bytes < count ) { FT_ERROR(( "FT_Stream_EnterFrame:" )); FT_ERROR(( " invalid read; expected %lu bytes, got %lu\n", count, read_bytes )); FT_FREE( stream->base ); error = FT_Err_Invalid_Stream_Operation; } stream->cursor = stream->base; stream->limit = stream->cursor + count; stream->pos += read_bytes; } else { Index: xc/extras/freetype2/src/base/ftsysio.c =================================================================== RCS file: xc/extras/freetype2/src/base/ftsysio.c diff -N xc/extras/freetype2/src/base/ftsysio.c --- xc/extras/freetype2/src/base/ftsysio.c 14 Nov 2003 16:48:24 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,131 +0,0 @@ -#include <ft2build.h> -#include FT_SYSTEM_STREAM_H - -#include <stdio.h> - - /* the ISO/ANSI standard stream object */ - typedef struct FT_StdStreamRec_ - { - FT_StreamRec stream; - FILE* file; - const char* pathname; - - } FT_StdStreamRec, *FT_StdStream; - - - - /* read bytes from a standard stream */ - static FT_ULong - ft_std_stream_read( FT_StdStream stream, - FT_Byte* buffer, - FT_ULong size ) - { - long read_bytes; - - read_bytes = fread( buffer, 1, size, stream->file ); - if ( read_bytes < 0 ) - read_bytes = 0; - - return (FT_ULong) read_bytes; - } - - - /* seek the standard stream to a new position */ - static FT_Error - ft_std_stream_seek( FT_StdStream stream, - FT_ULong pos ) - { - return ( fseek( stream->file, pos, SEEK_SET ) < 0 ) - ? FT_Err_Stream_Seek - : FT_Err_Ok; - } - - - /* close a standard stream */ - static void - ft_std_stream_done( FT_StdStream stream ) - { - fclose( stream->file ); - stream->file = NULL; - stream->pathname = NULL; - } - - - /* open a standard stream from a given pathname */ - static void - ft_std_stream_init( FT_StdStream stream, - const char* pathname ) - { - FT_ASSERT( pathname != NULL ); - - stream->file = fopen( pathname, "rb" ); - if ( stream->file == NULL ) - { - FT_ERROR(( "iso.stream.init: could not open '%s'\n", pathname )); - FT_XTHROW( FT_Err_Stream_Open ); - } - - /* compute total size in bytes */ - fseek( file, 0, SEEK_END ); - FT_STREAM__SIZE(stream) = ftell( file ); - fseek( file, 0, SEEK_SET ); - - stream->pathname = pathname; - stream->pos = 0; - - FT_TRACE1(( "iso.stream.init: opened '%s' (%ld bytes) succesfully\n", - pathname, FT_STREAM__SIZE(stream) )); - } - - - static void - ft_std_stream_class_init( FT_ClassRec* _clazz ) - { - FT_StreamClassRec* clazz = FT_STREAM_CLASS(_clazz); - - clazz->stream_read = (FT_Stream_ReadFunc) ft_std_stream_read; - clazz->stream_seek = (FT_Stream_SeekFunc) ft_std_stream_seek; - } - - - static const FT_TypeRec ft_std_stream_type; - { - "StreamClass", - NULL, - - sizeof( FT_ClassRec ), - ft_stream_class_init, - NULL, - - sizeof( FT_StdStreamRec ), - ft_std_stream_init, - ft_std_stream_done, - NULL, - }; - - - - FT_EXPORT_DEF( FT_Stream ) - ft_std_stream_new( FT_Memory memory, - const char* pathname ) - { - FT_Class clazz; - - clazz = ft_class_from_type( memory, &ft_std_stream_type ); - - return (FT_Stream) ft_object_new( clazz, pathname ); - } - - - FT_EXPORT_DEF( void ) - ft_std_stream_create( FT_Memory memory, - const char* pathname, - FT_Stream* astream ) - { - FT_Class clazz; - - clazz = ft_class_from_type( memory, &ft_std_stream_type ); - - ft_object_create( clazz, pathname, FT_OBJECT_P(astream) ); - } - Index: xc/extras/freetype2/src/base/ftsysmem.c =================================================================== RCS file: xc/extras/freetype2/src/base/ftsysmem.c diff -N xc/extras/freetype2/src/base/ftsysmem.c --- xc/extras/freetype2/src/base/ftsysmem.c 14 Nov 2003 16:48:24 -0000 1.1.1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,30 +0,0 @@ -#include <ft2build.h> -#include FT_SYSTEM_MEMORY_H - - static FT_Memory - ft_memory_new_default( FT_ULong size ) - { - return (FT_Memory) ft_malloc( size ); - } - - static void - ft_memory_destroy_default( FT_Memory memory ) - { - ft_free( memory ); - } - - - /* notice that in normal builds, we use the ISO C library functions */ - /* 'malloc', 'free' and 'realloc' directly.. */ - /* */ - static const FT_Memory_FuncsRec ft_memory_funcs_default_rec = - { - (FT_Memory_CreateFunc) ft_memory_new_iso, - (FT_Memory_DestroyFunc) ft_memory_destroy_iso, - (FT_Memory_AllocFunc) ft_malloc, - (FT_Memory_FreeFunc) ft_free, - (FT_Memory_ReallocFunc) ft_realloc - }; - - FT_APIVAR_DEF( const FT_Memory_Funcs ) - ft_memory_funcs_default = &ft_memory_funcs_defaults_rec; Index: xc/extras/freetype2/src/base/ftutil.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/base/ftutil.c,v retrieving revision 1.1.1.2 diff -u -2 -0 -r1.1.1.2 ftutil.c --- xc/extras/freetype2/src/base/ftutil.c 25 Nov 2003 19:27:19 -0000 1.1.1.2 +++ xc/extras/freetype2/src/base/ftutil.c 7 Mar 2005 18:53:45 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* ftutil.c */ /* */ /* FreeType utility file for memory and list management (body). */ /* */ -/* Copyright 2002 by */ +/* Copyright 2002, 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_DEBUG_H #include FT_INTERNAL_MEMORY_H #include FT_LIST_H /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -60,40 +60,70 @@ { FT_ERROR(( "FT_Alloc:" )); FT_ERROR(( " Out of memory? (%ld requested)\n", size )); return FT_Err_Out_Of_Memory; } FT_MEM_ZERO( *P, size ); } else *P = NULL; FT_TRACE7(( "FT_Alloc:" )); FT_TRACE7(( " size = %ld, block = 0x%08p, ref = 0x%08p\n", size, *P, P )); return FT_Err_Ok; } + 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 ) FT_Realloc( 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_Alloc() */ if ( !*P ) return FT_Alloc( memory, size, P ); /* if the new block if zero-sized, clear the current one */ if ( size <= 0 ) { @@ -102,40 +132,77 @@ } Q = memory->realloc( memory, current, size, *P ); if ( !Q ) goto Fail; if ( size > current ) FT_MEM_ZERO( (char*)Q + current, size - current ); *P = Q; return FT_Err_Ok; Fail: FT_ERROR(( "FT_Realloc:" )); FT_ERROR(( " Failed (current %ld, requested %ld)\n", current, size )); return FT_Err_Out_Of_Memory; } + 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 ) FT_Free( FT_Memory memory, void** P ) { FT_TRACE7(( "FT_Free:" )); FT_TRACE7(( " Freeing block 0x%08p, ref 0x%08p\n", P, P ? *P : (void*)0 )); if ( P && *P ) { memory->free( memory, *P ); *P = 0; } } /*************************************************************************/ /*************************************************************************/ Index: xc/extras/freetype2/src/bdf/bdf.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/bdf/bdf.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 bdf.h --- xc/extras/freetype2/src/bdf/bdf.h 23 Apr 2004 18:42:49 -0000 1.2 +++ xc/extras/freetype2/src/bdf/bdf.h 7 Mar 2005 18:53:45 -0000 @@ -1,23 +1,23 @@ /* * 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"), * 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 COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY 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. */ @@ -185,41 +185,41 @@ unsigned long glyphs_size; /* Glyph structures allocated. */ unsigned long glyphs_used; /* Glyph structures used. */ bdf_bbx_t bbx; /* Overall bounding box of glyphs. */ } bdf_glyphlist_t; typedef struct bdf_font_t_ { char* name; /* Name of the font. */ bdf_bbx_t bbx; /* Font bounding box. */ long point_size; /* Point size of the font. */ unsigned long resolution_x; /* Font horizontal resolution. */ unsigned long resolution_y; /* Font vertical resolution. */ int spacing; /* Font spacing value. */ 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. */ unsigned long glyphs_size; /* Glyph structures allocated. */ unsigned long glyphs_used; /* Glyph structures used. */ bdf_glyph_t* glyphs; /* Glyphs themselves. */ unsigned long unencoded_size; /* Unencoded glyph struct. allocated. */ unsigned long unencoded_used; /* Unencoded glyph struct. used. */ bdf_glyph_t* unencoded; /* Unencoded glyphs themselves. */ unsigned long props_size; /* Font properties allocated. */ unsigned long props_used; /* Font properties used. */ bdf_property_t* props; /* Font properties themselves. */ char* comments; /* Font comments. */ unsigned long comments_len; /* Length of comment string. */ bdf_glyphlist_t overflow; /* Storage used for glyph insertion. */ Index: xc/extras/freetype2/src/bdf/bdfdrivr.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/bdf/bdfdrivr.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 bdfdrivr.c --- xc/extras/freetype2/src/bdf/bdfdrivr.c 28 Apr 2004 10:39:03 -0000 1.3 +++ xc/extras/freetype2/src/bdf/bdfdrivr.c 7 Mar 2005 18:53:45 -0000 @@ -43,149 +43,162 @@ /*************************************************************************/ /* */ /* 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_bdfdriver typedef struct BDF_CMapRec_ { FT_CMapRec cmap; FT_UInt num_encodings; BDF_encoding_el* encodings; } BDF_CMapRec, *BDF_CMap; 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; cmap->encodings = face->en_table; return BDF_Err_Ok; } 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; max = cmap->num_encodings; while ( min < max ) { FT_UInt32 code; mid = ( min + max ) >> 1; code = encodings[mid].enc; if ( charcode == code ) { + /* increase glyph index by 1 -- */ + /* we reserve slot 0 for the undefined glyph */ result = encodings[mid].glyph + 1; break; } if ( charcode < code ) max = mid; else min = mid + 1; } return result; } 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; FT_UInt result = 0; min = 0; max = cmap->num_encodings; while ( min < max ) { FT_UInt32 code; mid = ( min + max ) >> 1; code = encodings[mid].enc; if ( charcode == code ) { + /* increase glyph index by 1 -- */ + /* we reserve slot 0 for the undefined glyph */ result = encodings[mid].glyph + 1; goto Exit; } if ( charcode < code ) max = mid; else min = mid + 1; } charcode = 0; if ( min < cmap->num_encodings ) { charcode = encodings[min].enc; result = encodings[min].glyph + 1; } Exit: *acharcode = charcode; return result; } - 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 }; static FT_Error bdf_interpret_style( BDF_Face bdf ) { FT_Error error = BDF_Err_Ok; FT_Face face = FT_FACE( bdf ); FT_Memory memory = face->memory; bdf_font_t* font = bdf->bdffont; bdf_property_t* prop; char *istr = NULL, *bstr = NULL; char *sstr = NULL, *astr = NULL; int parts = 0, len = 0; face->style_flags = 0; @@ -267,153 +280,154 @@ s += ft_strlen( istr ); *(s++) = ' '; } if ( sstr ) { ft_strcpy( s, sstr ); for ( i = 0; i < ft_strlen( sstr ); i++, s++ ) if ( *s == ' ' ) *s = '-'; /* replace spaces with dashes */ *(s++) = ' '; } *(--s) = '\0'; /* overwrite last ' ', terminate the string */ face->style_name = style; /* allocated string */ } return error; } - 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 ); bdf_free_font( face->bdffont ); FT_FREE( face->en_table ); 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; bdf_options_t options; FT_UNUSED( num_params ); FT_UNUSED( params ); FT_UNUSED( face_index ); if ( FT_STREAM_SEEK( 0 ) ) goto Exit; options.correct_metrics = 1; /* FZ XXX: options semantics */ options.keep_unencoded = 1; options.keep_comments = 0; options.font_spacing = BDF_PROPORTIONAL; error = bdf_load_font( stream, memory, &options, &font ); if ( error == BDF_Err_Missing_Startfont_Field ) { FT_TRACE2(( "[not a valid BDF file]\n" )); goto Fail; } else if ( error ) goto Exit; /* 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; FT_TRACE4(( "number of glyphs: %d (%d)\n", font->glyphs_size, font->glyphs_used )); FT_TRACE4(( "number of unencoded glyphs: %d (%d)\n", 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 */ prop = bdf_get_font_property( font, "FAMILY_NAME" ); if ( prop && prop->value.atom ) { 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; 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; prop = bdf_get_font_property( font, "POINT_SIZE" ); if ( prop ) /* convert from 722.7 decipoints to 72 points per inch */ bsize->size = (FT_Pos)( ( prop->value.int32 * 64 * 7200 + 36135L ) / 72270L ); prop = bdf_get_font_property( font, "PIXEL_SIZE" ); @@ -432,45 +446,49 @@ { bsize->y_ppem = bsize->size; if ( resolution_y ) bsize->y_ppem = bsize->y_ppem * resolution_y / 72; } if ( resolution_x && resolution_y ) bsize->x_ppem = bsize->y_ppem * resolution_x / resolution_y; else bsize->x_ppem = bsize->y_ppem; } /* encoding table */ { bdf_glyph_t* cur = font->glyphs; unsigned long n; 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; } } /* charmaps */ { bdf_property_t *charset_registry = 0, *charset_encoding = 0; FT_Bool unicode_charmap = 0; charset_registry = bdf_get_font_property( font, "CHARSET_REGISTRY" ); charset_encoding = bdf_get_font_property( font, "CHARSET_ENCODING" ); if ( charset_registry && charset_encoding ) { if ( charset_registry->format == BDF_ATOM && charset_encoding->format == BDF_ATOM && charset_registry->value.atom && charset_encoding->value.atom ) { @@ -504,127 +522,151 @@ { FT_CharMapRec charmap; charmap.face = FT_FACE( face ); charmap.encoding = FT_ENCODING_NONE; charmap.platform_id = 0; charmap.encoding_id = 0; if ( unicode_charmap ) { charmap.encoding = FT_ENCODING_UNICODE; charmap.platform_id = 3; charmap.encoding_id = 1; } error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); #if 0 /* Select default charmap */ - if (root->num_charmaps) - root->charmap = root->charmaps[0]; + if ( bdfface->num_charmaps ) + bdfface->charmap = bdfface->charmaps[0]; #endif } goto Exit; } } /* otherwise assume Adobe standard encoding */ { FT_CharMapRec charmap; charmap.face = FT_FACE( face ); charmap.encoding = FT_ENCODING_ADOBE_STANDARD; charmap.platform_id = 7; charmap.encoding_id = 0; 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]; } } } Exit: 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 ); + FT_UNUSED( char_height ); + FT_TRACE4(( "rec %d - pres %d\n", size->metrics.y_ppem, root->available_sizes->y_ppem )); if ( size->metrics.y_ppem == root->available_sizes->y_ppem >> 6 ) { 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; } - static FT_Error + 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 ) + { + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); + FT_UNUSED( horz_resolution ); + FT_UNUSED( vert_resolution ); + + return BDF_Set_Pixel_Size( size, 0, 0 ); + } + + + 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; FT_UNUSED( load_flags ); if ( !face ) { error = BDF_Err_Invalid_Argument; 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 */ glyph = face->bdffont->glyphs[glyph_index]; bitmap->rows = glyph.bbx.height; bitmap->width = glyph.bbx.width; if ( bpp == 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 */ @@ -767,106 +809,107 @@ case BDF_INTEGER: aproperty->type = BDF_PROPERTY_TYPE_INTEGER; aproperty->u.integer = prop->value.int32; break; case BDF_CARDINAL: aproperty->type = BDF_PROPERTY_TYPE_CARDINAL; aproperty->u.cardinal = prop->value.card32; break; default: goto Fail; } return 0; } Fail: return BDF_Err_Invalid_Argument; } + static FT_Error bdf_get_charset_id( BDF_Face face, const char* *acharset_encoding, const char* *acharset_registry ) { *acharset_encoding = face->charset_encoding; *acharset_registry = face->charset_registry; return 0; } static const FT_Service_BDFRec bdf_service_bdf = { (FT_BDF_GetCharsetIdFunc)bdf_get_charset_id, (FT_BDF_GetPropertyFunc) bdf_get_bdf_property }; /* * * SERVICES LIST * */ static const FT_ServiceDescRec bdf_services[] = { { FT_SERVICE_ID_BDF, &bdf_service_bdf }, { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_BDF }, { NULL, NULL } }; - static FT_Module_Interface + FT_CALLBACK_DEF( FT_Module_Interface ) bdf_driver_requester( FT_Module module, const char* name ) { FT_UNUSED( module ); return ft_service_list_lookup( bdf_services, name ); } FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec bdf_driver_class = { { FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_NO_OUTLINES, sizeof ( FT_DriverRec ), "bdf", 0x10000L, 0x20000L, 0, (FT_Module_Constructor)0, (FT_Module_Destructor) 0, (FT_Module_Requester) bdf_driver_requester }, sizeof ( BDF_FaceRec ), 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, - - (FT_Size_ResetPointsFunc) BDF_Set_Pixel_Size, - (FT_Size_ResetPixelsFunc) BDF_Set_Pixel_Size, - - (FT_Slot_LoadFunc) BDF_Glyph_Load, - - (FT_Face_GetKerningFunc) 0, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc) 0 + BDF_Face_Init, + BDF_Face_Done, + 0, /* FT_Size_InitFunc */ + 0, /* FT_Size_DoneFunc */ + 0, /* FT_Slot_InitFunc */ + 0, /* FT_Slot_DoneFunc */ + + BDF_Set_Point_Size, + BDF_Set_Pixel_Size, + + BDF_Glyph_Load, + + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ + 0, /* FT_Face_GetAdvancesFunc */ }; /* END */ Index: xc/extras/freetype2/src/bdf/bdfdrivr.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/bdf/bdfdrivr.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 bdfdrivr.h --- xc/extras/freetype2/src/bdf/bdfdrivr.h 28 Apr 2004 10:39:03 -0000 1.3 +++ xc/extras/freetype2/src/bdf/bdfdrivr.h 7 Mar 2005 18:53:45 -0000 @@ -1,25 +1,25 @@ /* bdfdrivr.h 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 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. */ @@ -42,33 +42,35 @@ FT_ULong enc; FT_UShort glyph; } BDF_encoding_el; typedef struct BDF_FaceRec_ { FT_FaceRec root; char* charset_encoding; char* charset_registry; bdf_font_t* bdffont; BDF_encoding_el* en_table; FT_CharMap charmap_handle; FT_CharMapRec charmap; /* a single charmap per face */ + FT_UInt default_glyph; + } BDF_FaceRec, *BDF_Face; FT_EXPORT_VAR( const FT_Driver_ClassRec ) bdf_driver_class; FT_END_HEADER #endif /* __BDFDRIVR_H__ */ /* END */ Index: xc/extras/freetype2/src/bdf/bdflib.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/bdf/bdflib.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 bdflib.c --- xc/extras/freetype2/src/bdf/bdflib.c 28 Apr 2004 10:39:03 -0000 1.3 +++ xc/extras/freetype2/src/bdf/bdflib.c 7 Mar 2005 18:53:47 -0000 @@ -1387,41 +1387,41 @@ /* If the property happens to be a comment, then it doesn't need */ /* to be added to the internal hash table. */ if ( ft_memcmp( name, "COMMENT", 7 ) != 0 ) { /* Add the property to the font property table. */ error = hash_insert( fp->name, (void *)font->props_used, (hashtable *)font->internal, memory ); if ( error ) goto Exit; } font->props_used++; /* Some special cases need to be handled here. The DEFAULT_CHAR */ /* property needs to be located if it exists in the property list, the */ /* FONT_ASCENT and FONT_DESCENT need to be assigned if they are */ /* 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 ) font->font_descent = fp->value.int32; else if ( ft_memcmp( name, "SPACING", 7 ) == 0 ) { if ( fp->value.atom[0] == 'p' || fp->value.atom[0] == 'P' ) font->spacing = BDF_PROPORTIONAL; else if ( fp->value.atom[0] == 'm' || fp->value.atom[0] == 'M' ) font->spacing = BDF_MONOWIDTH; else if ( fp->value.atom[0] == 'c' || fp->value.atom[0] == 'C' ) font->spacing = BDF_CHARCELL; } Exit: return error; } static const unsigned char nibble_mask[8] = @@ -2031,42 +2031,42 @@ error = hash_init( &(font->proptbl), memory ); if ( error ) goto Exit; for ( i = 0, prop = (bdf_property_t*)_bdf_properties; i < _num_bdf_properties; i++, prop++ ) { error = hash_insert( prop->name, (void *)i, &(font->proptbl), memory ); if ( error ) goto Exit; } } if ( FT_ALLOC( p->font->internal, sizeof ( hashtable ) ) ) goto Exit; 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; } /* Check for the start of the properties. */ if ( ft_memcmp( line, "STARTPROPERTIES", 15 ) == 0 ) { error = _bdf_split( (char *)" +", line, linelen, &p->list, memory ); if ( error ) goto Exit; p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1], 0, 10 ); if ( FT_NEW_ARRAY( p->font->props, p->cnt ) ) goto Exit; p->flags |= _BDF_PROPS; *next = _bdf_parse_properties; goto Exit; } Index: xc/extras/freetype2/src/cache/ftcbasic.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftcbasic.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 ftcbasic.c --- xc/extras/freetype2/src/cache/ftcbasic.c 28 Apr 2004 10:39:04 -0000 1.1 +++ xc/extras/freetype2/src/cache/ftcbasic.c 7 Mar 2005 18:53:47 -0000 @@ -46,218 +46,234 @@ ( FTC_SCALER_HASH( &(a)->scaler ) + 31*(a)->load_flags ) typedef struct FTC_BasicQueryRec_ { FTC_GQueryRec gquery; FTC_BasicAttrRec attrs; } FTC_BasicQueryRec, *FTC_BasicQuery; typedef struct FTC_BasicFamilyRec_ { FTC_FamilyRec family; FTC_BasicAttrRec attrs; } FTC_BasicFamilyRec, *FTC_BasicFamily; 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; } 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, &face ); if ( !error ) result = face->num_glyphs; return result; } FT_CALLBACK_DEF( FT_Error ) - ftc_basic_family_load_bitmap( FTC_BasicFamily family, - FT_UInt gindex, - FTC_Manager manager, - FT_Face *aface ) - { - FT_Error error; - FT_Size size; + ftc_basic_family_load_bitmap( FTC_Family ftcfamily, + FT_UInt gindex, + FTC_Manager manager, + FT_Face *aface ) + { + FTC_BasicFamily family = (FTC_BasicFamily)ftcfamily; + FT_Error error; + FT_Size size; error = FTC_Manager_LookupSize( manager, &family->attrs.scaler, &size ); if ( !error ) { FT_Face face = size->face; error = FT_Load_Glyph( face, gindex, family->attrs.load_flags | FT_LOAD_RENDER ); if ( !error ) *aface = face; } return error; } FT_CALLBACK_DEF( FT_Error ) - ftc_basic_family_load_glyph( FTC_BasicFamily family, - 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_basic_family_load_glyph( FTC_Family ftcfamily, + FT_UInt gindex, + FTC_Cache cache, + FT_Glyph *aglyph ) + { + 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 */ error = FTC_Manager_LookupSize( cache->manager, scaler, &size ); if ( !error ) { face = size->face; error = FT_Load_Glyph( face, gindex, family->attrs.load_flags ); if ( !error ) { if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP || face->glyph->format == FT_GLYPH_FORMAT_OUTLINE ) { /* ok, copy it */ FT_Glyph glyph; error = FT_Get_Glyph( face->glyph, &glyph ); if ( !error ) { *aglyph = glyph; goto Exit; } } else error = FTC_Err_Invalid_Argument; } } Exit: return error; } 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; result = FT_BOOL( family->attrs.scaler.face_id == face_id ); if ( result ) { /* we must call this function to avoid this node from appearing * in later lookups with the same face_id! */ FTC_GNode_UnselectFamily( gnode, cache ); } return result; } /* * * basic image cache * */ FT_CALLBACK_TABLE_DEF 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 }; FT_CALLBACK_TABLE_DEF 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, - - sizeof( FTC_GCacheRec ), - (FTC_Cache_InitFunc) ftc_gcache_init, - (FTC_Cache_DoneFunc) ftc_gcache_done + ftc_inode_new, + ftc_inode_weight, + ftc_gnode_compare, + ftc_basic_gnode_compare_faceid, + ftc_inode_free, + + 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 ) { return FTC_GCache_New( manager, &ftc_basic_image_cache_class, (FTC_GCache*)acache ); } - /* documentation is in ftcimage.h */ + /* documentation is in ftcache.h */ FT_EXPORT_DEF( FT_Error ) FTC_ImageCache_Lookup( FTC_ImageCache cache, FTC_ImageType type, FT_UInt gindex, FT_Glyph *aglyph, FTC_Node *anode ) { FTC_BasicQueryRec query; FTC_INode node; FT_Error error; FT_UInt32 hash; /* some argument checks are delayed to FTC_Cache_Lookup */ if ( !aglyph ) { error = FTC_Err_Invalid_Argument; goto Exit; } @@ -302,77 +318,81 @@ } } Exit: return error; } /* * * basic small bitmap cache * */ FT_CALLBACK_TABLE_DEF const FTC_SFamilyClassRec ftc_basic_sbit_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 + 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 }; FT_CALLBACK_TABLE_DEF 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, - - sizeof( FTC_GCacheRec ), - (FTC_Cache_InitFunc) ftc_gcache_init, - (FTC_Cache_DoneFunc) ftc_gcache_done + ftc_snode_new, + ftc_snode_weight, + ftc_snode_compare, + ftc_basic_gnode_compare_faceid, + ftc_snode_free, + + 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 ) { return FTC_GCache_New( manager, &ftc_basic_sbit_cache_class, (FTC_GCache*)acache ); } + /* documentation is in ftcache.h */ + FT_EXPORT_DEF( FT_Error ) FTC_SBitCache_Lookup( FTC_SBitCache cache, FTC_ImageType type, FT_UInt gindex, FTC_SBit *ansbit, FTC_Node *anode ) { FT_Error error; FTC_BasicQueryRec query; FTC_SNode node; FT_UInt32 hash; if ( anode ) *anode = NULL; /* other argument checks delayed to FTC_Cache_Lookup */ if ( !ansbit ) return FTC_Err_Invalid_Argument; Index: xc/extras/freetype2/src/cache/ftccache.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftccache.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftccache.c --- xc/extras/freetype2/src/cache/ftccache.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cache/ftccache.c 7 Mar 2005 18:53:47 -0000 @@ -287,120 +287,120 @@ /* check, just in case of general corruption :-) */ if ( manager->num_nodes == 0 ) FT_ERROR(( "ftc_node_destroy: invalid cache node count! = %d\n", manager->num_nodes )); #endif } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** ABSTRACT CACHE CLASS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ 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; cache->p = 0; cache->mask = FTC_HASH_INITIAL_SIZE - 1; cache->slack = FTC_HASH_INITIAL_SIZE * FTC_HASH_MAX_LOAD; return ( FT_MEM_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE * 2 ) ); } - 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 ) { if ( cache ) { FTC_Manager manager = cache->manager; FT_UFast i; FT_UInt count; count = cache->p + cache->mask + 1; for ( i = 0; i < count; i++ ) { FTC_Node *pnode = cache->buckets + i, next, node = *pnode; while ( node ) { next = node->link; node->link = NULL; /* remove node from mru list */ ftc_node_mru_unlink( node, manager ); /* now finalize it */ manager->cur_weight -= cache->clazz.node_weight( node, cache ); cache->clazz.node_free( node, cache ); node = next; } cache->buckets[i] = NULL; } ftc_cache_resize( cache ); } } - FT_EXPORT_DEF( void ) - FTC_Cache_Done( FTC_Cache cache ) + FT_LOCAL_DEF( void ) + ftc_cache_done( FTC_Cache cache ) { if ( cache->memory ) { FT_Memory memory = cache->memory; FTC_Cache_Clear( cache ); FT_FREE( cache->buckets ); cache->mask = 0; cache->p = 0; cache->slack = 0; cache->memory = NULL; } } - 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 ); } static void ftc_cache_add( FTC_Cache cache, FT_UInt32 hash, FTC_Node node ) { node->hash = hash; node->cache_index = (FT_UInt16) cache->index; node->ref_count = 0; ftc_node_hash_link( node, cache ); ftc_node_mru_link( node, cache->manager ); { FTC_Manager manager = cache->manager; manager->cur_weight += cache->clazz.node_weight( node, cache ); Index: xc/extras/freetype2/src/cache/ftccback.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftccback.h,v retrieving revision 1.1 diff -u -2 -0 -r1.1 ftccback.h --- xc/extras/freetype2/src/cache/ftccback.h 28 Apr 2004 10:39:04 -0000 1.1 +++ xc/extras/freetype2/src/cache/ftccback.h 7 Mar 2005 18:53:47 -0000 @@ -11,72 +11,75 @@ /* 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 __FTCCBACK_H__ #define __FTCCBACK_H__ #include <ft2build.h> #include FT_CACHE_H #include FT_CACHE_INTERNAL_MRU_H #include FT_CACHE_INTERNAL_IMAGE_H #include FT_CACHE_INTERNAL_MANAGER_H #include FT_CACHE_INTERNAL_GLYPH_H #include FT_CACHE_INTERNAL_SBITS_H 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 ); + ftc_inode_new( FTC_Node *pinode, + FT_Pointer gquery, + FTC_Cache cache ); FT_LOCAL( FT_ULong ) - ftc_inode_weight( FTC_INode inode ); + ftc_inode_weight( FTC_Node inode, + FTC_Cache cache ); FT_LOCAL( void ) - ftc_snode_free( FTC_SNode snode, + ftc_snode_free( FTC_Node snode, FTC_Cache cache ); FT_LOCAL( FT_Error ) - ftc_snode_new( FTC_SNode *psnode, - FTC_GQuery gquery, + ftc_snode_new( FTC_Node *psnode, + FT_Pointer gquery, FTC_Cache cache ); FT_LOCAL( FT_ULong ) - ftc_snode_weight( FTC_SNode snode ); + 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 ) ftc_cache_init( FTC_Cache cache ); FT_LOCAL( void ) ftc_cache_done( FTC_Cache cache ); #endif /* __FTCCBACK_H__ */ /* END */ Index: xc/extras/freetype2/src/cache/ftccmap.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftccmap.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftccmap.c --- xc/extras/freetype2/src/cache/ftccmap.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cache/ftccmap.c 7 Mar 2005 18:53:47 -0000 @@ -81,151 +81,167 @@ #define FTC_CMAP_NODE_HASH( x ) \ FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->first ) /* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */ /* glyph indices haven't been queried through FT_Get_Glyph_Index() yet */ #define FTC_CMAP_UNKNOWN ( (FT_UInt16)-1 ) /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** CHARMAP NODES *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ /* 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 ); } /* initialize a new cmap node */ FT_CALLBACK_DEF( FT_Error ) - ftc_cmap_node_new( FTC_CMapNode *anode, - FTC_CMapQuery query, - FTC_Cache cache ) - { - FT_Error error; - FT_Memory memory = cache->memory; - FTC_CMapNode node; - FT_UInt nn; + ftc_cmap_node_new( FTC_Node *ftcanode, + FT_Pointer ftcquery, + FTC_Cache cache ) + { + 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 ) ) { node->face_id = query->face_id; node->cmap_index = query->cmap_index; node->first = (query->char_code / FTC_CMAP_INDICES_MAX) * FTC_CMAP_INDICES_MAX; for ( nn = 0; nn < FTC_CMAP_INDICES_MAX; nn++ ) node->indices[nn] = FTC_CMAP_UNKNOWN; } *anode = node; return error; } /* 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 ); } /* 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 ) { FT_UInt32 offset = (FT_UInt32)( query->char_code - node->first ); return FT_BOOL( offset < FTC_CMAP_INDICES_MAX ); } return 0; } 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 ); } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** GLYPH IMAGE CACHE *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ 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, FTC_CMapCache *acache ) { return FTC_Manager_RegisterCache( manager, &ftc_cmap_cache_class, FTC_CACHE_P( acache ) ); } - /* documentation is in ftccmap.h */ + /* documentation is in ftcache.h */ FT_EXPORT_DEF( FT_UInt ) FTC_CMapCache_Lookup( FTC_CMapCache cmap_cache, FTC_FaceID face_id, FT_Int cmap_index, FT_UInt32 char_code ) { FTC_Cache cache = FTC_CACHE( cmap_cache ); FTC_CMapQueryRec query; FTC_CMapNode node; FT_Error error; FT_UInt gindex = 0; FT_UInt32 hash; if ( !cache ) { FT_ERROR(( "FTC_CMapCache_Lookup: bad arguments, returning 0!\n" )); return 0; } Index: xc/extras/freetype2/src/cache/ftcglyph.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftcglyph.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftcglyph.c --- xc/extras/freetype2/src/cache/ftcglyph.c 28 Apr 2004 10:39:04 -0000 1.2 +++ xc/extras/freetype2/src/cache/ftcglyph.c 7 Mar 2005 18:53:47 -0000 @@ -47,118 +47,129 @@ gnode->family = NULL; if ( family && --family->num_nodes <= 0 ) FTC_MruList_Remove( &FTC_GCACHE( cache )->families, (FTC_MruNode)family ); } FT_EXPORT_DEF( void ) FTC_GNode_Done( FTC_GNode gnode, FTC_Cache cache ) { /* finalize the node */ gnode->gindex = 0; FTC_GNode_UnselectFamily( gnode, cache ); } - 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 ); } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** CHUNK SETS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ FT_EXPORT_DEF( void ) FTC_Family_Init( FTC_Family family, FTC_Cache cache ) { FTC_GCacheClass clazz = FTC_CACHE__GCACHE_CLASS( cache ); family->clazz = clazz->family_class; family->num_nodes = 0; family->cache = cache; } - 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 ) { FTC_GCacheClass clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class; FTC_MruList_Init( &cache->families, clazz->family_class, 0, /* no maximum here! */ cache, FTC_CACHE( cache )->memory ); } return error; } - 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_EXPORT_DEF( void ) - FTC_GCache_Done( FTC_GCache 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_LOCAL_DEF( void ) - ftc_gcache_done( FTC_GCache cache ) + FT_EXPORT_DEF( void ) + FTC_GCache_Done( FTC_GCache cache ) { - FTC_GCache_Done( cache ); + ftc_gcache_done( FTC_CACHE( cache ) ); } FT_EXPORT_DEF( FT_Error ) FTC_GCache_New( FTC_Manager manager, FTC_GCacheClass clazz, FTC_GCache *acache ) { return FTC_Manager_RegisterCache( manager, (FTC_CacheClass)clazz, (FTC_Cache*)acache ); } FT_EXPORT_DEF( FT_Error ) FTC_GCache_Lookup( FTC_GCache cache, FT_UInt32 hash, FT_UInt gindex, FTC_GQuery query, FTC_Node *anode ) { Index: xc/extras/freetype2/src/cache/ftcimage.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftcimage.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftcimage.c --- xc/extras/freetype2/src/cache/ftcimage.c 28 Apr 2004 10:39:04 -0000 1.2 +++ xc/extras/freetype2/src/cache/ftcimage.c 7 Mar 2005 18:53:47 -0000 @@ -9,137 +9,146 @@ /* */ /* 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_CACHE_H #include FT_CACHE_INTERNAL_IMAGE_H #include FT_INTERNAL_MEMORY_H #include "ftccback.h" #include "ftcerror.h" /* 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; if ( inode->glyph ) { FT_Done_Glyph( inode->glyph ); inode->glyph = NULL; } FTC_GNode_Done( FTC_GNODE( inode ), cache ); FT_FREE( inode ); } - 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 ); } /* initialize a new glyph image node */ FT_EXPORT_DEF( FT_Error ) FTC_INode_New( FTC_INode *pinode, FTC_GQuery gquery, FTC_Cache cache ) { FT_Memory memory = cache->memory; FT_Error error; FTC_INode inode; if ( !FT_NEW( inode ) ) { FTC_GNode gnode = FTC_GNODE( inode ); FTC_Family family = gquery->family; FT_UInt gindex = gquery->gindex; FTC_IFamilyClass clazz = FTC_CACHE__IFAMILY_CLASS( cache ); /* initialize its inner fields */ FTC_GNode_Init( gnode, gindex, family ); /* we will now load the glyph image */ error = clazz->family_load_glyph( family, gindex, cache, &inode->glyph ); } *pinode = inode; return error; } 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 ) { case FT_GLYPH_FORMAT_BITMAP: { FT_BitmapGlyph bitg; bitg = (FT_BitmapGlyph)glyph; size = bitg->bitmap.rows * labs( bitg->bitmap.pitch ) + sizeof ( *bitg ); } break; case FT_GLYPH_FORMAT_OUTLINE: { FT_OutlineGlyph outg; outg = (FT_OutlineGlyph)glyph; size = outg->outline.n_points * ( sizeof ( FT_Vector ) + sizeof ( FT_Byte ) ) + outg->outline.n_contours * sizeof ( FT_Short ) + sizeof ( *outg ); } break; default: ; } size += sizeof ( *inode ); return size; } - 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 ); } /* END */ Index: xc/extras/freetype2/src/cache/ftcmanag.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftcmanag.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftcmanag.c --- xc/extras/freetype2/src/cache/ftcmanag.c 28 Apr 2004 10:39:04 -0000 1.2 +++ xc/extras/freetype2/src/cache/ftcmanag.c 7 Mar 2005 18:53:48 -0000 @@ -62,110 +62,131 @@ FT_Done_Size( size ); size = NULL; } Exit: *asize = size; return error; } typedef struct FTC_SizeNodeRec_ { FTC_MruNodeRec node; FT_Size size; FTC_ScalerRec scaler; } FTC_SizeNodeRec, *FTC_SizeNode; 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 ) FT_Done_Size( size ); } 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 ) ) { FT_Activate_Size( node->size ); return 1; } return 0; } 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 ); } 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]; return ftc_scaler_lookup_size( manager, scaler, &node->size ); } 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 ) { - return FT_BOOL( node->scaler.face_id == face_id ); + FTC_SizeNode node = (FTC_SizeNode)ftcnode; + FTC_FaceID face_id = (FTC_FaceID)ftcface_id; + + + return 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, FT_Size *asize ) { FT_Error error; FTC_SizeNode node; if ( asize == NULL ) return FTC_Err_Bad_Argument; *asize = NULL; if ( !manager ) return FTC_Err_Invalid_Cache_Handle; #ifdef FTC_INLINE FTC_MRULIST_LOOKUP_CMP( &manager->sizes, scaler, ftc_size_node_compare, @@ -183,99 +204,109 @@ /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** FACE MRU IMPLEMENTATION *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ typedef struct FTC_FaceNodeRec_ { FTC_MruNodeRec node; FTC_FaceID face_id; FT_Face face; } FTC_FaceNodeRec, *FTC_FaceNode; FT_CALLBACK_DEF( FT_Error ) - ftc_face_node_init( FTC_FaceNode node, - FTC_FaceID face_id, - FTC_Manager manager ) - { - FT_Error error; + ftc_face_node_init( FTC_MruNode ftcnode, + FT_Pointer ftcface_id, + FT_Pointer ftcmanager ) + { + 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; error = manager->request_face( face_id, manager->library, manager->request_data, &node->face ); if ( !error ) { /* destroy initial size object; it will be re-created later */ if ( node->face->size ) FT_Done_Size( node->face->size ); } return error; } 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 ); node->face = NULL; node->face_id = NULL; } 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 ); } 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 }; /* documentation is in ftcache.h */ FT_EXPORT_DEF( FT_Error ) FTC_Manager_LookupFace( FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface ) { FT_Error error; FTC_FaceNode node; if ( aface == NULL ) return FTC_Err_Bad_Argument; *aface = NULL; if ( !manager ) @@ -600,48 +631,50 @@ { FTC_Node prev = FTC_NODE__PREV( node ); /* don't touch locked nodes */ if ( node->ref_count <= 0 ) { ftc_node_destroy( node, manager ); result++; } if ( prev == manager->nodes_list ) break; node = prev; } return result; } + /* documentation is in ftcache.h */ + FT_EXPORT_DEF( void ) FTC_Manager_RemoveFaceID( FTC_Manager manager, FTC_FaceID face_id ) { FT_UInt nn; /* this will remove all FTC_SizeNode that correspond to * the face_id as well */ FTC_MruList_RemoveSelection( &manager->faces, NULL, face_id ); for ( nn = 0; nn < manager->num_caches; nn++ ) FTC_Cache_RemoveFaceID( manager->caches[nn], face_id ); } - /* documentation is in ftcmanag.h */ + /* documentation is in ftcache.h */ FT_EXPORT_DEF( void ) FTC_Node_Unref( FTC_Node node, FTC_Manager manager ) { if ( node && (FT_UInt)node->cache_index < manager->num_caches ) node->ref_count--; } /* END */ Index: xc/extras/freetype2/src/cache/ftcsbits.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cache/ftcsbits.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftcsbits.c --- xc/extras/freetype2/src/cache/ftcsbits.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cache/ftcsbits.c 7 Mar 2005 18:53:48 -0000 @@ -41,63 +41,64 @@ FT_Bitmap* bitmap, FT_Memory memory ) { FT_Error error; FT_Int pitch = bitmap->pitch; FT_ULong size; if ( pitch < 0 ) pitch = -pitch; size = (FT_ULong)( pitch * bitmap->rows ); if ( !FT_ALLOC( sbit->buffer, size ) ) FT_MEM_COPY( sbit->buffer, bitmap->buffer, size ); return error; } - 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; for ( ; count > 0; sbit++, count-- ) FT_FREE( sbit->buffer ); FTC_GNode_Done( FTC_GNODE( snode ), cache ); FT_FREE( snode ); } - 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 ); } static FT_Error ftc_snode_load( FTC_SNode snode, FTC_Manager manager, FT_UInt gindex, FT_ULong *asize ) { FT_Error error; FTC_GNode gnode = FTC_GNODE( snode ); FTC_Family family = gnode->family; FT_Memory memory = manager->memory; FT_Face face; FTC_SBit sbit; FTC_SFamilyClass clazz; if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count ) { @@ -223,111 +224,121 @@ snode->count = count; error = ftc_snode_load( snode, cache->manager, gindex, NULL ); if ( error ) { FTC_SNode_Free( snode, cache ); snode = NULL; } } Exit: *psnode = snode; return error; } 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 ); /* the node itself */ size = sizeof ( *snode ); for ( ; count > 0; count--, sbit++ ) { if ( sbit->buffer ) { pitch = sbit->pitch; if ( pitch < 0 ) pitch = -pitch; /* add the size of a given glyph image */ size += pitch * sbit->height; } } return size; } - 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 && (FT_UInt)( gindex - gnode->gindex ) < snode->count ); if ( result ) { /* check if we need to load the glyph bitmap now */ FTC_SBit sbit = snode->sbits + ( gindex - gnode->gindex ); if ( sbit->buffer == NULL && sbit->width != 255 ) { FT_ULong size; if ( !ftc_snode_load( snode, cache->manager, gindex, &size ) ) { cache->manager->cur_weight += size; } } } return result; } - 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 ); } /* END */ Index: xc/extras/freetype2/src/cff/cffdrivr.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffdrivr.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 cffdrivr.c --- xc/extras/freetype2/src/cff/cffdrivr.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cff/cffdrivr.c 7 Mar 2005 18:53:48 -0000 @@ -79,46 +79,47 @@ /* left_glyph :: The index of the left glyph in the kern pair. */ /* */ /* right_glyph :: The index of the right glyph in the kern pair. */ /* */ /* <Output> */ /* kerning :: The kerning vector. This is in font units for */ /* scalable formats, and in pixels for fixed-sizes */ /* formats. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ /* <Note> */ /* Only horizontal layouts (left-to-right & right-to-left) are */ /* supported by this function. Other layouts, or more sophisticated */ /* kernings, are out of scope of this method (the basic driver */ /* interface is meant to be simple). */ /* */ /* They can be implemented by format-specific interfaces. */ /* */ - static FT_Error - Get_Kerning( TT_Face face, + FT_CALLBACK_DEF( FT_Error ) + Get_Kerning( FT_Face ttface, /* TT_Face */ FT_UInt left_glyph, FT_UInt right_glyph, FT_Vector* kerning ) { + TT_Face face = (TT_Face)ttface; TT_Kern0_Pair pair; 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; left = 0; right = face->num_kern_pairs - 1; while ( left <= right ) @@ -161,64 +162,66 @@ /* A driver method used to load a glyph within a given glyph slot. */ /* */ /* <Input> */ /* slot :: A handle to the target slot object where the glyph */ /* will be loaded. */ /* */ /* size :: A handle to the source face size at which the glyph */ /* must be scaled, loaded, etc. */ /* */ /* glyph_index :: The index of the glyph in the font file. */ /* */ /* load_flags :: A flag indicating what to load for this glyph. The */ /* FT_LOAD_??? constants can be used to control the */ /* glyph loading process (e.g., whether the outline */ /* should be scaled, whether to load bitmaps or not, */ /* whether to hint the outline, etc). */ /* */ /* <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 ) return CFF_Err_Invalid_Slot_Handle; /* check whether we want a scaled outline or bitmap */ if ( !size ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; if ( load_flags & FT_LOAD_NO_SCALE ) size = NULL; /* 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; } /* now load the glyph outline if necessary */ error = cff_slot_load( slot, size, glyph_index, load_flags ); /* force drop-out mode to 2 - irrelevant now */ /* slot->outline.dropout_mode = 2; */ return error; } /* * GLYPH DICT SERVICE * */ static FT_Error cff_get_glyph_name( CFF_Face face, @@ -392,86 +395,86 @@ /**** ****/ /**** D R I V E R I N T E R F A C E ****/ /**** ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ static const FT_ServiceDescRec cff_services[] = { { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF }, { FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info }, #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict }, #endif { FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info }, { NULL, NULL } }; - 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; FT_Module_Interface result; result = ft_service_list_lookup( cff_services, module_interface ); if ( result != NULL ) 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; } /* The FT_DriverInterface structure is defined in ftdriver.h. */ FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec cff_driver_class = { /* begin with the FT_Module_Class fields */ { FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, sizeof( CFF_DriverRec ), "cff", 0x10000L, 0x20000L, 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 */ sizeof( TT_FaceRec ), 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, - - (FT_Size_ResetPointsFunc)cff_size_reset, - (FT_Size_ResetPixelsFunc)cff_size_reset, - - (FT_Slot_LoadFunc) Load_Glyph, - - (FT_Face_GetKerningFunc) Get_Kerning, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc)0, + cff_face_init, + cff_face_done, + cff_size_init, + cff_size_done, + cff_slot_init, + cff_slot_done, + + cff_point_size_reset, + cff_size_reset, + + Load_Glyph, + + Get_Kerning, + 0, /* FT_Face_AttachFunc */ + 0 /* FT_Face_GetAdvancesFunc */ }; /* END */ Index: xc/extras/freetype2/src/cff/cffgload.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffgload.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 cffgload.c --- xc/extras/freetype2/src/cff/cffgload.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cff/cffgload.c 7 Mar 2005 18:53:49 -0000 @@ -808,58 +808,58 @@ /* set default width */ decoder->num_hints = 0; decoder->read_width = 1; /* compute random seed from stack address of parameter */ seed = (FT_Fixed)(char*)&seed ^ (FT_Fixed)(char*)&decoder ^ (FT_Fixed)(char*)&charstring_base; seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL; if ( seed == 0 ) seed = 0x7384; /* initialize the decoder */ decoder->top = decoder->stack; decoder->zone = decoder->zones; zone = decoder->zones; stack = decoder->top; - hinter = (T2_Hints_Funcs) builder->hints_funcs; + hinter = (T2_Hints_Funcs)builder->hints_funcs; builder->path_begun = 0; zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; error = CFF_Err_Ok; x = builder->pos_x; y = builder->pos_y; /* begin hints recording session, if any */ if ( hinter ) hinter->open( hinter->hints ); - /* now, execute loop */ + /* now execute loop */ while ( ip < limit ) { CFF_Operator op; FT_Byte v; /********************************************************************/ /* */ /* Decode operator or operand */ /* */ v = *ip++; if ( v >= 32 || v == 28 ) { FT_Int shift = 16; FT_Int32 val; /* this is an operand, push it on the stack */ if ( v == 28 ) { @@ -1249,194 +1249,194 @@ cff_builder_close_contour( builder ); builder->path_begun = 0; y += args[0]; args = stack; break; case cff_op_hmoveto: FT_TRACE4(( " hmoveto" )); cff_builder_close_contour( builder ); builder->path_begun = 0; x += args[0]; args = stack; break; case cff_op_rlineto: FT_TRACE4(( " rlineto" )); 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; args = stack; while ( args < decoder->top ) { x += args[0]; y += args[1]; cff_builder_add_point( builder, x, y, 1 ); args += 2; } args = stack; break; case cff_op_hlineto: case cff_op_vlineto: { FT_Int phase = ( op == cff_op_hlineto ); 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 ) { if ( phase ) x += args[0]; else y += args[0]; if ( cff_builder_add_point1( builder, x, y ) ) - goto Memory_Error; + goto Fail; args++; phase ^= 1; } args = stack; } break; case cff_op_rrcurveto: FT_TRACE4(( " rrcurveto" )); /* check number of arguments; must be a multiple of 6 */ if ( num_args % 6 != 0 ) goto Stack_Underflow; 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 ) { x += args[0]; y += args[1]; cff_builder_add_point( builder, x, y, 0 ); x += args[2]; y += args[3]; cff_builder_add_point( builder, x, y, 0 ); x += args[4]; y += args[5]; cff_builder_add_point( builder, x, y, 1 ); args += 6; } args = stack; break; 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 ) { x += args[0]; args++; num_args--; } if ( num_args % 4 != 0 ) goto Stack_Underflow; if ( check_points( builder, 3 * ( num_args / 4 ) ) ) - goto Memory_Error; + goto Fail; while ( args < decoder->top ) { y += args[0]; cff_builder_add_point( builder, x, y, 0 ); x += args[1]; y += args[2]; cff_builder_add_point( builder, x, y, 0 ); y += args[3]; cff_builder_add_point( builder, x, y, 1 ); args += 4; } args = stack; break; 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 ) { y += args[0]; args++; num_args--; } if ( num_args % 4 != 0 ) goto Stack_Underflow; if ( check_points( builder, 3 * ( num_args / 4 ) ) ) - goto Memory_Error; + goto Fail; while ( args < decoder->top ) { x += args[0]; cff_builder_add_point( builder, x, y, 0 ); x += args[1]; y += args[2]; cff_builder_add_point( builder, x, y, 0 ); x += args[3]; cff_builder_add_point( builder, x, y, 1 ); args += 4; } args = stack; break; case cff_op_vhcurveto: case cff_op_hvcurveto: { FT_Int phase; 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 ) goto Stack_Underflow; if ( check_points( builder, ( num_args / 4 ) * 3 ) ) goto Stack_Underflow; phase = ( op == cff_op_hvcurveto ); while ( num_args >= 4 ) { num_args -= 4; if ( phase ) { x += args[0]; cff_builder_add_point( builder, x, y, 0 ); x += args[1]; y += args[2]; cff_builder_add_point( builder, x, y, 0 ); @@ -1459,123 +1459,123 @@ } args += 4; phase ^= 1; } args = stack; } break; case cff_op_rlinecurve: { FT_Int num_lines = ( num_args - 6 ) / 2; FT_TRACE4(( " rlinecurve" )); if ( num_args < 8 || ( num_args - 6 ) & 1 ) goto Stack_Underflow; if ( cff_builder_start_point( builder, x, y ) || check_points( builder, num_lines + 3 ) ) - goto Memory_Error; + goto Fail; args = stack; /* first, add the line segments */ while ( num_lines > 0 ) { x += args[0]; y += args[1]; cff_builder_add_point( builder, x, y, 1 ); args += 2; num_lines--; } /* then the curve */ x += args[0]; y += args[1]; cff_builder_add_point( builder, x, y, 0 ); x += args[2]; y += args[3]; cff_builder_add_point( builder, x, y, 0 ); x += args[4]; y += args[5]; cff_builder_add_point( builder, x, y, 1 ); args = stack; } break; case cff_op_rcurveline: { FT_Int num_curves = ( num_args - 2 ) / 6; FT_TRACE4(( " rcurveline" )); if ( num_args < 8 || ( num_args - 2 ) % 6 ) goto Stack_Underflow; if ( cff_builder_start_point ( builder, x, y ) || check_points( builder, num_curves*3 + 2 ) ) - goto Memory_Error; + goto Fail; args = stack; /* first, add the curves */ while ( num_curves > 0 ) { x += args[0]; y += args[1]; cff_builder_add_point( builder, x, y, 0 ); x += args[2]; y += args[3]; cff_builder_add_point( builder, x, y, 0 ); x += args[4]; y += args[5]; cff_builder_add_point( builder, x, y, 1 ); args += 6; num_curves--; } /* then the final line */ x += args[0]; y += args[1]; cff_builder_add_point( builder, x, y, 1 ); args = stack; } break; case cff_op_hflex1: { FT_Pos start_y; FT_TRACE4(( " hflex1" )); args = stack; /* 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; /* first control point */ x += args[0]; y += args[1]; cff_builder_add_point( builder, x, y, 0 ); /* second control point */ x += args[2]; y += args[3]; cff_builder_add_point( builder, x, y, 0 ); /* join point; on curve, with y-value the same as the last */ /* control point's y-value */ x += args[4]; cff_builder_add_point( builder, x, y, 1 ); /* third control point, with y-value the same as the join */ @@ -1591,42 +1591,42 @@ /* ending point, with y-value the same as the start */ x += args[8]; y = start_y; cff_builder_add_point( builder, x, y, 1 ); args = stack; break; } case cff_op_hflex: { FT_Pos start_y; FT_TRACE4(( " hflex" )); args = stack; /* 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; /* first control point */ x += args[0]; cff_builder_add_point( builder, x, y, 0 ); /* second control point */ x += args[1]; y += args[2]; cff_builder_add_point( builder, x, y, 0 ); /* join point; on curve, with y-value the same as the last */ /* control point's y-value */ x += args[3]; cff_builder_add_point( builder, x, y, 1 ); /* third control point, with y-value the same as the join */ /* point's y-value */ @@ -1644,41 +1644,41 @@ cff_builder_add_point( builder, x, y, 1 ); args = stack; break; } case cff_op_flex1: { FT_Pos start_x, start_y; /* record start x, y values for */ /* alter use */ FT_Fixed dx = 0, dy = 0; /* used in horizontal/vertical */ /* algorithm below */ FT_Int horizontal, count; FT_TRACE4(( " flex1" )); /* 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; start_y = y; /* XXX: figure out whether this is supposed to be a horizontal */ /* or vertical flex; the Type 2 specification is vague... */ args = stack; /* grab up to the last argument */ for ( count = 5; count > 0; count-- ) { dx += args[0]; dy += args[1]; args += 2; } /* rewind */ args = stack; @@ -1707,41 +1707,41 @@ { x = start_x; y += args[0]; } cff_builder_add_point( builder, x, y, 1 ); args = stack; break; } case cff_op_flex: { FT_UInt count; FT_TRACE4(( " flex" )); 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-- ) { x += args[0]; y += args[1]; cff_builder_add_point( builder, x, y, (FT_Bool)( count == 4 || count == 1 ) ); args += 2; } args = stack; } break; case cff_op_endchar: FT_TRACE4(( " endchar" )); /* We are going to emulate the seac operator. */ if ( num_args == 4 ) @@ -2158,56 +2158,54 @@ default: Unimplemented: FT_ERROR(( "Unimplemented opcode: %d", ip[-1] )); if ( ip[-1] == 12 ) FT_ERROR(( " %d", ip[0] )); FT_ERROR(( "\n" )); return CFF_Err_Unimplemented_Feature; } decoder->top = args; } /* general operator processing */ } /* while ip < limit */ FT_TRACE4(( "..end..\n\n" )); + Fail: return error; Syntax_Error: FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error!" )); return CFF_Err_Invalid_File_Format; Stack_Underflow: FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow!" )); return CFF_Err_Too_Few_Arguments; Stack_Overflow: FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow!" )); return CFF_Err_Stack_Overflow; - - Memory_Error: - return builder->error; } /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /********** *********/ /********** *********/ /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/ /********** *********/ /********** The following code is in charge of computing *********/ /********** the maximum advance width of the font. It *********/ /********** quickly processes each glyph charstring to *********/ /********** extract the value from either a `sbw' or `seac' *********/ /********** operator. *********/ /********** *********/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ Index: xc/extras/freetype2/src/cff/cffgload.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffgload.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 cffgload.h --- xc/extras/freetype2/src/cff/cffgload.h 23 Apr 2004 18:42:49 -0000 1.2 +++ xc/extras/freetype2/src/cff/cffgload.h 7 Mar 2005 18:53:49 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* cffgload.h */ /* */ /* 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, */ /* 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 __CFFGLOAD_H__ #define __CFFGLOAD_H__ #include <ft2build.h> #include FT_FREETYPE_H #include "cffobjs.h" @@ -58,77 +58,73 @@ /* scale_x :: The horizontal scale (FUnits to sub-pixels). */ /* */ /* scale_y :: The vertical scale (FUnits to sub-pixels). */ /* */ /* pos_x :: The horizontal translation (if composite glyph). */ /* */ /* pos_y :: The vertical translation (if composite glyph). */ /* */ /* left_bearing :: The left side bearing point. */ /* */ /* advance :: The horizontal advance vector. */ /* */ /* bbox :: Unused. */ /* */ /* path_begun :: A flag which indicates that a new path has begun. */ /* */ /* 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. */ /* */ /* hints_funcs :: Auxiliary pointer for hinting. */ /* */ /* hints_globals :: Auxiliary pointer for hinting. */ /* */ typedef struct CFF_Builder_ { FT_Memory memory; TT_Face face; CFF_GlyphSlot glyph; FT_GlyphLoader loader; FT_Outline* base; FT_Outline* current; FT_Vector last; FT_Fixed scale_x; FT_Fixed scale_y; FT_Pos pos_x; FT_Pos pos_y; FT_Vector left_bearing; FT_Vector advance; FT_BBox bbox; /* bounding box */ FT_Bool path_begun; 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 */ void* hints_globals; /* hinter-specific */ } CFF_Builder; /* execution context charstring zone */ typedef struct CFF_Decoder_Zone_ { FT_Byte* base; FT_Byte* limit; FT_Byte* cursor; } CFF_Decoder_Zone; typedef struct CFF_Decoder_ Index: xc/extras/freetype2/src/cff/cffload.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffload.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 cffload.c --- xc/extras/freetype2/src/cff/cffload.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cff/cffload.c 7 Mar 2005 18:53:50 -0000 @@ -1078,41 +1078,41 @@ } return result; } static FT_Error cff_new_index( CFF_Index idx, FT_Stream stream, FT_Bool load ) { FT_Error error; FT_Memory memory = stream->memory; FT_UShort count; FT_MEM_ZERO( idx, sizeof ( *idx ) ); idx->stream = stream; if ( !FT_READ_USHORT( count ) && - count > 0 ) + count > 0 ) { FT_Byte* p; FT_Byte offsize; FT_ULong data_size; FT_ULong* poff; /* there is at least one element; read the offset size, */ /* then access the offset table to compute the index's total size */ if ( FT_READ_BYTE( offsize ) ) goto Exit; idx->stream = stream; idx->count = count; idx->off_size = offsize; data_size = (FT_ULong)( count + 1 ) * offsize; if ( FT_NEW_ARRAY( idx->offsets, count + 1 ) || FT_FRAME_ENTER( data_size ) ) goto Exit; Index: xc/extras/freetype2/src/cff/cffobjs.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffobjs.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 cffobjs.c --- xc/extras/freetype2/src/cff/cffobjs.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cff/cffobjs.c 7 Mar 2005 18:53:50 -0000 @@ -29,41 +29,41 @@ #include "cffobjs.h" #include "cffload.h" #include "cffcmap.h" #include "cfferrs.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_cffobjs /*************************************************************************/ /* */ /* 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. */ /* */ /*************************************************************************/ #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS static FT_Error sbit_size_reset( CFF_Size size ) { CFF_Face face; FT_Error error = CFF_Err_Ok; FT_ULong strike_index; FT_Size_Metrics* metrics; FT_Size_Metrics* sbit_metrics; SFNT_Service sfnt; metrics = &size->root.metrics; @@ -118,67 +118,71 @@ static PSH_Globals_Funcs cff_size_get_globals_funcs( CFF_Size size ) { CFF_Face face = (CFF_Face)size->root.face; CFF_Font font = (CFF_FontRec *)face->extra.data; PSHinter_Service pshinter = (PSHinter_Service)font->pshinter; FT_Module module; module = FT_Get_Module( size->root.face->driver->root.library, "pshinter" ); return ( module && pshinter && pshinter->get_globals_funcs ) ? pshinter->get_globals_funcs( module ) : 0; } 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 ); 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; CFF_Private cpriv = &subfont->private_dict; PS_PrivateRec priv; /* IMPORTANT: The CFF and Type1 private dictionaries have */ /* slightly different structures; we need to */ /* synthetize a type1 dictionary on the fly here. */ { FT_UInt n, count; FT_MEM_ZERO( &priv, sizeof ( priv ) ); count = priv.num_blue_values = cpriv->num_blue_values; for ( n = 0; n < count; n++ ) priv.blue_values[n] = (FT_Short)cpriv->blue_values[n]; @@ -198,182 +202,205 @@ priv.blue_scale = cpriv->blue_scale; priv.blue_shift = (FT_Int)cpriv->blue_shift; priv.blue_fuzz = (FT_Int)cpriv->blue_fuzz; priv.standard_width[0] = (FT_UShort)cpriv->standard_width; priv.standard_height[0] = (FT_UShort)cpriv->standard_height; count = priv.num_snap_widths = cpriv->num_snap_widths; for ( n = 0; n < count; n++ ) priv.snap_widths[n] = (FT_Short)cpriv->snap_widths[n]; count = priv.num_snap_heights = cpriv->num_snap_heights; for ( n = 0; n < count; n++ ) priv.snap_heights[n] = (FT_Short)cpriv->snap_heights[n]; priv.force_bold = cpriv->force_bold; priv.language_group = cpriv->language_group; 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; } 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 if ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES ) { 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 if ( face->face_flags & FT_FACE_FLAG_SCALABLE ) return CFF_Err_Ok; else return error; } + 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 */ /* */ /*************************************************************************/ 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; if ( pshinter ) { 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 ) { T2_Hints_Funcs funcs; funcs = pshinter->get_t2_funcs( module ); - slot->root.internal->glyph_hints = (void*)funcs; + slot->internal->glyph_hints = (void*)funcs; } } return 0; } /*************************************************************************/ /* */ /* FACE FUNCTIONS */ /* */ /*************************************************************************/ static FT_String* cff_strcpy( FT_Memory memory, const FT_String* source ) { FT_Error error; FT_String* result = 0; FT_Int len = (FT_Int)ft_strlen( source ); if ( !FT_ALLOC( result, len + 1 ) ) { FT_MEM_COPY( result, source, len ); result[len] = 0; } FT_UNUSED( error ); return result; } 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; PSHinter_Service pshinter; 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 ); FT_FACE_FIND_GLOBAL_SERVICE( face, pshinter, POSTSCRIPT_HINTER ); if ( !sfnt ) 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 */ if ( FT_STREAM_SEEK( 0 ) ) goto Exit; /* check whether we have a valid OpenType file */ error = sfnt->init_face( stream, face, face_index, num_params, params ); if ( !error ) { if ( face->format_tag != 0x4F54544FL ) /* `OTTO'; OpenType/CFF font */ { FT_TRACE2(( "[not a valid OpenType/CFF font]\n" )); goto Bad_Format; } /* if we are performing a simple font format check, exit immediately */ if ( face_index < 0 ) return CFF_Err_Ok; @@ -404,351 +431,345 @@ /* FreeType 2 */ } /* now load the CFF part of the file */ error = face->goto_table( face, TTAG_CFF, stream, 0 ); if ( error ) goto Exit; } else { /* rewind to start of file; we are going to load a pure-CFF font */ if ( FT_STREAM_SEEK( 0 ) ) goto Exit; error = CFF_Err_Ok; } /* now load and parse the CFF table in the file */ { CFF_Font cff; CFF_FontRecDict dict; - FT_Memory memory = face->root.memory; - FT_Face root; + FT_Memory memory = cffface->memory; FT_Int32 flags; if ( FT_NEW( cff ) ) goto Exit; face->extra.data = cff; error = cff_font_load( stream, face_index, cff ); if ( error ) goto Exit; cff->pshinter = pshinter; cff->psnames = (void*)psnames; /* Complement the root flags with some interesting information. */ /* Note that this is only necessary for pure CFF and CEF fonts. */ - root = &face->root; - root->num_glyphs = cff->num_glyphs; + cffface->num_glyphs = cff->num_glyphs; dict = &cff->top_font.font_dict; /* we need the `PSNames' module for CFF and CEF formats */ /* which aren't CID-keyed */ if ( dict->cid_registry == 0xFFFFU && !psnames ) { FT_ERROR(( "cff_face_init:" )); FT_ERROR(( " cannot open CFF & CEF fonts\n" )); FT_ERROR(( " " )); FT_ERROR(( " without the `PSNames' module\n" )); goto Bad_Format; } if ( pure_cff ) { char* style_name = NULL; /* Set up num_faces. */ - root->num_faces = cff->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; - - 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->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; + + 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; + cffface->units_per_EM = dict->units_per_em; else - root->units_per_EM = 1000; + cffface->units_per_EM = 1000; - root->underline_position = + 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; - /* we're going to try to extract the style name from the - * full name. We need to ignore spaces and dashes during - * the search. - */ + /* We try to extract the style name from the full name. */ + /* We need to ignore spaces and dashes during the search. */ if ( full ) { while ( *fullp ) { - /* skip common characters at the start of both strings - */ + /* skip common characters at the start of both strings */ if ( *fullp == *family ) { family++; fullp++; 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++; continue; } 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 - */ + /* Rhe 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; } FT_FREE( full ); } } else { char *cid_font_name = cff_index_get_sid_string( &cff->string_index, dict->cid_font_name, psnames ); /* 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" ); /*******************************************************************/ /* */ /* Compute face flags. */ /* */ flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */ FT_FACE_FLAG_HORIZONTAL; /* horizontal data */ if ( sfnt_format ) flags |= FT_FACE_FLAG_SFNT; /* fixed width font? */ if ( dict->is_fixed_pitch ) flags |= FT_FACE_FLAG_FIXED_WIDTH; /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */ #if 0 /* kerning available? */ if ( face->kern_pairs ) flags |= FT_FACE_FLAG_KERNING; #endif - root->face_flags = flags; + cffface->face_flags = flags; /*******************************************************************/ /* */ /* Compute style flags. */ /* */ flags = 0; if ( dict->italic_angle ) flags |= FT_STYLE_FLAG_ITALIC; { char *weight = cff_index_get_sid_string( &cff->string_index, dict->weight, psnames ); if ( weight ) if ( !ft_strcmp( weight, "Bold" ) || !ft_strcmp( weight, "Black" ) ) flags |= FT_STYLE_FLAG_BOLD; FT_FREE( weight ); } - root->style_flags = flags; + cffface->style_flags = flags; } #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 /*******************************************************************/ /* */ /* Compute char maps. */ /* */ /* Try to synthetize a Unicode charmap if there is none available */ /* already. If an OpenType font contains a Unicode "cmap", we */ /* will use it, whatever be in the CFF part of the file. */ { FT_CharMapRec cmaprec; FT_CharMap cmap; FT_UInt nn; 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 ) goto Skip_Unicode; /* Deprecated Unicode platform id? */ if ( cmap->platform_id == 0 ) goto Skip_Unicode; /* Standard Unicode (deprecated) */ } /* since CID-keyed fonts don't contain glyph names, we can't */ /* construct a cmap */ if ( pure_cff && cff->top_font.font_dict.cid_registry != 0xFFFFU ) 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 ) { FT_CMap_Class clazz; - cmaprec.face = root; + cmaprec.face = cffface; cmaprec.platform_id = 7; /* Adobe platform id */ if ( encoding->offset == 0 ) { cmaprec.encoding_id = TT_ADOBE_ID_STANDARD; cmaprec.encoding = FT_ENCODING_ADOBE_STANDARD; clazz = &cff_cmap_encoding_class_rec; } else if ( encoding->offset == 1 ) { cmaprec.encoding_id = TT_ADOBE_ID_EXPERT; cmaprec.encoding = FT_ENCODING_ADOBE_EXPERT; clazz = &cff_cmap_encoding_class_rec; } else { cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM; cmaprec.encoding = FT_ENCODING_ADOBE_CUSTOM; clazz = &cff_cmap_encoding_class_rec; } FT_CMap_New( clazz, NULL, &cmaprec, NULL ); } } } Exit: return error; Bad_Format: error = CFF_Err_Unknown_File_Format; goto Exit; } 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; if ( sfnt ) sfnt->done_face( face ); { CFF_Font cff = (CFF_Font)face->extra.data; if ( cff ) { cff_font_done( cff ); FT_FREE( face->extra.data ); } } } 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 ); } /* END */ Index: xc/extras/freetype2/src/cff/cffobjs.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffobjs.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 cffobjs.h --- xc/extras/freetype2/src/cff/cffobjs.h 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cff/cffobjs.h 7 Mar 2005 18:53:50 -0000 @@ -96,67 +96,76 @@ FT_Fixed xx, xy; /* transformation matrix coefficients */ FT_Fixed yx, yy; FT_F26Dot6 ox, oy; /* offsets */ } CFF_Transform; /***********************************************************************/ /* */ /* TrueType driver class. */ /* */ typedef struct CFF_DriverRec_ { FT_DriverRec root; void* extension_component; } CFF_DriverRec; 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 ); /*************************************************************************/ /* */ /* Face functions */ /* */ 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 */ /*************************************************************************/ /* */ /* 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 #endif /* __CFFOBJS_H__ */ /* END */ Index: xc/extras/freetype2/src/cff/cffparse.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cff/cffparse.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 cffparse.c --- xc/extras/freetype2/src/cff/cffparse.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cff/cffparse.c 7 Mar 2005 18:53:51 -0000 @@ -573,86 +573,86 @@ goto Stack_Underflow; switch ( field->kind ) { case cff_kind_bool: case cff_kind_string: case cff_kind_num: val = cff_parse_num( parser->stack ); goto Store_Number; case cff_kind_fixed: val = cff_parse_fixed( parser->stack ); goto Store_Number; case cff_kind_fixed_thousand: val = cff_parse_fixed_thousand( parser->stack ); 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; case cff_kind_delta: { FT_Byte* qcount = (FT_Byte*)parser->object + field->count_offset; FT_Byte** data = parser->stack; if ( num_args > field->array_max ) num_args = field->array_max; /* store count */ *qcount = (FT_Byte)num_args; val = 0; while ( num_args > 0 ) { 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; default: /* for 64-bit systems */ *(FT_Long*)q = val; } q += field->size; num_args--; } } break; default: /* callback */ error = field->reader( parser ); if ( error ) goto Exit; } goto Found; } Index: xc/extras/freetype2/src/cid/cidgload.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cid/cidgload.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 cidgload.c --- xc/extras/freetype2/src/cid/cidgload.c 28 Apr 2004 10:39:04 -0000 1.3 +++ xc/extras/freetype2/src/cid/cidgload.c 7 Mar 2005 18:53:51 -0000 @@ -252,195 +252,198 @@ #endif /* 0 */ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /********** *********/ /********** *********/ /********** UNHINTED GLYPH LOADER *********/ /********** *********/ /********** The following code is in charge of loading a *********/ /********** single outline. It completely ignores hinting *********/ /********** and is used when FT_LOAD_NO_HINTING is set. *********/ /********** *********/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ 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; FT_Matrix font_matrix; FT_Vector font_offset; 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, FT_LOAD_TARGET_MODE( load_flags ), cid_load_glyph ); /* set up the decoder */ decoder.builder.no_recurse = FT_BOOL( ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) ); error = cid_load_glyph( &decoder, glyph_index ); font_matrix = decoder.font_matrix; font_offset = decoder.font_offset; /* save new glyph tables */ psaux->t1_decoder_funcs->done( &decoder ); } /* now, set the metrics -- this is rather simple, as */ /* the left side bearing is the xMin, and the top side */ /* 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; internal->glyph_transformed = 1; } 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 ); advance.x = metrics->horiAdvance; advance.y = 0; FT_Vector_Transform( &advance, &font_matrix ); metrics->horiAdvance = advance.x + font_offset.x; advance.x = 0; advance.y = metrics->vertAdvance; FT_Vector_Transform( &advance, &font_matrix ); metrics->vertAdvance = advance.y + font_offset.y; if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) { /* scale the outline and the metrics */ FT_Int n; FT_Outline* cur = decoder.builder.base; FT_Vector* vec = cur->points; FT_Fixed x_scale = glyph->x_scale; FT_Fixed y_scale = glyph->y_scale; /* First of all, scale the points */ if ( !hinting ) for ( n = cur->n_points; n > 0; n--, vec++ ) { vec->x = FT_MulFix( vec->x, x_scale ); 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 ); metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale ); metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale ); metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale ); if ( hinting ) { metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance ); metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance ); metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX ); metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY ); } } /* 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 ) { cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); cbox.xMax = FT_PIX_CEIL( cbox.xMax ); cbox.yMax = FT_PIX_CEIL( cbox.yMax ); } metrics->width = cbox.xMax - cbox.xMin; metrics->height = cbox.yMax - cbox.yMin; metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; } } + return error; } /* END */ Index: xc/extras/freetype2/src/cid/cidgload.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cid/cidgload.h,v retrieving revision 1.1.1.2 diff -u -2 -0 -r1.1.1.2 cidgload.h --- xc/extras/freetype2/src/cid/cidgload.h 25 Nov 2003 19:27:19 -0000 1.1.1.2 +++ xc/extras/freetype2/src/cid/cidgload.h 7 Mar 2005 18:53:51 -0000 @@ -1,51 +1,51 @@ /***************************************************************************/ /* */ /* cidgload.h */ /* */ /* 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, */ /* 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 __CIDGLOAD_H__ #define __CIDGLOAD_H__ #include <ft2build.h> #include "cidobjs.h" FT_BEGIN_HEADER #if 0 /* Compute the maximum advance width of a font through quick parsing */ FT_LOCAL( FT_Error ) cid_face_compute_max_advance( CID_Face face, FT_Int* max_advance ); #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 #endif /* __CIDGLOAD_H__ */ /* END */ Index: xc/extras/freetype2/src/cid/cidobjs.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cid/cidobjs.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 cidobjs.c --- xc/extras/freetype2/src/cid/cidobjs.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/cid/cidobjs.c 7 Mar 2005 18:53:51 -0000 @@ -30,275 +30,303 @@ #include "ciderrs.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_cidobjs /*************************************************************************/ /* */ /* SLOT FUNCTIONS */ /* */ /*************************************************************************/ 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 ) { 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 ) { T1_Hints_Funcs funcs; funcs = pshinter->get_t1_funcs( module ); - slot->root.internal->glyph_hints = (void*)funcs; + slot->internal->glyph_hints = (void*)funcs; } } return 0; } /*************************************************************************/ /* */ /* SIZE FUNCTIONS */ /* */ /*************************************************************************/ static PSH_Globals_Funcs cid_size_get_globals_funcs( CID_Size size ) { CID_Face face = (CID_Face)size->root.face; PSHinter_Service pshinter = (PSHinter_Service)face->pshinter; FT_Module module; module = FT_Get_Module( size->root.face->driver->root.library, "pshinter" ); return ( module && pshinter && pshinter->get_globals_funcs ) ? pshinter->get_globals_funcs( module ) : 0; } 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 ); 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; } 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 */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* cid_face_done */ /* */ /* <Description> */ /* Finalizes a given face object. */ /* */ /* <Input> */ /* 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; if ( face ) { CID_FaceInfo cid = &face->cid; PS_FontInfo info = &cid->font_info; - memory = face->root.memory; + memory = cidface->memory; /* release subrs */ if ( face->subrs ) { FT_Int n; for ( n = 0; n < cid->num_dicts; n++ ) { CID_Subrs subr = face->subrs + n; if ( subr->code ) { FT_FREE( subr->code[0] ); FT_FREE( subr->code ); } } FT_FREE( face->subrs ); } /* release FontInfo strings */ FT_FREE( info->version ); FT_FREE( info->notice ); FT_FREE( info->full_name ); FT_FREE( info->family_name ); FT_FREE( info->weight ); /* release font dictionaries */ FT_FREE( cid->font_dicts ); cid->num_dicts = 0; /* release other strings */ FT_FREE( cid->cid_font_name ); 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 ); } } /*************************************************************************/ /* */ /* <Function> */ /* cid_face_init */ /* */ /* <Description> */ /* Initializes a given CID face object. */ /* */ /* <Input> */ /* stream :: The source font stream. */ /* */ /* face_index :: The index of the font face in the resource. */ /* */ /* num_params :: Number of additional generic parameters. Ignored. */ /* */ /* params :: Additional generic parameters. Ignored. */ /* */ /* <InOut> */ /* face :: The newly built face object. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ 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 ) { + CID_Face face = (CID_Face)cidface; FT_Error error; FT_Service_PsCMaps psnames; PSAux_Service psaux; PSHinter_Service pshinter; FT_UNUSED( num_params ); FT_UNUSED( params ); FT_UNUSED( stream ); - face->root.num_faces = 1; + cidface->num_faces = 1; FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); psaux = (PSAux_Service)face->psaux; if ( !psaux ) { psaux = (PSAux_Service)FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); face->psaux = psaux; } pshinter = (PSHinter_Service)face->pshinter; if ( !pshinter ) { pshinter = (PSHinter_Service)FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "pshinter" ); face->pshinter = pshinter; } @@ -312,163 +340,162 @@ goto Exit; /* if we just wanted to check the format, leave successfully now */ if ( face_index < 0 ) goto Exit; /* check the face index */ if ( face_index != 0 ) { FT_ERROR(( "cid_face_init: invalid face index\n" )); error = CID_Err_Invalid_Argument; goto Exit; } /* now load the font program into the face object */ /* initialize the face object fields */ /* 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 ) { while ( *full ) { if ( *full == *family ) { family++; full++; } else { if ( *full == ' ' || *full == '-' ) full++; else if ( *family == ' ' || *family == '-' ) family++; else { if ( !*family ) - root->style_name = full; + cidface->style_name = full; break; } } } } } else { /* 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; - - if ( !root->units_per_EM ) - root->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->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 ( !cidface->units_per_EM ) + cidface->units_per_EM = 1000; + + 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: return error; } /*************************************************************************/ /* */ /* <Function> */ /* cid_driver_init */ /* */ /* <Description> */ /* Initializes a given CID driver object. */ /* */ /* <Input> */ /* driver :: A handle to the target driver object. */ /* */ /* <Return> */ /* 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 ); return CID_Err_Ok; } /*************************************************************************/ /* */ /* <Function> */ /* cid_driver_done */ /* */ /* <Description> */ /* Finalizes a given CID driver. */ /* */ /* <Input> */ /* 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 ); } /* END */ Index: xc/extras/freetype2/src/cid/cidobjs.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cid/cidobjs.h,v retrieving revision 1.1.1.2 diff -u -2 -0 -r1.1.1.2 cidobjs.h --- xc/extras/freetype2/src/cid/cidobjs.h 25 Nov 2003 19:27:19 -0000 1.1.1.2 +++ xc/extras/freetype2/src/cid/cidobjs.h 7 Mar 2005 18:53:51 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* cidobjs.h */ /* */ /* 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, */ /* 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 __CIDOBJS_H__ #define __CIDOBJS_H__ #include <ft2build.h> #include FT_INTERNAL_OBJECTS_H #include FT_CONFIG_CONFIG_H #include FT_INTERNAL_TYPE1_TYPES_H @@ -95,64 +95,69 @@ FT_SizeRec root; FT_Bool valid; } CID_SizeRec; typedef struct CID_GlyphSlotRec_ { FT_GlyphSlotRec root; FT_Bool hint; FT_Bool scaled; FT_Fixed x_scale; FT_Fixed y_scale; } CID_GlyphSlotRec; 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( FT_Size size, /* CID_Size */ + FT_UInt char_width, + FT_UInt char_height ); FT_LOCAL( FT_Error ) - cid_size_reset( CID_Size size ); + 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 #endif /* __CIDOBJS_H__ */ /* END */ Index: xc/extras/freetype2/src/cid/cidriver.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/cid/cidriver.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 cidriver.c --- xc/extras/freetype2/src/cid/cidriver.c 23 Apr 2004 18:42:49 -0000 1.2 +++ xc/extras/freetype2/src/cid/cidriver.c 7 Mar 2005 18:53:51 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* cidriver.c */ /* */ /* 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, */ /* 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 "cidriver.h" #include "cidgload.h" #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include "ciderrs.h" #include FT_SERVICE_POSTSCRIPT_NAME_H @@ -80,79 +80,78 @@ { (PS_GetFontInfoFunc) cid_ps_get_font_info, (PS_HasGlyphNamesFunc)NULL /* unsupported with CID fonts */ }; /* * SERVICE LIST * */ static const FT_ServiceDescRec cid_services[] = { { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name }, { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CID }, { FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info }, { NULL, NULL } }; - 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 ); } FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec t1cid_driver_class = { /* first of all, the FT_Module_Class fields */ { FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, sizeof( FT_DriverRec ), "t1cid", /* module name */ 0x10000L, /* version 1.0 of driver */ 0x20000L, /* requires FreeType 2.0 */ 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 */ sizeof( CID_FaceRec ), 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 */ }; /* END */ Index: xc/extras/freetype2/src/gzip/ftgzip.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/gzip/ftgzip.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ftgzip.c --- xc/extras/freetype2/src/gzip/ftgzip.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/gzip/ftgzip.c 7 Mar 2005 18:53:52 -0000 @@ -548,41 +548,41 @@ { FT_GZipFile zip = (FT_GZipFile)stream->descriptor.pointer; return ft_gzip_file_io( zip, pos, buffer, count ); } FT_EXPORT_DEF( FT_Error ) FT_Stream_OpenGzip( FT_Stream stream, FT_Stream source ) { FT_Error error; FT_Memory memory = source->memory; FT_GZipFile zip; FT_ZERO( stream ); stream->memory = memory; - if ( !FT_NEW( zip ) ) + if ( !FT_QNEW( zip ) ) { error = ft_gzip_file_init( zip, stream, source ); if ( error ) { FT_FREE( zip ); goto Exit; } stream->descriptor.pointer = zip; } stream->size = 0x7FFFFFFFL; /* don't know the real size! */ stream->pos = 0; stream->base = 0; stream->read = ft_gzip_stream_io; stream->close = ft_gzip_stream_close; Exit: return error; } Index: xc/extras/freetype2/src/lzw/zopen.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/lzw/zopen.c,v retrieving revision 1.1 diff -u -2 -0 -r1.1 zopen.c --- xc/extras/freetype2/src/lzw/zopen.c 28 Apr 2004 10:39:05 -0000 1.1 +++ xc/extras/freetype2/src/lzw/zopen.c 7 Mar 2005 18:53:52 -0000 @@ -49,44 +49,48 @@ static char rcsid[] = "$NetBSD: zopen.c,v 1.8 2003/08/07 11:13:29 agc Exp $"; #endif #endif /* LIBC_SCCS and not lint */ /*- * fcompress.c - File compression ala IEEE Computer, June 1984. * * Compress authors: * Spencer W. Thomas (decvax!utah-cs!thomas) * Jim McKie (decvax!mcvax!jim) * Steve Davies (decvax!vax135!petsd!peora!srd) * Ken Turkowski (decvax!decwrl!turtlevax!ken) * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) * * Cleaned up and converted to library returning I/O streams by * Diomidis Spinellis <dds@doc.ic.ac.uk>. */ #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[] = { 0x1f, 0x9d }; /* 1F 9D */ #endif #define BIT_MASK 0x1f /* Defines for third byte of header. */ #define BLOCK_MASK 0x80 /* * Masks 0x40 and 0x20 are free. I think 0x20 should mean that there is * a fourth header byte (for expansion). */ #define INIT_BITS 9 /* Initial number of bits/code. */ #define MAXCODE(n_bits) ((1 << (n_bits)) - 1) /* Definitions to retain old variable names */ #define fp zs->zs_fp #define state zs->zs_state Index: xc/extras/freetype2/src/pcf/pcfdrivr.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcfdrivr.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 pcfdrivr.c --- xc/extras/freetype2/src/pcf/pcfdrivr.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/pcf/pcfdrivr.c 7 Mar 2005 18:53:52 -0000 @@ -23,384 +23,414 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <ft2build.h> #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_OBJECTS_H #include FT_GZIP_H #include FT_LZW_H #include FT_ERRORS_H #include FT_BDF_H #include "pcf.h" #include "pcfdrivr.h" #include "pcfread.h" #include "pcferror.h" +#include "pcfutil.h" #undef FT_COMPONENT #define FT_COMPONENT trace_pcfread #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; } PCF_CMapRec, *PCF_CMap; 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; cmap->encodings = face->encodings; return PCF_Err_Ok; } 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; max = cmap->num_encodings; while ( min < max ) { FT_UInt32 code; mid = ( min + max ) >> 1; code = encodings[mid].enc; if ( charcode == code ) { result = encodings[mid].glyph + 1; break; } if ( charcode < code ) max = mid; else min = mid + 1; } return result; } 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; max = cmap->num_encodings; while ( min < max ) { FT_UInt32 code; mid = ( min + max ) >> 1; code = encodings[mid].enc; if ( charcode == code ) { result = encodings[mid].glyph + 1; goto Exit; } if ( charcode < code ) max = mid; else min = mid + 1; } charcode = 0; if ( min < cmap->num_encodings ) { charcode = encodings[min].enc; result = encodings[min].glyph + 1; } Exit: *acharcode = charcode; return result; } - 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 ); FT_FREE( face->encodings ); FT_FREE( face->metrics ); /* free properties */ { PCF_Property prop = face->properties; FT_Int i; for ( i = 0; i < face->nprops; i++ ) { prop = &face->properties[i]; FT_FREE( prop->name ); if ( prop->isString ) FT_FREE( prop->value ); } FT_FREE( face->properties ); } 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->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 ); FT_UNUSED( params ); FT_UNUSED( face_index ); error = pcf_load_font( stream, face ); if ( error ) { FT_Error error2; /* this didn't work, try gzip support! */ error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream ); if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature ) goto Fail; error = error2; if ( error ) { FT_Error error3; /* this didn't work, try LZW support! */ error3 = FT_Stream_OpenLZW( &face->gzip_stream, stream ); if ( FT_ERROR_BASE( error3 ) == FT_Err_Unimplemented_Feature ) goto Fail; error = error3; if ( error ) 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 ) goto Fail; } 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 ) goto Fail; } } - /* 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 on locales. */ if ( ( s[0] == 'i' || s[0] == 'I' ) && ( s[1] == 's' || s[1] == 'S' ) && ( s[2] == 'o' || s[2] == 'O' ) ) { s += 3; if ( !ft_strcmp( s, "10646" ) || ( !ft_strcmp( s, "8859" ) && !ft_strcmp( face->charset_encoding, "1" ) ) ) unicode_charmap = 1; } } { FT_CharMapRec charmap; charmap.face = FT_FACE( face ); charmap.encoding = FT_ENCODING_NONE; charmap.platform_id = 0; charmap.encoding_id = 0; if ( unicode_charmap ) { charmap.encoding = FT_ENCODING_UNICODE; charmap.platform_id = 3; charmap.encoding_id = 1; } error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL ); #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 } } Exit: return error; Fail: FT_TRACE2(( "[not a valid PCF file]\n" )); error = PCF_Err_Unknown_File_Format; /* error */ goto Exit; } - 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_UNUSED( pixel_height ); 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 ) { 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(( "size WRONG\n" )); return PCF_Err_Invalid_Pixel_Size; } } - static FT_Error + 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 ) + { + FT_UNUSED( char_width ); + FT_UNUSED( char_height ); + FT_UNUSED( horz_resolution ); + FT_UNUSED( vert_resolution ); + + return PCF_Set_Pixel_Size( size, 0, 0 ); + } + + + FT_CALLBACK_DEF( FT_Error ) PCF_Glyph_Load( FT_GlyphSlot slot, FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags ) { PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); FT_Stream stream = face->root.stream; FT_Error error = PCF_Err_Ok; FT_Bitmap* bitmap = &slot->bitmap; PCF_Metric metric; int bytes; FT_UNUSED( load_flags ); FT_TRACE4(( "load_glyph %d ---", glyph_index )); if ( !face ) { error = PCF_Err_Invalid_Argument; @@ -550,72 +580,72 @@ { (FT_BDF_GetCharsetIdFunc)pcf_get_charset_id, (FT_BDF_GetPropertyFunc) pcf_get_bdf_property }; /* * * SERVICE LIST * */ static const FT_ServiceDescRec pcf_services[] = { { FT_SERVICE_ID_BDF, &pcf_service_bdf }, { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PCF }, { NULL, NULL } }; - static FT_Module_Interface + FT_CALLBACK_DEF( FT_Module_Interface ) pcf_driver_requester( FT_Module module, const char* name ) { FT_UNUSED( module ); return ft_service_list_lookup( pcf_services, name ); } FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec pcf_driver_class = { { FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_NO_OUTLINES, sizeof ( FT_DriverRec ), "pcf", 0x10000L, 0x20000L, 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 ), - - (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, - - (FT_Size_ResetPointsFunc) PCF_Set_Pixel_Size, - (FT_Size_ResetPixelsFunc) PCF_Set_Pixel_Size, - - (FT_Slot_LoadFunc) PCF_Glyph_Load, - - (FT_Face_GetKerningFunc) 0, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc) 0 + sizeof ( PCF_FaceRec ), + sizeof ( FT_SizeRec ), + sizeof ( FT_GlyphSlotRec ), + + PCF_Face_Init, + PCF_Face_Done, + 0, /* FT_Size_InitFunc */ + 0, /* FT_Size_DoneFunc */ + 0, /* FT_Slot_InitFunc */ + 0, /* FT_Slot_DoneFunc */ + + PCF_Set_Point_Size, + PCF_Set_Pixel_Size, + + PCF_Glyph_Load, + + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ + 0 /* FT_Face_GetAdvancesFunc */ }; /* END */ Index: xc/extras/freetype2/src/pcf/pcfread.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcfread.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 pcfread.c --- xc/extras/freetype2/src/pcf/pcfread.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/pcf/pcfread.c 7 Mar 2005 18:53:53 -0000 @@ -105,54 +105,57 @@ return PCF_Err_Invalid_File_Format; if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) ) return PCF_Err_Out_Of_Memory; tables = face->toc.tables; for ( n = 0; n < toc->count; n++ ) { if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) ) goto Exit; tables++; } #if defined( FT_DEBUG_LEVEL_TRACE ) { FT_UInt i, j; 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++ ) { for( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] ); j++ ) 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 )); } } #endif return PCF_Err_Ok; Exit: FT_FREE( face->toc.tables ); return error; } static const FT_Frame_Field pcf_metric_header[] = { #undef FT_STRUCTURE #define FT_STRUCTURE PCF_MetricRec FT_FRAME_START( 12 ), @@ -353,120 +356,130 @@ FT_Int nprops, i; FT_ULong format, size; FT_Error error; FT_Memory memory = FT_FACE(face)->memory; FT_ULong string_size; FT_String* strings = 0; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_PROPERTIES, &format, &size ); if ( error ) goto Bail; 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; if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( nprops ); else (void)FT_READ_ULONG_LE( nprops ); 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; for ( i = 0; i < nprops; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) { if ( FT_STREAM_READ_FIELDS( pcf_property_msb_header, props + i ) ) goto Bail; } else { if ( FT_STREAM_READ_FIELDS( pcf_property_header, props + i ) ) goto Bail; } } /* pad the property array */ /* */ /* clever here - nprops is the same as the number of odd-units read, */ /* as only isStringProp are odd length (Keith Packard) */ /* */ if ( nprops & 3 ) { i = 4 - ( nprops & 3 ); FT_Stream_Skip( stream, i ); } if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( string_size ); else (void)FT_READ_ULONG_LE( string_size ); 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; error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size ); if ( error ) goto Bail; if ( FT_NEW_ARRAY( properties, nprops ) ) goto Bail; for ( i = 0; i < nprops; i++ ) { /* XXX: make atom */ 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; if ( props[i].isString ) { if ( FT_NEW_ARRAY( properties[i].value.atom, 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; face->nprops = nprops; FT_FREE( props ); FT_FREE( strings ); return PCF_Err_Ok; Bail: FT_FREE( props ); FT_FREE( strings ); return error; } static FT_Error pcf_get_metrics( FT_Stream stream, @@ -501,48 +514,50 @@ if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( nmetrics ); else (void)FT_READ_ULONG_LE( nmetrics ); } else { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_USHORT( nmetrics ); else (void)FT_READ_USHORT_LE( nmetrics ); } if ( error || nmetrics == -1 ) return PCF_Err_Invalid_File_Format; face->nmetrics = nmetrics; 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++ ) { pcf_get_metric( stream, format, metrics + i ); 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, ( metrics + i )->leftSideBearing, ( metrics + i )->rightSideBearing, ( metrics + i )->ascent, ( metrics + i )->descent, ( metrics + i )->attributes )); if ( error ) break; } if ( error ) FT_FREE( face->metrics ); return error; } static FT_Error @@ -571,94 +586,97 @@ if ( error ) return error; format = FT_GET_ULONG_LE(); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) nbitmaps = FT_GET_ULONG(); else nbitmaps = FT_GET_ULONG_LE(); FT_Stream_ExitFrame( stream ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return PCF_Err_Invalid_File_Format; if ( nbitmaps != face->nmetrics ) return PCF_Err_Invalid_File_Format; 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 ) (void)FT_READ_LONG( offsets[i] ); 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; for ( i = 0; i < GLYPHPADOPTIONS; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_LONG( bitmapSizes[i] ); else (void)FT_READ_LONG_LE( bitmapSizes[i] ); if ( error ) goto Bail; 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 */ for ( i = 0; i < nbitmaps; i++ ) face->metrics[i].bits = stream->pos + offsets[i]; face->bitmapsFormat = format; FT_FREE ( offsets ); return error; Bail: FT_FREE ( offsets ); FT_FREE ( bitmaps ); return error; } static FT_Error 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; int nencoding, encodingOffset; int i, j; PCF_Encoding tmpEncoding, encoding = 0; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_BDF_ENCODINGS, &format, &size ); if ( error ) return error; error = FT_Stream_EnterFrame( stream, 14 ); if ( error ) return error; @@ -670,72 +688,76 @@ firstCol = FT_GET_SHORT(); lastCol = FT_GET_SHORT(); firstRow = FT_GET_SHORT(); lastRow = FT_GET_SHORT(); face->defaultChar = FT_GET_SHORT(); } else { firstCol = FT_GET_SHORT_LE(); lastCol = FT_GET_SHORT_LE(); firstRow = FT_GET_SHORT_LE(); lastRow = FT_GET_SHORT_LE(); face->defaultChar = FT_GET_SHORT_LE(); } FT_Stream_ExitFrame( stream ); 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 ); if ( FT_NEW_ARRAY( tmpEncoding, nencoding ) ) return PCF_Err_Out_Of_Memory; error = FT_Stream_EnterFrame( stream, 2 * nencoding ); if ( error ) goto Bail; for ( i = 0, j = 0 ; i < nencoding; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) encodingOffset = FT_GET_SHORT(); else encodingOffset = FT_GET_SHORT_LE(); if ( encodingOffset != -1 ) { tmpEncoding[j].enc = ( ( ( i / ( lastCol - firstCol + 1 ) ) + firstRow ) * 256 ) + ( ( i % ( lastCol - firstCol + 1 ) ) + 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 ); if ( FT_NEW_ARRAY( encoding, j ) ) goto Bail; for ( i = 0; i < j; i++ ) { encoding[i].enc = tmpEncoding[i].enc; encoding[i].glyph = tmpEncoding[i].glyph; } face->nencodings = j; face->encodings = encoding; FT_FREE( tmpEncoding ); return error; Bail: FT_FREE( encoding ); Index: xc/extras/freetype2/src/pcf/pcfutil.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcfutil.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 pcfutil.c --- xc/extras/freetype2/src/pcf/pcfutil.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/pcf/pcfutil.c 7 Mar 2005 18:53:53 -0000 @@ -57,76 +57,76 @@ 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]; } /* * 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 ) { c = buf[0]; buf[0] = buf[1]; buf[1] = c; } } /* * 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 ) { c = buf[0]; buf[0] = buf[3]; buf[3] = c; c = buf[1]; buf[1] = buf[2]; buf[2] = c; } } /* END */ Index: xc/extras/freetype2/src/pcf/pcfutil.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/pcf/pcfutil.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 pcfutil.h --- xc/extras/freetype2/src/pcf/pcfutil.h 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/pcf/pcfutil.h 7 Mar 2005 18:53:53 -0000 @@ -13,39 +13,43 @@ furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __PCFUTIL_H__ #define __PCFUTIL_H__ #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__ */ /* END */ Index: xc/extras/freetype2/src/pfr/pfrdrivr.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/pfr/pfrdrivr.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 pfrdrivr.c --- xc/extras/freetype2/src/pfr/pfrdrivr.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/pfr/pfrdrivr.c 7 Mar 2005 18:53:53 -0000 @@ -1,200 +1,203 @@ /***************************************************************************/ /* */ /* pfrdrivr.c */ /* */ /* 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, */ /* 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_SERVICE_PFR_H #include FT_SERVICE_XFREE86_NAME_H #include "pfrdrivr.h" #include "pfrobjs.h" #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 ) { if ( avector->x != 0 ) avector->x = FT_MulDiv( avector->x, phys->outline_resolution, phys->metrics_resolution ); if ( avector->y != 0 ) avector->y = FT_MulDiv( avector->x, phys->outline_resolution, phys->metrics_resolution ); } return PFR_Err_Ok; } /* * PFR METRICS SERVICE * */ - 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; *anadvance = 0; if ( face ) { PFR_PhyFont phys = &face->phy_font; if ( gindex < phys->num_chars ) { *anadvance = phys->chars[gindex].advance; error = 0; } } return error; } - 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; if ( anoutline_resolution ) *anoutline_resolution = phys->outline_resolution; if ( ametrics_resolution ) *ametrics_resolution = phys->metrics_resolution; x_scale = 0x10000L; y_scale = 0x10000L; if ( size ) { x_scale = FT_DivFix( size->metrics.x_ppem << 6, phys->metrics_resolution ); y_scale = FT_DivFix( size->metrics.y_ppem << 6, phys->metrics_resolution ); } if ( ametrics_x_scale ) *ametrics_x_scale = x_scale; if ( ametrics_y_scale ) *ametrics_y_scale = y_scale; return PFR_Err_Ok; } 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 }; /* * SERVICE LIST * */ static const FT_ServiceDescRec pfr_services[] = { { FT_SERVICE_ID_PFR_METRICS, &pfr_metrics_service_rec }, { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_PFR }, { NULL, NULL } }; - 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 ); } FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec pfr_driver_class = { { FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE, sizeof( FT_DriverRec ), "pfr", 0x10000L, 0x20000L, 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, - - (FT_Size_ResetPointsFunc)NULL, - (FT_Size_ResetPixelsFunc)NULL, - (FT_Slot_LoadFunc) pfr_slot_load, - - (FT_Face_GetKerningFunc) pfr_get_kerning, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc)0 + pfr_face_init, + pfr_face_done, + 0, /* FT_Size_InitFunc */ + 0, /* FT_Size_DoneFunc */ + pfr_slot_init, + pfr_slot_done, + + 0, /* FT_Size_ResetPointsFunc */ + 0, /* FT_Size_ResetPixelsFunc */ + pfr_slot_load, + + pfr_get_kerning, + 0, /* FT_Face_AttachFunc */ + 0 /* FT_Face_GetAdvancesFunc */ }; /* END */ Index: xc/extras/freetype2/src/pfr/pfrobjs.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/pfr/pfrobjs.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 pfrobjs.c --- xc/extras/freetype2/src/pfr/pfrobjs.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/pfr/pfrobjs.c 7 Mar 2005 18:53:53 -0000 @@ -1,456 +1,465 @@ /***************************************************************************/ /* */ /* pfrobjs.c */ /* */ /* FreeType PFR object methods (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, */ /* 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 "pfrobjs.h" #include "pfrload.h" #include "pfrgload.h" #include "pfrcmap.h" #include "pfrsbit.h" #include FT_OUTLINE_H #include FT_INTERNAL_DEBUG_H #include "pfrerror.h" #undef FT_COMPONENT #define FT_COMPONENT trace_pfr /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** FACE OBJECT METHODS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ 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 ); FT_UNUSED( params ); /* load the header and check it */ error = pfr_header_load( &face->header, stream ); if ( error ) goto Exit; if ( !pfr_header_check( &face->header ) ) { FT_TRACE4(( "pfr_face_init: not a valid PFR font\n" )); error = PFR_Err_Unknown_File_Format; goto Exit; } /* check face index */ { FT_UInt num_faces; error = pfr_log_font_count( stream, face->header.log_dir_offset, &num_faces ); 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; goto Exit; } /* load the face */ error = pfr_log_font_load( &face->log_font, stream, face_index, face->header.log_dir_offset, FT_BOOL( face->header.phy_font_max_size_high != 0 ) ); if ( error ) goto Exit; /* now load the physical font descriptor */ error = pfr_phy_font_load( &face->phy_font, stream, face->log_font.phys_offset, face->log_font.phys_size ); if ( error ) goto Exit; /* 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; + FT_Memory memory = pfrface->stream->memory; - if ( FT_NEW_ARRAY( root->available_sizes, count ) ) + 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; FT_UInt count = phy_font->num_chars; PFR_Char gchar = phy_font->chars; for ( ; count > 0; count--, gchar++ ) { if ( max < gchar->advance ) 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; FT_CMap_New( &pfr_cmap_class_rec, NULL, &charmap, NULL ); #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: return error; } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** SLOT OBJECT METHOD *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ 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 ); return 0; } 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; if ( gindex > 0 ) gindex--; /* check that the glyph index is correct */ FT_ASSERT( gindex < face->phy_font.num_chars ); /* try to load an embedded bitmap */ if ( ( load_flags & ( FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP ) ) == 0 ) { error = pfr_slot_load_bitmap( slot, size, gindex ); if ( error == 0 ) goto Exit; } if ( load_flags & FT_LOAD_SBITS_ONLY ) { error = PFR_Err_Invalid_Argument; goto Exit; } 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; /* load the glyph outline (FT_LOAD_NO_RECURSE isn't supported) */ error = pfr_glyph_load( &slot->glyph, face->root.stream, gps_offset, gchar->gps_offset, gchar->gps_size ); 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; scaling = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); /* copy outline data */ *outline = slot->glyph.loader->base.outline; 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 */ metrics->horiAdvance = 0; metrics->vertAdvance = 0; advance = gchar->advance; em_metrics = face->phy_font.metrics_resolution; em_outline = face->phy_font.outline_resolution; if ( em_metrics != em_outline ) advance = FT_MulDiv( advance, em_outline, em_metrics ); if ( face->phy_font.flags & PFR_PHY_VERTICAL ) metrics->vertAdvance = advance; 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; /* Apply the font matrix, if any. */ /* TODO: Test existing fonts with unusual matrix */ /* whether we have to adjust Units per EM. */ { FT_Matrix font_matrix; font_matrix.xx = face->log_font.matrix[0] << 8; font_matrix.yx = face->log_font.matrix[1] << 8; font_matrix.xy = face->log_font.matrix[2] << 8; font_matrix.yy = face->log_font.matrix[3] << 8; FT_Outline_Transform( outline, &font_matrix ); } /* 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; /* scale outline points */ for ( n = 0; n < outline->n_points; n++, vec++ ) { vec->x = FT_MulFix( vec->x, x_scale ); vec->y = FT_MulFix( vec->y, y_scale ); } /* scale the advance */ metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale ); metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale ); } /* compute the rest of the metrics */ FT_Outline_Get_CBox( outline, &cbox ); metrics->width = cbox.xMax - cbox.xMin; metrics->height = cbox.yMax - cbox.yMin; metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax - metrics->height; } Exit: return error; } /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** KERNING METHOD *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ - FT_LOCAL_DEF( void ) - pfr_face_get_kerning( PFR_Face face, + 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; } /* END */ Index: xc/extras/freetype2/src/pfr/pfrobjs.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/pfr/pfrobjs.h,v retrieving revision 1.2 diff -u -2 -0 -r1.2 pfrobjs.h --- xc/extras/freetype2/src/pfr/pfrobjs.h 23 Apr 2004 18:42:50 -0000 1.2 +++ xc/extras/freetype2/src/pfr/pfrobjs.h 7 Mar 2005 18:53:53 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* pfrobjs.h */ /* */ /* 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, */ /* 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 __PFROBJS_H__ #define __PFROBJS_H__ #include "pfrtypes.h" FT_BEGIN_HEADER typedef struct PFR_FaceRec_* PFR_Face; @@ -41,56 +41,56 @@ } PFR_FaceRec; typedef struct PFR_SizeRec_ { FT_SizeRec root; } PFR_SizeRec; typedef struct PFR_SlotRec_ { FT_GlyphSlotRec root; PFR_GlyphRec glyph; } PFR_SlotRec; 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 #endif /* __PFROBJS_H__ */ /* END */ Index: xc/extras/freetype2/src/psaux/psobjs.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/psaux/psobjs.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 psobjs.c --- xc/extras/freetype2/src/psaux/psobjs.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/psaux/psobjs.c 7 Mar 2005 18:53:54 -0000 @@ -268,62 +268,62 @@ /* In the PostScript Language Reference Manual (PLRM) the following */ /* characters are called `whitespace characters'. */ #define IS_T1_WHITESPACE( c ) ( (c) == ' ' || (c) == '\t' ) #define IS_T1_LINESPACE( c ) ( (c) == '\r' || (c) == '\n' || (c) == '\f' ) #define IS_T1_NULLSPACE( c ) ( (c) == '\0' ) /* According to the PLRM all whitespace characters are equivalent, */ /* except in comments and strings. */ #define IS_T1_SPACE( c ) ( IS_T1_WHITESPACE( c ) || \ IS_T1_LINESPACE( c ) || \ IS_T1_NULLSPACE( c ) ) /* The following array is used by various functions to quickly convert */ /* digits (both decimal and non-decimal) into numbers. */ #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, -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, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 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, -1, -1, -1, -1, -1, -1, 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, -1, -1, -1, -1, -1, }; /* no character >= 0x80 can represent a valid number */ #define OP >= #endif /* 'A' == 65 */ #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, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, } /* no character < 0x80 can represent a valid number */ #define OP < #endif /* 'A' == 193 */ /* first character must be already part of the comment */ @@ -1238,49 +1238,49 @@ { case T1_FIELD_TYPE_BOOL: val = ps_tobool( &cur, limit ); goto Store_Integer; case T1_FIELD_TYPE_FIXED: val = ps_tofixed( &cur, limit, 0 ); goto Store_Integer; case T1_FIELD_TYPE_FIXED_1000: val = ps_tofixed( &cur, limit, 3 ); goto Store_Integer; case T1_FIELD_TYPE_INTEGER: val = ps_toint( &cur, limit ); /* fall through */ 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; default: /* for 64-bit systems */ *(FT_Long*)q = val; } break; case T1_FIELD_TYPE_STRING: case T1_FIELD_TYPE_KEY: { FT_Memory memory = parser->memory; FT_UInt len = (FT_UInt)( limit - cur ); if ( cur >= limit ) break; if ( field->type == T1_FIELD_TYPE_KEY ) { @@ -1526,41 +1526,41 @@ /* */ /* <InOut> */ /* builder :: A pointer to the glyph builder to initialize. */ /* */ /* <Input> */ /* face :: The current face object. */ /* */ /* size :: The current size object. */ /* */ /* glyph :: The current glyph object. */ /* */ /* hinting :: Whether hinting should be applied. */ /* */ FT_LOCAL_DEF( void ) t1_builder_init( T1_Builder builder, FT_Face face, FT_Size size, FT_GlyphSlot glyph, FT_Bool hinting ) { - builder->path_begun = 0; + builder->parse_state = T1_Parse_Start; builder->load_points = 1; builder->face = face; builder->glyph = glyph; builder->memory = face->memory; if ( glyph ) { FT_GlyphLoader loader = glyph->internal->loader; builder->loader = loader; builder->base = &loader->base.outline; builder->current = &loader->current.outline; FT_GlyphLoader_Rewind( loader ); builder->hints_globals = size->internal; builder->hints_funcs = 0; if ( hinting ) @@ -1683,51 +1683,55 @@ error = FT_GlyphLoader_CheckPoints( builder->loader, 0, 1 ); if ( !error ) { if ( outline->n_contours > 0 ) outline->contours[outline->n_contours - 1] = (short)( outline->n_points - 1 ); outline->n_contours++; } return error; } /* if a path was begun, add its first on-curve point */ FT_LOCAL_DEF( FT_Error ) t1_builder_start_point( T1_Builder builder, 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; } /* close the current contour */ FT_LOCAL_DEF( void ) t1_builder_close_contour( T1_Builder builder ) { FT_Outline* outline = builder->current; /* XXXX: We must not include the last point in the path if it */ /* is located on the first point. */ if ( outline->n_points > 1 ) { FT_Int first = 0; FT_Vector* p1 = outline->points + first; FT_Vector* p2 = outline->points + outline->n_points - 1; FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; Index: xc/extras/freetype2/src/psaux/t1decode.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/psaux/t1decode.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 t1decode.c --- xc/extras/freetype2/src/psaux/t1decode.c 28 Apr 2004 10:39:05 -0000 1.3 +++ xc/extras/freetype2/src/psaux/t1decode.c 7 Mar 2005 18:53:54 -0000 @@ -323,41 +323,41 @@ FT_Byte* limit; T1_Builder builder = &decoder->builder; FT_Pos x, y, orig_x, orig_y; T1_Hints_Funcs hinter; /* we don't want to touch the source code -- use macro trick */ #define start_point t1_builder_start_point #define check_points t1_builder_check_points #define add_point t1_builder_add_point #define add_point1 t1_builder_add_point1 #define add_contour t1_builder_add_contour #define close_contour t1_builder_close_contour /* First of all, initialize the decoder */ decoder->top = decoder->stack; decoder->zone = decoder->zones; zone = decoder->zones; - builder->path_begun = 0; + builder->parse_state = T1_Parse_Start; hinter = (T1_Hints_Funcs)builder->hints_funcs; zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; error = PSaux_Err_Ok; x = orig_x = builder->pos_x; y = orig_y = builder->pos_y; /* begin hints recording session, if any */ if ( hinter ) hinter->open( hinter->hints ); /* now, execute loop */ while ( ip < limit ) { FT_Long* top = decoder->top; @@ -539,41 +539,41 @@ decoder->top = top; } else if ( op == op_callothersubr ) /* callothersubr */ { FT_TRACE4(( " callothersubr" )); if ( top - decoder->stack < 2 ) goto Stack_Underflow; top -= 2; switch ( (FT_Int)top[1] ) { case 1: /* start flex feature */ if ( top[0] != 0 ) goto Unexpected_OtherSubr; decoder->flex_state = 1; 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 */ { FT_Int idx; if ( top[0] != 0 ) goto Unexpected_OtherSubr; /* note that we should not add a point for index 0; */ /* this will move our current position to the flex */ /* point without adding any point to the outline */ idx = decoder->num_flex_vectors++; if ( idx > 0 && idx < 7 ) add_point( builder, x, y, (FT_Byte)( idx == 3 || idx == 6 ) ); } @@ -730,195 +730,213 @@ if (hinter->close( hinter->hints, builder->current->n_points )) goto Syntax_Error; /* apply hints to the loaded glyph outline now */ hinter->apply( hinter->hints, builder->current, (PSH_Globals) builder->hints_globals, decoder->hint_mode ); } /* add current outline to the glyph slot */ FT_GlyphLoader_Add( builder->loader ); /* return now! */ FT_TRACE4(( "\n\n" )); return PSaux_Err_Ok; 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; orig_x = builder->last.x = x = builder->pos_x + top[0]; orig_y = builder->last.y = y = builder->pos_y; FT_UNUSED( orig_y ); /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) return PSaux_Err_Ok; break; case op_seac: /* return immediately after the processing */ return t1operator_seac( decoder, top[0], top[1], top[2], (FT_Int)top[3], (FT_Int)top[4] ); 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]; builder->advance.y = top[3]; builder->last.x = x = builder->pos_x + top[0]; builder->last.y = y = builder->pos_y + top[1]; /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) return PSaux_Err_Ok; break; case op_closepath: FT_TRACE4(( " closepath" )); close_contour( builder ); - builder->path_begun = 0; + if ( builder->parse_state != T1_Parse_Have_Path ) + 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; case op_hmoveto: FT_TRACE4(( " hmoveto" )); 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: FT_TRACE4(( " hvcurveto" )); if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) - goto Memory_Error; + goto Fail; x += top[0]; add_point( builder, x, y, 0 ); x += top[1]; y += top[2]; add_point( builder, x, y, 0 ); y += top[3]; add_point( builder, x, y, 1 ); break; case op_rlineto: 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: FT_TRACE4(( " rmoveto" )); 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: FT_TRACE4(( " rcurveto" )); if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) - goto Memory_Error; + goto Fail; x += top[0]; y += top[1]; add_point( builder, x, y, 0 ); x += top[2]; y += top[3]; add_point( builder, x, y, 0 ); x += top[4]; y += top[5]; add_point( builder, x, y, 1 ); break; case op_vhcurveto: FT_TRACE4(( " vhcurveto" )); if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) - goto Memory_Error; + goto Fail; y += top[0]; add_point( builder, x, y, 0 ); x += top[1]; y += top[2]; add_point( builder, x, y, 0 ); x += top[3]; add_point( builder, x, y, 1 ); break; case op_vlineto: FT_TRACE4(( " vlineto" )); if ( start_point( builder, x, y ) ) - goto Memory_Error; + goto Fail; y += top[0]; goto Add_Line; case op_vmoveto: FT_TRACE4(( " vmoveto" )); 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: FT_TRACE4(( " div" )); if ( top[1] ) { *top = top[0] / top[1]; ++top; } else { FT_ERROR(( "t1_decoder_parse_charstrings: division by 0\n" )); goto Syntax_Error; } break; case op_callsubr: { FT_Int idx; @@ -1055,50 +1073,48 @@ FT_TRACE4(( " setcurrentpoint" )); FT_ERROR(( "t1_decoder_parse_charstrings: " )); FT_ERROR(( "unexpected `setcurrentpoint'\n" )); goto Syntax_Error; default: FT_ERROR(( "t1_decoder_parse_charstrings: " "unhandled opcode %d\n", op )); goto Syntax_Error; } decoder->top = top; } /* general operator processing */ } /* while ip < limit */ FT_TRACE4(( "..end..\n\n" )); + Fail: return error; Syntax_Error: return PSaux_Err_Syntax_Error; Stack_Underflow: return PSaux_Err_Stack_Underflow; - - Memory_Error: - return builder->error; } /* parse a single Type 1 glyph */ FT_LOCAL_DEF( FT_Error ) t1_decoder_parse_glyph( T1_Decoder decoder, FT_UInt glyph ) { return decoder->parse_callback( decoder, glyph ); } /* initialize T1 decoder */ FT_LOCAL_DEF( FT_Error ) t1_decoder_init( T1_Decoder decoder, FT_Face face, FT_Size size, FT_GlyphSlot slot, FT_Byte** glyph_names, PS_Blend blend, Index: xc/extras/freetype2/src/raster/ftraster.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/raster/ftraster.c,v retrieving revision 1.2 diff -u -2 -0 -r1.2 ftraster.c --- xc/extras/freetype2/src/raster/ftraster.c 23 Apr 2004 18:42:51 -0000 1.2 +++ xc/extras/freetype2/src/raster/ftraster.c 7 Mar 2005 18:53:56 -0000 @@ -234,40 +234,50 @@ /*************************************************************************/ /*************************************************************************/ /** **/ /** SIMPLE TYPE DECLARATIONS **/ /** **/ /*************************************************************************/ /*************************************************************************/ typedef int Int; typedef unsigned int UInt; typedef short Short; typedef unsigned short UShort, *PUShort; typedef long Long, *PLong; typedef unsigned long ULong; 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; Long y; } TPoint; typedef enum TFlow_ { Flow_None = 0, Flow_Up = 1, Flow_Down = -1 } TFlow; /* States of each line, arc, and profile */ typedef enum TStates_ { @@ -296,41 +306,41 @@ PProfile next; /* next profile in same contour, used */ /* during drop-out control */ }; typedef PProfile TProfileList; typedef PProfile* PProfileList; /* Simple record used to implement a stack of bands, required */ /* by the sub-banding mechanism */ typedef struct TBand_ { Short y_min; /* band's minimum */ Short y_max; /* band's maximum */ } TBand; #define AlignProfileSize \ - ( ( sizeof ( TProfile ) + sizeof ( long ) - 1 ) / sizeof ( long ) ) + ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) ) #ifdef TT_STATIC_RASTER #define RAS_ARGS /* void */ #define RAS_ARG /* void */ #define RAS_VARS /* void */ #define RAS_VAR /* void */ #define FT_UNUSED_RASTER do ; while ( 0 ) #else /* TT_STATIC_RASTER */ #define RAS_ARGS TRaster_Instance* raster, #define RAS_ARG TRaster_Instance* raster Index: xc/extras/freetype2/src/sfnt/sfobjs.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/sfnt/sfobjs.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 sfobjs.c --- xc/extras/freetype2/src/sfnt/sfobjs.c 28 Apr 2004 10:39:06 -0000 1.3 +++ xc/extras/freetype2/src/sfnt/sfobjs.c 7 Mar 2005 18:53:56 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* sfobjs.c */ /* */ /* SFNT object management (base). */ /* */ -/* 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, */ /* 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 "sfobjs.h" #include "ttload.h" #include "ttcmap0.h" #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H #include "sferrors.h" @@ -143,40 +143,42 @@ /* <Input> */ /* face :: A handle to the source face object. */ /* */ /* nameid :: The name id of the name record to return. */ /* */ /* <Return> */ /* Character string. NULL if no name is present. */ /* */ static FT_String* tt_face_get_name( TT_Face face, FT_UShort nameid ) { FT_Memory memory = face->root.memory; FT_String* result = NULL; FT_UShort n; TT_NameEntryRec* rec; FT_Int found_apple = -1; FT_Int found_win = -1; FT_Int found_unicode = -1; + FT_Bool is_english = 0; + TT_NameEntry_ConvertFunc convert; rec = face->name_table.names; for ( n = 0; n < face->num_names; n++, rec++ ) { /* According to the OpenType 1.3 specification, only Microsoft or */ /* Apple platform IDs might be used in the `name' table. The */ /* `Unicode' platform is reserved for the `cmap' table, and the */ /* `Iso' one is deprecated. */ /* */ /* However, the Apple TrueType specification doesn't say the same */ /* thing and goes to suggest that all Unicode `name' table entries */ /* should be coded in UTF-16 (in big-endian format I suppose). */ /* */ if ( rec->nameID == nameid && rec->stringLength > 0 ) { switch ( rec->platformID ) { case TT_PLATFORM_APPLE_UNICODE: @@ -188,99 +190,101 @@ found_unicode = n; break; case TT_PLATFORM_MACINTOSH: if ( rec->languageID == TT_MAC_LANGID_ENGLISH ) found_apple = n; break; case TT_PLATFORM_MICROSOFT: /* we only take a non-English name when there is nothing */ /* else available in the font */ /* */ if ( found_win == -1 || ( rec->languageID & 0x3FF ) == 0x009 ) { switch ( rec->encodingID ) { case TT_MS_ID_SYMBOL_CS: case TT_MS_ID_UNICODE_CS: case TT_MS_ID_UCS_4: - found_win = n; + is_english = ( rec->languageID & 0x3FF ) == 0x009; + found_win = n; break; default: ; } } break; default: ; } } } /* 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 ) { case TT_MS_ID_UNICODE_CS: case TT_MS_ID_SYMBOL_CS: convert = tt_name_entry_ascii_from_utf16; break; case TT_MS_ID_UCS_4: convert = tt_name_entry_ascii_from_ucs4; break; default: ; } } else if ( found_apple >= 0 ) { rec = face->name_table.names + found_apple; convert = tt_name_entry_ascii_from_other; } else if ( found_unicode >= 0 ) { rec = face->name_table.names + found_unicode; convert = tt_name_entry_ascii_from_utf16; } if ( rec && convert ) { if ( rec->string == NULL ) { FT_Error error = SFNT_Err_Ok; FT_Stream stream = face->name_table.stream; 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 ) ) { FT_FREE( rec->string ); rec->stringLength = 0; result = NULL; goto Exit; } } result = convert( rec, memory ); } Exit: return result; } static FT_Encoding sfnt_find_encoding( int platform_id, @@ -414,45 +418,45 @@ /* Load tables */ /* We now support two SFNT-based bitmapped font formats. They */ /* are recognized easily as they do not include a `glyf' */ /* table. */ /* */ /* The first format comes from Apple, and uses a table named */ /* `bhed' instead of `head' to store the font header (using */ /* the same format). It also doesn't include horizontal and */ /* vertical metrics tables (i.e. `hhea' and `vhea' tables are */ /* missing). */ /* */ /* The other format comes from Microsoft, and is used with */ /* WinCE/PocketPC. It looks like a standard TTF, except that */ /* it doesn't contain outlines. */ /* */ /* 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; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* if this font doesn't contain outlines, we try to load */ /* a `bhed' table */ if ( !has_outline ) is_apple_sbit = FT_BOOL( !LOAD_( bitmap_header ) ); #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ /* load the font header (`head' table) if this isn't an Apple */ /* sbit font file */ if ( !is_apple_sbit && LOAD_( header ) ) goto Exit; /* the following tables are often not present in embedded TrueType */ /* fonts within PDF documents, so don't check for them. */ @@ -529,40 +533,49 @@ FT_FACE_FLAG_HORIZONTAL; /* horizontal data */ #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES if ( psnames_error == SFNT_Err_Ok && face->postscript.FormatType != 0x00030000L ) flags |= FT_FACE_FLAG_GLYPH_NAMES; #endif /* fixed width font? */ if ( face->postscript.isFixedPitch ) flags |= FT_FACE_FLAG_FIXED_WIDTH; /* vertical information? */ if ( face->vertical_info ) flags |= FT_FACE_FLAG_VERTICAL; /* kerning available ? */ if ( face->kern_pairs ) flags |= FT_FACE_FLAG_KERNING; +#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; /*********************************************************************/ /* */ /* Compute style flags. */ /* */ flags = 0; if ( has_outline == TRUE && face->os2.version != 0xFFFFU ) { /* we have an OS/2 table; use the `fsSelection' field */ if ( face->os2.fsSelection & 1 ) flags |= FT_STYLE_FLAG_ITALIC; if ( face->os2.fsSelection & 32 ) flags |= FT_STYLE_FLAG_BOLD; } else { /* this is an old Mac font, use the header field */ if ( face->header.Mac_Style & 1 ) @@ -812,29 +825,30 @@ FT_FREE( face->vertical.long_metrics ); FT_FREE( face->vertical.short_metrics ); face->vertical_info = 0; } /* freeing the gasp table */ FT_FREE( face->gasp.gaspRanges ); face->gasp.numRanges = 0; /* freeing the name table */ sfnt->free_names( face ); /* freeing the hdmx table */ sfnt->free_hdmx( face ); /* freeing family and style name */ FT_FREE( face->root.family_name ); 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; } /* END */ Index: xc/extras/freetype2/src/sfnt/ttload.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/sfnt/ttload.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ttload.c --- xc/extras/freetype2/src/sfnt/ttload.c 28 Apr 2004 10:39:06 -0000 1.3 +++ xc/extras/freetype2/src/sfnt/ttload.c 7 Mar 2005 18:53:57 -0000 @@ -190,58 +190,66 @@ else if ( FT_STREAM_SEEK( offset + 12 ) ) goto Bad_Format; for ( nn = 0; nn < num_tables; nn++ ) { TT_TableRec table; if ( FT_STREAM_READ_FIELDS( sfnt_dir_entry_fields, &table ) ) goto Bad_Format; if ( table.Offset + table.Length > stream->size && table.Tag != glyx_tag && table.Tag != locx_tag ) goto Bad_Format; if ( table.Tag == TTAG_head ) { 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 * make it 0x38, so we will just check that it is greater. * * Note that according to the specification, * the table must be padded to 32-bit lengths, but this doesn't * apply to the value of its "Length" field! */ if ( table.Length < 0x36 || FT_STREAM_SEEK( table.Offset + 12 ) || FT_READ_ULONG( magic ) || magic != 0x5F0F3CF5UL ) goto Bad_Format; 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; Bad_Format: error = SFNT_Err_Unknown_File_Format; goto Exit; } /*************************************************************************/ /* */ /* <Function> */ /* tt_face_load_sfnt_header */ /* */ /* <Description> */ @@ -408,41 +416,41 @@ /* The stream cursor must be at the font file's origin. */ /* */ FT_LOCAL_DEF( FT_Error ) tt_face_load_directory( TT_Face face, FT_Stream stream, SFNT_Header sfnt ) { FT_Error error; FT_Memory memory = stream->memory; TT_TableRec *entry, *limit; FT_TRACE2(( "tt_face_load_directory: %08p\n", face )); FT_TRACE2(( "-- Tables count: %12u\n", sfnt->num_tables )); FT_TRACE2(( "-- Format version: %08lx\n", sfnt->format_tag )); 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 ) || FT_FRAME_ENTER( face->num_tables * 16L ) ) goto Exit; entry = face->dir_tables; limit = entry + face->num_tables; for ( ; entry < limit; entry++ ) { /* loop through the tables and get all entries */ entry->Tag = FT_GET_TAG4(); entry->CheckSum = FT_GET_ULONG(); entry->Offset = FT_GET_LONG(); entry->Length = FT_GET_LONG(); FT_TRACE2(( " %c%c%c%c - %08lx - %08lx\n", (FT_Char)( entry->Tag >> 24 ), (FT_Char)( entry->Tag >> 16 ), (FT_Char)( entry->Tag >> 8 ), @@ -698,70 +706,70 @@ FT_FRAME_USHORT( maxStorage ), FT_FRAME_USHORT( maxFunctionDefs ), FT_FRAME_USHORT( maxInstructionDefs ), FT_FRAME_USHORT( maxStackElements ), FT_FRAME_USHORT( maxSizeOfInstructions ), FT_FRAME_USHORT( maxComponentElements ), FT_FRAME_USHORT( maxComponentDepth ), FT_FRAME_END }; FT_TRACE2(( "Load_TT_MaxProfile: %08p\n", face )); error = face->goto_table( face, TTAG_maxp, stream, 0 ); if ( error ) goto Exit; 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; maxProfile->maxCompositeContours = 0; maxProfile->maxZones = 0; maxProfile->maxTwilightPoints = 0; maxProfile->maxStorage = 0; maxProfile->maxFunctionDefs = 0; maxProfile->maxInstructionDefs = 0; maxProfile->maxStackElements = 0; maxProfile->maxSizeOfInstructions = 0; maxProfile->maxComponentElements = 0; maxProfile->maxComponentDepth = 0; if ( maxProfile->version >= 0x10000L ) { if ( FT_STREAM_READ_FIELDS( maxp_fields_extra, maxProfile ) ) goto Exit; /* XXX: an adjustment that is necessary to load certain */ /* broken fonts like `Keystrokes MT' :-( */ /* */ /* We allocate 64 function entries by default when */ /* the maxFunctionDefs field is null. */ 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 ); face->root.internal->max_contours = (FT_Short)FT_MAX( maxProfile->maxCompositeContours, maxProfile->maxContours ); face->max_components = (FT_ULong)maxProfile->maxComponentElements + maxProfile->maxComponentDepth; /* XXX: some fonts have maxComponents set to 0; we will */ /* then use 16 of them by default. */ if ( face->max_components == 0 ) face->max_components = 16; /* We also increase maxPoints and maxContours in order to support */ /* some broken fonts. */ face->root.internal->max_points += (FT_UShort)8; face->root.internal->max_contours += (FT_Short) 4; @@ -863,42 +871,42 @@ longs = (TT_LongMetrics *)&face->horizontal.long_metrics; shorts = (TT_ShortMetrics**)&face->horizontal.short_metrics; } /* never trust derived values */ num_shorts = face->max_profile.numGlyphs - num_longs; num_shorts_checked = ( table_len - num_longs * 4L ) / 2; if ( num_shorts < 0 ) { FT_ERROR(( "TT_Load_%s_Metrics: more metrics than glyphs!\n", vertical ? "Vertical" : "Horizontal" )); error = vertical ? SFNT_Err_Invalid_Vert_Metrics : SFNT_Err_Invalid_Horiz_Metrics; 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 ) ) goto Exit; { TT_LongMetrics cur = *longs; TT_LongMetrics limit = cur + num_longs; for ( ; cur < limit; cur++ ) { cur->advance = FT_GET_USHORT(); cur->bearing = FT_GET_SHORT(); } } /* do we have an inconsistent number of metric values? */ { TT_ShortMetrics* cur = *shorts; @@ -1181,48 +1189,51 @@ /*************************************************************************/ /* */ /* <Function> */ /* tt_face_free_names */ /* */ /* <Description> */ /* Frees the name records. */ /* */ /* <Input> */ /* face :: A handle to the target face object. */ /* */ FT_LOCAL_DEF( void ) tt_face_free_names( TT_Face face ) { FT_Memory memory = face->root.driver->root.memory; TT_NameTable table = &face->name_table; TT_NameEntry entry = table->names; 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; table->storageOffset = 0; } /*************************************************************************/ /* */ /* <Function> */ /* tt_face_load_cmap */ /* */ /* <Description> */ /* Loads the cmap directory in a face object. The cmaps itselves are */ /* loaded on demand in the `ttcmap.c' module. */ /* */ /* <Input> */ /* face :: A handle to the target face object. */ /* */ /* stream :: A handle to the input stream. */ @@ -1558,41 +1569,41 @@ FT_TRACE2(( "tt_face_load_gasp: %08p\n", face )); /* the gasp table is optional */ error = face->goto_table( face, TTAG_gasp, stream, 0 ); if ( error ) return SFNT_Err_Ok; if ( FT_FRAME_ENTER( 4L ) ) goto Exit; face->gasp.version = FT_GET_USHORT(); face->gasp.numRanges = FT_GET_USHORT(); FT_FRAME_EXIT(); 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; face->gasp.gaspRanges = gaspranges; for ( j = 0; j < num_ranges; j++ ) { gaspranges[j].maxPPEM = FT_GET_USHORT(); gaspranges[j].gaspFlag = FT_GET_USHORT(); FT_TRACE3(( " [max:%d flag:%d]", gaspranges[j].maxPPEM, gaspranges[j].gaspFlag )); } FT_TRACE3(( "\n" )); FT_FRAME_EXIT(); FT_TRACE2(( "GASP loaded\n" )); Exit: @@ -1607,40 +1618,45 @@ /*************************************************************************/ /* */ /* <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. */ /* */ + +#undef TT_KERN_INDEX +#define TT_KERN_INDEX( g1, g2 ) ( ( (FT_ULong)g1 << 16 ) | g2 ) + + 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(); @@ -1663,116 +1679,137 @@ 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 ) ) + 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 1 + if ( num_pairs > 0 ) { - FT_UInt i; - TT_Kern0_Pair pair0; + 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 ); + - pair0 = face->kern_pairs; + 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 ); + } +#else + { + TT_Kern0_Pair pair0 = face->kern_pairs; + FT_UInt i; + 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; } } } +#endif 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> */ /* tt_face_load_hdmx */ /* */ /* <Description> */ /* Loads the horizontal device metrics table. */ /* */ /* <Input> */ /* face :: A handle to the target face object. */ /* */ /* stream :: A handle to the input stream. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) tt_face_load_hdmx( TT_Face face, @@ -1792,60 +1829,60 @@ hdmx->records = 0; /* this table is optional */ error = face->goto_table( face, TTAG_hdmx, stream, 0 ); if ( error ) return SFNT_Err_Ok; if ( FT_FRAME_ENTER( 8L ) ) goto Exit; hdmx->version = FT_GET_USHORT(); num_records = FT_GET_SHORT(); record_size = FT_GET_LONG(); FT_FRAME_EXIT(); /* Only recognize format 0 */ if ( hdmx->version != 0 ) goto Exit; - if ( FT_NEW_ARRAY( hdmx->records, num_records ) ) + if ( FT_QNEW_ARRAY( hdmx->records, num_records ) ) goto Exit; hdmx->num_records = num_records; num_glyphs = face->root.num_glyphs; record_size -= num_glyphs + 2; { TT_HdmxEntry cur = hdmx->records; TT_HdmxEntry limit = cur + hdmx->num_records; for ( ; cur < limit; cur++ ) { /* read record */ if ( FT_READ_BYTE( cur->ppem ) || 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; } } Exit: return error; } /*************************************************************************/ /* */ /* <Function> */ /* tt_face_free_hdmx */ /* */ /* <Description> */ Index: xc/extras/freetype2/src/tools/cordic.py =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/tools/cordic.py,v retrieving revision 1.1.1.2 diff -u -2 -0 -r1.1.1.2 cordic.py --- xc/extras/freetype2/src/tools/cordic.py 25 Nov 2003 19:27:23 -0000 1.1.1.2 +++ xc/extras/freetype2/src/tools/cordic.py 7 Mar 2005 18:53:57 -0000 @@ -1,78 +1,79 @@ # 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 = "" def calc_val( x ): global units, shrink angle = math.atan(x) shrink = shrink * math.cos(angle) return angle/math.pi * units def print_val( n, x ): global comma lo = int(x) hi = lo + 1 alo = math.atan(lo) ahi = math.atan(hi) ax = math.atan(2.0**n) errlo = abs( alo - ax ) errhi = abs( ahi - ax ) - + if ( errlo < errhi ): hi = lo sys.stdout.write( comma + repr( int(hi) ) ) comma = ", " print "" print "table of arctan( 1/2^n ) for PI = " + repr(units/65536.0) + " units" # compute range of "i" r = [-1] r = r + 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 + + 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 = ", " - + shrink = shrink * math.cos( angle2/scale) - + print print "shrink factor = " + repr( shrink ) print "shrink factor 2 = " + repr( shrink * (2.0**32) ) print "expansion factor = " + repr(1/shrink) print "" \ No newline at end of file Index: xc/extras/freetype2/src/truetype/Jamfile =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/Jamfile,v retrieving revision 1.1.1.2 diff -u -2 -0 -r1.1.1.2 Jamfile --- xc/extras/freetype2/src/truetype/Jamfile 25 Nov 2003 19:27:23 -0000 1.1.1.2 +++ xc/extras/freetype2/src/truetype/Jamfile 7 Mar 2005 18:53:57 -0000 @@ -1,21 +1,21 @@ -# FreeType 2 src/truetype Jamfile (c) 2001 David Turner +# FreeType 2 src/truetype Jamfile (c) 2001, 2004 David Turner # SubDir FT2_TOP $(FT2_SRC_DIR) truetype ; { local _sources ; if $(FT2_MULTI) { - _sources = ttdriver ttobjs ttpload ttgload ttinterp ; + _sources = ttdriver ttobjs ttpload ttgload ttinterp ttgxvar ; } else { _sources = truetype ; } Library $(FT2_LIB) : $(_sources).c ; } # end of src/truetype Jamfile Index: xc/extras/freetype2/src/truetype/rules.mk =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/rules.mk,v retrieving revision 1.2 diff -u -2 -0 -r1.2 rules.mk --- xc/extras/freetype2/src/truetype/rules.mk 23 Apr 2004 18:42:53 -0000 1.2 +++ xc/extras/freetype2/src/truetype/rules.mk 7 Mar 2005 18:53:57 -0000 @@ -1,51 +1,52 @@ # # FreeType 2 TrueType driver configuration rules # -# 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, # 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. # TrueType driver directory # TT_DIR := $(SRC_DIR)/truetype # compilation flags for the driver # TT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(TT_DIR)) # TrueType driver sources (i.e., C files) # 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 # TT_DRV_H := $(TT_DRV_SRC:%.c=%.h) \ $(TT_DIR)/tterrors.h # TrueType driver object(s) # # TT_DRV_OBJ_M is used during `multi' builds # TT_DRV_OBJ_S is used during `single' builds # TT_DRV_OBJ_M := $(TT_DRV_SRC:$(TT_DIR)/%.c=$(OBJ_DIR)/%.$O) TT_DRV_OBJ_S := $(OBJ_DIR)/truetype.$O # TrueType driver source file for single build # TT_DRV_SRC_S := $(TT_DIR)/truetype.c Index: xc/extras/freetype2/src/truetype/truetype.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/truetype.c,v retrieving revision 1.1.1.1 diff -u -2 -0 -r1.1.1.1 truetype.c --- xc/extras/freetype2/src/truetype/truetype.c 14 Nov 2003 16:48:24 -0000 1.1.1.1 +++ xc/extras/freetype2/src/truetype/truetype.c 7 Mar 2005 18:53:57 -0000 @@ -1,32 +1,36 @@ /***************************************************************************/ /* */ /* truetype.c */ /* */ /* 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, */ /* 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 "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 */ Index: xc/extras/freetype2/src/truetype/ttdriver.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttdriver.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ttdriver.c --- xc/extras/freetype2/src/truetype/ttdriver.c 28 Apr 2004 10:39:07 -0000 1.3 +++ xc/extras/freetype2/src/truetype/ttdriver.c 7 Mar 2005 18:53:58 -0000 @@ -6,43 +6,52 @@ /* */ /* 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, */ /* 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_INTERNAL_SFNT_H #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" /*************************************************************************/ /* */ /* 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_ttdriver /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** ****/ /**** F A C E S ****/ /**** ****/ @@ -73,45 +82,46 @@ /* */ /* right_glyph :: The index of the right glyph in the kern pair. */ /* */ /* <Output> */ /* kerning :: The kerning vector. This is in font units for */ /* scalable formats, and in pixels for fixed-sizes */ /* formats. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ /* <Note> */ /* Only horizontal layouts (left-to-right & right-to-left) are */ /* supported by this function. Other layouts, or more sophisticated */ /* kernings, are out of scope of this method (the basic driver */ /* interface is meant to be simple). */ /* */ /* They can be implemented by format-specific interfaces. */ /* */ static FT_Error - Get_Kerning( TT_Face face, + Get_Kerning( FT_Face ttface, /* TT_Face */ FT_UInt left_glyph, FT_UInt right_glyph, FT_Vector* kerning ) { + TT_Face face = (TT_Face)ttface; TT_Kern0_Pair pair; 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 ) @@ -168,46 +178,47 @@ /* and vertical) expressed in fractional points. */ /* */ /* <Input> */ /* char_width :: The character width expressed in 26.6 */ /* fractional points. */ /* */ /* char_height :: The character height expressed in 26.6 */ /* fractional points. */ /* */ /* horz_resolution :: The horizontal resolution of the output device. */ /* */ /* vert_resolution :: The vertical resolution of the output device. */ /* */ /* <InOut> */ /* size :: A handle to the target size object. */ /* */ /* <Return> */ /* 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; FT_Long dim_x, dim_y; *metrics2 = *metrics; /* This bit flag, when set, indicates that the pixel size must be */ /* truncated to an integer. Nearly all TrueType fonts have this */ /* bit set, as hinting won't work really well otherwise. */ /* */ if ( ( face->header.Flags & 8 ) != 0 ) { /* we need to use rounding in the following computations. Otherwise, * the resulting hinted outlines will be very slightly distorted */ dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & ~63; dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & ~63; } @@ -233,87 +244,97 @@ return tt_size_reset( size ); } /*************************************************************************/ /* */ /* <Function> */ /* Set_Pixel_Sizes */ /* */ /* <Description> */ /* A driver method used to reset a size's character sizes (horizontal */ /* and vertical) expressed in integer pixels. */ /* */ /* <InOut> */ /* size :: A handle to the target size object. */ /* */ /* <Return> */ /* 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; size->ttmetrics.valid = FALSE; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS size->strike_index = 0xFFFFU; #endif return tt_size_reset( size ); } /*************************************************************************/ /* */ /* <Function> */ /* Load_Glyph */ /* */ /* <Description> */ /* A driver method used to load a glyph within a given glyph slot. */ /* */ /* <Input> */ /* slot :: A handle to the target slot object where the glyph */ /* will be loaded. */ /* */ /* size :: A handle to the source face size at which the glyph */ /* must be scaled, loaded, etc. */ /* */ /* glyph_index :: The index of the glyph in the font file. */ /* */ /* load_flags :: A flag indicating what to load for this glyph. The */ /* FTLOAD_??? constants can be used to control the */ /* glyph loading process (e.g., whether the outline */ /* should be scaled, whether to load bitmaps or not, */ /* whether to hint the outline, etc). */ /* */ /* <Return> */ /* 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 ) return TT_Err_Invalid_Slot_Handle; /* check whether we want a scaled outline or bitmap */ if ( !size ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; if ( load_flags & FT_LOAD_NO_SCALE ) size = NULL; /* reset the size object if necessary */ if ( size ) { /* these two object must have the same parent */ if ( size->root.face != slot->face ) return TT_Err_Invalid_Face_Handle; if ( !size->ttmetrics.valid ) @@ -328,102 +349,117 @@ /* force drop-out mode to 2 - irrelevant now */ /* slot->outline.dropout_mode = 2; */ return error; } /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** ****/ /**** D R I V E R I N T E R F A C E ****/ /**** ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ +#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; FT_Module sfntd; SFNT_Service sfnt; result = ft_service_list_lookup( tt_services, tt_interface ); if ( result != NULL ) 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; } /* The FT_DriverInterface structure is defined in ftdriver.h. */ FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec tt_driver_class = { { FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER FT_MODULE_DRIVER_HAS_HINTER, #else 0, #endif sizeof ( TT_DriverRec ), "truetype", /* driver name */ 0x10000L, /* driver version == 1.0 */ 0x20000L, /* driver requires FreeType 2.0 or above */ (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 ), - - (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, - - (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_face_init, + tt_face_done, + tt_size_init, + tt_size_done, + 0, /* FT_Slot_InitFunc */ + 0, /* FT_Slot_DoneFunc */ + + Set_Char_Sizes, + Set_Pixel_Sizes, + Load_Glyph, + + Get_Kerning, + 0, /* FT_Face_AttachFunc */ + 0 /* FT_Face_GetAdvancesFunc */ }; /* END */ Index: xc/extras/freetype2/src/truetype/ttgload.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttgload.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ttgload.c --- xc/extras/freetype2/src/truetype/ttgload.c 28 Apr 2004 10:39:07 -0000 1.3 +++ xc/extras/freetype2/src/truetype/ttgload.c 7 Mar 2005 18:53:59 -0000 @@ -9,40 +9,44 @@ /* */ /* 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_CALC_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H #include "ttgload.h" +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include "ttgxvar.h" +#endif + #include "tterrors.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_ttgload /*************************************************************************/ /* */ /* Composite font flags. */ /* */ #define ARGS_ARE_WORDS 0x0001 #define ARGS_ARE_XY_VALUES 0x0002 #define ROUND_XY_TO_GRID 0x0004 @@ -185,41 +189,41 @@ FT_UNUSED( check ); if ( face->vertical_info ) TT_Get_Metrics( (TT_HoriHeader *)&face->vertical, idx, tsb, ah ); #if 1 /* Emperically determined, at variance with what MS said */ else { *tsb = 0; *ah = face->root.units_per_EM; } #else /* This is what MS said to do. It isn't what they do, however. */ else if ( face->os2.version != 0xFFFFU ) { *tsb = face->os2.sTypoAscender; *ah = face->os2.sTypoAscender - face->os2.sTypoDescender; } - else + else { *tsb = face->horizontal.Ascender; *ah = face->horizontal.Ascender - face->horizontal.Descender; } #endif } #define cur_to_org( n, zone ) \ FT_ARRAY_COPY( (zone)->org, (zone)->cur, (n) ) #define org_to_cur( n, zone ) \ FT_ARRAY_COPY( (zone)->cur, (zone)->org, (n) ) /*************************************************************************/ /* */ /* Translates an array of coordinates. */ @@ -335,41 +339,41 @@ TT_Load_Simple_Glyph( TT_Loader load ) { FT_Error error; FT_Stream stream = load->stream; FT_GlyphLoader gloader = load->gloader; FT_Int n_contours = load->n_contours; FT_Outline* outline; TT_Face face = (TT_Face)load->face; TT_GlyphSlot slot = (TT_GlyphSlot)load->glyph; FT_UShort n_ins; FT_Int n, n_points; FT_Int byte_len = load->byte_len; FT_Byte *flag, *flag_limit; FT_Byte c, count; FT_Vector *vec, *vec_limit; FT_Pos x; 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; /* check space for contours array + instructions count */ byte_len -= 2 * ( n_contours + 1 ); if ( byte_len < 0 ) goto Invalid_Outline; for ( ; cont < cont_limit; cont++ ) cont[0] = FT_GET_USHORT(); n_points = 0; if ( n_contours > 0 ) n_points = cont[-1] + 1; error = FT_GlyphLoader_CheckPoints( gloader, n_points + 4, 0 ); if ( error ) goto Fail; /* we'd better check the contours table right now */ @@ -707,56 +711,92 @@ pp2 = pp1 + 1; pp2->x = pp1->x + load->advance; pp2->y = 0; /* pp3 = top side bearing */ pp3 = pp1 + 2; pp3->x = 0; pp3->y = load->top_bearing + load->bbox.yMax; /* pp4 = pp3 - ah */ pp4 = pp1 + 3; pp4->x = 0; pp4->y = pp3->y - load->vadvance; outline->tags[n_points ] = 0; outline->tags[n_points + 1] = 0; outline->tags[n_points + 2] = 0; 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 ); /* eventually scale the glyph */ if ( !( load->load_flags & FT_LOAD_NO_SCALE ) ) { 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++ ) { vec->x = FT_MulFix( vec->x, x_scale ); vec->y = FT_MulFix( vec->y, y_scale ); } } cur_to_org( n_points, zone ); /* eventually hint the glyph */ 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; @@ -786,104 +826,110 @@ error = TT_Run_Context( load->exec, debug ); if ( error && load->exec->pedantic_hinting ) goto Exit; error = TT_Err_Ok; /* ignore bytecode errors in non-pedantic mode */ } #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ } /* save glyph phantom points */ if ( !load->preserve_pps ) { load->pp1 = zone->cur[n_points - 4]; load->pp2 = zone->cur[n_points - 3]; load->pp3 = zone->cur[n_points - 2]; 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; } /*************************************************************************/ /* */ /* <Function> */ /* load_truetype_glyph */ /* */ /* <Description> */ /* Loads a given truetype glyph. Handles composites and uses a */ /* TT_Loader object. */ /* */ static FT_Error load_truetype_glyph( TT_Loader loader, FT_UInt glyph_index, FT_UInt recurse_count ) { #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER FT_Stream stream = loader->stream; #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; FT_Fixed x_scale, y_scale; FT_GlyphLoader gloader = loader->gloader; 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 if ( recurse_count >= TT_MAX_COMPOSITE_RECURSE ) { error = TT_Err_Invalid_Composite; goto Exit; } /* check glyph index */ if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) { error = TT_Err_Invalid_Glyph_Index; goto Exit; } loader->glyph_index = glyph_index; num_points = 0; x_scale = 0x10000L; 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 */ { FT_Short left_bearing = 0, top_bearing = 0; FT_UShort advance_width = 0, advance_height = 0; Get_HMetrics( face, glyph_index, (FT_Bool)!( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ), &left_bearing, &advance_width ); Get_VMetrics( face, glyph_index, (FT_Bool)!( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ), &top_bearing, &advance_height ); #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -980,40 +1026,62 @@ count = 0; if ( glyph_index < (FT_UInt)face->num_locations - 1 ) count = (FT_UInt)( face->glyph_locations[glyph_index + 1] - offset ); } if ( count == 0 ) { /* as described by Frederic Loyer, these are spaces, and */ /* not the unknown glyph. */ loader->bbox.xMin = 0; loader->bbox.xMax = 0; loader->bbox.yMin = 0; loader->bbox.yMax = 0; loader->pp1.x = 0; loader->pp2.x = loader->advance; 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; + + + if ( (error = TT_Vary_Get_Glyph_Deltas( (TT_Face)(loader->face), + glyph_index, + &deltas, + 4 ) ) ) + 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 ); loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); } #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER if ( loader->exec ) loader->exec->glyphSize = 0; #endif error = TT_Err_Ok; goto Exit; } loader->byte_len = (FT_Int)count; offset = loader->glyf_offset + offset; @@ -1027,48 +1095,40 @@ /* read first glyph header */ error = face->read_glyph_header( loader ); if ( error ) goto Fail; contours_count = loader->n_contours; count -= 10; loader->pp1.x = loader->bbox.xMin - loader->left_bearing; loader->pp1.y = 0; loader->pp2.x = loader->pp1.x + loader->advance; loader->pp2.y = 0; loader->pp3.x = 0; loader->pp3.y = loader->top_bearing + loader->bbox.yMax; 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 ); - } - /***********************************************************************/ /***********************************************************************/ /***********************************************************************/ /* if it is a simple glyph, load it */ if ( contours_count >= 0 ) { /* check that we can add the contours to the glyph */ error = FT_GlyphLoader_CheckPoints( gloader, 0, contours_count ); if ( error ) goto Fail; error = face->read_simple_glyph( loader ); if ( error ) goto Fail; #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER { @@ -1108,40 +1168,90 @@ FT_ULong ins_pos; /* position of composite instructions, if any */ #endif /* for each subglyph, read composite header */ start_point = gloader->base.outline.n_points; #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER start_contour = gloader->base.outline.n_contours; #endif error = face->read_composite_glyph( loader ); if ( error ) goto Fail; #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER ins_pos = loader->ins_pos; #endif 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 ) ) ) + 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)... */ /* */ if ( loader->load_flags & FT_LOAD_NO_RECURSE ) { /* set up remaining glyph fields */ FT_GlyphLoader_Add( gloader ); glyph->num_subglyphs = gloader->base.num_subglyphs; glyph->format = FT_GLYPH_FORMAT_COMPOSITE; glyph->subglyphs = gloader->base.subglyphs; goto Exit; } /*********************************************************************/ /*********************************************************************/ /*********************************************************************/ @@ -1549,47 +1659,47 @@ glyph->metrics.horiBearingX = bbox.xMin; glyph->metrics.horiBearingY = bbox.yMax; glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; /* don't forget to hint the advance when we need to */ if ( IS_HINTED( loader->load_flags ) ) glyph->metrics.horiAdvance = FT_PIX_ROUND( glyph->metrics.horiAdvance ); /* Now take care of vertical metrics. In the case where there is */ /* no vertical information within the font (relatively common), make */ /* up some metrics by `hand'... */ { FT_Short top_bearing; /* vertical top side bearing (EM units) */ FT_UShort advance_height; /* vertical advance height (EM units) */ FT_Pos left; /* scaled vertical left side bearing */ 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 { /* Make up the distances from the horizontal header. */ /* NOTE: The OS/2 values are the only `portable' ones, */ /* which is why we use them, if there is an OS/2 */ /* table in the font. Otherwise, we use the */ /* values defined in the horizontal header. */ /* */ /* NOTE2: The sTypoDescender is negative, which is why */ /* we compute the baseline-to-baseline distance */ /* here with: */ /* ascender - descender + linegap */ /* */ /* NOTE3: This is different from what MS's rasterizer */ /* appears to do when getting default values */ /* for the vertical phantom points. We leave */ /* the old code untouched, but relying on */ /* phantom points alone might be reasonable */ Index: xc/extras/freetype2/src/truetype/ttgxvar.c =================================================================== RCS file: xc/extras/freetype2/src/truetype/ttgxvar.c diff -N xc/extras/freetype2/src/truetype/ttgxvar.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/extras/freetype2/src/truetype/ttgxvar.c 7 Mar 2005 18:53:59 -0000 @@ -0,0 +1,1520 @@ +/***************************************************************************/ +/* */ +/* ttgxvar.c */ +/* */ +/* TrueType GX Font Variation loader */ +/* */ +/* 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. */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* 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; + + + *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; + points[i++] = first = FT_GET_USHORT(); + + /* first point not included in runcount */ + for ( j = 0; j < runcnt; ++j ) + points[i++] = ( first += FT_GET_USHORT() ); + } + else + { + points[i++] = first = FT_GET_BYTE(); + + for ( j = 0; j < runcnt; ++j ) + points[i++] = ( 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; + + + 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; + FT_ULong version; + FT_Long axisCount; + FT_Int i, j; + FT_ULong table_len; + + + blend->avar_checked = TRUE; + if ( ( error = face->goto_table( face, TTAG_avar, stream, &table_len ) ) ) + 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 ) ) ) + 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 != 0x00010000L || + gvar_head.axisCount != 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 < 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 ) ) ) + goto Exit; + if ( ( error = face->goto_table( face, TTAG_fvar, + stream, &table_len ) ) ) + goto Exit; + + fvar_start = FT_STREAM_POS( ); + + if ( FT_STREAM_READ_FIELDS( fvar_fields, &fvar_head ) ) + goto Exit; + + if ( fvar_head.version != 0x00010000UL || + 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] = a->tag >> 24; + a->name[1] = ( a->tag >> 16 ) & 0xFF; + a->name[2] = ( a->tag >> 8 ) & 0xFF; + a->name[3] = ( 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) ) ) + 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 ) ) ) + 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 ) ) ) + 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 < 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, + 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_MulFix( deltas[j], apply ); + } + + else + { + for ( j = 0; j < point_count; ++j ) + face->cvt[localpoints[j]] += 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; + 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 ( ( error = 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, + 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 */ Index: xc/extras/freetype2/src/truetype/ttgxvar.h =================================================================== RCS file: xc/extras/freetype2/src/truetype/ttgxvar.h diff -N xc/extras/freetype2/src/truetype/ttgxvar.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ xc/extras/freetype2/src/truetype/ttgxvar.h 7 Mar 2005 18:54:00 -0000 @@ -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 */ Index: xc/extras/freetype2/src/truetype/ttobjs.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttobjs.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ttobjs.c --- xc/extras/freetype2/src/truetype/ttobjs.c 28 Apr 2004 10:39:07 -0000 1.3 +++ xc/extras/freetype2/src/truetype/ttobjs.c 7 Mar 2005 18:54:00 -0000 @@ -1,59 +1,63 @@ /***************************************************************************/ /* */ /* ttobjs.c */ /* */ /* Objects manager (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, */ /* 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_CALC_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H #include "ttgload.h" #include "ttpload.h" #include "tterrors.h" #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #include "ttinterp.h" #endif #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING #include FT_TRUETYPE_UNPATENTED_H #endif +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include "ttgxvar.h" +#endif + /*************************************************************************/ /* */ /* 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_ttobjs #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER /*************************************************************************/ /* */ /* GLYPH ZONE FUNCTIONS */ /* */ /*************************************************************************/ /*************************************************************************/ @@ -144,48 +148,49 @@ /* <Description> */ /* Initializes a given TrueType face object. */ /* */ /* <Input> */ /* stream :: The source font stream. */ /* */ /* face_index :: The index of the font face in the resource. */ /* */ /* num_params :: Number of additional generic parameters. Ignored. */ /* */ /* params :: Additional generic parameters. Ignored. */ /* */ /* <InOut> */ /* face :: The newly built face object. */ /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ 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 ) { FT_Error error; FT_Library library; SFNT_Service sfnt; + TT_Face face = (TT_Face)ttface; library = face->root.driver->root.library; sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) goto Bad_Format; /* create input stream from resource */ if ( FT_STREAM_SEEK( 0 ) ) goto Exit; /* check that we have a valid TrueType file */ error = sfnt->init_face( stream, face, face_index, num_params, params ); if ( error ) goto Exit; /* We must also be able to accept Mac/GX fonts, as well as OT ones */ if ( face->format_tag != 0x00010000L && /* MS fonts */ face->format_tag != TTAG_true ) /* Mac fonts */ { @@ -248,95 +253,102 @@ return error; Bad_Format: error = TT_Err_Unknown_File_Format; goto Exit; } /*************************************************************************/ /* */ /* <Function> */ /* tt_face_done */ /* */ /* <Description> */ /* Finalizes a given face object. */ /* */ /* <Input> */ /* 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; SFNT_Service sfnt = (SFNT_Service)face->sfnt; /* for `extended TrueType formats' (i.e. compressed versions) */ if ( face->extra.finalizer ) face->extra.finalizer( face->extra.data ); if ( sfnt ) sfnt->done_face( face ); /* freeing the locations table */ FT_FREE( face->glyph_locations ); face->num_locations = 0; /* freeing the CVT */ FT_FREE( face->cvt ); face->cvt_size = 0; /* freeing the programs */ FT_FRAME_RELEASE( face->font_program ); 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 } /*************************************************************************/ /* */ /* SIZE FUNCTIONS */ /* */ /*************************************************************************/ /*************************************************************************/ /* */ /* <Function> */ /* tt_size_init */ /* */ /* <Description> */ /* Initializes a new TrueType size object. */ /* */ /* <InOut> */ /* size :: A handle to the size object. */ /* */ /* <Return> */ /* 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; #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER TT_Face face = (TT_Face)size->root.face; FT_Memory memory = face->root.memory; FT_Int i; TT_ExecContext exec; FT_UShort n_twilight; TT_MaxProfile* maxp = &face->max_profile; size->ttmetrics.valid = FALSE; size->max_function_defs = maxp->maxFunctionDefs; size->max_instruction_defs = maxp->maxInstructionDefs; size->num_function_defs = 0; @@ -459,62 +471,63 @@ error = TT_Err_Ok; TT_Save_Context( exec, size ); if ( !size->debug ) TT_Done_Context( exec ); #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ size->ttmetrics.valid = FALSE; return error; #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER Fail_Exec: if ( !size->debug ) TT_Done_Context( exec ); Fail_Memory: - tt_size_done( size ); + tt_size_done( ttsize ); return error; #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ } /*************************************************************************/ /* */ /* <Function> */ /* tt_size_done */ /* */ /* <Description> */ /* The TrueType size object finalizer. */ /* */ /* <Input> */ /* 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 FT_Memory memory = size->root.face->memory; if ( size->debug ) { /* the debug context must be deleted by the debugger itself */ size->context = NULL; size->debug = FALSE; } FT_FREE( size->cvt ); size->cvt_size = 0; /* free storage area */ FT_FREE( size->storage ); size->storage_size = 0; @@ -825,62 +838,64 @@ else return error; } /*************************************************************************/ /* */ /* <Function> */ /* tt_driver_init */ /* */ /* <Description> */ /* Initializes a given TrueType driver object. */ /* */ /* <Input> */ /* driver :: A handle to the target driver object. */ /* */ /* <Return> */ /* 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; /* set `extra' in glyph loader */ error = FT_GlyphLoader_CreateExtra( FT_DRIVER( driver )->glyph_loader ); return error; } /*************************************************************************/ /* */ /* <Function> */ /* tt_driver_done */ /* */ /* <Description> */ /* Finalizes a given TrueType driver. */ /* */ /* <Input> */ /* 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 ) { TT_Destroy_Context( driver->context, driver->root.root.memory ); driver->context = NULL; } #else - FT_UNUSED( driver ); + FT_UNUSED( ttdriver ); #endif } /* END */ Index: xc/extras/freetype2/src/truetype/ttobjs.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttobjs.h,v retrieving revision 1.3 diff -u -2 -0 -r1.3 ttobjs.h --- xc/extras/freetype2/src/truetype/ttobjs.h 28 Apr 2004 10:39:07 -0000 1.3 +++ xc/extras/freetype2/src/truetype/ttobjs.h 7 Mar 2005 18:54:00 -0000 @@ -363,66 +363,75 @@ #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ } TT_SizeRec; /*************************************************************************/ /* */ /* TrueType driver class. */ /* */ typedef struct TT_DriverRec_ { FT_DriverRec root; TT_ExecContext context; /* execution context */ TT_GlyphZoneRec zone; /* glyph loader points zone */ void* extension_component; } 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 */ /*************************************************************************/ /* */ /* 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 ); /*************************************************************************/ /* */ /* 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 #endif /* __TTOBJS_H__ */ /* END */ Index: xc/extras/freetype2/src/truetype/ttpload.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/truetype/ttpload.c,v retrieving revision 1.1.1.2 diff -u -2 -0 -r1.1.1.2 ttpload.c --- xc/extras/freetype2/src/truetype/ttpload.c 25 Nov 2003 19:27:23 -0000 1.1.1.2 +++ xc/extras/freetype2/src/truetype/ttpload.c 7 Mar 2005 18:54:00 -0000 @@ -1,46 +1,50 @@ /***************************************************************************/ /* */ /* ttpload.c */ /* */ /* TrueType glyph data/program tables loader (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, */ /* 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_OBJECTS_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include "ttpload.h" +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT +#include "ttgxvar.h" +#endif + #include "tterrors.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_ttpload /*************************************************************************/ /* */ /* <Function> */ /* tt_face_load_loca */ /* */ /* <Description> */ /* Loads the locations table. */ @@ -169,40 +173,45 @@ face->cvt_size = table_len / 2; if ( FT_NEW_ARRAY( face->cvt, face->cvt_size ) ) goto Exit; if ( FT_FRAME_ENTER( face->cvt_size * 2L ) ) goto Exit; { FT_Short* cur = face->cvt; FT_Short* limit = cur + face->cvt_size; for ( ; cur < limit; cur++ ) *cur = FT_GET_SHORT(); } 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; } /*************************************************************************/ /* */ /* <Function> */ /* tt_face_load_fpgm */ /* */ /* <Description> */ /* Loads the font program and the cvt program. */ /* */ /* <InOut> */ /* face :: A handle to the target face object. */ /* */ /* <Input> */ /* stream :: A handle to the input stream. */ /* */ /* <Return> */ Index: xc/extras/freetype2/src/type1/t1driver.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/type1/t1driver.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 t1driver.c --- xc/extras/freetype2/src/type1/t1driver.c 28 Apr 2004 10:39:08 -0000 1.3 +++ xc/extras/freetype2/src/type1/t1driver.c 7 Mar 2005 18:54:00 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* t1driver.c */ /* */ /* 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, */ /* 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 "t1driver.h" #include "t1gload.h" #include "t1load.h" #include "t1errors.h" #ifndef T1_CONFIG_OPTION_NO_AFM #include "t1afm.h" @@ -112,43 +112,45 @@ static const char* t1_get_ps_name( T1_Face face ) { return (const char*) face->type1.font_name; } static const FT_Service_PsFontNameRec t1_service_ps_name = { (FT_PsName_GetFunc)t1_get_ps_name }; /* * MULTIPLE MASTERS SERVICE * */ #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 /* * POSTSCRIPT INFO SERVICE * */ static FT_Error t1_ps_get_font_info( FT_Face face, PS_FontInfoRec* afont_info ) { *afont_info = ((T1_Face)face)->type1.font_info; return 0; } static FT_Int t1_ps_has_glyph_names( FT_Face face ) Index: xc/extras/freetype2/src/type1/t1gload.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/type1/t1gload.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 t1gload.c --- xc/extras/freetype2/src/type1/t1gload.c 28 Apr 2004 10:39:08 -0000 1.3 +++ xc/extras/freetype2/src/type1/t1gload.c 7 Mar 2005 18:54:01 -0000 @@ -43,41 +43,41 @@ /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/ /********** *********/ /********** The following code is in charge of computing *********/ /********** the maximum advance width of the font. It *********/ /********** quickly processes each glyph charstring to *********/ /********** extract the value from either a `sbw' or `seac' *********/ /********** operator. *********/ /********** *********/ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ FT_LOCAL_DEF( FT_Error ) T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder, FT_UInt glyph_index, FT_Data* char_string ) { 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; decoder->font_offset = type1->font_offset; #ifdef FT_CONFIG_OPTION_INCREMENTAL /* For incremental fonts get the character data using the */ /* callback function. */ if ( face->root.internal->incremental_interface ) error = face->root.internal->incremental_interface->funcs->get_glyph_data( face->root.internal->incremental_interface->object, glyph_index, char_string ); else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ /* For ordinary fonts get the character data stored in the face record. */ { char_string->pointer = type1->charstrings[glyph_index]; Index: xc/extras/freetype2/src/type1/t1load.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/type1/t1load.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 t1load.c --- xc/extras/freetype2/src/type1/t1load.c 28 Apr 2004 10:39:08 -0000 1.3 +++ xc/extras/freetype2/src/type1/t1load.c 7 Mar 2005 18:54:02 -0000 @@ -194,40 +194,193 @@ master->num_designs = blend->num_designs; for ( n = 0; n < blend->num_axis; n++ ) { FT_MM_Axis* axis = master->axis + n; PS_DesignMap map = blend->design_map + n; axis->name = blend->axis_names[n]; axis->minimum = map->design_points[0]; axis->maximum = map->design_points[map->num_points - 1]; } error = T1_Err_Ok; } return error; } +#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, FT_Fixed* coords ) { PS_Blend blend = face->blend; FT_Error error; FT_UInt n, m; error = T1_Err_Invalid_Argument; if ( blend && blend->num_axis == num_coords ) { /* recompute the weight vector from the blend coordinates */ error = T1_Err_Ok; for ( n = 0; n < blend->num_designs; n++ ) { FT_Fixed result = 0x10000L; /* 1.0 fixed */ @@ -263,48 +416,48 @@ FT_UInt num_coords, FT_Long* coords ) { PS_Blend blend = face->blend; FT_Error error; FT_UInt n, p; error = T1_Err_Invalid_Argument; if ( blend && blend->num_axis == num_coords ) { /* compute the blend coordinates through the blend design map */ FT_Fixed final_blends[T1_MAX_MM_DESIGNS]; for ( n = 0; n < blend->num_axis; n++ ) { 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? */ if ( design == p_design ) { the_blend = blends[p]; goto Found; } if ( design < p_design ) { after = p; break; } before = p; } /* now interpolate if necessary */ if ( before < 0 ) @@ -312,40 +465,67 @@ else if ( after < 0 ) the_blend = blends[map->num_points - 1]; else the_blend = FT_MulDiv( design - designs[before], blends [after] - blends [before], designs[after] - designs[before] ); Found: final_blends[n] = the_blend; } error = T1_Set_MM_Blend( face, num_coords, final_blends ); } return error; } + /*************************************************************************/ + /* */ + /* 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 ) { FT_Memory memory = face->root.memory; PS_Blend blend = face->blend; if ( blend ) { FT_UInt num_designs = blend->num_designs; FT_UInt num_axis = blend->num_axis; FT_UInt n; /* release design pos table */ FT_FREE( blend->design_pos[0] ); for ( n = 1; n < num_designs; n++ ) blend->design_pos[n] = 0; /* release blend `private' and `font info' dictionaries */ Index: xc/extras/freetype2/src/type1/t1load.h =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/type1/t1load.h,v retrieving revision 1.1.1.1 diff -u -2 -0 -r1.1.1.1 t1load.h --- xc/extras/freetype2/src/type1/t1load.h 14 Nov 2003 16:48:24 -0000 1.1.1.1 +++ xc/extras/freetype2/src/type1/t1load.h 7 Mar 2005 18:54:02 -0000 @@ -1,27 +1,27 @@ /***************************************************************************/ /* */ /* t1load.h */ /* */ /* 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, */ /* 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 __T1LOAD_H__ #define __T1LOAD_H__ #include <ft2build.h> #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include FT_MULTIPLE_MASTERS_H @@ -43,42 +43,51 @@ PS_TableRec glyph_names; PS_TableRec charstrings; PS_TableRec swap_table; /* For moving .notdef glyph to index 0. */ FT_Int num_subrs; PS_TableRec subrs; FT_Bool fontdata; } T1_LoaderRec, *T1_Loader; FT_LOCAL( FT_Error ) T1_Open_Face( T1_Face face ); #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT FT_LOCAL( FT_Error ) 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, FT_Fixed* coords ); FT_LOCAL( FT_Error ) T1_Set_MM_Design( T1_Face face, 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 ); #endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */ FT_END_HEADER #endif /* __T1LOAD_H__ */ /* END */ Index: xc/extras/freetype2/src/winfonts/winfnt.c =================================================================== RCS file: /cvs/xorg/xc/extras/freetype2/src/winfonts/winfnt.c,v retrieving revision 1.3 diff -u -2 -0 -r1.3 winfnt.c --- xc/extras/freetype2/src/winfonts/winfnt.c 28 Apr 2004 10:39:08 -0000 1.3 +++ xc/extras/freetype2/src/winfonts/winfnt.c 7 Mar 2005 18:54:02 -0000 @@ -449,46 +449,42 @@ if ( font->header.italic ) root->style_flags |= FT_STYLE_FLAG_ITALIC; if ( font->header.weight >= 800 ) root->style_flags |= FT_STYLE_FLAG_BOLD; /* set up the `fixed_sizes' array */ if ( FT_NEW_ARRAY( root->available_sizes, 1 ) ) goto Fail; root->num_fixed_sizes = 1; { FT_Bitmap_Size* bsize = root->available_sizes; bsize->width = font->header.avg_width; 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; } { FT_CharMapRec charmap; charmap.encoding = FT_ENCODING_NONE; charmap.platform_id = 0; charmap.encoding_id = 0; charmap.face = root; if ( font->header.charset == FT_WinFNT_ID_MAC ) { charmap.encoding = FT_ENCODING_APPLE_ROMAN; charmap.platform_id = 1; /* charmap.encoding_id = 0; */ } error = FT_CMap_New( fnt_cmap_class, NULL, @@ -536,41 +532,41 @@ else if ( root->style_flags & FT_STYLE_FLAG_ITALIC ) root->style_name = (char *)"Italic"; } goto Exit; Fail: FNT_Face_Done( face ); Exit: return error; } static FT_Error FNT_Size_Set_Pixels( FT_Size size ) { FNT_Face face = (FNT_Face)FT_SIZE_FACE( size ); 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; size->metrics.ascender = font->header.ascent * 64; size->metrics.descender = -( font->header.pixel_height - font->header.ascent ) * 64; size->metrics.height = font->header.pixel_height * 64; size->metrics.max_advance = font->header.max_width * 64; return FNT_Err_Ok; } else return FNT_Err_Invalid_Pixel_Size; } static FT_Error FNT_Load_Glyph( FT_GlyphSlot slot, FT_Size size, @@ -641,40 +637,42 @@ goto Exit; column = (FT_Byte*)bitmap->buffer; for ( ; pitch > 0; pitch--, column++ ) { FT_Byte* limit = p + bitmap->rows; for ( write = column; p < limit; p++, write += bitmap->pitch ) *write = *p; } } slot->internal->flags = FT_GLYPH_OWN_BITMAP; slot->bitmap_left = 0; slot->bitmap_top = font->header.ascent; 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; slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16; slot->format = FT_GLYPH_FORMAT_BITMAP; Exit: return error; } static FT_Error winfnt_get_header( FT_Face face, FT_WinFNT_HeaderRec *aheader ) { FNT_Font font = ((FNT_Face)face)->font; *aheader = font->header;