diff options
author | marha <marha@users.sourceforge.net> | 2013-06-21 10:45:51 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-06-21 10:48:19 +0200 |
commit | fa791414601df61d20d860299dba80fdb62565df (patch) | |
tree | eecc4c74bb78dece330009c571ed57d7f1aaede2 | |
parent | 7f9fb534564d0eb8a62cf444e569a07166e5ee03 (diff) | |
download | vcxsrv-fa791414601df61d20d860299dba80fdb62565df.tar.gz vcxsrv-fa791414601df61d20d860299dba80fdb62565df.tar.bz2 vcxsrv-fa791414601df61d20d860299dba80fdb62565df.zip |
Upgraded freetype to 2.5.0.1
300 files changed, 17824 insertions, 8922 deletions
diff --git a/freetype/ChangeLog b/freetype/ChangeLog index b5c7d13aa..5cda57a46 100644 --- a/freetype/ChangeLog +++ b/freetype/ChangeLog @@ -1,3 +1,1505 @@ +2013-06-19 Werner Lemberg <wl@gnu.org> + + * Version 2.5.0.1 released. + =========================== + + + Tag sources with `VER-2-5-0-1'. + + * include/freetype/config/ftoption.h: Undefine + CFF_CONFIG_OPTION_OLD_ENGINE. + * devel/ftoption.h: Define CFF_CONFIG_OPTION_OLD_ENGINE. + +2013-06-19 Werner Lemberg <wl@gnu.org> + + * builds/unix/install.mk (install): Don't create `cache' directory. + + Found by Peter Breitenlohner <peb@mppmu.mpg.de>. + +2013-06-19 Werner Lemberg <wl@gnu.org> + + * Version 2.5.0 released. + ========================= + + + Tag sources with `VER-2-5-0'. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.5.0. + + * README, Jamfile (RefDoc), + builds/win32/vc2005/freetype.vcproj, builds/win32/vc2005/index.html, + builds/win32/vc2008/freetype.vcproj, builds/win32/vc2008/index.html, + builds/win32/vc2010/freetype.vcxproj, builds/win32/vc2010/index.html, + builds/win32/visualc/freetype.dsp, + builds/win32/visualc/freetype.vcproj, + builds/win32/visualc/index.html, builds/win32/visualce/freetype.dsp, + builds/win32/visualce/freetype.vcproj, + builds/win32/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.4.12/2.5.0/, s/2412/250/. + + * include/freetype/freetype.h (FREETYPE_MINOR): Set to 5. + (FREETYPE_PATCH): Set to 0. + + * builds/unix/configure.raw (version_info): Set to 16:2:10. + + * src/base/ftobjs.c (FT_Open_Face): Pacify compiler. + * src/truetype/ttinterp.c (Ins_MSIRP, Ins_MIRP): Ditto. + +2013-06-18 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #39269. + + * src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Free memory in + case of reacollocation failures. + +2013-06-18 Andrew Church <achurch+savannah@achurch.org> + + Fix Savannah bug #39266. + + If memory allocations fail at certain points while opening a font, + FreeType can either crash due to a NULL dereference or leak memory. + + * include/freetype/internal/ftobjs.c (FT_Face_InternalRec, + FT_LibraryRec): Make `refcount' a signed integer. If, for example, + FT_Open_Face() fails in a memory allocation before the face's + reference count is set to 1, a subsequent `FT_Done_Library' call + would otherwise loop over `FT_Done_Face' 2^32 times before freeing + the face. + + * src/base/ftobjs.c (open_face): Initialize `stream' and friends + earlier. + (FT_Open_Face) <Fail>: Behave correctly if `node' is NULL. + (FT_Destroy_Module) <Fail>: Check that `renderer_clazz' is valid. + +2013-06-14 Werner Lemberg <wl@gnu.org> + + * src/smooth/ftgrays.c One final pragma to silence 64-bit MSVC. + +2013-06-06 Dave Arnold <darnold@adobe.com> + Werner Lemberg <wl@gnu.org> + + [cff] Add code to Adobe's engine to handle ppem > 2000. + + * src/cff/cffgload.c (cff_slot_load): If we get + FT_Err_Glyph_Too_Big, retry unhinted and scale up later on. + +2013-06-12 Werner Lemberg <wl@gnu.org> + + Another try on pragmas. + + * include/freetype/internal/ftdebug.h: Move pragmas to... + * include/freetype/internal/internal.h: ... this file since it gets + included by all source files. + * include/freetype/internal/ftserv.h: Remove pragma which has no + effect. + +2013-06-12 Werner Lemberg <wl@gnu.org> + + * include/freetype/internal/ftdebug.h: Disable MSVC warning C4127. + + This partially undoes commit 3f6e0e0c. + +2013-06-12 Werner Lemberg <wl@gnu.org> + + More compiler warning fixes. + + */*: Use cast to `FT_Bool' (or `Bool') where appropriate. + +2013-06-10 Werner Lemberg <wl@gnu.org> + + [truetype] Improve handling of broken sbit advance widths. + + * src/truetype/ttgload.c (TT_Load_Glyph): Use the glyph's (scaled) + `linearHoriAdvance' if the sbit's `horiAdvance' value is zero. + + Cf. font `Fixedsys Excelsior' v3.01 (FSEX300.ttf), glyph A, 16ppem. + +2013-06-10 Werner Lemberg <wl@gnu.org> + + [sfnt] Improve embedded bitmap tracing. + + * src/base/ftobjs.c (FT_Request_Size): Move trace message regarding + bitmap strike match to... + (FT_Match_Size): This function. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_metrics, + tt_sbit_decoder_load_byte_aligned, tt_sbit_decoder_load_bit_aligned, + tt_sbit_decoder_load_compound, tt_sbit_decoder_load_png, + tt_sbit_decoder_load_image): Decorate with tracing messages. + +2013-06-10 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #39160. + + * src/truetype/ttinterp.c (Ins_SDPVTL): Set projection vector too + for the degenerate case. + +2013-06-09 David Turner <digit@google.com> + + * src/cache/ftcmanag.c (FTC_Manager_Reset): Add missing cache flush. + + This code, present since eight(!) years in the unused `CACHE' + branch, has been forgotten to apply to the master branch. It's + really amazing that noone has ever complained since + `FTC_Manager_Reset' is pretty useless without flushing the cache. + +2013-06-07 Werner Lemberg <wl@gnu.org> + + Add and improve pragmas for MSVC compiler. + + * include/freetype/internal/ftdebug.h: Remove pragmas. + * include/freetype/internal/ftserv.h: Use push and pop for pragmas. + * include/freetype/internal/ftvalid.h: Handle warning C4324. + * src/base/ftobjs.c: Use push and pop for pragmas. + * src/gzip/ftgzip.c: Handle warning C4244. + +2013-06-07 Werner Lemberg <wl@gnu.org> + + [cff] s/cf2_getGlyphWidth/cf2_getGlyphOutline/. + + * src/cff/cf2font.c, src/cff/cf2font.h, src/cff/cf2ft.c: Do it. + +2013-06-06 Dave Arnold <darnold@adobe.com> + + [cff] Add early exit feature for width-only calls. + + This is for `FT_Get_Advance'. + + There are 7 places where the spec says the width can be defined: + + hstem/hstemhm + vstem/vstemhm + cntrmask/hintmask + hmoveto + vmoveto + rmoveto + endchar + + * src/cff/cf2intrp.c (cf2_doStems): Exit early for width-only calls, + if possible. + + (cf2_interpT2CharString) <cf2_cmdHSTEM>, <cf2_cmdVSTEM>, + <cf2_cmdVMOVETO>, <cf2_cmdENDCHAR>, <cf2_cmdHINTMASK>, + <cf2_cmdRMOVETO>, <cf2_cmdHMOVETO>: Exit early for width-only calls. + +2013-06-06 Werner Lemberg <wl@gnu.org> + + Next round of compiler fixes. + + * builds/win32/ftdebug.c, builds/wince/ftdebug.c (ft_debug_init): + Add proper cast. + + * include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Fix + cast. + * include/freetype/internal/ftstream.h: Decorate stream and frame + macros with `FT_Long' and `FT_ULong' as appropriate. + + * src/base/ftrfork.c (raccess_guess_darwin_hfsplus, + raccess_guess_darwin_newvfs): Use cast. + + * src/bdf/bdflib.c (_bdf_set_default_spacing): Use cast. + + * src/cache/ftcmanag.c (FTC_Manager_Check): Fix cast. + * src/cache/ftcmanag.h (FTC_ManagerRec): Ditto. + + * src/cff/cf2arrst.c (cf2_arrstack_setNum_Elements): Use cast. + * src/cff/cf2ft.c (cf2_freeSeacComponent): Ditto. + * src/cff/cffobjs.c (remove_subset_prefix, remove_style): Ditto. + + * src/cid/cidparse.c (cid_parser_new): Use cast. + + * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Use cast. + + * src/psaux/psobjs.c (reallocate_t1_table): Fix argument type. + + * src/raster/ftraster.c (ft_black_reset): Use cast. + + * src/truetype/ttgxvar.c (FT_Stream_FTell): Use cast. + (ALL_POINTS): Fix cast. + + * src/type1/t1driver.c (t1_ps_get_font_value): Add casts. + * src/type1/t1parse.c (T1_Get_Private_Dict): Add cast. + +2013-06-05 Dave Arnold <darnold@adobe.com> + + Fix more MSVC Win32 compiler warnings. + + * src/base/ftobjs.c: Fix typo in MS pragma. + + * src/base/bdflib.c (_bdf_set_default_spacing, _bdf_add_property): + `lineno' is only used in debug mode. + + * src/cff/cf2ft.c (cf2_builder_moveTo): `params' is only used in + debug mode. + +2013-06-05 Werner Lemberg <wl@gnu.org> + + Fix compiler warnings. + + * include/freetype/internal/ftmemory.h: Decorate memory allocation + macros with `FT_Long' where appropriate. + Remove duplicate of FT_MEM_QRENEW_ARRAY definition. + + * src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use + cast. + + * src/base/ftobjs.c: Add warning disabling pragma for MSVC while + including `md5.c'. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdESC>: Add + cast. + + * src/sfnt/ttsbit.c (tt_sbit_decoder_load_compound): Fix casts. + (tt_sbit_decoder_load_bitmap): Beautification. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Initialize + variables (earlier). + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Pacify compiler. + + * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use unsigned constants + where appropriate. + + * src/type1/t1load.c (T1_Get_MM_Var): Ditto. + +2013-06-04 Werner Lemberg <wl@gnu.org> + + * src/cff/cf2font.c (cf2_getGlyphWidth): Initialize `advWidth'. + + Problem reported by Ingmar Sittl <ingmar.sittl@elektrobit.com>. + +2013-06-04 Werner Lemberg <wl@gnu.org> + + Apply fixes for cppcheck nitpicks. + + http://cppcheck.sourceforge.net/ + + The call was (from the top-level of the FreeType tree): + + cppcheck --force \ + --enable=all \ + -I include \ + -I include/freetype/ \ + -I include/freetype/config/ \ + -I include/freetype/internal/ \ + . &> cppcheck.log + + Note that the current version heavily chokes on FreeType, delivering + many wrong results. I will report those issues to the cppcheck team + so that a newer version gives improved results hopefully. + + */* Improve variable scopes. + */* Remove redundant initializations which get overwritten. + + * src/base/ftmac.c ,builds/mac/ftmac.c (count_faces_scalable): + Remove unused variable. + + * src/base/ftdbgmem.c (ft_mem_table_destroy): `table' can't be zero. + + * src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt1_entry_validate): + Remove functionless code. + + * src/tools/ftrandom.c (main): Fix memory leak. + +2013-06-03 Werner Lemberg <wl@gnu.org> + + Add CFF_CONFIG_OPTION_OLD_ENGINE configuration option. + + This controls whether the old FreeType CFF engine gets compiled into + FreeType. It is now disabled by default. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (CFF_CONFIG_OPTION_OLD_ENGINE): New macro. + + * src/cff/cffdrivr.c (cff_property_set), src/cff/cffgload.c + (CFF_Operator, cff_argument_counts, cff_builder_add_point, + cff_operator_seac, cff_decoder_parse_charstrings, cff_slot_load), + src/cff/cffgload.h, src/cff/cffobjs.c (cff_driver_init): Use + CFF_CONFIG_OPTION_OLD_ENGINE to guard the affected code. + + * docs/CHANGES: Updated. + +2013-06-02 Werner Lemberg <wl@gnu.org> + + Fix PNG library handling. + + * builds/unix/configure.raw: Don't use LIBPNG_LIBS but + LIBPNG_LDFLAGS. + +2013-05-23 Behdad Esfahbod <behdad@google.com> + + Add support for color embedded bitmaps (eg. color emoji). + + A new load flag, FT_LOAD_COLOR, makes FreeType load color + embedded-bitmaps, following this draft specification + + https://color-emoji.googlecode.com/git/specification/v1.html + + which defines two new SFNT tables, `CBDT' and `CBLC' (named and + modeled after `EBDT' and `EBLC', respectively). The color bitmaps + are stored in the new FT_PIXEL_MODE_BGRA format to represent BGRA + pre-multiplied sRGB images. If PNG support is available, PNG color + images as defined in the same proposed specification are supported + also. + + Note that color bitmaps are converted to grayscale if client didn't + ask for color. + + * builds/unix/configure.raw: Search for libpng. + Add `--without-png' option. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (FT_CONFIG_OPTION_USE_PNG): New macro. + + * include/freetype/freetype.h (FT_LOAD_COLOR): New load flag. + + * include/freetype/ftimage.h (FT_Pixel_Mode): Add + `FT_PIXEL_MODE_BGRA'. + + * include/freetype/tttags.h (TTAG_CBDT, TTAG_CBLC): New tags. + + * src/base/ftbitmap.c (FT_Bitmap_Embolden): Updated. + (ft_gray_for_premultiplied_srgb_bgra): New function. + (FT_Bitmap_Convert): Handle FT_PIXEL_MODE_BGRA. + + * src/sfnt/pngshim.c, src/sfnt/pngshim.h: New files. + + * src/sfnt/sfnt.c: Include `pngshim.c'. + + * src/sfnt/ttsbit.c: Include FT_BITMAP_H and `pngshim.h' + (tt_face_load_eblc): Load `CBLC'. + (tt_sbit_decoder_init): Load `CBDT'. + (tt_sbit_decoder_alloc_bitmap): Pass load flags to select between + color and grayscale bitmaps. + Set `num_grays'. This is used by `ftview' to choose the blending + algorithm. + (tt_sbit_decoder_load_byte_aligned, + tt_sbit_decoder_load_bit_aligned, tt_sbit_decoder_load_compound, + tt_sbit_decoder_load_image): Pass load flag. + s/write/pwrite/. + Don't call `tt_sbit_decoder_alloc_bitmap'. + Updated. + (tt_sbit_decoder_load_png) [FT_CONFIG_OPTION_USE_PNG]: New function. + (tt_sbit_decoder_load_bitmap): Pass load flag. + Handle new glyph formats 17, 18, and 19. + Call `tt_sbit_decoder_alloc_bitmap'. + Flatten color bitmaps if necessary. + (tt_face_load_sbit_image): Updated. + + * src/sfnt/rules.mk (SFNT_DRV_SRC): Add `pngshim.c'. + + * docs/CHANGES: Updated. + +2013-05-24 Guenter <info@gknw.net> + + Apply Savannah patch #8055. + + Make `apinames' create an import file for NetWare. + + * src/tools/apinames.c (PROGRAM_VERSION): Set to 0.2. + (OutputFormat): Add `OUTPUT_NETWARE_IMP'. + (names_dump): Handle it. + (usage): Updated. + (main): Handle new command line flag `-wN'. + +2013-05-23 Behdad Esfahbod <behdad@behdad.org> + + Compilation fix. + + * src/truetype/ttinterp.c (TT_RunIns) + [!TT_CONFIG_OPTION_SUBPIXEL_HINTING]: Make it work. + +2013-05-22 Infinality <infinality@infinality.net> + + [truetype] Formatting and an additional subpixel tweak. + + * src/truetype/ttinterp.c (Ins_SHPIX): Formatting fix. + * src/truetype/ttsubpix.c (SKIP_NONPIXEL_Y_MOVES_Rules): + Revert previous modification for Verdana clones. + +2013-05-22 Infinality <infinality@infinality.net> + + [truetype] Adjust subpixel zp2 moves and tweak rules. + + These modifications fix thin diagonal stems in some legacy fonts. + + * src/truetype/ttinterp.c (Direct_Move_X): Remove unused macro. + (Move_Zp2_Point): Don't always disable x moves for subpixel rendering. + (Ins_SHP): Disable x moves here for subpixel rendering. + (Ins_SHPIX): Only disable x moves in compatibility mode. + Split out zp2 move reversals and reorder conditional respectively. + + * src/truetype/ttsubpix.c (SKIP_NONPIXEL_Y_MOVES_Rules): Fix oversight. + Only adjust Verdana clones for 17 ppem. + (SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions): Add Courier New. + (ALWAYS_SKIP_DELTAP_Rules): Found additional cases for Arial `s'. + +2013-05-20 Infinality <infinality@infinality.net> + + [truetype] Simplify and improve subpixel function detection. + + Some small enhancements have allowed the removal of many macros and + the simplification of existing rules in `ttsubpix.c'. + + * src/truetype/ttsubpix.h (SPH_TWEAK_ALLOW_X_DMOVEX, + SPH_TWEAK_ALLOW_X_MOVE_ZP2, + SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES, + SPH_TWEAK_SKIP_INLINE_DELTAS, SPH_TWEAK_MIRP_CVT_ZERO): Removed. + (SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP): New rule macro. + + * src/truetype/ttsubpix.c: Updated affected rules. + + * src/truetype/ttinterp.c (Direct_Move_X): Updated. + (INS_FDEF): Add additional function detection. + (INS_ENDF): Set runtime flag. + (Ins_CALL): Skip the call under certain conditions. + Remove bad code. + (Ins_LOOPCALL): Skip the call under certain conditions. + Remove bad code. + (Move_Zp2_Point): Updated. + (Ins_SHPIX): Updated. + Skip the move under some situations. + (Ins_MIAP): Improve conditions. + (Ins_MIRP): Updated. + (Ins_DELTAP): Skip move under certain conditions. + Simplify conditions. + (TT_RunIns): Updated. + Add code to handle new function detection. + Trace messages. + +2013-05-17 Werner Lemberg <wl@gnu.org> + + Update more FT_Err_XXX macros using FT_ERR and FT_THROW; + + * builds/amiga/src/base/ftsystem.c, builds/mac/ftmac.c, + builds/unix/ftsystem.c, builds/vms/ftsystem.c: Do it. + +2013-05-15 Werner Lemberg <wl@gnu.org> + + [truetype] Add `interpreter-version' property. + + This makes the option TT_CONFIG_OPTION_SUBPIXEL_HINTING controllable + at runtime. + + * include/freetype/ftttdrv.h: New file. + + * include/freetype/config/ftheader.h (FT_TRUETYPE_DRIVER_H): New + macro. + + * src/truetype/ttdriver.c: Include FT_TRUETYPE_DRIVER_H. + (tt_property_set, tt_property_get): Fill templates. + + * src/truetype/ttobjs.h (TT_DriverRec): Add `interpreter_version' + member. + Remove unused `extension_component' member. + + * src/truetype/ttgload.c: Include FT_TRUETYPE_DRIVER_H. + (tt_get_metrics, TT_Hint_Glyph, TT_Process_Simple_Glyph, + compute_glyph_metrics, tt_loader_init): Use `interpreter_version'. + + * src/truetype/ttinterp.c: Include FT_TRUETYPE_DRIVER_H. + (SUBPIXEL_HINTING): New macro to check `interpreter_version' flag. + Update all affected functions to use it. + Use TT_INTERPRETER_VERSION_XXX where appropriate. + + * src/truetype/ttobjs.c: Include FT_TRUETYPE_DRIVER_H. + (tt_driver_init): Initialize `interpreter_version'. + + * src/truetype/ttsubpix.c: Include FT_TRUETYPE_DRIVER_H. + Use TT_INTERPRETER_VERSION_XXX where appropriate. + +2013-05-13 Werner Lemberg <wl@gnu.org> + + [truetype] Avoid empty source file. + + * src/truetype/ttsubpix.c [!TT_CONFIG_OPTION_SUBPIXEL_HINTING]: + Provide dummy typedef. + +2013-05-13 Werner Lemberg <wl@gnu.org> + + * src/cff/cf2font.c (cf2_getGlyphWidth): Fix uninitialized variable. + + Fix suggested by Vaibhav Nagarnaik <vnagarnaik@gmail.com>. + +2013-05-13 Brian Nixon <bnixon@yahoo.com> + + Fix Savannah bug #38970. + + * src/base/ftdebug.c, builds/win32/ftdebug.c, + builds/wince/ftdebug.c, builds/amiga/src/base/ftdebug.c + (ft_debug_init): Don't read past the environment variable FT2_DEBUG. + +2013-05-12 Werner Lemberg <wl@gnu.org> + + [truetype] Add framework for TrueType properties. + + * src/truetype/ttdrivr.c: Include FT_SERVICE_PROPERTIES_H. + (tt_property_set, tt_property_get): New functions, still empty. + Define `tt_service_properties' service. + Update `tt_services'. + + * src/truetype/ttpic.h: Include FT_SERVICE_PROPERTIES_H. + (TT_SERVICE_PROPERTIES_GET): New macro. + (TTModulePIC): Add `tt_service_properties'. + +2013-05-12 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #38967. + + * src/base/ftcalc.c (FT_DivFix) [FT_LONG64]: Fix cast. + +2013-05-12 Werner Lemberg <wl@gnu.org> + + Introduce unsigned 64bit type (if available). + + * include/freetype/config/ftconfig.h: Define FT_UINT64 if available. + [FT_LONG64]: Provide FT_UInt64. + + * builds/unix/ftconfig.in: Synchronized. + +2013-05-12 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #38968. + + * include/freetype/ftmodapi.h: Add `FT_EXPORT' to + FT_Property_{Set,Get}. + * src/base/ftobjs.c: Add `FT_EXPORT_DEF' to + FT_Property_{Set,Get}. + +2013-05-10 Werner Lemberg <wl@gnu.org> + + [sfnt] Clean up bitmap code. + + * src/sfnt/ttsbit.c: Deleted. + * src/sfnt/ttsbit0.c: Renamed to `ttsbit.c'. + * rules.mk (SFNT_DRV_H): Updated. + +2013-05-10 Werner Lemberg <wl@gnu.org> + + */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code. + +2013-05-08 Werner Lemberg <wl@gnu.org> + + * Version 2.4.12 released. + ========================== + + + Tag sources with `VER-2-4-12'. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.4.12. + + * README, Jamfile (RefDoc), + builds/win32/vc2005/freetype.vcproj, builds/win32/vc2005/index.html, + builds/win32/vc2008/freetype.vcproj, builds/win32/vc2008/index.html, + builds/win32/vc2010/freetype.vcxproj, builds/win32/vc2010/index.html, + builds/win32/visualc/freetype.dsp, + builds/win32/visualc/freetype.vcproj, + builds/win32/visualc/index.html, builds/win32/visualce/freetype.dsp, + builds/win32/visualce/freetype.vcproj, + builds/win32/visualce/index.html, + builds/wince/vc2005-ce/freetype.vcproj, + builds/wince/vc2005-ce/index.html, + builds/wince/vc2008-ce/freetype.vcproj, + builds/wince/vc2008-ce/index.html: s/2.4.11/2.4.12/, s/2411/2412/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 12. + + * builds/unix/configure.raw (version_info): Set to 16:1:10. + +2013-05-08 Werner Lemberg <wl@gnu.org> + + * docs/CHANGES: Updated. + +2013-05-08 Werner Lemberg <wl@gnu.org> + + * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Typo. + +2013-05-05 Werner Lemberg <wl@gnu.org> + + Synchronize `ftconfig.h'. + + * builds/unix/ftconfig.in: Updated. + +2013-05-05 Werner Lemberg <wl@gnu.org> + + Fix compilation with C++. + + * src/base/md5.c (body): Use proper cast. + +2013-05-05 Werner Lemberg <wl@gnu.org> + + Fix 64bit compilation issues. + + * include/freetype/config/ftconfig.h [FT_LONG64]: Typedef + `FT_Int64' here. + + * src/base/ftcalc.c: Remove typedef of `FT_Int64'. + (FT_DivFix): Fix cast. + * src/base/fttrigon.c: Remove typedef of `FT_Int64'. + +2013-05-05 Werner Lemberg <wl@gnu.org> + + [raster] Fix clang issues. + + Fix suggested by <octoploid@yandex.com>. + + * src/raster/ftraster.c (ULong): New typedef. + (SCALED): Add proper cast. + +2013-05-04 Werner Lemberg <wl@gnu.org> + + Fix clang fixes. + + * src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate): Use + correct types. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) <default>: Force + unsigned for computations. + * src/cff/cffgload.c (cff_decoder_parse_charstrings): Ditto. + * src/cff/cffparse.c (cff_parse_integer): Ditto. + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto. + +2013-05-04 Werner Lemberg <wl@gnu.org> + + [cff] Make Adobe CFF engine work correctly on 64bit hosts. + + Reported by numerous people on the `freetype-devel' list. Without + this fix, glyphs aren't properly aligned on a common baseline. + + On 64bit systems, `FT_Pos' expands to `long int', having a width of + 64bit. `CF2_Fixed' expands to `int' which is normally 32bit wide on + 64bit hosts also. Wrong casts filled up the blues arrays with + incorrect values. Note that all blues values are accessed with the + `cf2_blueToFixed' macro which handles the 64bit to 32bit conversion. + + * src/cff/cf2ft.h (cf2_getBlueValues, cf2_getOtherBlues, + cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Use `FT_Pos' for + `data', not `CF2_Fixed'. + * src/cff/cf2ft.c (cf2_getBlueValues, cf2_getOtherBlues, + cf2_getFamilyBlues, cf2_getFamilyOtherBlues): Updated. + * src/cff/cf2blues.c (cf2_blues_init): Updated. + +2013-05-04 Werner Lemberg <wl@gnu.org> + + More fixes for clang's `sanitize' feature. + + * src/base/ftcalc.c (FT_DivFix): Use unsigned values for + computations which use the left shift operator and convert to signed + as the last step. + * src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate, + FT_Vector_Length, FT_Vector_Polarize): Ditto. + + * src/cff/cffgload.c (cff_decoder_parse_charstrings): Simplify. + * src/cff/cffload.c (cff_subfont_load): Fix constant. + * src/cff/cffparse.c (cff_parse_integer, cff_parse_real, do_fixed, + cff_parse_fixed_dynamic): Use unsigned values for computations which + use the left shift operator and convert to signed as the last step. + + * src/cid/cidload.c (cid_get_offset): Ditto. + + * src/psaux/psconv.c (PS_Conv_ToFixed): Ditto. + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto. + + * src/truetype/ttinterp.c (TT_MulFix14, TT_DotFix14): Ditto. + +2013-05-04 Werner Lemberg <wl@gnu.org> + + Fix errors reported by clang's `sanitize' feature. + + * include/freetype/internal/ftstream.h: Simplify and fix integer + extraction macros. + (FT_INT8_, FT_BYTE_I16, FT_BYTE_I32, FT_INT8_I16, FT_INT8_I32, + FT_INT8_I32, FT_INT8_U32): Removed. + (FT_PEEK_SHORT, FT_PEEK_LONG, FT_PEEK_OFF3, FT_PEEK_SHORT_LE, + FT_PEEK_LONG_LE, FT_PEEK_OFF3_LE): Use unsigned values for + computations and convert to signed as the last step. + + * src/cff/cf2fixed.h (cf2_intToFixed, cf2_fixedToInt, + cf2_fracToFixed): Avoid shifts of negative values. + (cf2_intToFrac, cf2_fixedToFrac, cf2_fixedTo26Dot6): Removed, + unused. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdEXTENDEDNMBR, + default>: Use unsigned values for computations and convert to signed + as the last step. + Use proper types in tracing messages. + + * src/cff/cffgload.c (cff_decoder_parse_charstrings): Use unsigned + values for computation of operands and convert to signed as the last + step. + Use proper type in tracing message. + +2013-05-03 Werner Lemberg <wl@gnu.org> + + * src/cff/cf2blues.c: Remove dead code. + +2013-05-02 Chris Liddell <chris.liddell@artifex.com> + + * src/cff/cffgload.c: Include FT_CFF_DRIVER_H. + +2013-04-27 Werner Lemberg <wl@gnu.org> + + * docs/CHANGES: Updated. + * README: Improved. + +2013-04-13 Werner Lemberg <wl@gnu.org> + + [cff] Add a new Type 2 interpreter and hinter. + + This work, written by Dave Arnold <darnold@adobe.com> and fully + integrated into FreeType by me, is a donation by Adobe in + collaboration with Google. It is vastly superior to the old CFF + engine, and it will replace it soon. Right now, it is still off by + default, and you have to explicitly select it using the new + `hinting-engine' property of the cff driver. + + For convenience, (most of) the new files are committed separately. + + * include/freetype/config/ftheader.h (FT_CFF_DRIVER_H): New macro. + * include/freetype/ftcffdrv.h: New file to access CFF driver + properties. + * include/freetype/fterrdef.h (FT_Err_Glyph_Too_Big): New error + code. + * include/freetype/internal/fttrace.h: Add `cf2blues', `cf2hints', + and `cf2interp'. + + * src/cff/cffgload.h (CFF_SubFont): New member `current_subfont'. + * src/cff/cffobjs.h (CFF_DriverRec): New members `hinting_engine' + and `no_stem_darkening'. + * src/cff/cfftypes.h (CFF_FontRec): New member `cf2_instance'. + + * src/cff/cff.c: Include new files. + * src/cff/cffdrivr.c (cff_property_set, cff_property_get): Handle + `hinting-engine' and `no-stem-darkening' properties (only the Adobe + engine listens to them). + * src/cff/cffgload.c: Include `cf2ft.h'. + (cff_decoder_prepare): Initialize `current_subfont'. + (cff_build_add_point): Handle Adobe engine which uses 16.16 + coordinates. + (cff_slot_load): Handle FT_LOAD_NO_SCALE and FT_LOAD_NO_HINTING + separately. + Choose rendering engine based on `hinting_engine' property. + * src/cff/cffload.c (cff_font_done): Call finalizer of the Adobe + engine. + * src/cff/cffobjs.c: Include FT_CFF_DRIVER_H. + (cff_driver_init): Set default property values. + + * src/cff/rules.mk (CFF_DRV_SRC, CFF_DRV_H): Add new files. + + * src/cff/cf2*.*: New files, containing the Adobe engine. + +2013-04-12 Werner Lemberg <wl@gnu.org> + + [cff] Minor code administration issues. + + * src/cff/cffgload.c (check_points): Rename to... + (cff_check_points): ...this and make it FT_LOCAL. + (cff_builder_add_point, cff_builder_add_point1, + cff_builder_start_point, cff_builder_close_contour, + cff_lookup_glyph_by_stdcharcode, cff_get_glyph_data, + cff_free_glyph_data): Make them FT_LOCAL. + + * src/cff/cffgload.h: Updated. + +2013-04-12 Werner Lemberg <wl@gnu.org> + + Add output bitmap checksums. + + Use `FT2_DEBUG=bitmap:3' for tracing. + + * src/base/md5.c, src/base/md5.h: New files, taken from + + http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 + + * include/freetype/internal/fttrace.h: Add `bitmap'. + + * src/base/ftobjs.c [FT_DEBUG_LEVEL_TRACE]: Include `md5.c' + + (FT_Render_Glyph_Internal) [FT_DEBUG_LEVEL_TRACE]: For tracing, + convert resulting bitmap to a uniform format and compute a checksum. + Use `bitmap' category for the tracing message. + + * src/base/rules.mk (BASE_H): Updated. + + * docs/LICENSE.TXT: Updated. + +2013-04-12 Werner Lemberg <wl@gnu.org> + + [cff] Add framework for CFF properties. + + * include/freetype/internal/ftserv.h (FT_DEFINE_SERVICEDESCREC7): + New macro. + + * src/cff/cffdrivr.c: Include FT_SERVICE_PROPERTIES_H. + (cff_property_set, cff_property_get): New functions, still empty. + Define `cff_service_properties' service. + Update `cff_services'. + + * src/cff/cffpic.h: Include FT_SERVICE_PROPERTIES_H. + (CFF_SERVICE_PROPERTIES_GET): New macro. + (CffModulePIC): Add `cff_service_properties'. + +2013-04-03 Werner Lemberg <wl@gnu.org> + + [bdf] Fix Savannah bug #38589. + + * src/bdf/bdflib.c (_bdf_readstream): Thinko. + +2013-03-31 Werner Lemberg <wl@gnu.org> + + * configure: Use egrep, not grep. + + Problem reported Mojca Miklavec <mojca.miklavec.lists@gmail.com>. + +2013-03-29 Werner Lemberg <wl@gnu.org> + + * include/freetype/ftlcdfil.h: Add description of color filtering. + + Based on a contribution from Antti S. Lankila <alankila@bel.fi> + (Savannah bug #38607). + +2013-03-23 Werner Lemberg <wl@gnu.org> + + [autofit] Minor. + + * src/autofit/afmodule.c (af_property_set): Typo. + (af_autofitter_init, af_autofitter_done): Use cast. + +2013-03-21 Werner Lemberg <wl@gnu.org> + + * configure: Automatically test for `gmake' also. + + Suggested by Mojca Miklavec <mojca.miklavec.lists@gmail.com>. + +2013-03-21 Peter Breitenlohner <peb@mppmu.mpg.de> + + Respect CONFIG_SHELL from the environment. + + Some large packages using FreeType have to use a broken (deficient) + /bin/sh. The configure scripts (as generated by Autoconf) are + clever enough to find a better shell and put that one into the + environment variable CONFIG_SHELL. If that environment variable is + already set the script skips the test and assumes to be already + running under a good shell. + + * builds/unix/detect.mk: Honour CONFIG_SHELL. + * builds/unix/unix-def.in (SHELL): Define. + +2013-03-21 Werner Lemberg <wl@gnu.org> + + Fix Savannah patch #7971. + + * configure: Handle MAKE environment variable also. + +2013-03-17 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #38538. + + * builds/amiga/src/base/ftdebug.c, builds/win32/ftdebug.c, + builds/wince/ftdebug.c (FT_Throw): Add function. + +2013-03-17 Werner Lemberg <wl@gnu.org> + + [raster] Remove dead code. + + * src/raster/rastpic.c (ft_raster1_renderer_class_pic_init) + src/smooth/ftspic.c (ft_smooth_renderer_class_pic_init): Do it. + +2013-03-17 Werner Lemberg <wl@gnu.org> + + * src/pshinter/pshpic.h (GET_PIC): Use correct container. + +2013-03-15 Werner Lemberg <wl@gnu.org> + + * include/freetype/ftmoderr.h: Fix commit from 2013-03-11. + + The previous version was not backwards compatible. Reported by + Behdad. + +2013-03-14 Werner Lemberg <wl@gnu.org> + + */*: Use FT_ERR_EQ, FT_ERR_NEQ, and FT_ERR where appropriate. + + FT_Err_XXX and friends are no longer directly used in the source + code. + +2013-03-14 Werner Lemberg <wl@gnu.org> + + New error management macros. + + * include/freetype/fterrors.h (FT_ERR_XCAT, FT_ERR_CAT): Move to... + * include/freetype/fttypes.h: ... this file. + (FT_ERR, FT_ERR_EQ, FT_ERR_NEQ, FT_MODERR_EQ, FT_MODERR_NEQ): New + macros. + + * include/freetype/freetype.h: Updated. + +2013-03-14 Werner Lemberg <wl@gnu.org> + + */*: Use FT_Err_Ok only. + + This is a purely mechanical conversion. + +2013-03-14 Werner Lemberg <wl@gnu.org> + + */*: Use `FT_THROW'. + + This is essentially a mechanical conversion, adding inclusion of + `FT_INTERNAL_DEBUG_H' where necessary, and providing the macros for + stand-alone compiling modes of the rasterizer modules. + + To convert the remaining occurrences of FT_Err_XXX and friends it is + necessary to rewrite the code. Note, however, that it doesn't harm + if some cases are not handled since FT_THROW is a no-op. + +2013-03-13 Werner Lemberg <wl@gnu.org> + + Introduce `FT_THROW' macro. + + The idea is to replace code like + + return FT_Err_Foo_Bar; + + or + + return CFF_Err_Foo_Bar; + + with + + return FT_THROW( Foo_Bar ); + + The FT_THROW macro has two functions: + + . It hides the module specific prefix. + + . In debug mode, it calls the empty function `FT_Throw' which can + be thus used to set a breakpoint. + + * include/freetype/internal/ftdebug.h (FT_THROW): New macro. + (FT_Throw): New prototype. + * src/base/ftdebug.c (FT_Throw): New function. + +2013-03-12 Werner Lemberg <wl@gnu.org> + + Remove `FT_KEEP_ERR_PREFIX'. + + The idea is to always have FT_ERR_PREFIX available internally. + + * include/freetype/fterrors.h: Use FT2_BUILD_LIBRARY to guard + undefinition of FT_ERR_PREFIX + + * src/gxvalid/gxverror.h, src/otvalid/otverror.h, + src/sfnt/sferrors.h: Updated. + +2013-03-11 Werner Lemberg <wl@gnu.org> + + [gxvalid] Fix module error. + + * src/gxvalid/gxverror.h (FT_ERR_BASE): Define as + FT_Mod_Err_GXvalid. + * include/freetype/ftmoderr.h: Add module error for `GXvalid'. + +2013-03-11 Werner Lemberg <wl@gnu.org> + + Always use module related error codes. + + * src/cff/cffobjs.c (cff_face_init), src/type1/t1objs.c + (T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Use + `FT_ERROR_BASE'. + + * src/type1/t1load.c (parse_encoding): Use + T1_Err_Unknown_File_Format. + +2013-03-08 Werner Lemberg <wl@gnu.org> + + [cff] Set `linear{Hori,Vert}Advance' for embedded bitmaps also. + + Problem reported by Khaled Hosny <khaledhosny@eglug.org>. + + * src/cff/cffgload.c (cff_slot_load): Implement it. + +2013-02-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Fix commit ab02d9e8. + + * src/base/ftbbox.c (BBox_Cubic_Check): Change scaling to msb of 22. + +2013-02-19 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] New bisecting BBox_Cubic_Check (disabled). + + * src/base/ftbbox.c (BBox_Cubic_Check): New bisecting algorithm + for extremum search built around simple condition that defines + which half contains the extremum. + +2013-02-18 Alexei Podtelezhnikov <apodtele@gmail.com> + + [tools] Update BBox testing tool. + + * src/tools/test_bbox.c: Add another cubic outline with exact BBox. + (REPEAT): Increase the number of benchmarking cycles. + (profile_outline): Tweak output formatting. + +2013-02-02 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #38235. + + * builds/unix/configure.raw: Don't generate `freetype-config' and + `freetype.pc'. + + * builds/unix/unix-def.in (FT2_EXTRA_LIBS, LIBBZ2, LIBZ, + build_libtool_libs, ft_version): New variables to be substituted. + (freetype-config, freetype.pc): New rules to generate those files. + + * builds/unix/freetype-config.in: Remove code for handling `rpath'. + The use of $rpath has been accidentally removed in a patch from + 2009-12-22, and apparently noone has missed it since. + Use `%' instead of `@' as a variable substitution marker. + Use quotes. + + * builds/unix/freetype.in: Use `%' instead of `@' as a variable + substitution marker. + Use quotes. + +2013-02-07 Werner Lemberg <wl@gnu.org> + + * src/truetype/ttobjs.c (tt_size_run_prep): Reset more GS variables. + + BTW, Greg agrees that the OpenType specification is missing the list + of GS variables which will always be reset to the default values + after the `prep' table has been executed. + +2013-02-06 Werner Lemberg <wl@gnu.org> + + * src/truetype/ttobjs.c (tt_size_run_prep): Reset reference points. + + Up to now, we simply took a snapshot of the Graphics State after the + `prep' table has been executed, and right before a glyph's bytecode + was run it got reloaded. However, as Greg Hitchcock has told us in + private communication, reference points get reset to zero in the MS + rasterizer and we follow in due course. While reasonable, this is + undocumented behaviour. + + Most notably, this fixes the rendering of Arial's `x' glyph in + subpixel hinting mode. + +2013-02-05 Werner Lemberg <wl@gnu.org> + + [truetype] A better fix for Savannah bug #38211. + + * src/truetype/ttinterp.c (Ins_IP): Implement identical behaviour to + MS rasterizer if rp1 == rp2 (confirmed by Greg Hitchcock). + +2013-02-01 Alexei Podtelezhnikov <apodtele@gmail.com> + + [pcf] Streamline parsing of PCF encoding table. + + * src/pcf/pcfread.c (pcf_get_encodings): Use simpler double for-loop. + Reallocate array instead of using temporary storage. + +2013-02-01 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #38227. + + * builds/unix/freetype-config.in: Set LC_ALL. + +2013-02-01 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #38221. + + This complements commit 83c0ebab. + + * src/base/ftcalc.c (FT_MulDiv_No_Round): Don't enclose with + `TT_USE_BYTECODE_INTERPRETER'. + +2013-02-01 Werner Lemberg <wl@gnu.org> + + [truetype] Fix Savannah bug #38211. + + * src/truetype/ttinterp.c (Ins_IP): Make FreeType behave identical + to other interpreters if rp1 == rp2 (which is invalid). + +2013-01-28 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Small optimization of BBox calculation. + + * src/base/ftbbox.c (BBox_Cubic_Check): Use FT_MSB function in + scaling algorithm. + +2013-01-26 Infinality <infinality@infinality.net> + + [truetype] Minor formatting fix. + + * src/truetype/ttinterp.c: Updated. + (DO_RS): Fix indentation. + +2013-01-26 Infinality <infinality@infinality.net> + + [truetype] Fix rasterizer_version logic in sph. + + * src/truetype/ttsubpix.c: Updated. + (ALWAYS_SKIP_DELTAP_Rules): Remove rule for Trebuchet MS. + (sph_set_tweaks): Fix `rasterizer_version' logic. + +2013-01-26 Infinality <infinality@infinality.net> + + [truetype] Align more to ClearType whitepaper for sph. + + * include/freetype/internal/tttypes.h (TT_FaceRec): Add flags + for detected opcode patterns and compatibility mode. + + * src/truetype/ttgload.c (tt_loader_init): Complete conditional. + + * src/truetype/ttinterp.c: Updated. + Remove SPH_DEBUG and replace with FT_TRACE7. + (DO_RS): More conditions. + (Ins_FDEF): Add more opcode detection patterns. + More specific conditions when flagging an fdef. + Make compatibility mode only turn on when delta fdefs are found. + (Ins_CALL, Ins_LOOPCALL): Set flags for currently executed fdef. + (Ins_SHPIX): Remove logic to handle ttfautohinted fonts. + Simplify conditionals where possible. + Use `&' instead of `%' operator for dumb compilers. + (Ins_MIAP): Adjust twilight zone conditional. + Ensure `ignore_x_mode' is on when testing sph conditionals. + (Ins_MIRP): Ensure `ignore_x_mode' is on when testing sph + conditionals. + Do cvt cutin always when `ignore_x_mode' is active. + Remove test for ttfautohinted fonts. + (Ins_DELTAP): Ensure `ignore_x_mode' is on when testing sph + conditionals. + Do cvt cutin always when `ignore_x_mode' is active. + Remove test for ttfautohinted fonts. + Use `&' instead of `%' operator for dumb compilers. + (Ins_GETINFO): Remove SPH_DEBUG and replace with FT_TRACE7. + + * src/truetype/ttinterp.h: Updated. + (TT_ExecContextRec): Remove compatibility_mode variable. + Add variable to indicate when executing in special fdefs for sph. + + * src/truetype/ttobjs.h: Updated. + (TT_DefRecord): Add flags to identify special fdefs for sph. + (TT_SizeRec): Remove unnecessary ttfautohinted variable. + + * src/truetype/ttsubpix.c: Updated. + (COMPATIBILITY_MODE_Rules): Remove all. Auto-detected now. + (PIXEL_HINTING_Rules): Remove all. Unnecessary after fixes. + (SKIP_NONPIXEL_Y_MOVES_Rules): Remove Ubuntu. + (SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions): Add Arial Bold `N'. + (SKIP_OFFPIXEL_Y_MOVES_Rules): Remove all. Happens automatically + now. + (ROUND_NONPIXEL_Y_MOVES_Rules): Remove Ubuntu. + (ROUND_NONPIXEL_Y_MOVES_Rules_Exceptions): Remove all. + (NORMAL_ROUND_Rules): Remove Verdana. + (NO_DELTAP_AFTER_IUP_Rules): Remove all. + (sph_set_tweaks): Performance fix. Don't run prep always. + Adjust conditional for sph_compatibility_mode. + + * src/truetype/ttsubpix.h: Add new fdef flags for sph. + +2013-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Fix broken emboldening at small sizes. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Do not attempt to + normalize zero-length vectors. + +2013-01-25 Werner Lemberg <wl@gnu.org> + + Fix Savannah bug #38167. + + This fixes commit 83c0ebab from 2012-06-27. + + * src/truetype/ttinterp.h: + s/TT_CONFIG_OPTION_BYTECODE_INTERPRETER/TT_USE_BYTECODE_INTERPRETER/. + +2013-01-25 Xi Wang <xi.wang@gmail.com> + + [sfnt] Fix broken pointer overflow checks. + + Many compilers such as gcc and clang optimize away pointer overflow + checks `p + n < p', because pointer overflow is undefined behavior. + Use a safe form `n > p_limit - p' instead. + + Also avoid possible integer overflow issues, for example, using + `num_glyphs > ( p_limit - p ) / 2' rather than `num_glyphs * 2' + given a large `num_glyphs'. + + * src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): Implement it. + +2013-01-25 Werner Lemberg <wl@gnu.org> + + [base] Fix `make multi'. + + * src/base/ftoutln.c, src/base/fttrigon.c: Include + FT_INTERNAL_CALC_H. + +2013-01-25 David 'Digit' Turner <digit@google.com> + + [truetype] Fix C++ compilation. + + * src/truetype/ttsubpix.h: Updated. + (SPH_X_SCALING_RULES_SIZE): Moved and renamed to... + * src/truetype/ttsubpix.c (X_SCALING_RULES_SIZE): This. + (sph_X_SCALING_Rules): Removed. + (scale_test_tweak): Make function static. + (sph_test_tweak_x_scaling): New function. + + * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Updated. + +2013-01-23 Werner Lemberg <wl@gnu.org> + + [base] Make `FT_Hypot' really internal. + + * include/freetype/fttrigon.h (FT_Hypot): Move to... + * include/freetype/internal/ftcalc.h: This file. + + * src/base/fttrigon.c (FT_Hypot): Move to... + * src/base/ftcalc.c: This file. + Include FT_TRIGONOMETRY_H. + + * src/truetype/ttgload.c: Don't include FT_TRIGONOMETRY_H. + +2013-01-23 Werner Lemberg <wl@gnu.org> + + [truetype] Revert change from 2013-01-22. + + FreeType's `height' value is the baseline-to-baseline distance... + + * src/truetype/ttobjs.c (tt_size_reset): Undo. + +2013-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base, truetype] New internal `FT_Hypot' function. + + * include/freetype/fttrigon.h (FT_Hypot): Declare it. + * src/base/fttrigon.c (FT_Hypot): Define it. + * src/truetype/ttgload.c (TT_Process_Composite_Component): Use it + instead of explicit expressions. + * src/truetype/ttinterp.c (Current_Ratio, Normalize): Use it instead + of TT_VecLen. + (TT_VecLen): Removed. + +2013-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Fix integer overflow. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Normalize incoming and + outgoing vectors and use fixed point arithmetic. + +2013-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Fix integer overflow. + + * src/base/ftoutln.c (FT_Outline_Get_Orientation): Scale the + coordinates down to avoid overflow. + +2013-01-23 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Split out MSB function. + + * src/base/fttrigon.c (ft_trig_prenorm): Borrow from here. + * include/freetype/internal/ftcalc.h (FT_MSB): Declare here. + * src/base/ftcalc.c (FT_MSB): Define here. + +2013-01-22 Werner Lemberg <wl@gnu.org> + + [truetype] Fix font height. + + * src/truetype/ttobjs.c (tt_size_reset): The Windows rendering + engine uses rounded values of the ascender and descender to compute + the TrueType font height. + +2013-01-16 Behdad Esfahbod <behdad@behdad.org> + + [sfnt] Fix optimized sbit loader. + + It was not taking bit_depth into consideration when blitting! + + * src/sfnt/ttsbit0.c (tt_sbit_decoder_load_byte_aligned, + * tt_sbit_decoder_load_bit_aligned): Handle bit + depth. + +2013-01-16 David 'Digit' Turner <digit@google.com> + + [truetype] Improve sub-pixel code. + + This patches fixes many issues with the ttsubpix implementation. + + 1. Data tables are defined, instead of declared, in the header, and + thus copied into each source file that includes it. + + 2. These tables were defined as global, mutable, visible variables, + and thus costing private RAM to every process that loads the + library (> 50 KB / process, this is huge!). + + Additionally, this also made the library export the symbols + completely needlessly. + + 3. Missing `sph_' and `SPH_' prefixes to some of the definitions. + + Note that this doesn't try to fix the incredibly inefficient storage + format for the data tables used by the code. This one will require + another pass in the future. + + * src/truetype/ttinterp.h (MAX_NAME_SIZE, MAX_CLASS_MEMBERS): + Renamed to... + (SPH_MAX_NAME_SIZE, SPH_MAX_CLASS_MEMBERS): This. + Update all users. + + (SPH_TweakRule, SPH_ScaleRule): Decorate with `const' where + appropriate. + + (Font_Class): Rename to... + (SPH_Font_Class): This. Decorate with `const' where appropriate. + + * src/truetype/ttsubpix.h (scale_test_tweak, sph_test_tweak): + Decorate arguments with `const' where appropriate. + + Move font tweaking tables to... + + * src/truetype/ttsubpic.c: This file and decorate them with `static' + and `const' where appropriate. + + (X_SCALING_Rules, X_SCALING_RULES_SIZE): Renamed to... + (spu_X_SCALING_Rules, SPH_X_SCALING_RULES_SIZE): This. + Update all users. + +2013-01-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Improve accuracy of normalization of short vectors. + + Unit vector components are stored as 2.14 fixed-point numbers. In + order to calculate all 14 bits accurately, a short vector to be + normalized has to be upscaled to at least 14 bits before its length + is calculated. This has been safe since accurate CORDIC algorithms + were adopted. + + * src/truetype/ttinterp.c (Normalize): Scale short vectors by 0x4000. + +2013-01-12 Alexei Podtelezhnikov <apodtele@gmail.com> + + [truetype] Kill very old vector normalization hacks. + + Back in the days, vector length calculations were not very accurate + and the vector normalization function, Normalize, had to meticulously + correct the errors for long vectors [commit b7ef2b096867]. It was no + longer necessary after accurate CORDIC algorithms were adopted, but + the code remained. It is time to kill it. + + * src/truetype/ttinterp.c (Normalize): Remove error compensation. + (TT_VecLen): Remove any mention of old less accurate implementation. + +2013-01-11 Werner Lemberg <wl@gnu.org> + + Disable FT_CONFIG_OPTION_OLD_INTERNALS. + + After the next release we are going to remove the code completely. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (FT_CONFIG_OPTION_OLD_INTERNALS): Comment out. + * docs/CHANGES: Document it. + +2013-01-10 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Update the overflow protection bit. + + The recent optimizations of CORDIC iterations drastically reduce the + expansion factor. Vector components with MSB of 29 are now safe + from overflow. + + * src/base/fttrigon.c (FT_TRIG_SAFE_MSB): New macro. + (ft_trig_prenorm): Use it and remove dead code. + +2013-01-09 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base, pshinter] Use FT_ABS, FT_MIN, and FT_MAX for readability. + + * src/base/ftbbox.c: Updated. + * src/base/ftobjs.c: Updated. + * src/base/fttrigon.c: Updated. + * src/pshinter/pshalgo.c: Updated. + * src/pshinter/pshrec.c: Updated. + +2013-01-08 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Clean up trigonometric core. + + * src/base/fttrigon.c: Document the algorithm in a large comment. + (FT_TRIG_COSCALE): Remove macro. + (FT_Tan: Use `FT_TRIG_SCALE' instead. + (FT_Cos, FT_Vector_Unit): Ditto and round the return values. + +2013-01-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Use rounding in CORDIC iterations. + + * src/base/fttrigon.c (ft_trig_pseudo_rotate, + ft_trig_pseudo_polarize): Improve accuracy by rounding. + +2013-01-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + [base] Reduce trigonometric algorithms. + + After we get within 45 degrees by means of true 90-degree rotations, + we can remove initial 45-degree CORDIC iteration and start from + atan(1/2) pseudorotation, reducing expansion factor thereby. + + * src/base/fttrigon.c (FT_TRIG_SCALE, FT_TRIG_COSCALE): Update macros. + (ft_trig_pseudo_rotate, ft_trig_pseudo_polarize): Update. + + * src/tools/cordic.py: Bring up to date with trigonometric core. + + * docs/CHANGES: Old typo. + +2013-01-02 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/pshinter/pshalgo.h: Remove unused code. + +2012-12-27 Werner Lemberg <wl@gnu.org> + + * src/truetype/ttgload.c (tt_loader_init): Add more tracing. + +2012-12-23 Werner Lemberg <wl@gnu.org> + + [type1] Fix handling of /FontBBox in MM fonts. + Problem reported by Del Merritt <del@alum.mit.edu> + + If we have + + /FontBBox { { 11 12 13 14 15 16 17 18 } + { 21 22 23 24 25 26 27 28 } + { 31 32 33 34 35 36 37 38 } + { 41 42 43 44 45 46 47 48 } } + + in the /Blend dictionary, then the first BBox is { 11 21 31 41 }, + the second { 12 22 32 42 }, etc. + + * include/freetype/internal/psaux.h (T1_FieldType): Add + `T1_FIELD_TYPE_MM_BBOX' (for temporary use). + + * src/psaux/psobjs.c (ps_parser_load_field) <T1_FIELD_TYPE_MM_BBOX>: + Implement it. + +2012-12-21 Alexei Podtelezhnikov <apodtele@gmail.com> + + * src/tools/cordic.py: Bring up to date with trigonometric core. + +2012-12-21 Werner Lemberg <wl@gnu.org> + + Check parameters of `FT_Outline_New'. + Problem reported by Robin Watts <robin.watts@artifex.com>. + + * src/base/ftoutln.c (FT_Outline_New_Internal): Ensure that + `numContours' and `numPoints' fit into FT_Outline's `n_points' and + `n_contours', respectively. + 2012-12-20 Werner Lemberg <wl@gnu.org> * Version 2.4.11 released. @@ -25,7 +1527,7 @@ builds/wince/vc2008-ce/freetype.vcproj, builds/wince/vc2008-ce/index.html: s/2.4.10/2.4.11/, s/2410/2411/. - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 10. + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 11. * builds/unix/configure.raw (version_info): Set to 16:0:10. @@ -170,7 +1672,7 @@ The dot product between freeVector and projVector or cosine of the angle between these FT_F2Dot14 unit vectors used to be scaled up by 4 and routinely occupied 32 bits in an FT_Long field F_dot_P. - This patch scales the value down by 2^14 instead, which simplifies + This patch scales the value down by 2^14 instead, which simplifies its use throughout the bytecode interpreter. This does not lead to the loss of precision because the lower bits @@ -183,7 +1685,7 @@ Besides code simplification, this change can lead to better performance when FT_MulDiv with the scaled-down F_dot_P is less likely to use the costly 64-bit path. We are not changing the type - of F_dot_P to FT_F2Dot14 at this point. + of F_dot_P to FT_F2Dot14 at this point. * src/truetype/ttinterp.c (Compute_Funcs): Scale F_dot_P down by 14 bits and modify its use accordingly. @@ -389,7 +1891,7 @@ [truetype] Cheaper way to threshold angles between vectors. * src/truetype/ttinterp.c (Ins_ISECT): Thresholding tangent is a lot - cheaper than thresholding sine. + cheaper than thresholding sine. 2012-10-20 Werner Lemberg <wl@gnu.org> @@ -5426,7 +6928,7 @@ ---------------------------------------------------------------------------- -Copyright 2010-2012 by +Copyright 2010-2013 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, diff --git a/freetype/ChangeLog.23 b/freetype/ChangeLog.23 index bc46c84a0..1a23848f8 100644 --- a/freetype/ChangeLog.23 +++ b/freetype/ChangeLog.23 @@ -6668,7 +6668,7 @@ 2007-01-10 Derek Clegg <dclegg@apple.com> - * src/type1/t1load.c (T1_Get_MM_Var): Always return fixed point + * src/type1/t1load.c (T1_Get_MM_Var): Always return fixed-point values. 2007-01-08 David Turner <david@freetype.org> diff --git a/freetype/Jamfile b/freetype/Jamfile index b3d48279b..2fec5f106 100644 --- a/freetype/Jamfile +++ b/freetype/Jamfile @@ -195,7 +195,7 @@ rule RefDoc actions RefDoc { - python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.4.11 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h + python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.5.0 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h } RefDoc refdoc ; diff --git a/freetype/README b/freetype/README index 068e623a1..798715a41 100644 --- a/freetype/README +++ b/freetype/README @@ -1,14 +1,19 @@ - FreeType 2.4.11 - =============== + FreeType 2.5.0 + ============== + + Homepage: http://www.freetype.org + + FreeType is a freely available software library to render fonts. + + It is written in C, designed to be small, efficient, highly + customizable, and portable while capable of producing high-quality + output (glyph images) of most vector and bitmap font formats. Please read the docs/CHANGES file, it contains IMPORTANT INFORMATION. - Read the files `docs/INSTALL' for installation instructions. - - See the file `docs/LICENSE.TXT' for the available licenses. Note - that we use ranges (`2008-2010') for copyright years also instead of - listing individual years (`2008, 2009, 2010'). + Read the files `docs/INSTALL*' for installation instructions; see + the file `docs/LICENSE.TXT' for the available licenses. The FreeType 2 API reference is located in `docs/reference'; use the file `ft2-doc.html' as the top entry point. Additional @@ -19,9 +24,30 @@ and download one of the following files. - freetype-doc-2.4.11.tar.bz2 - freetype-doc-2.4.11.tar.gz - ftdoc2411.zip + freetype-doc-2.5.0.tar.bz2 + freetype-doc-2.5.0.tar.gz + ftdoc250.zip + + To view the documentation online, go to + + http://www.freetype.org/freetype2/documentation.html + + + Mailing Lists + ============= + + The preferred way of communication with the FreeType team is using + e-mail lists. + + general use and discussion: freetype@nongnu.org + engine internals, porting, etc.: freetype-devel@nongnu.org + announcements: freetype-announce@nongnu.org + + The lists are moderated; see + + http://www.freetype.org/contact.html + + how to subscribe. Bugs @@ -44,7 +70,7 @@ ---------------------------------------------------------------------- -Copyright 2006-2012 by +Copyright 2006-2013 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/freetype/builds/amiga/src/base/ftdebug.c b/freetype/builds/amiga/src/base/ftdebug.c index 5284e697a..4e13a6a6f 100644 --- a/freetype/builds/amiga/src/base/ftdebug.c +++ b/freetype/builds/amiga/src/base/ftdebug.c @@ -2,9 +2,9 @@ /* */ /* ftdebug.c */ /* */ -/* Debugging and logging component (body). */ +/* Debugging and logging component for amiga (body). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005 by */ +/* Copyright 1996-2001, 2002, 2004, 2005, 2013 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -41,12 +41,12 @@ /*************************************************************************/ -/* - * Based on the default ftdebug.c, - * replaced vprintf() with KVPrintF(), - * commented out exit(), - * replaced getenv() with GetVar(). - */ + /* + * Based on the default ftdebug.c, + * replaced vprintf() with KVPrintF(), + * commented out exit(), + * replaced getenv() with GetVar(). + */ #include <exec/types.h> #include <utility/tagitem.h> @@ -59,9 +59,9 @@ #include <clib/debug_protos.h> #ifndef __amigaos4__ -extern struct Library *DOSBase; + extern struct Library *DOSBase; #else -extern struct DOSIFace *IDOS; + extern struct DOSIFace *IDOS; #endif @@ -75,13 +75,13 @@ extern struct DOSIFace *IDOS; /* documentation is in ftdebug.h */ FT_BASE_DEF( void ) - FT_Message( const char* fmt, ... ) + FT_Message( const char* fmt, + ... ) { va_list ap; va_start( ap, fmt ); -/* vprintf( fmt, ap ); */ KVPrintF( fmt, ap ); va_end( ap ); } @@ -90,19 +90,34 @@ extern struct DOSIFace *IDOS; /* documentation is in ftdebug.h */ FT_BASE_DEF( void ) - FT_Panic( const char* fmt, ... ) + FT_Panic( const char* fmt, + ... ) { va_list ap; va_start( ap, fmt ); -/* vprintf( fmt, ap ); */ KVPrintF( fmt, ap ); va_end( ap ); /* exit( EXIT_FAILURE ); */ } + + /* documentation is in ftdebug.h */ + + FT_BASE_DEF( int ) + FT_Throw( FT_Error error, + int line, + const char* file ) + { + FT_UNUSED( error ); + FT_UNUSED( line ); + FT_UNUSED( file ); + + return 0; + } + #endif /* FT_DEBUG_LEVEL_ERROR */ @@ -193,6 +208,9 @@ extern struct DOSIFace *IDOS; while ( *p && *p != ':' ) p++; + if ( !*p ) + break; + if ( *p == ':' && p > q ) { FT_Int n, i, len = (FT_Int)( p - q ); @@ -221,7 +239,7 @@ extern struct DOSIFace *IDOS; p++; if ( *p ) { - level = *p++ - '0'; + level = *p - '0'; if ( level < 0 || level > 7 ) level = -1; } diff --git a/freetype/builds/amiga/src/base/ftsystem.c b/freetype/builds/amiga/src/base/ftsystem.c index 6f9eac17f..42a552dbe 100644 --- a/freetype/builds/amiga/src/base/ftsystem.c +++ b/freetype/builds/amiga/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Amiga-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2005, 2006, 2007, 2010 by */ +/* Copyright 1996-2002, 2005-2007, 2010, 2013 by */ /* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -386,7 +386,7 @@ Free_VecPooled( APTR poolHeader, if ( !stream ) - return FT_Err_Invalid_Stream_Handle; + return FT_THROW( Invalid_Stream_Handle ); #ifdef __amigaos4__ sysfile = AllocMem ( sizeof (struct SysFile ), MEMF_SHARED ); @@ -398,7 +398,7 @@ Free_VecPooled( APTR poolHeader, FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not open `%s'\n", filepathname )); - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); } sysfile->file = Open( (STRPTR)filepathname, MODE_OLDFILE ); if ( !sysfile->file ) @@ -407,7 +407,7 @@ Free_VecPooled( APTR poolHeader, FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not open `%s'\n", filepathname )); - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); } fib = AllocDosObject( DOS_FIB, NULL ); @@ -418,7 +418,7 @@ Free_VecPooled( APTR poolHeader, FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not open `%s'\n", filepathname )); - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); } if ( !( ExamineFH( sysfile->file, fib ) ) ) { @@ -428,7 +428,7 @@ Free_VecPooled( APTR poolHeader, FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not open `%s'\n", filepathname )); - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); } stream->size = fib->fib_Size; FreeDosObject( DOS_FIB, fib ); @@ -447,7 +447,7 @@ Free_VecPooled( APTR poolHeader, ft_amiga_stream_close( stream ); FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " opened `%s' but zero-sized\n", filepathname )); - return FT_Err_Cannot_Open_Stream;; + return FT_THROW( Cannot_Open_Stream ); } FT_TRACE1(( "FT_Stream_Open:" )); diff --git a/freetype/builds/mac/ftmac.c b/freetype/builds/mac/ftmac.c index 719dd0ce9..16d50e87f 100644 --- a/freetype/builds/mac/ftmac.c +++ b/freetype/builds/mac/ftmac.c @@ -5,7 +5,7 @@ /* Mac FOND support. Written by just@letterror.com. */ /* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2008, 2013 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -184,7 +184,7 @@ typedef short ResourceIndex; FT_UNUSED( pathSpec ); FT_UNUSED( face_index ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #else @@ -270,7 +270,7 @@ typedef short ResourceIndex; return FT_Err_Ok; } else - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); } #endif /* HAVE_QUICKDRAW_CARBON */ @@ -323,10 +323,10 @@ typedef short ResourceIndex; CFRelease( cf_fontName ); if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); if ( noErr != FT_ATSFontGetFileReference( ats_font_id, ats_font_ref ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); /* face_index calculation by searching preceding fontIDs */ /* with same FSRef */ @@ -365,7 +365,7 @@ typedef short ResourceIndex; FT_UNUSED( maxPathSize ); FT_UNUSED( face_index ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #else @@ -385,7 +385,7 @@ typedef short ResourceIndex; return err; if ( noErr != FSRefMakePath( &ref, path, maxPathSize ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); return FT_Err_Ok; } @@ -404,7 +404,7 @@ typedef short ResourceIndex; FT_UNUSED( pathSpec ); FT_UNUSED( face_index ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #else @@ -425,7 +425,7 @@ typedef short ResourceIndex; if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, pathSpec, NULL ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); return FT_Err_Ok; } @@ -580,7 +580,7 @@ typedef short ResourceIndex; if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); /* at present, no support for dfont format */ err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res ); @@ -598,7 +598,7 @@ typedef short ResourceIndex; if ( noErr != FT_FSPathMakeSpec( pathname, &spec, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); /* at present, no support for dfont format without FSRef */ /* (see above), try original resource-fork font */ @@ -696,11 +696,9 @@ typedef short ResourceIndex; count_faces_scalable( char* fond_data ) { AsscEntry* assoc; - FamRec* fond; short i, face, face_all; - fond = (FamRec*)fond_data; face_all = EndianS16_BtoN( *( (short *)( fond_data + sizeof ( FamRec ) ) ) ) + 1; assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 ); @@ -847,17 +845,17 @@ typedef short ResourceIndex; /* We should not extract parent directory by string manipulation. */ if ( noErr != FSPathMakeRef( path_fond, &ref, FALSE ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, NULL, &par_ref ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( noErr != FSRefMakePath( &par_ref, path_lwfn, path_size ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* now we have absolute dirname in path_lwfn */ if ( path_lwfn[0] == '/' ) @@ -870,11 +868,11 @@ typedef short ResourceIndex; path_lwfn[dirname_len + base_lwfn[0]] = '\0'; if ( noErr != FSPathMakeRef( path_lwfn, &ref, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, NULL, NULL ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); return FT_Err_Ok; @@ -886,7 +884,7 @@ typedef short ResourceIndex; /* pathname for FSSpec is always HFS format */ if ( ft_strlen( (char *)path_fond ) > path_size ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); ft_strcpy( (char *)path_lwfn, (char *)path_fond ); @@ -895,7 +893,7 @@ typedef short ResourceIndex; i--; if ( i + 1 + base_lwfn[0] > path_size ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( ':' == path_lwfn[i] ) { @@ -909,7 +907,7 @@ typedef short ResourceIndex; } if ( noErr != FT_FSPathMakeSpec( path_lwfn, &spec, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); return FT_Err_Ok; @@ -1003,7 +1001,7 @@ typedef short ResourceIndex; /* detect integer overflows */ if ( total_size < old_total_size ) { - error = FT_Err_Array_Too_Large; + error = FT_ERR( Array_Too_Large ); goto Error; } @@ -1088,7 +1086,7 @@ typedef short ResourceIndex; if ( noErr != FT_FSPathMakeRes( pathname, &res ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); pfb_data = NULL; pfb_size = 0; @@ -1123,7 +1121,7 @@ typedef short ResourceIndex; sfnt = GetResource( TTAG_sfnt, sfnt_id ); if ( sfnt == NULL ) - return FT_Err_Invalid_Handle; + return FT_THROW( Invalid_Handle ); sfnt_size = (FT_ULong)GetHandleSize( sfnt ); if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) ) @@ -1182,23 +1180,26 @@ typedef short ResourceIndex; FT_Long face_index, FT_Face* aface ) { - FT_Error error = FT_Err_Cannot_Open_Resource; + FT_Error error = FT_ERR( Cannot_Open_Resource ); ResFileRefNum res_ref; ResourceIndex res_index; Handle fond; - short num_faces_in_res, num_faces_in_fond; + short num_faces_in_res; if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); UseResFile( res_ref ); if ( ResError() ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); num_faces_in_res = 0; for ( res_index = 1; ; ++res_index ) { + short num_faces_in_fond; + + fond = Get1IndResource( TTAG_FOND, res_index ); if ( ResError() ) break; @@ -1239,7 +1240,7 @@ typedef short ResourceIndex; GetResInfo( fond, &fond_id, &fond_type, fond_name ); if ( ResError() != noErr || fond_type != TTAG_FOND ) - return FT_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); HLock( fond ); parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index ); @@ -1322,7 +1323,7 @@ typedef short ResourceIndex; face_index, aface ); else - error = FT_Err_Unknown_File_Format; + error = FT_ERR( Unknown_File_Format ); found_no_lwfn_file: if ( have_sfnt && FT_Err_Ok != error ) @@ -1389,7 +1390,7 @@ typedef short ResourceIndex; /* test for valid `library' and `aface' delayed to FT_Open_Face() */ if ( !pathname ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); error = FT_Err_Ok; *aface = NULL; @@ -1432,7 +1433,7 @@ typedef short ResourceIndex; FT_UNUSED( face_index ); FT_UNUSED( aface ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); #else @@ -1443,11 +1444,11 @@ typedef short ResourceIndex; if ( !ref ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); err = FSRefMakePath( ref, pathname, sizeof ( pathname ) ); if ( err ) - error = FT_Err_Cannot_Open_Resource; + error = FT_ERR( Cannot_Open_Resource ); error = FT_New_Face_From_Resource( library, pathname, face_index, aface ); if ( error != 0 || *aface != NULL ) @@ -1487,7 +1488,7 @@ typedef short ResourceIndex; if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); else return FT_New_Face_From_FSRef( library, &ref, face_index, aface ); @@ -1500,11 +1501,11 @@ typedef short ResourceIndex; if ( !spec ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); err = FT_FSpMakePath( spec, pathname, sizeof ( pathname ) ); if ( err ) - error = FT_Err_Cannot_Open_Resource; + error = FT_ERR( Cannot_Open_Resource ); error = FT_New_Face_From_Resource( library, pathname, face_index, aface ); if ( error != 0 || *aface != NULL ) @@ -1522,7 +1523,7 @@ typedef short ResourceIndex; FT_UNUSED( face_index ); FT_UNUSED( aface ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); #endif /* HAVE_FSREF, HAVE_FSSPEC */ diff --git a/freetype/builds/unix/aclocal.m4 b/freetype/builds/unix/aclocal.m4 index 0940200fd..b9312147f 100644 --- a/freetype/builds/unix/aclocal.m4 +++ b/freetype/builds/unix/aclocal.m4 @@ -1,4 +1,4 @@ -# generated automatically by aclocal 1.12.5 -*- Autoconf -*- +# generated automatically by aclocal 1.13.1 -*- Autoconf -*- # Copyright (C) 1996-2012 Free Software Foundation, Inc. @@ -11,6 +11,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, diff --git a/freetype/builds/unix/config.guess b/freetype/builds/unix/config.guess index 872b96a16..b79252d6b 100644 --- a/freetype/builds/unix/config.guess +++ b/freetype/builds/unix/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2012-09-25' +timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +20,17 @@ timestamp='2012-09-25' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to <config-patches@gnu.org> and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -859,21 +874,21 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -886,59 +901,54 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -957,54 +967,63 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1237,19 +1256,21 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) diff --git a/freetype/builds/unix/config.sub b/freetype/builds/unix/config.sub index 89b128630..8b612ab89 100644 --- a/freetype/builds/unix/config.sub +++ b/freetype/builds/unix/config.sub @@ -1,24 +1,18 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2013 Free Software Foundation, Inc. -timestamp='2012-10-10' +timestamp='2013-04-24' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. @@ -26,11 +20,12 @@ timestamp='2012-10-10' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -73,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -259,7 +252,7 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc \ + | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ @@ -293,16 +286,17 @@ case $basic_machine in | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ - | or32 \ + | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ @@ -372,7 +366,7 @@ case $basic_machine in | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ @@ -410,12 +404,13 @@ case $basic_machine in | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ @@ -1026,7 +1021,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1353,7 +1352,7 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ @@ -1499,9 +1498,6 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1593,6 +1589,9 @@ case $basic_machine in mips*-*) os=-elf ;; + or1k-*) + os=-elf + ;; or32-*) os=-coff ;; diff --git a/freetype/builds/unix/configure b/freetype/builds/unix/configure index ba987277d..64acde93e 100644 --- a/freetype/builds/unix/configure +++ b/freetype/builds/unix/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for FreeType 2.4.11. +# Generated by GNU Autoconf 2.69 for FreeType 2.5. # # Report bugs to <freetype@nongnu.org>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='FreeType' PACKAGE_TARNAME='freetype' -PACKAGE_VERSION='2.4.11' -PACKAGE_STRING='FreeType 2.4.11' +PACKAGE_VERSION='2.5' +PACKAGE_STRING='FreeType 2.5' PACKAGE_BUGREPORT='freetype@nongnu.org' PACKAGE_URL='' @@ -739,6 +739,7 @@ enable_biarch_config enable_mmap with_zlib with_bzip2 +with_png with_old_mac_fonts with_fsspec with_fsref @@ -1302,7 +1303,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures FreeType 2.4.11 to adapt to many kinds of systems. +\`configure' configures FreeType 2.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1367,7 +1368,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of FreeType 2.4.11:";; + short | recursive ) echo "Configuration of FreeType 2.5:";; esac cat <<\_ACEOF @@ -1389,6 +1390,8 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-zlib use internal zlib instead of system-wide --without-bzip2 do not support bzip2 compressed fonts + --without-png do not support png compressed OpenType embedded + bitmaps --with-old-mac-fonts allow Mac resource-based fonts to be used --with-fsspec use obsolete FSSpec API of MacOS, if available (default=yes) @@ -1482,7 +1485,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -FreeType configure 2.4.11 +FreeType configure 2.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2080,7 +2083,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by FreeType $as_me 2.4.11, which was +It was created by FreeType $as_me 2.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2436,7 +2439,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Don't forget to update docs/VERSION.DLL! -version_info='16:0:10' +version_info='16:2:10' ft_version=`echo $version_info | tr : .` @@ -4694,6 +4697,7 @@ if test x$with_zlib != xno && test -n "$LIBZ"; then SYSTEM_ZLIB=yes fi + # check for system libbz2 # don't quote AS_HELP_STRING! @@ -4754,6 +4758,34 @@ if test x$with_bzip2 != xno && test -n "$LIBBZ2"; then SYSTEM_LIBBZ2=yes fi + +# check for system libpng + +HAVE_LIBPNG=no + +# Check whether --with-png was given. +if test "${with_png+set}" = set; then : + withval=$with_png; +fi + +if test x$with_png != xno; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng" >&5 +$as_echo_n "checking for libpng... " >&6; } + if test -z "$LIBPNG_CFLAGS" -a -z "$LIBPNG_LDFLAGS"; then + if ! which libpng-config >/dev/null; then + as_fn_error $? "\`libpng-config' not found; +either set the LIBPNG_CFLAGS and LIBPNG_LDFLAGS environment variables, +or pass \`--without-png' to the \`configure' script." "$LINENO" 5 + fi + LIBPNG_CFLAGS="`libpng-config --cflags`" + LIBPNG_LDFLAGS="`libpng-config --ldflags`" + fi + HAVE_LIBPNG=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPNG_LDFLAGS" >&5 +$as_echo "$LIBPNG_LDFLAGS" >&6; } +fi + + # Some options handling SDKs/archs in CFLAGS should be copied # to LDFLAGS. Apple TechNote 2137 recommends to include these # options in CFLAGS but not in LDFLAGS. @@ -12799,6 +12831,10 @@ if test x$SYSTEM_LIBBZ2 = xyes; then CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2" LDFLAGS="$LDFLAGS $LIBBZ2" fi +if test x$HAVE_LIBPNG = xyes; then + CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG" + LDFLAGS="$LDFLAGS $LIBPNG_LDFLAGS" +fi @@ -12814,7 +12850,7 @@ ac_config_headers="$ac_config_headers ftconfig.h:ftconfig.in" # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk' # and `builds/unix/unix-cc.mk' that will be used by the build system # -ac_config_files="$ac_config_files unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in" +ac_config_files="$ac_config_files unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in" # re-generate the Jamfile to use libtool now @@ -13327,7 +13363,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by FreeType $as_me 2.4.11, which was +This file was extended by FreeType $as_me 2.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13393,7 +13429,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -FreeType config.status 2.4.11 +FreeType config.status 2.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -13803,8 +13839,6 @@ do "ftconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS ftconfig.h:ftconfig.in" ;; "unix-cc.mk") CONFIG_FILES="$CONFIG_FILES unix-cc.mk:unix-cc.in" ;; "unix-def.mk") CONFIG_FILES="$CONFIG_FILES unix-def.mk:unix-def.in" ;; - "freetype-config") CONFIG_FILES="$CONFIG_FILES freetype-config" ;; - "freetype2.pc") CONFIG_FILES="$CONFIG_FILES freetype2.pc:freetype2.in" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/freetype/builds/unix/configure.ac b/freetype/builds/unix/configure.ac index 7189d4e81..e00d2cc33 100644 --- a/freetype/builds/unix/configure.ac +++ b/freetype/builds/unix/configure.ac @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright 2001-2012 by +# Copyright 2001-2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -11,13 +11,13 @@ # indicate that you have read the license and understand and accept it # fully. -AC_INIT([FreeType], [2.4.11], [freetype@nongnu.org], [freetype]) +AC_INIT([FreeType], [2.5], [freetype@nongnu.org], [freetype]) AC_CONFIG_SRCDIR([ftconfig.in]) # Don't forget to update docs/VERSION.DLL! -version_info='16:0:10' +version_info='16:2:10' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -254,12 +254,15 @@ AC_ARG_WITH([zlib], AS_HELP_STRING([--without-zlib], [use internal zlib instead of system-wide])) if test x$with_zlib != xno && test -z "$LIBZ"; then - AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])]) + AC_CHECK_LIB([z], + [gzsetparams], + [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])]) fi if test x$with_zlib != xno && test -n "$LIBZ"; then SYSTEM_ZLIB=yes fi + # check for system libbz2 # don't quote AS_HELP_STRING! @@ -267,12 +270,37 @@ AC_ARG_WITH([bzip2], AS_HELP_STRING([--without-bzip2], [do not support bzip2 compressed fonts])) if test x$with_bzip2 != xno && test -z "$LIBBZ2"; then - AC_CHECK_LIB([bz2], [BZ2_bzDecompress], [AC_CHECK_HEADER([bzlib.h], [LIBBZ2='-lbz2'])]) + AC_CHECK_LIB([bz2], + [BZ2_bzDecompress], + [AC_CHECK_HEADER([bzlib.h], [LIBBZ2='-lbz2'])]) fi if test x$with_bzip2 != xno && test -n "$LIBBZ2"; then SYSTEM_LIBBZ2=yes fi + +# check for system libpng + +HAVE_LIBPNG=no +AC_ARG_WITH([png], + AS_HELP_STRING([--without-png], + [do not support png compressed OpenType embedded bitmaps])) +if test x$with_png != xno; then + AC_MSG_CHECKING([for libpng]) + if test -z "$LIBPNG_CFLAGS" -a -z "$LIBPNG_LDFLAGS"; then + if ! which libpng-config >/dev/null; then + AC_MSG_ERROR([`libpng-config' not found; +either set the LIBPNG_CFLAGS and LIBPNG_LDFLAGS environment variables, +or pass `--without-png' to the `configure' script.]) + fi + LIBPNG_CFLAGS="`libpng-config --cflags`" + LIBPNG_LDFLAGS="`libpng-config --ldflags`" + fi + HAVE_LIBPNG=yes + AC_MSG_RESULT([$LIBPNG_LDFLAGS]) +fi + + # Some options handling SDKs/archs in CFLAGS should be copied # to LDFLAGS. Apple TechNote 2137 recommends to include these # options in CFLAGS but not in LDFLAGS. @@ -709,6 +737,10 @@ if test x$SYSTEM_LIBBZ2 = xyes; then CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2" LDFLAGS="$LDFLAGS $LIBBZ2" fi +if test x$HAVE_LIBPNG = xyes; then + CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG" + LDFLAGS="$LDFLAGS $LIBPNG_LDFLAGS" +fi AC_SUBST([CFLAGS]) AC_SUBST([LDFLAGS]) @@ -727,9 +759,7 @@ AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in], # and `builds/unix/unix-cc.mk' that will be used by the build system # AC_CONFIG_FILES([unix-cc.mk:unix-cc.in - unix-def.mk:unix-def.in - freetype-config - freetype2.pc:freetype2.in]) + unix-def.mk:unix-def.in]) # re-generate the Jamfile to use libtool now # diff --git a/freetype/builds/unix/configure.raw b/freetype/builds/unix/configure.raw index bf26061f0..6a6edc715 100644 --- a/freetype/builds/unix/configure.raw +++ b/freetype/builds/unix/configure.raw @@ -2,7 +2,7 @@ # # Process this file with autoconf to produce a configure script. # -# Copyright 2001-2012 by +# Copyright 2001-2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.in]) # Don't forget to update docs/VERSION.DLL! -version_info='16:0:10' +version_info='16:2:10' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) @@ -254,12 +254,15 @@ AC_ARG_WITH([zlib], AS_HELP_STRING([--without-zlib], [use internal zlib instead of system-wide])) if test x$with_zlib != xno && test -z "$LIBZ"; then - AC_CHECK_LIB([z], [gzsetparams], [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])]) + AC_CHECK_LIB([z], + [gzsetparams], + [AC_CHECK_HEADER([zlib.h], [LIBZ='-lz'])]) fi if test x$with_zlib != xno && test -n "$LIBZ"; then SYSTEM_ZLIB=yes fi + # check for system libbz2 # don't quote AS_HELP_STRING! @@ -267,12 +270,37 @@ AC_ARG_WITH([bzip2], AS_HELP_STRING([--without-bzip2], [do not support bzip2 compressed fonts])) if test x$with_bzip2 != xno && test -z "$LIBBZ2"; then - AC_CHECK_LIB([bz2], [BZ2_bzDecompress], [AC_CHECK_HEADER([bzlib.h], [LIBBZ2='-lbz2'])]) + AC_CHECK_LIB([bz2], + [BZ2_bzDecompress], + [AC_CHECK_HEADER([bzlib.h], [LIBBZ2='-lbz2'])]) fi if test x$with_bzip2 != xno && test -n "$LIBBZ2"; then SYSTEM_LIBBZ2=yes fi + +# check for system libpng + +HAVE_LIBPNG=no +AC_ARG_WITH([png], + AS_HELP_STRING([--without-png], + [do not support png compressed OpenType embedded bitmaps])) +if test x$with_png != xno; then + AC_MSG_CHECKING([for libpng]) + if test -z "$LIBPNG_CFLAGS" -a -z "$LIBPNG_LDFLAGS"; then + if ! which libpng-config >/dev/null; then + AC_MSG_ERROR([`libpng-config' not found; +either set the LIBPNG_CFLAGS and LIBPNG_LDFLAGS environment variables, +or pass `--without-png' to the `configure' script.]) + fi + LIBPNG_CFLAGS="`libpng-config --cflags`" + LIBPNG_LDFLAGS="`libpng-config --ldflags`" + fi + HAVE_LIBPNG=yes + AC_MSG_RESULT([$LIBPNG_LDFLAGS]) +fi + + # Some options handling SDKs/archs in CFLAGS should be copied # to LDFLAGS. Apple TechNote 2137 recommends to include these # options in CFLAGS but not in LDFLAGS. @@ -709,6 +737,10 @@ if test x$SYSTEM_LIBBZ2 = xyes; then CFLAGS="$CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2" LDFLAGS="$LDFLAGS $LIBBZ2" fi +if test x$HAVE_LIBPNG = xyes; then + CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG" + LDFLAGS="$LDFLAGS $LIBPNG_LDFLAGS" +fi AC_SUBST([CFLAGS]) AC_SUBST([LDFLAGS]) @@ -727,9 +759,7 @@ AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in], # and `builds/unix/unix-cc.mk' that will be used by the build system # AC_CONFIG_FILES([unix-cc.mk:unix-cc.in - unix-def.mk:unix-def.in - freetype-config - freetype2.pc:freetype2.in]) + unix-def.mk:unix-def.in]) # re-generate the Jamfile to use libtool now # diff --git a/freetype/builds/unix/detect.mk b/freetype/builds/unix/detect.mk index b2ae4f42b..0506e7d04 100644 --- a/freetype/builds/unix/detect.mk +++ b/freetype/builds/unix/detect.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003, 2004, 2006 by +# Copyright 1996-2000, 2002-2004, 2006, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -76,13 +76,14 @@ ifeq ($(PLATFORM),unix) have_Makefile := $(wildcard $(OBJ_DIR)/Makefile) + CONFIG_SHELL ?= /bin/sh setup: std_setup ifdef must_configure ifneq ($(have_Makefile),) # we are building FT2 not in the src tree - $(TOP_DIR)/builds/unix/configure $(value CFG) + $(CONFIG_SHELL) $(TOP_DIR)/builds/unix/configure $(value CFG) else - cd builds/unix; ./configure $(value CFG) + cd builds/unix; $(CONFIG_SHELL) ./configure $(value CFG) endif endif diff --git a/freetype/builds/unix/freetype-config.in b/freetype/builds/unix/freetype-config.in index 815367ba8..2edcd1135 100644 --- a/freetype/builds/unix/freetype-config.in +++ b/freetype/builds/unix/freetype-config.in @@ -1,6 +1,6 @@ #! /bin/sh # -# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009 by +# Copyright 2000-2005, 2008, 2009, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -9,14 +9,15 @@ # indicate that you have read the license and understand and accept it # fully. -prefix=@prefix@ -exec_prefix=@exec_prefix@ -exec_prefix_set=no -includedir=@includedir@ -libdir=@libdir@ -enable_shared=@build_libtool_libs@ -wl=@wl@ -hardcode_libdir_flag_spec='@hardcode_libdir_flag_spec@' +LC_ALL=C +export LC_ALL + +prefix="%prefix%" +exec_prefix="%exec_prefix%" +exec_prefix_set="no" +includedir="%includedir%" +libdir="%libdir%" +enable_shared="%build_libtool_libs%" usage() { @@ -72,7 +73,7 @@ while test $# -gt 0 ; do echo_exec_prefix=yes ;; --version) - echo @ft_version@ + echo %ft_version% exit 0 ;; --ftversion) @@ -140,12 +141,9 @@ if test "$echo_cflags" = "yes" ; then fi if test "$echo_libs" = "yes" ; then - rpath= - if test "$enable_shared" = "yes" ; then - eval "rpath=\"$hardcode_libdir_flag_spec\"" - fi - libs="-lfreetype @LIBZ@ @LIBBZ2@ @FT2_EXTRA_LIBS@" - if test "${SYSROOT}$libdir" != "/usr/lib" && test "${SYSROOT}$libdir" != "/usr/lib64"; then + libs="-lfreetype %LIBZ% %LIBBZ2% %FT2_EXTRA_LIBS%" + if test "${SYSROOT}$libdir" != "/usr/lib" && + test "${SYSROOT}$libdir" != "/usr/lib64"; then echo -L${SYSROOT}$libdir $libs else echo $libs diff --git a/freetype/builds/unix/freetype2.in b/freetype/builds/unix/freetype2.in index b73180049..c5c30276e 100644 --- a/freetype/builds/unix/freetype2.in +++ b/freetype/builds/unix/freetype2.in @@ -1,12 +1,12 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ +prefix="%prefix%" +exec_prefix="%exec_prefix%" +libdir="%libdir%" +includedir="%includedir%" Name: FreeType 2 Description: A free, high-quality, and portable font engine. -Version: @ft_version@ +Version: %ft_version% Requires: Libs: -L${libdir} -lfreetype -Libs.private: @LIBZ@ @LIBBZ2@ @FT2_EXTRA_LIBS@ +Libs.private: %LIBZ% %LIBBZ2% %FT2_EXTRA_LIBS% Cflags: -I${includedir}/freetype2 -I${includedir} diff --git a/freetype/builds/unix/ftconfig.in b/freetype/builds/unix/ftconfig.in index 9531afda1..d171e2476 100644 --- a/freetype/builds/unix/ftconfig.in +++ b/freetype/builds/unix/ftconfig.in @@ -4,7 +4,7 @@ /* */ /* UNIX-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2004, 2006-2009, 2011 by */ +/* Copyright 1996-2004, 2006-2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -175,13 +175,89 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* IntN types */ + /* <Section> */ + /* basic_types */ /* */ - /* Used to guarantee the size of some specific integers. */ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Int16 */ + /* */ + /* <Description> */ + /* A typedef for a 16bit signed integer type. */ + /* */ + typedef signed short FT_Int16; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_UInt16 */ + /* */ + /* <Description> */ + /* A typedef for a 16bit unsigned integer type. */ /* */ - typedef signed short FT_Int16; typedef unsigned short FT_UInt16; + /* */ + + + /* this #if 0 ... #endif clause is for documentation purposes */ +#if 0 + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Int32 */ + /* */ + /* <Description> */ + /* A typedef for a 32bit signed integer type. The size depends on */ + /* the configuration. */ + /* */ + typedef signed XXX FT_Int32; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_UInt32 */ + /* */ + /* A typedef for a 32bit unsigned integer type. The size depends on */ + /* the configuration. */ + /* */ + typedef unsigned XXX FT_UInt32; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Int64 */ + /* */ + /* A typedef for a 64bit signed integer type. The size depends on */ + /* the configuration. Only defined if there is real 64bit support; */ + /* otherwise, it gets emulated with a structure (if necessary). */ + /* */ + typedef signed XXX FT_Int64; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_UInt64 */ + /* */ + /* A typedef for a 64bit unsigned integer type. The size depends on */ + /* the configuration. Only defined if there is real 64bit support; */ + /* otherwise, it gets emulated with a structure (if necessary). */ + /* */ + typedef unsigned XXX FT_UInt64; + + /* */ + +#endif + #if FT_SIZEOF_INT == 4 typedef signed int FT_Int32; @@ -274,6 +350,11 @@ FT_BEGIN_HEADER #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ +#ifdef FT_LONG64 + typedef FT_INT64 FT_Int64; + typedef FT_UINT64 FT_UInt64; +#endif + #define FT_BEGIN_STMNT do { #define FT_END_STMNT } while ( 0 ) @@ -336,7 +417,8 @@ FT_BEGIN_HEADER "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ : "=r"(a), "=&r"(t2), "=&r"(t) - : "r"(a), "r"(b) ); + : "r"(a), "r"(b) + : "cc" ); return a; } diff --git a/freetype/builds/unix/ftsystem.c b/freetype/builds/unix/ftsystem.c index 95f8271ec..92c7d9211 100644 --- a/freetype/builds/unix/ftsystem.c +++ b/freetype/builds/unix/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* Unix-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2002, 2004-2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -235,7 +235,7 @@ if ( !stream ) - return FT_Err_Invalid_Stream_Handle; + return FT_THROW( Invalid_Stream_Handle ); /* open the file */ file = open( filepathname, O_RDONLY ); @@ -243,7 +243,7 @@ { FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not open `%s'\n", filepathname )); - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); } /* Here we ensure that a "fork" will _not_ duplicate */ @@ -365,7 +365,7 @@ stream->size = 0; stream->pos = 0; - return FT_Err_Cannot_Open_Stream; + return FT_THROW( Cannot_Open_Stream ); } diff --git a/freetype/builds/unix/install.mk b/freetype/builds/unix/install.mk index 2e5ef080e..056f46cd1 100644 --- a/freetype/builds/unix/install.mk +++ b/freetype/builds/unix/install.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003, 2006 by +# Copyright 1996-2000, 2002, 2003, 2006, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -31,7 +31,6 @@ install: $(PROJECT_LIBRARY) $(MKINSTALLDIRS) $(DESTDIR)$(libdir) \ $(DESTDIR)$(libdir)/pkgconfig \ $(DESTDIR)$(includedir)/freetype2/freetype/config \ - $(DESTDIR)$(includedir)/freetype2/freetype/cache \ $(DESTDIR)$(bindir) \ $(DESTDIR)$(datadir)/aclocal $(LIBTOOL) --mode=install $(INSTALL) \ diff --git a/freetype/builds/unix/unix-def.in b/freetype/builds/unix/unix-def.in index d3ebc8b26..010607b90 100644 --- a/freetype/builds/unix/unix-def.in +++ b/freetype/builds/unix/unix-def.in @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2004, 2006, 2008 by +# Copyright 1996-2000, 2002, 2004, 2006, 2008, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -12,13 +12,14 @@ # indicate that you have read the license and understand and accept it # fully. +SHELL := @SHELL@ TOP_DIR := $(shell cd $(TOP_DIR); pwd) -DELETE := rm -f -DELDIR := @RMDIR@ -CAT := cat -SEP := / +DELETE := rm -f +DELDIR := @RMDIR@ +CAT := cat +SEP := / # this is used for `make distclean' and `make install' OBJ_BUILD ?= $(BUILD_DIR) @@ -57,6 +58,13 @@ datadir := @datadir@ version_info := @version_info@ +# Variables needed for `freetype-config' and `freetype.pc'. +# +FT2_EXTRA_LIBS := @FT2_EXTRA_LIBS@ +LIBBZ2 := @LIBBZ2@ +LIBZ := @LIBZ@ +build_libtool_libs := @build_libtool_libs@ +ft_version := @ft_version@ # The directory where all library files are placed. # @@ -82,4 +90,48 @@ SYSTEM_ZLIB := @SYSTEM_ZLIB@ NO_OUTPUT := 2> /dev/null +# To support calls like +# +# configure --includedir='${libdir}'/freetype2/include +# +# we generate `freetype-config' and `freetype.pc' at compile time so that +# those variables are properly expanded. + +$(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in + rm -f $@ $@.tmp + sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \ + -e 's|%LIBBZ2%|$(LIBBZ2)|' \ + -e 's|%LIBZ%|$(LIBZ)|' \ + -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \ + -e 's|%exec_prefix%|$(exec_prefix)|' \ + -e 's|%ft_version%|$(ft_version)|' \ + -e 's|%includedir%|$(includedir)|' \ + -e 's|%libdir%|$(libdir)|' \ + -e 's|%prefix%|$(prefix)|' \ + $< \ + > $@.tmp + chmod +x $@.tmp + chmod a-w $@.tmp + mv $@.tmp $@ + +$(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in + rm -f $@ $@.tmp + sed -e 's|%FT2_EXTRA_LIBS%|$(FT2_EXTRA_LIBS)|' \ + -e 's|%LIBBZ2%|$(LIBBZ2)|' \ + -e 's|%LIBZ%|$(LIBZ)|' \ + -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \ + -e 's|%exec_prefix%|$(exec_prefix)|' \ + -e 's|%ft_version%|$(ft_version)|' \ + -e 's|%includedir%|$(includedir)|' \ + -e 's|%libdir%|$(libdir)|' \ + -e 's|%prefix%|$(prefix)|' \ + $< \ + > $@.tmp + chmod +x $@.tmp + chmod a-w $@.tmp + mv $@.tmp $@ + +all: $(OBJ_BUILD)/freetype-config \ + $(OBJ_BUILD)/freetype2.pc + # EOF diff --git a/freetype/builds/vms/ftsystem.c b/freetype/builds/vms/ftsystem.c index fb35967cc..5c2819edb 100644 --- a/freetype/builds/vms/ftsystem.c +++ b/freetype/builds/vms/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* VMS-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2005, 2010 by */ +/* Copyright 1996-2002, 2005, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -212,7 +212,7 @@ if ( !stream ) - return FT_Err_Invalid_Stream_Handle; + return FT_THROW( Invalid_Stream_Handle ); /* open the file */ file = open( filepathname, O_RDONLY ); @@ -220,7 +220,7 @@ { FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not open `%s'\n", filepathname )); - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); } if ( fstat( file, &stat_buf ) < 0 ) @@ -274,7 +274,7 @@ stream->size = 0; stream->pos = 0; - return FT_Err_Cannot_Open_Stream; + return FT_THROW( Cannot_Open_Stream ); } diff --git a/freetype/builds/win32/ftdebug.c b/freetype/builds/win32/ftdebug.c index d1ca15ac9..58b7f89ec 100644 --- a/freetype/builds/win32/ftdebug.c +++ b/freetype/builds/win32/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for Win32 (body). */ /* */ -/* Copyright 1996-2001, 2002, 2005, 2008, 2009 by */ +/* Copyright 1996-2001, 2002, 2005, 2008, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -47,7 +47,6 @@ #ifdef FT_DEBUG_LEVEL_ERROR - #include <stdarg.h> #include <stdlib.h> #include <string.h> @@ -55,8 +54,11 @@ #include <windows.h> + /* documentation is in ftdebug.h */ + FT_BASE_DEF( void ) - FT_Message( const char* fmt, ... ) + FT_Message( const char* fmt, + ... ) { static char buf[8192]; va_list ap; @@ -71,8 +73,11 @@ } + /* documentation is in ftdebug.h */ + FT_BASE_DEF( void ) - FT_Panic( const char* fmt, ... ) + FT_Panic( const char* fmt, + ... ) { static char buf[8192]; va_list ap; @@ -87,6 +92,21 @@ } + /* documentation is in ftdebug.h */ + + FT_BASE_DEF( int ) + FT_Throw( FT_Error error, + int line, + const char* file ) + { + FT_UNUSED( error ); + FT_UNUSED( line ); + FT_UNUSED( file ); + + return 0; + } + + #ifdef FT_DEBUG_LEVEL_TRACE @@ -146,9 +166,12 @@ while ( *p && *p != ':' ) p++; + if ( !*p ) + break; + if ( *p == ':' && p > q ) { - int n, i, len = p - q; + int n, i, len = (int)( p - q ); int level = -1, found = -1; @@ -174,7 +197,7 @@ p++; if ( *p ) { - level = *p++ - '0'; + level = *p - '0'; if ( level < 0 || level > 7 ) level = -1; } diff --git a/freetype/builds/win32/vc2005/freetype.vcproj b/freetype/builds/win32/vc2005/freetype.vcproj index 71a8b24f0..a7da85a46 100644 --- a/freetype/builds/win32/vc2005/freetype.vcproj +++ b/freetype/builds/win32/vc2005/freetype.vcproj @@ -16,7 +16,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype2411.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype250.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -33,7 +33,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype2411MT.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype250MT.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -50,7 +50,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype2411ST.lib" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype250ST.lib" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -67,7 +67,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype2411_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype250_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -84,7 +84,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype2411ST_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype250ST_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -101,7 +101,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype2411MT_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\win32\vc2005\freetype250MT_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
diff --git a/freetype/builds/win32/vc2005/index.html b/freetype/builds/win32/vc2005/index.html index a380079d9..788b83020 100644 --- a/freetype/builds/win32/vc2005/index.html +++ b/freetype/builds/win32/vc2005/index.html @@ -11,14 +11,14 @@ <p>This directory contains project files for Visual C++, named <tt>freetype.vcproj</tt>, and Visual Studio, called <tt>freetype.sln</tt>. It -compiles the following libraries from the FreeType 2.4.11 sources:</p> +compiles the following libraries from the FreeType 2.5.0 sources:</p> <ul> <pre> - freetype2411.lib - release build; single threaded - freetype2411_D.lib - debug build; single threaded - freetype2411MT.lib - release build; multi-threaded - freetype2411MT_D.lib - debug build; multi-threaded</pre> + freetype250.lib - release build; single threaded + freetype250_D.lib - debug build; single threaded + freetype250MT.lib - release build; multi-threaded + freetype250MT_D.lib - debug build; multi-threaded</pre> </ul> <p>Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/freetype/builds/win32/vc2008/freetype.vcproj b/freetype/builds/win32/vc2008/freetype.vcproj index ba755306d..bd76a2968 100644 --- a/freetype/builds/win32/vc2008/freetype.vcproj +++ b/freetype/builds/win32/vc2008/freetype.vcproj @@ -70,7 +70,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\win32\vc2008\freetype2411.lib"
+ OutputFile="..\..\..\objs\win32\vc2008\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -145,7 +145,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\win32\vc2008\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\win32\vc2008\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -220,7 +220,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\win32\vc2008\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\win32\vc2008\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -292,7 +292,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\win32\vc2008\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\win32\vc2008\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -365,7 +365,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\win32\vc2008\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\win32\vc2008\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -439,7 +439,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\win32\vc2008\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\win32\vc2008\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
diff --git a/freetype/builds/win32/vc2008/index.html b/freetype/builds/win32/vc2008/index.html index f064b228e..498ba6d5a 100644 --- a/freetype/builds/win32/vc2008/index.html +++ b/freetype/builds/win32/vc2008/index.html @@ -11,14 +11,14 @@ <p>This directory contains project files for Visual C++, named <tt>freetype.vcproj</tt>, and Visual Studio, called <tt>freetype.sln</tt>. It -compiles the following libraries from the FreeType 2.4.11 sources:</p> +compiles the following libraries from the FreeType 2.5.0 sources:</p> <ul> <pre> - freetype2411.lib - release build; single threaded - freetype2411_D.lib - debug build; single threaded - freetype2411MT.lib - release build; multi-threaded - freetype2411MT_D.lib - debug build; multi-threaded</pre> + freetype250.lib - release build; single threaded + freetype250_D.lib - debug build; single threaded + freetype250MT.lib - release build; multi-threaded + freetype250MT_D.lib - debug build; multi-threaded</pre> </ul> <p>Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/freetype/builds/win32/vc2010/freetype.vcxproj b/freetype/builds/win32/vc2010/freetype.vcxproj index 6623003e7..5c85da932 100644 --- a/freetype/builds/win32/vc2010/freetype.vcxproj +++ b/freetype/builds/win32/vc2010/freetype.vcxproj @@ -95,12 +95,12 @@ <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">freetype2411_D</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Multithreaded|Win32'">freetype2411MT_D</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Singlethreaded|Win32'">freetype2411ST_D</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">freetype2411</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Multithreaded|Win32'">freetype2411MT</TargetName>
- <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Singlethreaded|Win32'">freetype2411ST</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">freetype250_D</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Multithreaded|Win32'">freetype250MT_D</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug Singlethreaded|Win32'">freetype250ST_D</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">freetype250</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Multithreaded|Win32'">freetype250MT</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release Singlethreaded|Win32'">freetype250ST</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
diff --git a/freetype/builds/win32/vc2010/index.html b/freetype/builds/win32/vc2010/index.html index 9c4dd0bbc..caceac116 100644 --- a/freetype/builds/win32/vc2010/index.html +++ b/freetype/builds/win32/vc2010/index.html @@ -11,14 +11,14 @@ <p>This directory contains a project file for Visual C++, named <tt>freetype.vcxproj</tt>, and Visual Studio, called <tt>freetype.sln</tt>. It -compiles the following libraries from the FreeType 2.4.11 sources:</p> +compiles the following libraries from the FreeType 2.5.0 sources:</p> <ul> <pre> - freetype2411.lib - release build; single threaded - freetype2411_D.lib - debug build; single threaded - freetype2411MT.lib - release build; multi-threaded - freetype2411MT_D.lib - debug build; multi-threaded</pre> + freetype250.lib - release build; single threaded + freetype250_D.lib - debug build; single threaded + freetype250MT.lib - release build; multi-threaded + freetype250MT_D.lib - debug build; multi-threaded</pre> </ul> <p>Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/freetype/builds/win32/visualc/freetype.dsp b/freetype/builds/win32/visualc/freetype.dsp index b8e05ae09..516e47f3c 100644 --- a/freetype/builds/win32/visualc/freetype.dsp +++ b/freetype/builds/win32/visualc/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250.lib"
!ELSEIF "$(CFG)" == "freetype - Win32 Debug"
@@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250_D.lib"
!ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded"
@@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"lib\freetype2411_D.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411MT_D.lib"
+# ADD BASE LIB32 /nologo /out:"lib\freetype250_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250MT_D.lib"
!ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded"
@@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"lib\freetype2411.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411MT.lib"
+# ADD BASE LIB32 /nologo /out:"lib\freetype250.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250MT.lib"
!ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded"
@@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype2411.lib"
-# ADD LIB32 /out:"..\..\..\objs\freetype2411ST.lib"
+# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype250.lib"
+# ADD LIB32 /out:"..\..\..\objs\freetype250ST.lib"
# SUBTRACT LIB32 /nologo
!ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded"
@@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype2411_D.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411ST_D.lib"
+# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype250_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250ST_D.lib"
!ENDIF
diff --git a/freetype/builds/win32/visualc/freetype.vcproj b/freetype/builds/win32/visualc/freetype.vcproj index cd5e73535..dc5e67ad4 100644 --- a/freetype/builds/win32/visualc/freetype.vcproj +++ b/freetype/builds/win32/visualc/freetype.vcproj @@ -69,7 +69,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411.lib"
+ OutputFile="..\..\..\objs\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -144,7 +144,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -219,7 +219,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -291,7 +291,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -364,7 +364,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -438,7 +438,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
diff --git a/freetype/builds/win32/visualc/index.html b/freetype/builds/win32/visualc/index.html index 684dbfd69..ef6a5ed62 100644 --- a/freetype/builds/win32/visualc/index.html +++ b/freetype/builds/win32/visualc/index.html @@ -11,14 +11,14 @@ <p>This directory contains project files for Visual C++, named <tt>freetype.dsp</tt>, and Visual Studio, called <tt>freetype.sln</tt>. It -compiles the following libraries from the FreeType 2.4.11 sources:</p> +compiles the following libraries from the FreeType 2.5.0 sources:</p> <ul> <pre> - freetype2411.lib - release build; single threaded - freetype2411_D.lib - debug build; single threaded - freetype2411MT.lib - release build; multi-threaded - freetype2411MT_D.lib - debug build; multi-threaded</pre> + freetype250.lib - release build; single threaded + freetype250_D.lib - debug build; single threaded + freetype250MT.lib - release build; multi-threaded + freetype250MT_D.lib - debug build; multi-threaded</pre> </ul> <p>Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/freetype/builds/win32/visualce/freetype.dsp b/freetype/builds/win32/visualce/freetype.dsp index b8e05ae09..516e47f3c 100644 --- a/freetype/builds/win32/visualce/freetype.dsp +++ b/freetype/builds/win32/visualce/freetype.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250.lib"
!ELSEIF "$(CFG)" == "freetype - Win32 Debug"
@@ -78,7 +78,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250_D.lib"
!ELSEIF "$(CFG)" == "freetype - Win32 Debug Multithreaded"
@@ -102,8 +102,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"lib\freetype2411_D.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411MT_D.lib"
+# ADD BASE LIB32 /nologo /out:"lib\freetype250_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250MT_D.lib"
!ELSEIF "$(CFG)" == "freetype - Win32 Release Multithreaded"
@@ -126,8 +126,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"lib\freetype2411.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411MT.lib"
+# ADD BASE LIB32 /nologo /out:"lib\freetype250.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250MT.lib"
!ELSEIF "$(CFG)" == "freetype - Win32 Release Singlethreaded"
@@ -151,8 +151,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype2411.lib"
-# ADD LIB32 /out:"..\..\..\objs\freetype2411ST.lib"
+# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype250.lib"
+# ADD LIB32 /out:"..\..\..\objs\freetype250ST.lib"
# SUBTRACT LIB32 /nologo
!ELSEIF "$(CFG)" == "freetype - Win32 Debug Singlethreaded"
@@ -177,8 +177,8 @@ BSC32=bscmake.exe # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype2411_D.lib"
-# ADD LIB32 /nologo /out:"..\..\..\objs\freetype2411ST_D.lib"
+# ADD BASE LIB32 /nologo /out:"..\..\..\objs\freetype250_D.lib"
+# ADD LIB32 /nologo /out:"..\..\..\objs\freetype250ST_D.lib"
!ENDIF
diff --git a/freetype/builds/win32/visualce/freetype.vcproj b/freetype/builds/win32/visualce/freetype.vcproj index 3210d77f5..88f51679b 100644 --- a/freetype/builds/win32/visualce/freetype.vcproj +++ b/freetype/builds/win32/visualce/freetype.vcproj @@ -87,7 +87,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411.lib"
+ OutputFile="..\..\..\objs\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -162,7 +162,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -237,7 +237,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -309,7 +309,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -382,7 +382,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -456,7 +456,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -534,7 +534,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411.lib"
+ OutputFile="..\..\..\objs\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -619,7 +619,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -704,7 +704,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -785,7 +785,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -867,7 +867,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -950,7 +950,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1036,7 +1036,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411.lib"
+ OutputFile="..\..\..\objs\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1121,7 +1121,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1206,7 +1206,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -1287,7 +1287,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1369,7 +1369,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1452,7 +1452,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1538,7 +1538,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411.lib"
+ OutputFile="..\..\..\objs\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1623,7 +1623,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1708,7 +1708,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -1789,7 +1789,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1871,7 +1871,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1954,7 +1954,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2040,7 +2040,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411.lib"
+ OutputFile="..\..\..\objs\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2125,7 +2125,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2210,7 +2210,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -2291,7 +2291,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2373,7 +2373,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2456,7 +2456,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2542,7 +2542,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411.lib"
+ OutputFile="..\..\..\objs\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2627,7 +2627,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2712,7 +2712,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -2793,7 +2793,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2875,7 +2875,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2958,7 +2958,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3044,7 +3044,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411.lib"
+ OutputFile="..\..\..\objs\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3129,7 +3129,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3214,7 +3214,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -3295,7 +3295,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3377,7 +3377,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3460,7 +3460,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
diff --git a/freetype/builds/win32/visualce/index.html b/freetype/builds/win32/visualce/index.html index e41c3cba5..c97a861a1 100644 --- a/freetype/builds/win32/visualce/index.html +++ b/freetype/builds/win32/visualce/index.html @@ -21,14 +21,14 @@ the following targets: <li>PPC/SP WM6 (Windows Mobile 6)</li> </ul> -It compiles the following libraries from the FreeType 2.4.11 sources:</p> +It compiles the following libraries from the FreeType 2.5.0 sources:</p> <ul> <pre> - freetype2411.lib - release build; single threaded - freetype2411_D.lib - debug build; single threaded - freetype2411MT.lib - release build; multi-threaded - freetype2411MT_D.lib - debug build; multi-threaded</pre> + freetype250.lib - release build; single threaded + freetype250_D.lib - debug build; single threaded + freetype250MT.lib - release build; multi-threaded + freetype250MT_D.lib - debug build; multi-threaded</pre> </ul> <p>Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/freetype/builds/wince/ftdebug.c b/freetype/builds/wince/ftdebug.c index 272415d3d..354f4f0a7 100644 --- a/freetype/builds/wince/ftdebug.c +++ b/freetype/builds/wince/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component for WinCE (body). */ /* */ -/* Copyright 1996-2001, 2002, 2005, 2008, 2009 by */ +/* Copyright 1996-2001, 2002, 2005, 2008, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -71,7 +71,8 @@ FT_BASE_DEF( void ) - FT_Message( const char* fmt, ... ) + FT_Message( const char* fmt, + ... ) { static char buf[8192]; va_list ap; @@ -87,7 +88,8 @@ FT_BASE_DEF( void ) - FT_Panic( const char* fmt, ... ) + FT_Panic( const char* fmt, + ... ) { static char buf[8192]; va_list ap; @@ -102,6 +104,20 @@ } + /* documentation is in ftdebug.h */ + + FT_BASE_DEF( int ) + FT_Throw( FT_Error error, + int line, + const char* file ) + { + FT_UNUSED( error ); + FT_UNUSED( line ); + FT_UNUSED( file ); + + return 0; + } + #ifdef FT_DEBUG_LEVEL_TRACE @@ -168,9 +184,12 @@ while ( *p && *p != ':' ) p++; + if ( !*p ) + break; + if ( *p == ':' && p > q ) { - int n, i, len = p - q; + int n, i, len = (int)( p - q ); int level = -1, found = -1; @@ -196,7 +215,7 @@ p++; if ( *p ) { - level = *p++ - '0'; + level = *p - '0'; if ( level < 0 || level > 7 ) level = -1; } diff --git a/freetype/builds/wince/vc2005-ce/freetype.vcproj b/freetype/builds/wince/vc2005-ce/freetype.vcproj index 381cf9199..f7e022e77 100644 --- a/freetype/builds/wince/vc2005-ce/freetype.vcproj +++ b/freetype/builds/wince/vc2005-ce/freetype.vcproj @@ -21,7 +21,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -41,7 +41,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -61,7 +61,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -81,7 +81,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -101,7 +101,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -121,7 +121,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -141,7 +141,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -161,7 +161,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -181,7 +181,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -201,7 +201,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -221,7 +221,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -241,7 +241,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -261,7 +261,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST.lib" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST.lib" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -281,7 +281,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST.lib" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST.lib" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -301,7 +301,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST.lib" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST.lib" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -321,7 +321,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST.lib" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST.lib" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -341,7 +341,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST.lib" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST.lib" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -361,7 +361,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST.lib" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST.lib" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -381,7 +381,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -401,7 +401,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -421,7 +421,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -441,7 +441,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -461,7 +461,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -481,7 +481,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -501,7 +501,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -521,7 +521,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -541,7 +541,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -561,7 +561,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -581,7 +581,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -601,7 +601,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411ST_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250ST_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -621,7 +621,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -641,7 +641,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -661,7 +661,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -681,7 +681,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -701,7 +701,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -721,7 +721,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -741,7 +741,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
@@ -758,7 +758,7 @@ <Tool Name="VCManagedResourceCompilerTool" />
<Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1033" />
<Tool Name="VCPreLinkEventTool" />
- <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype2411MT_D.lib" SuppressStartupBanner="true" />
+ <Tool Name="VCLibrarianTool" OutputFile="..\..\..\objs\wince\vc2005-ce\freetype250MT_D.lib" SuppressStartupBanner="true" />
<Tool Name="VCALinkTool" />
<Tool Name="VCXDCMakeTool" />
<Tool Name="VCBscMakeTool" />
diff --git a/freetype/builds/wince/vc2005-ce/index.html b/freetype/builds/wince/vc2005-ce/index.html index ff1e345f8..db5385356 100644 --- a/freetype/builds/wince/vc2005-ce/index.html +++ b/freetype/builds/wince/vc2005-ce/index.html @@ -21,14 +21,14 @@ the following targets: <li>PPC/SP WM6 (Windows Mobile 6)</li> </ul> -It compiles the following libraries from the FreeType 2.4.11 sources:</p> +It compiles the following libraries from the FreeType 2.5.0 sources:</p> <ul> <pre> - freetype2411.lib - release build; single threaded - freetype2411_D.lib - debug build; single threaded - freetype2411MT.lib - release build; multi-threaded - freetype2411MT_D.lib - debug build; multi-threaded</pre> + freetype250.lib - release build; single threaded + freetype250_D.lib - debug build; single threaded + freetype250MT.lib - release build; multi-threaded + freetype250MT_D.lib - debug build; multi-threaded</pre> </ul> <p>Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/freetype/builds/wince/vc2008-ce/freetype.vcproj b/freetype/builds/wince/vc2008-ce/freetype.vcproj index 536e4457d..7920751a3 100644 --- a/freetype/builds/wince/vc2008-ce/freetype.vcproj +++ b/freetype/builds/wince/vc2008-ce/freetype.vcproj @@ -88,7 +88,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -177,7 +177,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -266,7 +266,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -355,7 +355,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -444,7 +444,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -533,7 +533,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -621,7 +621,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -709,7 +709,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -797,7 +797,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -885,7 +885,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -973,7 +973,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1061,7 +1061,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1149,7 +1149,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -1236,7 +1236,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -1323,7 +1323,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -1410,7 +1410,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -1497,7 +1497,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -1584,7 +1584,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST.lib"
/>
<Tool
Name="VCALinkTool"
@@ -1668,7 +1668,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1753,7 +1753,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1838,7 +1838,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -1923,7 +1923,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2008,7 +2008,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2093,7 +2093,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2178,7 +2178,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2263,7 +2263,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2348,7 +2348,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2433,7 +2433,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2518,7 +2518,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2603,7 +2603,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411ST_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250ST_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2689,7 +2689,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2775,7 +2775,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2861,7 +2861,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -2947,7 +2947,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3033,7 +3033,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3119,7 +3119,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3205,7 +3205,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT.lib"
SuppressStartupBanner="true"
/>
<Tool
@@ -3279,7 +3279,7 @@ />
<Tool
Name="VCLibrarianTool"
- OutputFile="..\..\..\objs\wince\vc2008-ce\freetype2411MT_D.lib"
+ OutputFile="..\..\..\objs\wince\vc2008-ce\freetype250MT_D.lib"
SuppressStartupBanner="true"
/>
<Tool
diff --git a/freetype/builds/wince/vc2008-ce/index.html b/freetype/builds/wince/vc2008-ce/index.html index 97cca35fe..50160ecb5 100644 --- a/freetype/builds/wince/vc2008-ce/index.html +++ b/freetype/builds/wince/vc2008-ce/index.html @@ -21,14 +21,14 @@ the following targets: <li>PPC/SP WM6 (Windows Mobile 6)</li> </ul> -It compiles the following libraries from the FreeType 2.4.11 sources:</p> +It compiles the following libraries from the FreeType 2.5.0 sources:</p> <ul> <pre> - freetype2411.lib - release build; single threaded - freetype2411_D.lib - debug build; single threaded - freetype2411MT.lib - release build; multi-threaded - freetype2411MT_D.lib - debug build; multi-threaded</pre> + freetype250.lib - release build; single threaded + freetype250_D.lib - debug build; single threaded + freetype250MT.lib - release build; multi-threaded + freetype250MT_D.lib - debug build; multi-threaded</pre> </ul> <p>Be sure to extract the files with the Windows (CR+LF) line endings. ZIP diff --git a/freetype/configure b/freetype/configure index 55a24fdc5..4d8a945a5 100644 --- a/freetype/configure +++ b/freetype/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by +# Copyright 2002-2006, 2008-2010, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -15,19 +15,29 @@ rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk +# respect GNUMAKE environment variable for backwards compatibility if test "x$GNUMAKE" = x; then - GNUMAKE=make + if test "x$MAKE" = x; then + if test "x`make -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then + MAKE=gmake + else + MAKE=make + fi + fi +else + MAKE=$GNUMAKE fi -if test -z "`$GNUMAKE -v 2>/dev/null | grep GNU`"; then - if test -z "`$GNUMAKE -v 2>/dev/null | grep makepp`"; then - echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2 - echo "Please try" >&2 - echo " \`GNUMAKE=<GNU make command name> $0'." >&2 - echo "or >&2" - echo " \`GNUMAKE=\"makepp --norc-substitution\" $0'." >&2 - exit 1 - fi +if test "x`$MAKE -v 2>/dev/null | egrep 'GNU|makepp'`" = x; then + echo "GNU make (>= 3.80) or makepp (>= 1.19) is required to build FreeType2." >&2 + echo "Please try" >&2 + echo >&2 + echo " MAKE=<GNU make command name> $0" >&2 + echo >&2 + echo "or" >&2 + echo >&2 + echo " MAKE=\"makepp --norc-substitution\" $0" >&2 + exit 1 fi # Get `dirname' functionality. This is taken and adapted from autoconf's @@ -120,6 +130,6 @@ case $# in esac done ;; esac -CFG=$CFG $GNUMAKE setup unix +CFG=$CFG $MAKE setup unix # eof diff --git a/freetype/devel/ftoption.h b/freetype/devel/ftoption.h index 6b2a40f83..220625df9 100644 --- a/freetype/devel/ftoption.h +++ b/freetype/devel/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -205,6 +205,20 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ + /* PNG bitmap support. */ + /* */ + /* FreeType now handles loading color bitmap glyphs in the PNG format. */ + /* This requires help from the external libpng library. Uncompressed */ + /* color bitmaps do not need any external libraries and will be */ + /* supported regardless of this configuration. */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +#define FT_CONFIG_OPTION_USE_PNG + + + /*************************************************************************/ + /* */ /* Define to disable the use of file stream functions and types, FILE, */ /* fopen() etc. Enables the use of smaller system libraries on embedded */ /* systems that have multiple system libraries, some with or without */ @@ -738,6 +752,25 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ /**** ****/ + /**** C F F D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the cff driver module. */ + /* */ +#define CFF_CONFIG_OPTION_OLD_ENGINE + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ @@ -774,37 +807,10 @@ FT_BEGIN_HEADER /* - * Define this variable if you want to keep the layout of internal - * structures that was used prior to FreeType 2.2. This also compiles in - * a few obsolete functions to avoid linking problems on typical Unix - * distributions. - * - * For embedded systems or building a new distribution from scratch, it - * is recommended to disable the macro since it reduces the library's code - * size and activates a few memory-saving optimizations as well. + * This macro is obsolete. Support has been removed in FreeType + * version 2.5. */ -#define FT_CONFIG_OPTION_OLD_INTERNALS - - - /* - * To detect legacy cache-lookup call from a rogue client (<= 2.1.7), - * we restrict the number of charmaps in a font. The current API of - * FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API - * takes charcode only. To determine the passed value is for cmap_index - * or charcode, the possible cmap_index is restricted not to exceed - * the minimum possible charcode by a rogue client. It is also very - * unlikely that a rogue client is interested in Unicode values 0 to 15. - * - * NOTE: The original threshold was 4 deduced from popular number of - * cmap subtables in UCS-4 TrueType fonts, but now it is not - * irregular for OpenType fonts to have more than 4 subtables, - * because variation selector subtables are available for Apple - * and Microsoft platforms. - */ - -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_MAX_CHARMAP_CACHEABLE 15 -#endif +/* #define FT_CONFIG_OPTION_OLD_INTERNALS */ /* diff --git a/freetype/docs/CHANGES b/freetype/docs/CHANGES index 18ec1945a..a5db2d23a 100644 --- a/freetype/docs/CHANGES +++ b/freetype/docs/CHANGES @@ -1,4 +1,169 @@ +CHANGES BETWEEN 2.4.12 and 2.5 + + I. IMPORTANT BUG FIXES + + - The cache manager function `FTC_Manager_Reset' didn't flush the + cache. + + + II. IMPORTANT CHANGES + + - Behdad Esfahbod (on behalf of Google) contributed support for + color embedded bitmaps (eg. color emoji). + + A new load flag, FT_LOAD_COLOR, makes FreeType load color + embedded-bitmaps, following this draft specification + + https://color-emoji.googlecode.com/git/specification/v1.html + + which defines two new SFNT tables, `CBDT' and `CBLC' (named and + modeled after `EBDT' and `EBLC', respectively). The color + bitmaps are stored in the new FT_PIXEL_MODE_BGRA format to + represent BGRA pre-multiplied sRGB images. If PNG support is + available, PNG color images as defined in the same proposed + specification are supported also. + + Note that color bitmaps are converted to grayscale if client + didn't ask for color. + + - As announced in the previous release, the old FreeType CFF + engine is now disabled by default. It can be conditionally + compiled by defining the configuration macro + CFF_CONFIG_OPTION_OLD_ENGINE. + + - As announced in the previous release, all code related to macro + FT_CONFIG_OPTION_OLD_INTERNALS has been removed, thus becoming + obsolete. + + + III. MISCELLANEOUS + + - The property API (`FT_Property_Get' and `FT_Property_Set') is + now declared as stable. + + The exception, however, are the experimental auto-hinter + properties `glyph-to-script-map' and `fallback-script' which are + subject to change in a forthcoming release. + + - `ftview' has been updated to support color embedded bitmaps; it + can be toggled on and off with key `c'. The small cache toggle + is now key `K'. + + - It is now possible to control the version of the TrueType + hinting engine using the new `interpreter-version' property of + the `truetype' module: Versions 35 and 38 (the default) are + supported, which roughly corresponds to disable and enable + subpixel hinting support, respectively. + + In both `ftview' and `ftdiff', switching between the two + versions can be done with key `H'. In the `ftbench' demo + program, command line option `-H' has been extended to activate + the non-default interpreter version. + + - The `ttdebug' program has been further improved. In particular, + it accepts a new command line option `-H' to select the hinting + engine. + + - Another round of TrueType subpixel hinting fixes. + + - The `apinames' tool can now create an import file for NetWare. + + - 64bit compilation of the new CFF engine was buggy. + + - Some fixes to improve robustness in memory-tight situations. + + +====================================================================== + +CHANGES BETWEEN 2.4.11 and 2.4.12 + + - We have another CFF parsing and hinting engine! Written by Dave + Arnold <darnold@adobe.com>, this work has been contributed by + Adobe in collaboration with Google. It is vastly superior to + the old CFF engine, and it will replace it in the next release. + Right now, it is still off by default, and you have to + explicitly select it using the new `hinting-engine' property of + the cff driver: + + ... + #include FT_MODULE_H + #include FT_CFF_DRIVER_H + + FT_Library library; + int engine = FT_CFF_HINTING_ADOBE; + + + ... + FT_Property_Set( library, "cff", "hinting-engine", &engine ); + + The code has a (mature) beta status; we encourage all users to + test it and report any problems. + + In case you want to activate the new CFF engine unconditionally, + apply this patch: + +--- snip --- +diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c +index ebcf189..3f2ce6b 100644 +--- a/src/cff/cffobjs.c ++++ b/src/cff/cffobjs.c +@@ -1056,7 +1056,7 @@ + + + /* set default property values */ +- driver->hinting_engine = FT_CFF_HINTING_FREETYPE; ++ driver->hinting_engine = FT_CFF_HINTING_ADOBE; + driver->no_stem_darkening = FALSE; + + return FT_Err_Ok; +--- snip --- + + - The macro FT_CONFIG_OPTION_OLD_INTERNALS is no longer set by + default. In the next release, we will completely remove the + associated code. Please update your programs in case you are + still using this macro. + + + II. MISCELLANEOUS + + - The (top-level) `configure' script now respects the MAKE + environment variable to specify a `make' binary. For backwards + compatibility, GNUMAKE still overrides MAKE, though. + + - The `ftview' and `ftdiff' demo programs have been redesigned, + showing more options permanently on the screen, among other + minor improvements. + + - Using the `H' key, it is now possible to select the CFF engine + in both `ftview' and `ftdiff'. + + - The new command line option `-H' for `ftbench' selects the Adobe + CFF engine. + + - It is now possible to directly select the LCD rendering mode + with the keys `A'-`F' in `ftview'. The key mapping for cycling + through LCD modes has been changed from `K' and `L' to `k' and + `l', and toggling custom LCD filtering is no longer mapped to + key `F' but to key `L'. + + - In `ftdiff', key `x' toggles between layout modes: Either use + the advance width (this is new and now the default) or the + bounding box information to determine line breaks. + + - For all demo tools, the new command line option `-v' shows the + version. + + - For the demo tools with a GUI, the new command line options `-w' + and `-h' select the width and the height of the output window, + respectively. + + - The `ttdebug' program was broken and has been reactivated. Note + that this program is not compiled by default. + + +====================================================================== + CHANGES BETWEEN 2.4.10 and 2.4.11 I. IMPORTANT BUG FIXES @@ -2486,7 +2651,7 @@ CHANGES BETWEEN 2.0.3 and 2.0.2 number. see <freetype/fterrors.h> for details. - A new public header file has been introduced, named - FT_TRIGONOMETRY_H (include/freetype/fttrig.h), providing + FT_TRIGONOMETRY_H (include/freetype/fttrigon.h), providing trigonometric functions to compute sines, cosines, arctangents, etc. with 16.16 fixed precision. The implementation is based on the CORDIC algorithm and is very fast while being sufficiently @@ -3714,7 +3879,7 @@ Extensions support: ------------------------------------------------------------------------ -Copyright 2000-2012 by +Copyright 2000-2013 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/freetype/docs/INSTALL.UNIX b/freetype/docs/INSTALL.UNIX index 5dc0764ef..7175ca093 100644 --- a/freetype/docs/INSTALL.UNIX +++ b/freetype/docs/INSTALL.UNIX @@ -23,7 +23,7 @@ or MSys on Win32: fail. It is also fine to have GNU Make under another name (e.g. 'gmake') - if you use the GNUMAKE variable as described below. + if you use the MAKE variable as described below. As a special exception, 'makepp' can also be used to build FreeType 2. See the file docs/MAKEPP for details. @@ -61,11 +61,11 @@ or MSys on Win32: ./configure --prefix=/usr - When using a different command to invoke GNU Make, use the GNUMAKE + When using a different command to invoke GNU Make, use the MAKE variable. For example, if `gmake' is the command to use on your system, do something like: - GNUMAKE=gmake ./configure [options] + MAKE=gmake ./configure [options] gmake gmake install (as root) @@ -83,7 +83,7 @@ or MSys on Win32: ---------------------------------------------------------------------- -Copyright 2003, 2004, 2005, 2006, 2007 by +Copyright 2003-2007, 2013 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/freetype/docs/LICENSE.TXT b/freetype/docs/LICENSE.TXT index 62945c85f..99dc342d7 100644 --- a/freetype/docs/LICENSE.TXT +++ b/freetype/docs/LICENSE.TXT @@ -30,5 +30,8 @@ file src/bdf/README and src/pcf/README). The gzip module uses the zlib license (see src/gzip/zlib.h) which too is compatible to the above two licenses. +The MD5 checksum support (only used for debugging in development builds) +is in the public domain. + --- end of LICENSE.TXT --- diff --git a/freetype/docs/VERSION.DLL b/freetype/docs/VERSION.DLL index cf8c35325..2d1cc9acf 100644 --- a/freetype/docs/VERSION.DLL +++ b/freetype/docs/VERSION.DLL @@ -52,6 +52,8 @@ on _most_ systems, but not all of them: release libtool so ------------------------------- + 2.5.0 16.2.10 6.10.2 + 2.4.12 16.1.10 6.10.1 2.4.11 16.0.10 6.10.0 2.4.10 15.0.9 6.9.0 2.4.9 14.1.8 6.8.1 @@ -108,7 +110,7 @@ other release numbers. ------------------------------------------------------------------------ -Copyright 2002-2012 by +Copyright 2002-2013 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, diff --git a/freetype/docs/reference/ft2-auto_hinter.html b/freetype/docs/reference/ft2-auto_hinter.html index 68a87d4ba..f2cf72a9d 100644 --- a/freetype/docs/reference/ft2-auto_hinter.html +++ b/freetype/docs/reference/ft2-auto_hinter.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> The auto-hinter @@ -54,6 +54,7 @@ The auto-hinter <table align=center width="75%"><tr><td> <h4><a name="glyph-to-script-map">glyph-to-script-map</a></h4> <table align=center width="87%"><tr><td> +<p><b>Experimental</b> <b>only</b></p> <p>The auto-hinter provides various script modules to hint glyphs. Examples of supported scripts are Latin or CJK. Before a glyph is auto-hinted, the Unicode character map of the font gets examined, and the script is then determined based on Unicode character ranges, see below.</p> <p>OpenType fonts, however, often provide much more glyphs than character codes (small caps, superscripts, ligatures, swashes, etc.), to be controlled by so-called ‘features’. Handling OpenType features can be quite complicated and thus needs a separate library on top of FreeType.</p> <p>The mapping between glyph indices and scripts (in the auto-hinter sense, see the <a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_XXX</a> values) is stored as an array with ‘num_glyphs’ elements, as found in the font's <a href="ft2-base_interface.html#FT_Face">FT_Face</a> structure. The ‘glyph-to-script-map’ property returns a pointer to this array which can be modified as needed. Note that the modification should happen before the first glyph gets processed by the auto-hinter so that the global analysis of the font shapes actually uses the modified mapping.</p> @@ -97,6 +98,7 @@ Defined in FT_AUTOHINTER_H (freetype/ftautoh.h). </pre></table><br> <table align=center width="87%"><tr><td> +<p><b>Experimental</b> <b>only</b></p> <p>A list of constants used for the <a href="ft2-auto_hinter.html#glyph-to-script-map">glyph-to-script-map</a> property to specify the script submodule the auto-hinter should use for hinting a particular glyph.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>values</b></em></td></tr><tr><td> @@ -192,7 +194,7 @@ Defined in FT_AUTOHINTER_H (freetype/ftautoh.h). U+1900 - U+194F // Limbu U+1B80 - U+1BBF // Sundanese U+1C80 - U+1CDF // Meetei Mayak - U+A800 - U+A82F // Syloti Nagri + U+A800 - U+A82F // Syloti Nagri U+11800 - U+118DF // Sharada </pre> <p>Note that currently Indic support is rudimentary only, missing blue zone support.</p> @@ -221,6 +223,7 @@ Defined in FT_AUTOHINTER_H (freetype/ftautoh.h). </pre></table><br> <table align=center width="87%"><tr><td> +<p><b>Experimental</b> <b>only</b></p> <p>The data exchange structure for the <a href="ft2-auto_hinter.html#glyph-to-script-map">glyph-to-script-map</a> property.</p> </td></tr></table><br> </td></tr></table> @@ -232,6 +235,7 @@ Defined in FT_AUTOHINTER_H (freetype/ftautoh.h). <table align=center width="75%"><tr><td> <h4><a name="fallback-script">fallback-script</a></h4> <table align=center width="87%"><tr><td> +<p><b>Experimental</b> <b>only</b></p> <p>If no auto-hinter script module can be assigned to a glyph, a fallback script gets assigned to it (see also the <a href="ft2-auto_hinter.html#glyph-to-script-map">glyph-to-script-map</a> property). By default, this is <a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_CJK</a>. Using the ‘fallback-script’ property, this fallback value can be changed.</p> <pre class="colored"> FT_Library library; diff --git a/freetype/docs/reference/ft2-base_interface.html b/freetype/docs/reference/ft2-base_interface.html index 8ed2f11b3..3b35b793b 100644 --- a/freetype/docs/reference/ft2-base_interface.html +++ b/freetype/docs/reference/ft2-base_interface.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Base Interface @@ -88,10 +88,10 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). <table align=center width="87%"><tr><td> <p>A handle to a FreeType library instance. Each ‘library’ is completely independent from the others; it is the ‘root’ of a set of objects like fonts, faces, sizes, etc.</p> <p>It also embeds a memory manager (see <a href="ft2-system_interface.html#FT_Memory">FT_Memory</a>), as well as a scan-line converter object (see <a href="ft2-raster.html#FT_Raster">FT_Raster</a>).</p> -<p>For multi-threading applications each thread should have its own FT_Library object.</p> +<p>In multi-threaded applications, make sure that the same FT_Library object or any of its children doesn't get accessed in parallel.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> -<p>Library objects are normally created by <a href="ft2-base_interface.html#FT_Init_FreeType">FT_Init_FreeType</a>, and destroyed with <a href="ft2-base_interface.html#FT_Done_FreeType">FT_Done_FreeType</a>.</p> +<p>Library objects are normally created by <a href="ft2-base_interface.html#FT_Init_FreeType">FT_Init_FreeType</a>, and destroyed with <a href="ft2-base_interface.html#FT_Done_FreeType">FT_Done_FreeType</a>. If you need reference-counting (cf. <a href="ft2-module_management.html#FT_Reference_Library">FT_Reference_Library</a>), use <a href="ft2-module_management.html#FT_New_Library">FT_New_Library</a> and <a href="ft2-module_management.html#FT_Done_Library">FT_Done_Library</a>.</p> </td></tr></table> </td></tr></table> <hr width="75%"> @@ -761,7 +761,8 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). <p>The typographic descender of the face, expressed in font units. For font formats not having this information, it is set to ‘bbox.yMin’. Note that this field is usually negative. Only relevant for scalable formats.</p> </td></tr> <tr valign=top><td><b>height</b></td><td> -<p>The height is the vertical distance between two consecutive baselines, expressed in font units. It is always positive. Only relevant for scalable formats.</p> +<p>This value is the vertical distance between two consecutive baselines, expressed in font units. It is always positive. Only relevant for scalable formats.</p> +<p>If you want the global glyph height, use ‘ascender - descender’.</p> </td></tr> <tr valign=top><td><b>max_advance_width</b></td><td> <p>The maximum advance width, in font units, for all glyphs in this face. This can be used to make word wrapping computations faster. Only relevant for scalable formats.</p> @@ -1509,6 +1510,7 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> <p>In case you want to provide your own memory allocating routines, use <a href="ft2-module_management.html#FT_New_Library">FT_New_Library</a> instead, followed by a call to <a href="ft2-module_management.html#FT_Add_Default_Modules">FT_Add_Default_Modules</a> (or a series of calls to <a href="ft2-module_management.html#FT_Add_Module">FT_Add_Module</a>).</p> <p>For multi-threading applications each thread should have its own FT_Library object.</p> +<p>If you need reference-counting (cf. <a href="ft2-module_management.html#FT_Reference_Library">FT_Reference_Library</a>), use <a href="ft2-module_management.html#FT_New_Library">FT_New_Library</a> and <a href="ft2-module_management.html#FT_Done_Library">FT_Done_Library</a>.</p> </td></tr></table> </td></tr></table> <hr width="75%"> @@ -1767,6 +1769,9 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td> <p>FreeType error code. 0 means success.</p> </td></tr></table> +<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> +<p>Use <a href="ft2-base_interface.html#FT_Done_Face">FT_Done_Face</a> to destroy the created <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object (along with its slot and sizes).</p> +</td></tr></table> </td></tr></table> <hr width="75%"> <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> @@ -2479,6 +2484,8 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). #define <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_MONOCHROME</a> ( 1L << 12 ) #define <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_LINEAR_DESIGN</a> ( 1L << 13 ) #define <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_AUTOHINT</a> ( 1L << 15 ) + /* Bits 16..19 are used by `FT_LOAD_TARGET_' */ +#define <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_COLOR</a> ( 1L << 20 ) </pre></table><br> <table align=center width="87%"><tr><td> @@ -2548,6 +2555,9 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). <tr valign=top><td><b>FT_LOAD_NO_AUTOHINT</b></td><td> <p>Disable auto-hinter. See also the note below.</p> </td></tr> +<tr valign=top><td><b>FT_LOAD_COLOR</b></td><td> +<p>This flag is used to request loading of color embedded-bitmap images. The resulting color bitmaps, if available, will have the <a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_BGRA</a> format. When the flag is not used and color bitmaps are found, they will be converted to 256-level gray bitmaps transparently. Those bitmaps will be in the <a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY</a> format.</p> +</td></tr> </table> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> diff --git a/freetype/docs/reference/ft2-basic_types.html b/freetype/docs/reference/ft2-basic_types.html index 2c3032840..9ff0f736f 100644 --- a/freetype/docs/reference/ft2-basic_types.html +++ b/freetype/docs/reference/ft2-basic_types.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,27 +35,28 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Basic Data Types </h1></center> <h2>Synopsis</h2> <table align=center cellspacing=5 cellpadding=0 border=0> -<tr><td></td><td><a href="#FT_Byte">FT_Byte</a></td><td></td><td><a href="#FT_Offset">FT_Offset</a></td><td></td><td><a href="#FT_UnitVector">FT_UnitVector</a></td></tr> -<tr><td></td><td><a href="#FT_Bytes">FT_Bytes</a></td><td></td><td><a href="#FT_PtrDist">FT_PtrDist</a></td><td></td><td><a href="#FT_F26Dot6">FT_F26Dot6</a></td></tr> -<tr><td></td><td><a href="#FT_Char">FT_Char</a></td><td></td><td><a href="#FT_String">FT_String</a></td><td></td><td><a href="#FT_Pixel_Mode">FT_Pixel_Mode</a></td></tr> -<tr><td></td><td><a href="#FT_Int">FT_Int</a></td><td></td><td><a href="#FT_Tag">FT_Tag</a></td><td></td><td><a href="#ft_pixel_mode_xxx">ft_pixel_mode_xxx</a></td></tr> -<tr><td></td><td><a href="#FT_UInt">FT_UInt</a></td><td></td><td><a href="#FT_Error">FT_Error</a></td><td></td><td><a href="#FT_Palette_Mode">FT_Palette_Mode</a></td></tr> -<tr><td></td><td><a href="#FT_Int16">FT_Int16</a></td><td></td><td><a href="#FT_Fixed">FT_Fixed</a></td><td></td><td><a href="#FT_Bitmap">FT_Bitmap</a></td></tr> -<tr><td></td><td><a href="#FT_UInt16">FT_UInt16</a></td><td></td><td><a href="#FT_Pointer">FT_Pointer</a></td><td></td><td><a href="#FT_IMAGE_TAG">FT_IMAGE_TAG</a></td></tr> -<tr><td></td><td><a href="#FT_Int32">FT_Int32</a></td><td></td><td><a href="#FT_Pos">FT_Pos</a></td><td></td><td><a href="#FT_Glyph_Format">FT_Glyph_Format</a></td></tr> -<tr><td></td><td><a href="#FT_UInt32">FT_UInt32</a></td><td></td><td><a href="#FT_Vector">FT_Vector</a></td><td></td><td><a href="#ft_glyph_format_xxx">ft_glyph_format_xxx</a></td></tr> -<tr><td></td><td><a href="#FT_Short">FT_Short</a></td><td></td><td><a href="#FT_BBox">FT_BBox</a></td><td></td><td><a href="#FT_Data">FT_Data</a></td></tr> -<tr><td></td><td><a href="#FT_UShort">FT_UShort</a></td><td></td><td><a href="#FT_Matrix">FT_Matrix</a></td><td></td><td><a href="#FT_Generic_Finalizer">FT_Generic_Finalizer</a></td></tr> -<tr><td></td><td><a href="#FT_Long">FT_Long</a></td><td></td><td><a href="#FT_FWord">FT_FWord</a></td><td></td><td><a href="#FT_Generic">FT_Generic</a></td></tr> -<tr><td></td><td><a href="#FT_ULong">FT_ULong</a></td><td></td><td><a href="#FT_UFWord">FT_UFWord</a></td><td></td><td><a href="#FT_MAKE_TAG">FT_MAKE_TAG</a></td></tr> -<tr><td></td><td><a href="#FT_Bool">FT_Bool</a></td><td></td><td><a href="#FT_F2Dot14">FT_F2Dot14</a></td><td></td><td></td></tr> +<tr><td></td><td><a href="#FT_Byte">FT_Byte</a></td><td></td><td><a href="#FT_PtrDist">FT_PtrDist</a></td><td></td><td><a href="#FT_Pixel_Mode">FT_Pixel_Mode</a></td></tr> +<tr><td></td><td><a href="#FT_Bytes">FT_Bytes</a></td><td></td><td><a href="#FT_String">FT_String</a></td><td></td><td><a href="#ft_pixel_mode_xxx">ft_pixel_mode_xxx</a></td></tr> +<tr><td></td><td><a href="#FT_Char">FT_Char</a></td><td></td><td><a href="#FT_Tag">FT_Tag</a></td><td></td><td><a href="#FT_Palette_Mode">FT_Palette_Mode</a></td></tr> +<tr><td></td><td><a href="#FT_Int">FT_Int</a></td><td></td><td><a href="#FT_Error">FT_Error</a></td><td></td><td><a href="#FT_Bitmap">FT_Bitmap</a></td></tr> +<tr><td></td><td><a href="#FT_UInt">FT_UInt</a></td><td></td><td><a href="#FT_Fixed">FT_Fixed</a></td><td></td><td><a href="#FT_IMAGE_TAG">FT_IMAGE_TAG</a></td></tr> +<tr><td></td><td><a href="#FT_Int16">FT_Int16</a></td><td></td><td><a href="#FT_Pointer">FT_Pointer</a></td><td></td><td><a href="#FT_Glyph_Format">FT_Glyph_Format</a></td></tr> +<tr><td></td><td><a href="#FT_UInt16">FT_UInt16</a></td><td></td><td><a href="#FT_Pos">FT_Pos</a></td><td></td><td><a href="#ft_glyph_format_xxx">ft_glyph_format_xxx</a></td></tr> +<tr><td></td><td><a href="#FT_Int32">FT_Int32</a></td><td></td><td><a href="#FT_Vector">FT_Vector</a></td><td></td><td><a href="#FT_Data">FT_Data</a></td></tr> +<tr><td></td><td><a href="#FT_UInt32">FT_UInt32</a></td><td></td><td><a href="#FT_BBox">FT_BBox</a></td><td></td><td><a href="#FT_Generic_Finalizer">FT_Generic_Finalizer</a></td></tr> +<tr><td></td><td><a href="#FT_Short">FT_Short</a></td><td></td><td><a href="#FT_Matrix">FT_Matrix</a></td><td></td><td><a href="#FT_Generic">FT_Generic</a></td></tr> +<tr><td></td><td><a href="#FT_UShort">FT_UShort</a></td><td></td><td><a href="#FT_FWord">FT_FWord</a></td><td></td><td><a href="#FT_MAKE_TAG">FT_MAKE_TAG</a></td></tr> +<tr><td></td><td><a href="#FT_Long">FT_Long</a></td><td></td><td><a href="#FT_UFWord">FT_UFWord</a></td><td></td><td><a href="#FT_Int64">FT_Int64</a></td></tr> +<tr><td></td><td><a href="#FT_ULong">FT_ULong</a></td><td></td><td><a href="#FT_F2Dot14">FT_F2Dot14</a></td><td></td><td><a href="#FT_UInt64">FT_UInt64</a></td></tr> +<tr><td></td><td><a href="#FT_Bool">FT_Bool</a></td><td></td><td><a href="#FT_UnitVector">FT_UnitVector</a></td><td></td><td></td></tr> +<tr><td></td><td><a href="#FT_Offset">FT_Offset</a></td><td></td><td><a href="#FT_F26Dot6">FT_F26Dot6</a></td><td></td><td></td></tr> </table><br><br> <table align=center width="87%"><tr><td> @@ -430,7 +431,7 @@ Defined in FT_TYPES_H (freetype/fttypes.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>This type is used to store 16.16 fixed float values, like scaling values or matrix coefficients.</p> +<p>This type is used to store 16.16 fixed-point values, like scaling values or matrix coefficients.</p> </td></tr></table><br> </td></tr></table> <hr width="75%"> @@ -468,7 +469,7 @@ Defined in FT_IMAGE_H (freetype/ftimage.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>The type FT_Pos is used to store vectorial coordinates. Depending on the context, these can represent distances in integer font units, or 16.16, or 26.6 fixed float pixel coordinates.</p> +<p>The type FT_Pos is used to store vectorial coordinates. Depending on the context, these can represent distances in integer font units, or 16.16, or 26.6 fixed-point pixel coordinates.</p> </td></tr></table><br> </td></tr></table> <hr width="75%"> @@ -573,7 +574,7 @@ Defined in FT_TYPES_H (freetype/fttypes.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>A simple structure used to store a 2x2 matrix. Coefficients are in 16.16 fixed float format. The computation performed is:</p> +<p>A simple structure used to store a 2x2 matrix. Coefficients are in 16.16 fixed-point format. The computation performed is:</p> <pre class="colored"> x' = x*xx + y*xy y' = x*yx + y*yy @@ -651,7 +652,7 @@ Defined in FT_TYPES_H (freetype/fttypes.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>A signed 2.14 fixed float type used for unit vectors.</p> +<p>A signed 2.14 fixed-point type used for unit vectors.</p> </td></tr></table><br> </td></tr></table> <hr width="75%"> @@ -705,7 +706,7 @@ Defined in FT_TYPES_H (freetype/fttypes.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>A signed 26.6 fixed float type used for vectorial pixel coordinates.</p> +<p>A signed 26.6 fixed-point type used for vectorial pixel coordinates.</p> </td></tr></table><br> </td></tr></table> <hr width="75%"> @@ -729,6 +730,7 @@ Defined in FT_IMAGE_H (freetype/ftimage.h). <a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY4</a>, <a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_LCD</a>, <a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_LCD_V</a>, + <a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_BGRA</a>, FT_PIXEL_MODE_MAX /* do not remove */ @@ -762,6 +764,9 @@ Defined in FT_IMAGE_H (freetype/ftimage.h). <tr valign=top><td><b>FT_PIXEL_MODE_LCD_V</b></td><td> <p>An 8-bit bitmap, representing RGB or BGR decimated glyph images used for display on rotated LCD displays; the bitmap is three times taller than the original glyph image. See also <a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD_V</a>.</p> </td></tr> +<tr valign=top><td><b>FT_PIXEL_MODE_BGRA</b></td><td> +<p>An image with four 8-bit channels per pixel, representing a color image (such as emoticons) with alpha channel. For each pixel, the format is BGRA, which means, the blue channel comes first in memory. The color channels are pre-multiplied and in the sRGB colorspace. For example, full red at half-translucent opacity will be represented as ‘00,00,80,80’, not ‘00,00,FF,80’. See also <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_COLOR</a>.</p> +</td></tr> </table> </td></tr></table> </td></tr></table> @@ -1169,5 +1174,37 @@ Defined in FT_TYPES_H (freetype/fttypes.h). <td width="100%"></td> <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> +<table align=center width="75%"><tr><td> +<h4><a name="FT_Int64">FT_Int64</a></h4> +<table align=center width="87%"><tr><td> +Defined in FT_CONFIG_CONFIG_H (freetype/config/ftconfig.h). +</td></tr></table><br> +<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> + + <span class="keyword">typedef</span> <span class="keyword">signed</span> XXX <b>FT_Int64</b>; + +</pre></table><br> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + +<table align=center width="75%"><tr><td> +<h4><a name="FT_UInt64">FT_UInt64</a></h4> +<table align=center width="87%"><tr><td> +Defined in FT_CONFIG_CONFIG_H (freetype/config/ftconfig.h). +</td></tr></table><br> +<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> + + <span class="keyword">typedef</span> <span class="keyword">unsigned</span> XXX <b>FT_UInt64</b>; + +</pre></table><br> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + </body> </html> diff --git a/freetype/docs/reference/ft2-bdf_fonts.html b/freetype/docs/reference/ft2-bdf_fonts.html index cfcd1cceb..ecf25412d 100644 --- a/freetype/docs/reference/ft2-bdf_fonts.html +++ b/freetype/docs/reference/ft2-bdf_fonts.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> BDF and PCF Files diff --git a/freetype/docs/reference/ft2-bitmap_handling.html b/freetype/docs/reference/ft2-bitmap_handling.html index cce07578e..8f18bebf5 100644 --- a/freetype/docs/reference/ft2-bitmap_handling.html +++ b/freetype/docs/reference/ft2-bitmap_handling.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Bitmap Handling @@ -188,7 +188,7 @@ Defined in FT_BITMAP_H (freetype/ftbitmap.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a bitmap object with depth 8bpp, making the number of used bytes per line (a.k.a. the ‘pitch’) a multiple of ‘alignment’.</p> +<p>Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp to a bitmap object with depth 8bpp, making the number of used bytes line (a.k.a. the ‘pitch’) a multiple of ‘alignment’.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> diff --git a/freetype/docs/reference/ft2-bzip2.html b/freetype/docs/reference/ft2-bzip2.html index 4c2f1a6a3..39e898c5e 100644 --- a/freetype/docs/reference/ft2-bzip2.html +++ b/freetype/docs/reference/ft2-bzip2.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> BZIP2 Streams diff --git a/freetype/docs/reference/ft2-cache_subsystem.html b/freetype/docs/reference/ft2-cache_subsystem.html index 061ea3589..ae2219406 100644 --- a/freetype/docs/reference/ft2-cache_subsystem.html +++ b/freetype/docs/reference/ft2-cache_subsystem.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Cache Sub-System @@ -350,7 +350,7 @@ Defined in FT_CACHE_H (freetype/ftcache.h). </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> <p>The returned <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object is always owned by the manager. You should never try to discard it yourself.</p> -<p>The <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object doesn't necessarily have a current size object (i.e., face->size can be 0). If you need a specific ‘font size’, use <a href="ft2-cache_subsystem.html#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a> instead.</p> +<p>The <a href="ft2-base_interface.html#FT_Face">FT_Face</a> object doesn't necessarily have a current size object (i.e., face->size can be 0). If you need a specific ‘font size’, use <a href="ft2-cache_subsystem.html#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a> instead.</p> <p>Never change the face's transformation matrix (i.e., never call the <a href="ft2-base_interface.html#FT_Set_Transform">FT_Set_Transform</a> function) on a returned face! If you need to transform glyphs, do it yourself after glyph loading.</p> <p>When you perform a lookup, out-of-memory errors are detected <i>within</i> the lookup and force incremental flushes of the cache until enough memory is released for the lookup to succeed.</p> <p>If a lookup fails with ‘FT_Err_Out_Of_Memory’ the cache has already been completely flushed, and still no memory was available for the operation.</p> @@ -732,7 +732,7 @@ Defined in FT_CACHE_H (freetype/ftcache.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>A handle to an glyph image cache object. They are designed to hold many distinct glyph images while not exceeding a certain memory threshold.</p> +<p>A handle to a glyph image cache object. They are designed to hold many distinct glyph images while not exceeding a certain memory threshold.</p> </td></tr></table><br> </td></tr></table> <hr width="75%"> diff --git a/freetype/docs/reference/ft2-cff_driver.html b/freetype/docs/reference/ft2-cff_driver.html new file mode 100644 index 000000000..35d2f9404 --- /dev/null +++ b/freetype/docs/reference/ft2-cff_driver.html @@ -0,0 +1,138 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>FreeType-2.5.0 API Reference</title> +<style type="text/css"> + body { font-family: Verdana, Geneva, Arial, Helvetica, serif; + color: #000000; + background: #FFFFFF; } + + p { text-align: justify; } + h1 { text-align: center; } + li { text-align: justify; } + td { padding: 0 0.5em 0 0.5em; } + td.left { padding: 0 0.5em 0 0.5em; + text-align: left; } + + a:link { color: #0000EF; } + a:visited { color: #51188E; } + a:hover { color: #FF0000; } + + span.keyword { font-family: monospace; + text-align: left; + white-space: pre; + color: darkblue; } + + pre.colored { color: blue; } + + ul.empty { list-style-type: none; } +</style> +</head> +<body> + +<table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> +<center><h1>FreeType-2.5.0 API Reference</h1></center> + +<center><h1> +The CFF driver +</h1></center> +<h2>Synopsis</h2> +<table align=center cellspacing=5 cellpadding=0 border=0> +<tr><td></td><td><a href="#hinting-engine">hinting-engine</a></td><td></td><td><a href="#FT_CFF_HINTING_XXX">FT_CFF_HINTING_XXX</a></td><td></td><td><a href="#no-stem-darkening">no-stem-darkening</a></td></tr> +</table><br><br> + +<table align=center width="87%"><tr><td> +<p>While FreeType's CFF driver doesn't expose API functions by itself, it is possible to control its behaviour with <a href="ft2-module_management.html#FT_Property_Set">FT_Property_Set</a> and <a href="ft2-module_management.html#FT_Property_Get">FT_Property_Get</a>. The following lists the available properties together with the necessary macros and structures.</p> +<p>The CFF driver's module name is ‘cff’.</p> +</td></tr></table><br> +<table align=center width="75%"><tr><td> +<h4><a name="hinting-engine">hinting-engine</a></h4> +<table align=center width="87%"><tr><td> +<p>Thanks to Adobe, which contributed a new hinting (and parsing) engine, an application can select between ‘freetype’ and ‘adobe’ if compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration macro isn't defined, ‘hinting-engine’ does nothing.</p> +<p>The default engine is ‘freetype’ if CFF_CONFIG_OPTION_OLD_ENGINE is defined, and ‘adobe’ otherwise.</p> +<p>The following example code demonstrates how to select Adobe's hinting engine (omitting the error handling).</p> +<pre class="colored"> + FT_Library library; + FT_Face face; + FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; + + + FT_Init_FreeType( &library ); + + FT_Property_Set( library, "cff", + "hinting-engine", &hinting_engine ); +</pre> +</td></tr></table><br> +<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> +<p>This property can be used with <a href="ft2-module_management.html#FT_Property_Get">FT_Property_Get</a> also.</p> +</td></tr></table> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + +<table align=center width="75%"><tr><td> +<h4><a name="FT_CFF_HINTING_XXX">FT_CFF_HINTING_XXX</a></h4> +<table align=center width="87%"><tr><td> +Defined in FT_CFF_DRIVER_H (freetype/ftcffdrv.h). +</td></tr></table><br> +<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> + +#define <a href="ft2-cff_driver.html#FT_CFF_HINTING_XXX">FT_CFF_HINTING_FREETYPE</a> 0 +#define <a href="ft2-cff_driver.html#FT_CFF_HINTING_XXX">FT_CFF_HINTING_ADOBE</a> 1 + +</pre></table><br> +<table align=center width="87%"><tr><td> +<p>A list of constants used for the <a href="ft2-cff_driver.html#hinting-engine">hinting-engine</a> property to select the hinting engine for CFF fonts.</p> +</td></tr></table><br> +<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>values</b></em></td></tr><tr><td> +<p></p> +<table cellpadding=3 border=0> +<tr valign=top><td colspan=0><b>FT_CFF_HINTING_FREETYPE</b></td></tr> +<tr valign=top><td></td><td> +<p>Use the old FreeType hinting engine.</p> +</td></tr> +<tr valign=top><td><b>FT_CFF_HINTING_ADOBE</b></td><td> +<p>Use the hinting engine contributed by Adobe.</p> +</td></tr> +</table> +</td></tr></table> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + +<table align=center width="75%"><tr><td> +<h4><a name="no-stem-darkening">no-stem-darkening</a></h4> +<table align=center width="87%"><tr><td> +<p>By default, the Adobe CFF engine darkens stems at smaller sizes, regardless of hinting, to enhance contrast. Setting this property, stem darkening gets switched off.</p> +<p>Note that stem darkening is never applied if <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_SCALE</a> is set.</p> +<pre class="colored"> + FT_Library library; + FT_Face face; + FT_Bool no_stem_darkening = TRUE; + + + FT_Init_FreeType( &library ); + + FT_Property_Set( library, "cff", + "no-stem-darkening", &no_stem_darkening ); +</pre> +</td></tr></table><br> +<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> +<p>This property can be used with <a href="ft2-module_management.html#FT_Property_Get">FT_Property_Get</a> also.</p> +</td></tr></table> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + +</body> +</html> diff --git a/freetype/docs/reference/ft2-cid_fonts.html b/freetype/docs/reference/ft2-cid_fonts.html index b49188e04..a31eeace3 100644 --- a/freetype/docs/reference/ft2-cid_fonts.html +++ b/freetype/docs/reference/ft2-cid_fonts.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> CID Fonts diff --git a/freetype/docs/reference/ft2-computations.html b/freetype/docs/reference/ft2-computations.html index 08464392c..d19452b67 100644 --- a/freetype/docs/reference/ft2-computations.html +++ b/freetype/docs/reference/ft2-computations.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Computations @@ -108,7 +108,7 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>A very simple function used to perform the computation ‘(a*b)/0x10000’ with maximum accuracy. Most of the time this is used to multiply a given value by a 16.16 fixed float factor.</p> +<p>A very simple function used to perform the computation ‘(a*b)/0x10000’ with maximum accuracy. Most of the time this is used to multiply a given value by a 16.16 fixed-point factor.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> @@ -147,7 +147,7 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>A very simple function used to perform the computation ‘(a*0x10000)/b’ with maximum accuracy. Most of the time, this is used to divide a given value by a 16.16 fixed float factor.</p> +<p>A very simple function used to perform the computation ‘(a*0x10000)/b’ with maximum accuracy. Most of the time, this is used to divide a given value by a 16.16 fixed-point factor.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> @@ -387,7 +387,7 @@ Defined in FT_TRIGONOMETRY_H (freetype/fttrigon.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>This type is used to model angle values in FreeType. Note that the angle is a 16.16 fixed float value expressed in degrees.</p> +<p>This type is used to model angle values in FreeType. Note that the angle is a 16.16 fixed-point value expressed in degrees.</p> </td></tr></table><br> </td></tr></table> <hr width="75%"> @@ -483,7 +483,7 @@ Defined in FT_TRIGONOMETRY_H (freetype/fttrigon.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>Return the sinus of a given angle in fixed point format.</p> +<p>Return the sinus of a given angle in fixed-point format.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> @@ -517,7 +517,7 @@ Defined in FT_TRIGONOMETRY_H (freetype/fttrigon.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>Return the cosinus of a given angle in fixed point format.</p> +<p>Return the cosinus of a given angle in fixed-point format.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> @@ -551,7 +551,7 @@ Defined in FT_TRIGONOMETRY_H (freetype/fttrigon.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>Return the tangent of a given angle in fixed point format.</p> +<p>Return the tangent of a given angle in fixed-point format.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> diff --git a/freetype/docs/reference/ft2-font_formats.html b/freetype/docs/reference/ft2-font_formats.html index 84ecd4835..0ba5734b2 100644 --- a/freetype/docs/reference/ft2-font_formats.html +++ b/freetype/docs/reference/ft2-font_formats.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Font Formats diff --git a/freetype/docs/reference/ft2-gasp_table.html b/freetype/docs/reference/ft2-gasp_table.html index 9b00d55c1..43307ae2b 100644 --- a/freetype/docs/reference/ft2-gasp_table.html +++ b/freetype/docs/reference/ft2-gasp_table.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Gasp Table diff --git a/freetype/docs/reference/ft2-glyph_management.html b/freetype/docs/reference/ft2-glyph_management.html index 6249dfd6a..201eb5385 100644 --- a/freetype/docs/reference/ft2-glyph_management.html +++ b/freetype/docs/reference/ft2-glyph_management.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Glyph Management @@ -92,7 +92,7 @@ Defined in FT_GLYPH_H (freetype/ftglyph.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>The root glyph structure contains a given glyph image plus its advance width in 16.16 fixed float format.</p> +<p>The root glyph structure contains a given glyph image plus its advance width in 16.16 fixed-point format.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>fields</b></em></td></tr><tr><td> <p></p> diff --git a/freetype/docs/reference/ft2-glyph_stroker.html b/freetype/docs/reference/ft2-glyph_stroker.html index 7822ab055..4b911012d 100644 --- a/freetype/docs/reference/ft2-glyph_stroker.html +++ b/freetype/docs/reference/ft2-glyph_stroker.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Glyph Stroker @@ -348,7 +348,7 @@ Defined in FT_STROKER_H (freetype/ftstroke.h). <p>The line join style.</p> </td></tr> <tr valign=top><td><b>miter_limit</b></td><td> -<p>The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles, expressed as 16.16 fixed point value.</p> +<p>The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles, expressed as 16.16 fixed-point value.</p> </td></tr> </table> </td></tr></table> diff --git a/freetype/docs/reference/ft2-glyph_variants.html b/freetype/docs/reference/ft2-glyph_variants.html index a654a268f..b27b509e5 100644 --- a/freetype/docs/reference/ft2-glyph_variants.html +++ b/freetype/docs/reference/ft2-glyph_variants.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Glyph Variants diff --git a/freetype/docs/reference/ft2-gx_validation.html b/freetype/docs/reference/ft2-gx_validation.html index d15594824..59343d3cb 100644 --- a/freetype/docs/reference/ft2-gx_validation.html +++ b/freetype/docs/reference/ft2-gx_validation.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> TrueTypeGX/AAT Validation diff --git a/freetype/docs/reference/ft2-gzip.html b/freetype/docs/reference/ft2-gzip.html index 538347901..6de691ad0 100644 --- a/freetype/docs/reference/ft2-gzip.html +++ b/freetype/docs/reference/ft2-gzip.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> GZIP Streams diff --git a/freetype/docs/reference/ft2-header_file_macros.html b/freetype/docs/reference/ft2-header_file_macros.html index 95d821b33..0f2a483d6 100644 --- a/freetype/docs/reference/ft2-header_file_macros.html +++ b/freetype/docs/reference/ft2-header_file_macros.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,37 +35,38 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Header File Macros </h1></center> <h2>Synopsis</h2> <table align=center cellspacing=5 cellpadding=0 border=0> -<tr><td></td><td><a href="#FT_CONFIG_CONFIG_H">FT_CONFIG_CONFIG_H</a></td><td></td><td><a href="#FT_BZIP2_H">FT_BZIP2_H</a></td></tr> -<tr><td></td><td><a href="#FT_CONFIG_STANDARD_LIBRARY_H">FT_CONFIG_STANDARD_LIBRARY_H</a></td><td></td><td><a href="#FT_WINFONTS_H">FT_WINFONTS_H</a></td></tr> -<tr><td></td><td><a href="#FT_CONFIG_OPTIONS_H">FT_CONFIG_OPTIONS_H</a></td><td></td><td><a href="#FT_GLYPH_H">FT_GLYPH_H</a></td></tr> -<tr><td></td><td><a href="#FT_CONFIG_MODULES_H">FT_CONFIG_MODULES_H</a></td><td></td><td><a href="#FT_BITMAP_H">FT_BITMAP_H</a></td></tr> -<tr><td></td><td><a href="#FT_FREETYPE_H">FT_FREETYPE_H</a></td><td></td><td><a href="#FT_BBOX_H">FT_BBOX_H</a></td></tr> -<tr><td></td><td><a href="#FT_ERRORS_H">FT_ERRORS_H</a></td><td></td><td><a href="#FT_CACHE_H">FT_CACHE_H</a></td></tr> -<tr><td></td><td><a href="#FT_MODULE_ERRORS_H">FT_MODULE_ERRORS_H</a></td><td></td><td><a href="#FT_CACHE_IMAGE_H">FT_CACHE_IMAGE_H</a></td></tr> -<tr><td></td><td><a href="#FT_SYSTEM_H">FT_SYSTEM_H</a></td><td></td><td><a href="#FT_CACHE_SMALL_BITMAPS_H">FT_CACHE_SMALL_BITMAPS_H</a></td></tr> -<tr><td></td><td><a href="#FT_IMAGE_H">FT_IMAGE_H</a></td><td></td><td><a href="#FT_CACHE_CHARMAP_H">FT_CACHE_CHARMAP_H</a></td></tr> -<tr><td></td><td><a href="#FT_TYPES_H">FT_TYPES_H</a></td><td></td><td><a href="#FT_MAC_H">FT_MAC_H</a></td></tr> -<tr><td></td><td><a href="#FT_LIST_H">FT_LIST_H</a></td><td></td><td><a href="#FT_MULTIPLE_MASTERS_H">FT_MULTIPLE_MASTERS_H</a></td></tr> -<tr><td></td><td><a href="#FT_OUTLINE_H">FT_OUTLINE_H</a></td><td></td><td><a href="#FT_SFNT_NAMES_H">FT_SFNT_NAMES_H</a></td></tr> -<tr><td></td><td><a href="#FT_SIZES_H">FT_SIZES_H</a></td><td></td><td><a href="#FT_OPENTYPE_VALIDATE_H">FT_OPENTYPE_VALIDATE_H</a></td></tr> -<tr><td></td><td><a href="#FT_MODULE_H">FT_MODULE_H</a></td><td></td><td><a href="#FT_GX_VALIDATE_H">FT_GX_VALIDATE_H</a></td></tr> -<tr><td></td><td><a href="#FT_RENDER_H">FT_RENDER_H</a></td><td></td><td><a href="#FT_PFR_H">FT_PFR_H</a></td></tr> -<tr><td></td><td><a href="#FT_AUTOHINTER_H">FT_AUTOHINTER_H</a></td><td></td><td><a href="#FT_STROKER_H">FT_STROKER_H</a></td></tr> -<tr><td></td><td><a href="#FT_TYPE1_TABLES_H">FT_TYPE1_TABLES_H</a></td><td></td><td><a href="#FT_SYNTHESIS_H">FT_SYNTHESIS_H</a></td></tr> -<tr><td></td><td><a href="#FT_TRUETYPE_IDS_H">FT_TRUETYPE_IDS_H</a></td><td></td><td><a href="#FT_XFREE86_H">FT_XFREE86_H</a></td></tr> -<tr><td></td><td><a href="#FT_TRUETYPE_TABLES_H">FT_TRUETYPE_TABLES_H</a></td><td></td><td><a href="#FT_TRIGONOMETRY_H">FT_TRIGONOMETRY_H</a></td></tr> -<tr><td></td><td><a href="#FT_TRUETYPE_TAGS_H">FT_TRUETYPE_TAGS_H</a></td><td></td><td><a href="#FT_LCD_FILTER_H">FT_LCD_FILTER_H</a></td></tr> -<tr><td></td><td><a href="#FT_BDF_H">FT_BDF_H</a></td><td></td><td><a href="#FT_UNPATENTED_HINTING_H">FT_UNPATENTED_HINTING_H</a></td></tr> -<tr><td></td><td><a href="#FT_CID_H">FT_CID_H</a></td><td></td><td><a href="#FT_INCREMENTAL_H">FT_INCREMENTAL_H</a></td></tr> -<tr><td></td><td><a href="#FT_GZIP_H">FT_GZIP_H</a></td><td></td><td><a href="#FT_GASP_H">FT_GASP_H</a></td></tr> -<tr><td></td><td><a href="#FT_LZW_H">FT_LZW_H</a></td><td></td><td><a href="#FT_ADVANCES_H">FT_ADVANCES_H</a></td></tr> +<tr><td></td><td><a href="#FT_CONFIG_CONFIG_H">FT_CONFIG_CONFIG_H</a></td><td></td><td><a href="#FT_LZW_H">FT_LZW_H</a></td></tr> +<tr><td></td><td><a href="#FT_CONFIG_STANDARD_LIBRARY_H">FT_CONFIG_STANDARD_LIBRARY_H</a></td><td></td><td><a href="#FT_BZIP2_H">FT_BZIP2_H</a></td></tr> +<tr><td></td><td><a href="#FT_CONFIG_OPTIONS_H">FT_CONFIG_OPTIONS_H</a></td><td></td><td><a href="#FT_WINFONTS_H">FT_WINFONTS_H</a></td></tr> +<tr><td></td><td><a href="#FT_CONFIG_MODULES_H">FT_CONFIG_MODULES_H</a></td><td></td><td><a href="#FT_GLYPH_H">FT_GLYPH_H</a></td></tr> +<tr><td></td><td><a href="#FT_FREETYPE_H">FT_FREETYPE_H</a></td><td></td><td><a href="#FT_BITMAP_H">FT_BITMAP_H</a></td></tr> +<tr><td></td><td><a href="#FT_ERRORS_H">FT_ERRORS_H</a></td><td></td><td><a href="#FT_BBOX_H">FT_BBOX_H</a></td></tr> +<tr><td></td><td><a href="#FT_MODULE_ERRORS_H">FT_MODULE_ERRORS_H</a></td><td></td><td><a href="#FT_CACHE_H">FT_CACHE_H</a></td></tr> +<tr><td></td><td><a href="#FT_SYSTEM_H">FT_SYSTEM_H</a></td><td></td><td><a href="#FT_CACHE_IMAGE_H">FT_CACHE_IMAGE_H</a></td></tr> +<tr><td></td><td><a href="#FT_IMAGE_H">FT_IMAGE_H</a></td><td></td><td><a href="#FT_CACHE_SMALL_BITMAPS_H">FT_CACHE_SMALL_BITMAPS_H</a></td></tr> +<tr><td></td><td><a href="#FT_TYPES_H">FT_TYPES_H</a></td><td></td><td><a href="#FT_CACHE_CHARMAP_H">FT_CACHE_CHARMAP_H</a></td></tr> +<tr><td></td><td><a href="#FT_LIST_H">FT_LIST_H</a></td><td></td><td><a href="#FT_MAC_H">FT_MAC_H</a></td></tr> +<tr><td></td><td><a href="#FT_OUTLINE_H">FT_OUTLINE_H</a></td><td></td><td><a href="#FT_MULTIPLE_MASTERS_H">FT_MULTIPLE_MASTERS_H</a></td></tr> +<tr><td></td><td><a href="#FT_SIZES_H">FT_SIZES_H</a></td><td></td><td><a href="#FT_SFNT_NAMES_H">FT_SFNT_NAMES_H</a></td></tr> +<tr><td></td><td><a href="#FT_MODULE_H">FT_MODULE_H</a></td><td></td><td><a href="#FT_OPENTYPE_VALIDATE_H">FT_OPENTYPE_VALIDATE_H</a></td></tr> +<tr><td></td><td><a href="#FT_RENDER_H">FT_RENDER_H</a></td><td></td><td><a href="#FT_GX_VALIDATE_H">FT_GX_VALIDATE_H</a></td></tr> +<tr><td></td><td><a href="#FT_AUTOHINTER_H">FT_AUTOHINTER_H</a></td><td></td><td><a href="#FT_PFR_H">FT_PFR_H</a></td></tr> +<tr><td></td><td><a href="#FT_CFF_DRIVER_H">FT_CFF_DRIVER_H</a></td><td></td><td><a href="#FT_STROKER_H">FT_STROKER_H</a></td></tr> +<tr><td></td><td><a href="#FT_TRUETYPE_DRIVER_H">FT_TRUETYPE_DRIVER_H</a></td><td></td><td><a href="#FT_SYNTHESIS_H">FT_SYNTHESIS_H</a></td></tr> +<tr><td></td><td><a href="#FT_TYPE1_TABLES_H">FT_TYPE1_TABLES_H</a></td><td></td><td><a href="#FT_XFREE86_H">FT_XFREE86_H</a></td></tr> +<tr><td></td><td><a href="#FT_TRUETYPE_IDS_H">FT_TRUETYPE_IDS_H</a></td><td></td><td><a href="#FT_TRIGONOMETRY_H">FT_TRIGONOMETRY_H</a></td></tr> +<tr><td></td><td><a href="#FT_TRUETYPE_TABLES_H">FT_TRUETYPE_TABLES_H</a></td><td></td><td><a href="#FT_LCD_FILTER_H">FT_LCD_FILTER_H</a></td></tr> +<tr><td></td><td><a href="#FT_TRUETYPE_TAGS_H">FT_TRUETYPE_TAGS_H</a></td><td></td><td><a href="#FT_UNPATENTED_HINTING_H">FT_UNPATENTED_HINTING_H</a></td></tr> +<tr><td></td><td><a href="#FT_BDF_H">FT_BDF_H</a></td><td></td><td><a href="#FT_INCREMENTAL_H">FT_INCREMENTAL_H</a></td></tr> +<tr><td></td><td><a href="#FT_CID_H">FT_CID_H</a></td><td></td><td><a href="#FT_GASP_H">FT_GASP_H</a></td></tr> +<tr><td></td><td><a href="#FT_GZIP_H">FT_GZIP_H</a></td><td></td><td><a href="#FT_ADVANCES_H">FT_ADVANCES_H</a></td></tr> </table><br><br> <table align=center width="87%"><tr><td> @@ -348,6 +349,38 @@ Header File Macros <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> <table align=center width="75%"><tr><td> +<h4><a name="FT_CFF_DRIVER_H">FT_CFF_DRIVER_H</a></h4> +<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> + +#define <b>FT_CFF_DRIVER_H</b> <freetype/ftcffdrv.h> + +</pre></table><br> +<table align=center width="87%"><tr><td> +<p>A macro used in #include statements to name the file containing structures and macros related to the CFF driver module.</p> +</td></tr></table><br> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + +<table align=center width="75%"><tr><td> +<h4><a name="FT_TRUETYPE_DRIVER_H">FT_TRUETYPE_DRIVER_H</a></h4> +<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> + +#define <b>FT_TRUETYPE_DRIVER_H</b> <freetype/ftttdrv.h> + +</pre></table><br> +<table align=center width="87%"><tr><td> +<p>A macro used in #include statements to name the file containing structures and macros related to the TrueType driver module.</p> +</td></tr></table><br> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + +<table align=center width="75%"><tr><td> <h4><a name="FT_TYPE1_TABLES_H">FT_TYPE1_TABLES_H</a></h4> <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> diff --git a/freetype/docs/reference/ft2-incremental.html b/freetype/docs/reference/ft2-incremental.html index 2e693f752..2c78c9ef2 100644 --- a/freetype/docs/reference/ft2-incremental.html +++ b/freetype/docs/reference/ft2-incremental.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Incremental Loading diff --git a/freetype/docs/reference/ft2-index.html b/freetype/docs/reference/ft2-index.html index 76aa35f58..1369414d3 100644 --- a/freetype/docs/reference/ft2-index.html +++ b/freetype/docs/reference/ft2-index.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -34,265 +34,270 @@ <table align=center><tr><td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <table align=center border=0 cellpadding=0 cellspacing=0> -<tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_ATOM</a></td><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_LIGHT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_Stroker_LineJoin</a></td></tr> -<tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_CARDINAL</a></td><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_NONE</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineTo">FT_Stroker_LineTo</a></td></tr> -<tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_INTEGER</a></td><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LcdFilter</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_New">FT_Stroker_New</a></td></tr> -<tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_NONE</a></td><td><a href="ft2-header_file_macros.html#FT_LIST_H">FT_LIST_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ParseOutline">FT_Stroker_ParseOutline</a></td></tr> -<tr><td><a href="ft2-bdf_fonts.html#BDF_Property">BDF_Property</a></td><td><a href="ft2-base_interface.html#FT_Library">FT_Library</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Rewind">FT_Stroker_Rewind</a></td></tr> -<tr><td><a href="ft2-bdf_fonts.html#BDF_PropertyRec">BDF_PropertyRec</a></td><td><a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Set">FT_Stroker_Set</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#CID_FaceDict">CID_FaceDict</a></td><td><a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilterWeights">FT_Library_SetLcdFilterWeights</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_StrokerBorder</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#CID_FaceDictRec">CID_FaceDictRec</a></td><td><a href="ft2-version.html#FT_Library_Version">FT_Library_Version</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_2X2</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#CID_FaceInfo">CID_FaceInfo</a></td><td><a href="ft2-list_processing.html#FT_List">FT_List</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#CID_FaceInfoRec">CID_FaceInfoRec</a></td><td><a href="ft2-list_processing.html#FT_List_Add">FT_List_Add</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#CID_Info">CID_Info</a></td><td><a href="ft2-list_processing.html#FT_List_Destructor">FT_List_Destructor</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID</a></td></tr> -<tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MAJOR</a></td><td><a href="ft2-list_processing.html#FT_List_Finalize">FT_List_Finalize</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_SCALE</a></td></tr> -<tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MINOR</a></td><td><a href="ft2-list_processing.html#FT_List_Find">FT_List_Find</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_USE_MY_METRICS</a></td></tr> -<tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_PATCH</a></td><td><a href="ft2-list_processing.html#FT_List_Insert">FT_List_Insert</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_XXX</a></td></tr> -<tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_XXX</a></td><td><a href="ft2-list_processing.html#FT_List_Iterate">FT_List_Iterate</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_XY_SCALE</a></td></tr> -<tr><td><a href="ft2-sizes_management.html#FT_Activate_Size">FT_Activate_Size</a></td><td><a href="ft2-list_processing.html#FT_List_Iterator">FT_List_Iterator</a></td><td><a href="ft2-base_interface.html#FT_SubGlyph">FT_SubGlyph</a></td></tr> -<tr><td><a href="ft2-quick_advance.html#FT_ADVANCE_FLAG_FAST_ONLY">FT_ADVANCE_FLAG_FAST_ONLY</a></td><td><a href="ft2-list_processing.html#FT_List_Remove">FT_List_Remove</a></td><td><a href="ft2-header_file_macros.html#FT_SYNTHESIS_H">FT_SYNTHESIS_H</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_ADVANCES_H">FT_ADVANCES_H</a></td><td><a href="ft2-list_processing.html#FT_List_Up">FT_List_Up</a></td><td><a href="ft2-header_file_macros.html#FT_SYSTEM_H">FT_SYSTEM_H</a></td></tr> -<tr><td><a href="ft2-module_management.html#FT_Add_Default_Modules">FT_Add_Default_Modules</a></td><td><a href="ft2-list_processing.html#FT_ListNode">FT_ListNode</a></td><td><a href="ft2-basic_types.html#FT_Tag">FT_Tag</a></td></tr> -<tr><td><a href="ft2-module_management.html#FT_Add_Module">FT_Add_Module</a></td><td><a href="ft2-list_processing.html#FT_ListNodeRec">FT_ListNodeRec</a></td><td><a href="ft2-computations.html#FT_Tan">FT_Tan</a></td></tr> -<tr><td><a href="ft2-system_interface.html#FT_Alloc_Func">FT_Alloc_Func</a></td><td><a href="ft2-list_processing.html#FT_ListRec">FT_ListRec</a></td><td><a href="ft2-header_file_macros.html#FT_TRIGONOMETRY_H">FT_TRIGONOMETRY_H</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_ANGLE_2PI">FT_ANGLE_2PI</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_CROP_BITMAP</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_NONE</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_ANGLE_PI">FT_ANGLE_PI</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_DEFAULT</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_PATENTED</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_ANGLE_PI2">FT_ANGLE_PI2</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_FORCE_AUTOHINT</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_UNPATENTED</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_ANGLE_PI4">FT_ANGLE_PI4</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_IDS_H">FT_TRUETYPE_IDS_H</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_Angle">FT_Angle</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_IGNORE_TRANSFORM</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_TABLES_H">FT_TRUETYPE_TABLES_H</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_Angle_Diff">FT_Angle_Diff</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_LINEAR_DESIGN</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_TAGS_H">FT_TRUETYPE_TAGS_H</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_Atan2">FT_Atan2</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_MONOCHROME</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TrueTypeEngineType</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Attach_File">FT_Attach_File</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_AUTOHINT</a></td><td><a href="ft2-gx_validation.html#FT_TrueTypeGX_Free">FT_TrueTypeGX_Free</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Attach_Stream">FT_Attach_Stream</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_BITMAP</a></td><td><a href="ft2-gx_validation.html#FT_TrueTypeGX_Validate">FT_TrueTypeGX_Validate</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_AUTOHINTER_H">FT_AUTOHINTER_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_HINTING</a></td><td><a href="ft2-header_file_macros.html#FT_TYPE1_TABLES_H">FT_TYPE1_TABLES_H</a></td></tr> -<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_CJK</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_RECURSE</a></td><td><a href="ft2-header_file_macros.html#FT_TYPES_H">FT_TYPES_H</a></td></tr> -<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_INDIC</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_SCALE</a></td><td><a href="ft2-basic_types.html#FT_UFWord">FT_UFWord</a></td></tr> -<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_LATIN</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_PEDANTIC</a></td><td><a href="ft2-basic_types.html#FT_UInt">FT_UInt</a></td></tr> -<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_NONE</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_RENDER</a></td><td><a href="ft2-basic_types.html#FT_UInt16">FT_UInt16</a></td></tr> -<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_XXX</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LCD</a></td><td><a href="ft2-basic_types.html#FT_UInt32">FT_UInt32</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_BBOX_H">FT_BBOX_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LCD_V</a></td><td><a href="ft2-basic_types.html#FT_ULong">FT_ULong</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_BBox">FT_BBox</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LIGHT</a></td><td><a href="ft2-header_file_macros.html#FT_UNPATENTED_HINTING_H">FT_UNPATENTED_HINTING_H</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_BDF_H">FT_BDF_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_MODE">FT_LOAD_TARGET_MODE</a></td><td><a href="ft2-basic_types.html#FT_UnitVector">FT_UnitVector</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_BITMAP_H">FT_BITMAP_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_MONO</a></td><td><a href="ft2-basic_types.html#FT_UShort">FT_UShort</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Bitmap">FT_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_NORMAL</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_APPLE</a></td></tr> -<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Convert">FT_Bitmap_Convert</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_XXX</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_BASE</a></td></tr> -<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Copy">FT_Bitmap_Copy</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_VERTICAL_LAYOUT</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_bsln</a></td></tr> -<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Done">FT_Bitmap_Done</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_XXX</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_CKERN</a></td></tr> -<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Embolden">FT_Bitmap_Embolden</a></td><td><a href="ft2-base_interface.html#FT_Load_Char">FT_Load_Char</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_CKERNXXX</a></td></tr> -<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_New">FT_Bitmap_New</a></td><td><a href="ft2-base_interface.html#FT_Load_Glyph">FT_Load_Glyph</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_feat</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Bitmap_Size">FT_Bitmap_Size</a></td><td><a href="ft2-truetype_tables.html#FT_Load_Sfnt_Table">FT_Load_Sfnt_Table</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GDEF</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_BitmapGlyph">FT_BitmapGlyph</a></td><td><a href="ft2-basic_types.html#FT_Long">FT_Long</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GPOS</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_BitmapGlyphRec">FT_BitmapGlyphRec</a></td><td><a href="ft2-header_file_macros.html#FT_LZW_H">FT_LZW_H</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GSUB</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Bool">FT_Bool</a></td><td><a href="ft2-header_file_macros.html#FT_MAC_H">FT_MAC_H</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_GX</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Byte">FT_Byte</a></td><td><a href="ft2-basic_types.html#FT_MAKE_TAG">FT_MAKE_TAG</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GX_LENGTH">FT_VALIDATE_GX_LENGTH</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Bytes">FT_Bytes</a></td><td><a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_GXXXX</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_BZIP2_H">FT_BZIP2_H</a></td><td><a href="ft2-computations.html#FT_Matrix_Invert">FT_Matrix_Invert</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_JSTF</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CACHE_CHARMAP_H">FT_CACHE_CHARMAP_H</a></td><td><a href="ft2-computations.html#FT_Matrix_Multiply">FT_Matrix_Multiply</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_just</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CACHE_H">FT_CACHE_H</a></td><td><a href="ft2-system_interface.html#FT_Memory">FT_Memory</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_kern</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CACHE_IMAGE_H">FT_CACHE_IMAGE_H</a></td><td><a href="ft2-system_interface.html#FT_MemoryRec">FT_MemoryRec</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_lcar</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CACHE_SMALL_BITMAPS_H">FT_CACHE_SMALL_BITMAPS_H</a></td><td><a href="ft2-multiple_masters.html#FT_MM_Axis">FT_MM_Axis</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_MATH</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_CeilFix">FT_CeilFix</a></td><td><a href="ft2-multiple_masters.html#FT_MM_Var">FT_MM_Var</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_MS</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Char">FT_Char</a></td><td><a href="ft2-header_file_macros.html#FT_MODULE_ERRORS_H">FT_MODULE_ERRORS_H</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_mort</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_CharMap">FT_CharMap</a></td><td><a href="ft2-header_file_macros.html#FT_MODULE_H">FT_MODULE_H</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_morx</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_CharMapRec">FT_CharMapRec</a></td><td><a href="ft2-base_interface.html#FT_Module">FT_Module</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_OT</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CID_H">FT_CID_H</a></td><td><a href="ft2-module_management.html#FT_Module_Class">FT_Module_Class</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_OTXXX</a></td></tr> -<tr><td><a href="ft2-gx_validation.html#FT_ClassicKern_Free">FT_ClassicKern_Free</a></td><td><a href="ft2-module_management.html#FT_Module_Constructor">FT_Module_Constructor</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_opbd</a></td></tr> -<tr><td><a href="ft2-gx_validation.html#FT_ClassicKern_Validate">FT_ClassicKern_Validate</a></td><td><a href="ft2-module_management.html#FT_Module_Destructor">FT_Module_Destructor</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_prop</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_CONFIG_H">FT_CONFIG_CONFIG_H</a></td><td><a href="ft2-module_management.html#FT_Module_Requester">FT_Module_Requester</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_trak</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_MODULES_H">FT_CONFIG_MODULES_H</a></td><td><a href="ft2-header_file_macros.html#FT_MULTIPLE_MASTERS_H">FT_MULTIPLE_MASTERS_H</a></td><td><a href="ft2-multiple_masters.html#FT_Var_Axis">FT_Var_Axis</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_OPTIONS_H">FT_CONFIG_OPTIONS_H</a></td><td><a href="ft2-computations.html#FT_MulDiv">FT_MulDiv</a></td><td><a href="ft2-multiple_masters.html#FT_Var_Named_Style">FT_Var_Named_Style</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_STANDARD_LIBRARY_H">FT_CONFIG_STANDARD_LIBRARY_H</a></td><td><a href="ft2-computations.html#FT_MulFix">FT_MulFix</a></td><td><a href="ft2-basic_types.html#FT_Vector">FT_Vector</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_Cos">FT_Cos</a></td><td><a href="ft2-multiple_masters.html#FT_Multi_Master">FT_Multi_Master</a></td><td><a href="ft2-computations.html#FT_Vector_From_Polar">FT_Vector_From_Polar</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Data">FT_Data</a></td><td><a href="ft2-base_interface.html#FT_New_Face">FT_New_Face</a></td><td><a href="ft2-computations.html#FT_Vector_Length">FT_Vector_Length</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_DivFix">FT_DivFix</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FOND">FT_New_Face_From_FOND</a></td><td><a href="ft2-computations.html#FT_Vector_Polarize">FT_Vector_Polarize</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Done_Face">FT_Done_Face</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FSRef">FT_New_Face_From_FSRef</a></td><td><a href="ft2-computations.html#FT_Vector_Rotate">FT_Vector_Rotate</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Done_FreeType">FT_Done_FreeType</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FSSpec">FT_New_Face_From_FSSpec</a></td><td><a href="ft2-computations.html#FT_Vector_Transform">FT_Vector_Transform</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Done_Glyph">FT_Done_Glyph</a></td><td><a href="ft2-module_management.html#FT_New_Library">FT_New_Library</a></td><td><a href="ft2-computations.html#FT_Vector_Unit">FT_Vector_Unit</a></td></tr> -<tr><td><a href="ft2-module_management.html#FT_Done_Library">FT_Done_Library</a></td><td><a href="ft2-base_interface.html#FT_New_Memory_Face">FT_New_Memory_Face</a></td><td><a href="ft2-header_file_macros.html#FT_WINFONTS_H">FT_WINFONTS_H</a></td></tr> -<tr><td><a href="ft2-sizes_management.html#FT_Done_Size">FT_Done_Size</a></td><td><a href="ft2-sizes_management.html#FT_New_Size">FT_New_Size</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_Header">FT_WinFNT_Header</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Driver">FT_Driver</a></td><td><a href="ft2-basic_types.html#FT_Offset">FT_Offset</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_HeaderRec">FT_WinFNT_HeaderRec</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_ENC_TAG">FT_ENC_TAG</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_DRIVER</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1250</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_CUSTOM</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_MEMORY</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1251</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_EXPERT</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_PARAMS</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1252</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_LATIN_1</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_PATHNAME</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1253</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_STANDARD</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_STREAM</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1254</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_APPLE_ROMAN</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_XXX</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1255</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_BIG5</a></td><td><a href="ft2-header_file_macros.html#FT_OPENTYPE_VALIDATE_H">FT_OPENTYPE_VALIDATE_H</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1256</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_GB2312</a></td><td><a href="ft2-base_interface.html#FT_Open_Args">FT_Open_Args</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1257</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_JOHAB</a></td><td><a href="ft2-base_interface.html#FT_Open_Face">FT_Open_Face</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1258</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_BIG5</a></td><td><a href="ft2-ot_validation.html#FT_OpenType_Free">FT_OpenType_Free</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1361</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_GB2312</a></td><td><a href="ft2-ot_validation.html#FT_OpenType_Validate">FT_OpenType_Validate</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP874</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_JOHAB</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_FILL_LEFT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP932</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_SJIS</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_FILL_RIGHT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP936</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_SYMBOL</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_NONE</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP949</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_WANSUNG</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_POSTSCRIPT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP950</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_NONE</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_TRUETYPE</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_DEFAULT</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_OLD_LATIN_2</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_Orientation</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_MAC</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_SJIS</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_EVEN_ODD_FILL</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_OEM</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_UNICODE</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_FLAGS</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_SYMBOL</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_WANSUNG</a></td><td><a href="ft2-header_file_macros.html#FT_OUTLINE_H">FT_OUTLINE_H</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_XXX</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_Encoding</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_HIGH_PRECISION</a></td><td><a href="ft2-header_file_macros.html#FT_XFREE86_H">FT_XFREE86_H</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_ERRORS_H">FT_ERRORS_H</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_IGNORE_DROPOUTS</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache">FTC_CMapCache</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Error">FT_Error</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_INCLUDE_STUBS</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache_Lookup">FTC_CMapCache_Lookup</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_F26Dot6">FT_F26Dot6</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_NONE</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache_New">FTC_CMapCache_New</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_F2Dot14">FT_F2Dot14</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_OWNER</a></td><td><a href="ft2-cache_subsystem.html#FTC_Face_Requester">FTC_Face_Requester</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_CID_KEYED</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_REVERSE_FILL</a></td><td><a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_EXTERNAL_STREAM</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_SINGLE_PASS</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache">FTC_ImageCache</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FAST_GLYPHS</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_SMART_DROPOUTS</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_Lookup">FTC_ImageCache_Lookup</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FIXED_SIZES</a></td><td><a href="ft2-outline_processing.html#FT_Outline">FT_Outline</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_LookupScaler">FTC_ImageCache_LookupScaler</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FIXED_WIDTH</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Check">FT_Outline_Check</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_New">FTC_ImageCache_New</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_GLYPH_NAMES</a></td><td><a href="ft2-outline_processing.html#FT_Outline_ConicToFunc">FT_Outline_ConicToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageType">FTC_ImageType</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_HINTER</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Copy">FT_Outline_Copy</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageTypeRec">FTC_ImageTypeRec</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_HORIZONTAL</a></td><td><a href="ft2-outline_processing.html#FT_Outline_CubicToFunc">FT_Outline_CubicToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_KERNING</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Decompose">FT_Outline_Decompose</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_Done">FTC_Manager_Done</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_MULTIPLE_MASTERS</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Done">FT_Outline_Done</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_LookupFace">FTC_Manager_LookupFace</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_SCALABLE</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Embolden">FT_Outline_Embolden</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_SFNT</a></td><td><a href="ft2-outline_processing.html#FT_Outline_EmboldenXY">FT_Outline_EmboldenXY</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_New">FTC_Manager_New</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_TRICKY</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Funcs">FT_Outline_Funcs</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_RemoveFaceID">FTC_Manager_RemoveFaceID</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_VERTICAL</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_BBox">FT_Outline_Get_BBox</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_Reset">FTC_Manager_Reset</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_XXX</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_Bitmap">FT_Outline_Get_Bitmap</a></td><td><a href="ft2-cache_subsystem.html#FTC_Node">FTC_Node</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Face">FT_Face</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_CBox">FT_Outline_Get_CBox</a></td><td><a href="ft2-cache_subsystem.html#FTC_Node_Unref">FTC_Node_Unref</a></td></tr> -<tr><td><a href="ft2-version.html#FT_Face_CheckTrueTypePatents">FT_Face_CheckTrueTypePatents</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_Orientation">FT_Outline_Get_Orientation</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBit">FTC_SBit</a></td></tr> -<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharsOfVariant">FT_Face_GetCharsOfVariant</a></td><td><a href="ft2-glyph_stroker.html#FT_Outline_GetInsideBorder">FT_Outline_GetInsideBorder</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache">FTC_SBitCache</a></td></tr> -<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharVariantIndex">FT_Face_GetCharVariantIndex</a></td><td><a href="ft2-glyph_stroker.html#FT_Outline_GetOutsideBorder">FT_Outline_GetOutsideBorder</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_Lookup">FTC_SBitCache_Lookup</a></td></tr> -<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharVariantIsDefault">FT_Face_GetCharVariantIsDefault</a></td><td><a href="ft2-outline_processing.html#FT_Outline_LineToFunc">FT_Outline_LineToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_LookupScaler">FTC_SBitCache_LookupScaler</a></td></tr> -<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetVariantSelectors">FT_Face_GetVariantSelectors</a></td><td><a href="ft2-outline_processing.html#FT_Outline_MoveToFunc">FT_Outline_MoveToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_New">FTC_SBitCache_New</a></td></tr> -<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetVariantsOfChar">FT_Face_GetVariantsOfChar</a></td><td><a href="ft2-outline_processing.html#FT_Outline_New">FT_Outline_New</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitRec">FTC_SBitRec</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Face_Internal">FT_Face_Internal</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Render">FT_Outline_Render</a></td><td><a href="ft2-cache_subsystem.html#FTC_Scaler">FTC_Scaler</a></td></tr> -<tr><td><a href="ft2-version.html#FT_Face_SetUnpatentedHinting">FT_Face_SetUnpatentedHinting</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Reverse">FT_Outline_Reverse</a></td><td><a href="ft2-cache_subsystem.html#FTC_ScalerRec">FTC_ScalerRec</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FaceRec">FT_FaceRec</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Transform">FT_Outline_Transform</a></td><td><a href="ft2-auto_hinter.html#fallback-script">fallback-script</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Translate">FT_Outline_Translate</a></td><td><a href="ft2-base_interface.html#ft_encoding_xxx">ft_encoding_xxx</a></td></tr> -<tr><td><a href="ft2-computations.html#FT_FloorFix">FT_FloorFix</a></td><td><a href="ft2-glyph_management.html#FT_OutlineGlyph">FT_OutlineGlyph</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_gridfit</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_FREETYPE_H">FT_FREETYPE_H</a></td><td><a href="ft2-glyph_management.html#FT_OutlineGlyphRec">FT_OutlineGlyphRec</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_pixels</a></td></tr> -<tr><td><a href="ft2-system_interface.html#FT_Free_Func">FT_Free_Func</a></td><td><a href="ft2-sfnt_names.html#FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY">FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_subpixels</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_BITMAP_EMBEDDING_ONLY</a></td><td><a href="ft2-sfnt_names.html#FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY">FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_truncate</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_EDITABLE_EMBEDDING</a></td><td><a href="ft2-incremental.html#FT_PARAM_TAG_INCREMENTAL">FT_PARAM_TAG_INCREMENTAL</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_unscaled</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_INSTALLABLE_EMBEDDING</a></td><td><a href="ft2-truetype_tables.html#FT_PARAM_TAG_UNPATENTED_HINTING">FT_PARAM_TAG_UNPATENTED_HINTING</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_xxx</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_NO_SUBSETTING</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">FT_Palette_Mode</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_bitmap</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING</a></td><td><a href="ft2-base_interface.html#FT_Parameter">FT_Parameter</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_composite</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING</a></td><td><a href="ft2-header_file_macros.html#FT_PFR_H">FT_PFR_H</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_none</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_XXX</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_outline</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_FWord">FT_FWord</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY2</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_plotter</a></td></tr> -<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_DO_GRAY</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY4</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_xxx</a></td></tr> -<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_DO_GRIDFIT</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_LCD</a></td><td><a href="ft2-base_interface.html#ft_kerning_default">ft_kerning_default</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_GASP_H">FT_GASP_H</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_LCD_V</a></td><td><a href="ft2-base_interface.html#ft_kerning_unfitted">ft_kerning_unfitted</a></td></tr> -<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_NO_TABLE</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_MONO</a></td><td><a href="ft2-base_interface.html#ft_kerning_unscaled">ft_kerning_unscaled</a></td></tr> -<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_SYMMETRIC_GRIDFIT</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_NONE</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_driver</a></td></tr> -<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_SYMMETRIC_SMOOTHING</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_Pixel_Mode</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_memory</a></td></tr> -<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_XXX</a></td><td><a href="ft2-basic_types.html#FT_Pointer">FT_Pointer</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_params</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Generic">FT_Generic</a></td><td><a href="ft2-basic_types.html#FT_Pos">FT_Pos</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_pathname</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Generic_Finalizer">FT_Generic_Finalizer</a></td><td><a href="ft2-auto_hinter.html#FT_Prop_GlyphToScriptMap">FT_Prop_GlyphToScriptMap</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_stream</a></td></tr> -<tr><td><a href="ft2-quick_advance.html#FT_Get_Advance">FT_Get_Advance</a></td><td><a href="ft2-auto_hinter.html#FT_Prop_IncreaseXHeight">FT_Prop_IncreaseXHeight</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_even_odd_fill</a></td></tr> -<tr><td><a href="ft2-quick_advance.html#FT_Get_Advances">FT_Get_Advances</a></td><td><a href="ft2-module_management.html#FT_Property_Get">FT_Property_Get</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_flags</a></td></tr> -<tr><td><a href="ft2-bdf_fonts.html#FT_Get_BDF_Charset_ID">FT_Get_BDF_Charset_ID</a></td><td><a href="ft2-module_management.html#FT_Property_Set">FT_Property_Set</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_high_precision</a></td></tr> -<tr><td><a href="ft2-bdf_fonts.html#FT_Get_BDF_Property">FT_Get_BDF_Property</a></td><td><a href="ft2-bdf_fonts.html#FT_PropertyType">FT_PropertyType</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_ignore_dropouts</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_Char_Index">FT_Get_Char_Index</a></td><td><a href="ft2-basic_types.html#FT_PtrDist">FT_PtrDist</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_none</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_Charmap_Index">FT_Get_Charmap_Index</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_AA</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_owner</a></td></tr> -<tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_From_Glyph_Index">FT_Get_CID_From_Glyph_Index</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_CLIP</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_reverse_fill</a></td></tr> -<tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_Is_Internally_CID_Keyed">FT_Get_CID_Is_Internally_CID_Keyed</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_DEFAULT</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_single_pass</a></td></tr> -<tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_Registry_Ordering_Supplement">FT_Get_CID_Registry_Ordering_Supplement</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_DIRECT</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">ft_palette_mode_rgb</a></td></tr> -<tr><td><a href="ft2-truetype_tables.html#FT_Get_CMap_Format">FT_Get_CMap_Format</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_XXX</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">ft_palette_mode_rgba</a></td></tr> -<tr><td><a href="ft2-truetype_tables.html#FT_Get_CMap_Language_ID">FT_Get_CMap_Language_ID</a></td><td><a href="ft2-raster.html#FT_Raster">FT_Raster</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_grays</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_First_Char">FT_Get_First_Char</a></td><td><a href="ft2-raster.html#FT_Raster_BitSet_Func">FT_Raster_BitSet_Func</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_mono</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_FSType_Flags">FT_Get_FSType_Flags</a></td><td><a href="ft2-raster.html#FT_Raster_BitTest_Func">FT_Raster_BitTest_Func</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_none</a></td></tr> -<tr><td><a href="ft2-gasp_table.html#FT_Get_Gasp">FT_Get_Gasp</a></td><td><a href="ft2-raster.html#FT_Raster_DoneFunc">FT_Raster_DoneFunc</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_pal2</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Get_Glyph">FT_Get_Glyph</a></td><td><a href="ft2-raster.html#FT_Raster_Funcs">FT_Raster_Funcs</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_pal4</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_Glyph_Name">FT_Get_Glyph_Name</a></td><td><a href="ft2-raster.html#FT_Raster_NewFunc">FT_Raster_NewFunc</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_xxx</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_Kerning">FT_Get_Kerning</a></td><td><a href="ft2-raster.html#FT_Raster_Params">FT_Raster_Params</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_mono</a></td></tr> -<tr><td><a href="ft2-multiple_masters.html#FT_Get_MM_Var">FT_Get_MM_Var</a></td><td><a href="ft2-raster.html#FT_Raster_RenderFunc">FT_Raster_RenderFunc</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_normal</a></td></tr> -<tr><td><a href="ft2-module_management.html#FT_Get_Module">FT_Get_Module</a></td><td><a href="ft2-raster.html#FT_Raster_ResetFunc">FT_Raster_ResetFunc</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_xxx</a></td></tr> -<tr><td><a href="ft2-multiple_masters.html#FT_Get_Multi_Master">FT_Get_Multi_Master</a></td><td><a href="ft2-raster.html#FT_Raster_SetModeFunc">FT_Raster_SetModeFunc</a></td><td><a href="ft2-auto_hinter.html#glyph-to-script-map">glyph-to-script-map</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_Name_Index">FT_Get_Name_Index</a></td><td><a href="ft2-header_file_macros.html#FT_RENDER_H">FT_RENDER_H</a></td><td><a href="ft2-auto_hinter.html#increase-x-height">increase-x-height</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_Next_Char">FT_Get_Next_Char</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD</a></td><td><a href="ft2-type1_tables.html#PS_Dict_Keys">PS_Dict_Keys</a></td></tr> -<tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Advance">FT_Get_PFR_Advance</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD_V</a></td><td><a href="ft2-type1_tables.html#PS_FontInfo">PS_FontInfo</a></td></tr> -<tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Kerning">FT_Get_PFR_Kerning</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LIGHT</a></td><td><a href="ft2-type1_tables.html#PS_FontInfoRec">PS_FontInfoRec</a></td></tr> -<tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Metrics">FT_Get_PFR_Metrics</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_MONO</a></td><td><a href="ft2-type1_tables.html#PS_Private">PS_Private</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_Postscript_Name">FT_Get_Postscript_Name</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_NORMAL</a></td><td><a href="ft2-type1_tables.html#PS_PrivateRec">PS_PrivateRec</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Info">FT_Get_PS_Font_Info</a></td><td><a href="ft2-system_interface.html#FT_Realloc_Func">FT_Realloc_Func</a></td><td><a href="ft2-type1_tables.html#T1_Blend_Flags">T1_Blend_Flags</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Private">FT_Get_PS_Font_Private</a></td><td><a href="ft2-base_interface.html#FT_Reference_Face">FT_Reference_Face</a></td><td><a href="ft2-type1_tables.html#T1_EncodingType">T1_EncodingType</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Value">FT_Get_PS_Font_Value</a></td><td><a href="ft2-module_management.html#FT_Reference_Library">FT_Reference_Library</a></td><td><a href="ft2-type1_tables.html#T1_FontInfo">T1_FontInfo</a></td></tr> -<tr><td><a href="ft2-module_management.html#FT_Get_Renderer">FT_Get_Renderer</a></td><td><a href="ft2-module_management.html#FT_Remove_Module">FT_Remove_Module</a></td><td><a href="ft2-type1_tables.html#T1_Private">T1_Private</a></td></tr> -<tr><td><a href="ft2-sfnt_names.html#FT_Get_Sfnt_Name">FT_Get_Sfnt_Name</a></td><td><a href="ft2-base_interface.html#FT_Render_Glyph">FT_Render_Glyph</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_CUSTOM</a></td></tr> -<tr><td><a href="ft2-sfnt_names.html#FT_Get_Sfnt_Name_Count">FT_Get_Sfnt_Name_Count</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_Render_Mode</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_EXPERT</a></td></tr> -<tr><td><a href="ft2-truetype_tables.html#FT_Get_Sfnt_Table">FT_Get_Sfnt_Table</a></td><td><a href="ft2-base_interface.html#FT_Renderer">FT_Renderer</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_LATIN_1</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_SubGlyph_Info">FT_Get_SubGlyph_Info</a></td><td><a href="ft2-module_management.html#FT_Renderer_Class">FT_Renderer_Class</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_STANDARD</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Get_Track_Kerning">FT_Get_Track_Kerning</a></td><td><a href="ft2-base_interface.html#FT_Request_Size">FT_Request_Size</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_XXX</a></td></tr> -<tr><td><a href="ft2-truetype_engine.html#FT_Get_TrueType_Engine_Type">FT_Get_TrueType_Engine_Type</a></td><td><a href="ft2-computations.html#FT_RoundFix">FT_RoundFix</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_DEFAULT</a></td></tr> -<tr><td><a href="ft2-winfnt_fonts.html#FT_Get_WinFNT_Header">FT_Get_WinFNT_Header</a></td><td><a href="ft2-base_interface.html#FT_Select_Charmap">FT_Select_Charmap</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_ISO_10646</a></td></tr> -<tr><td><a href="ft2-font_formats.html#FT_Get_X11_Font_Format">FT_Get_X11_Font_Format</a></td><td><a href="ft2-base_interface.html#FT_Select_Size">FT_Select_Size</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_1_1</a></td></tr> -<tr><td><a href="ft2-mac_specific.html#FT_GetFile_From_Mac_ATS_Name">FT_GetFile_From_Mac_ATS_Name</a></td><td><a href="ft2-base_interface.html#FT_Set_Char_Size">FT_Set_Char_Size</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_2_0</a></td></tr> -<tr><td><a href="ft2-mac_specific.html#FT_GetFile_From_Mac_Name">FT_GetFile_From_Mac_Name</a></td><td><a href="ft2-base_interface.html#FT_Set_Charmap">FT_Set_Charmap</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_32</a></td></tr> -<tr><td><a href="ft2-mac_specific.html#FT_GetFilePath_From_Mac_ATS_Name">FT_GetFilePath_From_Mac_ATS_Name</a></td><td><a href="ft2-module_management.html#FT_Set_Debug_Hook">FT_Set_Debug_Hook</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_VARIANT_SELECTOR</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a></td><td><a href="ft2-multiple_masters.html#FT_Set_MM_Blend_Coordinates">FT_Set_MM_Blend_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_XXX</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a></td><td><a href="ft2-multiple_masters.html#FT_Set_MM_Design_Coordinates">FT_Set_MM_Design_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_Header">TT_Header</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a></td><td><a href="ft2-base_interface.html#FT_Set_Pixel_Sizes">FT_Set_Pixel_Sizes</a></td><td><a href="ft2-truetype_tables.html#TT_HoriHeader">TT_HoriHeader</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a></td><td><a href="ft2-module_management.html#FT_Set_Renderer">FT_Set_Renderer</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_10646</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a></td><td><a href="ft2-base_interface.html#FT_Set_Transform">FT_Set_Transform</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_7BIT_ASCII</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_BITMAP</a></td><td><a href="ft2-multiple_masters.html#FT_Set_Var_Blend_Coordinates">FT_Set_Var_Blend_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_8859_1</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_COMPOSITE</a></td><td><a href="ft2-multiple_masters.html#FT_Set_Var_Design_Coordinates">FT_Set_Var_Design_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_XXX</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_NONE</a></td><td><a href="ft2-header_file_macros.html#FT_SFNT_NAMES_H">FT_SFNT_NAMES_H</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ARABIC</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_OUTLINE</a></td><td><a href="ft2-truetype_tables.html#FT_Sfnt_Table_Info">FT_Sfnt_Table_Info</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ARMENIAN</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_PLOTTER</a></td><td><a href="ft2-truetype_tables.html#FT_Sfnt_Tag">FT_Sfnt_Tag</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_BENGALI</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_GLYPH_H">FT_GLYPH_H</a></td><td><a href="ft2-sfnt_names.html#FT_SfntName">FT_SfntName</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_BURMESE</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a></td><td><a href="ft2-basic_types.html#FT_Short">FT_Short</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_DEVANAGARI</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_Glyph_BBox_Mode</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_BBOX</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GEEZ</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_Copy">FT_Glyph_Copy</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_CELL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GEORGIAN</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_Glyph_Format</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_NOMINAL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GREEK</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_Get_CBox">FT_Glyph_Get_CBox</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_REAL_DIM</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GUJARATI</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Glyph_Metrics">FT_Glyph_Metrics</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_SCALES</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GURMUKHI</a></td></tr> -<tr><td><a href="ft2-glyph_stroker.html#FT_Glyph_Stroke">FT_Glyph_Stroke</a></td><td><a href="ft2-header_file_macros.html#FT_SIZES_H">FT_SIZES_H</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_HEBREW</a></td></tr> -<tr><td><a href="ft2-glyph_stroker.html#FT_Glyph_StrokeBorder">FT_Glyph_StrokeBorder</a></td><td><a href="ft2-computations.html#FT_Sin">FT_Sin</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_JAPANESE</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_To_Bitmap">FT_Glyph_To_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_Size">FT_Size</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KANNADA</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_Glyph_Transform">FT_Glyph_Transform</a></td><td><a href="ft2-base_interface.html#FT_Size_Internal">FT_Size_Internal</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KHMER</a></td></tr> -<tr><td><a href="ft2-glyph_management.html#FT_GlyphRec">FT_GlyphRec</a></td><td><a href="ft2-base_interface.html#FT_Size_Metrics">FT_Size_Metrics</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KOREAN</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_GlyphSlot">FT_GlyphSlot</a></td><td><a href="ft2-base_interface.html#FT_Size_Request">FT_Size_Request</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_LAOTIAN</a></td></tr> -<tr><td><a href="ft2-bitmap_handling.html#FT_GlyphSlot_Own_Bitmap">FT_GlyphSlot_Own_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_Size_Request_Type</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MALAYALAM</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_GlyphSlotRec">FT_GlyphSlotRec</a></td><td><a href="ft2-base_interface.html#FT_Size_RequestRec">FT_Size_RequestRec</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MALDIVIAN</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_GX_VALIDATE_H">FT_GX_VALIDATE_H</a></td><td><a href="ft2-base_interface.html#FT_SizeRec">FT_SizeRec</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MONGOLIAN</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_GZIP_H">FT_GZIP_H</a></td><td><a href="ft2-base_interface.html#FT_Slot_Internal">FT_Slot_Internal</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ORIYA</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_HAS_FAST_GLYPHS">FT_HAS_FAST_GLYPHS</a></td><td><a href="ft2-raster.html#FT_Span">FT_Span</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ROMAN</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_HAS_FIXED_SIZES">FT_HAS_FIXED_SIZES</a></td><td><a href="ft2-raster.html#FT_SpanFunc">FT_SpanFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_RSYMBOL</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_HAS_GLYPH_NAMES">FT_HAS_GLYPH_NAMES</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_STROKER_BORDER_LEFT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_RUSSIAN</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_HAS_HORIZONTAL">FT_HAS_HORIZONTAL</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_STROKER_BORDER_RIGHT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SIMPLIFIED_CHINESE</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_HAS_KERNING">FT_HAS_KERNING</a></td><td><a href="ft2-header_file_macros.html#FT_STROKER_H">FT_STROKER_H</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SINDHI</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_HAS_MULTIPLE_MASTERS">FT_HAS_MULTIPLE_MASTERS</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_BUTT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SINHALESE</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_HAS_VERTICAL">FT_HAS_VERTICAL</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_ROUND</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SLAVIC</a></td></tr> -<tr><td><a href="ft2-type1_tables.html#FT_Has_PS_Glyph_Names">FT_Has_PS_Glyph_Names</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_SQUARE</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TAMIL</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_IMAGE_H">FT_IMAGE_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_BEVEL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TELUGU</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_IMAGE_TAG">FT_IMAGE_TAG</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_THAI</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_INCREMENTAL_H">FT_INCREMENTAL_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER_FIXED</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TIBETAN</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental">FT_Incremental</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER_VARIABLE</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TRADITIONAL_CHINESE</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental_FreeGlyphDataFunc">FT_Incremental_FreeGlyphDataFunc</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_ROUND</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_UNINTERP</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental_FuncsRec">FT_Incremental_FuncsRec</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_BOLD</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_VIETNAMESE</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental_GetGlyphDataFunc">FT_Incremental_GetGlyphDataFunc</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_ITALIC</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_XXX</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental_GetGlyphMetricsFunc">FT_Incremental_GetGlyphMetricsFunc</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_XXX</a></td><td><a href="ft2-truetype_tables.html#TT_MaxProfile">TT_MaxProfile</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental_Interface">FT_Incremental_Interface</a></td><td><a href="ft2-system_interface.html#FT_Stream">FT_Stream</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_BIG_5</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental_InterfaceRec">FT_Incremental_InterfaceRec</a></td><td><a href="ft2-system_interface.html#FT_Stream_CloseFunc">FT_Stream_CloseFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_GB2312</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental_Metrics">FT_Incremental_Metrics</a></td><td><a href="ft2-system_interface.html#FT_Stream_IoFunc">FT_Stream_IoFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_JOHAB</a></td></tr> -<tr><td><a href="ft2-incremental.html#FT_Incremental_MetricsRec">FT_Incremental_MetricsRec</a></td><td><a href="ft2-bzip2.html#FT_Stream_OpenBzip2">FT_Stream_OpenBzip2</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_SJIS</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Init_FreeType">FT_Init_FreeType</a></td><td><a href="ft2-gzip.html#FT_Stream_OpenGzip">FT_Stream_OpenGzip</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_SYMBOL_CS</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Int">FT_Int</a></td><td><a href="ft2-lzw.html#FT_Stream_OpenLZW">FT_Stream_OpenLZW</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_UCS_4</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Int16">FT_Int16</a></td><td><a href="ft2-system_interface.html#FT_StreamDesc">FT_StreamDesc</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_UNICODE_CS</a></td></tr> -<tr><td><a href="ft2-basic_types.html#FT_Int32">FT_Int32</a></td><td><a href="ft2-system_interface.html#FT_StreamRec">FT_StreamRec</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_WANSUNG</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_IS_CID_KEYED">FT_IS_CID_KEYED</a></td><td><a href="ft2-basic_types.html#FT_String">FT_String</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_XXX</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_IS_FIXED_WIDTH">FT_IS_FIXED_WIDTH</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker">FT_Stroker</a></td><td><a href="ft2-truetype_tables.html#TT_OS2">TT_OS2</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_IS_SCALABLE">FT_IS_SCALABLE</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_BeginSubPath">FT_Stroker_BeginSubPath</a></td><td><a href="ft2-truetype_tables.html#TT_PCLT">TT_PCLT</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_IS_SFNT">FT_IS_SFNT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ConicTo">FT_Stroker_ConicTo</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_ADOBE</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_IS_TRICKY">FT_IS_TRICKY</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_CubicTo">FT_Stroker_CubicTo</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_APPLE_UNICODE</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_DEFAULT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Done">FT_Stroker_Done</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_CUSTOM</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_UNFITTED</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_EndSubPath">FT_Stroker_EndSubPath</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_ISO</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_UNSCALED</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Export">FT_Stroker_Export</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_MACINTOSH</a></td></tr> -<tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_Kerning_Mode</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ExportBorder">FT_Stroker_ExportBorder</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_MICROSOFT</a></td></tr> -<tr><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_DEFAULT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_GetBorderCounts">FT_Stroker_GetBorderCounts</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_XXX</a></td></tr> -<tr><td><a href="ft2-header_file_macros.html#FT_LCD_FILTER_H">FT_LCD_FILTER_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_GetCounts">FT_Stroker_GetCounts</a></td><td><a href="ft2-truetype_tables.html#TT_Postscript">TT_Postscript</a></td></tr> -<tr><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_LEGACY</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_Stroker_LineCap</a></td><td><a href="ft2-truetype_tables.html#TT_VertHeader">TT_VertHeader</a></td></tr> +<tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_ATOM</a></td><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_LIGHT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ParseOutline">FT_Stroker_ParseOutline</a></td></tr> +<tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_CARDINAL</a></td><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_NONE</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Rewind">FT_Stroker_Rewind</a></td></tr> +<tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_INTEGER</a></td><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LcdFilter</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Set">FT_Stroker_Set</a></td></tr> +<tr><td><a href="ft2-bdf_fonts.html#FT_PropertyType">BDF_PROPERTY_TYPE_NONE</a></td><td><a href="ft2-header_file_macros.html#FT_LIST_H">FT_LIST_H</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_StrokerBorder</a></td></tr> +<tr><td><a href="ft2-bdf_fonts.html#BDF_Property">BDF_Property</a></td><td><a href="ft2-base_interface.html#FT_Library">FT_Library</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_2X2</a></td></tr> +<tr><td><a href="ft2-bdf_fonts.html#BDF_PropertyRec">BDF_PropertyRec</a></td><td><a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#CID_FaceDict">CID_FaceDict</a></td><td><a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilterWeights">FT_Library_SetLcdFilterWeights</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#CID_FaceDictRec">CID_FaceDictRec</a></td><td><a href="ft2-version.html#FT_Library_Version">FT_Library_Version</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#CID_FaceInfo">CID_FaceInfo</a></td><td><a href="ft2-list_processing.html#FT_List">FT_List</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_SCALE</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#CID_FaceInfoRec">CID_FaceInfoRec</a></td><td><a href="ft2-list_processing.html#FT_List_Add">FT_List_Add</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_USE_MY_METRICS</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#CID_Info">CID_Info</a></td><td><a href="ft2-list_processing.html#FT_List_Destructor">FT_List_Destructor</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_XXX</a></td></tr> +<tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MAJOR</a></td><td><a href="ft2-list_processing.html#FT_List_Finalize">FT_List_Finalize</a></td><td><a href="ft2-base_interface.html#FT_SUBGLYPH_FLAG_XXX">FT_SUBGLYPH_FLAG_XY_SCALE</a></td></tr> +<tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MINOR</a></td><td><a href="ft2-list_processing.html#FT_List_Find">FT_List_Find</a></td><td><a href="ft2-base_interface.html#FT_SubGlyph">FT_SubGlyph</a></td></tr> +<tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_PATCH</a></td><td><a href="ft2-list_processing.html#FT_List_Insert">FT_List_Insert</a></td><td><a href="ft2-header_file_macros.html#FT_SYNTHESIS_H">FT_SYNTHESIS_H</a></td></tr> +<tr><td><a href="ft2-version.html#FREETYPE_XXX">FREETYPE_XXX</a></td><td><a href="ft2-list_processing.html#FT_List_Iterate">FT_List_Iterate</a></td><td><a href="ft2-header_file_macros.html#FT_SYSTEM_H">FT_SYSTEM_H</a></td></tr> +<tr><td><a href="ft2-sizes_management.html#FT_Activate_Size">FT_Activate_Size</a></td><td><a href="ft2-list_processing.html#FT_List_Iterator">FT_List_Iterator</a></td><td><a href="ft2-basic_types.html#FT_Tag">FT_Tag</a></td></tr> +<tr><td><a href="ft2-quick_advance.html#FT_ADVANCE_FLAG_FAST_ONLY">FT_ADVANCE_FLAG_FAST_ONLY</a></td><td><a href="ft2-list_processing.html#FT_List_Remove">FT_List_Remove</a></td><td><a href="ft2-computations.html#FT_Tan">FT_Tan</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_ADVANCES_H">FT_ADVANCES_H</a></td><td><a href="ft2-list_processing.html#FT_List_Up">FT_List_Up</a></td><td><a href="ft2-header_file_macros.html#FT_TRIGONOMETRY_H">FT_TRIGONOMETRY_H</a></td></tr> +<tr><td><a href="ft2-module_management.html#FT_Add_Default_Modules">FT_Add_Default_Modules</a></td><td><a href="ft2-list_processing.html#FT_ListNode">FT_ListNode</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_DRIVER_H">FT_TRUETYPE_DRIVER_H</a></td></tr> +<tr><td><a href="ft2-module_management.html#FT_Add_Module">FT_Add_Module</a></td><td><a href="ft2-list_processing.html#FT_ListNodeRec">FT_ListNodeRec</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_NONE</a></td></tr> +<tr><td><a href="ft2-system_interface.html#FT_Alloc_Func">FT_Alloc_Func</a></td><td><a href="ft2-list_processing.html#FT_ListRec">FT_ListRec</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_PATENTED</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_ANGLE_2PI">FT_ANGLE_2PI</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_COLOR</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TRUETYPE_ENGINE_TYPE_UNPATENTED</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_ANGLE_PI">FT_ANGLE_PI</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_CROP_BITMAP</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_IDS_H">FT_TRUETYPE_IDS_H</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_ANGLE_PI2">FT_ANGLE_PI2</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_DEFAULT</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_TABLES_H">FT_TRUETYPE_TABLES_H</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_ANGLE_PI4">FT_ANGLE_PI4</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_FORCE_AUTOHINT</a></td><td><a href="ft2-header_file_macros.html#FT_TRUETYPE_TAGS_H">FT_TRUETYPE_TAGS_H</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_Angle">FT_Angle</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH</a></td><td><a href="ft2-truetype_engine.html#FT_TrueTypeEngineType">FT_TrueTypeEngineType</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_Angle_Diff">FT_Angle_Diff</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_IGNORE_TRANSFORM</a></td><td><a href="ft2-gx_validation.html#FT_TrueTypeGX_Free">FT_TrueTypeGX_Free</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_Atan2">FT_Atan2</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_LINEAR_DESIGN</a></td><td><a href="ft2-gx_validation.html#FT_TrueTypeGX_Validate">FT_TrueTypeGX_Validate</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Attach_File">FT_Attach_File</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_MONOCHROME</a></td><td><a href="ft2-header_file_macros.html#FT_TYPE1_TABLES_H">FT_TYPE1_TABLES_H</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Attach_Stream">FT_Attach_Stream</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_AUTOHINT</a></td><td><a href="ft2-header_file_macros.html#FT_TYPES_H">FT_TYPES_H</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_AUTOHINTER_H">FT_AUTOHINTER_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_BITMAP</a></td><td><a href="ft2-basic_types.html#FT_UFWord">FT_UFWord</a></td></tr> +<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_CJK</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_HINTING</a></td><td><a href="ft2-basic_types.html#FT_UInt">FT_UInt</a></td></tr> +<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_INDIC</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_RECURSE</a></td><td><a href="ft2-basic_types.html#FT_UInt16">FT_UInt16</a></td></tr> +<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_LATIN</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_NO_SCALE</a></td><td><a href="ft2-basic_types.html#FT_UInt32">FT_UInt32</a></td></tr> +<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_NONE</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_PEDANTIC</a></td><td><a href="ft2-basic_types.html#FT_UInt64">FT_UInt64</a></td></tr> +<tr><td><a href="ft2-auto_hinter.html#FT_AUTOHINTER_SCRIPT_XXX">FT_AUTOHINTER_SCRIPT_XXX</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_RENDER</a></td><td><a href="ft2-basic_types.html#FT_ULong">FT_ULong</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_BBOX_H">FT_BBOX_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LCD</a></td><td><a href="ft2-header_file_macros.html#FT_UNPATENTED_HINTING_H">FT_UNPATENTED_HINTING_H</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_BBox">FT_BBox</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LCD_V</a></td><td><a href="ft2-basic_types.html#FT_UnitVector">FT_UnitVector</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_BDF_H">FT_BDF_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_LIGHT</a></td><td><a href="ft2-basic_types.html#FT_UShort">FT_UShort</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_BITMAP_H">FT_BITMAP_H</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_MODE">FT_LOAD_TARGET_MODE</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_APPLE</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Bitmap">FT_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_MONO</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_BASE</a></td></tr> +<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Convert">FT_Bitmap_Convert</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_NORMAL</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_bsln</a></td></tr> +<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Copy">FT_Bitmap_Copy</a></td><td><a href="ft2-base_interface.html#FT_LOAD_TARGET_XXX">FT_LOAD_TARGET_XXX</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_CKERN</a></td></tr> +<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Done">FT_Bitmap_Done</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_VERTICAL_LAYOUT</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_CKERNXXX</a></td></tr> +<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_Embolden">FT_Bitmap_Embolden</a></td><td><a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_XXX</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_feat</a></td></tr> +<tr><td><a href="ft2-bitmap_handling.html#FT_Bitmap_New">FT_Bitmap_New</a></td><td><a href="ft2-base_interface.html#FT_Load_Char">FT_Load_Char</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GDEF</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Bitmap_Size">FT_Bitmap_Size</a></td><td><a href="ft2-base_interface.html#FT_Load_Glyph">FT_Load_Glyph</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GPOS</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_BitmapGlyph">FT_BitmapGlyph</a></td><td><a href="ft2-truetype_tables.html#FT_Load_Sfnt_Table">FT_Load_Sfnt_Table</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_GSUB</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_BitmapGlyphRec">FT_BitmapGlyphRec</a></td><td><a href="ft2-basic_types.html#FT_Long">FT_Long</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_GX</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Bool">FT_Bool</a></td><td><a href="ft2-header_file_macros.html#FT_LZW_H">FT_LZW_H</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GX_LENGTH">FT_VALIDATE_GX_LENGTH</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Byte">FT_Byte</a></td><td><a href="ft2-header_file_macros.html#FT_MAC_H">FT_MAC_H</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_GXXXX</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Bytes">FT_Bytes</a></td><td><a href="ft2-basic_types.html#FT_MAKE_TAG">FT_MAKE_TAG</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_JSTF</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_BZIP2_H">FT_BZIP2_H</a></td><td><a href="ft2-basic_types.html#FT_Matrix">FT_Matrix</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_just</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CACHE_CHARMAP_H">FT_CACHE_CHARMAP_H</a></td><td><a href="ft2-computations.html#FT_Matrix_Invert">FT_Matrix_Invert</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_kern</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CACHE_H">FT_CACHE_H</a></td><td><a href="ft2-computations.html#FT_Matrix_Multiply">FT_Matrix_Multiply</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_lcar</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CACHE_IMAGE_H">FT_CACHE_IMAGE_H</a></td><td><a href="ft2-system_interface.html#FT_Memory">FT_Memory</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_MATH</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CACHE_SMALL_BITMAPS_H">FT_CACHE_SMALL_BITMAPS_H</a></td><td><a href="ft2-system_interface.html#FT_MemoryRec">FT_MemoryRec</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_CKERNXXX">FT_VALIDATE_MS</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_CeilFix">FT_CeilFix</a></td><td><a href="ft2-multiple_masters.html#FT_MM_Axis">FT_MM_Axis</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_mort</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CFF_DRIVER_H">FT_CFF_DRIVER_H</a></td><td><a href="ft2-multiple_masters.html#FT_MM_Var">FT_MM_Var</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_morx</a></td></tr> +<tr><td><a href="ft2-cff_driver.html#FT_CFF_HINTING_XXX">FT_CFF_HINTING_ADOBE</a></td><td><a href="ft2-header_file_macros.html#FT_MODULE_ERRORS_H">FT_MODULE_ERRORS_H</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_OT</a></td></tr> +<tr><td><a href="ft2-cff_driver.html#FT_CFF_HINTING_XXX">FT_CFF_HINTING_FREETYPE</a></td><td><a href="ft2-header_file_macros.html#FT_MODULE_H">FT_MODULE_H</a></td><td><a href="ft2-ot_validation.html#FT_VALIDATE_OTXXX">FT_VALIDATE_OTXXX</a></td></tr> +<tr><td><a href="ft2-cff_driver.html#FT_CFF_HINTING_XXX">FT_CFF_HINTING_XXX</a></td><td><a href="ft2-base_interface.html#FT_Module">FT_Module</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_opbd</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Char">FT_Char</a></td><td><a href="ft2-module_management.html#FT_Module_Class">FT_Module_Class</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_prop</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_CharMap">FT_CharMap</a></td><td><a href="ft2-module_management.html#FT_Module_Constructor">FT_Module_Constructor</a></td><td><a href="ft2-gx_validation.html#FT_VALIDATE_GXXXX">FT_VALIDATE_trak</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_CharMapRec">FT_CharMapRec</a></td><td><a href="ft2-module_management.html#FT_Module_Destructor">FT_Module_Destructor</a></td><td><a href="ft2-multiple_masters.html#FT_Var_Axis">FT_Var_Axis</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CID_H">FT_CID_H</a></td><td><a href="ft2-module_management.html#FT_Module_Requester">FT_Module_Requester</a></td><td><a href="ft2-multiple_masters.html#FT_Var_Named_Style">FT_Var_Named_Style</a></td></tr> +<tr><td><a href="ft2-gx_validation.html#FT_ClassicKern_Free">FT_ClassicKern_Free</a></td><td><a href="ft2-header_file_macros.html#FT_MULTIPLE_MASTERS_H">FT_MULTIPLE_MASTERS_H</a></td><td><a href="ft2-basic_types.html#FT_Vector">FT_Vector</a></td></tr> +<tr><td><a href="ft2-gx_validation.html#FT_ClassicKern_Validate">FT_ClassicKern_Validate</a></td><td><a href="ft2-computations.html#FT_MulDiv">FT_MulDiv</a></td><td><a href="ft2-computations.html#FT_Vector_From_Polar">FT_Vector_From_Polar</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_CONFIG_H">FT_CONFIG_CONFIG_H</a></td><td><a href="ft2-computations.html#FT_MulFix">FT_MulFix</a></td><td><a href="ft2-computations.html#FT_Vector_Length">FT_Vector_Length</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_MODULES_H">FT_CONFIG_MODULES_H</a></td><td><a href="ft2-multiple_masters.html#FT_Multi_Master">FT_Multi_Master</a></td><td><a href="ft2-computations.html#FT_Vector_Polarize">FT_Vector_Polarize</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_OPTIONS_H">FT_CONFIG_OPTIONS_H</a></td><td><a href="ft2-base_interface.html#FT_New_Face">FT_New_Face</a></td><td><a href="ft2-computations.html#FT_Vector_Rotate">FT_Vector_Rotate</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_CONFIG_STANDARD_LIBRARY_H">FT_CONFIG_STANDARD_LIBRARY_H</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FOND">FT_New_Face_From_FOND</a></td><td><a href="ft2-computations.html#FT_Vector_Transform">FT_Vector_Transform</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_Cos">FT_Cos</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FSRef">FT_New_Face_From_FSRef</a></td><td><a href="ft2-computations.html#FT_Vector_Unit">FT_Vector_Unit</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Data">FT_Data</a></td><td><a href="ft2-mac_specific.html#FT_New_Face_From_FSSpec">FT_New_Face_From_FSSpec</a></td><td><a href="ft2-header_file_macros.html#FT_WINFONTS_H">FT_WINFONTS_H</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_DivFix">FT_DivFix</a></td><td><a href="ft2-module_management.html#FT_New_Library">FT_New_Library</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_Header">FT_WinFNT_Header</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Done_Face">FT_Done_Face</a></td><td><a href="ft2-base_interface.html#FT_New_Memory_Face">FT_New_Memory_Face</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_HeaderRec">FT_WinFNT_HeaderRec</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Done_FreeType">FT_Done_FreeType</a></td><td><a href="ft2-sizes_management.html#FT_New_Size">FT_New_Size</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1250</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Done_Glyph">FT_Done_Glyph</a></td><td><a href="ft2-basic_types.html#FT_Offset">FT_Offset</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1251</a></td></tr> +<tr><td><a href="ft2-module_management.html#FT_Done_Library">FT_Done_Library</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_DRIVER</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1252</a></td></tr> +<tr><td><a href="ft2-sizes_management.html#FT_Done_Size">FT_Done_Size</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_MEMORY</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1253</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Driver">FT_Driver</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_PARAMS</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1254</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_ENC_TAG">FT_ENC_TAG</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_PATHNAME</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1255</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_CUSTOM</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_STREAM</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1256</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_EXPERT</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">FT_OPEN_XXX</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1257</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_LATIN_1</a></td><td><a href="ft2-header_file_macros.html#FT_OPENTYPE_VALIDATE_H">FT_OPENTYPE_VALIDATE_H</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1258</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_ADOBE_STANDARD</a></td><td><a href="ft2-base_interface.html#FT_Open_Args">FT_Open_Args</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP1361</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_APPLE_ROMAN</a></td><td><a href="ft2-base_interface.html#FT_Open_Face">FT_Open_Face</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP874</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_BIG5</a></td><td><a href="ft2-ot_validation.html#FT_OpenType_Free">FT_OpenType_Free</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP932</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_GB2312</a></td><td><a href="ft2-ot_validation.html#FT_OpenType_Validate">FT_OpenType_Validate</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP936</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_JOHAB</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_FILL_LEFT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP949</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_BIG5</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_FILL_RIGHT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_CP950</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_GB2312</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_NONE</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_DEFAULT</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_JOHAB</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_POSTSCRIPT</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_MAC</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_SJIS</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_ORIENTATION_TRUETYPE</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_OEM</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_SYMBOL</a></td><td><a href="ft2-outline_processing.html#FT_Orientation">FT_Orientation</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_SYMBOL</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_MS_WANSUNG</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_EVEN_ODD_FILL</a></td><td><a href="ft2-winfnt_fonts.html#FT_WinFNT_ID_XXX">FT_WinFNT_ID_XXX</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_NONE</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_FLAGS</a></td><td><a href="ft2-header_file_macros.html#FT_XFREE86_H">FT_XFREE86_H</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_OLD_LATIN_2</a></td><td><a href="ft2-header_file_macros.html#FT_OUTLINE_H">FT_OUTLINE_H</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache">FTC_CMapCache</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_SJIS</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_HIGH_PRECISION</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache_Lookup">FTC_CMapCache_Lookup</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_UNICODE</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_IGNORE_DROPOUTS</a></td><td><a href="ft2-cache_subsystem.html#FTC_CMapCache_New">FTC_CMapCache_New</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_ENCODING_WANSUNG</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_INCLUDE_STUBS</a></td><td><a href="ft2-cache_subsystem.html#FTC_Face_Requester">FTC_Face_Requester</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Encoding">FT_Encoding</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_NONE</a></td><td><a href="ft2-cache_subsystem.html#FTC_FaceID">FTC_FaceID</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_ERRORS_H">FT_ERRORS_H</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_OWNER</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache">FTC_ImageCache</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Error">FT_Error</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_REVERSE_FILL</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_Lookup">FTC_ImageCache_Lookup</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_F26Dot6">FT_F26Dot6</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_SINGLE_PASS</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_LookupScaler">FTC_ImageCache_LookupScaler</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_F2Dot14">FT_F2Dot14</a></td><td><a href="ft2-outline_processing.html#FT_OUTLINE_FLAGS">FT_OUTLINE_SMART_DROPOUTS</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageCache_New">FTC_ImageCache_New</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_CID_KEYED</a></td><td><a href="ft2-outline_processing.html#FT_Outline">FT_Outline</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageType">FTC_ImageType</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_EXTERNAL_STREAM</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Check">FT_Outline_Check</a></td><td><a href="ft2-cache_subsystem.html#FTC_ImageTypeRec">FTC_ImageTypeRec</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FAST_GLYPHS</a></td><td><a href="ft2-outline_processing.html#FT_Outline_ConicToFunc">FT_Outline_ConicToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager">FTC_Manager</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FIXED_SIZES</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Copy">FT_Outline_Copy</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_Done">FTC_Manager_Done</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_FIXED_WIDTH</a></td><td><a href="ft2-outline_processing.html#FT_Outline_CubicToFunc">FT_Outline_CubicToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_LookupFace">FTC_Manager_LookupFace</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_GLYPH_NAMES</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Decompose">FT_Outline_Decompose</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_LookupSize">FTC_Manager_LookupSize</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_HINTER</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Done">FT_Outline_Done</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_New">FTC_Manager_New</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_HORIZONTAL</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Embolden">FT_Outline_Embolden</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_RemoveFaceID">FTC_Manager_RemoveFaceID</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_KERNING</a></td><td><a href="ft2-outline_processing.html#FT_Outline_EmboldenXY">FT_Outline_EmboldenXY</a></td><td><a href="ft2-cache_subsystem.html#FTC_Manager_Reset">FTC_Manager_Reset</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_MULTIPLE_MASTERS</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Funcs">FT_Outline_Funcs</a></td><td><a href="ft2-cache_subsystem.html#FTC_Node">FTC_Node</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_SCALABLE</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_BBox">FT_Outline_Get_BBox</a></td><td><a href="ft2-cache_subsystem.html#FTC_Node_Unref">FTC_Node_Unref</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_SFNT</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_Bitmap">FT_Outline_Get_Bitmap</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBit">FTC_SBit</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_TRICKY</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_CBox">FT_Outline_Get_CBox</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache">FTC_SBitCache</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_VERTICAL</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Get_Orientation">FT_Outline_Get_Orientation</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_Lookup">FTC_SBitCache_Lookup</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FACE_FLAG_XXX">FT_FACE_FLAG_XXX</a></td><td><a href="ft2-glyph_stroker.html#FT_Outline_GetInsideBorder">FT_Outline_GetInsideBorder</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_LookupScaler">FTC_SBitCache_LookupScaler</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Face">FT_Face</a></td><td><a href="ft2-glyph_stroker.html#FT_Outline_GetOutsideBorder">FT_Outline_GetOutsideBorder</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitCache_New">FTC_SBitCache_New</a></td></tr> +<tr><td><a href="ft2-version.html#FT_Face_CheckTrueTypePatents">FT_Face_CheckTrueTypePatents</a></td><td><a href="ft2-outline_processing.html#FT_Outline_LineToFunc">FT_Outline_LineToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_SBitRec">FTC_SBitRec</a></td></tr> +<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharsOfVariant">FT_Face_GetCharsOfVariant</a></td><td><a href="ft2-outline_processing.html#FT_Outline_MoveToFunc">FT_Outline_MoveToFunc</a></td><td><a href="ft2-cache_subsystem.html#FTC_Scaler">FTC_Scaler</a></td></tr> +<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharVariantIndex">FT_Face_GetCharVariantIndex</a></td><td><a href="ft2-outline_processing.html#FT_Outline_New">FT_Outline_New</a></td><td><a href="ft2-cache_subsystem.html#FTC_ScalerRec">FTC_ScalerRec</a></td></tr> +<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetCharVariantIsDefault">FT_Face_GetCharVariantIsDefault</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Render">FT_Outline_Render</a></td><td><a href="ft2-auto_hinter.html#fallback-script">fallback-script</a></td></tr> +<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetVariantSelectors">FT_Face_GetVariantSelectors</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Reverse">FT_Outline_Reverse</a></td><td><a href="ft2-base_interface.html#ft_encoding_xxx">ft_encoding_xxx</a></td></tr> +<tr><td><a href="ft2-glyph_variants.html#FT_Face_GetVariantsOfChar">FT_Face_GetVariantsOfChar</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Transform">FT_Outline_Transform</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_gridfit</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Face_Internal">FT_Face_Internal</a></td><td><a href="ft2-outline_processing.html#FT_Outline_Translate">FT_Outline_Translate</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_pixels</a></td></tr> +<tr><td><a href="ft2-version.html#FT_Face_SetUnpatentedHinting">FT_Face_SetUnpatentedHinting</a></td><td><a href="ft2-glyph_management.html#FT_OutlineGlyph">FT_OutlineGlyph</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_subpixels</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FaceRec">FT_FaceRec</a></td><td><a href="ft2-glyph_management.html#FT_OutlineGlyphRec">FT_OutlineGlyphRec</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_truncate</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Fixed">FT_Fixed</a></td><td><a href="ft2-sfnt_names.html#FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY">FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_unscaled</a></td></tr> +<tr><td><a href="ft2-computations.html#FT_FloorFix">FT_FloorFix</a></td><td><a href="ft2-sfnt_names.html#FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY">FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY</a></td><td><a href="ft2-glyph_management.html#ft_glyph_bbox_xxx">ft_glyph_bbox_xxx</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_FREETYPE_H">FT_FREETYPE_H</a></td><td><a href="ft2-incremental.html#FT_PARAM_TAG_INCREMENTAL">FT_PARAM_TAG_INCREMENTAL</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_bitmap</a></td></tr> +<tr><td><a href="ft2-system_interface.html#FT_Free_Func">FT_Free_Func</a></td><td><a href="ft2-truetype_tables.html#FT_PARAM_TAG_UNPATENTED_HINTING">FT_PARAM_TAG_UNPATENTED_HINTING</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_composite</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_BITMAP_EMBEDDING_ONLY</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">FT_Palette_Mode</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_none</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_EDITABLE_EMBEDDING</a></td><td><a href="ft2-base_interface.html#FT_Parameter">FT_Parameter</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_outline</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_INSTALLABLE_EMBEDDING</a></td><td><a href="ft2-header_file_macros.html#FT_PFR_H">FT_PFR_H</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_plotter</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_NO_SUBSETTING</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_BGRA</a></td><td><a href="ft2-basic_types.html#ft_glyph_format_xxx">ft_glyph_format_xxx</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY</a></td><td><a href="ft2-base_interface.html#ft_kerning_default">ft_kerning_default</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY2</a></td><td><a href="ft2-base_interface.html#ft_kerning_unfitted">ft_kerning_unfitted</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_FSTYPE_XXX">FT_FSTYPE_XXX</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_GRAY4</a></td><td><a href="ft2-base_interface.html#ft_kerning_unscaled">ft_kerning_unscaled</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_FWord">FT_FWord</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_LCD</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_driver</a></td></tr> +<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_DO_GRAY</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_LCD_V</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_memory</a></td></tr> +<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_DO_GRIDFIT</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_MONO</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_params</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_GASP_H">FT_GASP_H</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_PIXEL_MODE_NONE</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_pathname</a></td></tr> +<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_NO_TABLE</a></td><td><a href="ft2-basic_types.html#FT_Pixel_Mode">FT_Pixel_Mode</a></td><td><a href="ft2-base_interface.html#FT_OPEN_XXX">ft_open_stream</a></td></tr> +<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_SYMMETRIC_GRIDFIT</a></td><td><a href="ft2-basic_types.html#FT_Pointer">FT_Pointer</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_even_odd_fill</a></td></tr> +<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_SYMMETRIC_SMOOTHING</a></td><td><a href="ft2-basic_types.html#FT_Pos">FT_Pos</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_flags</a></td></tr> +<tr><td><a href="ft2-gasp_table.html#FT_GASP_XXX">FT_GASP_XXX</a></td><td><a href="ft2-auto_hinter.html#FT_Prop_GlyphToScriptMap">FT_Prop_GlyphToScriptMap</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_high_precision</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Generic">FT_Generic</a></td><td><a href="ft2-auto_hinter.html#FT_Prop_IncreaseXHeight">FT_Prop_IncreaseXHeight</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_ignore_dropouts</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Generic_Finalizer">FT_Generic_Finalizer</a></td><td><a href="ft2-module_management.html#FT_Property_Get">FT_Property_Get</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_none</a></td></tr> +<tr><td><a href="ft2-quick_advance.html#FT_Get_Advance">FT_Get_Advance</a></td><td><a href="ft2-module_management.html#FT_Property_Set">FT_Property_Set</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_owner</a></td></tr> +<tr><td><a href="ft2-quick_advance.html#FT_Get_Advances">FT_Get_Advances</a></td><td><a href="ft2-bdf_fonts.html#FT_PropertyType">FT_PropertyType</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_reverse_fill</a></td></tr> +<tr><td><a href="ft2-bdf_fonts.html#FT_Get_BDF_Charset_ID">FT_Get_BDF_Charset_ID</a></td><td><a href="ft2-basic_types.html#FT_PtrDist">FT_PtrDist</a></td><td><a href="ft2-outline_processing.html#ft_outline_flags">ft_outline_single_pass</a></td></tr> +<tr><td><a href="ft2-bdf_fonts.html#FT_Get_BDF_Property">FT_Get_BDF_Property</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_AA</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">ft_palette_mode_rgb</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_Char_Index">FT_Get_Char_Index</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_CLIP</a></td><td><a href="ft2-basic_types.html#FT_Palette_Mode">ft_palette_mode_rgba</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_Charmap_Index">FT_Get_Charmap_Index</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_DEFAULT</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_grays</a></td></tr> +<tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_From_Glyph_Index">FT_Get_CID_From_Glyph_Index</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_DIRECT</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_mono</a></td></tr> +<tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_Is_Internally_CID_Keyed">FT_Get_CID_Is_Internally_CID_Keyed</a></td><td><a href="ft2-raster.html#FT_RASTER_FLAG_XXX">FT_RASTER_FLAG_XXX</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_none</a></td></tr> +<tr><td><a href="ft2-cid_fonts.html#FT_Get_CID_Registry_Ordering_Supplement">FT_Get_CID_Registry_Ordering_Supplement</a></td><td><a href="ft2-raster.html#FT_Raster">FT_Raster</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_pal2</a></td></tr> +<tr><td><a href="ft2-truetype_tables.html#FT_Get_CMap_Format">FT_Get_CMap_Format</a></td><td><a href="ft2-raster.html#FT_Raster_BitSet_Func">FT_Raster_BitSet_Func</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_pal4</a></td></tr> +<tr><td><a href="ft2-truetype_tables.html#FT_Get_CMap_Language_ID">FT_Get_CMap_Language_ID</a></td><td><a href="ft2-raster.html#FT_Raster_BitTest_Func">FT_Raster_BitTest_Func</a></td><td><a href="ft2-basic_types.html#ft_pixel_mode_xxx">ft_pixel_mode_xxx</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_First_Char">FT_Get_First_Char</a></td><td><a href="ft2-raster.html#FT_Raster_DoneFunc">FT_Raster_DoneFunc</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_mono</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_FSType_Flags">FT_Get_FSType_Flags</a></td><td><a href="ft2-raster.html#FT_Raster_Funcs">FT_Raster_Funcs</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_normal</a></td></tr> +<tr><td><a href="ft2-gasp_table.html#FT_Get_Gasp">FT_Get_Gasp</a></td><td><a href="ft2-raster.html#FT_Raster_NewFunc">FT_Raster_NewFunc</a></td><td><a href="ft2-base_interface.html#ft_render_mode_xxx">ft_render_mode_xxx</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Get_Glyph">FT_Get_Glyph</a></td><td><a href="ft2-raster.html#FT_Raster_Params">FT_Raster_Params</a></td><td><a href="ft2-auto_hinter.html#glyph-to-script-map">glyph-to-script-map</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_Glyph_Name">FT_Get_Glyph_Name</a></td><td><a href="ft2-raster.html#FT_Raster_RenderFunc">FT_Raster_RenderFunc</a></td><td><a href="ft2-cff_driver.html#hinting-engine">hinting-engine</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_Kerning">FT_Get_Kerning</a></td><td><a href="ft2-raster.html#FT_Raster_ResetFunc">FT_Raster_ResetFunc</a></td><td><a href="ft2-auto_hinter.html#increase-x-height">increase-x-height</a></td></tr> +<tr><td><a href="ft2-multiple_masters.html#FT_Get_MM_Var">FT_Get_MM_Var</a></td><td><a href="ft2-raster.html#FT_Raster_SetModeFunc">FT_Raster_SetModeFunc</a></td><td><a href="ft2-tt_driver.html#interpreter-version">interpreter-version</a></td></tr> +<tr><td><a href="ft2-module_management.html#FT_Get_Module">FT_Get_Module</a></td><td><a href="ft2-header_file_macros.html#FT_RENDER_H">FT_RENDER_H</a></td><td><a href="ft2-cff_driver.html#no-stem-darkening">no-stem-darkening</a></td></tr> +<tr><td><a href="ft2-multiple_masters.html#FT_Get_Multi_Master">FT_Get_Multi_Master</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD</a></td><td><a href="ft2-type1_tables.html#PS_Dict_Keys">PS_Dict_Keys</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_Name_Index">FT_Get_Name_Index</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD_V</a></td><td><a href="ft2-type1_tables.html#PS_FontInfo">PS_FontInfo</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_Next_Char">FT_Get_Next_Char</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LIGHT</a></td><td><a href="ft2-type1_tables.html#PS_FontInfoRec">PS_FontInfoRec</a></td></tr> +<tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Advance">FT_Get_PFR_Advance</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_MONO</a></td><td><a href="ft2-type1_tables.html#PS_Private">PS_Private</a></td></tr> +<tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Kerning">FT_Get_PFR_Kerning</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_NORMAL</a></td><td><a href="ft2-type1_tables.html#PS_PrivateRec">PS_PrivateRec</a></td></tr> +<tr><td><a href="ft2-pfr_fonts.html#FT_Get_PFR_Metrics">FT_Get_PFR_Metrics</a></td><td><a href="ft2-system_interface.html#FT_Realloc_Func">FT_Realloc_Func</a></td><td><a href="ft2-type1_tables.html#T1_Blend_Flags">T1_Blend_Flags</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_Postscript_Name">FT_Get_Postscript_Name</a></td><td><a href="ft2-base_interface.html#FT_Reference_Face">FT_Reference_Face</a></td><td><a href="ft2-type1_tables.html#T1_EncodingType">T1_EncodingType</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Info">FT_Get_PS_Font_Info</a></td><td><a href="ft2-module_management.html#FT_Reference_Library">FT_Reference_Library</a></td><td><a href="ft2-type1_tables.html#T1_FontInfo">T1_FontInfo</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Private">FT_Get_PS_Font_Private</a></td><td><a href="ft2-module_management.html#FT_Remove_Module">FT_Remove_Module</a></td><td><a href="ft2-type1_tables.html#T1_Private">T1_Private</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#FT_Get_PS_Font_Value">FT_Get_PS_Font_Value</a></td><td><a href="ft2-base_interface.html#FT_Render_Glyph">FT_Render_Glyph</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_CUSTOM</a></td></tr> +<tr><td><a href="ft2-module_management.html#FT_Get_Renderer">FT_Get_Renderer</a></td><td><a href="ft2-base_interface.html#FT_Render_Mode">FT_Render_Mode</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_EXPERT</a></td></tr> +<tr><td><a href="ft2-sfnt_names.html#FT_Get_Sfnt_Name">FT_Get_Sfnt_Name</a></td><td><a href="ft2-base_interface.html#FT_Renderer">FT_Renderer</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_LATIN_1</a></td></tr> +<tr><td><a href="ft2-sfnt_names.html#FT_Get_Sfnt_Name_Count">FT_Get_Sfnt_Name_Count</a></td><td><a href="ft2-module_management.html#FT_Renderer_Class">FT_Renderer_Class</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_STANDARD</a></td></tr> +<tr><td><a href="ft2-truetype_tables.html#FT_Get_Sfnt_Table">FT_Get_Sfnt_Table</a></td><td><a href="ft2-base_interface.html#FT_Request_Size">FT_Request_Size</a></td><td><a href="ft2-truetype_tables.html#TT_ADOBE_ID_XXX">TT_ADOBE_ID_XXX</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_SubGlyph_Info">FT_Get_SubGlyph_Info</a></td><td><a href="ft2-computations.html#FT_RoundFix">FT_RoundFix</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_DEFAULT</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Get_Track_Kerning">FT_Get_Track_Kerning</a></td><td><a href="ft2-base_interface.html#FT_Select_Charmap">FT_Select_Charmap</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_ISO_10646</a></td></tr> +<tr><td><a href="ft2-truetype_engine.html#FT_Get_TrueType_Engine_Type">FT_Get_TrueType_Engine_Type</a></td><td><a href="ft2-base_interface.html#FT_Select_Size">FT_Select_Size</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_1_1</a></td></tr> +<tr><td><a href="ft2-winfnt_fonts.html#FT_Get_WinFNT_Header">FT_Get_WinFNT_Header</a></td><td><a href="ft2-base_interface.html#FT_Set_Char_Size">FT_Set_Char_Size</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_2_0</a></td></tr> +<tr><td><a href="ft2-font_formats.html#FT_Get_X11_Font_Format">FT_Get_X11_Font_Format</a></td><td><a href="ft2-base_interface.html#FT_Set_Charmap">FT_Set_Charmap</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_UNICODE_32</a></td></tr> +<tr><td><a href="ft2-mac_specific.html#FT_GetFile_From_Mac_ATS_Name">FT_GetFile_From_Mac_ATS_Name</a></td><td><a href="ft2-module_management.html#FT_Set_Debug_Hook">FT_Set_Debug_Hook</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_VARIANT_SELECTOR</a></td></tr> +<tr><td><a href="ft2-mac_specific.html#FT_GetFile_From_Mac_Name">FT_GetFile_From_Mac_Name</a></td><td><a href="ft2-multiple_masters.html#FT_Set_MM_Blend_Coordinates">FT_Set_MM_Blend_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_APPLE_ID_XXX">TT_APPLE_ID_XXX</a></td></tr> +<tr><td><a href="ft2-mac_specific.html#FT_GetFilePath_From_Mac_ATS_Name">FT_GetFilePath_From_Mac_ATS_Name</a></td><td><a href="ft2-multiple_masters.html#FT_Set_MM_Design_Coordinates">FT_Set_MM_Design_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_Header">TT_Header</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_GRIDFIT</a></td><td><a href="ft2-base_interface.html#FT_Set_Pixel_Sizes">FT_Set_Pixel_Sizes</a></td><td><a href="ft2-truetype_tables.html#TT_HoriHeader">TT_HoriHeader</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_PIXELS</a></td><td><a href="ft2-module_management.html#FT_Set_Renderer">FT_Set_Renderer</a></td><td><a href="ft2-tt_driver.html#TT_INTERPRETER_VERSION_XXX">TT_INTERPRETER_VERSION_35</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_SUBPIXELS</a></td><td><a href="ft2-base_interface.html#FT_Set_Transform">FT_Set_Transform</a></td><td><a href="ft2-tt_driver.html#TT_INTERPRETER_VERSION_XXX">TT_INTERPRETER_VERSION_38</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_TRUNCATE</a></td><td><a href="ft2-multiple_masters.html#FT_Set_Var_Blend_Coordinates">FT_Set_Var_Blend_Coordinates</a></td><td><a href="ft2-tt_driver.html#TT_INTERPRETER_VERSION_XXX">TT_INTERPRETER_VERSION_XXX</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_GLYPH_BBOX_UNSCALED</a></td><td><a href="ft2-multiple_masters.html#FT_Set_Var_Design_Coordinates">FT_Set_Var_Design_Coordinates</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_10646</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_BITMAP</a></td><td><a href="ft2-header_file_macros.html#FT_SFNT_NAMES_H">FT_SFNT_NAMES_H</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_7BIT_ASCII</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_COMPOSITE</a></td><td><a href="ft2-truetype_tables.html#FT_Sfnt_Table_Info">FT_Sfnt_Table_Info</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_8859_1</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_NONE</a></td><td><a href="ft2-truetype_tables.html#FT_Sfnt_Tag">FT_Sfnt_Tag</a></td><td><a href="ft2-truetype_tables.html#TT_ISO_ID_XXX">TT_ISO_ID_XXX</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_OUTLINE</a></td><td><a href="ft2-sfnt_names.html#FT_SfntName">FT_SfntName</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ARABIC</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_GLYPH_FORMAT_PLOTTER</a></td><td><a href="ft2-basic_types.html#FT_Short">FT_Short</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ARMENIAN</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_GLYPH_H">FT_GLYPH_H</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_BBOX</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_BENGALI</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph">FT_Glyph</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_CELL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_BURMESE</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_BBox_Mode">FT_Glyph_BBox_Mode</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_NOMINAL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_DEVANAGARI</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_Copy">FT_Glyph_Copy</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_REAL_DIM</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GEEZ</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Glyph_Format">FT_Glyph_Format</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_SIZE_REQUEST_TYPE_SCALES</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GEORGIAN</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_Get_CBox">FT_Glyph_Get_CBox</a></td><td><a href="ft2-header_file_macros.html#FT_SIZES_H">FT_SIZES_H</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GREEK</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Glyph_Metrics">FT_Glyph_Metrics</a></td><td><a href="ft2-computations.html#FT_Sin">FT_Sin</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GUJARATI</a></td></tr> +<tr><td><a href="ft2-glyph_stroker.html#FT_Glyph_Stroke">FT_Glyph_Stroke</a></td><td><a href="ft2-base_interface.html#FT_Size">FT_Size</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_GURMUKHI</a></td></tr> +<tr><td><a href="ft2-glyph_stroker.html#FT_Glyph_StrokeBorder">FT_Glyph_StrokeBorder</a></td><td><a href="ft2-base_interface.html#FT_Size_Internal">FT_Size_Internal</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_HEBREW</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_To_Bitmap">FT_Glyph_To_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_Size_Metrics">FT_Size_Metrics</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_JAPANESE</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_Glyph_Transform">FT_Glyph_Transform</a></td><td><a href="ft2-base_interface.html#FT_Size_Request">FT_Size_Request</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KANNADA</a></td></tr> +<tr><td><a href="ft2-glyph_management.html#FT_GlyphRec">FT_GlyphRec</a></td><td><a href="ft2-base_interface.html#FT_Size_Request_Type">FT_Size_Request_Type</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KHMER</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_GlyphSlot">FT_GlyphSlot</a></td><td><a href="ft2-base_interface.html#FT_Size_RequestRec">FT_Size_RequestRec</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_KOREAN</a></td></tr> +<tr><td><a href="ft2-bitmap_handling.html#FT_GlyphSlot_Own_Bitmap">FT_GlyphSlot_Own_Bitmap</a></td><td><a href="ft2-base_interface.html#FT_SizeRec">FT_SizeRec</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_LAOTIAN</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_GlyphSlotRec">FT_GlyphSlotRec</a></td><td><a href="ft2-base_interface.html#FT_Slot_Internal">FT_Slot_Internal</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MALAYALAM</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_GX_VALIDATE_H">FT_GX_VALIDATE_H</a></td><td><a href="ft2-raster.html#FT_Span">FT_Span</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MALDIVIAN</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_GZIP_H">FT_GZIP_H</a></td><td><a href="ft2-raster.html#FT_SpanFunc">FT_SpanFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_MONGOLIAN</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_HAS_FAST_GLYPHS">FT_HAS_FAST_GLYPHS</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_STROKER_BORDER_LEFT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ORIYA</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_HAS_FIXED_SIZES">FT_HAS_FIXED_SIZES</a></td><td><a href="ft2-glyph_stroker.html#FT_StrokerBorder">FT_STROKER_BORDER_RIGHT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_ROMAN</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_HAS_GLYPH_NAMES">FT_HAS_GLYPH_NAMES</a></td><td><a href="ft2-header_file_macros.html#FT_STROKER_H">FT_STROKER_H</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_RSYMBOL</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_HAS_HORIZONTAL">FT_HAS_HORIZONTAL</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_BUTT</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_RUSSIAN</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_HAS_KERNING">FT_HAS_KERNING</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_ROUND</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SIMPLIFIED_CHINESE</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_HAS_MULTIPLE_MASTERS">FT_HAS_MULTIPLE_MASTERS</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_STROKER_LINECAP_SQUARE</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SINDHI</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_HAS_VERTICAL">FT_HAS_VERTICAL</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_BEVEL</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SINHALESE</a></td></tr> +<tr><td><a href="ft2-type1_tables.html#FT_Has_PS_Glyph_Names">FT_Has_PS_Glyph_Names</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_SLAVIC</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_IMAGE_H">FT_IMAGE_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER_FIXED</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TAMIL</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_IMAGE_TAG">FT_IMAGE_TAG</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_MITER_VARIABLE</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TELUGU</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_INCREMENTAL_H">FT_INCREMENTAL_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_STROKER_LINEJOIN_ROUND</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_THAI</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental">FT_Incremental</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_BOLD</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TIBETAN</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental_FreeGlyphDataFunc">FT_Incremental_FreeGlyphDataFunc</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_ITALIC</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_TRADITIONAL_CHINESE</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental_FuncsRec">FT_Incremental_FuncsRec</a></td><td><a href="ft2-base_interface.html#FT_STYLE_FLAG_XXX">FT_STYLE_FLAG_XXX</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_UNINTERP</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental_GetGlyphDataFunc">FT_Incremental_GetGlyphDataFunc</a></td><td><a href="ft2-system_interface.html#FT_Stream">FT_Stream</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_VIETNAMESE</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental_GetGlyphMetricsFunc">FT_Incremental_GetGlyphMetricsFunc</a></td><td><a href="ft2-system_interface.html#FT_Stream_CloseFunc">FT_Stream_CloseFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MAC_ID_XXX">TT_MAC_ID_XXX</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental_Interface">FT_Incremental_Interface</a></td><td><a href="ft2-system_interface.html#FT_Stream_IoFunc">FT_Stream_IoFunc</a></td><td><a href="ft2-truetype_tables.html#TT_MaxProfile">TT_MaxProfile</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental_InterfaceRec">FT_Incremental_InterfaceRec</a></td><td><a href="ft2-bzip2.html#FT_Stream_OpenBzip2">FT_Stream_OpenBzip2</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_BIG_5</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental_Metrics">FT_Incremental_Metrics</a></td><td><a href="ft2-gzip.html#FT_Stream_OpenGzip">FT_Stream_OpenGzip</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_GB2312</a></td></tr> +<tr><td><a href="ft2-incremental.html#FT_Incremental_MetricsRec">FT_Incremental_MetricsRec</a></td><td><a href="ft2-lzw.html#FT_Stream_OpenLZW">FT_Stream_OpenLZW</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_JOHAB</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Init_FreeType">FT_Init_FreeType</a></td><td><a href="ft2-system_interface.html#FT_StreamDesc">FT_StreamDesc</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_SJIS</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Int">FT_Int</a></td><td><a href="ft2-system_interface.html#FT_StreamRec">FT_StreamRec</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_SYMBOL_CS</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Int16">FT_Int16</a></td><td><a href="ft2-basic_types.html#FT_String">FT_String</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_UCS_4</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Int32">FT_Int32</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker">FT_Stroker</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_UNICODE_CS</a></td></tr> +<tr><td><a href="ft2-basic_types.html#FT_Int64">FT_Int64</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_BeginSubPath">FT_Stroker_BeginSubPath</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_WANSUNG</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_IS_CID_KEYED">FT_IS_CID_KEYED</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ConicTo">FT_Stroker_ConicTo</a></td><td><a href="ft2-truetype_tables.html#TT_MS_ID_XXX">TT_MS_ID_XXX</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_IS_FIXED_WIDTH">FT_IS_FIXED_WIDTH</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_CubicTo">FT_Stroker_CubicTo</a></td><td><a href="ft2-truetype_tables.html#TT_OS2">TT_OS2</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_IS_SCALABLE">FT_IS_SCALABLE</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Done">FT_Stroker_Done</a></td><td><a href="ft2-truetype_tables.html#TT_PCLT">TT_PCLT</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_IS_SFNT">FT_IS_SFNT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_EndSubPath">FT_Stroker_EndSubPath</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_ADOBE</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_IS_TRICKY">FT_IS_TRICKY</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_Export">FT_Stroker_Export</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_APPLE_UNICODE</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_DEFAULT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_ExportBorder">FT_Stroker_ExportBorder</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_CUSTOM</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_UNFITTED</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_GetBorderCounts">FT_Stroker_GetBorderCounts</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_ISO</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_KERNING_UNSCALED</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_GetCounts">FT_Stroker_GetCounts</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_MACINTOSH</a></td></tr> +<tr><td><a href="ft2-base_interface.html#FT_Kerning_Mode">FT_Kerning_Mode</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineCap">FT_Stroker_LineCap</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_MICROSOFT</a></td></tr> +<tr><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_DEFAULT</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineJoin">FT_Stroker_LineJoin</a></td><td><a href="ft2-truetype_tables.html#TT_PLATFORM_XXX">TT_PLATFORM_XXX</a></td></tr> +<tr><td><a href="ft2-header_file_macros.html#FT_LCD_FILTER_H">FT_LCD_FILTER_H</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_LineTo">FT_Stroker_LineTo</a></td><td><a href="ft2-truetype_tables.html#TT_Postscript">TT_Postscript</a></td></tr> +<tr><td><a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_LEGACY</a></td><td><a href="ft2-glyph_stroker.html#FT_Stroker_New">FT_Stroker_New</a></td><td><a href="ft2-truetype_tables.html#TT_VertHeader">TT_VertHeader</a></td></tr> </table> <hr> <table><tr><td width="100%"></td> <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><font size=-2>generated on Thu Dec 20 08:35:15 2012</font></center></body> +<center><font size=-2>generated on Wed Jun 19 23:29:20 2013</font></center></body> </html> diff --git a/freetype/docs/reference/ft2-lcd_filtering.html b/freetype/docs/reference/ft2-lcd_filtering.html index 9965c432d..da50ff5f5 100644 --- a/freetype/docs/reference/ft2-lcd_filtering.html +++ b/freetype/docs/reference/ft2-lcd_filtering.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> LCD Filtering @@ -49,6 +49,20 @@ LCD Filtering <table align=center width="87%"><tr><td> <p>The <a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a> API can be used to specify a low-pass filter which is then applied to LCD-optimized bitmaps generated through <a href="ft2-base_interface.html#FT_Render_Glyph">FT_Render_Glyph</a>. This is useful to reduce color fringes which would occur with unfiltered rendering.</p> <p>Note that no filter is active by default, and that this function is <b>not</b> implemented in default builds of the library. You need to #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your ‘ftoption.h’ file in order to activate it.</p> +<p>FreeType generates alpha coverage maps, which are linear by nature. For instance, the value 0x80 in bitmap representation means that (within numerical precision) 0x80/0xff fraction of that pixel is covered by the glyph's outline. The blending function for placing text over a background is</p> +<pre class="colored"> + dst = alpha * src + (1 - alpha) * dst , +</pre> +<p>which is known as OVER. However, when calculating the output of the OVER operator, the source colors should first be transformed to a linear color space, then alpha blended in that space, and transformed back to the output color space.</p> +<p>When linear light blending is used, the default FIR5 filtering weights (as given by FT_LCD_FILTER_DEFAULT) are no longer optimal, as they have been designed for black on white rendering while lacking gamma correction. To preserve color neutrality, weights for a FIR5 filter should be chosen according to two free parameters ‘a’ and ‘c’, and the FIR weights should be</p> +<pre class="colored"> + [a - c, a + c, 2 * a, a + c, a - c] . +</pre> +<p>This formula generates equal weights for all the color primaries across the filter kernel, which makes it colorless. One suggested set of weights is</p> +<pre class="colored"> + [0x10, 0x50, 0x60, 0x50, 0x10] , +</pre> +<p>where ‘a’ has value 0x30 and ‘b’ value 0x20. The weights in filter may have a sum larger than 0x100, which increases coloration slightly but also improves contrast.</p> </td></tr></table><br> <table align=center width="75%"><tr><td> <h4><a name="FT_LcdFilter">FT_LcdFilter</a></h4> diff --git a/freetype/docs/reference/ft2-list_processing.html b/freetype/docs/reference/ft2-list_processing.html index cbb43eb7e..674a8e294 100644 --- a/freetype/docs/reference/ft2-list_processing.html +++ b/freetype/docs/reference/ft2-list_processing.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> List Processing diff --git a/freetype/docs/reference/ft2-lzw.html b/freetype/docs/reference/ft2-lzw.html index 0fdd4dcf5..09434482e 100644 --- a/freetype/docs/reference/ft2-lzw.html +++ b/freetype/docs/reference/ft2-lzw.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> LZW Streams diff --git a/freetype/docs/reference/ft2-mac_specific.html b/freetype/docs/reference/ft2-mac_specific.html index ca837e8dd..72ef43027 100644 --- a/freetype/docs/reference/ft2-mac_specific.html +++ b/freetype/docs/reference/ft2-mac_specific.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Mac Specific Interface diff --git a/freetype/docs/reference/ft2-module_management.html b/freetype/docs/reference/ft2-module_management.html index 227bca3c8..cd53efb25 100644 --- a/freetype/docs/reference/ft2-module_management.html +++ b/freetype/docs/reference/ft2-module_management.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Module Management @@ -356,7 +356,7 @@ Defined in FT_MODULE_H (freetype/ftmodapi.h). </td></tr></table><br> <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> - <a href="ft2-basic_types.html#FT_Error">FT_Error</a> + FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> ) <b>FT_Property_Set</b>( <a href="ft2-base_interface.html#FT_Library">FT_Library</a> library, <span class="keyword">const</span> <a href="ft2-basic_types.html#FT_String">FT_String</a>* module_name, <span class="keyword">const</span> <a href="ft2-basic_types.html#FT_String">FT_String</a>* property_name, @@ -397,7 +397,8 @@ Defined in FT_MODULE_H (freetype/ftmodapi.h). bar = 1; FT_Property_Set( library, "foo", "bar", &bar ); </pre> -<p>It is not possible to set properties of the FreeType Cache sub-system with FT_Property_Set; use ?FTC_Property_Set? instead.</p> +<p>Note that the FreeType Cache sub-system doesn't recognize module property changes. To avoid glyph lookup confusion within the cache you should call <a href="ft2-cache_subsystem.html#FTC_Manager_Reset">FTC_Manager_Reset</a> to completely flush the cache if a module property gets changed after <a href="ft2-cache_subsystem.html#FTC_Manager_New">FTC_Manager_New</a> has been called.</p> +<p>It is not possible to set properties of the FreeType Cache sub-system itself with FT_Property_Set; use ?FTC_Property_Set? instead.</p> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>since</b></em></td></tr><tr><td> <p>2.4.11</p> @@ -415,7 +416,7 @@ Defined in FT_MODULE_H (freetype/ftmodapi.h). </td></tr></table><br> <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> - <a href="ft2-basic_types.html#FT_Error">FT_Error</a> + FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> ) <b>FT_Property_Get</b>( <a href="ft2-base_interface.html#FT_Library">FT_Library</a> library, <span class="keyword">const</span> <a href="ft2-basic_types.html#FT_String">FT_String</a>* module_name, <span class="keyword">const</span> <a href="ft2-basic_types.html#FT_String">FT_String</a>* property_name, diff --git a/freetype/docs/reference/ft2-multiple_masters.html b/freetype/docs/reference/ft2-multiple_masters.html index bdb592bc0..3197a4485 100644 --- a/freetype/docs/reference/ft2-multiple_masters.html +++ b/freetype/docs/reference/ft2-multiple_masters.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Multiple Masters diff --git a/freetype/docs/reference/ft2-ot_validation.html b/freetype/docs/reference/ft2-ot_validation.html index 7f61dd264..9feef848a 100644 --- a/freetype/docs/reference/ft2-ot_validation.html +++ b/freetype/docs/reference/ft2-ot_validation.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> OpenType Validation diff --git a/freetype/docs/reference/ft2-outline_processing.html b/freetype/docs/reference/ft2-outline_processing.html index 54d0c1680..966570056 100644 --- a/freetype/docs/reference/ft2-outline_processing.html +++ b/freetype/docs/reference/ft2-outline_processing.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Outline Processing @@ -226,10 +226,10 @@ Defined in FT_OUTLINE_H (freetype/ftoutln.h). <p>A handle to the library object from where the outline is allocated. Note however that the new outline will <b>not</b> necessarily be <b>freed</b>, when destroying the library, by <a href="ft2-base_interface.html#FT_Done_FreeType">FT_Done_FreeType</a>.</p> </td></tr> <tr valign=top><td><b>numPoints</b></td><td> -<p>The maximum number of points within the outline.</p> +<p>The maximum number of points within the outline. Must be smaller than or equal to 0xFFFF (65535).</p> </td></tr> <tr valign=top><td><b>numContours</b></td><td> -<p>The maximum number of contours within the outline.</p> +<p>The maximum number of contours within the outline. This value must be in the range 0 to ‘numPoints’.</p> </td></tr> </table> </td></tr></table> diff --git a/freetype/docs/reference/ft2-pfr_fonts.html b/freetype/docs/reference/ft2-pfr_fonts.html index 4c1841526..d000b04c7 100644 --- a/freetype/docs/reference/ft2-pfr_fonts.html +++ b/freetype/docs/reference/ft2-pfr_fonts.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> PFR Fonts diff --git a/freetype/docs/reference/ft2-quick_advance.html b/freetype/docs/reference/ft2-quick_advance.html index 36677e384..1615aa4ac 100644 --- a/freetype/docs/reference/ft2-quick_advance.html +++ b/freetype/docs/reference/ft2-quick_advance.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Quick retrieval of advance values @@ -86,7 +86,7 @@ Defined in FT_ADVANCES_H (freetype/ftadvanc.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>Retrieve the advance value of a given glyph outline in an <a href="ft2-base_interface.html#FT_Face">FT_Face</a>. By default, the unhinted advance is returned in font units.</p> +<p>Retrieve the advance value of a given glyph outline in an <a href="ft2-base_interface.html#FT_Face">FT_Face</a>.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> @@ -106,7 +106,7 @@ Defined in FT_ADVANCES_H (freetype/ftadvanc.h). <p></p> <table cellpadding=3 border=0> <tr valign=top><td><b>padvance</b></td><td> -<p>The advance value, in either font units or 16.16 format.</p> +<p>The advance value. If scaling is performed (based on the value of ‘load_flags’), the advance value is in 16.16 format. Otherwise, it is in font units.</p> <p>If <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_VERTICAL_LAYOUT</a> is set, this is the vertical advance corresponding to a vertical layout. Otherwise, it is the horizontal advance in a horizontal layout.</p> </td></tr> </table> @@ -140,7 +140,7 @@ Defined in FT_ADVANCES_H (freetype/ftadvanc.h). </pre></table><br> <table align=center width="87%"><tr><td> -<p>Retrieve the advance values of several glyph outlines in an <a href="ft2-base_interface.html#FT_Face">FT_Face</a>. By default, the unhinted advances are returned in font units.</p> +<p>Retrieve the advance values of several glyph outlines in an <a href="ft2-base_interface.html#FT_Face">FT_Face</a>.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> @@ -163,7 +163,8 @@ Defined in FT_ADVANCES_H (freetype/ftadvanc.h). <p></p> <table cellpadding=3 border=0> <tr valign=top><td><b>padvance</b></td><td> -<p>The advances, in either font units or 16.16 format. This array must contain at least ‘count’ elements.</p> +<p>The advance values. This array, to be provided by the caller, must contain at least ‘count’ elements.</p> +<p>If scaling is performed (based on the value of ‘load_flags’), the advance values are in 16.16 format. Otherwise, they are in font units.</p> <p>If <a href="ft2-base_interface.html#FT_LOAD_XXX">FT_LOAD_VERTICAL_LAYOUT</a> is set, these are the vertical advances corresponding to a vertical layout. Otherwise, they are the horizontal advances in a horizontal layout.</p> </td></tr> </table> diff --git a/freetype/docs/reference/ft2-raster.html b/freetype/docs/reference/ft2-raster.html index 06b654732..be8241e4c 100644 --- a/freetype/docs/reference/ft2-raster.html +++ b/freetype/docs/reference/ft2-raster.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Scanline Converter diff --git a/freetype/docs/reference/ft2-sfnt_names.html b/freetype/docs/reference/ft2-sfnt_names.html index 39a27418a..dbf23dba4 100644 --- a/freetype/docs/reference/ft2-sfnt_names.html +++ b/freetype/docs/reference/ft2-sfnt_names.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> SFNT Names diff --git a/freetype/docs/reference/ft2-sizes_management.html b/freetype/docs/reference/ft2-sizes_management.html index c11e8e875..60fdbe76c 100644 --- a/freetype/docs/reference/ft2-sizes_management.html +++ b/freetype/docs/reference/ft2-sizes_management.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Size Management diff --git a/freetype/docs/reference/ft2-system_interface.html b/freetype/docs/reference/ft2-system_interface.html index eebe91a63..b6a1e1329 100644 --- a/freetype/docs/reference/ft2-system_interface.html +++ b/freetype/docs/reference/ft2-system_interface.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> System Interface diff --git a/freetype/docs/reference/ft2-toc.html b/freetype/docs/reference/ft2-toc.html index d354b012d..461b37893 100644 --- a/freetype/docs/reference/ft2-toc.html +++ b/freetype/docs/reference/ft2-toc.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -34,7 +34,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1>Table of Contents</h1></center> <br><table align=center width="75%"><tr><td><h2>General Remarks</h2><ul class="empty"><li> @@ -125,12 +125,20 @@ </td></tr> </table> </li></ul></td></tr></table> -<br><table align=center width="75%"><tr><td><h2>The Auto-Hinter</h2><ul class="empty"><li> +<br><table align=center width="75%"><tr><td><h2>Controlling FreeType Modules</h2><ul class="empty"><li> <table cellpadding=5> <tr valign=top><td class="left"> <a href="ft2-auto_hinter.html">The auto-hinter</a></td><td> <p>Controlling the auto-hinting module.</p> </td></tr> +<tr valign=top><td class="left"> +<a href="ft2-cff_driver.html">The CFF driver</a></td><td> +<p>Controlling the CFF driver module.</p> +</td></tr> +<tr valign=top><td class="left"> +<a href="ft2-tt_driver.html">The TrueType driver</a></td><td> +<p>Controlling the TrueType driver module.</p> +</td></tr> </table> </li></ul></td></tr></table> <br><table align=center width="75%"><tr><td><h2>Cache Sub-System</h2><ul class="empty"><li> @@ -204,6 +212,10 @@ <p>An API to validate OpenType tables.</p> </td></tr> <tr valign=top><td class="left"> +<a href="ft2-incremental.html">Incremental Loading</a></td><td> +<p>Custom Glyph Loading.</p> +</td></tr> +<tr valign=top><td class="left"> <a href="ft2-truetype_engine.html">The TrueType Engine</a></td><td> <p>TrueType bytecode support.</p> </td></tr> @@ -211,10 +223,6 @@ <a href="ft2-gx_validation.html">TrueTypeGX/AAT Validation</a></td><td> <p>An API to validate TrueTypeGX/AAT tables.</p> </td></tr> -<tr valign=top><td class="left"> -<a href="ft2-incremental.html">Incremental Loading</a></td><td> -<p>Custom Glyph Loading.</p> -</td></tr> </table> </li></ul></td></tr></table> <br><table align=center width="75%"><tr><td><h2><a href="ft2-index.html">Global Index</a></h2><ul class="empty"><li></li></ul></td></tr></table> @@ -223,5 +231,5 @@ <td width="100%"></td> </tr></table> -<center><font size=-2>generated on Thu Dec 20 08:35:15 2012</font></center></body> +<center><font size=-2>generated on Wed Jun 19 23:29:20 2013</font></center></body> </html> diff --git a/freetype/docs/reference/ft2-truetype_engine.html b/freetype/docs/reference/ft2-truetype_engine.html index 088f0a621..315b216f5 100644 --- a/freetype/docs/reference/ft2-truetype_engine.html +++ b/freetype/docs/reference/ft2-truetype_engine.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> The TrueType Engine diff --git a/freetype/docs/reference/ft2-truetype_tables.html b/freetype/docs/reference/ft2-truetype_tables.html index 0ac0ae766..479b3a0c9 100644 --- a/freetype/docs/reference/ft2-truetype_tables.html +++ b/freetype/docs/reference/ft2-truetype_tables.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> TrueType Tables diff --git a/freetype/docs/reference/ft2-tt_driver.html b/freetype/docs/reference/ft2-tt_driver.html new file mode 100644 index 000000000..0bf393df2 --- /dev/null +++ b/freetype/docs/reference/ft2-tt_driver.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" +"http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>FreeType-2.5.0 API Reference</title> +<style type="text/css"> + body { font-family: Verdana, Geneva, Arial, Helvetica, serif; + color: #000000; + background: #FFFFFF; } + + p { text-align: justify; } + h1 { text-align: center; } + li { text-align: justify; } + td { padding: 0 0.5em 0 0.5em; } + td.left { padding: 0 0.5em 0 0.5em; + text-align: left; } + + a:link { color: #0000EF; } + a:visited { color: #51188E; } + a:hover { color: #FF0000; } + + span.keyword { font-family: monospace; + text-align: left; + white-space: pre; + color: darkblue; } + + pre.colored { color: blue; } + + ul.empty { list-style-type: none; } +</style> +</head> +<body> + +<table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> +<center><h1>FreeType-2.5.0 API Reference</h1></center> + +<center><h1> +The TrueType driver +</h1></center> +<h2>Synopsis</h2> +<table align=center cellspacing=5 cellpadding=0 border=0> +<tr><td></td><td><a href="#interpreter-version">interpreter-version</a></td><td></td><td><a href="#TT_INTERPRETER_VERSION_XXX">TT_INTERPRETER_VERSION_XXX</a></td></tr> +</table><br><br> + +<table align=center width="87%"><tr><td> +<p>While FreeType's TrueType driver doesn't expose API functions by itself, it is possible to control its behaviour with <a href="ft2-module_management.html#FT_Property_Set">FT_Property_Set</a> and <a href="ft2-module_management.html#FT_Property_Get">FT_Property_Get</a>. The following lists the available properties together with the necessary macros and structures.</p> +<p>The TrueType driver's module name is ‘truetype’.</p> +</td></tr></table><br> +<table align=center width="75%"><tr><td> +<h4><a name="interpreter-version">interpreter-version</a></h4> +<table align=center width="87%"><tr><td> +<p>Currently, two versions are available which represent the bytecode interpreter with and without subpixel hinting support, respectively. The default is subpixel support if TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel support otherwise (since it isn't available then).</p> +<p>If subpixel hinting is on, many TrueType bytecode instructions behave differently compared to B/W or grayscale rendering. The main idea is to render at a much increased horizontal resolution, then sampling down the created output to subpixel precision. However, many older fonts are not suited to this and must be specially taken care of by applying (hardcoded) font-specific tweaks.</p> +<p>Details on subpixel hinting and some of the necessary tweaks can be found in Greg Hitchcock's whitepaper at ‘http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx’.</p> +<p>The following example code demonstrates how to activate subpixel hinting (omitting the error handling).</p> +<pre class="colored"> + FT_Library library; + FT_Face face; + FT_UInt interpreter_version = TT_INTERPRETER_VERSION_38; + + + FT_Init_FreeType( &library ); + + FT_Property_Set( library, "truetype", + "interpreter-version", + &interpreter_version ); +</pre> +</td></tr></table><br> +<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> +<p>This property can be used with <a href="ft2-module_management.html#FT_Property_Get">FT_Property_Get</a> also.</p> +</td></tr></table> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + +<table align=center width="75%"><tr><td> +<h4><a name="TT_INTERPRETER_VERSION_XXX">TT_INTERPRETER_VERSION_XXX</a></h4> +<table align=center width="87%"><tr><td> +Defined in FT_TRUETYPE_DRIVER_H (freetype/ftttdrv.h). +</td></tr></table><br> +<table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> + +#define <a href="ft2-tt_driver.html#TT_INTERPRETER_VERSION_XXX">TT_INTERPRETER_VERSION_35</a> 35 +#define <a href="ft2-tt_driver.html#TT_INTERPRETER_VERSION_XXX">TT_INTERPRETER_VERSION_38</a> 38 + +</pre></table><br> +<table align=center width="87%"><tr><td> +<p>A list of constants used for the <a href="ft2-tt_driver.html#interpreter-version">interpreter-version</a> property to select the hinting engine for Truetype fonts.</p> +<p>The numeric value in the constant names represents the version number as returned by the ‘GETINFO’ bytecode instruction.</p> +</td></tr></table><br> +<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>values</b></em></td></tr><tr><td> +<p></p> +<table cellpadding=3 border=0> +<tr valign=top><td colspan=0><b>TT_INTERPRETER_VERSION_35</b></td></tr> +<tr valign=top><td></td><td> +<p>Version 35 corresponds to MS rasterizer v.1.7 as used e.g. in Windows 98; only grayscale and B/W rasterizing is supported.</p> +</td></tr> +<tr valign=top><td colspan=0><b>TT_INTERPRETER_VERSION_38</b></td></tr> +<tr valign=top><td></td><td> +<p>Version 38 corresponds to MS rasterizer v.1.9; it is roughly equivalent to the hinting provided by DirectWrite ClearType (as can be found, for example, in the Internet Explorer 9 running on Windows 7).</p> +</td></tr> +</table> +</td></tr></table> +<table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> +<p>This property controls the behaviour of the bytecode interpreter and thus how outlines get hinted. It does <b>not</b> control how glyph get rasterized! In particular, it does not control subpixel color filtering.</p> +<p>If FreeType has not been compiled with configuration option FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version 38 causes an ‘FT_Err_Unimplemented_Feature’ error.</p> +</td></tr></table> +</td></tr></table> +<hr width="75%"> +<table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> +<td width="100%"></td> +<td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> + +</body> +</html> diff --git a/freetype/docs/reference/ft2-type1_tables.html b/freetype/docs/reference/ft2-type1_tables.html index 481a4574f..63b6dee1a 100644 --- a/freetype/docs/reference/ft2-type1_tables.html +++ b/freetype/docs/reference/ft2-type1_tables.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Type 1 Tables diff --git a/freetype/docs/reference/ft2-user_allocation.html b/freetype/docs/reference/ft2-user_allocation.html index 2a0580582..fb0cf5efc 100644 --- a/freetype/docs/reference/ft2-user_allocation.html +++ b/freetype/docs/reference/ft2-user_allocation.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> User allocation diff --git a/freetype/docs/reference/ft2-version.html b/freetype/docs/reference/ft2-version.html index 981f0c4b8..ea580ade7 100644 --- a/freetype/docs/reference/ft2-version.html +++ b/freetype/docs/reference/ft2-version.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> FreeType Version @@ -57,8 +57,8 @@ Defined in FT_FREETYPE_H (freetype/freetype.h). <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> #define <a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MAJOR</a> 2 -#define <a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MINOR</a> 4 -#define <a href="ft2-version.html#FREETYPE_XXX">FREETYPE_PATCH</a> 11 +#define <a href="ft2-version.html#FREETYPE_XXX">FREETYPE_MINOR</a> 5 +#define <a href="ft2-version.html#FREETYPE_XXX">FREETYPE_PATCH</a> 0 </pre></table><br> <table align=center width="87%"><tr><td> diff --git a/freetype/docs/reference/ft2-winfnt_fonts.html b/freetype/docs/reference/ft2-winfnt_fonts.html index 04ef19cc2..1d314ffe5 100644 --- a/freetype/docs/reference/ft2-winfnt_fonts.html +++ b/freetype/docs/reference/ft2-winfnt_fonts.html @@ -3,7 +3,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>FreeType-2.4.11 API Reference</title> +<title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; @@ -35,7 +35,7 @@ <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> -<center><h1>FreeType-2.4.11 API Reference</h1></center> +<center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> Window FNT Files diff --git a/freetype/include/freetype/config/ftconfig.h b/freetype/include/freetype/config/ftconfig.h index 4502fd83d..5dce30ef3 100644 --- a/freetype/include/freetype/config/ftconfig.h +++ b/freetype/include/freetype/config/ftconfig.h @@ -4,7 +4,7 @@ /* */ /* ANSI-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2004, 2006-2008, 2010-2011 by */ +/* Copyright 1996-2004, 2006-2008, 2010-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -200,6 +200,30 @@ FT_BEGIN_HEADER /* */ typedef unsigned XXX FT_UInt32; + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_Int64 */ + /* */ + /* A typedef for a 64bit signed integer type. The size depends on */ + /* the configuration. Only defined if there is real 64bit support; */ + /* otherwise, it gets emulated with a structure (if necessary). */ + /* */ + typedef signed XXX FT_Int64; + + + /*************************************************************************/ + /* */ + /* <Type> */ + /* FT_UInt64 */ + /* */ + /* A typedef for a 64bit unsigned integer type. The size depends on */ + /* the configuration. Only defined if there is real 64bit support; */ + /* otherwise, it gets emulated with a structure (if necessary). */ + /* */ + typedef unsigned XXX FT_UInt64; + /* */ #endif @@ -239,13 +263,15 @@ FT_BEGIN_HEADER /* FT_LONG64 must be defined if a 64-bit type is available */ #define FT_LONG64 -#define FT_INT64 long +#define FT_INT64 long +#define FT_UINT64 unsigned long #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ /* this compiler provides the __int64 type */ #define FT_LONG64 -#define FT_INT64 __int64 +#define FT_INT64 __int64 +#define FT_UINT64 unsigned __int64 #elif defined( __BORLANDC__ ) /* Borland C++ */ @@ -254,7 +280,8 @@ FT_BEGIN_HEADER /* this compiler provides the __int64 type */ #define FT_LONG64 -#define FT_INT64 __int64 +#define FT_INT64 __int64 +#define FT_UINT64 unsigned __int64 #elif defined( __WATCOMC__ ) /* Watcom C++ */ @@ -263,13 +290,15 @@ FT_BEGIN_HEADER #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ #define FT_LONG64 -#define FT_INT64 long long int +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int #elif defined( __GNUC__ ) /* GCC provides the `long long' type */ #define FT_LONG64 -#define FT_INT64 long long int +#define FT_INT64 long long int +#define FT_UINT64 unsigned long long int #endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */ @@ -293,6 +322,11 @@ FT_BEGIN_HEADER #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ +#ifdef FT_LONG64 + typedef FT_INT64 FT_Int64; + typedef FT_UINT64 FT_UInt64; +#endif + #define FT_BEGIN_STMNT do { #define FT_END_STMNT } while ( 0 ) diff --git a/freetype/include/freetype/config/ftheader.h b/freetype/include/freetype/config/ftheader.h index 33d6b4054..8371a3161 100644 --- a/freetype/include/freetype/config/ftheader.h +++ b/freetype/include/freetype/config/ftheader.h @@ -4,7 +4,7 @@ /* */ /* Build macros of the FreeType 2 library. */ /* */ -/* Copyright 1996-2008, 2010, 2012 by */ +/* Copyright 1996-2008, 2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -331,6 +331,32 @@ /************************************************************************* * * @macro: + * FT_CFF_DRIVER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the CFF driver module. + * + */ +#define FT_CFF_DRIVER_H <freetype/ftcffdrv.h> + + + /************************************************************************* + * + * @macro: + * FT_TRUETYPE_DRIVER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the TrueType driver module. + * + */ +#define FT_TRUETYPE_DRIVER_H <freetype/ftttdrv.h> + + + /************************************************************************* + * + * @macro: * FT_TYPE1_TABLES_H * * @description: diff --git a/freetype/include/freetype/config/ftoption.h b/freetype/include/freetype/config/ftoption.h index a73fff455..0883c69e4 100644 --- a/freetype/include/freetype/config/ftoption.h +++ b/freetype/include/freetype/config/ftoption.h @@ -4,7 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -216,6 +216,20 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ + /* PNG bitmap support. */ + /* */ + /* FreeType now handles loading color bitmap glyphs in the PNG format. */ + /* This requires help from the external libpng library. Uncompressed */ + /* color bitmaps do not need any external libraries and will be */ + /* supported regardless of this configuration. */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +/* #define FT_CONFIG_OPTION_USE_PNG */ + + + /*************************************************************************/ + /* */ /* DLL export compilation */ /* */ /* When compiling FreeType as a DLL, some systems/compilers need a */ @@ -738,6 +752,25 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ /**** ****/ + /**** C F F D R I V E R C O N F I G U R A T I O N ****/ + /**** ****/ + /*************************************************************************/ + /*************************************************************************/ + + + /*************************************************************************/ + /* */ + /* CFF_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe CFF */ + /* engine gets compiled into FreeType. If defined, it is possible to */ + /* switch between the two engines using the `hinting-engine' property of */ + /* the cff driver module. */ + /* */ +/* #define CFF_CONFIG_OPTION_OLD_ENGINE */ + + + /*************************************************************************/ + /*************************************************************************/ + /**** ****/ /**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/ /**** ****/ /*************************************************************************/ @@ -774,37 +807,10 @@ FT_BEGIN_HEADER /* - * Define this variable if you want to keep the layout of internal - * structures that was used prior to FreeType 2.2. This also compiles in - * a few obsolete functions to avoid linking problems on typical Unix - * distributions. - * - * For embedded systems or building a new distribution from scratch, it - * is recommended to disable the macro since it reduces the library's code - * size and activates a few memory-saving optimizations as well. + * This macro is obsolete. Support has been removed in FreeType + * version 2.5. */ -#define FT_CONFIG_OPTION_OLD_INTERNALS - - - /* - * To detect legacy cache-lookup call from a rogue client (<= 2.1.7), - * we restrict the number of charmaps in a font. The current API of - * FTC_CMapCache_Lookup() takes cmap_index & charcode, but old API - * takes charcode only. To determine the passed value is for cmap_index - * or charcode, the possible cmap_index is restricted not to exceed - * the minimum possible charcode by a rogue client. It is also very - * unlikely that a rogue client is interested in Unicode values 0 to 15. - * - * NOTE: The original threshold was 4 deduced from popular number of - * cmap subtables in UCS-4 TrueType fonts, but now it is not - * irregular for OpenType fonts to have more than 4 subtables, - * because variation selector subtables are available for Apple - * and Microsoft platforms. - */ - -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_MAX_CHARMAP_CACHEABLE 15 -#endif +/* #define FT_CONFIG_OPTION_OLD_INTERNALS */ /* diff --git a/freetype/include/freetype/freetype.h b/freetype/include/freetype/freetype.h index 8df4828f6..fe46d2297 100644 --- a/freetype/include/freetype/freetype.h +++ b/freetype/include/freetype/freetype.h @@ -4,7 +4,7 @@ /* */ /* FreeType high-level API and common types (specification only). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,8 +31,8 @@ #include <ft2build.h> #include FT_CONFIG_CONFIG_H -#include FT_ERRORS_H #include FT_TYPES_H +#include FT_ERRORS_H FT_BEGIN_HEADER @@ -329,12 +329,14 @@ FT_BEGIN_HEADER /* It also embeds a memory manager (see @FT_Memory), as well as a */ /* scan-line converter object (see @FT_Raster). */ /* */ - /* For multi-threading applications each thread should have its own */ - /* FT_Library object. */ + /* In multi-threaded applications, make sure that the same FT_Library */ + /* object or any of its children doesn't get accessed in parallel. */ /* */ /* <Note> */ /* Library objects are normally created by @FT_Init_FreeType, and */ - /* destroyed with @FT_Done_FreeType. */ + /* destroyed with @FT_Done_FreeType. If you need reference-counting */ + /* (cf. @FT_Reference_Library), use @FT_New_Library and */ + /* @FT_Done_Library. */ /* */ typedef struct FT_LibraryRec_ *FT_Library; @@ -875,12 +877,15 @@ FT_BEGIN_HEADER /* usually negative. Only relevant for */ /* scalable formats. */ /* */ - /* height :: The height is the vertical distance */ + /* height :: This value is the vertical distance */ /* between two consecutive baselines, */ /* expressed in font units. It is always */ /* positive. Only relevant for scalable */ /* formats. */ /* */ + /* If you want the global glyph height, use */ + /* `ascender - descender'. */ + /* */ /* max_advance_width :: The maximum advance width, in font units, */ /* for all glyphs in this face. This can be */ /* used to make word wrapping computations */ @@ -1675,6 +1680,9 @@ FT_BEGIN_HEADER /* For multi-threading applications each thread should have its own */ /* FT_Library object. */ /* */ + /* If you need reference-counting (cf. @FT_Reference_Library), use */ + /* @FT_New_Library and @FT_Done_Library. */ + /* */ FT_EXPORT( FT_Error ) FT_Init_FreeType( FT_Library *alibrary ); @@ -1869,6 +1877,10 @@ FT_BEGIN_HEADER /* <Return> */ /* FreeType error code. 0~means success. */ /* */ + /* <Note> */ + /* Use @FT_Done_Face to destroy the created @FT_Face object (along */ + /* with its slot and sizes). */ + /* */ FT_EXPORT( FT_Error ) FT_New_Face( FT_Library library, const char* filepathname, @@ -2431,7 +2443,7 @@ FT_BEGIN_HEADER * * If the font is `tricky' (see @FT_FACE_FLAG_TRICKY for more), using * FT_LOAD_NO_SCALE usually yields meaningless outlines because the - * subglyphs must be scaled and positioned with hinting instructions. + * subglyphs must be scaled and positioned with hinting instructions. * This can be solved by loading the font without FT_LOAD_NO_SCALE and * setting the character size to `font->units_per_EM'. * @@ -2520,6 +2532,14 @@ FT_BEGIN_HEADER * FT_LOAD_NO_AUTOHINT :: * Disable auto-hinter. See also the note below. * + * FT_LOAD_COLOR :: + * This flag is used to request loading of color embedded-bitmap + * images. The resulting color bitmaps, if available, will have the + * @FT_PIXEL_MODE_BGRA format. When the flag is not used and color + * bitmaps are found, they will be converted to 256-level gray + * bitmaps transparently. Those bitmaps will be in the + * @FT_PIXEL_MODE_GRAY format. + * * @note: * By default, hinting is enabled and the font's native hinter (see * @FT_FACE_FLAG_HINTER) is preferred over the auto-hinter. You can @@ -2557,6 +2577,8 @@ FT_BEGIN_HEADER #define FT_LOAD_MONOCHROME ( 1L << 12 ) #define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) #define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) + /* Bits 16..19 are used by `FT_LOAD_TARGET_' */ +#define FT_LOAD_COLOR ( 1L << 20 ) /* */ @@ -3695,7 +3717,7 @@ FT_BEGIN_HEADER /* <Description> */ /* A very simple function used to perform the computation */ /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */ - /* used to multiply a given value by a 16.16 fixed float factor. */ + /* used to multiply a given value by a 16.16 fixed-point factor. */ /* */ /* <Input> */ /* a :: The first multiplier. */ @@ -3740,7 +3762,7 @@ FT_BEGIN_HEADER /* <Description> */ /* A very simple function used to perform the computation */ /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */ - /* used to divide a given value by a 16.16 fixed float factor. */ + /* used to divide a given value by a 16.16 fixed-point factor. */ /* */ /* <Input> */ /* a :: The first multiplier. */ @@ -3878,8 +3900,8 @@ FT_BEGIN_HEADER * */ #define FREETYPE_MAJOR 2 -#define FREETYPE_MINOR 4 -#define FREETYPE_PATCH 11 +#define FREETYPE_MINOR 5 +#define FREETYPE_PATCH 0 /*************************************************************************/ diff --git a/freetype/include/freetype/ftadvanc.h b/freetype/include/freetype/ftadvanc.h index b2451bec4..012b74b81 100644 --- a/freetype/include/freetype/ftadvanc.h +++ b/freetype/include/freetype/ftadvanc.h @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (specification only). */ /* */ -/* Copyright 2008 by */ +/* Copyright 2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -82,8 +82,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* Retrieve the advance value of a given glyph outline in an */ - /* @FT_Face. By default, the unhinted advance is returned in font */ - /* units. */ + /* @FT_Face. */ /* */ /* <Input> */ /* face :: The source @FT_Face handle. */ @@ -94,8 +93,9 @@ FT_BEGIN_HEADER /* calling @FT_Load_Glyph, used to determine what kind */ /* of advances you need. */ /* <Output> */ - /* padvance :: The advance value, in either font units or 16.16 */ - /* format. */ + /* padvance :: The advance value. If scaling is performed (based on */ + /* the value of `load_flags'), the advance value is in */ + /* 16.16 format. Otherwise, it is in font units. */ /* */ /* If @FT_LOAD_VERTICAL_LAYOUT is set, this is the */ /* vertical advance corresponding to a vertical layout. */ @@ -127,8 +127,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* Retrieve the advance values of several glyph outlines in an */ - /* @FT_Face. By default, the unhinted advances are returned in font */ - /* units. */ + /* @FT_Face. */ /* */ /* <Input> */ /* face :: The source @FT_Face handle. */ @@ -141,8 +140,12 @@ FT_BEGIN_HEADER /* calling @FT_Load_Glyph. */ /* */ /* <Output> */ - /* padvance :: The advances, in either font units or 16.16 format. */ - /* This array must contain at least `count' elements. */ + /* padvance :: The advance values. This array, to be provided by the */ + /* caller, must contain at least `count' elements. */ + /* */ + /* If scaling is performed (based on the value of */ + /* `load_flags'), the advance values are in 16.16 format. */ + /* Otherwise, they are in font units. */ /* */ /* If @FT_LOAD_VERTICAL_LAYOUT is set, these are the */ /* vertical advances corresponding to a vertical layout. */ diff --git a/freetype/include/freetype/ftautoh.h b/freetype/include/freetype/ftautoh.h index b427c4dd0..5e1153a1c 100644 --- a/freetype/include/freetype/ftautoh.h +++ b/freetype/include/freetype/ftautoh.h @@ -4,7 +4,7 @@ /* */ /* FreeType API for controlling the auto-hinter (specification only). */ /* */ -/* Copyright 2012 by */ +/* Copyright 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,6 +61,8 @@ FT_BEGIN_HEADER * glyph-to-script-map * * @description: + * *Experimental* *only* + * * The auto-hinter provides various script modules to hint glyphs. * Examples of supported scripts are Latin or CJK. Before a glyph is * auto-hinted, the Unicode character map of the font gets examined, and @@ -113,6 +115,8 @@ FT_BEGIN_HEADER * FT_AUTOHINTER_SCRIPT_XXX * * @description: + * *Experimental* *only* + * * A list of constants used for the @glyph-to-script-map property to * specify the script submodule the auto-hinter should use for hinting a * particular glyph. @@ -216,7 +220,7 @@ FT_BEGIN_HEADER * U+1900 - U+194F // Limbu * U+1B80 - U+1BBF // Sundanese * U+1C80 - U+1CDF // Meetei Mayak - * U+A800 - U+A82F // Syloti Nagri + * U+A800 - U+A82F // Syloti Nagri * U+11800 - U+118DF // Sharada * } * @@ -236,6 +240,8 @@ FT_BEGIN_HEADER * FT_Prop_GlyphToScriptMap * * @description: + * *Experimental* *only* + * * The data exchange structure for the @glyph-to-script-map property. * */ @@ -253,6 +259,8 @@ FT_BEGIN_HEADER * fallback-script * * @description: + * *Experimental* *only* + * * If no auto-hinter script module can be assigned to a glyph, a * fallback script gets assigned to it (see also the * @glyph-to-script-map property). By default, this is diff --git a/freetype/include/freetype/ftbitmap.h b/freetype/include/freetype/ftbitmap.h index 92742369b..7dbf5ba3f 100644 --- a/freetype/include/freetype/ftbitmap.h +++ b/freetype/include/freetype/ftbitmap.h @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (specification). */ /* */ -/* Copyright 2004, 2005, 2006, 2008 by */ +/* Copyright 2004-2006, 2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -135,9 +135,9 @@ FT_BEGIN_HEADER /* FT_Bitmap_Convert */ /* */ /* <Description> */ - /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a */ - /* bitmap object with depth 8bpp, making the number of used bytes per */ - /* line (a.k.a. the `pitch') a multiple of `alignment'. */ + /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp */ + /* to a bitmap object with depth 8bpp, making the number of used */ + /* bytes line (a.k.a. the `pitch') a multiple of `alignment'. */ /* */ /* <Input> */ /* library :: A handle to a library object. */ diff --git a/freetype/include/freetype/ftcache.h b/freetype/include/freetype/ftcache.h index 6af530622..4ec9587cf 100644 --- a/freetype/include/freetype/ftcache.h +++ b/freetype/include/freetype/ftcache.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache subsystem (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2008, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -214,17 +214,6 @@ FT_BEGIN_HEADER /* */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* these macros are incompatible with LLP64, should not be used */ - -#define FT_POINTER_TO_ULONG( p ) ( (FT_ULong)(FT_Pointer)(p) ) - -#define FTC_FACE_ID_HASH( i ) \ - ((FT_UInt32)(( FT_POINTER_TO_ULONG( i ) >> 3 ) ^ \ - ( FT_POINTER_TO_ULONG( i ) << 7 ) ) ) - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ /*************************************************************************/ /*************************************************************************/ @@ -381,7 +370,7 @@ FT_BEGIN_HEADER /* should never try to discard it yourself. */ /* */ /* The @FT_Face object doesn't necessarily have a current size object */ - /* (i.e., face->size can be 0). If you need a specific `font size', */ + /* (i.e., face->size can be~0). If you need a specific `font size', */ /* use @FTC_Manager_LookupSize instead. */ /* */ /* Never change the face's transformation matrix (i.e., never call */ @@ -705,17 +694,6 @@ FT_BEGIN_HEADER (d1)->width == (d2)->width && \ (d1)->flags == (d2)->flags ) -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* this macro is incompatible with LLP64, should not be used */ - -#define FTC_IMAGE_TYPE_HASH( d ) \ - (FT_UFast)( FTC_FACE_ID_HASH( (d)->face_id ) ^ \ - ( (d)->width << 8 ) ^ (d)->height ^ \ - ( (d)->flags << 4 ) ) - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - /*************************************************************************/ /* */ @@ -723,7 +701,7 @@ FT_BEGIN_HEADER /* FTC_ImageCache */ /* */ /* <Description> */ - /* A handle to an glyph image cache object. They are designed to */ + /* A handle to a glyph image cache object. They are designed to */ /* hold many distinct glyph images while not exceeding a certain */ /* memory threshold. */ /* */ @@ -1071,67 +1049,6 @@ FT_BEGIN_HEADER /* */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*@***********************************************************************/ - /* */ - /* <Struct> */ - /* FTC_FontRec */ - /* */ - /* <Description> */ - /* A simple structure used to describe a given `font' to the cache */ - /* manager. Note that a `font' is the combination of a given face */ - /* with a given character size. */ - /* */ - /* <Fields> */ - /* face_id :: The ID of the face to use. */ - /* */ - /* pix_width :: The character width in integer pixels. */ - /* */ - /* pix_height :: The character height in integer pixels. */ - /* */ - typedef struct FTC_FontRec_ - { - FTC_FaceID face_id; - FT_UShort pix_width; - FT_UShort pix_height; - - } FTC_FontRec; - - - /* */ - - -#define FTC_FONT_COMPARE( f1, f2 ) \ - ( (f1)->face_id == (f2)->face_id && \ - (f1)->pix_width == (f2)->pix_width && \ - (f1)->pix_height == (f2)->pix_height ) - - /* this macro is incompatible with LLP64, should not be used */ -#define FTC_FONT_HASH( f ) \ - (FT_UInt32)( FTC_FACE_ID_HASH((f)->face_id) ^ \ - ((f)->pix_width << 8) ^ \ - ((f)->pix_height) ) - - typedef FTC_FontRec* FTC_Font; - - - FT_EXPORT( FT_Error ) - FTC_Manager_Lookup_Face( FTC_Manager manager, - FTC_FaceID face_id, - FT_Face *aface ); - - FT_EXPORT( FT_Error ) - FTC_Manager_Lookup_Size( FTC_Manager manager, - FTC_Font font, - FT_Face *aface, - FT_Size *asize ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - - /* */ - FT_END_HEADER #endif /* __FTCACHE_H__ */ diff --git a/freetype/include/freetype/ftcffdrv.h b/freetype/include/freetype/ftcffdrv.h new file mode 100644 index 000000000..ccbcbccaa --- /dev/null +++ b/freetype/include/freetype/ftcffdrv.h @@ -0,0 +1,151 @@ +/***************************************************************************/ +/* */ +/* ftcffdrv.h */ +/* */ +/* FreeType API for controlling the CFF driver (specification only). */ +/* */ +/* Copyright 2013 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 __FTCFFDRV_H__ +#define __FTCFFDRV_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * cff_driver + * + * @title: + * The CFF driver + * + * @abstract: + * Controlling the CFF driver module. + * + * @description: + * While FreeType's CFF driver doesn't expose API functions by itself, + * it is possible to control its behaviour with @FT_Property_Set and + * @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * The CFF driver's module name is `cff'. + * + */ + + + /************************************************************************** + * + * @property: + * hinting-engine + * + * @description: + * Thanks to Adobe, which contributed a new hinting (and parsing) + * engine, an application can select between `freetype' and `adobe' if + * compiled with CFF_CONFIG_OPTION_OLD_ENGINE. If this configuration + * macro isn't defined, `hinting-engine' does nothing. + * + * The default engine is `freetype' if CFF_CONFIG_OPTION_OLD_ENGINE is + * defined, and `adobe' otherwise. + * + * The following example code demonstrates how to select Adobe's hinting + * engine (omitting the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_UInt hinting_engine = FT_CFF_HINTING_ADOBE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "hinting-engine", &hinting_engine ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /************************************************************************** + * + * @enum: + * FT_CFF_HINTING_XXX + * + * @description: + * A list of constants used for the @hinting-engine property to select + * the hinting engine for CFF fonts. + * + * @values: + * FT_CFF_HINTING_FREETYPE :: + * Use the old FreeType hinting engine. + * + * FT_CFF_HINTING_ADOBE :: + * Use the hinting engine contributed by Adobe. + * + */ +#define FT_CFF_HINTING_FREETYPE 0 +#define FT_CFF_HINTING_ADOBE 1 + + + /************************************************************************** + * + * @property: + * no-stem-darkening + * + * @description: + * By default, the Adobe CFF engine darkens stems at smaller sizes, + * regardless of hinting, to enhance contrast. Setting this property, + * stem darkening gets switched off. + * + * Note that stem darkening is never applied if @FT_LOAD_NO_SCALE is set. + * + * { + * FT_Library library; + * FT_Face face; + * FT_Bool no_stem_darkening = TRUE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "cff", + * "no-stem-darkening", &no_stem_darkening ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /* */ + +FT_END_HEADER + + +#endif /* __FTCFFDRV_H__ */ + + +/* END */ diff --git a/freetype/include/freetype/ftchapters.h b/freetype/include/freetype/ftchapters.h index 984eef372..c55670d1d 100644 --- a/freetype/include/freetype/ftchapters.h +++ b/freetype/include/freetype/ftchapters.h @@ -67,13 +67,15 @@ /***************************************************************************/ /* */ /* <Chapter> */ -/* auto_hinter */ +/* module_specific */ /* */ /* <Title> */ -/* The Auto-Hinter */ +/* Controlling FreeType Modules */ /* */ /* <Sections> */ /* auto_hinter */ +/* cff_driver */ +/* tt_driver */ /* */ /***************************************************************************/ diff --git a/freetype/include/freetype/fterrdef.h b/freetype/include/freetype/fterrdef.h index bb06d79e9..76c7b9e36 100644 --- a/freetype/include/freetype/fterrdef.h +++ b/freetype/include/freetype/fterrdef.h @@ -4,7 +4,7 @@ /* */ /* FreeType error codes (specification). */ /* */ -/* Copyright 2002, 2004, 2006, 2007, 2010-2012 by */ +/* Copyright 2002, 2004, 2006, 2007, 2010-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -217,6 +217,8 @@ "ignore" ) FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \ "no Unicode glyph name found" ) + FT_ERRORDEF_( Glyph_Too_Big, 0xA4, \ + "glyph to big for hinting" ) /* BDF errors */ diff --git a/freetype/include/freetype/fterrors.h b/freetype/include/freetype/fterrors.h index a54699f87..0fa3e4dce 100644 --- a/freetype/include/freetype/fterrors.h +++ b/freetype/include/freetype/fterrors.h @@ -4,7 +4,7 @@ /* */ /* FreeType error code handling (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2007 by */ +/* Copyright 1996-2002, 2004, 2007, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,9 +28,8 @@ /* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */ /* defined in ftoption.h in order to make the higher byte indicate */ /* the module where the error has happened (this is not compatible */ - /* with standard builds of FreeType 2). You can then use the macro */ - /* FT_ERROR_BASE macro to extract the generic error code from an */ - /* FT_Error value. */ + /* with standard builds of FreeType 2). See the file `ftmoderr.h' for */ + /* more details. */ /* */ /* */ /* II - Error Message strings */ @@ -101,12 +100,6 @@ #undef FT_NEED_EXTERN_C -#undef FT_ERR_XCAT -#undef FT_ERR_CAT - -#define FT_ERR_XCAT( x, y ) x ## y -#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) - /* FT_ERR_PREFIX is used as a prefix for error identifiers. */ /* By default, we use `FT_Err_'. */ @@ -150,11 +143,11 @@ /* this macro is used to define an error */ -#define FT_ERRORDEF_( e, v, s ) \ +#define FT_ERRORDEF_( e, v, s ) \ FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s ) /* this is only used for <module>_Err_Ok, which must be 0! */ -#define FT_NOERRORDEF_( e, v, s ) \ +#define FT_NOERRORDEF_( e, v, s ) \ FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s ) @@ -194,11 +187,9 @@ #undef FT_NEED_EXTERN_C #undef FT_ERR_BASE - /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ -#ifndef FT_KEEP_ERR_PREFIX + /* FT_ERR_PREFIX is needed internally */ +#ifndef FT2_BUILD_LIBRARY #undef FT_ERR_PREFIX -#else -#undef FT_KEEP_ERR_PREFIX #endif #endif /* __FTERRORS_H__ */ diff --git a/freetype/include/freetype/ftglyph.h b/freetype/include/freetype/ftglyph.h index 3de69f7ae..31dc33187 100644 --- a/freetype/include/freetype/ftglyph.h +++ b/freetype/include/freetype/ftglyph.h @@ -94,7 +94,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* The root glyph structure contains a given glyph image plus its */ - /* advance width in 16.16 fixed float format. */ + /* advance width in 16.16 fixed-point format. */ /* */ /* <Fields> */ /* library :: A handle to the FreeType library object. */ diff --git a/freetype/include/freetype/ftimage.h b/freetype/include/freetype/ftimage.h index 04b5e04f7..3b826b1d3 100644 --- a/freetype/include/freetype/ftimage.h +++ b/freetype/include/freetype/ftimage.h @@ -5,8 +5,7 @@ /* FreeType glyph image formats and default raster interface */ /* (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -54,7 +53,7 @@ FT_BEGIN_HEADER /* <Description> */ /* The type FT_Pos is used to store vectorial coordinates. Depending */ /* on the context, these can represent distances in integer font */ - /* units, or 16.16, or 26.6 fixed float pixel coordinates. */ + /* units, or 16.16, or 26.6 fixed-point pixel coordinates. */ /* */ typedef signed long FT_Pos; @@ -169,6 +168,15 @@ FT_BEGIN_HEADER /* times taller than the original glyph image. See also */ /* @FT_RENDER_MODE_LCD_V. */ /* */ + /* FT_PIXEL_MODE_BGRA :: */ + /* An image with four 8-bit channels per pixel, representing a */ + /* color image (such as emoticons) with alpha channel. For each */ + /* pixel, the format is BGRA, which means, the blue channel comes */ + /* first in memory. The color channels are pre-multiplied and in */ + /* the sRGB colorspace. For example, full red at half-translucent */ + /* opacity will be represented as `00,00,80,80', not `00,00,FF,80'. */ + /* See also @FT_LOAD_COLOR. */ + /* */ typedef enum FT_Pixel_Mode_ { FT_PIXEL_MODE_NONE = 0, @@ -178,6 +186,7 @@ FT_BEGIN_HEADER FT_PIXEL_MODE_GRAY4, FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V, + FT_PIXEL_MODE_BGRA, FT_PIXEL_MODE_MAX /* do not remove */ diff --git a/freetype/include/freetype/ftlcdfil.h b/freetype/include/freetype/ftlcdfil.h index 0b55ebee6..8b253f118 100644 --- a/freetype/include/freetype/ftlcdfil.h +++ b/freetype/include/freetype/ftlcdfil.h @@ -53,6 +53,44 @@ FT_BEGIN_HEADER * *not* implemented in default builds of the library. You need to * #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file * in order to activate it. + * + * FreeType generates alpha coverage maps, which are linear by nature. + * For instance, the value 0x80 in bitmap representation means that + * (within numerical precision) 0x80/0xff fraction of that pixel is + * covered by the glyph's outline. The blending function for placing + * text over a background is + * + * { + * dst = alpha * src + (1 - alpha) * dst , + * } + * + * which is known as OVER. However, when calculating the output of the + * OVER operator, the source colors should first be transformed to a + * linear color space, then alpha blended in that space, and transformed + * back to the output color space. + * + * When linear light blending is used, the default FIR5 filtering + * weights (as given by FT_LCD_FILTER_DEFAULT) are no longer optimal, as + * they have been designed for black on white rendering while lacking + * gamma correction. To preserve color neutrality, weights for a FIR5 + * filter should be chosen according to two free parameters `a' and `c', + * and the FIR weights should be + * + * { + * [a - c, a + c, 2 * a, a + c, a - c] . + * } + * + * This formula generates equal weights for all the color primaries + * across the filter kernel, which makes it colorless. One suggested + * set of weights is + * + * { + * [0x10, 0x50, 0x60, 0x50, 0x10] , + * } + * + * where `a' has value 0x30 and `b' value 0x20. The weights in filter + * may have a sum larger than 0x100, which increases coloration slightly + * but also improves contrast. */ diff --git a/freetype/include/freetype/ftmodapi.h b/freetype/include/freetype/ftmodapi.h index aedfc54df..8abffb558 100644 --- a/freetype/include/freetype/ftmodapi.h +++ b/freetype/include/freetype/ftmodapi.h @@ -4,7 +4,7 @@ /* */ /* FreeType modules public interface (specification). */ /* */ -/* Copyright 1996-2003, 2006, 2008-2010, 2012 by */ +/* Copyright 1996-2003, 2006, 2008-2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -322,14 +322,21 @@ FT_BEGIN_HEADER * FT_Property_Set( library, "foo", "bar", &bar ); * } * + * Note that the FreeType Cache sub-system doesn't recognize module + * property changes. To avoid glyph lookup confusion within the cache + * you should call @FTC_Manager_Reset to completely flush the cache if + * a module property gets changed after @FTC_Manager_New has been + * called. + * * It is not possible to set properties of the FreeType Cache - * sub-system with FT_Property_Set; use @FTC_Property_Set instead. + * sub-system itself with FT_Property_Set; use @FTC_Property_Set + * instead. * * @since: * 2.4.11 * */ - FT_Error + FT_EXPORT( FT_Error ) FT_Property_Set( FT_Library library, const FT_String* module_name, const FT_String* property_name, @@ -393,7 +400,7 @@ FT_BEGIN_HEADER * 2.4.11 * */ - FT_Error + FT_EXPORT( FT_Error ) FT_Property_Get( FT_Library library, const FT_String* module_name, const FT_String* property_name, diff --git a/freetype/include/freetype/ftmoderr.h b/freetype/include/freetype/ftmoderr.h index 1bf3b384a..5a27db151 100644 --- a/freetype/include/freetype/ftmoderr.h +++ b/freetype/include/freetype/ftmoderr.h @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2005, 2010 by */ +/* Copyright 2001-2005, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,17 +18,57 @@ /*************************************************************************/ /* */ - /* This file is used to define the FreeType module error offsets. */ + /* This file is used to define the FreeType module error codes. */ /* */ - /* The lower byte gives the error code, the higher byte gives the */ - /* module. The base module has error offset 0. For example, the error */ - /* `FT_Err_Invalid_File_Format' has value 0x003, the error */ - /* `TT_Err_Invalid_File_Format' has value 0x1103, the error */ - /* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */ + /* If the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in `ftoption.h' is */ + /* set, the lower byte of an error value identifies the error code as */ + /* usual. In addition, the higher byte identifies the module. For */ + /* example, the error `FT_Err_Invalid_File_Format' has value 0x0003, the */ + /* error `TT_Err_Invalid_File_Format' has value 0x1303, the error */ + /* `T1_Err_Invalid_File_Format' has value 0x1403, etc. */ + /* */ + /* Note that `FT_Err_Ok', `TT_Err_Ok', etc. are always equal to zero, */ + /* including the high byte. */ + /* */ + /* If FT_CONFIG_OPTION_USE_MODULE_ERRORS isn't set, the higher byte of */ + /* an error value is set to zero. */ + /* */ + /* To hide the various `XXX_Err_' prefixes in the source code, FreeType */ + /* provides some macros in `fttypes.h'. */ + /* */ + /* FT_ERR( err ) */ + /* Add current error module prefix (as defined with the */ + /* `FT_ERR_PREFIX' macro) to `err'. For example, in the BDF module */ + /* the line */ + /* */ + /* error = FT_ERR( Invalid_Outline ); */ + /* */ + /* expands to */ + /* */ + /* error = BDF_Err_Invalid_Outline; */ + /* */ + /* For simplicity, you can always use `FT_Err_Ok' directly instead */ + /* of `FT_ERR( Ok )'. */ + /* */ + /* FT_ERR_EQ( errcode, err ) */ + /* FT_ERR_NEQ( errcode, err ) */ + /* Compare error code `errcode' with the error `err' for equality */ + /* and inequality, respectively. Example: */ + /* */ + /* if ( FT_ERR_EQ( error, Invalid_Outline ) ) */ + /* ... */ + /* */ + /* Using this macro you don't have to think about error prefixes. */ + /* Of course, if module errors are not active, the above example is */ + /* the same as */ + /* */ + /* if ( error == FT_Err_Invalid_Outline ) */ + /* ... */ + /* */ + /* FT_ERROR_BASE( errcode ) */ + /* FT_ERROR_MODULE( errcode ) */ + /* Get base error and module error code, respectively. */ /* */ - /* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */ - /* to make the higher byte always zero (disabling the module error */ - /* mechanism). */ /* */ /* It can also be used to create a module error message table easily */ /* with something like */ @@ -48,9 +88,6 @@ /* #include FT_MODULE_ERRORS_H */ /* } */ /* */ - /* To use such a table, all errors must be ANDed with 0xFF00 to remove */ - /* the error code. */ - /* */ /*************************************************************************/ @@ -124,6 +161,7 @@ FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) + FT_MODERRDEF( GXvalid, 0x1600, "GX validation module" ) #ifdef FT_MODERR_END_LIST diff --git a/freetype/include/freetype/ftoutln.h b/freetype/include/freetype/ftoutln.h index e733f391e..fd69f2829 100644 --- a/freetype/include/freetype/ftoutln.h +++ b/freetype/include/freetype/ftoutln.h @@ -126,8 +126,10 @@ FT_BEGIN_HEADER /* destroying the library, by @FT_Done_FreeType. */ /* */ /* numPoints :: The maximum number of points within the outline. */ + /* Must be smaller than or equal to 0xFFFF (65535). */ /* */ /* numContours :: The maximum number of contours within the outline. */ + /* This value must be in the range 0 to `numPoints'. */ /* */ /* <Output> */ /* anoutline :: A handle to the new outline. */ diff --git a/freetype/include/freetype/ftstroke.h b/freetype/include/freetype/ftstroke.h index c3eb85a67..a498e4a88 100644 --- a/freetype/include/freetype/ftstroke.h +++ b/freetype/include/freetype/ftstroke.h @@ -271,7 +271,7 @@ FT_BEGIN_HEADER * miter_limit :: * The miter limit for the FT_STROKER_LINEJOIN_MITER_FIXED and * FT_STROKER_LINEJOIN_MITER_VARIABLE line join styles, - * expressed as 16.16 fixed point value. + * expressed as 16.16 fixed-point value. * * @note: * The radius is expressed in the same units as the outline diff --git a/freetype/include/freetype/fttrigon.h b/freetype/include/freetype/fttrigon.h index 6b77d2ee5..65143cb8c 100644 --- a/freetype/include/freetype/fttrigon.h +++ b/freetype/include/freetype/fttrigon.h @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (specification). */ /* */ -/* Copyright 2001, 2003, 2005, 2007 by */ +/* Copyright 2001, 2003, 2005, 2007, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -46,7 +46,7 @@ FT_BEGIN_HEADER * * @description: * This type is used to model angle values in FreeType. Note that the - * angle is a 16.16 fixed float value expressed in degrees. + * angle is a 16.16 fixed-point value expressed in degrees. * */ typedef FT_Fixed FT_Angle; @@ -106,7 +106,7 @@ FT_BEGIN_HEADER * FT_Sin * * @description: - * Return the sinus of a given angle in fixed point format. + * Return the sinus of a given angle in fixed-point format. * * @input: * angle :: @@ -130,7 +130,7 @@ FT_BEGIN_HEADER * FT_Cos * * @description: - * Return the cosinus of a given angle in fixed point format. + * Return the cosinus of a given angle in fixed-point format. * * @input: * angle :: @@ -154,7 +154,7 @@ FT_BEGIN_HEADER * FT_Tan * * @description: - * Return the tangent of a given angle in fixed point format. + * Return the tangent of a given angle in fixed-point format. * * @input: * angle :: diff --git a/freetype/include/freetype/ftttdrv.h b/freetype/include/freetype/ftttdrv.h new file mode 100644 index 000000000..d5d3f1ccc --- /dev/null +++ b/freetype/include/freetype/ftttdrv.h @@ -0,0 +1,150 @@ +/***************************************************************************/ +/* */ +/* ftttdrv.h */ +/* */ +/* FreeType API for controlling the TrueType driver */ +/* (specification only). */ +/* */ +/* Copyright 2013 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 __FTTTDRV_H__ +#define __FTTTDRV_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + +#ifdef FREETYPE_H +#error "freetype.h of FreeType 1 has been loaded!" +#error "Please fix the directory search order for header files" +#error "so that freetype.h of FreeType 2 is found first." +#endif + + +FT_BEGIN_HEADER + + + /************************************************************************** + * + * @section: + * tt_driver + * + * @title: + * The TrueType driver + * + * @abstract: + * Controlling the TrueType driver module. + * + * @description: + * While FreeType's TrueType driver doesn't expose API functions by + * itself, it is possible to control its behaviour with @FT_Property_Set + * and @FT_Property_Get. The following lists the available properties + * together with the necessary macros and structures. + * + * The TrueType driver's module name is `truetype'. + * + */ + + + /************************************************************************** + * + * @property: + * interpreter-version + * + * @description: + * Currently, two versions are available which represent the bytecode + * interpreter with and without subpixel hinting support, + * respectively. The default is subpixel support if + * TT_CONFIG_OPTION_SUBPIXEL_HINTING is defined, and no subpixel + * support otherwise (since it isn't available then). + * + * If subpixel hinting is on, many TrueType bytecode instructions + * behave differently compared to B/W or grayscale rendering. The + * main idea is to render at a much increased horizontal resolution, + * then sampling down the created output to subpixel precision. + * However, many older fonts are not suited to this and must be + * specially taken care of by applying (hardcoded) font-specific + * tweaks. + * + * Details on subpixel hinting and some of the necessary tweaks can be + * found in Greg Hitchcock's whitepaper at + * `http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx'. + * + * The following example code demonstrates how to activate subpixel + * hinting (omitting the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_UInt interpreter_version = TT_INTERPRETER_VERSION_38; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "truetype", + * "interpreter-version", + * &interpreter_version ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + */ + + + /************************************************************************** + * + * @enum: + * TT_INTERPRETER_VERSION_XXX + * + * @description: + * A list of constants used for the @interpreter-version property to + * select the hinting engine for Truetype fonts. + * + * The numeric value in the constant names represents the version + * number as returned by the `GETINFO' bytecode instruction. + * + * @values: + * TT_INTERPRETER_VERSION_35 :: + * Version~35 corresponds to MS rasterizer v.1.7 as used e.g. in + * Windows~98; only grayscale and B/W rasterizing is supported. + * + * TT_INTERPRETER_VERSION_38 :: + * Version~38 corresponds to MS rasterizer v.1.9; it is roughly + * equivalent to the hinting provided by DirectWrite ClearType (as + * can be found, for example, in the Internet Explorer~9 running on + * Windows~7). + * + * @note: + * This property controls the behaviour of the bytecode interpreter + * and thus how outlines get hinted. It does *not* control how glyph + * get rasterized! In particular, it does not control subpixel color + * filtering. + * + * If FreeType has not been compiled with configuration option + * FT_CONFIG_OPTION_SUBPIXEL_HINTING, selecting version~38 causes an + * `FT_Err_Unimplemented_Feature' error. + * + */ +#define TT_INTERPRETER_VERSION_35 35 +#define TT_INTERPRETER_VERSION_38 38 + + + /* */ + +FT_END_HEADER + + +#endif /* __FTTTDRV_H__ */ + + +/* END */ diff --git a/freetype/include/freetype/fttypes.h b/freetype/include/freetype/fttypes.h index 325552744..027e59ce1 100644 --- a/freetype/include/freetype/fttypes.h +++ b/freetype/include/freetype/fttypes.h @@ -4,7 +4,7 @@ /* */ /* FreeType simple types definitions (specification only). */ /* */ -/* Copyright 1996-2002, 2004, 2006-2009, 2012 by */ +/* Copyright 1996-2002, 2004, 2006-2009, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -255,7 +255,7 @@ FT_BEGIN_HEADER /* FT_F2Dot14 */ /* */ /* <Description> */ - /* A signed 2.14 fixed float type used for unit vectors. */ + /* A signed 2.14 fixed-point type used for unit vectors. */ /* */ typedef signed short FT_F2Dot14; @@ -266,7 +266,7 @@ FT_BEGIN_HEADER /* FT_F26Dot6 */ /* */ /* <Description> */ - /* A signed 26.6 fixed float type used for vectorial pixel */ + /* A signed 26.6 fixed-point type used for vectorial pixel */ /* coordinates. */ /* */ typedef signed long FT_F26Dot6; @@ -278,7 +278,7 @@ FT_BEGIN_HEADER /* FT_Fixed */ /* */ /* <Description> */ - /* This type is used to store 16.16 fixed float values, like scaling */ + /* This type is used to store 16.16 fixed-point values, like scaling */ /* values or matrix coefficients. */ /* */ typedef signed long FT_Fixed; @@ -362,7 +362,7 @@ FT_BEGIN_HEADER /* */ /* <Description> */ /* A simple structure used to store a 2x2 matrix. Coefficients are */ - /* in 16.16 fixed float format. The computation performed is: */ + /* in 16.16 fixed-point format. The computation performed is: */ /* */ /* { */ /* x' = x*xx + y*xy */ @@ -571,14 +571,24 @@ FT_BEGIN_HEADER /* */ #define FT_IS_EMPTY( list ) ( (list).head == 0 ) +#define FT_BOOL( x ) ( (FT_Bool)( x ) ) - /* return base error code (without module-specific prefix) */ -#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) + /* concatenate C tokens */ +#define FT_ERR_XCAT( x, y ) x ## y +#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) + + /* see `ftmoderr.h' for descriptions of the following macros */ + +#define FT_ERR( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) - /* return module error code */ +#define FT_ERROR_BASE( x ) ( (x) & 0xFF ) #define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U ) -#define FT_BOOL( x ) ( (FT_Bool)( x ) ) +#define FT_ERR_EQ( x, e ) \ + ( FT_ERROR_BASE( x ) == FT_ERROR_BASE( FT_ERR( e ) ) ) +#define FT_ERR_NEQ( x, e ) \ + ( FT_ERROR_BASE( x ) != FT_ERROR_BASE( FT_ERR( e ) ) ) + FT_END_HEADER diff --git a/freetype/include/freetype/internal/ftcalc.h b/freetype/include/freetype/internal/ftcalc.h index a6a5e05f6..faac3a386 100644 --- a/freetype/include/freetype/internal/ftcalc.h +++ b/freetype/include/freetype/internal/ftcalc.h @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (specification). */ /* */ -/* Copyright 1996-2006, 2008, 2009, 2012 by */ +/* Copyright 1996-2006, 2008, 2009, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,7 +33,7 @@ FT_BEGIN_HEADER /* FT_FixedSqrt */ /* */ /* <Description> */ - /* Computes the square root of a 16.16 fixed point value. */ + /* Computes the square root of a 16.16 fixed-point value. */ /* */ /* <Input> */ /* x :: The value to compute the root for. */ @@ -48,29 +48,6 @@ FT_BEGIN_HEADER FT_SqrtFixed( FT_Int32 x ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <Function> */ - /* FT_Sqrt32 */ - /* */ - /* <Description> */ - /* Computes the square root of an Int32 integer (which will be */ - /* handled as an unsigned long value). */ - /* */ - /* <Input> */ - /* x :: The value to compute the root for. */ - /* */ - /* <Return> */ - /* The result of `sqrt(x)'. */ - /* */ - FT_EXPORT( FT_Int32 ) - FT_Sqrt32( FT_Int32 x ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */ @@ -125,7 +102,6 @@ FT_BEGIN_HEADER * A variant of FT_Vector_Transform. See comments for * FT_Matrix_Multiply_Scaled. */ - FT_BASE( void ) FT_Vector_Transform_Scaled( FT_Vector* vector, const FT_Matrix* matrix, @@ -156,6 +132,22 @@ FT_BEGIN_HEADER FT_Pos out_y ); + /* + * Return the most significant bit index. + */ + FT_BASE( FT_Int ) + FT_MSB( FT_UInt32 z ); + + + /* + * Return sqrt(x*x+y*y), which is the same as `FT_Vector_Length' but uses + * two fixed-point arguments instead. + */ + FT_BASE( FT_Fixed ) + FT_Hypot( FT_Fixed x, + FT_Fixed y ); + + #define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 ) #define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 ) #define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 ) diff --git a/freetype/include/freetype/internal/ftdebug.h b/freetype/include/freetype/internal/ftdebug.h index 7baae3531..58a3916d7 100644 --- a/freetype/include/freetype/internal/ftdebug.h +++ b/freetype/include/freetype/internal/ftdebug.h @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008, 2009 by */ +/* Copyright 1996-2002, 2004, 2006-2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -185,7 +185,8 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ - /* Define the FT_ASSERT macro. */ + /* Define the FT_ASSERT and FT_THROW macros. The call to `FT_Throw' */ + /* makes it possible to easily set a breakpoint at this function. */ /* */ /*************************************************************************/ @@ -199,10 +200,18 @@ FT_BEGIN_HEADER __LINE__, __FILE__ ); \ } while ( 0 ) +#define FT_THROW( e ) \ + ( FT_Throw( FT_ERR_CAT( FT_ERR_PREFIX, e ), \ + __LINE__, \ + __FILE__ ) | \ + FT_ERR_CAT( FT_ERR_PREFIX, e ) ) + #else /* !FT_DEBUG_LEVEL_ERROR */ #define FT_ASSERT( condition ) do { } while ( 0 ) +#define FT_THROW( e ) FT_ERR_CAT( FT_ERR_PREFIX, e ) + #endif /* !FT_DEBUG_LEVEL_ERROR */ @@ -226,22 +235,18 @@ FT_BEGIN_HEADER FT_Panic( const char* fmt, ... ); + /* report file name and line number of an error */ + FT_BASE( int ) + FT_Throw( FT_Error error, + int line, + const char* file ); + #endif /* FT_DEBUG_LEVEL_ERROR */ FT_BASE( void ) ft_debug_init( void ); - -#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ - - /* We disable the warning `conditional expression is constant' here */ - /* in order to compile cleanly with the maximum level of warnings. */ -#pragma warning( disable : 4127 ) - -#endif /* _MSC_VER */ - - FT_END_HEADER #endif /* __FTDEBUG_H__ */ diff --git a/freetype/include/freetype/internal/ftdriver.h b/freetype/include/freetype/internal/ftdriver.h index 093b14b4f..940218e62 100644 --- a/freetype/include/freetype/internal/ftdriver.h +++ b/freetype/include/freetype/internal/ftdriver.h @@ -4,7 +4,7 @@ /* */ /* FreeType font driver interface (specification). */ /* */ -/* Copyright 1996-2003, 2006, 2008, 2011-2012 by */ +/* Copyright 1996-2003, 2006, 2008, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -60,22 +60,6 @@ FT_BEGIN_HEADER (*FT_Size_SelectFunc)( FT_Size size, FT_ULong size_index ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - typedef FT_Error - (*FT_Size_ResetPointsFunc)( FT_Size size, - FT_F26Dot6 char_width, - FT_F26Dot6 char_height, - FT_UInt horz_resolution, - FT_UInt vert_resolution ); - - typedef FT_Error - (*FT_Size_ResetPixelsFunc)( FT_Size size, - FT_UInt pixel_width, - FT_UInt pixel_height ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - typedef FT_Error (*FT_Slot_LoadFunc)( FT_GlyphSlot slot, FT_Size size, @@ -196,13 +180,6 @@ FT_BEGIN_HEADER FT_Slot_InitFunc init_slot; FT_Slot_DoneFunc done_slot; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_Size_ResetPointsFunc set_char_sizes; - FT_Size_ResetPixelsFunc set_pixel_sizes; - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - FT_Slot_LoadFunc load_glyph; FT_Face_GetKerningFunc get_kerning; @@ -216,30 +193,6 @@ FT_BEGIN_HEADER } FT_Driver_ClassRec, *FT_Driver_Class; - /* - * The following functions are used as stubs for `set_char_sizes' and - * `set_pixel_sizes'; the code uses `request_size' and `select_size' - * functions instead. - * - * Implementation is in `src/base/ftobjs.c'. - */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_BASE( FT_Error ) - ft_stub_set_char_sizes( FT_Size size, - FT_F26Dot6 width, - FT_F26Dot6 height, - FT_UInt horz_res, - FT_UInt vert_res ); - - FT_BASE( FT_Error ) - ft_stub_set_pixel_sizes( FT_Size size, - FT_UInt width, - FT_UInt height ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* <Macro> */ @@ -279,94 +232,74 @@ FT_BEGIN_HEADER /* */ #ifndef FT_CONFIG_OPTION_PIC -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) \ - a_, b_, -#else -#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) /* empty */ -#endif - #define FT_DECLARE_DRIVER( class_ ) \ - FT_CALLBACK_TABLE \ + FT_CALLBACK_TABLE \ const FT_Driver_ClassRec class_; -#define FT_DEFINE_DRIVER( \ - class_, \ - flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_, \ - face_object_size_, \ - size_object_size_, \ - slot_object_size_, \ - init_face_, \ - done_face_, \ - init_size_, \ - done_size_, \ - init_slot_, \ - done_slot_, \ - old_set_char_sizes_, \ - old_set_pixel_sizes_, \ - load_glyph_, \ - get_kerning_, \ - attach_file_, \ - get_advances_, \ - request_size_, \ - select_size_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Driver_ClassRec class_ = \ - { \ - FT_DEFINE_ROOT_MODULE( flags_, \ - size_, \ - name_, \ - version_, \ - requires_, \ - interface_, \ - init_, \ - done_, \ - get_interface_ ) \ - \ - face_object_size_, \ - size_object_size_, \ - slot_object_size_, \ - \ - init_face_, \ - done_face_, \ - \ - init_size_, \ - done_size_, \ - \ - init_slot_, \ - done_slot_, \ - \ - FT_DEFINE_DRIVERS_OLD_INTERNALS( old_set_char_sizes_, \ - old_set_pixel_sizes_ ) \ - \ - load_glyph_, \ - \ - get_kerning_, \ - attach_file_, \ - get_advances_, \ - \ - request_size_, \ - select_size_ \ +#define FT_DEFINE_DRIVER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + face_object_size_, \ + size_object_size_, \ + slot_object_size_, \ + init_face_, \ + done_face_, \ + init_size_, \ + done_size_, \ + init_slot_, \ + done_slot_, \ + load_glyph_, \ + get_kerning_, \ + attach_file_, \ + get_advances_, \ + request_size_, \ + select_size_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Driver_ClassRec class_ = \ + { \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + \ + face_object_size_, \ + size_object_size_, \ + slot_object_size_, \ + \ + init_face_, \ + done_face_, \ + \ + init_size_, \ + done_size_, \ + \ + init_slot_, \ + done_slot_, \ + \ + load_glyph_, \ + \ + get_kerning_, \ + attach_file_, \ + get_advances_, \ + \ + request_size_, \ + select_size_ \ }; #else /* FT_CONFIG_OPTION_PIC */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) \ - clazz->set_char_sizes = a_; \ - clazz->set_pixel_sizes = b_; -#else -#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) /* empty */ -#endif - #define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( class_ ) #define FT_DEFINE_DRIVER( \ @@ -389,8 +322,6 @@ FT_BEGIN_HEADER done_size_, \ init_slot_, \ done_slot_, \ - old_set_char_sizes_, \ - old_set_pixel_sizes_, \ load_glyph_, \ get_kerning_, \ attach_file_, \ @@ -453,9 +384,6 @@ FT_BEGIN_HEADER clazz->init_slot = init_slot_; \ clazz->done_slot = done_slot_; \ \ - FT_DEFINE_DRIVERS_OLD_INTERNALS( old_set_char_sizes_, \ - old_set_pixel_sizes_ ) \ - \ clazz->load_glyph = load_glyph_; \ \ clazz->get_kerning = get_kerning_; \ diff --git a/freetype/include/freetype/internal/ftmemory.h b/freetype/include/freetype/internal/ftmemory.h index 026aa63ea..3d51aeec6 100644 --- a/freetype/include/freetype/internal/ftmemory.h +++ b/freetype/include/freetype/internal/ftmemory.h @@ -4,7 +4,7 @@ /* */ /* The FreeType memory management macros (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2010 by */ +/* Copyright 1996-2002, 2004-2007, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -141,8 +141,10 @@ FT_BEGIN_HEADER const void* P ); -#define FT_MEM_ALLOC( ptr, size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, (size), &error ) ) +#define FT_MEM_ALLOC( ptr, size ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \ + (FT_Long)(size), \ + &error ) ) #define FT_MEM_FREE( ptr ) \ FT_BEGIN_STMNT \ @@ -154,45 +156,60 @@ FT_BEGIN_HEADER FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) ) #define FT_MEM_REALLOC( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, 1, \ - (cursz), (newsz), \ - (ptr), &error ) ) - -#define FT_MEM_QALLOC( ptr, size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, (size), &error ) ) + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + 1, \ + (FT_Long)(cursz), \ + (FT_Long)(newsz), \ + (ptr), \ + &error ) ) + +#define FT_MEM_QALLOC( ptr, size ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \ + (FT_Long)(size), \ + &error ) ) #define FT_MEM_QNEW( ptr ) \ FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) ) -#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, 1, \ - (cursz), (newsz), \ - (ptr), &error ) ) - -#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \ - (cursz), (newsz), \ - (ptr), &error ) ) - -#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (item_size), \ - 0, (count), \ - NULL, &error ) ) - -#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (itmsz), \ - (oldcnt), (newcnt), \ - (ptr), &error ) ) - -#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (item_size), \ - 0, (count), \ - NULL, &error ) ) - -#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (itmsz), \ - (oldcnt), (newcnt), \ - (ptr), &error ) ) +#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + 1, \ + (FT_Long)(cursz), \ + (FT_Long)(newsz), \ + (ptr), \ + &error ) ) + +#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + (FT_Long)(item_size), \ + 0, \ + (FT_Long)(count), \ + NULL, \ + &error ) ) + +#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + (FT_Long)(itmsz), \ + (FT_Long)(oldcnt), \ + (FT_Long)(newcnt), \ + (ptr), \ + &error ) ) + +#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + (FT_Long)(item_size), \ + 0, \ + (FT_Long)(count), \ + NULL, \ + &error ) ) + +#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + (FT_Long)(itmsz), \ + (FT_Long)(oldcnt), \ + (FT_Long)(newcnt), \ + (ptr), \ + &error ) ) #define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 ) @@ -236,26 +253,37 @@ FT_BEGIN_HEADER /* _typed_ in order to automatically compute array element sizes. */ /* */ -#define FT_MEM_NEW_ARRAY( ptr, count ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \ - 0, (count), \ - NULL, &error ) ) - -#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \ - (cursz), (newsz), \ - (ptr), &error ) ) - -#define FT_MEM_QNEW_ARRAY( ptr, count ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \ - 0, (count), \ - NULL, &error ) ) - -#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \ - FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \ - (cursz), (newsz), \ - (ptr), &error ) ) - +#define FT_MEM_NEW_ARRAY( ptr, count ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + sizeof ( *(ptr) ), \ + 0, \ + (FT_Long)(count), \ + NULL, \ + &error ) ) + +#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \ + sizeof ( *(ptr) ), \ + (FT_Long)(cursz), \ + (FT_Long)(newsz), \ + (ptr), \ + &error ) ) + +#define FT_MEM_QNEW_ARRAY( ptr, count ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + sizeof ( *(ptr) ), \ + 0, \ + (FT_Long)(count), \ + NULL, \ + &error ) ) + +#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \ + FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \ + sizeof ( *(ptr) ), \ + (FT_Long)(cursz), \ + (FT_Long)(newsz), \ + (ptr), \ + &error ) ) #define FT_ALLOC( ptr, size ) \ FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) ) @@ -303,37 +331,6 @@ FT_BEGIN_HEADER FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) ) -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - 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 ); - - 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 ); - - FT_BASE( void ) - FT_Free( FT_Memory memory, - void* *P ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - FT_BASE( FT_Pointer ) ft_mem_strdup( FT_Memory memory, const char* str, @@ -345,6 +342,7 @@ FT_BEGIN_HEADER FT_ULong size, FT_Error *p_error ); + #define FT_MEM_STRDUP( dst, str ) \ (dst) = (char*)ft_mem_strdup( memory, (const char*)(str), &error ) diff --git a/freetype/include/freetype/internal/ftobjs.h b/freetype/include/freetype/internal/ftobjs.h index 28132a4a1..701c850eb 100644 --- a/freetype/include/freetype/internal/ftobjs.h +++ b/freetype/include/freetype/internal/ftobjs.h @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2006, 2008, 2010, 2012 by */ +/* Copyright 1996-2006, 2008, 2010, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -352,10 +352,6 @@ FT_BEGIN_HEADER /* */ typedef struct FT_Face_InternalRec_ { -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_UShort reserved1; - FT_Short reserved2; -#endif FT_Matrix transform_matrix; FT_Vector transform_delta; FT_Int transform_flags; @@ -367,7 +363,7 @@ FT_BEGIN_HEADER #endif FT_Bool ignore_unpatented_hinter; - FT_UInt refcount; + FT_Int refcount; } FT_Face_InternalRec; @@ -887,7 +883,7 @@ FT_BEGIN_HEADER FT_PIC_Container pic_container; #endif - FT_UInt refcount; + FT_Int refcount; } FT_LibraryRec; diff --git a/freetype/include/freetype/internal/ftserv.h b/freetype/include/freetype/internal/ftserv.h index 1d4ded54f..cd5fbd0fa 100644 --- a/freetype/include/freetype/internal/ftserv.h +++ b/freetype/include/freetype/internal/ftserv.h @@ -4,7 +4,7 @@ /* */ /* The FreeType services (specification only). */ /* */ -/* Copyright 2003-2007, 2009, 2012 by */ +/* Copyright 2003-2007, 2009, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -34,14 +34,6 @@ FT_BEGIN_HEADER -#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ - - /* we disable the warning `conditional expression is constant' here */ - /* in order to compile cleanly with the maximum level of warnings */ -#pragma warning( disable : 4127 ) - -#endif /* _MSC_VER */ - /* * @macro: * FT_FACE_FIND_SERVICE @@ -174,6 +166,7 @@ FT_BEGIN_HEADER /* FT_DEFINE_SERVICEDESCREC4 */ /* FT_DEFINE_SERVICEDESCREC5 */ /* FT_DEFINE_SERVICEDESCREC6 */ + /* FT_DEFINE_SERVICEDESCREC7 */ /* */ /* <Description> */ /* Used to initialize an array of FT_ServiceDescRec structures. */ @@ -270,6 +263,26 @@ FT_BEGIN_HEADER { NULL, NULL } \ }; +#define FT_DEFINE_SERVICEDESCREC7( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { serv_id_4, serv_data_4 }, \ + { serv_id_5, serv_data_5 }, \ + { serv_id_6, serv_data_6 }, \ + { serv_id_7, serv_data_7 }, \ + { NULL, NULL } \ + }; + #else /* FT_CONFIG_OPTION_PIC */ #define FT_DEFINE_SERVICEDESCREC1( class_, \ @@ -527,6 +540,59 @@ FT_BEGIN_HEADER return FT_Err_Ok; \ } +#define FT_DEFINE_SERVICEDESCREC7( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6, \ + serv_id_7, serv_data_7 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 8 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = serv_id_3; \ + clazz[2].serv_data = serv_data_3; \ + clazz[3].serv_id = serv_id_4; \ + clazz[3].serv_data = serv_data_4; \ + clazz[4].serv_id = serv_id_5; \ + clazz[4].serv_data = serv_data_5; \ + clazz[5].serv_id = serv_id_6; \ + clazz[5].serv_data = serv_data_6; \ + clazz[6].serv_id = serv_id_7; \ + clazz[6].serv_data = serv_data_7; \ + clazz[7].serv_id = NULL; \ + clazz[7].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } + #endif /* FT_CONFIG_OPTION_PIC */ @@ -579,7 +645,9 @@ FT_BEGIN_HEADER /* * A magic number used within the services cache. */ -#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~1) /* magic number */ + + /* ensure that value `1' has the same width as a pointer */ +#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~(FT_PtrDist)1) /* diff --git a/freetype/include/freetype/internal/ftstream.h b/freetype/include/freetype/internal/ftstream.h index 8b185005f..266185832 100644 --- a/freetype/include/freetype/internal/ftstream.h +++ b/freetype/include/freetype/internal/ftstream.h @@ -4,7 +4,7 @@ /* */ /* Stream handling (specification). */ /* */ -/* Copyright 1996-2002, 2004-2006, 2011 by */ +/* Copyright 1996-2002, 2004-2006, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -154,67 +154,60 @@ FT_BEGIN_HEADER /* */ #define FT_BYTE_( p, i ) ( ((const FT_Byte*)(p))[(i)] ) -#define FT_INT8_( p, i ) ( ((const FT_Char*)(p))[(i)] ) #define FT_INT16( x ) ( (FT_Int16)(x) ) #define FT_UINT16( x ) ( (FT_UInt16)(x) ) #define FT_INT32( x ) ( (FT_Int32)(x) ) #define FT_UINT32( x ) ( (FT_UInt32)(x) ) -#define FT_BYTE_I16( p, i, s ) ( FT_INT16( FT_BYTE_( p, i ) ) << (s) ) + #define FT_BYTE_U16( p, i, s ) ( FT_UINT16( FT_BYTE_( p, i ) ) << (s) ) -#define FT_BYTE_I32( p, i, s ) ( FT_INT32( FT_BYTE_( p, i ) ) << (s) ) #define FT_BYTE_U32( p, i, s ) ( FT_UINT32( FT_BYTE_( p, i ) ) << (s) ) -#define FT_INT8_I16( p, i, s ) ( FT_INT16( FT_INT8_( p, i ) ) << (s) ) -#define FT_INT8_U16( p, i, s ) ( FT_UINT16( FT_INT8_( p, i ) ) << (s) ) -#define FT_INT8_I32( p, i, s ) ( FT_INT32( FT_INT8_( p, i ) ) << (s) ) -#define FT_INT8_U32( p, i, s ) ( FT_UINT32( FT_INT8_( p, i ) ) << (s) ) - -#define FT_PEEK_SHORT( p ) FT_INT16( FT_INT8_I16( p, 0, 8) | \ - FT_BYTE_I16( p, 1, 0) ) +#define FT_PEEK_SHORT( p ) FT_INT16( FT_BYTE_U16( p, 0, 8) | \ + FT_BYTE_U16( p, 1, 0) ) #define FT_PEEK_USHORT( p ) FT_UINT16( FT_BYTE_U16( p, 0, 8 ) | \ FT_BYTE_U16( p, 1, 0 ) ) -#define FT_PEEK_LONG( p ) FT_INT32( FT_INT8_I32( p, 0, 24 ) | \ - FT_BYTE_I32( p, 1, 16 ) | \ - FT_BYTE_I32( p, 2, 8 ) | \ - FT_BYTE_I32( p, 3, 0 ) ) +#define FT_PEEK_LONG( p ) FT_INT32( FT_BYTE_U32( p, 0, 24 ) | \ + FT_BYTE_U32( p, 1, 16 ) | \ + FT_BYTE_U32( p, 2, 8 ) | \ + FT_BYTE_U32( p, 3, 0 ) ) #define FT_PEEK_ULONG( p ) FT_UINT32( FT_BYTE_U32( p, 0, 24 ) | \ FT_BYTE_U32( p, 1, 16 ) | \ FT_BYTE_U32( p, 2, 8 ) | \ FT_BYTE_U32( p, 3, 0 ) ) -#define FT_PEEK_OFF3( p ) FT_INT32( FT_INT8_I32( p, 0, 16 ) | \ - FT_BYTE_I32( p, 1, 8 ) | \ - FT_BYTE_I32( p, 2, 0 ) ) +#define FT_PEEK_OFF3( p ) FT_INT32( FT_BYTE_U32( p, 0, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 2, 0 ) ) #define FT_PEEK_UOFF3( p ) FT_UINT32( FT_BYTE_U32( p, 0, 16 ) | \ FT_BYTE_U32( p, 1, 8 ) | \ FT_BYTE_U32( p, 2, 0 ) ) -#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_INT8_I16( p, 1, 8 ) | \ - FT_BYTE_I16( p, 0, 0 ) ) +#define FT_PEEK_SHORT_LE( p ) FT_INT16( FT_BYTE_U16( p, 1, 8 ) | \ + FT_BYTE_U16( p, 0, 0 ) ) #define FT_PEEK_USHORT_LE( p ) FT_UINT16( FT_BYTE_U16( p, 1, 8 ) | \ FT_BYTE_U16( p, 0, 0 ) ) -#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_INT8_I32( p, 3, 24 ) | \ - FT_BYTE_I32( p, 2, 16 ) | \ - FT_BYTE_I32( p, 1, 8 ) | \ - FT_BYTE_I32( p, 0, 0 ) ) +#define FT_PEEK_LONG_LE( p ) FT_INT32( FT_BYTE_U32( p, 3, 24 ) | \ + FT_BYTE_U32( p, 2, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 0, 0 ) ) #define FT_PEEK_ULONG_LE( p ) FT_UINT32( FT_BYTE_U32( p, 3, 24 ) | \ FT_BYTE_U32( p, 2, 16 ) | \ FT_BYTE_U32( p, 1, 8 ) | \ FT_BYTE_U32( p, 0, 0 ) ) -#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_INT8_I32( p, 2, 16 ) | \ - FT_BYTE_I32( p, 1, 8 ) | \ - FT_BYTE_I32( p, 0, 0 ) ) +#define FT_PEEK_OFF3_LE( p ) FT_INT32( FT_BYTE_U32( p, 2, 16 ) | \ + FT_BYTE_U32( p, 1, 8 ) | \ + FT_BYTE_U32( p, 0, 0 ) ) #define FT_PEEK_UOFF3_LE( p ) FT_UINT32( FT_BYTE_U32( p, 2, 16 ) | \ FT_BYTE_U32( p, 1, 8 ) | \ @@ -493,37 +486,41 @@ FT_BEGIN_HEADER #define FT_STREAM_POS() \ FT_Stream_Pos( stream ) -#define FT_STREAM_SEEK( position ) \ - FT_SET_ERROR( FT_Stream_Seek( stream, position ) ) +#define FT_STREAM_SEEK( position ) \ + FT_SET_ERROR( FT_Stream_Seek( stream, \ + (FT_ULong)(position) ) ) -#define FT_STREAM_SKIP( distance ) \ - FT_SET_ERROR( FT_Stream_Skip( stream, distance ) ) +#define FT_STREAM_SKIP( distance ) \ + FT_SET_ERROR( FT_Stream_Skip( stream, \ + (FT_Long)(distance) ) ) -#define FT_STREAM_READ( buffer, count ) \ - FT_SET_ERROR( FT_Stream_Read( stream, \ - (FT_Byte*)buffer, \ - count ) ) +#define FT_STREAM_READ( buffer, count ) \ + FT_SET_ERROR( FT_Stream_Read( stream, \ + (FT_Byte*)(buffer), \ + (FT_ULong)(count) ) ) -#define FT_STREAM_READ_AT( position, buffer, count ) \ - FT_SET_ERROR( FT_Stream_ReadAt( stream, \ - position, \ - (FT_Byte*)buffer, \ - count ) ) +#define FT_STREAM_READ_AT( position, buffer, count ) \ + FT_SET_ERROR( FT_Stream_ReadAt( stream, \ + (FT_ULong)(position), \ + (FT_Byte*)buffer, \ + (FT_ULong)(count) ) ) #define FT_STREAM_READ_FIELDS( fields, object ) \ FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) ) -#define FT_FRAME_ENTER( size ) \ - FT_SET_ERROR( \ - FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) ) +#define FT_FRAME_ENTER( size ) \ + FT_SET_ERROR( \ + FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, \ + (FT_ULong)(size) ) ) ) -#define FT_FRAME_EXIT() \ +#define FT_FRAME_EXIT() \ FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) ) #define FT_FRAME_EXTRACT( size, bytes ) \ FT_SET_ERROR( \ - FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \ + FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, \ + (FT_ULong)(size), \ (FT_Byte**)&(bytes) ) ) ) #define FT_FRAME_RELEASE( bytes ) \ diff --git a/freetype/include/freetype/internal/fttrace.h b/freetype/include/freetype/internal/fttrace.h index 6e6cb49fa..a9d98b60a 100644 --- a/freetype/include/freetype/internal/fttrace.h +++ b/freetype/include/freetype/internal/fttrace.h @@ -4,7 +4,7 @@ /* */ /* Tracing handling (specification only). */ /* */ -/* Copyright 2002, 2004-2007, 2009, 2011-2012 by */ +/* Copyright 2002, 2004-2007, 2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,6 +38,7 @@ 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) */ FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */ +FT_TRACE_DEF( bitmap ) /* bitmap checksum (ftobjs.c) */ /* Cache sub-system */ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ @@ -87,6 +88,10 @@ FT_TRACE_DEF( cffload ) FT_TRACE_DEF( cffobjs ) FT_TRACE_DEF( cffparse ) +FT_TRACE_DEF( cf2blues ) +FT_TRACE_DEF( cf2hints ) +FT_TRACE_DEF( cf2interp ) + /* Type 42 driver component */ FT_TRACE_DEF( t42 ) diff --git a/freetype/include/freetype/internal/ftvalid.h b/freetype/include/freetype/internal/ftvalid.h index 00cd85e7b..12ad03685 100644 --- a/freetype/include/freetype/internal/ftvalid.h +++ b/freetype/include/freetype/internal/ftvalid.h @@ -4,7 +4,7 @@ /* */ /* FreeType validation support (specification). */ /* */ -/* Copyright 2004 by */ +/* Copyright 2004, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -76,6 +76,14 @@ FT_BEGIN_HEADER } FT_ValidationLevel; +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + /* We disable the warning `structure was padded due to */ + /* __declspec(align())' in order to compile cleanly with */ + /* the maximum level of warnings. */ +#pragma warning( push ) +#pragma warning( disable : 4324 ) +#endif /* _MSC_VER */ + /* validator structure */ typedef struct FT_ValidatorRec_ { @@ -88,8 +96,11 @@ FT_BEGIN_HEADER } FT_ValidatorRec; +#if defined( _MSC_VER ) +#pragma warning( pop ) +#endif -#define FT_VALIDATOR( x ) ((FT_Validator)( x )) +#define FT_VALIDATOR( x ) ( (FT_Validator)( x ) ) FT_BASE( void ) diff --git a/freetype/include/freetype/internal/internal.h b/freetype/include/freetype/internal/internal.h index f500a651c..262afcfa8 100644 --- a/freetype/include/freetype/internal/internal.h +++ b/freetype/include/freetype/internal/internal.h @@ -4,7 +4,7 @@ /* */ /* Internal header files (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004 by */ +/* Copyright 1996-2004, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -48,4 +48,16 @@ #define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h> +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + + /* We disable the warning `conditional expression is constant' here */ + /* in order to compile cleanly with the maximum level of warnings. */ + /* In particular, the warning complains about stuff like `while(0)' */ + /* which is very useful in macro definitions. There is no benefit */ + /* in having it enabled. */ +#pragma warning( disable : 4127 ) + +#endif /* _MSC_VER */ + + /* END */ diff --git a/freetype/include/freetype/internal/psaux.h b/freetype/include/freetype/internal/psaux.h index a46cb6a3d..e903114f8 100644 --- a/freetype/include/freetype/internal/psaux.h +++ b/freetype/include/freetype/internal/psaux.h @@ -101,6 +101,9 @@ FT_BEGIN_HEADER /* capacity :: The current size of the heap block. Increments by */ /* 1kByte chunks. */ /* */ + /* init :: Set to 0xDEADBEEF if `elements' and `lengths' have */ + /* been allocated. */ + /* */ /* max_elems :: The maximum number of elements in table. */ /* */ /* num_elems :: The current number of elements in table. */ @@ -183,6 +186,7 @@ FT_BEGIN_HEADER T1_FIELD_TYPE_STRING, T1_FIELD_TYPE_KEY, T1_FIELD_TYPE_BBOX, + T1_FIELD_TYPE_MM_BBOX, T1_FIELD_TYPE_INTEGER_ARRAY, T1_FIELD_TYPE_FIXED_ARRAY, T1_FIELD_TYPE_CALLBACK, diff --git a/freetype/include/freetype/internal/sfnt.h b/freetype/include/freetype/internal/sfnt.h index aab4f8531..6b5e41f1a 100644 --- a/freetype/include/freetype/internal/sfnt.h +++ b/freetype/include/freetype/internal/sfnt.h @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2006, 2009, 2012 by */ +/* Copyright 1996-2006, 2009, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -125,77 +125,6 @@ FT_BEGIN_HEADER (*TT_Done_Face_Func)( TT_Face face ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_SFNT_HeaderRec_Func */ - /* */ - /* <Description> */ - /* Loads the header of a SFNT font file. Supports collections. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* face_index :: The index of the TrueType font, if we are opening a */ - /* collection. */ - /* */ - /* <Output> */ - /* sfnt :: The SFNT header. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The stream cursor must be at the font file's origin. */ - /* */ - /* This function recognizes fonts embedded in a `TrueType */ - /* collection'. */ - /* */ - /* This function checks that the header is valid by looking at the */ - /* values of `search_range', `entry_selector', and `range_shift'. */ - /* */ - typedef FT_Error - (*TT_Load_SFNT_HeaderRec_Func)( TT_Face face, - FT_Stream stream, - FT_Long face_index, - SFNT_Header sfnt ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Load_Directory_Func */ - /* */ - /* <Description> */ - /* Loads the table directory into a face object. */ - /* */ - /* <Input> */ - /* face :: A handle to the target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* sfnt :: The SFNT header. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The stream cursor must be on the first byte after the 4-byte font */ - /* format tag. This is the case just after a call to */ - /* TT_Load_Format_Tag(). */ - /* */ - typedef FT_Error - (*TT_Load_Directory_Func)( TT_Face face, - FT_Stream stream, - SFNT_Header sfnt ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* <FuncType> */ @@ -363,88 +292,6 @@ FT_BEGIN_HEADER TT_SBit_MetricsRec *ametrics ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_Set_SBit_Strike_OldFunc */ - /* */ - /* <Description> */ - /* Select an sbit strike for a given size request. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - /* req :: The size request. */ - /* */ - /* <Output> */ - /* astrike_index :: The index of the sbit strike. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. Returns an error if no */ - /* sbit strike exists for the selected ppem values. */ - /* */ - typedef FT_Error - (*TT_Set_SBit_Strike_OldFunc)( TT_Face face, - FT_UInt x_ppem, - FT_UInt y_ppem, - FT_ULong* astrike_index ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_CharMap_Load_Func */ - /* */ - /* <Description> */ - /* Loads a given TrueType character map into memory. */ - /* */ - /* <Input> */ - /* face :: A handle to the parent face object. */ - /* */ - /* stream :: A handle to the current stream object. */ - /* */ - /* <InOut> */ - /* cmap :: A pointer to a cmap object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The function assumes that the stream is already in use (i.e., */ - /* opened). In case of error, all partially allocated tables are */ - /* released. */ - /* */ - typedef FT_Error - (*TT_CharMap_Load_Func)( TT_Face face, - void* cmap, - FT_Stream input ); - - - /*************************************************************************/ - /* */ - /* <FuncType> */ - /* TT_CharMap_Free_Func */ - /* */ - /* <Description> */ - /* Destroys a character mapping table. */ - /* */ - /* <Input> */ - /* face :: A handle to the parent face object. */ - /* */ - /* cmap :: A handle to a cmap object. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - typedef FT_Error - (*TT_CharMap_Free_Func)( TT_Face face, - void* cmap ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* <FuncType> */ @@ -657,11 +504,6 @@ FT_BEGIN_HEADER TT_Load_Any_Func load_any; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_Load_SFNT_HeaderRec_Func load_sfnt_header; - TT_Load_Directory_Func load_directory; -#endif - /* these functions are called by `load_face' but they can also */ /* be called from external modules, if there is a need to do so */ TT_Load_Table_Func load_head; @@ -674,12 +516,6 @@ FT_BEGIN_HEADER TT_Load_Table_Func load_name; TT_Free_Table_Func free_name; - /* optional tables */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_Load_Table_Func load_hdmx_stub; - TT_Free_Table_Func free_hdmx_stub; -#endif - /* this field was called `load_kerning' up to version 2.1.10 */ TT_Load_Table_Func load_kern; @@ -690,43 +526,12 @@ FT_BEGIN_HEADER /* version 2.1.10 */ TT_Load_Table_Func load_bhed; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* see `ttsbit.h' */ - TT_Set_SBit_Strike_OldFunc set_sbit_strike_stub; - TT_Load_Table_Func load_sbits_stub; - - /* - * The following two fields appeared in version 2.1.8, and were placed - * between `load_sbits' and `load_sbit_image'. We support them as a - * special exception since they are used by Xfont library within the - * X.Org xserver, and because the probability that other rogue clients - * use the other version 2.1.7 fields below is _extremely_ low. - * - * Note that this forces us to disable an interesting memory-saving - * optimization though... - */ - - TT_Find_SBit_Image_Func find_sbit_image; - TT_Load_SBit_Metrics_Func load_sbit_metrics; - -#endif - TT_Load_SBit_Image_Func load_sbit_image; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_Free_Table_Func free_sbits_stub; -#endif - /* see `ttpost.h' */ TT_Get_PS_Name_Func get_psname; TT_Free_Table_Func free_psnames; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_CharMap_Load_Func load_charmap_stub; - TT_CharMap_Free_Func free_charmap_stub; -#endif - /* starting here, the structure differs from version 2.1.7 */ /* this field was introduced in version 2.1.8, named `get_psname' */ @@ -755,213 +560,141 @@ FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a ) \ - a, -#else -#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a ) /* empty */ -#endif - -#define FT_INTERNAL( a ) \ - a, - -#define FT_DEFINE_SFNT_INTERFACE( \ - class_, \ - goto_table_, \ - init_face_, \ - load_face_, \ - done_face_, \ - get_interface_, \ - load_any_, \ - load_sfnt_header_, \ - load_directory_, \ - load_head_, \ - load_hhea_, \ - load_cmap_, \ - load_maxp_, \ - load_os2_, \ - load_post_, \ - load_name_, \ - free_name_, \ - load_hdmx_stub_, \ - free_hdmx_stub_, \ - load_kern_, \ - load_gasp_, \ - load_pclt_, \ - load_bhed_, \ - set_sbit_strike_stub_, \ - load_sbits_stub_, \ - find_sbit_image_, \ - load_sbit_metrics_, \ - load_sbit_image_, \ - free_sbits_stub_, \ - get_psname_, \ - free_psnames_, \ - load_charmap_stub_, \ - free_charmap_stub_, \ - get_kerning_, \ - load_font_dir_, \ - load_hmtx_, \ - load_eblc_, \ - free_eblc_, \ - set_sbit_strike_, \ - load_strike_metrics_, \ - get_metrics_ ) \ - static const SFNT_Interface class_ = \ - { \ - FT_INTERNAL( goto_table_ ) \ - FT_INTERNAL( init_face_ ) \ - FT_INTERNAL( load_face_ ) \ - FT_INTERNAL( done_face_ ) \ - FT_INTERNAL( get_interface_ ) \ - FT_INTERNAL( load_any_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sfnt_header_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_directory_ ) \ - FT_INTERNAL( load_head_ ) \ - FT_INTERNAL( load_hhea_ ) \ - FT_INTERNAL( load_cmap_ ) \ - FT_INTERNAL( load_maxp_ ) \ - FT_INTERNAL( load_os2_ ) \ - FT_INTERNAL( load_post_ ) \ - FT_INTERNAL( load_name_ ) \ - FT_INTERNAL( free_name_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_hdmx_stub_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( free_hdmx_stub_ ) \ - FT_INTERNAL( load_kern_ ) \ - FT_INTERNAL( load_gasp_ ) \ - FT_INTERNAL( load_pclt_ ) \ - FT_INTERNAL( load_bhed_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( set_sbit_strike_stub_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbits_stub_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( find_sbit_image_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbit_metrics_ ) \ - FT_INTERNAL( load_sbit_image_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( free_sbits_stub_ ) \ - FT_INTERNAL( get_psname_ ) \ - FT_INTERNAL( free_psnames_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_charmap_stub_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( free_charmap_stub_ ) \ - FT_INTERNAL( get_kerning_ ) \ - FT_INTERNAL( load_font_dir_ ) \ - FT_INTERNAL( load_hmtx_ ) \ - FT_INTERNAL( load_eblc_ ) \ - FT_INTERNAL( free_eblc_ ) \ - FT_INTERNAL( set_sbit_strike_ ) \ - FT_INTERNAL( load_strike_metrics_ ) \ - FT_INTERNAL( get_metrics_ ) \ +#define FT_DEFINE_SFNT_INTERFACE( \ + class_, \ + goto_table_, \ + init_face_, \ + load_face_, \ + done_face_, \ + get_interface_, \ + load_any_, \ + load_head_, \ + load_hhea_, \ + load_cmap_, \ + load_maxp_, \ + load_os2_, \ + load_post_, \ + load_name_, \ + free_name_, \ + load_kern_, \ + load_gasp_, \ + load_pclt_, \ + load_bhed_, \ + load_sbit_image_, \ + get_psname_, \ + free_psnames_, \ + get_kerning_, \ + load_font_dir_, \ + load_hmtx_, \ + load_eblc_, \ + free_eblc_, \ + set_sbit_strike_, \ + load_strike_metrics_, \ + get_metrics_ ) \ + static const SFNT_Interface class_ = \ + { \ + goto_table_, \ + init_face_, \ + load_face_, \ + done_face_, \ + get_interface_, \ + load_any_, \ + load_head_, \ + load_hhea_, \ + load_cmap_, \ + load_maxp_, \ + load_os2_, \ + load_post_, \ + load_name_, \ + free_name_, \ + load_kern_, \ + load_gasp_, \ + load_pclt_, \ + load_bhed_, \ + load_sbit_image_, \ + get_psname_, \ + free_psnames_, \ + get_kerning_, \ + load_font_dir_, \ + load_hmtx_, \ + load_eblc_, \ + free_eblc_, \ + set_sbit_strike_, \ + load_strike_metrics_, \ + get_metrics_, \ }; #else /* FT_CONFIG_OPTION_PIC */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ ) \ - clazz->a = a_; -#else -#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ ) /* empty */ -#endif - #define FT_INTERNAL( a, a_ ) \ clazz->a = a_; -#define FT_DEFINE_SFNT_INTERFACE( \ - class_, \ - goto_table_, \ - init_face_, \ - load_face_, \ - done_face_, \ - get_interface_, \ - load_any_, \ - load_sfnt_header_, \ - load_directory_, \ - load_head_, \ - load_hhea_, \ - load_cmap_, \ - load_maxp_, \ - load_os2_, \ - load_post_, \ - load_name_, \ - free_name_, \ - load_hdmx_stub_, \ - free_hdmx_stub_, \ - load_kern_, \ - load_gasp_, \ - load_pclt_, \ - load_bhed_, \ - set_sbit_strike_stub_, \ - load_sbits_stub_, \ - find_sbit_image_, \ - load_sbit_metrics_, \ - load_sbit_image_, \ - free_sbits_stub_, \ - get_psname_, \ - free_psnames_, \ - load_charmap_stub_, \ - free_charmap_stub_, \ - get_kerning_, \ - load_font_dir_, \ - load_hmtx_, \ - load_eblc_, \ - free_eblc_, \ - set_sbit_strike_, \ - load_strike_metrics_, \ - get_metrics_ ) \ - void \ - FT_Init_Class_ ## class_( FT_Library library, \ - SFNT_Interface* clazz ) \ - { \ - FT_UNUSED( library ); \ - \ - FT_INTERNAL( goto_table, goto_table_ ) \ - FT_INTERNAL( init_face, init_face_ ) \ - FT_INTERNAL( load_face, load_face_ ) \ - FT_INTERNAL( done_face, done_face_ ) \ - FT_INTERNAL( get_interface, get_interface_ ) \ - FT_INTERNAL( load_any, load_any_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sfnt_header, \ - load_sfnt_header_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_directory, \ - load_directory_ ) \ - FT_INTERNAL( load_head, load_head_ ) \ - FT_INTERNAL( load_hhea, load_hhea_ ) \ - FT_INTERNAL( load_cmap, load_cmap_ ) \ - FT_INTERNAL( load_maxp, load_maxp_ ) \ - FT_INTERNAL( load_os2, load_os2_ ) \ - FT_INTERNAL( load_post, load_post_ ) \ - FT_INTERNAL( load_name, load_name_ ) \ - FT_INTERNAL( free_name, free_name_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_hdmx_stub, \ - load_hdmx_stub_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( free_hdmx_stub, \ - free_hdmx_stub_ ) \ - FT_INTERNAL( load_kern, load_kern_ ) \ - FT_INTERNAL( load_gasp, load_gasp_ ) \ - FT_INTERNAL( load_pclt, load_pclt_ ) \ - FT_INTERNAL( load_bhed, load_bhed_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( set_sbit_strike_stub, \ - set_sbit_strike_stub_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbits_stub, \ - load_sbits_stub_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( find_sbit_image, \ - find_sbit_image_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_sbit_metrics, \ - load_sbit_metrics_ ) \ - FT_INTERNAL( load_sbit_image, load_sbit_image_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( free_sbits_stub, \ - free_sbits_stub_ ) \ - FT_INTERNAL( get_psname, get_psname_ ) \ - FT_INTERNAL( free_psnames, free_psnames_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( load_charmap_stub, \ - load_charmap_stub_ ) \ - FT_DEFINE_DRIVERS_OLD_INTERNAL( free_charmap_stub, \ - free_charmap_stub_ ) \ - FT_INTERNAL( get_kerning, get_kerning_ ) \ - FT_INTERNAL( load_font_dir, load_font_dir_ ) \ - FT_INTERNAL( load_hmtx, load_hmtx_ ) \ - FT_INTERNAL( load_eblc, load_eblc_ ) \ - FT_INTERNAL( free_eblc, free_eblc_ ) \ - FT_INTERNAL( set_sbit_strike, set_sbit_strike_ ) \ - FT_INTERNAL( load_strike_metrics, load_strike_metrics_ ) \ - FT_INTERNAL( get_metrics, get_metrics_ ) \ +#define FT_DEFINE_SFNT_INTERFACE( \ + class_, \ + goto_table_, \ + init_face_, \ + load_face_, \ + done_face_, \ + get_interface_, \ + load_any_, \ + load_head_, \ + load_hhea_, \ + load_cmap_, \ + load_maxp_, \ + load_os2_, \ + load_post_, \ + load_name_, \ + free_name_, \ + load_kern_, \ + load_gasp_, \ + load_pclt_, \ + load_bhed_, \ + load_sbit_image_, \ + get_psname_, \ + free_psnames_, \ + get_kerning_, \ + load_font_dir_, \ + load_hmtx_, \ + load_eblc_, \ + free_eblc_, \ + set_sbit_strike_, \ + load_strike_metrics_, \ + get_metrics_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + SFNT_Interface* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->goto_table = goto_table_; \ + clazz->init_face = init_face_; \ + clazz->load_face = load_face_; \ + clazz->done_face = done_face_; \ + clazz->get_interface = get_interface_; \ + clazz->load_any = load_any_; \ + clazz->load_head = load_head_; \ + clazz->load_hhea = load_hhea_; \ + clazz->load_cmap = load_cmap_; \ + clazz->load_maxp = load_maxp_; \ + clazz->load_os2 = load_os2_; \ + clazz->load_post = load_post_; \ + clazz->load_name = load_name_; \ + clazz->free_name = free_name_; \ + clazz->load_kern = load_kern_; \ + clazz->load_gasp = load_gasp_; \ + clazz->load_pclt = load_pclt_; \ + clazz->load_bhed = load_bhed_; \ + clazz->load_sbit_image = load_sbit_image_; \ + clazz->get_psname = get_psname_; \ + clazz->free_psnames = free_psnames_; \ + clazz->get_kerning = get_kerning_; \ + clazz->load_font_dir = load_font_dir_; \ + clazz->load_hmtx = load_hmtx_; \ + clazz->load_eblc = load_eblc_; \ + clazz->free_eblc = free_eblc_; \ + clazz->set_sbit_strike = set_sbit_strike_; \ + clazz->load_strike_metrics = load_strike_metrics_; \ + clazz->get_metrics = get_metrics_; \ } #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/freetype/include/freetype/internal/t1types.h b/freetype/include/freetype/internal/t1types.h index f859de273..e20237c14 100644 --- a/freetype/include/freetype/internal/t1types.h +++ b/freetype/include/freetype/internal/t1types.h @@ -5,7 +5,7 @@ /* Basic Type1/Type2 type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -205,10 +205,6 @@ FT_BEGIN_HEADER FT_CharMapRec charmaprecs[2]; FT_CharMap charmaps[2]; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - PS_Unicodes unicode_map; -#endif - /* support for Multiple Masters fonts */ PS_Blend blend; diff --git a/freetype/include/freetype/internal/tttypes.h b/freetype/include/freetype/internal/tttypes.h index 5eee3cd6c..1bbfe499c 100644 --- a/freetype/include/freetype/internal/tttypes.h +++ b/freetype/include/freetype/internal/tttypes.h @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2002, 2004-2008, 2012 by */ +/* Copyright 1996-2002, 2004-2008, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -311,87 +311,6 @@ FT_BEGIN_HEADER } TT_GaspRec; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_HdmxEntryRec */ - /* */ - /* <Description> */ - /* A small structure used to model the pre-computed widths of a given */ - /* size. They are found in the `hdmx' table. */ - /* */ - /* <Fields> */ - /* ppem :: The pixels per EM value at which these metrics apply. */ - /* */ - /* max_width :: The maximum advance width for this metric. */ - /* */ - /* widths :: An array of widths. Note: These are 8-bit bytes. */ - /* */ - typedef struct TT_HdmxEntryRec_ - { - FT_Byte ppem; - FT_Byte max_width; - FT_Byte* widths; - - } TT_HdmxEntryRec, *TT_HdmxEntry; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_HdmxRec */ - /* */ - /* <Description> */ - /* A structure used to model the `hdmx' table, which contains */ - /* pre-computed widths for a set of given sizes/dimensions. */ - /* */ - /* <Fields> */ - /* version :: The version number. */ - /* */ - /* num_records :: The number of hdmx records. */ - /* */ - /* records :: An array of hdmx records. */ - /* */ - typedef struct TT_HdmxRec_ - { - FT_UShort version; - FT_Short num_records; - TT_HdmxEntry records; - - } TT_HdmxRec, *TT_Hdmx; - - - /*************************************************************************/ - /* */ - /* <Struct> */ - /* TT_Kern0_PairRec */ - /* */ - /* <Description> */ - /* A structure used to model a kerning pair for the kerning table */ - /* format 0. The engine now loads this table if it finds one in the */ - /* font file. */ - /* */ - /* <Fields> */ - /* left :: The index of the left glyph in pair. */ - /* */ - /* right :: The index of the right glyph in pair. */ - /* */ - /* value :: The kerning distance. A positive value spaces the */ - /* glyphs, a negative one makes them closer. */ - /* */ - typedef struct TT_Kern0_PairRec_ - { - FT_UShort left; /* index of left glyph in pair */ - FT_UShort right; /* index of right glyph in pair */ - FT_FWord value; /* kerning value */ - - } TT_Kern0_PairRec, *TT_Kern0_Pair; - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -1269,9 +1188,6 @@ FT_BEGIN_HEADER TT_HoriHeader horizontal; /* TrueType horizontal header */ TT_MaxProfile max_profile; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_ULong max_components; /* stubbed to 0 */ -#endif FT_Bool vertical_info; TT_VertHeader vertical; /* TT Vertical header, if present */ @@ -1308,11 +1224,6 @@ FT_BEGIN_HEADER /* */ /***********************************************************************/ - /* horizontal device metrics */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - TT_HdmxRec hdmx; -#endif - /* grid-fitting and scaling table */ TT_GaspRec gasp; /* the `gasp' table */ @@ -1320,11 +1231,6 @@ FT_BEGIN_HEADER TT_PCLT pclt; /* embedded bitmaps support */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_ULong num_sbit_strikes; - TT_SBit_Strike sbit_strikes; -#endif - FT_ULong num_sbit_scales; TT_SBit_Scale sbit_scales; @@ -1338,12 +1244,6 @@ FT_BEGIN_HEADER /* */ /***********************************************************************/ - /* the glyph locations */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_UShort num_locations_stub; - FT_Long* glyph_locations_stub; -#endif - /* the font program, if any */ FT_ULong font_program_size; FT_Byte* font_program; @@ -1356,13 +1256,6 @@ FT_BEGIN_HEADER FT_ULong cvt_size; FT_Short* cvt; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - /* the format 0 kerning table, if any */ - FT_Int num_kern_pairs; - FT_Int kern_table_index; - TT_Kern0_Pair kern_pairs; -#endif - /* A pointer to the bytecode interpreter to use. This is also */ /* used to hook the debugger for the `ttdebug' utility. */ TT_Interpreter interpreter; @@ -1383,11 +1276,8 @@ FT_BEGIN_HEADER const char* postscript_name; - /* since version 2.1.8, but was originally placed after */ - /* `glyph_locations_stub' */ FT_ULong glyf_len; - /* since version 2.1.8, but was originally placed before `extra' */ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_Bool doblend; GX_Blend blend; @@ -1428,6 +1318,13 @@ FT_BEGIN_HEADER FT_ULong horz_metrics_offset; FT_ULong vert_metrics_offset; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* since 2.4.12 */ + FT_ULong sph_found_func_flags; /* special functions found */ + /* for this face */ + FT_Bool sph_compatibility_mode; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + } TT_FaceRec; diff --git a/freetype/include/freetype/tttags.h b/freetype/include/freetype/tttags.h index 307ce4b63..be8c524ed 100644 --- a/freetype/include/freetype/tttags.h +++ b/freetype/include/freetype/tttags.h @@ -4,7 +4,7 @@ /* */ /* Tags for TrueType and OpenType tables (specification only). */ /* */ -/* Copyright 1996-2001, 2004, 2005, 2007, 2008 by */ +/* Copyright 1996-2001, 2004, 2005, 2007, 2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -40,6 +40,8 @@ FT_BEGIN_HEADER #define TTAG_bhed FT_MAKE_TAG( 'b', 'h', 'e', 'd' ) #define TTAG_bloc FT_MAKE_TAG( 'b', 'l', 'o', 'c' ) #define TTAG_bsln FT_MAKE_TAG( 'b', 's', 'l', 'n' ) +#define TTAG_CBDT FT_MAKE_TAG( 'C', 'B', 'D', 'T' ) +#define TTAG_CBLC FT_MAKE_TAG( 'C', 'B', 'L', 'C' ) #define TTAG_CFF FT_MAKE_TAG( 'C', 'F', 'F', ' ' ) #define TTAG_CID FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) #define TTAG_cmap FT_MAKE_TAG( 'c', 'm', 'a', 'p' ) diff --git a/freetype/src/autofit/afcjk.c b/freetype/src/autofit/afcjk.c index 38325f6d0..f69a528e3 100644 --- a/freetype/src/autofit/afcjk.c +++ b/freetype/src/autofit/afcjk.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK script (body). */ /* */ -/* Copyright 2006-2012 by */ +/* Copyright 2006-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -481,7 +481,8 @@ FT_Bool under_ref = FT_BOOL( shoot < ref ); - if ( (AF_CJK_BLUE_TOP == bb || AF_CJK_BLUE_RIGHT == bb) ^ under_ref ) + if ( ( AF_CJK_BLUE_TOP == bb || + AF_CJK_BLUE_RIGHT == bb ) ^ under_ref ) *blue_shoot = *blue_ref = ( shoot + ref ) / 2; } @@ -566,7 +567,7 @@ FT_Set_Charmap( face, oldmap ); - return AF_Err_Ok; + return FT_Err_Ok; } @@ -702,7 +703,7 @@ { AF_Point pt = seg->first; AF_Point last = seg->last; - AF_Flags f0 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL); + AF_Flags f0 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL ); AF_Flags f1; @@ -711,7 +712,7 @@ for ( ; pt != last; f0 = f1 ) { pt = pt->next; - f1 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL); + f1 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL ); if ( !f0 && !f1 ) break; @@ -721,7 +722,7 @@ } } - return AF_Err_Ok; + return FT_Err_Ok; } @@ -895,7 +896,7 @@ AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = hints->memory; AF_CJKAxis laxis = &((AF_CJKMetrics)hints->metrics)->axis[dim]; @@ -965,14 +966,15 @@ /* can make a single edge. */ if ( link ) { - AF_Segment seg1 = edge->first; - AF_Segment link1; + AF_Segment seg1 = edge->first; FT_Pos dist2 = 0; do { - link1 = seg1->link; + AF_Segment link1 = seg1->link; + + if ( link1 ) { dist2 = AF_SEGMENT_DIST( link, link1 ); diff --git a/freetype/src/autofit/afdummy.c b/freetype/src/autofit/afdummy.c index 2258a198a..22944559d 100644 --- a/freetype/src/autofit/afdummy.c +++ b/freetype/src/autofit/afdummy.c @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (body). */ /* */ -/* Copyright 2003-2005, 2011 by */ +/* Copyright 2003-2005, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,7 +28,7 @@ { af_glyph_hints_rescale( hints, metrics ); - return AF_Err_Ok; + return FT_Err_Ok; } @@ -39,7 +39,7 @@ FT_UNUSED( hints ); FT_UNUSED( outline ); - return AF_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/autofit/afglobal.c b/freetype/src/autofit/afglobal.c index 3c1e837ed..3e4146575 100644 --- a/freetype/src/autofit/afglobal.c +++ b/freetype/src/autofit/afglobal.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter routines to compute global hinting values (body). */ /* */ -/* Copyright 2003-2012 by */ +/* Copyright 2003-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -55,7 +55,7 @@ static FT_Error af_face_globals_compute_script_coverage( AF_FaceGlobals globals ) { - FT_Error error = AF_Err_Ok; + FT_Error error; FT_Face face = globals->face; FT_CharMap old_charmap = face->charmap; FT_Byte* gscripts = globals->glyph_scripts; @@ -75,7 +75,7 @@ * Ignore this error; we simply use the fallback script. * XXX: Shouldn't we rather disable hinting? */ - error = AF_Err_Ok; + error = FT_Err_Ok; goto Exit; } @@ -237,12 +237,12 @@ FT_UInt script = options & 15; const FT_Offset script_max = sizeof ( AF_SCRIPT_CLASSES_GET ) / sizeof ( AF_SCRIPT_CLASSES_GET[0] ); - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; if ( gindex >= (FT_ULong)globals->glyph_count ) { - error = AF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } diff --git a/freetype/src/autofit/afhints.c b/freetype/src/autofit/afhints.c index 8aca8e7ba..e8defaa88 100644 --- a/freetype/src/autofit/afhints.c +++ b/freetype/src/autofit/afhints.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (body). */ /* */ -/* Copyright 2003-2007, 2009-2012 by */ +/* Copyright 2003-2007, 2009-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -39,7 +39,7 @@ FT_Memory memory, AF_Segment *asegment ) { - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_Segment segment = NULL; @@ -52,7 +52,7 @@ if ( old_max >= big_max ) { - error = AF_Err_Out_Of_Memory; + error = FT_THROW( Out_Of_Memory ); goto Exit; } @@ -83,7 +83,7 @@ FT_Memory memory, AF_Edge *anedge ) { - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_Edge edge = NULL; AF_Edge edges; @@ -97,7 +97,7 @@ if ( old_max >= big_max ) { - error = AF_Err_Out_Of_Memory; + error = FT_THROW( Out_Of_Memory ); goto Exit; } @@ -265,7 +265,7 @@ FT_TRACE7(( "Table of %s segments:\n", dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); - if (axis->num_segments) + if ( axis->num_segments ) FT_TRACE7(( " [ index | pos | dir | from" " | to | link | serif | edge" " | height | extra | flags ]\n" )); @@ -316,7 +316,7 @@ axis = &hints->axis[dim]; *num_segments = axis->num_segments; - return AF_Err_Ok; + return FT_Err_Ok; } #ifdef __cplusplus } @@ -340,20 +340,20 @@ if ( !offset ) - return AF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); dim = ( dimension == 0 ) ? AF_DIMENSION_HORZ : AF_DIMENSION_VERT; axis = &hints->axis[dim]; if ( idx < 0 || idx >= axis->num_segments ) - return AF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); seg = &axis->segments[idx]; - *offset = (dim == AF_DIMENSION_HORZ) ? seg->first->ox - : seg->first->oy; + *offset = ( dim == AF_DIMENSION_HORZ ) ? seg->first->ox + : seg->first->oy; - return AF_Err_Ok; + return FT_Err_Ok; } #ifdef __cplusplus } @@ -593,7 +593,7 @@ af_glyph_hints_reload( AF_GlyphHints hints, FT_Outline* outline ) { - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_Point points; FT_UInt old_max, new_max; FT_Fixed x_scale = hints->x_scale; diff --git a/freetype/src/autofit/afindic.c b/freetype/src/autofit/afindic.c index 70de70ba9..8c2497259 100644 --- a/freetype/src/autofit/afindic.c +++ b/freetype/src/autofit/afindic.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic scripts (body). */ /* */ -/* Copyright 2007, 2011, 2012 by */ +/* Copyright 2007, 2011-2013 by */ /* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -56,7 +56,7 @@ FT_Set_Charmap( face, oldmap ); - return AF_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/autofit/aflatin.c b/freetype/src/autofit/aflatin.c index 8ebd49681..ef0157a13 100644 --- a/freetype/src/autofit/aflatin.c +++ b/freetype/src/autofit/aflatin.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003-2012 by */ +/* Copyright 2003-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -561,7 +561,7 @@ } FT_Set_Charmap( face, oldmap ); - return AF_Err_Ok; + return FT_Err_Ok; } @@ -743,7 +743,7 @@ if ( delta2 < 32 ) delta2 = 0; - else if ( delta < 48 ) + else if ( delta2 < 48 ) delta2 = 32; else delta2 = 64; @@ -795,7 +795,7 @@ { AF_AxisHints axis = &hints->axis[dim]; FT_Memory memory = hints->memory; - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_Segment segment = NULL; AF_SegmentRec seg0; AF_Point* contour = hints->contours; @@ -1107,7 +1107,7 @@ AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = hints->memory; AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; @@ -1583,7 +1583,7 @@ hints->scaler_flags = scaler_flags; hints->other_flags = other_flags; - return AF_Err_Ok; + return FT_Err_Ok; } @@ -1787,7 +1787,7 @@ if ( delta < 0 ) delta = -delta; - if (delta >= 16) + if ( delta >= 16 ) { dist = org_dist; if ( dist < 48 ) @@ -1914,7 +1914,7 @@ continue; #ifdef FT_DEBUG_LEVEL_TRACE - if (!anchor) + if ( !anchor ) FT_TRACE5(( " BLUE_ANCHOR: edge %d (opos=%.2f) snapped to %.2f," " was %.2f (anchor=edge %d)\n", edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0, @@ -2080,7 +2080,7 @@ cur_pos1 = FT_PIX_ROUND( org_center ); - if (cur_len <= 64 ) + if ( cur_len <= 64 ) { u_off = 32; d_off = 32; diff --git a/freetype/src/autofit/aflatin2.c b/freetype/src/autofit/aflatin2.c index 40a5ffd6a..b1e9658d5 100644 --- a/freetype/src/autofit/aflatin2.c +++ b/freetype/src/autofit/aflatin2.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003-2012 by */ +/* Copyright 2003-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -475,7 +475,7 @@ af_latin2_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_CharMap oldmap = face->charmap; FT_UInt ee; @@ -507,7 +507,7 @@ } FT_Set_Charmap( face, oldmap ); - return AF_Err_Ok; + return FT_Err_Ok; } @@ -708,7 +708,7 @@ { AF_AxisHints axis = &hints->axis[dim]; FT_Memory memory = hints->memory; - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_Segment segment = NULL; AF_SegmentRec seg0; AF_Point* contour = hints->contours; @@ -824,17 +824,17 @@ segment->dir = first->out_dir; segment->first = first; segment->last = point; - segment->pos = (FT_Short)(( min_u + max_u ) >> 1); + segment->pos = (FT_Short)( ( min_u + max_u ) >> 1 ); segment->min_coord = (FT_Short) min_v; segment->max_coord = (FT_Short) max_v; - segment->height = (FT_Short)(max_v - min_v); + segment->height = (FT_Short)( max_v - min_v ); /* a segment is round if it doesn't have successive */ /* on-curve points. */ { AF_Point pt = first; AF_Point last = point; - AF_Flags f0 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL); + AF_Flags f0 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL ); AF_Flags f1; @@ -843,7 +843,7 @@ for ( ; pt != last; f0 = f1 ) { pt = pt->next; - f1 = (AF_Flags)(pt->flags & AF_FLAG_CONTROL); + f1 = (AF_Flags)( pt->flags & AF_FLAG_CONTROL ); if ( !f0 && !f1 ) break; @@ -860,7 +860,7 @@ break; /* jump to the start of the next segment, if any */ - while ( FT_ABS(point->out_dir) != major_dir ) + while ( FT_ABS( point->out_dir ) != major_dir ) { point = point->next; @@ -928,16 +928,17 @@ FT_UInt count = axis->num_segments; FT_UInt ii, jj; - for (ii = 0; ii < count; ii++) + for ( ii = 0; ii < count; ii++ ) { if ( segments[ii].dir > 0 ) { - for (jj = ii+1; jj < count; jj++) + for ( jj = ii + 1; jj < count; jj++ ) { if ( segments[jj].dir < 0 ) { AF_SegmentRec tmp; + tmp = segments[ii]; segments[ii] = segments[jj]; segments[jj] = tmp; @@ -1064,7 +1065,7 @@ AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = hints->memory; AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; @@ -1098,7 +1099,7 @@ if ( dim == AF_DIMENSION_HORZ ) { if ( laxis->width_count > 0 ) - segment_length_threshold = (laxis->standard_width * 10 ) >> 4; + segment_length_threshold = ( laxis->standard_width * 10 ) >> 4; else segment_length_threshold = FT_DivFix( 64, hints->y_scale ); } @@ -1144,10 +1145,11 @@ { FT_Pos dist = seg->serif->pos - seg->pos; - if (dist < 0) + + if ( dist < 0 ) dist = -dist; - if (dist >= laxis->standard_width >> 1) + if ( dist >= laxis->standard_width >> 1 ) { /* unlink this serif, it is too distant from its reference stem */ seg->serif = NULL; @@ -1445,7 +1447,7 @@ compare = &blue->ref; dist = edge->fpos - compare->org; - if (dist < 0) + if ( dist < 0 ) dist = -dist; dist = FT_MulFix( dist, scale ); @@ -1549,8 +1551,8 @@ * In `light' hinting mode we disable horizontal hinting completely. * We also do it if the face is italic. */ - if ( mode == FT_RENDER_MODE_LIGHT || - (face->style_flags & FT_STYLE_FLAG_ITALIC) != 0 ) + if ( mode == FT_RENDER_MODE_LIGHT || + ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; hints->scaler_flags = scaler_flags; @@ -1631,8 +1633,8 @@ FT_Int sign = 0; FT_Int vertical = ( dim == AF_DIMENSION_VERT ); + FT_UNUSED( base_flags ); - FT_UNUSED(base_flags); if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || axis->extra_light ) @@ -1762,7 +1764,7 @@ if ( delta < 0 ) delta = -delta; - if (delta >= 16) + if ( delta >= 16 ) { dist = org_dist; if ( dist < 48 ) @@ -1816,7 +1818,7 @@ { FT_UNUSED( hints ); - serif->pos = base->pos + (serif->opos - base->opos); + serif->pos = base->pos + ( serif->opos - base->opos ); } @@ -1898,9 +1900,10 @@ { anchor = edge; - anchor_drift = (anchor->pos - anchor->opos); - if (edge2) - anchor_drift = (anchor_drift + (edge2->pos - edge2->opos)) >> 1; + anchor_drift = ( anchor->pos - anchor->opos ); + if ( edge2 ) + anchor_drift = ( anchor_drift + + ( edge2->pos - edge2->opos ) ) >> 1; } } } @@ -1992,8 +1995,8 @@ edge2->flags |= AF_EDGE_DONE; - anchor_drift = ( (anchor->pos - anchor->opos) + - (edge2->pos - edge2->opos)) >> 1; + anchor_drift = ( ( anchor->pos - anchor->opos ) + + ( edge2->pos - edge2->opos ) ) >> 1; FT_TRACE5(( "DRIFT: %.2f\n", anchor_drift/64.0 )); } @@ -2012,8 +2015,8 @@ (AF_Edge_Flags)edge->flags, (AF_Edge_Flags)edge2->flags ); - org_left = org_pos + ((org_len - cur_len) >> 1); - org_right = org_pos + ((org_len + cur_len) >> 1); + org_left = org_pos + ( ( org_len - cur_len ) >> 1 ); + org_right = org_pos + ( ( org_len + cur_len ) >> 1 ); FT_TRACE5(( "ALIGN: left=%.2f right=%.2f ", org_left / 64.0, org_right / 64.0 )); @@ -2041,13 +2044,13 @@ } /* if the span is within a single pixel, don't touch it */ - if ( FT_PIX_FLOOR(org_left) == FT_PIX_CEIL(org_right) ) + if ( FT_PIX_FLOOR( org_left ) == FT_PIX_CEIL( org_right ) ) { FT_TRACE5(( "single pixel stem\n" )); goto AlignStem; } - if (cur_len <= 96) + if ( cur_len <= 96 ) { /* we want to avoid the absolute worst case which is * when the left and right edges of the span each represent @@ -2055,43 +2058,43 @@ * to 25/75%, since this is much more pleasant to the eye with * very acceptable distortion */ - FT_Pos frac_left = (org_left) & 63; - FT_Pos frac_right = (org_right) & 63; + FT_Pos frac_left = org_left & 63; + FT_Pos frac_right = org_right & 63; if ( frac_left >= 22 && frac_left <= 42 && frac_right >= 22 && frac_right <= 42 ) { org = frac_left; - fit = (org <= 32) ? 16 : 48; - delta = FT_ABS(fit - org); + fit = ( org <= 32 ) ? 16 : 48; + delta = FT_ABS( fit - org ); displacements[count] = fit - org; scores[count++] = delta; - FT_TRACE5(( "dispA=%.2f (%d) ", (fit - org) / 64.0, delta )); + FT_TRACE5(( "dispA=%.2f (%d) ", ( fit - org ) / 64.0, delta )); org = frac_right; - fit = (org <= 32) ? 16 : 48; - delta = FT_ABS(fit - org); + fit = ( org <= 32 ) ? 16 : 48; + delta = FT_ABS( fit - org ); displacements[count] = fit - org; scores[count++] = delta; - FT_TRACE5(( "dispB=%.2f (%d) ", (fit - org) / 64.0, delta )); + FT_TRACE5(( "dispB=%.2f (%d) ", ( fit - org ) / 64.0, delta )); } } /* snapping the left edge to the grid */ org = org_left; - fit = FT_PIX_ROUND(org); - delta = FT_ABS(fit - org); + fit = FT_PIX_ROUND( org ); + delta = FT_ABS( fit - org ); displacements[count] = fit - org; scores[count++] = delta; - FT_TRACE5(( "dispC=%.2f (%d) ", (fit - org) / 64.0, delta )); + FT_TRACE5(( "dispC=%.2f (%d) ", ( fit - org ) / 64.0, delta )); /* snapping the right edge to the grid */ org = org_right; - fit = FT_PIX_ROUND(org); - delta = FT_ABS(fit - org); + fit = FT_PIX_ROUND( org ); + delta = FT_ABS( fit - org ); displacements[count] = fit - org; scores[count++] = delta; - FT_TRACE5(( "dispD=%.2f (%d) ", (fit - org) / 64.0, delta )); + FT_TRACE5(( "dispD=%.2f (%d) ", ( fit - org ) / 64.0, delta )); /* now find the best displacement */ { @@ -2099,9 +2102,9 @@ FT_Pos best_disp = displacements[0]; FT_UInt nn; - for (nn = 1; nn < count; nn++) + for ( nn = 1; nn < count; nn++ ) { - if (scores[nn] < best_score) + if ( scores[nn] < best_score ) { best_score = scores[nn]; best_disp = displacements[nn]; @@ -2114,7 +2117,7 @@ } AlignStem: - edge->pos = cur_center - (cur_len >> 1); + edge->pos = cur_center - ( cur_len >> 1 ); edge2->pos = edge->pos + cur_len; FT_TRACE5(( "STEM1: %d (opos=%.2f) to %d (opos=%.2f)" diff --git a/freetype/src/autofit/afloader.c b/freetype/src/autofit/afloader.c index f280beda2..17a6fb7c3 100644 --- a/freetype/src/autofit/afloader.c +++ b/freetype/src/autofit/afloader.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (body). */ /* */ -/* Copyright 2003-2009, 2011-2012 by */ +/* Copyright 2003-2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -48,7 +48,7 @@ af_loader_reset( AF_Module module, FT_Face face ) { - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_Loader loader = module->loader; @@ -349,7 +349,7 @@ if ( start_point + k >= num_base_points || l >= (FT_UInt)num_new_points ) { - error = AF_Err_Invalid_Composite; + error = FT_THROW( Invalid_Composite ); goto Exit; } @@ -387,7 +387,7 @@ default: /* we don't support other formats (yet?) */ - error = AF_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); } Hint_Metrics: @@ -502,7 +502,7 @@ if ( !size ) - return AF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); FT_ZERO( &scaler ); diff --git a/freetype/src/autofit/afmodule.c b/freetype/src/autofit/afmodule.c index f46cff9ec..b1bb5ee0e 100644 --- a/freetype/src/autofit/afmodule.c +++ b/freetype/src/autofit/afmodule.c @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (body). */ /* */ -/* Copyright 2003-2006, 2009, 2011-2012 by */ +/* Copyright 2003-2006, 2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -50,12 +50,12 @@ AF_FaceGlobals* aglobals, AF_Module module ) { - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_FaceGlobals globals; if ( !face ) - return AF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); globals = (AF_FaceGlobals)face->autohint.data; if ( !globals ) @@ -84,7 +84,7 @@ const char* property_name, const void* value ) { - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_Module module = (AF_Module)ft_module; @@ -110,9 +110,9 @@ return error; } - FT_TRACE0(( "af_property_get: missing property `%s'\n", + FT_TRACE0(( "af_property_set: missing property `%s'\n", property_name )); - return AF_Err_Missing_Property; + return FT_THROW( Missing_Property ); } @@ -121,7 +121,7 @@ const char* property_name, void* value ) { - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AF_Module module = (AF_Module)ft_module; FT_UInt fallback_script = module->fallback_script; @@ -163,7 +163,7 @@ FT_TRACE0(( "af_property_get: missing property `%s'\n", property_name )); - return AF_Err_Missing_Property; + return FT_THROW( Missing_Property ); } @@ -201,8 +201,11 @@ FT_CALLBACK_DEF( FT_Error ) - af_autofitter_init( AF_Module module ) + af_autofitter_init( FT_Module ft_module ) /* AF_Module */ { + AF_Module module = (AF_Module)ft_module; + + module->fallback_script = AF_SCRIPT_FALLBACK; return af_loader_init( module ); @@ -210,8 +213,11 @@ FT_CALLBACK_DEF( void ) - af_autofitter_done( AF_Module module ) + af_autofitter_done( FT_Module ft_module ) /* AF_Module */ { + AF_Module module = (AF_Module)ft_module; + + af_loader_done( module ); } diff --git a/freetype/src/autofit/afpic.c b/freetype/src/autofit/afpic.c index e6022f930..45e1448c0 100644 --- a/freetype/src/autofit/afpic.c +++ b/freetype/src/autofit/afpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009-2012 by */ +/* Copyright 2009-2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -80,7 +80,7 @@ { FT_PIC_Container* pic_container = &library->pic_container; FT_UInt ss; - FT_Error error = AF_Err_Ok; + FT_Error error = FT_Err_Ok; AFModulePIC* container = NULL; FT_Memory memory = library->memory; diff --git a/freetype/src/base/basepic.h b/freetype/src/base/basepic.h index bf90bef0b..329d7c8fd 100644 --- a/freetype/src/base/basepic.h +++ b/freetype/src/base/basepic.h @@ -25,11 +25,13 @@ FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H #ifndef FT_CONFIG_OPTION_PIC -#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class -#define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class -#define FT_DEFAULT_MODULES_GET ft_default_modules + +#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class +#define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class +#define FT_DEFAULT_MODULES_GET ft_default_modules + #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table +#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table #endif #else /* FT_CONFIG_OPTION_PIC */ @@ -41,25 +43,35 @@ FT_BEGIN_HEADER #endif - typedef struct BasePIC_ + typedef struct BasePIC_ { - FT_Module_Class** default_module_classes; - FT_Glyph_Class ft_outline_glyph_class; - FT_Glyph_Class ft_bitmap_glyph_class; + FT_Module_Class** default_module_classes; + FT_Glyph_Class ft_outline_glyph_class; + FT_Glyph_Class ft_bitmap_glyph_class; + #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK - ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES]; + ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES]; #endif + } BasePIC; -#define GET_PIC(lib) ((BasePIC*)((lib)->pic_container.base)) -#define FT_OUTLINE_GLYPH_CLASS_GET (&GET_PIC(library)->ft_outline_glyph_class) -#define FT_BITMAP_GLYPH_CLASS_GET (&GET_PIC(library)->ft_bitmap_glyph_class) -#define FT_DEFAULT_MODULES_GET (GET_PIC(library)->default_module_classes) + +#define GET_PIC( lib ) ( (BasePIC*)( (lib)->pic_container.base ) ) + +#define FT_OUTLINE_GLYPH_CLASS_GET \ + ( &GET_PIC( library )->ft_outline_glyph_class ) +#define FT_BITMAP_GLYPH_CLASS_GET \ + ( &GET_PIC( library )->ft_bitmap_glyph_class ) +#define FT_DEFAULT_MODULES_GET \ + ( GET_PIC( library )->default_module_classes ) + #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#define FT_RACCESS_GUESS_TABLE_GET (GET_PIC(library)->ft_raccess_guess_table) +#define FT_RACCESS_GUESS_TABLE_GET \ + ( GET_PIC( library )->ft_raccess_guess_table ) #endif - /* see basepic.c for the implementation. */ + + /* see basepic.c for the implementation */ void ft_base_pic_free( FT_Library library ); @@ -67,7 +79,8 @@ FT_BEGIN_HEADER ft_base_pic_init( FT_Library library ); #endif /* FT_CONFIG_OPTION_PIC */ - /* */ + + /* */ FT_END_HEADER diff --git a/freetype/src/base/ftadvanc.c b/freetype/src/base/ftadvanc.c index a8bb43d3d..52078478d 100644 --- a/freetype/src/base/ftadvanc.c +++ b/freetype/src/base/ftadvanc.c @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (body). */ /* */ -/* Copyright 2008, 2009, 2011 by */ +/* Copyright 2008, 2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,8 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_ADVANCES_H #include FT_INTERNAL_OBJECTS_H @@ -35,7 +37,7 @@ return FT_Err_Ok; if ( face->size == NULL ) - return FT_Err_Invalid_Size_Handle; + return FT_THROW( Invalid_Size_Handle ); if ( flags & FT_LOAD_VERTICAL_LAYOUT ) scale = face->size->metrics.y_scale; @@ -76,10 +78,10 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); if ( gindex >= (FT_UInt)face->num_glyphs ) - return FT_Err_Invalid_Glyph_Index; + return FT_THROW( Invalid_Glyph_Index ); func = face->driver->clazz->get_advances; if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) ) @@ -91,7 +93,7 @@ if ( !error ) return _ft_face_scale_advances( face, padvance, 1, flags ); - if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) + if ( FT_ERR_NEQ( error, Unimplemented_Feature ) ) return error; } @@ -114,12 +116,12 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); num = (FT_UInt)face->num_glyphs; end = start + count; if ( start >= num || end < start || end > num ) - return FT_Err_Invalid_Glyph_Index; + return FT_THROW( Invalid_Glyph_Index ); if ( count == 0 ) return FT_Err_Ok; @@ -131,14 +133,14 @@ if ( !error ) return _ft_face_scale_advances( face, padvances, count, flags ); - if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) + if ( FT_ERR_NEQ( error, Unimplemented_Feature ) ) return error; } error = FT_Err_Ok; if ( flags & FT_ADVANCE_FLAG_FAST_ONLY ) - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; for ( nn = 0; nn < count; nn++ ) diff --git a/freetype/src/base/ftbbox.c b/freetype/src/base/ftbbox.c index 4b8e9112f..6d1c44cb2 100644 --- a/freetype/src/base/ftbbox.c +++ b/freetype/src/base/ftbbox.c @@ -4,7 +4,7 @@ /* */ /* FreeType bbox computation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2006, 2010 by */ +/* Copyright 1996-2002, 2004, 2006, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -25,6 +25,8 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_BBOX_H #include FT_IMAGE_H #include FT_OUTLINE_H @@ -222,65 +224,100 @@ FT_Pos* min, FT_Pos* max ) { - FT_Pos stack[32*3 + 1], *arc; - + FT_Pos q1, q2, q3, q4; - arc = stack; - arc[0] = p1; - arc[1] = p2; - arc[2] = p3; - arc[3] = p4; + q1 = p1; + q2 = p2; + q3 = p3; + q4 = p4; - do + /* for a conic segment to possibly reach new maximum */ + /* one of its off-points must be above the current value */ + while ( q2 > *max || q3 > *max ) { - FT_Pos y1 = arc[0]; - FT_Pos y2 = arc[1]; - FT_Pos y3 = arc[2]; - FT_Pos y4 = arc[3]; - - - if ( y1 == y4 ) + /* determine which half contains the maximum and split */ + if ( q1 + q2 > q3 + q4 ) /* first half */ { - if ( y1 == y2 && y1 == y3 ) /* flat */ - goto Test; + q4 = q4 + q3; + q3 = q3 + q2; + q2 = q2 + q1; + q4 = q4 + q3; + q3 = q3 + q2; + q4 = ( q4 + q3 ) / 8; + q3 = q3 / 4; + q2 = q2 / 2; } - else if ( y1 < y4 ) + else /* second half */ { - if ( y2 >= y1 && y2 <= y4 && y3 >= y1 && y3 <= y4 ) /* ascending */ - goto Test; + q1 = q1 + q2; + q2 = q2 + q3; + q3 = q3 + q4; + q1 = q1 + q2; + q2 = q2 + q3; + q1 = ( q1 + q2 ) / 8; + q2 = q2 / 4; + q3 = q3 / 2; } - else + + /* check if either end reached the maximum */ + if ( q1 == q2 && q1 >= q3 ) { - if ( y2 >= y4 && y2 <= y1 && y3 >= y4 && y3 <= y1 ) /* descending */ - { - y2 = y1; - y1 = y4; - y4 = y2; - goto Test; - } + *max = q1; + break; } + if ( q3 == q4 && q2 <= q4 ) + { + *max = q4; + break; + } + } - /* 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; + q1 = p1; + q2 = p2; + q3 = p3; + q4 = p4; - Test: - if ( y1 < *min ) *min = y1; - if ( y4 > *max ) *max = y4; - arc -= 3; + /* for a conic segment to possibly reach new minimum */ + /* one of its off-points must be below the current value */ + while ( q2 < *min || q3 < *min ) + { + /* determine which half contains the minimum and split */ + if ( q1 + q2 < q3 + q4 ) /* first half */ + { + q4 = q4 + q3; + q3 = q3 + q2; + q2 = q2 + q1; + q4 = q4 + q3; + q3 = q3 + q2; + q4 = ( q4 + q3 ) / 8; + q3 = q3 / 4; + q2 = q2 / 2; + } + else /* second half */ + { + q1 = q1 + q2; + q2 = q2 + q3; + q3 = q3 + q4; + q1 = q1 + q2; + q2 = q2 + q3; + q1 = ( q1 + q2 ) / 8; + q2 = q2 / 4; + q3 = q3 / 2; + } - Suite: - ; - } while ( arc >= stack ); + /* check if either end reached the minimum */ + if ( q1 == q2 && q1 <= q3 ) + { + *min = q1; + break; + } + if ( q3 == q4 && q2 >= q4 ) + { + *min = q4; + break; + } + } } #else @@ -358,107 +395,57 @@ return; } - /* There are some split points. Find them. */ + /* There are some split points. Find them. */ + /* We already made sure that a, b, and c below cannot be all zero. */ { 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; + FT_Int shift; /* 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. */ + /* to use our 16.16 fixed-point routines. */ /* */ /* 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. */ + /* We normalize a, b, and c to `8.16' fixed-point values to ensure */ + /* that their product is held in a `16.16' value including the sign. */ + /* Necessarily, we need to shift `a', `b', and `c' so that the most */ + /* significant bit of their absolute values is at position 22. */ + /* */ + /* This also means that we are using 23 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). */ - { - FT_ULong t1, t2; - int shift = 0; - - - /* 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 ); - t1 |= t2; - - /* 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; + shift = FT_MSB( FT_ABS( a ) | FT_ABS( b ) | FT_ABS( c ) ); - if ( t1 > 0x7FFFFFUL ) - { - do - { - shift++; - t1 >>= 1; - - } while ( t1 > 0x7FFFFFUL ); - - /* 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; + if ( shift > 22 ) + { + shift -= 22; - } while ( t1 < 0x400000UL ); + /* this loses some bits of precision, but we use 23 of them */ + /* for the computation anyway */ + a >>= shift; + b >>= shift; + c >>= shift; + } + else + { + shift = 22 - shift; - a <<= shift; - b <<= shift; - c <<= shift; - } + a <<= shift; + b <<= shift; + c <<= shift; } /* handle a == 0 */ @@ -581,10 +568,10 @@ FT_DEFINE_OUTLINE_FUNCS(bbox_interface, if ( !abbox ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( !outline ) - return FT_Err_Invalid_Outline; + return FT_THROW( Invalid_Outline ); /* if outline is empty, return (0,0,0,0) */ if ( outline->n_points == 0 || outline->n_contours <= 0 ) diff --git a/freetype/src/base/ftbdf.c b/freetype/src/base/ftbdf.c index d29adf09d..5755f8558 100644 --- a/freetype/src/base/ftbdf.c +++ b/freetype/src/base/ftbdf.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing BDF-specific strings (body). */ /* */ -/* Copyright 2002, 2003, 2004 by */ +/* Copyright 2002-2004, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,7 +33,7 @@ const char* registry = NULL; - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( face ) { @@ -66,7 +66,7 @@ FT_Error error; - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); aproperty->type = BDF_PROPERTY_TYPE_NONE; diff --git a/freetype/src/base/ftbitmap.c b/freetype/src/base/ftbitmap.c index 84fa32275..975818e14 100644 --- a/freetype/src/base/ftbitmap.c +++ b/freetype/src/base/ftbitmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (body). */ /* */ -/* Copyright 2004-2009, 2011 by */ +/* Copyright 2004-2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,8 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_BITMAP_H #include FT_IMAGE_H #include FT_INTERNAL_OBJECTS_H @@ -135,7 +137,7 @@ new_pitch = ( width + xpixels ); break; default: - return FT_Err_Invalid_Glyph_Format; + return FT_THROW( Invalid_Glyph_Format ); } /* if no need to allocate memory */ @@ -223,14 +225,14 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( !bitmap || !bitmap->buffer ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) || ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6; ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6; @@ -238,7 +240,7 @@ if ( xstr == 0 && ystr == 0 ) return FT_Err_Ok; else if ( xstr < 0 || ystr < 0 ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); switch ( bitmap->pixel_mode ) { @@ -277,6 +279,10 @@ case FT_PIXEL_MODE_LCD_V: ystr *= 3; break; + + case FT_PIXEL_MODE_BGRA: + /* We don't embolden color glyphs. */ + return FT_Err_Ok; } error = ft_bitmap_assure_buffer( library->memory, bitmap, xstr, ystr ); @@ -369,6 +375,59 @@ } + FT_Byte + ft_gray_for_premultiplied_srgb_bgra( const FT_Byte* bgra ) + { + FT_Long a = bgra[3]; + FT_Long b = bgra[0]; + FT_Long g = bgra[1]; + FT_Long r = bgra[2]; + FT_Long l; + + + /* + * Luminosity for sRGB is defined using ~0.2126,0.7152,0.0722 + * coefficients for RGB channels *on the linear colors*. + * A gamma of 2.2 is fair to assume. And then, we need to + * undo the premultiplication too. + * + * http://accessibility.kde.org/hsl-adjusted.php + * + * We do the computation with integers only. + */ + + /* Undo premultification, get the number in a 16.16 form. */ + b = FT_MulDiv( b, 65536, a ); + g = FT_MulDiv( g, 65536, a ); + r = FT_MulDiv( r, 65536, a ); + a = a * 256; + + /* Apply gamma of 2.0 instead of 2.2. */ + b = FT_MulFix( b, b ); + g = FT_MulFix( g, g ); + r = FT_MulFix( r, r ); + + /* Apply coefficients. */ + b = FT_MulFix( b, 4731 /* 0.0722 * 65536 */ ); + g = FT_MulFix( g, 46871 /* 0.7152 * 65536 */ ); + r = FT_MulFix( r, 13933 /* 0.2126 * 65536 */ ); + + l = r + g + b; + + /* + * Final transparency can be determined this way: + * + * - If alpha is zero, we want 0. + * - If alpha is zero and luminosity is zero, we want 255. + * - If alpha is zero and luminosity is one, we want 0. + * + * So the formula is a * (1 - l). + */ + + return (FT_Byte)( FT_MulFix( 65535 - l, a ) >> 8 ); + } + + /* documentation is in ftbitmap.h */ FT_EXPORT_DEF( FT_Error ) @@ -382,7 +441,7 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); memory = library->memory; @@ -394,6 +453,7 @@ case FT_PIXEL_MODE_GRAY4: case FT_PIXEL_MODE_LCD: case FT_PIXEL_MODE_LCD_V: + case FT_PIXEL_MODE_BGRA: { FT_Int pad; FT_Long old_size; @@ -419,7 +479,7 @@ if ( target->pitch > 0 && (FT_ULong)target->rows > FT_ULONG_MAX / target->pitch ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( target->rows * target->pitch > old_size && FT_QREALLOC( target->buffer, @@ -429,7 +489,7 @@ break; default: - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); } switch ( source->pixel_mode ) @@ -606,6 +666,37 @@ } break; + case FT_PIXEL_MODE_BGRA: + { + FT_Byte* s = source->buffer; + FT_Byte* t = target->buffer; + FT_Int s_pitch = source->pitch; + FT_Int t_pitch = target->pitch; + FT_Int i; + + + target->num_grays = 256; + + for ( i = source->rows; i > 0; i-- ) + { + FT_Byte* ss = s; + FT_Byte* tt = t; + FT_Int j; + + + for ( j = source->width; j > 0; j-- ) + { + tt[0] = ft_gray_for_premultiplied_srgb_bgra( ss ); + + ss += 4; + tt += 1; + } + + s += s_pitch; + t += t_pitch; + } + } + break; default: ; @@ -650,10 +741,10 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( !bitmap ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); memory = library->memory; diff --git a/freetype/src/base/ftcalc.c b/freetype/src/base/ftcalc.c index 2aeea0459..0ec0d7893 100644 --- a/freetype/src/base/ftcalc.c +++ b/freetype/src/base/ftcalc.c @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (body). */ /* */ -/* Copyright 1996-2006, 2008, 2012 by */ +/* Copyright 1996-2006, 2008, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -34,6 +34,7 @@ #include <ft2build.h> #include FT_GLYPH_H +#include FT_TRIGONOMETRY_H #include FT_INTERNAL_CALC_H #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H @@ -42,13 +43,9 @@ #undef FT_MulFix #endif -/* we need to define a 64-bits data type here */ +/* we need to emulate a 64-bit data type if a real one isn't available */ -#ifdef FT_LONG64 - - typedef FT_INT64 FT_Int64; - -#else +#ifndef FT_LONG64 typedef struct FT_Int64_ { @@ -57,7 +54,7 @@ } FT_Int64; -#endif /* FT_LONG64 */ +#endif /* !FT_LONG64 */ /*************************************************************************/ @@ -103,39 +100,57 @@ } -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS + FT_BASE_DEF ( FT_Int ) + FT_MSB( FT_UInt32 z ) + { + FT_Int shift = 0; - /* documentation is in ftcalc.h */ + /* determine msb bit index in `shift' */ + if ( z >= ( 1L << 16 ) ) + { + z >>= 16; + shift += 16; + } + if ( z >= ( 1L << 8 ) ) + { + z >>= 8; + shift += 8; + } + if ( z >= ( 1L << 4 ) ) + { + z >>= 4; + shift += 4; + } + if ( z >= ( 1L << 2 ) ) + { + z >>= 2; + shift += 2; + } + if ( z >= ( 1L << 1 ) ) + { + z >>= 1; + shift += 1; + } - FT_EXPORT_DEF( FT_Int32 ) - FT_Sqrt32( FT_Int32 x ) - { - FT_UInt32 val, root, newroot, mask; + return shift; + } - root = 0; - mask = (FT_UInt32)0x40000000UL; - val = (FT_UInt32)x; + /* documentation is in ftcalc.h */ - do - { - newroot = root + mask; - if ( newroot <= val ) - { - val -= newroot; - root = newroot + mask; - } + FT_BASE_DEF( FT_Fixed ) + FT_Hypot( FT_Fixed x, + FT_Fixed y ) + { + FT_Vector v; - root >>= 1; - mask >>= 2; - } while ( mask != 0 ); + v.x = x; + v.y = y; - return root; + return FT_Vector_Length( &v ); } -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - #ifdef FT_LONG64 @@ -163,8 +178,6 @@ } -#ifdef TT_USE_BYTECODE_INTERPRETER - /* documentation is in ftcalc.h */ FT_BASE_DEF( FT_Long ) @@ -187,8 +200,6 @@ return ( s > 0 ) ? d : -d; } -#endif /* TT_USE_BYTECODE_INTERPRETER */ - /* documentation is in freetype.h */ @@ -235,16 +246,25 @@ FT_Int32 s; FT_UInt32 q; + s = 1; - if ( a < 0 ) { a = -a; s = -1; } - if ( b < 0 ) { b = -b; s = -s; } + if ( a < 0 ) + { + a = -a; + s = -1; + } + if ( b < 0 ) + { + b = -b; + s = -s; + } if ( b == 0 ) /* check for division by 0 */ q = 0x7FFFFFFFL; else /* compute result directly */ - q = (FT_UInt32)( ( ( (FT_Int64)a << 16 ) + ( b >> 1 ) ) / b ); + q = (FT_UInt32)( ( ( (FT_UInt64)a << 16 ) + ( b >> 1 ) ) / b ); return ( s < 0 ? -(FT_Long)q : (FT_Long)q ); } @@ -392,8 +412,6 @@ } -#ifdef TT_USE_BYTECODE_INTERPRETER - FT_BASE_DEF( FT_Long ) FT_MulDiv_No_Round( FT_Long a, FT_Long b, @@ -426,8 +444,6 @@ return ( s < 0 ? -a : a ); } -#endif /* TT_USE_BYTECODE_INTERPRETER */ - /* documentation is in freetype.h */ @@ -552,7 +568,7 @@ else if ( ( a >> 16 ) == 0 ) { /* compute result directly */ - q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b; + q = (FT_UInt32)( ( (FT_ULong)a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b; } else { @@ -560,8 +576,8 @@ FT_Int64 temp, temp2; - temp.hi = (FT_Int32) ( a >> 16 ); - temp.lo = (FT_UInt32)( a << 16 ); + temp.hi = (FT_Int32)( a >> 16 ); + temp.lo = (FT_UInt32)a << 16; temp2.hi = 0; temp2.lo = (FT_UInt32)( b >> 1 ); FT_Add64( &temp, &temp2, &temp ); @@ -727,14 +743,14 @@ if ( !matrix ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* compute discriminant */ delta = FT_MulFix( matrix->xx, matrix->yy ) - FT_MulFix( matrix->xy, matrix->yx ); if ( !delta ) - return FT_Err_Invalid_Argument; /* matrix can't be inverted */ + return FT_THROW( Invalid_Argument ); /* matrix can't be inverted */ matrix->xy = - FT_DivFix( matrix->xy, delta ); matrix->yx = - FT_DivFix( matrix->yx, delta ); diff --git a/freetype/src/base/ftcid.c b/freetype/src/base/ftcid.c index 733aae147..741879d92 100644 --- a/freetype/src/base/ftcid.c +++ b/freetype/src/base/ftcid.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing CID font information. */ /* */ -/* Copyright 2007, 2009 by Derek Clegg, Michael Toftdal. */ +/* Copyright 2007, 2009, 2013 by Derek Clegg, Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -35,7 +35,7 @@ FT_Int s = 0; - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( face ) { @@ -65,7 +65,7 @@ FT_Get_CID_Is_Internally_CID_Keyed( FT_Face face, FT_Bool *is_cid ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); FT_Bool ic = 0; @@ -92,7 +92,7 @@ FT_UInt glyph_index, FT_UInt *cid ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); FT_UInt c = 0; diff --git a/freetype/src/base/ftdbgmem.c b/freetype/src/base/ftdbgmem.c index 12fed04bb..6fb86fe77 100644 --- a/freetype/src/base/ftdbgmem.c +++ b/freetype/src/base/ftdbgmem.c @@ -4,7 +4,7 @@ /* */ /* Memory debugger (body). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2009 by */ +/* Copyright 2001-2006, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -344,85 +344,80 @@ ft_mem_table_destroy( FT_MemTable table ) { FT_ULong i; + FT_Long leak_count = 0; + FT_ULong leaks = 0; FT_DumpMemory( table->memory ); - if ( table ) + /* remove all blocks from the table, revealing leaked ones */ + for ( i = 0; i < table->size; i++ ) { - FT_Long leak_count = 0; - FT_ULong leaks = 0; + FT_MemNode *pnode = table->buckets + i, next, node = *pnode; - /* remove all blocks from the table, revealing leaked ones */ - for ( i = 0; i < table->size; i++ ) + while ( node ) { - FT_MemNode *pnode = table->buckets + i, next, node = *pnode; + next = node->link; + node->link = 0; - - while ( node ) + if ( node->size > 0 ) { - next = node->link; - node->link = 0; - - if ( node->size > 0 ) - { - printf( - "leaked memory block at address %p, size %8ld in (%s:%ld)\n", - node->address, node->size, - FT_FILENAME( node->source->file_name ), - node->source->line_no ); + printf( + "leaked memory block at address %p, size %8ld in (%s:%ld)\n", + node->address, node->size, + FT_FILENAME( node->source->file_name ), + node->source->line_no ); - leak_count++; - leaks += node->size; + leak_count++; + leaks += node->size; - ft_mem_table_free( table, node->address ); - } + ft_mem_table_free( table, node->address ); + } - node->address = NULL; - node->size = 0; + node->address = NULL; + node->size = 0; - ft_mem_table_free( table, node ); - node = next; - } - table->buckets[i] = 0; + ft_mem_table_free( table, node ); + node = next; } + table->buckets[i] = 0; + } - ft_mem_table_free( table, table->buckets ); - table->buckets = NULL; - - table->size = 0; - table->nodes = 0; + ft_mem_table_free( table, table->buckets ); + table->buckets = NULL; - /* remove all sources */ - for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ ) - { - FT_MemSource source, next; + table->size = 0; + table->nodes = 0; + /* remove all sources */ + for ( i = 0; i < FT_MEM_SOURCE_BUCKETS; i++ ) + { + FT_MemSource source, next; - for ( source = table->sources[i]; source != NULL; source = next ) - { - next = source->link; - ft_mem_table_free( table, source ); - } - table->sources[i] = NULL; + for ( source = table->sources[i]; source != NULL; source = next ) + { + next = source->link; + ft_mem_table_free( table, source ); } - printf( - "FreeType: total memory allocations = %ld\n", table->alloc_total ); - printf( - "FreeType: maximum memory footprint = %ld\n", table->alloc_max ); + table->sources[i] = NULL; + } - ft_mem_table_free( table, table ); + printf( "FreeType: total memory allocations = %ld\n", + table->alloc_total ); + printf( "FreeType: maximum memory footprint = %ld\n", + table->alloc_max ); - if ( leak_count > 0 ) - ft_mem_debug_panic( - "FreeType: %ld bytes of memory leaked in %ld blocks\n", - leaks, leak_count ); + ft_mem_table_free( table, table ); - printf( "FreeType: no memory leaks detected\n" ); - } + if ( leak_count > 0 ) + ft_mem_debug_panic( + "FreeType: %ld bytes of memory leaked in %ld blocks\n", + leaks, leak_count ); + + printf( "FreeType: no memory leaks detected\n" ); } diff --git a/freetype/src/base/ftdebug.c b/freetype/src/base/ftdebug.c index 2adbeabeb..b9156d15e 100644 --- a/freetype/src/base/ftdebug.c +++ b/freetype/src/base/ftdebug.c @@ -4,7 +4,7 @@ /* */ /* Debugging and logging component (body). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2008 by */ +/* Copyright 1996-2001, 2002, 2004, 2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -51,7 +51,8 @@ /* documentation is in ftdebug.h */ FT_BASE_DEF( void ) - FT_Message( const char* fmt, ... ) + FT_Message( const char* fmt, + ... ) { va_list ap; @@ -65,7 +66,8 @@ /* documentation is in ftdebug.h */ FT_BASE_DEF( void ) - FT_Panic( const char* fmt, ... ) + FT_Panic( const char* fmt, + ... ) { va_list ap; @@ -77,6 +79,21 @@ exit( EXIT_FAILURE ); } + + /* documentation is in ftdebug.h */ + + FT_BASE_DEF( int ) + FT_Throw( FT_Error error, + int line, + const char* file ) + { + FT_UNUSED( error ); + FT_UNUSED( line ); + FT_UNUSED( file ); + + return 0; + } + #endif /* FT_DEBUG_LEVEL_ERROR */ @@ -164,6 +181,9 @@ while ( *p && *p != ':' ) p++; + if ( !*p ) + break; + if ( *p == ':' && p > q ) { FT_Int n, i, len = (FT_Int)( p - q ); @@ -192,7 +212,7 @@ p++; if ( *p ) { - level = *p++ - '0'; + level = *p - '0'; if ( level < 0 || level > 7 ) level = -1; } diff --git a/freetype/src/base/ftgloadr.c b/freetype/src/base/ftgloadr.c index 3a5615e5e..3cc5c7a80 100644 --- a/freetype/src/base/ftgloadr.c +++ b/freetype/src/base/ftgloadr.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph loader (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2010 by */ +/* Copyright 2002-2006, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,7 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_GLYPH_LOADER_H #include FT_INTERNAL_MEMORY_H #include FT_INTERNAL_OBJECTS_H @@ -219,7 +220,7 @@ new_max = FT_PAD_CEIL( new_max, 8 ); if ( new_max > FT_OUTLINE_POINTS_MAX ) - return FT_Err_Array_Too_Large; + return FT_THROW( Array_Too_Large ); if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) || FT_RENEW_ARRAY( base->tags, old_max, new_max ) ) @@ -251,7 +252,7 @@ new_max = FT_PAD_CEIL( new_max, 4 ); if ( new_max > FT_OUTLINE_CONTOURS_MAX ) - return FT_Err_Array_Too_Large; + return FT_THROW( Array_Too_Large ); if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) ) goto Exit; @@ -264,6 +265,9 @@ FT_GlyphLoader_Adjust_Points( loader ); Exit: + if ( error ) + FT_GlyphLoader_Reset( loader ); + return error; } diff --git a/freetype/src/base/ftglyph.c b/freetype/src/base/ftglyph.c index 7363c7dce..5dd28a8c5 100644 --- a/freetype/src/base/ftglyph.c +++ b/freetype/src/base/ftglyph.c @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (body). */ /* */ -/* Copyright 1996-2005, 2007, 2008, 2010, 2012 by */ +/* Copyright 1996-2005, 2007, 2008, 2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,8 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_GLYPH_H #include FT_OUTLINE_H #include FT_BITMAP_H @@ -65,7 +67,7 @@ if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) { - error = FT_Err_Invalid_Glyph_Format; + error = FT_THROW( Invalid_Glyph_Format ); goto Exit; } @@ -166,7 +168,7 @@ /* check format in glyph slot */ if ( slot->format != FT_GLYPH_FORMAT_OUTLINE ) { - error = FT_Err_Invalid_Glyph_Format; + error = FT_THROW( Invalid_Glyph_Format ); goto Exit; } @@ -314,7 +316,7 @@ /* check arguments */ if ( !target ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -322,7 +324,7 @@ if ( !source || !source->clazz ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -361,12 +363,12 @@ if ( !slot ) - return FT_Err_Invalid_Slot_Handle; + return FT_THROW( Invalid_Slot_Handle ); library = slot->library; if ( !aglyph ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* if it is a bitmap, that's easy :-) */ if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) @@ -388,7 +390,7 @@ if ( !clazz ) { - error = FT_Err_Invalid_Glyph_Format; + error = FT_THROW( Invalid_Glyph_Format ); goto Exit; } @@ -427,7 +429,7 @@ if ( !glyph || !glyph->clazz ) - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); else { clazz = glyph->clazz; @@ -441,7 +443,7 @@ FT_Vector_Transform( &glyph->advance, matrix ); } else - error = FT_Err_Invalid_Glyph_Format; + error = FT_THROW( Invalid_Glyph_Format ); } return error; } @@ -600,7 +602,7 @@ return error; Bad: - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } diff --git a/freetype/src/base/ftgxval.c b/freetype/src/base/ftgxval.c index aeeb8ce4f..a8ec44ac0 100644 --- a/freetype/src/base/ftgxval.c +++ b/freetype/src/base/ftgxval.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating TrueTyepGX/AAT tables (body). */ /* */ -/* Copyright 2004, 2005, 2006, 2010 by */ +/* Copyright 2004-2006, 2010, 2013 by */ /* Masatake YAMATO, Redhat K.K, */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -26,6 +26,8 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_GX_VALIDATE_H @@ -44,13 +46,13 @@ if ( !face ) { - error = FT_Err_Invalid_Face_Handle; + error = FT_THROW( Invalid_Face_Handle ); goto Exit; } if ( tables == NULL ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -62,7 +64,7 @@ tables, table_length ); else - error = FT_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); Exit: return error; @@ -96,13 +98,13 @@ if ( !face ) { - error = FT_Err_Invalid_Face_Handle; + error = FT_THROW( Invalid_Face_Handle ); goto Exit; } if ( ckern_table == NULL ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -113,7 +115,7 @@ validation_flags, ckern_table ); else - error = FT_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); Exit: return error; diff --git a/freetype/src/base/ftinit.c b/freetype/src/base/ftinit.c index 0d8b568be..85f321fd2 100644 --- a/freetype/src/base/ftinit.c +++ b/freetype/src/base/ftinit.c @@ -4,7 +4,7 @@ /* */ /* FreeType initialization layer (body). */ /* */ -/* Copyright 1996-2002, 2005, 2007, 2009, 2012 by */ +/* Copyright 1996-2002, 2005, 2007, 2009, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -166,7 +166,7 @@ pic_container->default_module_classes = 0; - if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * + if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * ( FT_NUM_MODULE_CLASSES + 1 ) ) ) return error; @@ -242,7 +242,7 @@ if ( !memory ) { FT_ERROR(( "FT_Init_FreeType: cannot find memory manager\n" )); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } /* build a library out of it, then fill it with the set of */ diff --git a/freetype/src/base/ftlcdfil.c b/freetype/src/base/ftlcdfil.c index 0da4ba160..852fb3298 100644 --- a/freetype/src/base/ftlcdfil.c +++ b/freetype/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for color filtering of subpixel bitmap glyphs (body). */ /* */ -/* Copyright 2006, 2008, 2009, 2010 by */ +/* Copyright 2006, 2008-2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,8 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_LCD_FILTER_H #include FT_IMAGE_H #include FT_INTERNAL_OBJECTS_H @@ -271,7 +273,7 @@ unsigned char *weights ) { if ( !library || !weights ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); ft_memcpy( library->lcd_weights, weights, 5 ); @@ -292,7 +294,7 @@ if ( !library ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); switch ( filter ) { @@ -339,7 +341,7 @@ #endif default: - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } library->lcd_filter = filter; @@ -356,7 +358,7 @@ FT_UNUSED( library ); FT_UNUSED( weights ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } @@ -367,7 +369,7 @@ FT_UNUSED( library ); FT_UNUSED( filter ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ diff --git a/freetype/src/base/ftmac.c b/freetype/src/base/ftmac.c index f2007485d..5b5aae61c 100644 --- a/freetype/src/base/ftmac.c +++ b/freetype/src/base/ftmac.c @@ -8,8 +8,7 @@ /* This file is for Mac OS X only; see builds/mac/ftoldmac.c for */ /* classic platforms built by MPW. */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, */ -/* 2009 by */ +/* Copyright 1996-2009, 2013 by */ /* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -131,7 +130,7 @@ FT_UNUSED( pathSpec ); FT_UNUSED( face_index ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } @@ -190,10 +189,10 @@ CFRelease( cf_fontName ); if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); if ( noErr != FT_ATSFontGetFileReference( ats_font_id, ats_font_ref ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); /* face_index calculation by searching preceding fontIDs */ /* with same FSRef */ @@ -229,11 +228,11 @@ err = FT_GetFileRef_From_Mac_ATS_Name( fontName, &ref, face_index ); - if ( FT_Err_Ok != err ) + if ( err ) return err; if ( noErr != FSRefMakePath( &ref, path, maxPathSize ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); return FT_Err_Ok; } @@ -251,19 +250,19 @@ FT_UNUSED( pathSpec ); FT_UNUSED( face_index ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); #else FSRef ref; FT_Error err; err = FT_GetFileRef_From_Mac_ATS_Name( fontName, &ref, face_index ); - if ( FT_Err_Ok != err ) + if ( err ) return err; if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, pathSpec, NULL ) ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); return FT_Err_Ok; #endif @@ -279,7 +278,7 @@ if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); /* at present, no support for dfont format */ err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res ); @@ -359,11 +358,9 @@ count_faces_scalable( char* fond_data ) { AsscEntry* assoc; - FamRec* fond; short i, face, face_all; - fond = (FamRec*)fond_data; face_all = EndianS16_BtoN( *( (short *)( fond_data + sizeof ( FamRec ) ) ) ) + 1; assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 ); @@ -508,17 +505,17 @@ /* We should not extract parent directory by string manipulation. */ if ( noErr != FSPathMakeRef( path_fond, &ref, FALSE ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, NULL, &par_ref ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( noErr != FSRefMakePath( &par_ref, path_lwfn, path_size ) ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* now we have absolute dirname in path_lwfn */ ft_strcat( (char *)path_lwfn, "/" ); @@ -527,11 +524,11 @@ path_lwfn[dirname_len + base_lwfn[0]] = '\0'; if ( noErr != FSPathMakeRef( path_lwfn, &ref, FALSE ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, NULL, NULL ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); return FT_Err_Ok; } @@ -557,7 +554,7 @@ { err = lookup_lwfn_by_fond( pathname, lwfn_file_name, buff, sizeof ( buff ) ); - if ( FT_Err_Ok == err ) + if ( !err ) have_lwfn = 1; } @@ -620,7 +617,7 @@ /* detect integer overflows */ if ( total_size < old_total_size ) { - error = FT_Err_Array_Too_Large; + error = FT_THROW( Array_Too_Large ); goto Error; } @@ -705,7 +702,7 @@ if ( noErr != FT_FSPathMakeRes( pathname, &res ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); pfb_data = NULL; pfb_size = 0; @@ -740,7 +737,7 @@ sfnt = GetResource( TTAG_sfnt, sfnt_id ); if ( sfnt == NULL ) - return FT_Err_Invalid_Handle; + return FT_THROW( Invalid_Handle ); sfnt_size = (FT_ULong)GetHandleSize( sfnt ); if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) ) @@ -797,23 +794,26 @@ FT_Long face_index, FT_Face* aface ) { - FT_Error error = FT_Err_Cannot_Open_Resource; + FT_Error error = FT_ERR( Cannot_Open_Resource ); ResFileRefNum res_ref; ResourceIndex res_index; Handle fond; - short num_faces_in_res, num_faces_in_fond; + short num_faces_in_res; if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); UseResFile( res_ref ); if ( ResError() ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); num_faces_in_res = 0; for ( res_index = 1; ; ++res_index ) { + short num_faces_in_fond; + + fond = Get1IndResource( TTAG_FOND, res_index ); if ( ResError() ) break; @@ -828,7 +828,7 @@ } CloseResFile( res_ref ); - if ( FT_Err_Ok == error && NULL != aface && NULL != *aface ) + if ( !error && aface && *aface ) (*aface)->num_faces = num_faces_in_res; return error; } @@ -854,7 +854,7 @@ GetResInfo( fond, &fond_id, &fond_type, fond_name ); if ( ResError() != noErr || fond_type != TTAG_FOND ) - return FT_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index ); @@ -883,7 +883,7 @@ error = lookup_lwfn_by_fond( path_fond, lwfn_file_name, path_lwfn, sizeof ( path_lwfn ) ); - if ( FT_Err_Ok == error ) + if ( !error ) have_lwfn = 1; } } @@ -894,10 +894,10 @@ face_index, aface ); else - error = FT_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); found_no_lwfn_file: - if ( have_sfnt && FT_Err_Ok != error ) + if ( have_sfnt && error ) error = FT_New_Face_From_SFNT( library, sfnt_id, face_index, @@ -961,7 +961,7 @@ /* test for valid `library' and `aface' delayed to FT_Open_Face() */ if ( !pathname ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); error = FT_Err_Ok; *aface = NULL; @@ -1003,11 +1003,11 @@ if ( !ref ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); err = FSRefMakePath( ref, pathname, sizeof ( pathname ) ); if ( err ) - error = FT_Err_Cannot_Open_Resource; + error = FT_THROW( Cannot_Open_Resource ); error = FT_New_Face_From_Resource( library, pathname, face_index, aface ); if ( error != 0 || *aface != NULL ) @@ -1043,13 +1043,13 @@ FT_UNUSED( face_index ); FT_UNUSED( aface ); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); #else FSRef ref; if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); else return FT_New_Face_From_FSRef( library, &ref, face_index, aface ); #endif diff --git a/freetype/src/base/ftmm.c b/freetype/src/base/ftmm.c index 030772981..18ff879bf 100644 --- a/freetype/src/base/ftmm.c +++ b/freetype/src/base/ftmm.c @@ -4,7 +4,7 @@ /* */ /* Multiple Master font support (body). */ /* */ -/* Copyright 1996-2001, 2003, 2004, 2009 by */ +/* Copyright 1996-2001, 2003, 2004, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,8 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_MULTIPLE_MASTERS_H #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_MULTIPLE_MASTERS_H @@ -42,9 +44,9 @@ *aservice = NULL; if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( FT_HAS_MULTIPLE_MASTERS( face ) ) { @@ -73,7 +75,7 @@ error = ft_face_get_mm_service( face, &service ); if ( !error ) { - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( service->get_mm ) error = service->get_mm( face, amaster ); } @@ -95,7 +97,7 @@ error = ft_face_get_mm_service( face, &service ); if ( !error ) { - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( service->get_mm_var ) error = service->get_mm_var( face, amaster ); } @@ -118,7 +120,7 @@ error = ft_face_get_mm_service( face, &service ); if ( !error ) { - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( service->set_mm_design ) error = service->set_mm_design( face, num_coords, coords ); } @@ -141,7 +143,7 @@ error = ft_face_get_mm_service( face, &service ); if ( !error ) { - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( service->set_var_design ) error = service->set_var_design( face, num_coords, coords ); } @@ -164,7 +166,7 @@ error = ft_face_get_mm_service( face, &service ); if ( !error ) { - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( service->set_mm_blend ) error = service->set_mm_blend( face, num_coords, coords ); } @@ -190,7 +192,7 @@ error = ft_face_get_mm_service( face, &service ); if ( !error ) { - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( service->set_mm_blend ) error = service->set_mm_blend( face, num_coords, coords ); } diff --git a/freetype/src/base/ftobjs.c b/freetype/src/base/ftobjs.c index 76ccf0a44..157bf4563 100644 --- a/freetype/src/base/ftobjs.c +++ b/freetype/src/base/ftobjs.c @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (body). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -41,6 +41,32 @@ #include "ftbase.h" #endif + +#ifdef FT_DEBUG_LEVEL_TRACE + +#include FT_BITMAP_H + +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + /* We disable the warning `conversion from XXX to YYY, */ + /* possible loss of data' in order to compile cleanly with */ + /* the maximum level of warnings: `md5.c' is non-FreeType */ + /* code, and it gets used during development builds only. */ +#pragma warning( push ) +#pragma warning( disable : 4244 ) +#endif /* _MSC_VER */ + + /* it's easiest to include `md5.c' directly */ +#define free md5_free /* suppress a shadow warning */ +#include "md5.c" +#undef free + +#if defined( _MSC_VER ) +#pragma warning( pop ) +#endif + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + #define GRID_FIT_METRICS @@ -137,10 +163,10 @@ *astream = 0; if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( !args ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); memory = library->memory; @@ -178,7 +204,7 @@ #endif else - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); if ( error ) FT_FREE( stream ); @@ -385,7 +411,7 @@ if ( !face || !face->driver ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); driver = face->driver; clazz = driver->clazz; @@ -575,7 +601,7 @@ if ( !face || !face->size || !face->glyph ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); /* The validity test for `glyph_index' is performed by the */ /* font drivers. */ @@ -815,7 +841,7 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); glyph_index = (FT_UInt)char_code; if ( face->charmap ) @@ -966,7 +992,7 @@ first = face->charmaps; if ( !first ) - return FT_Err_Invalid_CharMap_Handle; + return FT_THROW( Invalid_CharMap_Handle ); /* * The original TrueType specification(s) only specified charmap @@ -1044,7 +1070,7 @@ } } - return FT_Err_Invalid_CharMap_Handle; + return FT_THROW( Invalid_CharMap_Handle ); } @@ -1127,15 +1153,15 @@ if ( FT_ALLOC( face, clazz->face_object_size ) ) goto Fail; + face->driver = driver; + face->memory = memory; + face->stream = stream; + if ( FT_NEW( internal ) ) goto Fail; face->internal = internal; - face->driver = driver; - face->memory = memory; - face->stream = stream; - #ifdef FT_CONFIG_OPTION_INCREMENTAL { int i; @@ -1166,7 +1192,7 @@ /* is returned. */ /* no error should happen, but we want to play safe */ - if ( error2 && error2 != FT_Err_Invalid_CharMap_Handle ) + if ( error2 && FT_ERR_NEQ( error2, Invalid_CharMap_Handle ) ) { error = error2; goto Fail; @@ -1207,7 +1233,7 @@ /* test for valid `library' and `aface' delayed to FT_Open_Face() */ if ( !pathname ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); args.flags = FT_OPEN_PATHNAME; args.pathname = (char*)pathname; @@ -1233,7 +1259,7 @@ /* test for valid `library' and `face' delayed to FT_Open_Face() */ if ( !file_base ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); args.flags = FT_OPEN_MEMORY; args.memory_base = file_base; @@ -1305,10 +1331,10 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( !base ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); *astream = 0; memory = library->memory; @@ -1422,7 +1448,7 @@ if ( FT_READ_ULONG( tag ) ) return error; if ( tag != TTAG_typ1 ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); if ( FT_READ_USHORT( numTables ) ) return error; @@ -1459,7 +1485,7 @@ if ( face_index >= 0 && pstable_index == face_index ) return FT_Err_Ok; } - return FT_Err_Table_Missing; + return FT_THROW( Table_Missing ); } @@ -1505,7 +1531,7 @@ error = open_face_from_buffer( library, sfnt_ps, length, - face_index < 0 ? face_index : 0, + FT_MIN( face_index, 0 ), is_sfnt_cid ? "cid" : "type1", aface ); Exit: @@ -1513,7 +1539,7 @@ FT_Error error1; - if ( error == FT_Err_Unknown_File_Format ) + if ( FT_ERR_EQ( error, Unknown_File_Format ) ) { error1 = FT_Stream_Seek( stream, pos ); if ( error1 ) @@ -1541,7 +1567,7 @@ FT_Long face_index, FT_Face *aface ) { - FT_Error error = FT_Err_Cannot_Open_Resource; + FT_Error error = FT_ERR( Cannot_Open_Resource ); FT_Memory memory = library->memory; FT_Byte* pfb_data = NULL; int i, type, flags; @@ -1634,7 +1660,7 @@ pfb_data[pfb_pos++] = 0; } - error = FT_Err_Cannot_Open_Resource; + error = FT_ERR( Cannot_Open_Resource ); if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len ) goto Exit2; @@ -1696,7 +1722,7 @@ if ( face_index == -1 ) face_index = 0; if ( face_index >= resource_cnt ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); flag_offset = offsets[face_index]; error = FT_Stream_Seek( stream, flag_offset ); @@ -1706,7 +1732,7 @@ if ( FT_READ_LONG( rlen ) ) goto Exit; if ( rlen == -1 ) - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); error = open_face_PS_from_sfnt_stream( library, stream, @@ -1813,7 +1839,7 @@ if ( NULL == stream ) - return FT_Err_Invalid_Stream_Operation; + return FT_THROW( Invalid_Stream_Operation ); error = FT_Stream_Seek( stream, 0 ); if ( error ) @@ -1830,7 +1856,7 @@ header[ 1] > 33 || header[63] != 0 || header[2 + header[1]] != 0 ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); dlen = ( header[0x53] << 24 ) | ( header[0x54] << 16 ) | @@ -1863,7 +1889,7 @@ #define FT_COMPONENT trace_raccess FT_Memory memory = library->memory; - FT_Error error = FT_Err_Unknown_File_Format; + FT_Error error = FT_ERR( Unknown_File_Format ); int i; char * file_names[FT_RACCESS_N_RULES]; @@ -1902,7 +1928,7 @@ i, args2.pathname, offsets[i] )); error = FT_Stream_New( library, &args2, &stream2 ); - if ( is_darwin_vfs && error == FT_Err_Cannot_Open_Stream ) + if ( is_darwin_vfs && FT_ERR_EQ( error, Cannot_Open_Stream ) ) vfs_rfork_has_no_font = TRUE; if ( error ) @@ -1931,7 +1957,7 @@ /* Caller (load_mac_face) requires FT_Err_Unknown_File_Format. */ if ( error ) - error = FT_Err_Unknown_File_Format; + error = FT_ERR( Unknown_File_Format ); return error; @@ -1960,7 +1986,7 @@ error = IsMacBinary( library, stream, face_index, aface ); - if ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format ) + if ( FT_ERR_EQ( error, Unknown_File_Format ) ) { #undef FT_COMPONENT @@ -1977,9 +2003,9 @@ } - if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format || - FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation ) && - ( args->flags & FT_OPEN_PATHNAME ) ) + if ( ( FT_ERR_EQ( error, Unknown_File_Format ) || + FT_ERR_EQ( error, Invalid_Stream_Operation ) ) && + ( args->flags & FT_OPEN_PATHNAME ) ) error = load_face_in_embedded_rfork( library, stream, face_index, aface, args ); return error; @@ -1998,8 +2024,8 @@ FT_Face *aface ) { FT_Error error; - FT_Driver driver; - FT_Memory memory; + FT_Driver driver = NULL; + FT_Memory memory = NULL; FT_Stream stream = NULL; FT_Face face = NULL; FT_ListNode node = NULL; @@ -2012,7 +2038,7 @@ /* FT_Stream_New() */ if ( ( !aface && face_index >= 0 ) || !args ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); external_stream = FT_BOOL( ( args->flags & FT_OPEN_STREAM ) && args->stream ); @@ -2049,14 +2075,14 @@ goto Success; } else - error = FT_Err_Invalid_Handle; + error = FT_THROW( Invalid_Handle ); FT_Stream_Free( stream, external_stream ); goto Fail; } else { - error = FT_Err_Missing_Module; + error = FT_ERR( Missing_Module ); /* check each font driver for an appropriate format */ cur = library->modules; @@ -2086,7 +2112,7 @@ #ifdef FT_CONFIG_OPTION_MAC_FONTS if ( ft_strcmp( cur[0]->clazz->module_name, "truetype" ) == 0 && - FT_ERROR_BASE( error ) == FT_Err_Table_Missing ) + FT_ERR_EQ( error, Table_Missing ) ) { /* TrueType but essential tables are missing */ if ( FT_Stream_Seek( stream, 0 ) ) @@ -2106,7 +2132,7 @@ } #endif - if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format ) + if ( FT_ERR_NEQ( error, Unknown_File_Format ) ) goto Fail3; } } @@ -2115,9 +2141,9 @@ /* If we are on the mac, and we get an */ /* FT_Err_Invalid_Stream_Operation it may be because we have an */ /* empty data fork, so we need to check the resource fork. */ - if ( FT_ERROR_BASE( error ) != FT_Err_Cannot_Open_Stream && - FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format && - FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation ) + if ( FT_ERR_NEQ( error, Cannot_Open_Stream ) && + FT_ERR_NEQ( error, Unknown_File_Format ) && + FT_ERR_NEQ( error, Invalid_Stream_Operation ) ) goto Fail2; #if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS ) @@ -2133,12 +2159,12 @@ return error; } - if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format ) + if ( FT_ERR_NEQ( error, Unknown_File_Format ) ) goto Fail2; #endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */ /* no driver is able to handle this format */ - error = FT_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); Fail2: FT_Stream_Free( stream, external_stream ); @@ -2239,7 +2265,10 @@ goto Exit; Fail: - FT_Done_Face( face ); + if ( node ) + FT_Done_Face( face ); /* face must be in the driver's list */ + else if ( face ) + destroy_face( memory, face, driver ); Exit: FT_TRACE4(( "FT_Open_Face: Return %d\n", error )); @@ -2260,7 +2289,7 @@ /* test for valid `face' delayed to FT_Attach_Stream() */ if ( !filepathname ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); open.stream = NULL; open.flags = FT_OPEN_PATHNAME; @@ -2286,11 +2315,11 @@ /* test for valid `parameters' delayed to FT_Stream_New() */ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); driver = face->driver; if ( !driver ) - return FT_Err_Invalid_Driver_Handle; + return FT_THROW( Invalid_Driver_Handle ); error = FT_Stream_New( driver->root.library, parameters, &stream ); if ( error ) @@ -2299,7 +2328,7 @@ /* we implement FT_Attach_Stream in each driver through the */ /* `attach_file' interface */ - error = FT_Err_Unimplemented_Feature; + error = FT_ERR( Unimplemented_Feature ); clazz = driver->clazz; if ( clazz->attach_file ) error = clazz->attach_file( face, stream ); @@ -2336,7 +2365,7 @@ FT_ListNode node; - error = FT_Err_Invalid_Face_Handle; + error = FT_ERR( Invalid_Face_Handle ); if ( face && face->driver ) { face->internal->refcount--; @@ -2382,13 +2411,13 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); if ( !asize ) - return FT_Err_Invalid_Size_Handle; + return FT_THROW( Invalid_Size_Handle ); if ( !face->driver ) - return FT_Err_Invalid_Driver_Handle; + return FT_THROW( Invalid_Driver_Handle ); *asize = 0; @@ -2440,15 +2469,15 @@ if ( !size ) - return FT_Err_Invalid_Size_Handle; + return FT_THROW( Invalid_Size_Handle ); face = size->face; if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); driver = face->driver; if ( !driver ) - return FT_Err_Invalid_Driver_Handle; + return FT_THROW( Invalid_Driver_Handle ); memory = driver->root.memory; @@ -2469,7 +2498,7 @@ destroy_size( memory, size, driver ); } else - error = FT_Err_Invalid_Size_Handle; + error = FT_THROW( Invalid_Size_Handle ); return error; } @@ -2488,11 +2517,11 @@ if ( !FT_HAS_FIXED_SIZES( face ) ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); /* FT_Bitmap_Size doesn't provide enough info... */ if ( req->type != FT_SIZE_REQUEST_TYPE_NOMINAL ) - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); w = FT_REQUEST_WIDTH ( req ); h = FT_REQUEST_HEIGHT( req ); @@ -2515,6 +2544,8 @@ if ( w == FT_PIX_ROUND( bsize->x_ppem ) || ignore_width ) { + FT_TRACE3(( "FT_Match_Size: bitmap strike %d matches\n", i )); + if ( size_index ) *size_index = (FT_ULong)i; @@ -2522,7 +2553,7 @@ } } - return FT_Err_Invalid_Pixel_Size; + return FT_THROW( Invalid_Pixel_Size ); } @@ -2765,10 +2796,10 @@ if ( !face || !FT_HAS_FIXED_SIZES( face ) ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); if ( strike_index < 0 || strike_index >= face->num_fixed_sizes ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); clazz = face->driver->clazz; @@ -2818,11 +2849,11 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); if ( !req || req->width < 0 || req->height < 0 || req->type >= FT_SIZE_REQUEST_TYPE_MAX ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); clazz = face->driver->clazz; @@ -2871,9 +2902,6 @@ if ( error ) return error; - FT_TRACE3(( "FT_Request_Size: bitmap strike %lu matched\n", - strike_index )); - return FT_Select_Size( face, (FT_Int)strike_index ); } @@ -2973,10 +3001,10 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); if ( !akerning ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); driver = face->driver; @@ -3032,14 +3060,14 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); if ( !akerning ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); FT_FACE_FIND_SERVICE( face, service, KERNING ); if ( !service ) - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); error = service->get_track( face, point_size, @@ -3061,10 +3089,10 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); if ( encoding == FT_ENCODING_NONE ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* FT_ENCODING_UNICODE is special. We try to find the `best' Unicode */ /* charmap available, i.e., one with UCS-4 characters, if possible. */ @@ -3075,7 +3103,7 @@ cur = face->charmaps; if ( !cur ) - return FT_Err_Invalid_CharMap_Handle; + return FT_THROW( Invalid_CharMap_Handle ); limit = cur + face->num_charmaps; @@ -3097,7 +3125,7 @@ } } - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } @@ -3112,13 +3140,13 @@ if ( !face ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); cur = face->charmaps; if ( !cur ) - return FT_Err_Invalid_CharMap_Handle; + return FT_THROW( Invalid_CharMap_Handle ); if ( FT_Get_CMap_Format( charmap ) == 14 ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); limit = cur + face->num_charmaps; @@ -3139,7 +3167,7 @@ return 0; } } - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } @@ -3178,7 +3206,7 @@ { FT_CMap_Class clazz = cmap->clazz; FT_Face face = cmap->charmap.face; - FT_Memory memory = FT_FACE_MEMORY(face); + FT_Memory memory = FT_FACE_MEMORY( face ); if ( clazz->done ) @@ -3247,7 +3275,7 @@ if ( clazz == NULL || charmap == NULL || charmap->face == NULL ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); face = charmap->face; memory = FT_FACE_MEMORY( face ); @@ -3580,7 +3608,7 @@ FT_Pointer buffer, FT_UInt buffer_max ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); /* clean up buffer */ @@ -3669,11 +3697,11 @@ if ( !face || !FT_IS_SFNT( face ) ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE ); if ( service == NULL ) - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); return service->load_table( face, tag, offset, buffer, length ); } @@ -3692,11 +3720,11 @@ if ( !face || !FT_IS_SFNT( face ) ) - return FT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE ); if ( service == NULL ) - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); return service->table_info( face, table_index, tag, &offset, length ); } @@ -3759,11 +3787,11 @@ if ( size == NULL ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); face = size->face; if ( face == NULL || face->driver == NULL ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* we don't need anything more complex than that; all size objects */ /* are already listed by the face */ @@ -3955,15 +3983,15 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( !renderer ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); node = FT_List_Find( &library->renderers, renderer ); if ( !node ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -4021,12 +4049,12 @@ else renderer = FT_Lookup_Renderer( library, slot->format, &node ); - error = FT_Err_Unimplemented_Feature; + error = FT_ERR( Unimplemented_Feature ); while ( renderer ) { error = renderer->render( renderer, slot, render_mode, NULL ); - if ( !error || - FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph ) + if ( !error || + FT_ERR_NEQ( error, Cannot_Render_Glyph ) ) break; /* FT_Err_Cannot_Render_Glyph is returned if the render mode */ @@ -4046,6 +4074,47 @@ } } +#ifdef FT_DEBUG_LEVEL_TRACE + +#undef FT_COMPONENT +#define FT_COMPONENT trace_bitmap + + /* we convert to a single bitmap format for computing the checksum */ + { + FT_Bitmap bitmap; + FT_Error err; + + + FT_Bitmap_New( &bitmap ); + + err = FT_Bitmap_Convert( library, &slot->bitmap, &bitmap, 1 ); + if ( !err ) + { + MD5_CTX ctx; + unsigned char md5[16]; + int i; + + + MD5_Init( &ctx); + MD5_Update( &ctx, bitmap.buffer, bitmap.rows * bitmap.pitch ); + MD5_Final( md5, &ctx ); + + FT_TRACE3(( "MD5 checksum for %dx%d bitmap:\n" + " ", + bitmap.rows, bitmap.pitch )); + for ( i = 0; i < 16; i++ ) + FT_TRACE3(( "%02X", md5[i] )); + FT_TRACE3(( "\n" )); + } + + FT_Bitmap_Done( library, &bitmap ); + } + +#undef FT_COMPONENT +#define FT_COMPONENT trace_objs + +#endif /* FT_DEBUG_LEVEL_TRACE */ + return error; } @@ -4060,7 +4129,7 @@ if ( !slot || !slot->face ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); library = FT_FACE_LIBRARY( slot->face ); @@ -4140,14 +4209,14 @@ FREETYPE_MINOR ) if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( !clazz ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* check freetype version */ if ( clazz->module_requires > FREETYPE_VER_FIXED ) - return FT_Err_Invalid_Version; + return FT_THROW( Invalid_Version ); /* look for a module with the same name in the library's table */ for ( nn = 0; nn < library->num_modules; nn++ ) @@ -4157,7 +4226,7 @@ { /* this installed module has the same name, compare their versions */ if ( clazz->module_version <= module->clazz->module_version ) - return FT_Err_Lower_Module_Version; + return FT_THROW( Lower_Module_Version ); /* remove the module from our list, then exit the loop to replace */ /* it by our new version.. */ @@ -4171,7 +4240,7 @@ if ( library->num_modules >= FT_MAX_MODULES ) { - error = FT_Err_Too_Many_Drivers; + error = FT_THROW( Too_Many_Drivers ); goto Exit; } @@ -4242,7 +4311,8 @@ FT_Renderer renderer = FT_RENDERER( module ); - if ( renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE && + if ( renderer->clazz && + renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE && renderer->raster ) renderer->clazz->raster_class->raster_done( renderer->raster ); } @@ -4350,7 +4420,7 @@ /* try to find the module from the table, then remove it from there */ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( module ) { @@ -4379,7 +4449,7 @@ } } } - return FT_Err_Invalid_Driver_Handle; + return FT_THROW( Invalid_Driver_Handle ); } @@ -4406,10 +4476,10 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( !module_name || !property_name || !value ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); cur = library->modules; limit = cur + library->num_modules; @@ -4423,7 +4493,7 @@ { FT_ERROR(( "%s: can't find module `%s'\n", func_name, module_name )); - return FT_Err_Missing_Module; + return FT_THROW( Missing_Module ); } /* check whether we have a service interface */ @@ -4431,7 +4501,7 @@ { FT_ERROR(( "%s: module `%s' doesn't support properties\n", func_name, module_name )); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } /* search property service */ @@ -4441,21 +4511,21 @@ { FT_ERROR(( "%s: module `%s' doesn't support properties\n", func_name, module_name )); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } service = (FT_Service_Properties)interface; if ( set ) - missing_func = !service->set_property; + missing_func = (FT_Bool)( !service->set_property ); else - missing_func = !service->get_property; + missing_func = (FT_Bool)( !service->get_property ); if ( missing_func ) { FT_ERROR(( "%s: property service of module `%s' is broken\n", func_name, module_name )); - return FT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } return set ? service->set_property( cur[0], property_name, value ) @@ -4465,7 +4535,7 @@ /* documentation is in ftmodapi.h */ - FT_Error + FT_EXPORT_DEF( FT_Error ) FT_Property_Set( FT_Library library, const FT_String* module_name, const FT_String* property_name, @@ -4481,7 +4551,7 @@ /* documentation is in ftmodapi.h */ - FT_Error + FT_EXPORT_DEF( FT_Error ) FT_Property_Get( FT_Library library, const FT_String* module_name, const FT_String* property_name, @@ -4530,7 +4600,7 @@ if ( !memory ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); #ifdef FT_DEBUG_LEVEL_ERROR /* init debugging support */ @@ -4617,7 +4687,7 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); library->refcount--; if ( library->refcount > 0 ) @@ -4764,70 +4834,6 @@ } -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_BASE_DEF( FT_Error ) - ft_stub_set_char_sizes( FT_Size size, - FT_F26Dot6 width, - FT_F26Dot6 height, - FT_UInt horz_res, - FT_UInt vert_res ) - { - FT_Size_RequestRec req; - FT_Driver driver = size->face->driver; - - - if ( driver->clazz->request_size ) - { - req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; - req.width = width; - req.height = height; - - if ( horz_res == 0 ) - horz_res = vert_res; - - if ( vert_res == 0 ) - vert_res = horz_res; - - if ( horz_res == 0 ) - horz_res = vert_res = 72; - - req.horiResolution = horz_res; - req.vertResolution = vert_res; - - return driver->clazz->request_size( size, &req ); - } - - return 0; - } - - - FT_BASE_DEF( FT_Error ) - ft_stub_set_pixel_sizes( FT_Size size, - FT_UInt width, - FT_UInt height ) - { - FT_Size_RequestRec req; - FT_Driver driver = size->face->driver; - - - if ( driver->clazz->request_size ) - { - req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; - req.width = width << 6; - req.height = height << 6; - req.horiResolution = 0; - req.vertResolution = 0; - - return driver->clazz->request_size( size, &req ); - } - - return 0; - } - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /* documentation is in freetype.h */ FT_EXPORT_DEF( FT_Error ) @@ -4839,7 +4845,7 @@ FT_Int *p_arg2, FT_Matrix *p_transform ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); if ( glyph && diff --git a/freetype/src/base/ftotval.c b/freetype/src/base/ftotval.c index 694fd2b87..5fc73d76a 100644 --- a/freetype/src/base/ftotval.c +++ b/freetype/src/base/ftotval.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for validating OpenType tables (body). */ /* */ -/* Copyright 2004, 2006, 2008, 2010 by */ +/* Copyright 2004, 2006, 2008, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,6 +16,8 @@ /***************************************************************************/ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_OPENTYPE_VALIDATE_H #include FT_OPENTYPE_VALIDATE_H @@ -38,7 +40,7 @@ if ( !face ) { - error = FT_Err_Invalid_Face_Handle; + error = FT_THROW( Invalid_Face_Handle ); goto Exit; } @@ -48,7 +50,7 @@ GSUB_table && JSTF_table ) ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -63,7 +65,7 @@ GSUB_table, JSTF_table ); else - error = FT_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); Exit: return error; diff --git a/freetype/src/base/ftoutln.c b/freetype/src/base/ftoutln.c index c4fd2660a..54ca5cdcf 100644 --- a/freetype/src/base/ftoutln.c +++ b/freetype/src/base/ftoutln.c @@ -4,7 +4,7 @@ /* */ /* FreeType outline management (body). */ /* */ -/* Copyright 1996-2008, 2010, 2012 by */ +/* Copyright 1996-2008, 2010, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,6 +26,7 @@ #include <ft2build.h> #include FT_OUTLINE_H #include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_CALC_H #include FT_INTERNAL_DEBUG_H #include FT_TRIGONOMETRY_H @@ -73,7 +74,7 @@ if ( !outline || !func_interface ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); shift = func_interface->shift; delta = func_interface->delta; @@ -286,7 +287,7 @@ return error; Invalid_Outline: - return FT_Err_Invalid_Outline; + return FT_THROW( Invalid_Outline ); } @@ -300,10 +301,17 @@ if ( !anoutline || !memory ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); *anoutline = null_outline; + if ( numContours < 0 || + (FT_UInt)numContours > numPoints ) + return FT_THROW( Invalid_Argument ); + + if ( numPoints > FT_OUTLINE_POINTS_MAX ) + return FT_THROW( Array_Too_Large ); + if ( FT_NEW_ARRAY( anoutline->points, numPoints ) || FT_NEW_ARRAY( anoutline->tags, numPoints ) || FT_NEW_ARRAY( anoutline->contours, numContours ) ) @@ -332,7 +340,7 @@ FT_Outline *anoutline ) { if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); return FT_Outline_New_Internal( library->memory, numPoints, numContours, anoutline ); @@ -380,7 +388,7 @@ } Bad: - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } @@ -396,7 +404,7 @@ if ( !source || !target || source->n_points != target->n_points || source->n_contours != target->n_contours ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( source == target ) return FT_Err_Ok; @@ -435,7 +443,7 @@ return FT_Err_Ok; } else - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } @@ -448,7 +456,7 @@ /* check for valid `outline' in FT_Outline_Done_Internal() */ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); return FT_Outline_Done_Internal( library->memory, outline ); } @@ -602,21 +610,21 @@ if ( !library ) - return FT_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); if ( !outline || !params ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); renderer = library->cur_renderer; node = library->renderers.head; params->source = (void*)outline; - error = FT_Err_Cannot_Render_Glyph; + error = FT_ERR( Cannot_Render_Glyph ); while ( renderer ) { error = renderer->raster_render( renderer->raster, params ); - if ( !error || FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph ) + if ( !error || FT_ERR_NEQ( error, Cannot_Render_Glyph ) ) break; /* FT_Err_Cannot_Render_Glyph is returned if the render mode */ @@ -650,7 +658,7 @@ if ( !abitmap ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* other checks are delayed to FT_Outline_Render() */ @@ -900,7 +908,7 @@ if ( !outline ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); xstrength /= 2; ystrength /= 2; @@ -911,7 +919,7 @@ if ( orientation == FT_ORIENTATION_NONE ) { if ( outline->n_contours ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); else return FT_Err_Ok; } @@ -930,10 +938,15 @@ v_prev = points[last]; v_cur = v_first; - /* compute the incoming vector and its length */ + /* compute incoming normalized vector */ in.x = v_cur.x - v_prev.x; in.y = v_cur.y - v_prev.y; l_in = FT_Vector_Length( &in ); + if ( l_in ) + { + in.x = FT_DivFix( in.x, l_in ); + in.y = FT_DivFix( in.y, l_in ); + } for ( n = first; n <= last; n++ ) { @@ -942,39 +955,48 @@ else v_next = v_first; - /* compute the outgoing vector and its length */ + /* compute outgoing normalized vector */ out.x = v_next.x - v_cur.x; out.y = v_next.y - v_cur.y; l_out = FT_Vector_Length( &out ); + if ( l_out ) + { + out.x = FT_DivFix( out.x, l_out ); + out.y = FT_DivFix( out.y, l_out ); + } - d = l_in * l_out + in.x * out.x + in.y * out.y; + d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y ); - /* shift only if turn is less then ~160 degrees */ - if ( 16 * d > l_in * l_out ) + /* shift only if turn is less than ~160 degrees */ + if ( d > -0xF000L ) { - /* shift components are aligned along bisector */ - /* and directed according to the outline orientation. */ - shift.x = l_out * in.y + l_in * out.y; - shift.y = l_out * in.x + l_in * out.x; + d = d + 0x10000L; + + /* shift components are aligned along lateral bisector */ + /* and directed according to the outline orientation. */ + shift.x = in.y + out.y; + shift.y = in.x + out.x; if ( orientation == FT_ORIENTATION_TRUETYPE ) shift.x = -shift.x; else shift.y = -shift.y; - /* threshold strength to better handle collapsing segments */ - l = FT_MIN( l_in, l_out ); - q = out.x * in.y - out.y * in.x; + /* restrict shift magnitude to better handle collapsing segments */ + q = FT_MulFix( out.x, in.y ) - FT_MulFix( out.y, in.x ); if ( orientation == FT_ORIENTATION_TRUETYPE ) q = -q; - if ( FT_MulDiv( xstrength, q, l ) < d ) + l = FT_MIN( l_in, l_out ); + + /* non-strict inequalities avoid divide-by-zero when q == l == 0 */ + if ( FT_MulFix( xstrength, q ) <= FT_MulFix( d, l ) ) shift.x = FT_MulDiv( shift.x, xstrength, d ); else shift.x = FT_MulDiv( shift.x, l, q ); - - if ( FT_MulDiv( ystrength, q, l ) < d ) + + if ( FT_MulFix( ystrength, q ) <= FT_MulFix( d, l ) ) shift.y = FT_MulDiv( shift.y, ystrength, d ); else shift.y = FT_MulDiv( shift.y, l, q ); @@ -1002,6 +1024,8 @@ FT_EXPORT_DEF( FT_Orientation ) FT_Outline_Get_Orientation( FT_Outline* outline ) { + FT_BBox cbox; + FT_Int xshift, yshift; FT_Vector* points; FT_Vector v_prev, v_cur; FT_Int c, n, first; @@ -1016,6 +1040,14 @@ /* cubic or quadratic curves, this test deals with the polygon */ /* only which is spanned up by the control points. */ + FT_Outline_Get_CBox( outline, &cbox ); + + xshift = FT_MSB( FT_ABS( cbox.xMax ) | FT_ABS( cbox.xMin ) ) - 14; + xshift = FT_MAX( xshift, 0 ); + + yshift = FT_MSB( cbox.yMax - cbox.yMin ) - 14; + yshift = FT_MAX( yshift, 0 ); + points = outline->points; first = 0; @@ -1029,7 +1061,8 @@ for ( n = first; n <= last; n++ ) { v_cur = points[n]; - area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ); + area += ( ( v_cur.y - v_prev.y ) >> yshift ) * + ( ( v_cur.x + v_prev.x ) >> xshift ); v_prev = v_cur; } diff --git a/freetype/src/base/ftpfr.c b/freetype/src/base/ftpfr.c index 3a0f92d07..0ba955f01 100644 --- a/freetype/src/base/ftpfr.c +++ b/freetype/src/base/ftpfr.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for accessing PFR-specific data (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2008, 2010 by */ +/* Copyright 2002-2004, 2008, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,6 +16,8 @@ /***************************************************************************/ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H + #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_PFR_H @@ -48,7 +50,7 @@ if ( !face ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); service = ft_pfr_check( face ); if ( service ) @@ -84,7 +86,7 @@ if ( ametrics_y_scale ) *ametrics_y_scale = y_scale; - error = FT_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); } return error; @@ -104,7 +106,7 @@ if ( !face ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); service = ft_pfr_check( face ); if ( service ) @@ -135,7 +137,7 @@ } else /* XXX: TODO: PROVIDE ADVANCE-LOADING METHOD TO ALL FONT DRIVERS */ - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); return error; } diff --git a/freetype/src/base/ftrfork.c b/freetype/src/base/ftrfork.c index dcefdd28d..804911721 100644 --- a/freetype/src/base/ftrfork.c +++ b/freetype/src/base/ftrfork.c @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (body). */ /* */ -/* Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2004-2010, 2013 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are */ @@ -86,7 +86,7 @@ /* map_len = head[12] .. head[15] */ if ( *rdata_pos + rdata_len != map_pos || map_pos == rfork_offset ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); error = FT_Stream_Seek( stream, map_pos ); if ( error ) @@ -108,7 +108,7 @@ allmatch = 0; } if ( !allzeros && !allmatch ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); /* If we have reached this point then it is probably a mac resource */ /* file. Now, does it contain any interesting resources? */ @@ -121,7 +121,7 @@ if ( FT_READ_USHORT( type_list ) ) return error; if ( type_list == -1 ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); error = FT_Stream_Seek( stream, map_pos + type_list ); if ( error ) @@ -233,7 +233,7 @@ } } - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); } @@ -435,7 +435,7 @@ *result_file_name = NULL; if ( NULL == stream ) - return FT_Err_Cannot_Open_Stream; + return FT_THROW( Cannot_Open_Stream ); return raccess_guess_apple_generic( library, stream, base_file_name, magic, result_offset ); @@ -457,7 +457,7 @@ *result_file_name = NULL; if ( NULL == stream ) - return FT_Err_Cannot_Open_Stream; + return FT_THROW( Cannot_Open_Stream ); return raccess_guess_apple_generic( library, stream, base_file_name, magic, result_offset ); @@ -481,7 +481,7 @@ memory = library->memory; newpath = raccess_make_file_name( memory, base_file_name, "._" ); if ( !newpath ) - return FT_Err_Out_Of_Memory; + return FT_THROW( Out_Of_Memory ); error = raccess_guess_linux_double_from_file_name( library, newpath, result_offset ); @@ -507,7 +507,7 @@ FT_Error error; char* newpath = NULL; FT_Memory memory; - FT_Long base_file_len = ft_strlen( base_file_name ); + FT_Long base_file_len = (FT_Long)ft_strlen( base_file_name ); FT_UNUSED( stream ); @@ -515,7 +515,7 @@ memory = library->memory; if ( base_file_len + 6 > FT_INT_MAX ) - return FT_Err_Array_Too_Large; + return FT_THROW( Array_Too_Large ); if ( FT_ALLOC( newpath, base_file_len + 6 ) ) return error; @@ -543,7 +543,7 @@ FT_Error error; char* newpath = NULL; FT_Memory memory; - FT_Long base_file_len = ft_strlen( base_file_name ); + FT_Long base_file_len = (FT_Long)ft_strlen( base_file_name ); FT_UNUSED( stream ); @@ -551,7 +551,7 @@ memory = library->memory; if ( base_file_len + 18 > FT_INT_MAX ) - return FT_Err_Array_Too_Large; + return FT_THROW( Array_Too_Large ); if ( FT_ALLOC( newpath, base_file_len + 18 ) ) return error; @@ -584,7 +584,7 @@ newpath = raccess_make_file_name( memory, base_file_name, "resource.frk/" ); if ( !newpath ) - return FT_Err_Out_Of_Memory; + return FT_THROW( Out_Of_Memory ); *result_file_name = newpath; *result_offset = 0; @@ -610,7 +610,7 @@ newpath = raccess_make_file_name( memory, base_file_name, ".resource/" ); if ( !newpath ) - return FT_Err_Out_Of_Memory; + return FT_THROW( Out_Of_Memory ); *result_file_name = newpath; *result_offset = 0; @@ -637,7 +637,7 @@ newpath = raccess_make_file_name( memory, base_file_name, "%" ); if ( !newpath ) - return FT_Err_Out_Of_Memory; + return FT_THROW( Out_Of_Memory ); error = raccess_guess_linux_double_from_file_name( library, newpath, result_offset ); @@ -669,7 +669,7 @@ newpath = raccess_make_file_name( memory, base_file_name, ".AppleDouble/" ); if ( !newpath ) - return FT_Err_Out_Of_Memory; + return FT_THROW( Out_Of_Memory ); error = raccess_guess_linux_double_from_file_name( library, newpath, result_offset ); @@ -708,7 +708,7 @@ if ( FT_READ_LONG( magic_from_stream ) ) return error; if ( magic_from_stream != magic ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); if ( FT_READ_LONG( version_number ) ) return error; @@ -721,7 +721,7 @@ if ( FT_READ_USHORT( n_of_entries ) ) return error; if ( n_of_entries == 0 ) - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); for ( i = 0; i < n_of_entries; i++ ) { @@ -744,7 +744,7 @@ } } - return FT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); } @@ -838,7 +838,7 @@ { new_names[i] = NULL; offsets[i] = 0; - errors[i] = FT_Err_Unimplemented_Feature; + errors[i] = FT_ERR( Unimplemented_Feature ); } } diff --git a/freetype/src/base/ftsnames.c b/freetype/src/base/ftsnames.c index 3447888ca..260e91c14 100644 --- a/freetype/src/base/ftsnames.c +++ b/freetype/src/base/ftsnames.c @@ -44,7 +44,7 @@ FT_UInt idx, FT_SfntName *aname ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); if ( aname && face && FT_IS_SFNT( face ) ) diff --git a/freetype/src/base/ftstream.c b/freetype/src/base/ftstream.c index fc2868e8d..d965333da 100644 --- a/freetype/src/base/ftstream.c +++ b/freetype/src/base/ftstream.c @@ -4,7 +4,7 @@ /* */ /* I/O stream support (body). */ /* */ -/* Copyright 2000-2002, 2004-2006, 2008-2011 by */ +/* Copyright 2000-2002, 2004-2006, 2008-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -68,7 +68,7 @@ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", pos, stream->size )); - error = FT_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); } } /* note that seeking to the first position after the file is valid */ @@ -78,7 +78,7 @@ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", pos, stream->size )); - error = FT_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); } if ( !error ) @@ -93,7 +93,7 @@ FT_Long distance ) { if ( distance < 0 ) - return FT_Err_Invalid_Stream_Operation; + return FT_THROW( Invalid_Stream_Operation ); return FT_Stream_Seek( stream, (FT_ULong)( stream->pos + distance ) ); } @@ -131,7 +131,7 @@ " invalid i/o; pos = 0x%lx, size = 0x%lx\n", pos, stream->size )); - return FT_Err_Invalid_Stream_Operation; + return FT_THROW( Invalid_Stream_Operation ); } if ( stream->read ) @@ -153,7 +153,7 @@ " invalid read; expected %lu bytes, got %lu\n", count, read_bytes )); - error = FT_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); } return error; @@ -254,7 +254,7 @@ " frame size (%lu) larger than stream size (%lu)\n", count, stream->size )); - error = FT_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); goto Exit; } @@ -277,7 +277,7 @@ count, read_bytes )); FT_FREE( stream->base ); - error = FT_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); } stream->cursor = stream->base; stream->limit = stream->cursor + count; @@ -293,7 +293,7 @@ " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx\n", stream->pos, count, stream->size )); - error = FT_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); goto Exit; } @@ -474,7 +474,7 @@ return result; Fail: - *error = FT_Err_Invalid_Stream_Operation; + *error = FT_THROW( Invalid_Stream_Operation ); FT_ERROR(( "FT_Stream_ReadChar:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -521,7 +521,7 @@ return result; Fail: - *error = FT_Err_Invalid_Stream_Operation; + *error = FT_THROW( Invalid_Stream_Operation ); FT_ERROR(( "FT_Stream_ReadUShort:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -568,7 +568,7 @@ return result; Fail: - *error = FT_Err_Invalid_Stream_Operation; + *error = FT_THROW( Invalid_Stream_Operation ); FT_ERROR(( "FT_Stream_ReadUShortLE:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -615,7 +615,7 @@ return result; Fail: - *error = FT_Err_Invalid_Stream_Operation; + *error = FT_THROW( Invalid_Stream_Operation ); FT_ERROR(( "FT_Stream_ReadUOffset:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -662,7 +662,7 @@ return result; Fail: - *error = FT_Err_Invalid_Stream_Operation; + *error = FT_THROW( Invalid_Stream_Operation ); FT_ERROR(( "FT_Stream_ReadULong:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -709,7 +709,7 @@ return result; Fail: - *error = FT_Err_Invalid_Stream_Operation; + *error = FT_THROW( Invalid_Stream_Operation ); FT_ERROR(( "FT_Stream_ReadULongLE:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -727,8 +727,9 @@ FT_Bool frame_accessed = 0; FT_Byte* cursor; + if ( !fields || !stream ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); cursor = stream->cursor; @@ -760,7 +761,7 @@ if ( cursor + len > stream->limit ) { - error = FT_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); goto Exit; } @@ -776,43 +777,43 @@ case ft_frame_byte: case ft_frame_schar: /* read a single byte */ - value = FT_NEXT_BYTE(cursor); + value = FT_NEXT_BYTE( cursor ); sign_shift = 24; break; case ft_frame_short_be: case ft_frame_ushort_be: /* read a 2-byte big-endian short */ - value = FT_NEXT_USHORT(cursor); + value = FT_NEXT_USHORT( cursor) ; sign_shift = 16; break; case ft_frame_short_le: case ft_frame_ushort_le: /* read a 2-byte little-endian short */ - value = FT_NEXT_USHORT_LE(cursor); + value = FT_NEXT_USHORT_LE( cursor ); sign_shift = 16; break; case ft_frame_long_be: case ft_frame_ulong_be: /* read a 4-byte big-endian long */ - value = FT_NEXT_ULONG(cursor); + value = FT_NEXT_ULONG( cursor ); sign_shift = 0; break; case ft_frame_long_le: case ft_frame_ulong_le: /* read a 4-byte little-endian long */ - value = FT_NEXT_ULONG_LE(cursor); + value = FT_NEXT_ULONG_LE( cursor ); sign_shift = 0; break; case ft_frame_off3_be: case ft_frame_uoff3_be: /* read a 3-byte big-endian long */ - value = FT_NEXT_UOFF3(cursor); + value = FT_NEXT_UOFF3( cursor ); sign_shift = 8; break; case ft_frame_off3_le: case ft_frame_uoff3_le: /* read a 3-byte little-endian long */ - value = FT_NEXT_UOFF3_LE(cursor); + value = FT_NEXT_UOFF3_LE( cursor ); sign_shift = 8; break; @@ -831,15 +832,15 @@ p = (FT_Byte*)structure + fields->offset; switch ( fields->size ) { - case (8 / FT_CHAR_BIT): + case ( 8 / FT_CHAR_BIT ): *(FT_Byte*)p = (FT_Byte)value; break; - case (16 / FT_CHAR_BIT): + case ( 16 / FT_CHAR_BIT ): *(FT_UShort*)p = (FT_UShort)value; break; - case (32 / FT_CHAR_BIT): + case ( 32 / FT_CHAR_BIT ): *(FT_UInt32*)p = (FT_UInt32)value; break; diff --git a/freetype/src/base/ftstroke.c b/freetype/src/base/ftstroke.c index fd6a0c10b..ee61ceca0 100644 --- a/freetype/src/base/ftstroke.c +++ b/freetype/src/base/ftstroke.c @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (body). */ /* */ -/* Copyright 2002-2006, 2008-2011 by */ +/* Copyright 2002-2006, 2008-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -795,7 +795,7 @@ if ( !library ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); memory = library->memory; @@ -1954,7 +1954,7 @@ if ( !stroker || border > 1 ) { - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -2060,7 +2060,7 @@ if ( !outline || !stroker ) - return FT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); FT_Stroker_Rewind( stroker ); @@ -2238,7 +2238,7 @@ return error; Invalid_Outline: - return FT_Err_Invalid_Outline; + return FT_THROW( Invalid_Outline ); } @@ -2258,7 +2258,7 @@ FT_Stroker stroker, FT_Bool destroy ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); FT_Glyph glyph = NULL; FT_Library library = stroker->library; @@ -2334,7 +2334,7 @@ FT_Bool inside, FT_Bool destroy ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); FT_Glyph glyph = NULL; FT_Library library = stroker->library; diff --git a/freetype/src/base/ftsystem.c b/freetype/src/base/ftsystem.c index 7e203bef8..2c6ddac10 100644 --- a/freetype/src/base/ftsystem.c +++ b/freetype/src/base/ftsystem.c @@ -4,7 +4,7 @@ /* */ /* ANSI-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2002, 2006, 2008-2011 by */ +/* Copyright 1996-2002, 2006, 2008-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -228,7 +228,7 @@ if ( !stream ) - return FT_Err_Invalid_Stream_Handle; + return FT_THROW( Invalid_Stream_Handle ); stream->descriptor.pointer = NULL; stream->pathname.pointer = (char*)filepathname; @@ -243,7 +243,7 @@ FT_ERROR(( "FT_Stream_Open:" " could not open `%s'\n", filepathname )); - return FT_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); } ft_fseek( file, 0, SEEK_END ); @@ -253,7 +253,7 @@ FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " opened `%s' but zero-sized\n", filepathname )); ft_fclose( file ); - return FT_Err_Cannot_Open_Stream; + return FT_THROW( Cannot_Open_Stream ); } ft_fseek( file, 0, SEEK_SET ); diff --git a/freetype/src/base/fttrigon.c b/freetype/src/base/fttrigon.c index 52395388b..4ffdcb77f 100644 --- a/freetype/src/base/fttrigon.c +++ b/freetype/src/base/fttrigon.c @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (body). */ /* */ -/* Copyright 2001-2005, 2012 by */ +/* Copyright 2001-2005, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -15,31 +15,41 @@ /* */ /***************************************************************************/ + /*************************************************************************/ + /* */ + /* This is a fixed-point CORDIC implementation of trigonometric */ + /* functions as well as transformations between Cartesian and polar */ + /* coordinates. The angles are represented as 16.16 fixed-point values */ + /* in degrees, i.e., the angular resolution is 2^-16 degrees. Note that */ + /* only vectors longer than 2^16*180/pi (or at least 22 bits) on a */ + /* discrete Cartesian grid can have the same or better angular */ + /* resolution. Therefore, to maintain this precision, some functions */ + /* require an interim upscaling of the vectors, whereas others operate */ + /* with 24-bit long vectors directly. */ + /* */ + /*************************************************************************/ #include <ft2build.h> #include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_CALC_H #include FT_TRIGONOMETRY_H -#ifdef FT_LONG64 - typedef FT_INT64 FT_Int64; -#endif - - - /* the Cordic shrink factor 0.607252935008887 * 2^32 */ -#define FT_TRIG_SCALE 0x9B74EDA8UL + /* the Cordic shrink factor 0.858785336480436 * 2^32 */ +#define FT_TRIG_SCALE 0xDBD95B16UL - /* the following is 0.607252935008887 * 2^30 */ -#define FT_TRIG_COSCALE 0x26DD3B6AUL + /* the highest bit in overflow-safe vector components, */ + /* MSB of 0.858785336480436 * sqrt(0.5) * 2^30 */ +#define FT_TRIG_SAFE_MSB 29 /* this table was generated for FT_PI = 180L << 16, i.e. degrees */ #define FT_TRIG_MAX_ITERS 23 static const FT_Fixed - ft_trig_arctan_table[23] = + ft_trig_arctan_table[] = { - 2949120L, 1740967L, 919879L, 466945L, 234379L, 117304L, 58666L, - 29335L, 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L, + 1740967L, 919879L, 466945L, 234379L, 117304L, 58666L, 29335L, + 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L, 57L, 29L, 14L, 7L, 4L, 2L, 1L }; @@ -55,7 +65,7 @@ s = val; - val = ( val >= 0 ) ? val : -val; + val = FT_ABS( val ); v = ( val * (FT_Int64)FT_TRIG_SCALE ) + 0x100000000UL; val = (FT_Fixed)( v >> 32 ); @@ -74,7 +84,7 @@ s = val; - val = ( val >= 0 ) ? val : -val; + val = FT_ABS( val ); v1 = (FT_UInt32)val >> 16; v2 = (FT_UInt32)( val & 0xFFFFL ); @@ -86,7 +96,7 @@ lo1 = k1 * v2 + k2 * v1; /* can't overflow */ lo2 = ( k2 * v2 ) >> 16; - lo3 = ( lo1 >= lo2 ) ? lo1 : lo2; + lo3 = FT_MAX( lo1, lo2 ); lo1 += lo2; hi += lo1 >> 16; @@ -104,85 +114,29 @@ static FT_Int ft_trig_prenorm( FT_Vector* vec ) { - FT_Fixed x, y, z; - FT_Int shift; + FT_Pos x, y; + FT_Int shift; x = vec->x; y = vec->y; - z = ( ( x >= 0 ) ? x : - x ) | ( (y >= 0) ? y : -y ); - shift = 0; - -#if 1 - /* determine msb bit index in `shift' */ - if ( z >= ( 1L << 16 ) ) - { - z >>= 16; - shift += 16; - } - if ( z >= ( 1L << 8 ) ) - { - z >>= 8; - shift += 8; - } - if ( z >= ( 1L << 4 ) ) - { - z >>= 4; - shift += 4; - } - if ( z >= ( 1L << 2 ) ) - { - z >>= 2; - shift += 2; - } - if ( z >= ( 1L << 1 ) ) - { - z >>= 1; - shift += 1; - } + shift = FT_MSB( FT_ABS( x ) | FT_ABS( y ) ); - if ( shift <= 27 ) + if ( shift <= FT_TRIG_SAFE_MSB ) { - shift = 27 - shift; - vec->x = x << shift; - vec->y = y << shift; + shift = FT_TRIG_SAFE_MSB - shift; + vec->x = (FT_Pos)( (FT_ULong)x << shift ); + vec->y = (FT_Pos)( (FT_ULong)y << shift ); } else { - shift -= 27; + shift -= FT_TRIG_SAFE_MSB; vec->x = x >> shift; vec->y = y >> shift; shift = -shift; } -#else /* 0 */ - - if ( z < ( 1L << 27 ) ) - { - do - { - shift++; - z <<= 1; - } while ( z < ( 1L << 27 ) ); - vec->x = x << shift; - vec->y = y << shift; - } - else if ( z > ( 1L << 28 ) ) - { - do - { - shift++; - z >>= 1; - } while ( z > ( 1L << 28 ) ); - - vec->x = x >> shift; - vec->y = y >> shift; - shift = -shift; - } - -#endif /* 0 */ - return shift; } @@ -192,49 +146,50 @@ FT_Angle theta ) { FT_Int i; - FT_Fixed x, y, xtemp; + FT_Fixed x, y, xtemp, b; const FT_Fixed *arctanptr; x = vec->x; y = vec->y; - /* Get angle between -90 and 90 degrees */ - while ( theta <= -FT_ANGLE_PI2 ) + /* Rotate inside [-PI/4,PI/4] sector */ + while ( theta < -FT_ANGLE_PI4 ) { - x = -x; - y = -y; - theta += FT_ANGLE_PI; + xtemp = y; + y = -x; + x = xtemp; + theta += FT_ANGLE_PI2; } - while ( theta > FT_ANGLE_PI2 ) + while ( theta > FT_ANGLE_PI4 ) { - x = -x; - y = -y; - theta -= FT_ANGLE_PI; + xtemp = -y; + y = x; + x = xtemp; + theta -= FT_ANGLE_PI2; } arctanptr = ft_trig_arctan_table; /* Pseudorotations, with right shifts */ - i = 0; - do + for ( i = 1, b = 1; i < FT_TRIG_MAX_ITERS; b <<= 1, i++ ) { if ( theta < 0 ) { - xtemp = x + ( y >> i ); - y = y - ( x >> i ); + xtemp = x + ( ( y + b ) >> i ); + y = y - ( ( x + b ) >> i ); x = xtemp; theta += *arctanptr++; } else { - xtemp = x - ( y >> i ); - y = y + ( x >> i ); + xtemp = x - ( ( y + b ) >> i ); + y = y + ( ( x + b ) >> i ); x = xtemp; theta -= *arctanptr++; } - } while ( ++i < FT_TRIG_MAX_ITERS ); + } vec->x = x; vec->y = y; @@ -246,46 +201,65 @@ { FT_Angle theta; FT_Int i; - FT_Fixed x, y, xtemp; + FT_Fixed x, y, xtemp, b; const FT_Fixed *arctanptr; x = vec->x; y = vec->y; - /* Get the vector into the right half plane */ - theta = 0; - if ( x < 0 ) + /* Get the vector into [-PI/4,PI/4] sector */ + if ( y > x ) { - x = -x; - y = -y; - theta = 2 * FT_ANGLE_PI2; + if ( y > -x ) + { + theta = FT_ANGLE_PI2; + xtemp = y; + y = -x; + x = xtemp; + } + else + { + theta = y > 0 ? FT_ANGLE_PI : -FT_ANGLE_PI; + x = -x; + y = -y; + } + } + else + { + if ( y < -x ) + { + theta = -FT_ANGLE_PI2; + xtemp = -y; + y = x; + x = xtemp; + } + else + { + theta = 0; + } } - - if ( y > 0 ) - theta = - theta; arctanptr = ft_trig_arctan_table; /* Pseudorotations, with right shifts */ - i = 0; - do + for ( i = 1, b = 1; i < FT_TRIG_MAX_ITERS; b <<= 1, i++ ) { if ( y > 0 ) { - xtemp = x + ( y >> i ); - y = y - ( x >> i ); + xtemp = x + ( ( y + b ) >> i ); + y = y - ( ( x + b ) >> i ); x = xtemp; theta += *arctanptr++; } else { - xtemp = x - ( y >> i ); - y = y + ( x >> i ); + xtemp = x - ( ( y + b ) >> i ); + y = y + ( ( x + b ) >> i ); x = xtemp; theta -= *arctanptr++; } - } while ( ++i < FT_TRIG_MAX_ITERS ); + } /* round theta */ if ( theta >= 0 ) @@ -306,11 +280,11 @@ FT_Vector v; - v.x = FT_TRIG_COSCALE >> 2; + v.x = FT_TRIG_SCALE >> 8; v.y = 0; ft_trig_pseudo_rotate( &v, angle ); - return v.x / ( 1 << 12 ); + return ( v.x + 0x80L ) >> 8; } @@ -331,7 +305,7 @@ FT_Vector v; - v.x = FT_TRIG_COSCALE >> 2; + v.x = FT_TRIG_SCALE >> 8; v.y = 0; ft_trig_pseudo_rotate( &v, angle ); @@ -366,11 +340,11 @@ FT_Vector_Unit( FT_Vector* vec, FT_Angle angle ) { - vec->x = FT_TRIG_COSCALE >> 2; + vec->x = FT_TRIG_SCALE >> 8; vec->y = 0; ft_trig_pseudo_rotate( vec, angle ); - vec->x >>= 12; - vec->y >>= 12; + vec->x = ( vec->x + 0x80L ) >> 8; + vec->y = ( vec->y + 0x80L ) >> 8; } @@ -413,8 +387,8 @@ else { shift = -shift; - vec->x = v.x << shift; - vec->y = v.y << shift; + vec->x = (FT_Pos)( (FT_ULong)v.x << shift ); + vec->y = (FT_Pos)( (FT_ULong)v.y << shift ); } } } @@ -434,11 +408,11 @@ /* handle trivial cases */ if ( v.x == 0 ) { - return ( v.y >= 0 ) ? v.y : -v.y; + return FT_ABS( v.y ); } else if ( v.y == 0 ) { - return ( v.x >= 0 ) ? v.x : -v.x; + return FT_ABS( v.x ); } /* general case */ @@ -450,7 +424,7 @@ if ( shift > 0 ) return ( v.x + ( 1 << ( shift - 1 ) ) ) >> shift; - return v.x << -shift; + return (FT_Fixed)( (FT_UInt32)v.x << -shift ); } @@ -475,7 +449,8 @@ v.x = ft_trig_downscale( v.x ); - *length = ( shift >= 0 ) ? ( v.x >> shift ) : ( v.x << -shift ); + *length = ( shift >= 0 ) ? ( v.x >> shift ) + : (FT_Fixed)( (FT_UInt32)v.x << -shift ); *angle = v.y; } diff --git a/freetype/src/base/fttype1.c b/freetype/src/base/fttype1.c index 885dba598..c1f9931db 100644 --- a/freetype/src/base/fttype1.c +++ b/freetype/src/base/fttype1.c @@ -28,7 +28,7 @@ FT_Get_PS_Font_Info( FT_Face face, PS_FontInfoRec* afont_info ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); if ( face ) @@ -73,7 +73,7 @@ FT_Get_PS_Font_Private( FT_Face face, PS_PrivateRec* afont_private ) { - FT_Error error = FT_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); if ( face ) diff --git a/freetype/src/base/ftutil.c b/freetype/src/base/ftutil.c index 5f77be557..879d02752 100644 --- a/freetype/src/base/ftutil.c +++ b/freetype/src/base/ftutil.c @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for memory and list management (body). */ /* */ -/* Copyright 2002, 2004, 2005, 2006, 2007 by */ +/* Copyright 2002, 2004-2007, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -75,12 +75,12 @@ { block = memory->alloc( memory, size ); if ( block == NULL ) - error = FT_Err_Out_Of_Memory; + error = FT_THROW( Out_Of_Memory ); } else if ( size < 0 ) { /* may help catch/prevent security issues */ - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); } *p_error = error; @@ -98,6 +98,7 @@ { FT_Error error = FT_Err_Ok; + block = ft_mem_qrealloc( memory, item_size, cur_count, new_count, block, &error ); if ( !error && new_count > cur_count ) @@ -127,7 +128,7 @@ if ( cur_count < 0 || new_count < 0 || item_size < 0 ) { /* may help catch/prevent nasty security issues */ - error = FT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); } else if ( new_count == 0 || item_size == 0 ) { @@ -136,7 +137,7 @@ } else if ( new_count > FT_INT_MAX/item_size ) { - error = FT_Err_Array_Too_Large; + error = FT_THROW( Array_Too_Large ); } else if ( cur_count == 0 ) { @@ -153,7 +154,7 @@ block2 = memory->realloc( memory, cur_size, new_size, block ); if ( block2 == NULL ) - error = FT_Err_Out_Of_Memory; + error = FT_THROW( Out_Of_Memory ); else block = block2; } @@ -432,70 +433,4 @@ } -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_BASE_DEF( FT_Error ) - FT_Alloc( FT_Memory memory, - FT_Long size, - void* *P ) - { - FT_Error error; - - - (void)FT_ALLOC( *P, size ); - return error; - } - - - FT_BASE_DEF( FT_Error ) - FT_QAlloc( FT_Memory memory, - FT_Long size, - void* *p ) - { - FT_Error error; - - - (void)FT_QALLOC( *p, size ); - return error; - } - - - FT_BASE_DEF( FT_Error ) - FT_Realloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void* *P ) - { - FT_Error error; - - - (void)FT_REALLOC( *P, current, size ); - return error; - } - - - FT_BASE_DEF( FT_Error ) - FT_QRealloc( FT_Memory memory, - FT_Long current, - FT_Long size, - void* *p ) - { - FT_Error error; - - - (void)FT_QREALLOC( *p, current, size ); - return error; - } - - - FT_BASE_DEF( void ) - FT_Free( FT_Memory memory, - void* *P ) - { - if ( *P ) - FT_MEM_FREE( *P ); - } - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - /* END */ diff --git a/freetype/src/base/ftwinfnt.c b/freetype/src/base/ftwinfnt.c index bc2e90e1f..463ae761d 100644 --- a/freetype/src/base/ftwinfnt.c +++ b/freetype/src/base/ftwinfnt.c @@ -32,7 +32,7 @@ FT_Error error; - error = FT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( face != NULL ) { diff --git a/freetype/src/base/md5.c b/freetype/src/base/md5.c new file mode 100644 index 000000000..2f01c9302 --- /dev/null +++ b/freetype/src/base/md5.c @@ -0,0 +1,295 @@ +/* + * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. + * MD5 Message-Digest Algorithm (RFC 1321). + * + * Homepage: + * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 + * + * Author: + * Alexander Peslyak, better known as Solar Designer <solar at openwall.com> + * + * This software was written by Alexander Peslyak in 2001. No copyright is + * claimed, and the software is hereby placed in the public domain. + * In case this attempt to disclaim copyright and place the software in the + * public domain is deemed null and void, then the software is + * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the + * general public under the following terms: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted. + * + * There's ABSOLUTELY NO WARRANTY, express or implied. + * + * (This is a heavily cut-down "BSD license".) + * + * This differs from Colin Plumb's older public domain implementation in that + * no exactly 32-bit integer data type is required (any 32-bit or wider + * unsigned integer data type will do), there's no compile-time endianness + * configuration, and the function prototypes match OpenSSL's. No code from + * Colin Plumb's implementation has been reused; this comment merely compares + * the properties of the two independent implementations. + * + * The primary goals of this implementation are portability and ease of use. + * It is meant to be fast, but not as fast as possible. Some known + * optimizations are not included to reduce source code size and avoid + * compile-time configuration. + */ + +#ifndef HAVE_OPENSSL + +#include <string.h> + +#include "md5.h" + +/* + * The basic MD5 functions. + * + * F and G are optimized compared to their RFC 1321 definitions for + * architectures that lack an AND-NOT instruction, just like in Colin Plumb's + * implementation. + */ +#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | ~(z))) + +/* + * The MD5 transformation for all four rounds. + */ +#define STEP(f, a, b, c, d, x, t, s) \ + (a) += f((b), (c), (d)) + (x) + (t); \ + (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ + (a) += (b); + +/* + * SET reads 4 input bytes in little-endian byte order and stores them + * in a properly aligned word in host byte order. + * + * The check for little-endian architectures that tolerate unaligned + * memory accesses is just an optimization. Nothing will break if it + * doesn't work. + */ +#if defined(__i386__) || defined(__x86_64__) || defined(__vax__) +#define SET(n) \ + (*(MD5_u32plus *)&ptr[(n) * 4]) +#define GET(n) \ + SET(n) +#else +#define SET(n) \ + (ctx->block[(n)] = \ + (MD5_u32plus)ptr[(n) * 4] | \ + ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ + ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ + ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) +#define GET(n) \ + (ctx->block[(n)]) +#endif + +/* + * This processes one or more 64-byte data blocks, but does NOT update + * the bit counters. There are no alignment requirements. + */ +static void *body(MD5_CTX *ctx, void *data, unsigned long size) +{ + unsigned char *ptr; + MD5_u32plus a, b, c, d; + MD5_u32plus saved_a, saved_b, saved_c, saved_d; + + ptr = (unsigned char *)data; + + a = ctx->a; + b = ctx->b; + c = ctx->c; + d = ctx->d; + + do { + saved_a = a; + saved_b = b; + saved_c = c; + saved_d = d; + +/* Round 1 */ + STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) + STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) + STEP(F, c, d, a, b, SET(2), 0x242070db, 17) + STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) + STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) + STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) + STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) + STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) + STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) + STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) + STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) + STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) + STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) + STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) + STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) + STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) + +/* Round 2 */ + STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) + STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) + STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) + STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) + STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) + STEP(G, d, a, b, c, GET(10), 0x02441453, 9) + STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) + STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) + STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) + STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) + STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) + STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) + STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) + STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) + STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) + STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) + +/* Round 3 */ + STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) + STEP(H, d, a, b, c, GET(8), 0x8771f681, 11) + STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) + STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23) + STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) + STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11) + STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) + STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23) + STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) + STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11) + STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) + STEP(H, b, c, d, a, GET(6), 0x04881d05, 23) + STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) + STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11) + STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) + STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23) + +/* Round 4 */ + STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) + STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) + STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) + STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) + STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) + STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) + STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) + STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) + STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) + STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) + STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) + STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) + STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) + STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) + STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) + STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) + + a += saved_a; + b += saved_b; + c += saved_c; + d += saved_d; + + ptr += 64; + } while (size -= 64); + + ctx->a = a; + ctx->b = b; + ctx->c = c; + ctx->d = d; + + return ptr; +} + +void MD5_Init(MD5_CTX *ctx) +{ + ctx->a = 0x67452301; + ctx->b = 0xefcdab89; + ctx->c = 0x98badcfe; + ctx->d = 0x10325476; + + ctx->lo = 0; + ctx->hi = 0; +} + +void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) +{ + MD5_u32plus saved_lo; + unsigned long used, free; + + saved_lo = ctx->lo; + if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) + ctx->hi++; + ctx->hi += size >> 29; + + used = saved_lo & 0x3f; + + if (used) { + free = 64 - used; + + if (size < free) { + memcpy(&ctx->buffer[used], data, size); + return; + } + + memcpy(&ctx->buffer[used], data, free); + data = (unsigned char *)data + free; + size -= free; + body(ctx, ctx->buffer, 64); + } + + if (size >= 64) { + data = body(ctx, data, size & ~(unsigned long)0x3f); + size &= 0x3f; + } + + memcpy(ctx->buffer, data, size); +} + +void MD5_Final(unsigned char *result, MD5_CTX *ctx) +{ + unsigned long used, free; + + used = ctx->lo & 0x3f; + + ctx->buffer[used++] = 0x80; + + free = 64 - used; + + if (free < 8) { + memset(&ctx->buffer[used], 0, free); + body(ctx, ctx->buffer, 64); + used = 0; + free = 64; + } + + memset(&ctx->buffer[used], 0, free - 8); + + ctx->lo <<= 3; + ctx->buffer[56] = ctx->lo; + ctx->buffer[57] = ctx->lo >> 8; + ctx->buffer[58] = ctx->lo >> 16; + ctx->buffer[59] = ctx->lo >> 24; + ctx->buffer[60] = ctx->hi; + ctx->buffer[61] = ctx->hi >> 8; + ctx->buffer[62] = ctx->hi >> 16; + ctx->buffer[63] = ctx->hi >> 24; + + body(ctx, ctx->buffer, 64); + + result[0] = ctx->a; + result[1] = ctx->a >> 8; + result[2] = ctx->a >> 16; + result[3] = ctx->a >> 24; + result[4] = ctx->b; + result[5] = ctx->b >> 8; + result[6] = ctx->b >> 16; + result[7] = ctx->b >> 24; + result[8] = ctx->c; + result[9] = ctx->c >> 8; + result[10] = ctx->c >> 16; + result[11] = ctx->c >> 24; + result[12] = ctx->d; + result[13] = ctx->d >> 8; + result[14] = ctx->d >> 16; + result[15] = ctx->d >> 24; + + memset(ctx, 0, sizeof(*ctx)); +} + +#endif diff --git a/freetype/src/base/md5.h b/freetype/src/base/md5.h new file mode 100644 index 000000000..f1a685764 --- /dev/null +++ b/freetype/src/base/md5.h @@ -0,0 +1,45 @@ +/* + * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. + * MD5 Message-Digest Algorithm (RFC 1321). + * + * Homepage: + * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 + * + * Author: + * Alexander Peslyak, better known as Solar Designer <solar at openwall.com> + * + * This software was written by Alexander Peslyak in 2001. No copyright is + * claimed, and the software is hereby placed in the public domain. + * In case this attempt to disclaim copyright and place the software in the + * public domain is deemed null and void, then the software is + * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the + * general public under the following terms: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted. + * + * There's ABSOLUTELY NO WARRANTY, express or implied. + * + * See md5.c for more information. + */ + +#ifdef HAVE_OPENSSL +#include <openssl/md5.h> +#elif !defined(_MD5_H) +#define _MD5_H + +/* Any 32-bit or wider unsigned integer data type will do */ +typedef unsigned int MD5_u32plus; + +typedef struct { + MD5_u32plus lo, hi; + MD5_u32plus a, b, c, d; + unsigned char buffer[64]; + MD5_u32plus block[16]; +} MD5_CTX; + +extern void MD5_Init(MD5_CTX *ctx); +extern void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); +extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); + +#endif diff --git a/freetype/src/base/rules.mk b/freetype/src/base/rules.mk index 10f578abc..e93219115 100644 --- a/freetype/src/base/rules.mk +++ b/freetype/src/base/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by +# Copyright 1996-2000, 2002-2009, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -50,7 +50,10 @@ ifneq ($(ftmac_c),) BASE_SRC += $(BASE_DIR)/$(ftmac_c) endif -BASE_H := $(BASE_DIR)/ftbase.h +# for simplicity, we also handle `md5.c' (which gets included by `ftobjs.h') +BASE_H := $(BASE_DIR)/ftbase.h \ + $(BASE_DIR)/md5.c \ + $(BASE_DIR)/md5.h # Base layer `extensions' sources # diff --git a/freetype/src/bdf/bdfdrivr.c b/freetype/src/bdf/bdfdrivr.c index 0edcc77b6..0ea0a5ea5 100644 --- a/freetype/src/bdf/bdfdrivr.c +++ b/freetype/src/bdf/bdfdrivr.c @@ -2,7 +2,7 @@ FreeType font driver for bdf files - Copyright (C) 2001-2008, 2011 by + Copyright (C) 2001-2008, 2011, 2013 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -72,7 +72,7 @@ THE SOFTWARE. cmap->num_encodings = face->bdffont->glyphs_used; cmap->encodings = face->en_table; - return BDF_Err_Ok; + return FT_Err_Ok; } @@ -198,7 +198,7 @@ THE SOFTWARE. static FT_Error bdf_interpret_style( BDF_Face bdf ) { - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Face face = FT_FACE( bdf ); FT_Memory memory = face->memory; bdf_font_t* font = bdf->bdffont; @@ -342,7 +342,7 @@ THE SOFTWARE. FT_Int num_params, FT_Parameter* params ) { - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; BDF_Face face = (BDF_Face)bdfface; FT_Memory memory = FT_FACE_MEMORY( face ); @@ -365,7 +365,7 @@ THE SOFTWARE. options.font_spacing = BDF_PROPORTIONAL; error = bdf_load_font( stream, memory, &options, &font ); - if ( error == BDF_Err_Missing_Startfont_Field ) + if ( FT_ERR_EQ( error, Missing_Startfont_Field ) ) { FT_TRACE2(( " not a BDF file\n" )); goto Fail; @@ -591,7 +591,7 @@ THE SOFTWARE. Fail: BDF_Face_Done( bdfface ); - return BDF_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); } @@ -608,7 +608,7 @@ THE SOFTWARE. size->metrics.descender = -bdffont->font_descent << 6; size->metrics.max_advance = bdffont->bbx.width << 6; - return BDF_Err_Ok; + return FT_Err_Ok; } @@ -619,7 +619,7 @@ THE SOFTWARE. FT_Face face = size->face; FT_Bitmap_Size* bsize = face->available_sizes; bdf_font_t* bdffont = ( (BDF_Face)face )->bdffont; - FT_Error error = BDF_Err_Invalid_Pixel_Size; + FT_Error error = FT_ERR( Invalid_Pixel_Size ); FT_Long height; @@ -630,17 +630,17 @@ THE SOFTWARE. { case FT_SIZE_REQUEST_TYPE_NOMINAL: if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) ) - error = BDF_Err_Ok; + error = FT_Err_Ok; break; case FT_SIZE_REQUEST_TYPE_REAL_DIM: if ( height == ( bdffont->font_ascent + bdffont->font_descent ) ) - error = BDF_Err_Ok; + error = FT_Err_Ok; break; default: - error = BDF_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); break; } @@ -660,7 +660,7 @@ THE SOFTWARE. { BDF_Face bdf = (BDF_Face)FT_SIZE_FACE( size ); FT_Face face = FT_FACE( bdf ); - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Bitmap* bitmap = &slot->bitmap; bdf_glyph_t glyph; int bpp = bdf->bdffont->bpp; @@ -670,7 +670,7 @@ THE SOFTWARE. if ( !face || glyph_index >= (FT_UInt)face->num_glyphs ) { - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -786,7 +786,7 @@ THE SOFTWARE. } Fail: - return BDF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } @@ -864,10 +864,6 @@ THE SOFTWARE. 0, /* FT_Slot_InitFunc */ 0, /* FT_Slot_DoneFunc */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - ft_stub_set_char_sizes, - ft_stub_set_pixel_sizes, -#endif BDF_Glyph_Load, 0, /* FT_Face_GetKerningFunc */ diff --git a/freetype/src/bdf/bdflib.c b/freetype/src/bdf/bdflib.c index 7208d99c9..0b8412d9e 100644 --- a/freetype/src/bdf/bdflib.c +++ b/freetype/src/bdf/bdflib.c @@ -1,6 +1,6 @@ /* * Copyright 2000 Computing Research Labs, New Mexico State University - * Copyright 2001-2012 + * Copyright 2001-2013 * Francesco Zappa Nardelli * * Permission is hereby granted, free of charge, to any person obtaining a @@ -254,7 +254,7 @@ { hashnode* obp = ht->table, *bp, *nbp; int i, sz = ht->size; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; ht->size <<= 1; @@ -282,8 +282,8 @@ hash_init( hashtable* ht, FT_Memory memory ) { - int sz = INITIAL_HT_SIZE; - FT_Error error = BDF_Err_Ok; + int sz = INITIAL_HT_SIZE; + FT_Error error = FT_Err_Ok; ht->size = sz; @@ -322,8 +322,9 @@ hashtable* ht, FT_Memory memory ) { - hashnode nn, *bp = hash_bucket( key, ht ); - FT_Error error = BDF_Err_Ok; + hashnode nn; + hashnode* bp = hash_bucket( key, ht ); + FT_Error error = FT_Err_Ok; nn = *bp; @@ -456,7 +457,7 @@ _bdf_list_ensure( _bdf_list_t* list, unsigned long num_items ) /* same as _bdf_list_t.used */ { - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; if ( num_items > list->size ) @@ -469,7 +470,7 @@ if ( oldsize == bigsize ) { - error = BDF_Err_Out_Of_Memory; + error = FT_THROW( Out_Of_Memory ); goto Exit; } else if ( newsize < oldsize || newsize > bigsize ) @@ -519,7 +520,7 @@ unsigned long *alen ) { unsigned long i, j; - char *fp, *dp; + char* dp; *alen = 0; @@ -530,7 +531,9 @@ dp = list->field[0]; for ( i = j = 0; i < list->used; i++ ) { - fp = list->field[i]; + char* fp = list->field[i]; + + while ( *fp ) dp[j++] = *fp++; @@ -558,7 +561,7 @@ int mult, final_empty; char *sp, *ep, *end; char seps[32]; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; /* Initialize the list. */ @@ -581,7 +584,7 @@ /* this, so an error is signaled. */ if ( separators == 0 || *separators == 0 ) { - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -667,14 +670,14 @@ unsigned long lineno, buf_size; int refill, hold, to_skip; ptrdiff_t bytes, start, end, cursor, avail; - char* buf = 0; + char* buf = 0; FT_Memory memory = stream->memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; if ( callback == 0 ) { - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -738,7 +741,7 @@ if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */ { FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno )); - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -753,7 +756,7 @@ { bytes = avail - start; - FT_MEM_COPY( buf, buf + start, bytes ); + FT_MEM_MOVE( buf, buf + start, bytes ); cursor = bytes; avail -= bytes; @@ -1028,7 +1031,7 @@ size_t n; bdf_property_t* p; FT_Memory memory = font->memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; /* First check whether the property has */ @@ -1047,7 +1050,7 @@ n = ft_strlen( name ) + 1; if ( n > FT_ULONG_MAX ) - return BDF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( FT_NEW_ARRAY( p->name, n ) ) goto Exit; @@ -1134,7 +1137,7 @@ { char* cp; FT_Memory memory = font->memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; if ( FT_RENEW_ARRAY( font->comments, @@ -1165,12 +1168,14 @@ char name[256]; _bdf_list_t list; FT_Memory memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; + + FT_UNUSED( lineno ); /* only used in debug mode */ if ( font == 0 || font->name == 0 || font->name[0] == 0 ) { - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1185,13 +1190,13 @@ if ( len >= 256 ) { FT_ERROR(( "_bdf_set_default_spacing: " ERRMSG7, lineno )); - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } FT_MEM_COPY( name, font->name, len ); - error = _bdf_list_split( &list, (char *)"-", name, len ); + error = _bdf_list_split( &list, (char *)"-", name, (unsigned long)len ); if ( error ) goto Fail; @@ -1298,7 +1303,9 @@ hashnode hn; bdf_property_t *prop, *fp; FT_Memory memory = font->memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; + + FT_UNUSED( lineno ); /* only used in debug mode */ /* First, check whether the property already exists in the font. */ @@ -1431,7 +1438,7 @@ if ( !fp->value.atom ) { FT_ERROR(( "_bdf_add_property: " ERRMSG8, lineno, "SPACING" )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1472,7 +1479,7 @@ bdf_font_t* font; FT_Memory memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( call_data ); FT_UNUSED( lineno ); /* only used in debug mode */ @@ -1504,7 +1511,7 @@ if ( ft_memcmp( line, "CHARS", 5 ) != 0 ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "CHARS" )); - error = BDF_Err_Missing_Chars_Field; + error = FT_THROW( Missing_Chars_Field ); goto Exit; } @@ -1522,7 +1529,7 @@ if ( p->cnt >= 0x110000UL ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "CHARS" )); - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1582,7 +1589,7 @@ if ( !s ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG8, lineno, "STARTCHAR" )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1605,7 +1612,7 @@ { /* Missing STARTCHAR field. */ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "STARTCHAR" )); - error = BDF_Err_Missing_Startchar_Field; + error = FT_THROW( Missing_Startchar_Field ); goto Exit; } @@ -1636,7 +1643,7 @@ sizeof ( unsigned long ) * 32 ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "ENCODING" )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1906,7 +1913,7 @@ { /* Missing BBX field. */ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "BBX" )); - error = BDF_Err_Missing_Bbx_Field; + error = FT_THROW( Missing_Bbx_Field ); goto Exit; } @@ -1917,7 +1924,7 @@ if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno )); - error = BDF_Err_Bbx_Too_Big; + error = FT_THROW( Bbx_Too_Big ); goto Exit; } else @@ -1933,13 +1940,13 @@ } FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG9, lineno )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; Missing_Encoding: /* Missing ENCODING field. */ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); - error = BDF_Err_Missing_Encoding_Field; + error = FT_THROW( Missing_Encoding_Field ); Exit: if ( error && ( p->flags & _BDF_GLYPH ) ) @@ -1963,7 +1970,7 @@ char* name; char* value; char nbuf[128]; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( lineno ); @@ -2069,7 +2076,7 @@ char *s; FT_Memory memory = NULL; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( lineno ); /* only used in debug mode */ @@ -2112,7 +2119,7 @@ { /* we don't emit an error message since this code gets */ /* explicitly caught one level higher */ - error = BDF_Err_Missing_Startfont_Field; + error = FT_THROW( Missing_Startfont_Field ); goto Exit; } @@ -2162,7 +2169,7 @@ { /* Missing the FONTBOUNDINGBOX field. */ FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); - error = BDF_Err_Missing_Fontboundingbox_Field; + error = FT_THROW( Missing_Fontboundingbox_Field ); goto Exit; } @@ -2191,7 +2198,7 @@ { /* Missing the SIZE field. */ FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "SIZE" )); - error = BDF_Err_Missing_Size_Field; + error = FT_THROW( Missing_Size_Field ); goto Exit; } @@ -2228,7 +2235,7 @@ if ( !s ) { FT_ERROR(( "_bdf_parse_start: " ERRMSG8, lineno, "FONT" )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -2257,7 +2264,7 @@ { /* Missing the FONT field. */ FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONT" )); - error = BDF_Err_Missing_Font_Field; + error = FT_THROW( Missing_Font_Field ); goto Exit; } @@ -2314,7 +2321,7 @@ { /* Missing the FONTBOUNDINGBOX field. */ FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); - error = BDF_Err_Missing_Fontboundingbox_Field; + error = FT_THROW( Missing_Fontboundingbox_Field ); goto Exit; } @@ -2346,7 +2353,7 @@ } FT_ERROR(( "_bdf_parse_start: " ERRMSG9, lineno )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); Exit: return error; @@ -2370,7 +2377,7 @@ _bdf_parse_t *p = NULL; FT_Memory memory = extmemory; - FT_Error error = BDF_Err_Ok; + FT_Error error = FT_Err_Ok; if ( FT_NEW( p ) ) @@ -2463,14 +2470,14 @@ { /* Error happened while parsing header. */ FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno )); - error = BDF_Err_Corrupted_Font_Header; + error = FT_THROW( Corrupted_Font_Header ); goto Exit; } else { /* Error happened when parsing glyphs. */ FT_ERROR(( "bdf_load_font: " ERRMSG3, lineno )); - error = BDF_Err_Corrupted_Font_Glyphs; + error = FT_THROW( Corrupted_Font_Glyphs ); goto Exit; } } @@ -2490,8 +2497,8 @@ p->font->comments[p->font->comments_len] = 0; } } - else if ( error == BDF_Err_Ok ) - error = BDF_Err_Invalid_File_Format; + else if ( error == FT_Err_Ok ) + error = FT_THROW( Invalid_File_Format ); *font = p->font; diff --git a/freetype/src/bzip2/ftbzip2.c b/freetype/src/bzip2/ftbzip2.c index d60ee3ea0..749413027 100644 --- a/freetype/src/bzip2/ftbzip2.c +++ b/freetype/src/bzip2/ftbzip2.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2010, 2012 by */ +/* Copyright 2010, 2012, 2013 by */ /* Joel Klinghed. */ /* */ /* Based on src/gzip/ftgzip.c, Copyright 2002 - 2010 by */ @@ -120,7 +120,7 @@ static FT_Error ft_bzip2_check_header( FT_Stream stream ) { - FT_Error error = Bzip2_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte head[4]; @@ -134,7 +134,7 @@ head[1] != 0x5a || head[2] != 0x68 ) /* only support bzip2 (huffman) */ { - error = Bzip2_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -149,7 +149,7 @@ FT_Stream source ) { bz_stream* bzstream = &zip->bzstream; - FT_Error error = Bzip2_Err_Ok; + FT_Error error = FT_Err_Ok; zip->stream = stream; @@ -182,7 +182,7 @@ if ( BZ2_bzDecompressInit( bzstream, 0, 0 ) != BZ_OK || bzstream->next_in == NULL ) - error = Bzip2_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); Exit: return error; @@ -255,7 +255,7 @@ size = stream->read( stream, stream->pos, zip->input, FT_BZIP2_BUFFER_SIZE ); if ( size == 0 ) - return Bzip2_Err_Invalid_Stream_Operation; + return FT_THROW( Invalid_Stream_Operation ); } else { @@ -264,7 +264,7 @@ size = FT_BZIP2_BUFFER_SIZE; if ( size == 0 ) - return Bzip2_Err_Invalid_Stream_Operation; + return FT_THROW( Invalid_Stream_Operation ); FT_MEM_COPY( zip->input, stream->base + stream->pos, size ); } @@ -273,7 +273,7 @@ bzstream->next_in = (char*)zip->input; bzstream->avail_in = size; - return Bzip2_Err_Ok; + return FT_Err_Ok; } @@ -281,7 +281,7 @@ ft_bzip2_file_fill_output( FT_BZip2File zip ) { bz_stream* bzstream = &zip->bzstream; - FT_Error error = Bzip2_Err_Ok; + FT_Error error = FT_Err_Ok; zip->cursor = zip->buffer; @@ -306,12 +306,12 @@ { zip->limit = (FT_Byte*)bzstream->next_out; if ( zip->limit == zip->cursor ) - error = Bzip2_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); break; } else if ( err != BZ_OK ) { - error = Bzip2_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); break; } } @@ -325,7 +325,7 @@ ft_bzip2_file_skip_output( FT_BZip2File zip, FT_ULong count ) { - FT_Error error = Bzip2_Err_Ok; + FT_Error error = FT_Err_Ok; FT_ULong delta; @@ -502,7 +502,7 @@ FT_UNUSED( stream ); FT_UNUSED( source ); - return Bzip2_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #endif /* !FT_CONFIG_OPTION_USE_BZIP2 */ diff --git a/freetype/src/cache/ftcbasic.c b/freetype/src/cache/ftcbasic.c index d4fc353c4..84d336d5d 100644 --- a/freetype/src/cache/ftcbasic.c +++ b/freetype/src/cache/ftcbasic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType basic cache interface (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 by */ +/* Copyright 2003-2007, 2009-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,44 +30,6 @@ #define FT_COMPONENT trace_cache -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* - * These structures correspond to the FTC_Font and FTC_ImageDesc types - * that were defined in version 2.1.7. - */ - typedef struct FTC_OldFontRec_ - { - FTC_FaceID face_id; - FT_UShort pix_width; - FT_UShort pix_height; - - } FTC_OldFontRec, *FTC_OldFont; - - - typedef struct FTC_OldImageDescRec_ - { - FTC_OldFontRec font; - FT_UInt32 flags; - - } FTC_OldImageDescRec, *FTC_OldImageDesc; - - - /* - * Notice that FTC_OldImageDescRec and FTC_ImageTypeRec are nearly - * identical, bit-wise. The only difference is that the `width' and - * `height' fields are expressed as 16-bit integers in the old structure, - * and as normal `int' in the new one. - * - * We are going to perform a weird hack to detect which structure is - * being passed to the image and sbit caches. If the new structure's - * `width' is larger than 0x10000, we assume that we are really receiving - * an FTC_OldImageDesc. - */ - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /* * Basic Families * @@ -226,7 +188,7 @@ } } else - error = FTC_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); } } @@ -328,7 +290,7 @@ /* some argument checks are delayed to FTC_Cache_Lookup */ if ( !aglyph ) { - error = FTC_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -336,26 +298,6 @@ if ( anode ) *anode = NULL; -#if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU ) - - /* - * This one is a major hack used to detect whether we are passed a - * regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one. - */ - if ( (FT_ULong)type->width >= 0x10000L ) - { - FTC_OldImageDesc desc = (FTC_OldImageDesc)type; - - - query.attrs.scaler.face_id = desc->font.face_id; - query.attrs.scaler.width = desc->font.pix_width; - query.attrs.scaler.height = desc->font.pix_height; - query.attrs.load_flags = desc->flags; - } - else - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - { if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX ) { @@ -424,7 +366,7 @@ /* some argument checks are delayed to FTC_Cache_Lookup */ if ( !aglyph || !scaler ) { - error = FTC_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -467,142 +409,11 @@ } - -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* yet another backwards-legacy structure */ - typedef struct FTC_OldImage_Desc_ - { - FTC_FontRec font; - FT_UInt image_type; - - } FTC_OldImage_Desc; - - -#define FTC_OLD_IMAGE_FORMAT( x ) ( (x) & 7 ) - - -#define ftc_old_image_format_bitmap 0x0000 -#define ftc_old_image_format_outline 0x0001 - -#define ftc_old_image_format_mask 0x000F - -#define ftc_old_image_flag_monochrome 0x0010 -#define ftc_old_image_flag_unhinted 0x0020 -#define ftc_old_image_flag_autohinted 0x0040 -#define ftc_old_image_flag_unscaled 0x0080 -#define ftc_old_image_flag_no_sbits 0x0100 - - /* monochrome bitmap */ -#define ftc_old_image_mono ftc_old_image_format_bitmap | \ - ftc_old_image_flag_monochrome - - /* anti-aliased bitmap */ -#define ftc_old_image_grays ftc_old_image_format_bitmap - - /* scaled outline */ -#define ftc_old_image_outline ftc_old_image_format_outline - - - static void - ftc_image_type_from_old_desc( FTC_ImageType typ, - FTC_OldImage_Desc* desc ) - { - typ->face_id = desc->font.face_id; - typ->width = desc->font.pix_width; - typ->height = desc->font.pix_height; - - /* convert image type flags to load flags */ - { - FT_UInt load_flags = FT_LOAD_DEFAULT; - FT_UInt type = desc->image_type; - - - /* determine load flags, depending on the font description's */ - /* image type */ - - if ( FTC_OLD_IMAGE_FORMAT( type ) == ftc_old_image_format_bitmap ) - { - if ( type & ftc_old_image_flag_monochrome ) - load_flags |= FT_LOAD_MONOCHROME; - - /* disable embedded bitmaps loading if necessary */ - if ( type & ftc_old_image_flag_no_sbits ) - load_flags |= FT_LOAD_NO_BITMAP; - } - else - { - /* we want an outline, don't load embedded bitmaps */ - load_flags |= FT_LOAD_NO_BITMAP; - - if ( type & ftc_old_image_flag_unscaled ) - load_flags |= FT_LOAD_NO_SCALE; - } - - /* always render glyphs to bitmaps */ - load_flags |= FT_LOAD_RENDER; - - if ( type & ftc_old_image_flag_unhinted ) - load_flags |= FT_LOAD_NO_HINTING; - - if ( type & ftc_old_image_flag_autohinted ) - load_flags |= FT_LOAD_FORCE_AUTOHINT; - - typ->flags = load_flags; - } - } - - - FT_EXPORT( FT_Error ) - FTC_Image_Cache_New( FTC_Manager manager, - FTC_ImageCache *acache ); - - FT_EXPORT( FT_Error ) - FTC_Image_Cache_Lookup( FTC_ImageCache icache, - FTC_OldImage_Desc* desc, - FT_UInt gindex, - FT_Glyph *aglyph ); - - - FT_EXPORT_DEF( FT_Error ) - FTC_Image_Cache_New( FTC_Manager manager, - FTC_ImageCache *acache ) - { - return FTC_ImageCache_New( manager, (FTC_ImageCache*)acache ); - } - - - - FT_EXPORT_DEF( FT_Error ) - FTC_Image_Cache_Lookup( FTC_ImageCache icache, - FTC_OldImage_Desc* desc, - FT_UInt gindex, - FT_Glyph *aglyph ) - { - FTC_ImageTypeRec type0; - - - if ( !desc ) - return FTC_Err_Invalid_Argument; - - ftc_image_type_from_old_desc( &type0, desc ); - - return FTC_ImageCache_Lookup( (FTC_ImageCache)icache, - &type0, - gindex, - aglyph, - NULL ); - } - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - - /* - * - * basic small bitmap cache - * - */ - + /* + * + * basic small bitmap cache + * + */ FT_CALLBACK_TABLE_DEF const FTC_SFamilyClassRec ftc_basic_sbit_family_class = @@ -668,29 +479,10 @@ /* other argument checks delayed to FTC_Cache_Lookup */ if ( !ansbit ) - return FTC_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); *ansbit = NULL; -#if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU ) - - /* This one is a major hack used to detect whether we are passed a - * regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one. - */ - if ( (FT_ULong)type->width >= 0x10000L ) - { - FTC_OldImageDesc desc = (FTC_OldImageDesc)type; - - - query.attrs.scaler.face_id = desc->font.face_id; - query.attrs.scaler.width = desc->font.pix_width; - query.attrs.scaler.height = desc->font.pix_height; - query.attrs.load_flags = desc->flags; - } - else - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - { if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX ) { @@ -765,7 +557,7 @@ /* other argument checks delayed to FTC_Cache_Lookup */ if ( !ansbit || !scaler ) - return FTC_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); *ansbit = NULL; @@ -807,49 +599,4 @@ } -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_EXPORT( FT_Error ) - FTC_SBit_Cache_New( FTC_Manager manager, - FTC_SBitCache *acache ); - - FT_EXPORT( FT_Error ) - FTC_SBit_Cache_Lookup( FTC_SBitCache cache, - FTC_OldImage_Desc* desc, - FT_UInt gindex, - FTC_SBit *ansbit ); - - - FT_EXPORT_DEF( FT_Error ) - FTC_SBit_Cache_New( FTC_Manager manager, - FTC_SBitCache *acache ) - { - return FTC_SBitCache_New( manager, (FTC_SBitCache*)acache ); - } - - - FT_EXPORT_DEF( FT_Error ) - FTC_SBit_Cache_Lookup( FTC_SBitCache cache, - FTC_OldImage_Desc* desc, - FT_UInt gindex, - FTC_SBit *ansbit ) - { - FTC_ImageTypeRec type0; - - - if ( !desc ) - return FTC_Err_Invalid_Argument; - - ftc_image_type_from_old_desc( &type0, desc ); - - return FTC_SBitCache_Lookup( (FTC_SBitCache)cache, - &type0, - gindex, - ansbit, - NULL ); - } - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /* END */ diff --git a/freetype/src/cache/ftccache.c b/freetype/src/cache/ftccache.c index f01c403f8..f20dd4502 100644 --- a/freetype/src/cache/ftccache.c +++ b/freetype/src/cache/ftccache.c @@ -4,8 +4,7 @@ /* */ /* The FreeType internal cache interface (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, */ -/* 2011 by */ +/* Copyright 2000-2007, 2009-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -270,11 +269,7 @@ /* remove a node from the cache manager */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_BASE_DEF( void ) -#else FT_LOCAL_DEF( void ) -#endif ftc_node_destroy( FTC_Node node, FTC_Manager manager ) { @@ -493,14 +488,14 @@ FTC_Node* bucket; FTC_Node* pnode; FTC_Node node; - FT_Error error = FTC_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Bool list_changed = FALSE; FTC_Node_CompareFunc compare = cache->clazz.node_compare; if ( cache == NULL || anode == NULL ) - return FTC_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* Go to the `top' node of the list sharing same masked hash */ bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash ); diff --git a/freetype/src/cache/ftccache.h b/freetype/src/cache/ftccache.h index d60984f77..4155f320e 100644 --- a/freetype/src/cache/ftccache.h +++ b/freetype/src/cache/ftccache.h @@ -4,8 +4,7 @@ /* */ /* FreeType internal cache interface (specification). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, */ -/* 2011 by */ +/* Copyright 2000-2007, 2009-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -87,12 +86,6 @@ FT_BEGIN_HEADER ftc_get_top_node_for_hash( ( cache ), ( hash ) ) #endif -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_BASE( void ) - ftc_node_destroy( FTC_Node node, - FTC_Manager manager ); -#endif - /*************************************************************************/ /*************************************************************************/ @@ -223,7 +216,7 @@ FT_BEGIN_HEADER FT_Bool _list_changed = FALSE; \ \ \ - error = FTC_Err_Ok; \ + error = FT_Err_Ok; \ node = NULL; \ \ /* Go to the `top' node of the list sharing same masked hash */ \ @@ -328,7 +321,7 @@ FT_BEGIN_HEADER #define FTC_CACHE_TRYLOOP_END( list_changed ) \ - if ( !error || error != FTC_Err_Out_Of_Memory ) \ + if ( !error || FT_ERR_NEQ( error, Out_Of_Memory ) ) \ break; \ \ _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \ diff --git a/freetype/src/cache/ftccback.h b/freetype/src/cache/ftccback.h index 80ec9ce44..952827927 100644 --- a/freetype/src/cache/ftccback.h +++ b/freetype/src/cache/ftccback.h @@ -4,7 +4,7 @@ /* */ /* Callback functions of the caching sub-system (specification only). */ /* */ -/* Copyright 2004, 2005, 2006, 2011 by */ +/* Copyright 2004-2006, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -81,11 +81,10 @@ FT_LOCAL( void ) ftc_cache_done( FTC_Cache cache ); -#ifndef FT_CONFIG_OPTION_OLD_INTERNALS FT_LOCAL( void ) ftc_node_destroy( FTC_Node node, FTC_Manager manager ); -#endif + #endif /* __FTCCBACK_H__ */ diff --git a/freetype/src/cache/ftccmap.c b/freetype/src/cache/ftccmap.c index 226c0015c..848349be2 100644 --- a/freetype/src/cache/ftccmap.c +++ b/freetype/src/cache/ftccmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType CharMap cache (body) */ /* */ -/* Copyright 2000-2012 by */ +/* Copyright 2000-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,43 +31,6 @@ #define FT_COMPONENT trace_cache -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - typedef enum FTC_OldCMapType_ - { - FTC_OLD_CMAP_BY_INDEX = 0, - FTC_OLD_CMAP_BY_ENCODING = 1, - FTC_OLD_CMAP_BY_ID = 2 - - } FTC_OldCMapType; - - - typedef struct FTC_OldCMapIdRec_ - { - FT_UInt platform; - FT_UInt encoding; - - } FTC_OldCMapIdRec, *FTC_OldCMapId; - - - typedef struct FTC_OldCMapDescRec_ - { - FTC_FaceID face_id; - FTC_OldCMapType type; - - union - { - FT_UInt index; - FT_Encoding encoding; - FTC_OldCMapIdRec id; - - } u; - - } FTC_OldCMapDescRec, *FTC_OldCMapDesc; - -#endif /* FT_CONFIG_OLD_INTERNALS */ - - /*************************************************************************/ /* */ /* Each FTC_CMapNode contains a simple array to map a range of character */ @@ -266,21 +229,6 @@ } -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* - * Unfortunately, it is not possible to support binary backwards - * compatibility in the cmap cache. The FTC_CMapCache_Lookup signature - * changes were too deep, and there is no clever hackish way to detect - * what kind of structure we are being passed. - * - * On the other hand it seems that no production code is using this - * function on Unix distributions. - */ - -#endif - - /* documentation is in ftcache.h */ FT_EXPORT_DEF( FT_UInt ) @@ -315,57 +263,9 @@ return 0; } -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - /* - * If cmap_index is greater than the maximum number of cachable - * charmaps, we assume the request is from a legacy rogue client - * using old internal header. See include/config/ftoption.h. - */ - if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change ) - { - FTC_OldCMapDesc desc = (FTC_OldCMapDesc) face_id; - - - char_code = (FT_UInt32)cmap_index; - query.face_id = desc->face_id; - - - switch ( desc->type ) - { - case FTC_OLD_CMAP_BY_INDEX: - query.cmap_index = desc->u.index; - query.char_code = (FT_UInt32)cmap_index; - break; - - case FTC_OLD_CMAP_BY_ENCODING: - { - FT_Face face; - - - error = FTC_Manager_LookupFace( cache->manager, desc->face_id, - &face ); - if ( error ) - return 0; - - FT_Select_Charmap( face, desc->u.encoding ); - - return FT_Get_Char_Index( face, char_code ); - } - - default: - return 0; - } - } - else - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - { - query.face_id = face_id; - query.cmap_index = (FT_UInt)cmap_index; - query.char_code = char_code; - } + query.face_id = face_id; + query.cmap_index = (FT_UInt)cmap_index; + query.char_code = char_code; hash = FTC_CMAP_HASH( face_id, cmap_index, char_code ); diff --git a/freetype/src/cache/ftcmanag.c b/freetype/src/cache/ftcmanag.c index 76a510d04..4eb2c5bfd 100644 --- a/freetype/src/cache/ftcmanag.c +++ b/freetype/src/cache/ftcmanag.c @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */ +/* Copyright 2000-2006, 2008-2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -187,12 +187,12 @@ if ( asize == NULL ) - return FTC_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); *asize = NULL; if ( !manager ) - return FTC_Err_Invalid_Cache_Handle; + return FT_THROW( Invalid_Cache_Handle ); #ifdef FTC_INLINE @@ -314,12 +314,12 @@ if ( aface == NULL ) - return FTC_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); *aface = NULL; if ( !manager ) - return FTC_Err_Invalid_Cache_Handle; + return FT_THROW( Invalid_Cache_Handle ); /* we break encapsulation for the sake of speed */ #ifdef FTC_INLINE @@ -364,7 +364,7 @@ if ( !library ) - return FTC_Err_Invalid_Library_Handle; + return FT_THROW( Invalid_Library_Handle ); memory = library->memory; @@ -456,7 +456,8 @@ FTC_MruList_Reset( &manager->sizes ); FTC_MruList_Reset( &manager->faces ); } - /* XXX: FIXME: flush the caches? */ + + FTC_Manager_FlushN( manager, manager->num_nodes ); } @@ -473,7 +474,7 @@ /* check node weights */ if ( first ) { - FT_ULong weight = 0; + FT_Offset weight = 0; node = first; @@ -575,7 +576,7 @@ FTC_CacheClass clazz, FTC_Cache *acache ) { - FT_Error error = FTC_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); FTC_Cache cache = NULL; @@ -586,7 +587,7 @@ if ( manager->num_caches >= FTC_MAX_CACHES ) { - error = FTC_Err_Too_Many_Caches; + error = FT_THROW( Too_Many_Caches ); FT_ERROR(( "FTC_Manager_RegisterCache:" " too many registered caches\n" )); goto Exit; @@ -689,55 +690,4 @@ } -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_EXPORT_DEF( FT_Error ) - FTC_Manager_Lookup_Face( FTC_Manager manager, - FTC_FaceID face_id, - FT_Face *aface ) - { - return FTC_Manager_LookupFace( manager, face_id, aface ); - } - - - FT_EXPORT( FT_Error ) - FTC_Manager_Lookup_Size( FTC_Manager manager, - FTC_Font font, - FT_Face *aface, - FT_Size *asize ) - { - FTC_ScalerRec scaler; - FT_Error error; - FT_Size size; - FT_Face face; - - - scaler.face_id = font->face_id; - scaler.width = font->pix_width; - scaler.height = font->pix_height; - scaler.pixel = TRUE; - scaler.x_res = 0; - scaler.y_res = 0; - - error = FTC_Manager_LookupSize( manager, &scaler, &size ); - if ( error ) - { - face = NULL; - size = NULL; - } - else - face = size->face; - - if ( aface ) - *aface = face; - - if ( asize ) - *asize = size; - - return error; - } - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - /* END */ diff --git a/freetype/src/cache/ftcmanag.h b/freetype/src/cache/ftcmanag.h index d6c85162a..0aec33c58 100644 --- a/freetype/src/cache/ftcmanag.h +++ b/freetype/src/cache/ftcmanag.h @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2004, 2006, 2010 by */ +/* Copyright 2000-2001, 2003, 2004, 2006, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -94,8 +94,8 @@ FT_BEGIN_HEADER FT_Memory memory; FTC_Node nodes_list; - FT_ULong max_weight; - FT_ULong cur_weight; + FT_Offset max_weight; + FT_Offset cur_weight; FT_UInt num_nodes; FTC_Cache caches[FTC_MAX_CACHES]; diff --git a/freetype/src/cache/ftcmru.h b/freetype/src/cache/ftcmru.h index 8c3797fb0..6fccf1178 100644 --- a/freetype/src/cache/ftcmru.h +++ b/freetype/src/cache/ftcmru.h @@ -4,7 +4,7 @@ /* */ /* Simple MRU list-cache (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2004, 2005, 2006, 2010 by */ +/* Copyright 2000-2001, 2003-2006, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -166,7 +166,7 @@ FT_BEGIN_HEADER FTC_MruNode _first, _node; \ \ \ - error = FTC_Err_Ok; \ + error = FT_Err_Ok; \ _first = *(_pfirst); \ _node = NULL; \ \ diff --git a/freetype/src/cache/ftcsbits.c b/freetype/src/cache/ftcsbits.c index 8bf8d607e..6df1c1993 100644 --- a/freetype/src/cache/ftcsbits.c +++ b/freetype/src/cache/ftcsbits.c @@ -4,7 +4,7 @@ /* */ /* FreeType sbits manager (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 by */ +/* Copyright 2000-2006, 2009-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -116,7 +116,7 @@ if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count ) { FT_ERROR(( "ftc_snode_load: invalid glyph index" )); - return FTC_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } sbit = snode->sbits + ( gindex - gnode->gindex ); @@ -189,13 +189,13 @@ /* we mark unloaded glyphs with `sbit.buffer == 0' */ /* and `width == 255', `height == 0' */ /* */ - if ( error && error != FTC_Err_Out_Of_Memory ) + if ( error && FT_ERR_NEQ( error, Out_Of_Memory ) ) { BadGlyph: sbit->width = 255; sbit->height = 0; sbit->buffer = NULL; - error = FTC_Err_Ok; + error = FT_Err_Ok; if ( asize ) *asize = 0; } @@ -223,7 +223,7 @@ total = clazz->family_get_count( family, cache->manager ); if ( total == 0 || gindex >= total ) { - error = FTC_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } diff --git a/freetype/src/cff/cf2arrst.c b/freetype/src/cff/cf2arrst.c new file mode 100644 index 000000000..c8d6f1309 --- /dev/null +++ b/freetype/src/cff/cf2arrst.c @@ -0,0 +1,241 @@ +/***************************************************************************/ +/* */ +/* cf2arrst.c */ +/* */ +/* Adobe's code for Array Stacks (body). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" +#include FT_INTERNAL_DEBUG_H + +#include "cf2glue.h" +#include "cf2arrst.h" + +#include "cf2error.h" + + + /* + * CF2_ArrStack uses an error pointer, to enable shared errors. + * Shared errors are necessary when multiple objects allow the program + * to continue after detecting errors. Only the first error should be + * recorded. + */ + + FT_LOCAL_DEF( void ) + cf2_arrstack_init( CF2_ArrStack arrstack, + FT_Memory memory, + FT_Error* error, + size_t sizeItem ) + { + FT_ASSERT( arrstack != NULL ); + + /* initialize the structure */ + arrstack->memory = memory; + arrstack->error = error; + arrstack->sizeItem = sizeItem; + arrstack->allocated = 0; + arrstack->chunk = 10; /* chunks of 10 items */ + arrstack->count = 0; + arrstack->totalSize = 0; + arrstack->ptr = NULL; + } + + + FT_LOCAL_DEF( void ) + cf2_arrstack_finalize( CF2_ArrStack arrstack ) + { + FT_Memory memory = arrstack->memory; /* for FT_FREE */ + + + FT_ASSERT( arrstack != NULL ); + + arrstack->allocated = 0; + arrstack->count = 0; + arrstack->totalSize = 0; + + /* free the data buffer */ + FT_FREE( arrstack->ptr ); + } + + + /* allocate or reallocate the buffer size; */ + /* return false on memory error */ + static FT_Bool + cf2_arrstack_setNumElements( CF2_ArrStack arrstack, + size_t numElements ) + { + FT_ASSERT( arrstack != NULL ); + + { + FT_Error error = FT_Err_Ok; /* for FT_REALLOC */ + FT_Memory memory = arrstack->memory; /* for FT_REALLOC */ + + FT_Long newSize = (FT_Long)( numElements * arrstack->sizeItem ); + + + if ( numElements > LONG_MAX / arrstack->sizeItem ) + goto exit; + + + FT_ASSERT( newSize > 0 ); /* avoid realloc with zero size */ + + if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) ) + { + arrstack->allocated = numElements; + arrstack->totalSize = newSize; + + if ( arrstack->count > numElements ) + { + /* we truncated the list! */ + CF2_SET_ERROR( arrstack->error, Stack_Overflow ); + arrstack->count = numElements; + return FALSE; + } + + return TRUE; /* success */ + } + } + + exit: + /* if there's not already an error, store this one */ + CF2_SET_ERROR( arrstack->error, Out_Of_Memory ); + + return FALSE; + } + + + /* set the count, ensuring allocation is sufficient */ + FT_LOCAL_DEF( void ) + cf2_arrstack_setCount( CF2_ArrStack arrstack, + size_t numElements ) + { + FT_ASSERT( arrstack != NULL ); + + if ( numElements > arrstack->allocated ) + { + /* expand the allocation first */ + if ( !cf2_arrstack_setNumElements( arrstack, numElements ) ) + return; + } + + arrstack->count = numElements; + } + + + /* clear the count */ + FT_LOCAL_DEF( void ) + cf2_arrstack_clear( CF2_ArrStack arrstack ) + { + FT_ASSERT( arrstack != NULL ); + + arrstack->count = 0; + } + + + /* current number of items */ + FT_LOCAL_DEF( size_t ) + cf2_arrstack_size( const CF2_ArrStack arrstack ) + { + FT_ASSERT( arrstack != NULL ); + + return arrstack->count; + } + + + FT_LOCAL_DEF( void* ) + cf2_arrstack_getBuffer( const CF2_ArrStack arrstack ) + { + FT_ASSERT( arrstack != NULL ); + + return arrstack->ptr; + } + + + /* return pointer to the given element */ + FT_LOCAL_DEF( void* ) + cf2_arrstack_getPointer( const CF2_ArrStack arrstack, + size_t idx ) + { + void* newPtr; + + + FT_ASSERT( arrstack != NULL ); + + if ( idx >= arrstack->count ) + { + /* overflow */ + CF2_SET_ERROR( arrstack->error, Stack_Overflow ); + idx = 0; /* choose safe default */ + } + + newPtr = (FT_Byte*)arrstack->ptr + idx * arrstack->sizeItem; + + return newPtr; + } + + + /* push (append) an element at the end of the list; */ + /* return false on memory error */ + /* TODO: should there be a length param for extra checking? */ + FT_LOCAL_DEF( void ) + cf2_arrstack_push( CF2_ArrStack arrstack, + const void* ptr ) + { + FT_ASSERT( arrstack != NULL ); + + if ( arrstack->count == arrstack->allocated ) + { + /* grow the buffer by one chunk */ + if ( !cf2_arrstack_setNumElements( + arrstack, arrstack->allocated + arrstack->chunk ) ) + { + /* on error, ignore the push */ + return; + } + } + + FT_ASSERT( ptr != NULL ); + + { + size_t offset = arrstack->count * arrstack->sizeItem; + void* newPtr = (FT_Byte*)arrstack->ptr + offset; + + + FT_MEM_COPY( newPtr, ptr, arrstack->sizeItem ); + arrstack->count += 1; + } + } + + +/* END */ diff --git a/freetype/src/cff/cf2arrst.h b/freetype/src/cff/cf2arrst.h new file mode 100644 index 000000000..ff5ad8b12 --- /dev/null +++ b/freetype/src/cff/cf2arrst.h @@ -0,0 +1,100 @@ +/***************************************************************************/ +/* */ +/* cf2arrst.h */ +/* */ +/* Adobe's code for Array Stacks (specification). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2ARRST_H__ +#define __CF2ARRST_H__ + + +#include "cf2error.h" + + +FT_BEGIN_HEADER + + + /* need to define the struct here (not opaque) so it can be allocated by */ + /* clients */ + typedef struct CF2_ArrStackRec_ + { + FT_Memory memory; + FT_Error* error; + + size_t sizeItem; /* bytes per element */ + size_t allocated; /* items allocated */ + size_t chunk; /* allocation increment in items */ + size_t count; /* number of elements allocated */ + size_t totalSize; /* total bytes allocated */ + + void* ptr; /* ptr to data */ + + } CF2_ArrStackRec, *CF2_ArrStack; + + + FT_LOCAL( void ) + cf2_arrstack_init( CF2_ArrStack arrstack, + FT_Memory memory, + FT_Error* error, + size_t sizeItem ); + FT_LOCAL( void ) + cf2_arrstack_finalize( CF2_ArrStack arrstack ); + + FT_LOCAL( void ) + cf2_arrstack_setCount( CF2_ArrStack arrstack, + size_t numElements ); + FT_LOCAL( void ) + cf2_arrstack_clear( CF2_ArrStack arrstack ); + FT_LOCAL( size_t ) + cf2_arrstack_size( const CF2_ArrStack arrstack ); + + FT_LOCAL( void* ) + cf2_arrstack_getBuffer( const CF2_ArrStack arrstack ); + FT_LOCAL( void* ) + cf2_arrstack_getPointer( const CF2_ArrStack arrstack, + size_t idx ); + + FT_LOCAL( void ) + cf2_arrstack_push( CF2_ArrStack arrstack, + const void* ptr ); + + +FT_END_HEADER + + +#endif /* __CF2ARRST_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2blues.c b/freetype/src/cff/cf2blues.c new file mode 100644 index 000000000..5b348398a --- /dev/null +++ b/freetype/src/cff/cf2blues.c @@ -0,0 +1,578 @@ +/***************************************************************************/ +/* */ +/* cf2blues.c */ +/* */ +/* Adobe's code for handling Blue Zones (body). */ +/* */ +/* Copyright 2009-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" +#include FT_INTERNAL_DEBUG_H + +#include "cf2blues.h" +#include "cf2hints.h" +#include "cf2font.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_cf2blues + + + /* + * For blue values, the FreeType parser produces an array of integers, + * while the Adobe CFF engine produces an array of fixed. + * Define a macro to convert FreeType to fixed. + */ +#define cf2_blueToFixed( x ) cf2_intToFixed( x ) + + + FT_LOCAL_DEF( void ) + cf2_blues_init( CF2_Blues blues, + CF2_Font font ) + { + /* pointer to parsed font object */ + CFF_Decoder* decoder = font->decoder; + + CF2_Fixed zoneHeight; + CF2_Fixed maxZoneHeight = 0; + CF2_Fixed csUnitsPerPixel; + + size_t numBlueValues; + size_t numOtherBlues; + size_t numFamilyBlues; + size_t numFamilyOtherBlues; + + FT_Pos* blueValues; + FT_Pos* otherBlues; + FT_Pos* familyBlues; + FT_Pos* familyOtherBlues; + + size_t i; + CF2_Fixed emBoxBottom, emBoxTop; + + CF2_Int unitsPerEm = font->unitsPerEm; + + + if ( unitsPerEm == 0 ) + unitsPerEm = 1000; + + FT_ZERO( blues ); + blues->scale = font->innerTransform.d; + + cf2_getBlueMetrics( decoder, + &blues->blueScale, + &blues->blueShift, + &blues->blueFuzz ); + + cf2_getBlueValues( decoder, &numBlueValues, &blueValues ); + cf2_getOtherBlues( decoder, &numOtherBlues, &otherBlues ); + cf2_getFamilyBlues( decoder, &numFamilyBlues, &familyBlues ); + cf2_getFamilyOtherBlues( decoder, &numFamilyOtherBlues, &familyOtherBlues ); + + /* + * synthetic em box hint heuristic + * + * Apply this when ideographic dictionary (LanguageGroup 1) has no + * real alignment zones. Adobe tools generate dummy zones at -250 and + * 1100 for a 1000 unit em. Fonts with ICF-based alignment zones + * should not enable the heuristic. When the heuristic is enabled, + * the font's blue zones are ignored. + * + */ + + /* get em box from OS/2 typoAscender/Descender */ + /* TODO: FreeType does not parse these metrics. Skip them for now. */ +#if 0 + FCM_getHorizontalLineMetrics( &e, + font->font, + &ascender, + &descender, + &linegap ); + if ( ascender - descender == unitsPerEm ) + { + emBoxBottom = cf2_intToFixed( descender ); + emBoxTop = cf2_intToFixed( ascender ); + } + else +#endif + { + emBoxBottom = CF2_ICF_Bottom; + emBoxTop = CF2_ICF_Top; + } + + if ( cf2_getLanguageGroup( decoder ) == 1 && + ( numBlueValues == 0 || + ( numBlueValues == 4 && + cf2_blueToFixed( blueValues[0] ) < emBoxBottom && + cf2_blueToFixed( blueValues[1] ) < emBoxBottom && + cf2_blueToFixed( blueValues[2] ) > emBoxTop && + cf2_blueToFixed( blueValues[3] ) > emBoxTop ) ) ) + { + /* + * Construct hint edges suitable for synthetic ghost hints at top + * and bottom of em box. +-CF2_MIN_COUNTER allows for unhinted + * features above or below the last hinted edge. This also gives a + * net 1 pixel boost to the height of ideographic glyphs. + * + * Note: Adjust synthetic hints outward by epsilon (0x.0001) to + * avoid interference. E.g., some fonts have real hints at + * 880 and -120. + */ + + blues->emBoxBottomEdge.csCoord = emBoxBottom - CF2_FIXED_EPSILON; + blues->emBoxBottomEdge.dsCoord = cf2_fixedRound( + FT_MulFix( + blues->emBoxBottomEdge.csCoord, + blues->scale ) ) - + CF2_MIN_COUNTER; + blues->emBoxBottomEdge.scale = blues->scale; + blues->emBoxBottomEdge.flags = CF2_GhostBottom | + CF2_Locked | + CF2_Synthetic; + + blues->emBoxTopEdge.csCoord = emBoxTop + CF2_FIXED_EPSILON + + 2 * font->darkenY; + blues->emBoxTopEdge.dsCoord = cf2_fixedRound( + FT_MulFix( + blues->emBoxTopEdge.csCoord, + blues->scale ) ) + + CF2_MIN_COUNTER; + blues->emBoxTopEdge.scale = blues->scale; + blues->emBoxTopEdge.flags = CF2_GhostTop | + CF2_Locked | + CF2_Synthetic; + + blues->doEmBoxHints = TRUE; /* enable the heuristic */ + + return; + } + + /* copy `BlueValues' and `OtherBlues' to a combined array of top and */ + /* bottom zones */ + for ( i = 0; i < numBlueValues; i += 2 ) + { + blues->zone[blues->count].csBottomEdge = + cf2_blueToFixed( blueValues[i] ); + blues->zone[blues->count].csTopEdge = + cf2_blueToFixed( blueValues[i + 1] ); + + zoneHeight = blues->zone[blues->count].csTopEdge - + blues->zone[blues->count].csBottomEdge; + + if ( zoneHeight < 0 ) + { + FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" )); + continue; /* reject this zone */ + } + + if ( zoneHeight > maxZoneHeight ) + { + /* take maximum before darkening adjustment */ + /* so overshoot suppression point doesn't change */ + maxZoneHeight = zoneHeight; + } + + /* adjust both edges of top zone upward by twice darkening amount */ + if ( i != 0 ) + { + blues->zone[blues->count].csTopEdge += 2 * font->darkenY; + blues->zone[blues->count].csBottomEdge += 2 * font->darkenY; + } + + /* first `BlueValue' is bottom zone; others are top */ + if ( i == 0 ) + { + blues->zone[blues->count].bottomZone = + TRUE; + blues->zone[blues->count].csFlatEdge = + blues->zone[blues->count].csTopEdge; + } + else + { + blues->zone[blues->count].bottomZone = + FALSE; + blues->zone[blues->count].csFlatEdge = + blues->zone[blues->count].csBottomEdge; + } + + blues->count += 1; + } + + for ( i = 0; i < numOtherBlues; i += 2 ) + { + blues->zone[blues->count].csBottomEdge = + cf2_blueToFixed( otherBlues[i] ); + blues->zone[blues->count].csTopEdge = + cf2_blueToFixed( otherBlues[i + 1] ); + + zoneHeight = blues->zone[blues->count].csTopEdge - + blues->zone[blues->count].csBottomEdge; + + if ( zoneHeight < 0 ) + { + FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" )); + continue; /* reject this zone */ + } + + if ( zoneHeight > maxZoneHeight ) + { + /* take maximum before darkening adjustment */ + /* so overshoot suppression point doesn't change */ + maxZoneHeight = zoneHeight; + } + + /* Note: bottom zones are not adjusted for darkening amount */ + + /* all OtherBlues are bottom zone */ + blues->zone[blues->count].bottomZone = + TRUE; + blues->zone[blues->count].csFlatEdge = + blues->zone[blues->count].csTopEdge; + + blues->count += 1; + } + + /* Adjust for FamilyBlues */ + + /* Search for the nearest flat edge in `FamilyBlues' or */ + /* `FamilyOtherBlues'. According to the Black Book, any matching edge */ + /* must be within one device pixel */ + + csUnitsPerPixel = FT_DivFix( cf2_intToFixed( 1 ), blues->scale ); + + /* loop on all zones in this font */ + for ( i = 0; i < blues->count; i++ ) + { + size_t j; + CF2_Fixed minDiff; + CF2_Fixed flatFamilyEdge, diff; + /* value for this font */ + CF2_Fixed flatEdge = blues->zone[i].csFlatEdge; + + + if ( blues->zone[i].bottomZone ) + { + /* In a bottom zone, the top edge is the flat edge. */ + /* Search `FamilyOtherBlues' for bottom zones; look for closest */ + /* Family edge that is within the one pixel threshold. */ + + minDiff = CF2_FIXED_MAX; + + for ( j = 0; j < numFamilyOtherBlues; j += 2 ) + { + /* top edge */ + flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] ); + + diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + + if ( diff < minDiff && diff < csUnitsPerPixel ) + { + blues->zone[i].csFlatEdge = flatFamilyEdge; + minDiff = diff; + + if ( diff == 0 ) + break; + } + } + + /* check the first member of FamilyBlues, which is a bottom zone */ + if ( numFamilyBlues >= 2 ) + { + /* top edge */ + flatFamilyEdge = cf2_blueToFixed( familyBlues[1] ); + + diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + + if ( diff < minDiff && diff < csUnitsPerPixel ) + blues->zone[i].csFlatEdge = flatFamilyEdge; + } + } + else + { + /* In a top zone, the bottom edge is the flat edge. */ + /* Search `FamilyBlues' for top zones; skip first zone, which is a */ + /* bottom zone; look for closest Family edge that is within the */ + /* one pixel threshold */ + + minDiff = CF2_FIXED_MAX; + + for ( j = 2; j < numFamilyBlues; j += 2 ) + { + /* bottom edge */ + flatFamilyEdge = cf2_blueToFixed( familyBlues[j] ); + + /* adjust edges of top zone upward by twice darkening amount */ + flatFamilyEdge += 2 * font->darkenY; /* bottom edge */ + + diff = cf2_fixedAbs( flatEdge - flatFamilyEdge ); + + if ( diff < minDiff && diff < csUnitsPerPixel ) + { + blues->zone[i].csFlatEdge = flatFamilyEdge; + minDiff = diff; + + if ( diff == 0 ) + break; + } + } + } + } + + /* TODO: enforce separation of zones, including BlueFuzz */ + + /* Adjust BlueScale; similar to AdjustBlueScale() in coretype */ + /* `bcsetup.c'. */ + + if ( maxZoneHeight > 0 ) + { + if ( blues->blueScale > FT_DivFix( cf2_intToFixed( 1 ), + maxZoneHeight ) ) + { + /* clamp at maximum scale */ + blues->blueScale = FT_DivFix( cf2_intToFixed( 1 ), + maxZoneHeight ); + } + + /* + * TODO: Revisit the bug fix for 613448. The minimum scale + * requirement catches a number of library fonts. For + * example, with default BlueScale (.039625) and 0.4 minimum, + * the test below catches any font with maxZoneHeight < 10.1. + * There are library fonts ranging from 2 to 10 that get + * caught, including e.g., Eurostile LT Std Medium with + * maxZoneHeight of 6. + * + */ +#if 0 + if ( blueScale < .4 / maxZoneHeight ) + { + tetraphilia_assert( 0 ); + /* clamp at minimum scale, per bug 0613448 fix */ + blueScale = .4 / maxZoneHeight; + } +#endif + + } + + /* + * Suppress overshoot and boost blue zones at small sizes. Boost + * amount varies linearly from 0.5 pixel near 0 to 0 pixel at + * blueScale cutoff. + * Note: This boost amount is different from the coretype heuristic. + * + */ + + if ( blues->scale < blues->blueScale ) + { + blues->suppressOvershoot = TRUE; + + /* Change rounding threshold for `dsFlatEdge'. */ + /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */ + /* 10ppem Arial */ + + blues->boost = FT_MulFix( + cf2_floatToFixed( .6 ), + ( cf2_intToFixed( 1 ) - + FT_DivFix( blues->scale, + blues->blueScale ) ) ); + if ( blues->boost > 0x7FFF ) + { + /* boost must remain less than 0.5, or baseline could go negative */ + blues->boost = 0x7FFF; + } + } + + /* boost and darkening have similar effects; don't do both */ + if ( font->stemDarkened ) + blues->boost = 0; + + /* set device space alignment for each zone; */ + /* apply boost amount before rounding flat edge */ + + for ( i = 0; i < blues->count; i++ ) + { + if ( blues->zone[i].bottomZone ) + blues->zone[i].dsFlatEdge = cf2_fixedRound( + FT_MulFix( + blues->zone[i].csFlatEdge, + blues->scale ) - + blues->boost ); + else + blues->zone[i].dsFlatEdge = cf2_fixedRound( + FT_MulFix( + blues->zone[i].csFlatEdge, + blues->scale ) + + blues->boost ); + } + } + + + /* + * Check whether `stemHint' is captured by one of the blue zones. + * + * Zero, one or both edges may be valid; only valid edges can be + * captured. For compatibility with CoolType, search top and bottom + * zones in the same pass (see `BlueLock'). If a hint is captured, + * return true and position the edge(s) in one of 3 ways: + * + * 1) If `BlueScale' suppresses overshoot, position the captured edge + * at the flat edge of the zone. + * 2) If overshoot is not suppressed and `BlueShift' requires + * overshoot, position the captured edge a minimum of 1 device pixel + * from the flat edge. + * 3) If overshoot is not suppressed or required, position the captured + * edge at the nearest device pixel. + * + */ + FT_LOCAL_DEF( FT_Bool ) + cf2_blues_capture( const CF2_Blues blues, + CF2_Hint bottomHintEdge, + CF2_Hint topHintEdge ) + { + /* TODO: validate? */ + CF2_Fixed csFuzz = blues->blueFuzz; + + /* new position of captured edge */ + CF2_Fixed dsNew; + + /* amount that hint is moved when positioned */ + CF2_Fixed dsMove = 0; + + FT_Bool captured = FALSE; + CF2_UInt i; + + + /* assert edge flags are consistent */ + FT_ASSERT( !cf2_hint_isTop( bottomHintEdge ) && + !cf2_hint_isBottom( topHintEdge ) ); + + /* TODO: search once without blue fuzz for compatibility with coretype? */ + for ( i = 0; i < blues->count; i++ ) + { + if ( blues->zone[i].bottomZone && + cf2_hint_isBottom( bottomHintEdge ) ) + { + if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= + bottomHintEdge->csCoord && + bottomHintEdge->csCoord <= + ( blues->zone[i].csTopEdge + csFuzz ) ) + { + /* bottom edge captured by bottom zone */ + + if ( blues->suppressOvershoot ) + dsNew = blues->zone[i].dsFlatEdge; + + else if ( ( blues->zone[i].csTopEdge - bottomHintEdge->csCoord ) >= + blues->blueShift ) + { + /* guarantee minimum of 1 pixel overshoot */ + dsNew = FT_MIN( + cf2_fixedRound( bottomHintEdge->dsCoord ), + blues->zone[i].dsFlatEdge - cf2_intToFixed( 1 ) ); + } + + else + { + /* simply round captured edge */ + dsNew = cf2_fixedRound( bottomHintEdge->dsCoord ); + } + + dsMove = dsNew - bottomHintEdge->dsCoord; + captured = TRUE; + + break; + } + } + + if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) ) + { + if ( ( blues->zone[i].csBottomEdge - csFuzz ) <= + topHintEdge->csCoord && + topHintEdge->csCoord <= + ( blues->zone[i].csTopEdge + csFuzz ) ) + { + /* top edge captured by top zone */ + + if ( blues->suppressOvershoot ) + dsNew = blues->zone[i].dsFlatEdge; + + else if ( ( topHintEdge->csCoord - blues->zone[i].csBottomEdge ) >= + blues->blueShift ) + { + /* guarantee minimum of 1 pixel overshoot */ + dsNew = FT_MAX( + cf2_fixedRound( topHintEdge->dsCoord ), + blues->zone[i].dsFlatEdge + cf2_intToFixed( 1 ) ); + } + + else + { + /* simply round captured edge */ + dsNew = cf2_fixedRound( topHintEdge->dsCoord ); + } + + dsMove = dsNew - topHintEdge->dsCoord; + captured = TRUE; + + break; + } + } + } + + if ( captured ) + { + /* move both edges and flag them `locked' */ + if ( cf2_hint_isValid( bottomHintEdge ) ) + { + bottomHintEdge->dsCoord += dsMove; + cf2_hint_lock( bottomHintEdge ); + } + + if ( cf2_hint_isValid( topHintEdge ) ) + { + topHintEdge->dsCoord += dsMove; + cf2_hint_lock( topHintEdge ); + } + } + + return captured; + } + + +/* END */ diff --git a/freetype/src/cff/cf2blues.h b/freetype/src/cff/cf2blues.h new file mode 100644 index 000000000..2f38fcad8 --- /dev/null +++ b/freetype/src/cff/cf2blues.h @@ -0,0 +1,185 @@ +/***************************************************************************/ +/* */ +/* cf2blues.h */ +/* */ +/* Adobe's code for handling Blue Zones (specification). */ +/* */ +/* Copyright 2009-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + + /* + * A `CF2_Blues' object stores the blue zones (horizontal alignment + * zones) of a font. These are specified in the CFF private dictionary + * by `BlueValues', `OtherBlues', `FamilyBlues', and `FamilyOtherBlues'. + * Each zone is defined by a top and bottom edge in character space. + * Further, each zone is either a top zone or a bottom zone, as recorded + * by `bottomZone'. + * + * The maximum number of `BlueValues' and `FamilyBlues' is 7 each. + * However, these are combined to produce a total of 7 zones. + * Similarly, the maximum number of `OtherBlues' and `FamilyOtherBlues' + * is 5 and these are combined to produce an additional 5 zones. + * + * Blue zones are used to `capture' hints and force them to a common + * alignment point. This alignment is recorded in device space in + * `dsFlatEdge'. Except for this value, a `CF2_Blues' object could be + * constructed independently of scaling. Construction may occur once + * the matrix is known. Other features implemented in the Capture + * method are overshoot suppression, overshoot enforcement, and Blue + * Boost. + * + * Capture is determined by `BlueValues' and `OtherBlues', but the + * alignment point may be adjusted to the scaled flat edge of + * `FamilyBlues' or `FamilyOtherBlues'. No alignment is done to the + * curved edge of a zone. + * + */ + + +#ifndef __CF2BLUES_H__ +#define __CF2BLUES_H__ + + +#include "cf2glue.h" + + +FT_BEGIN_HEADER + + + /* + * `CF2_Hint' is shared by `cf2hints.h' and + * `cf2blues.h', but `cf2blues.h' depends on + * `cf2hints.h', so define it here. Note: The typedef is in + * `cf2glue.h'. + * + */ + enum + { + CF2_GhostBottom = 0x1, /* a single bottom edge */ + CF2_GhostTop = 0x2, /* a single top edge */ + CF2_PairBottom = 0x4, /* the bottom edge of a stem hint */ + CF2_PairTop = 0x8, /* the top edge of a stem hint */ + CF2_Locked = 0x10, /* this edge has been aligned */ + /* by a blue zone */ + CF2_Synthetic = 0x20 /* this edge was synthesized */ + }; + + + /* + * Default value for OS/2 typoAscender/Descender when their difference + * is not equal to `unitsPerEm'. The default is based on -250 and 1100 + * in `CF2_Blues', assuming 1000 units per em here. + * + */ + enum + { + CF2_ICF_Top = cf2_intToFixed( 880 ), + CF2_ICF_Bottom = cf2_intToFixed( -120 ) + }; + + + /* + * Constant used for hint adjustment and for synthetic em box hint + * placement. + */ +#define CF2_MIN_COUNTER cf2_floatToFixed( 0.5 ) + + + /* shared typedef is in cf2glue.h */ + struct CF2_HintRec_ + { + CF2_UInt flags; /* attributes of the edge */ + size_t index; /* index in original stem hint array */ + /* (if not synthetic) */ + CF2_Fixed csCoord; + CF2_Fixed dsCoord; + CF2_Fixed scale; + }; + + + typedef struct CF2_BlueRec_ + { + CF2_Fixed csBottomEdge; + CF2_Fixed csTopEdge; + CF2_Fixed csFlatEdge; /* may be from either local or Family zones */ + CF2_Fixed dsFlatEdge; /* top edge of bottom zone or bottom edge */ + /* of top zone (rounded) */ + FT_Bool bottomZone; + + } CF2_BlueRec; + + + /* max total blue zones is 12 */ + enum + { + CF2_MAX_BLUES = 7, + CF2_MAX_OTHERBLUES = 5 + }; + + + typedef struct CF2_BluesRec_ + { + CF2_Fixed scale; + CF2_UInt count; + FT_Bool suppressOvershoot; + FT_Bool doEmBoxHints; + + CF2_Fixed blueScale; + CF2_Fixed blueShift; + CF2_Fixed blueFuzz; + + CF2_Fixed boost; + + CF2_HintRec emBoxTopEdge; + CF2_HintRec emBoxBottomEdge; + + CF2_BlueRec zone[CF2_MAX_BLUES + CF2_MAX_OTHERBLUES]; + + } CF2_BluesRec, *CF2_Blues; + + + FT_LOCAL( void ) + cf2_blues_init( CF2_Blues blues, + CF2_Font font ); + FT_LOCAL( FT_Bool ) + cf2_blues_capture( const CF2_Blues blues, + CF2_Hint bottomHintEdge, + CF2_Hint topHintEdge ); + + +FT_END_HEADER + + +#endif /* __CF2BLUES_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2error.c b/freetype/src/cff/cf2error.c new file mode 100644 index 000000000..b5595a3d1 --- /dev/null +++ b/freetype/src/cff/cf2error.c @@ -0,0 +1,52 @@ +/***************************************************************************/ +/* */ +/* cf2error.c */ +/* */ +/* Adobe's code for error handling (body). */ +/* */ +/* Copyright 2006-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" +#include "cf2error.h" + + + FT_LOCAL_DEF( void ) + cf2_setError( FT_Error* error, + FT_Error value ) + { + if ( error && *error == 0 ) + *error = value; + } + + +/* END */ diff --git a/freetype/src/cff/cf2error.h b/freetype/src/cff/cf2error.h new file mode 100644 index 000000000..6453ebcb7 --- /dev/null +++ b/freetype/src/cff/cf2error.h @@ -0,0 +1,119 @@ +/***************************************************************************/ +/* */ +/* cf2error.h */ +/* */ +/* Adobe's code for error handling (specification). */ +/* */ +/* Copyright 2006-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2ERROR_H__ +#define __CF2ERROR_H__ + + +#include FT_MODULE_ERRORS_H + +#undef __FTERRORS_H__ + +#undef FT_ERR_PREFIX +#define FT_ERR_PREFIX CF2_Err_ +#define FT_ERR_BASE FT_Mod_Err_CF2 + + +#include FT_ERRORS_H +#include "cf2ft.h" + + +FT_BEGIN_HEADER + + + /* + * A poor-man error facility. + * + * This code being written in vanilla C, doesn't have the luxury of a + * language-supported exception mechanism such as the one available in + * Java. Instead, we are stuck with using error codes that must be + * carefully managed and preserved. However, it is convenient for us to + * model our error mechanism on a Java-like exception mechanism. + * When we assign an error code we are thus `throwing' an error. + * + * The perservation of an error code is done by coding convention. + * Upon a function call if the error code is anything other than + * `FT_Err_Ok', which is guaranteed to be zero, we + * will return without altering that error. This will allow the + * error to propogate and be handled at the appropriate location in + * the code. + * + * This allows a style of code where the error code is initialized + * up front and a block of calls are made with the error code only + * being checked after the block. If a new error occurs, the original + * error will be preserved and a functional no-op should result in any + * subsequent function that has an initial error code not equal to + * `FT_Err_Ok'. + * + * Errors are encoded by calling the `FT_THROW' macro. For example, + * + * { + * FT_Error e; + * + * + * ... + * e = FT_THROW( Out_Of_Memory ); + * } + * + */ + + + /* Set error code to a particular value. */ + FT_LOCAL( void ) + cf2_setError( FT_Error* error, + FT_Error value ); + + + /* + * A macro that conditionally sets an error code. + * + * This macro will first check whether `error' is set; + * if not, it will set it to `e'. + * + */ +#define CF2_SET_ERROR( error, e ) \ + cf2_setError( error, FT_THROW( e ) ) + + +FT_END_HEADER + + +#endif /* __CF2ERROR_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2fixed.h b/freetype/src/cff/cf2fixed.h new file mode 100644 index 000000000..ed1452a7d --- /dev/null +++ b/freetype/src/cff/cf2fixed.h @@ -0,0 +1,95 @@ +/***************************************************************************/ +/* */ +/* cf2fixed.h */ +/* */ +/* Adobe's code for Fixed Point Mathematics (specification only). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2FIXED_H__ +#define __CF2FIXED_H__ + + +FT_BEGIN_HEADER + + + /* rasterizer integer and fixed point arithmetic must be 32-bit */ + +#define CF2_Fixed CF2_F16Dot16 + typedef FT_Int32 CF2_Frac; /* 2.30 fixed point */ + + +#define CF2_FIXED_MAX ( (CF2_Fixed)0x7FFFFFFFL ) +#define CF2_FIXED_MIN ( (CF2_Fixed)0x80000000L ) +#define CF2_FIXED_ONE 0x10000L +#define CF2_FIXED_EPSILON 0x0001 + + /* in C 89, left and right shift of negative numbers is */ + /* implementation specific behaviour in the general case */ + +#define cf2_intToFixed( i ) \ + ( (CF2_Fixed)( (FT_UInt32)(i) << 16 ) ) +#define cf2_fixedToInt( x ) \ + ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) ) +#define cf2_fixedRound( x ) \ + ( (CF2_Fixed)( ( (x) + 0x8000 ) & 0xFFFF0000L ) ) +#define cf2_floatToFixed( f ) \ + ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) ) +#define cf2_fixedAbs( x ) \ + ( (x) < 0 ? -(x) : (x) ) +#define cf2_fixedFloor( x ) \ + ( (CF2_Fixed)( (x) & 0xFFFF0000L ) ) +#define cf2_fixedFraction( x ) \ + ( (x) - cf2_fixedFloor( x ) ) +#define cf2_fracToFixed( x ) \ + ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \ + : ( ( (x) + 0x2000 ) >> 14 ) ) + + + /* signed numeric types */ + typedef enum CF2_NumberType_ + { + CF2_NumberFixed, /* 16.16 */ + CF2_NumberFrac, /* 2.30 */ + CF2_NumberInt /* 32.0 */ + + } CF2_NumberType; + + +FT_END_HEADER + + +#endif /* __CF2FIXED_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2font.c b/freetype/src/cff/cf2font.c new file mode 100644 index 000000000..479d9125d --- /dev/null +++ b/freetype/src/cff/cf2font.c @@ -0,0 +1,403 @@ +/***************************************************************************/ +/* */ +/* cf2font.c */ +/* */ +/* Adobe's code for font instances (body). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" + +#include "cf2glue.h" +#include "cf2font.h" +#include "cf2error.h" +#include "cf2intrp.h" + + + /* Compute a stem darkening amount in character space. */ + static void + cf2_computeDarkening( CF2_Fixed emRatio, + CF2_Fixed ppem, + CF2_Fixed stemWidth, + CF2_Fixed* darkenAmount, + CF2_Fixed boldenAmount, + FT_Bool stemDarkened ) + { + /* Internal calculations are done in units per thousand for */ + /* convenience. */ + CF2_Fixed stemWidthPer1000, scaledStem; + + + *darkenAmount = 0; + + if ( boldenAmount == 0 && !stemDarkened ) + return; + + /* protect against range problems and divide by zero */ + if ( emRatio < cf2_floatToFixed( .01 ) ) + return; + + if ( stemDarkened ) + { + /* convert from true character space to 1000 unit character space; */ + /* add synthetic emboldening effect */ + + /* we have to assure that the computation of `scaledStem' */ + /* and `stemWidthPer1000' don't overflow */ + + stemWidthPer1000 = FT_MulFix( stemWidth + boldenAmount, emRatio ); + + if ( emRatio > CF2_FIXED_ONE && + stemWidthPer1000 <= ( stemWidth + boldenAmount ) ) + { + stemWidthPer1000 = 0; /* to pacify compiler */ + scaledStem = cf2_intToFixed( 2333 ); + } + else + { + scaledStem = FT_MulFix( stemWidthPer1000, ppem ); + + if ( ppem > CF2_FIXED_ONE && + scaledStem <= stemWidthPer1000 ) + scaledStem = cf2_intToFixed( 2333 ); + } + + /* + * Total darkening amount is computed in 1000 unit character space + * using the modified 5 part curve as Avalon rasterizer. + * The darkening amount is smaller for thicker stems. + * It becomes zero when the stem is thicker than 2.333 pixels. + * + * In Avalon rasterizer, + * + * darkenAmount = 0.5 pixels if scaledStem <= 0.5 pixels, + * darkenAmount = 0.333 pixels if 1 <= scaledStem <= 1.667 pixels, + * darkenAmount = 0 pixel if scaledStem >= 2.333 pixels, + * + * and piecewise linear in-between. + * + */ + if ( scaledStem < cf2_intToFixed( 500 ) ) + *darkenAmount = FT_DivFix( cf2_intToFixed( 400 ), ppem ); + + else if ( scaledStem < cf2_intToFixed( 1000 ) ) + *darkenAmount = FT_DivFix( cf2_intToFixed( 525 ), ppem ) - + FT_MulFix( stemWidthPer1000, + cf2_floatToFixed( .25 ) ); + + else if ( scaledStem < cf2_intToFixed( 1667 ) ) + *darkenAmount = FT_DivFix( cf2_intToFixed( 275 ), ppem ); + + else if ( scaledStem < cf2_intToFixed( 2333 ) ) + *darkenAmount = FT_DivFix( cf2_intToFixed( 963 ), ppem ) - + FT_MulFix( stemWidthPer1000, + cf2_floatToFixed( .413 ) ); + + /* use half the amount on each side and convert back to true */ + /* character space */ + *darkenAmount = FT_DivFix( *darkenAmount, 2 * emRatio ); + } + + /* add synthetic emboldening effect in character space */ + *darkenAmount += boldenAmount / 2; + } + + + /* set up values for the current FontDict and matrix */ + + /* caller's transform is adjusted for subpixel positioning */ + static void + cf2_font_setup( CF2_Font font, + const CF2_Matrix* transform ) + { + /* pointer to parsed font object */ + CFF_Decoder* decoder = font->decoder; + + FT_Bool needExtraSetup; + + /* character space units */ + CF2_Fixed boldenX = font->syntheticEmboldeningAmountX; + CF2_Fixed boldenY = font->syntheticEmboldeningAmountY; + + CF2_Fixed ppem; + + + /* clear previous error */ + font->error = FT_Err_Ok; + + /* if a CID fontDict has changed, we need to recompute some cached */ + /* data */ + needExtraSetup = + (FT_Bool)( font->lastSubfont != cf2_getSubfont( decoder ) ); + + /* if ppem has changed, we need to recompute some cached data */ + /* note: because of CID font matrix concatenation, ppem and transform */ + /* do not necessarily track. */ + ppem = cf2_getPpemY( decoder ); + if ( font->ppem != ppem ) + { + font->ppem = ppem; + needExtraSetup = TRUE; + } + + /* copy hinted flag on each call */ + font->hinted = (FT_Bool)( font->renderingFlags & CF2_FlagsHinted ); + + /* determine if transform has changed; */ + /* include Fontmatrix but ignore translation */ + if ( ft_memcmp( transform, + &font->currentTransform, + 4 * sizeof ( CF2_Fixed ) ) != 0 ) + { + /* save `key' information for `cache of one' matrix data; */ + /* save client transform, without the translation */ + font->currentTransform = *transform; + font->currentTransform.tx = + font->currentTransform.ty = cf2_intToFixed( 0 ); + + /* TODO: FreeType transform is simple scalar; for now, use identity */ + /* for outer */ + font->innerTransform = *transform; + font->outerTransform.a = + font->outerTransform.d = cf2_intToFixed( 1 ); + font->outerTransform.b = + font->outerTransform.c = cf2_intToFixed( 0 ); + + needExtraSetup = TRUE; + } + + /* + * font->darkened is set to true if there is a stem darkening request or + * the font is synthetic emboldened. + * font->darkened controls whether to adjust blue zones, winding order, + * and hinting. + * + */ + if ( font->stemDarkened != ( font->renderingFlags & CF2_FlagsDarkened ) ) + { + font->stemDarkened = + (FT_Bool)( font->renderingFlags & CF2_FlagsDarkened ); + + /* blue zones depend on darkened flag */ + needExtraSetup = TRUE; + } + + /* recompute variables that are dependent on transform or FontDict or */ + /* darken flag */ + if ( needExtraSetup ) + { + /* StdVW is found in the private dictionary; */ + /* recompute darkening amounts whenever private dictionary or */ + /* transform change */ + /* Note: a rendering flag turns darkening on or off, so we want to */ + /* store the `on' amounts; */ + /* darkening amount is computed in character space */ + /* TODO: testing size-dependent darkening here; */ + /* what to do for rotations? */ + + CF2_Fixed emRatio; + CF2_Fixed stdHW; + CF2_Int unitsPerEm = font->unitsPerEm; + + + if ( unitsPerEm == 0 ) + unitsPerEm = 1000; + + ppem = FT_MAX( cf2_intToFixed( 4 ), + font->ppem ); /* use minimum ppem of 4 */ + +#if 0 + /* since vstem is measured in the x-direction, we use the `a' member */ + /* of the fontMatrix */ + emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->a ); +#endif + + /* Freetype does not preserve the fontMatrix when parsing; use */ + /* unitsPerEm instead. */ + /* TODO: check precision of this */ + emRatio = cf2_intToFixed( 1000 ) / unitsPerEm; + font->stdVW = cf2_getStdVW( decoder ); + + if ( font->stdVW <= 0 ) + font->stdVW = FT_DivFix( cf2_intToFixed( 75 ), emRatio ); + + if ( boldenX > 0 ) + { + /* Ensure that boldenX is at least 1 pixel for synthetic bold font */ + /* (similar to what Avalon does) */ + boldenX = FT_MAX( boldenX, + FT_DivFix( cf2_intToFixed( unitsPerEm ), ppem ) ); + + /* Synthetic emboldening adds at least 1 pixel to darkenX, while */ + /* stem darkening adds at most half pixel. Since the purpose of */ + /* stem darkening (readability at small sizes) is met with */ + /* synthetic emboldening, no need to add stem darkening for a */ + /* synthetic bold font. */ + cf2_computeDarkening( emRatio, + ppem, + font->stdVW, + &font->darkenX, + boldenX, + FALSE ); + } + else + cf2_computeDarkening( emRatio, + ppem, + font->stdVW, + &font->darkenX, + 0, + font->stemDarkened ); + +#if 0 + /* since hstem is measured in the y-direction, we use the `d' member */ + /* of the fontMatrix */ + /* TODO: use the same units per em as above; check this */ + emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->d ); +#endif + + /* set the default stem width, because it must be the same for all */ + /* family members; */ + /* choose a constant for StdHW that depends on font contrast */ + stdHW = cf2_getStdHW( decoder ); + + if ( stdHW > 0 && font->stdVW > 2 * stdHW ) + font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio ); + else + { + /* low contrast font gets less hstem darkening */ + font->stdHW = FT_DivFix( cf2_intToFixed( 110 ), emRatio ); + } + + cf2_computeDarkening( emRatio, + ppem, + font->stdHW, + &font->darkenY, + boldenY, + font->stemDarkened ); + + if ( font->darkenX != 0 || font->darkenY != 0 ) + font->darkened = TRUE; + else + font->darkened = FALSE; + + font->reverseWinding = FALSE; /* initial expectation is CCW */ + + /* compute blue zones for this instance */ + cf2_blues_init( &font->blues, font ); + } + } + + + /* equivalent to AdobeGetOutline */ + FT_LOCAL_DEF( FT_Error ) + cf2_getGlyphOutline( CF2_Font font, + CF2_Buffer charstring, + const CF2_Matrix* transform, + CF2_F16Dot16* glyphWidth ) + { + FT_Error lastError = FT_Err_Ok; + + FT_Vector translation; + +#if 0 + FT_Vector advancePoint; +#endif + + CF2_Fixed advWidth = 0; + FT_Bool needWinding; + + + /* Note: use both integer and fraction for outlines. This allows bbox */ + /* to come out directly. */ + + translation.x = transform->tx; + translation.y = transform->ty; + + /* set up values based on transform */ + cf2_font_setup( font, transform ); + if ( font->error ) + goto exit; /* setup encountered an error */ + + /* reset darken direction */ + font->reverseWinding = FALSE; + + /* winding order only affects darkening */ + needWinding = font->darkened; + + while ( 1 ) + { + /* reset output buffer */ + cf2_outline_reset( &font->outline ); + + /* build the outline, passing the full translation */ + cf2_interpT2CharString( font, + charstring, + (CF2_OutlineCallbacks)&font->outline, + &translation, + FALSE, + 0, + 0, + &advWidth ); + + if ( font->error ) + goto exit; + + if ( !needWinding ) + break; + + /* check winding order */ + if ( font->outline.root.windingMomentum >= 0 ) /* CFF is CCW */ + break; + + /* invert darkening and render again */ + /* TODO: this should be a parameter to getOutline-computeOffset */ + font->reverseWinding = TRUE; + + needWinding = FALSE; /* exit after next iteration */ + } + + /* finish storing client outline */ + cf2_outline_close( &font->outline ); + + exit: + /* FreeType just wants the advance width; there is no translation */ + *glyphWidth = advWidth; + + /* free resources and collect errors from objects we've used */ + cf2_setError( &font->error, lastError ); + + return font->error; + } + + +/* END */ diff --git a/freetype/src/cff/cf2font.h b/freetype/src/cff/cf2font.h new file mode 100644 index 000000000..f9dd1bbd4 --- /dev/null +++ b/freetype/src/cff/cf2font.h @@ -0,0 +1,114 @@ +/***************************************************************************/ +/* */ +/* cf2font.h */ +/* */ +/* Adobe's code for font instances (specification). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2FONT_H__ +#define __CF2FONT_H__ + + +#include "cf2ft.h" +#include "cf2blues.h" + + +FT_BEGIN_HEADER + + +#define CF2_OPERAND_STACK_SIZE 48 +#define CF2_MAX_SUBR 10 /* maximum subroutine nesting */ + + + /* typedef is in `cf2glue.h' */ + struct CF2_FontRec_ + { + FT_Memory memory; + FT_Error error; /* shared error for this instance */ + + CF2_RenderingFlags renderingFlags; + + /* variables that depend on Transform: */ + /* the following have zero translation; */ + /* inner * outer = font * original */ + + CF2_Matrix currentTransform; /* original client matrix */ + CF2_Matrix innerTransform; /* for hinting; erect, scaled */ + CF2_Matrix outerTransform; /* post hinting; includes rotations */ + CF2_Fixed ppem; /* transform-dependent */ + + CF2_Int unitsPerEm; + + CF2_Fixed syntheticEmboldeningAmountX; /* character space units */ + CF2_Fixed syntheticEmboldeningAmountY; /* character space units */ + + /* FreeType related members */ + CF2_OutlineRec outline; /* freetype glyph outline functions */ + CFF_Decoder* decoder; + CFF_SubFont lastSubfont; /* FreeType parsed data; */ + /* top font or subfont */ + + /* these flags can vary from one call to the next */ + FT_Bool hinted; + FT_Bool darkened; /* true if stemDarkened or synthetic bold */ + /* i.e. darkenX != 0 || darkenY != 0 */ + FT_Bool stemDarkened; + + /* variables that depend on both FontDict and Transform */ + CF2_Fixed stdVW; /* in character space; depends on dict entry */ + CF2_Fixed stdHW; /* in character space; depends on dict entry */ + CF2_Fixed darkenX; /* character space units */ + CF2_Fixed darkenY; /* depends on transform */ + /* and private dict (StdVW) */ + FT_Bool reverseWinding; /* darken assuming */ + /* counterclockwise winding */ + + CF2_BluesRec blues; /* computed zone data */ + }; + + + FT_LOCAL( FT_Error ) + cf2_getGlyphOutline( CF2_Font font, + CF2_Buffer charstring, + const CF2_Matrix* transform, + CF2_F16Dot16* glyphWidth ); + + +FT_END_HEADER + + +#endif /* __CF2FONT_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2ft.c b/freetype/src/cff/cf2ft.c new file mode 100644 index 000000000..c09a0244a --- /dev/null +++ b/freetype/src/cff/cf2ft.c @@ -0,0 +1,639 @@ +/***************************************************************************/ +/* */ +/* cf2ft.c */ +/* */ +/* FreeType Glue Component to Adobe's Interpreter (body). */ +/* */ +/* Copyright 2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" +#include FT_INTERNAL_DEBUG_H + +#include "cf2font.h" +#include "cf2error.h" + + +#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */ + + + /* + * This check should avoid most internal overflow cases. Clients should + * generally respond to `Glyph_Too_Big' by getting a glyph outline + * at EM size, scaling it and filling it as a graphics operation. + * + */ + static FT_Error + cf2_checkTransform( const CF2_Matrix* transform, + CF2_Int unitsPerEm ) + { + CF2_Fixed maxScale; + + + FT_ASSERT( unitsPerEm > 0 ); + + FT_ASSERT( transform->a > 0 && transform->d > 0 ); + FT_ASSERT( transform->b == 0 && transform->c == 0 ); + FT_ASSERT( transform->tx == 0 && transform->ty == 0 ); + + if ( unitsPerEm > 0x7FFF ) + return FT_THROW( Glyph_Too_Big ); + + maxScale = FT_DivFix( CF2_MAX_SIZE, cf2_intToFixed( unitsPerEm ) ); + + if ( transform->a > maxScale || transform->d > maxScale ) + return FT_THROW( Glyph_Too_Big ); + + return FT_Err_Ok; + } + + + static void + cf2_setGlyphWidth( CF2_Outline outline, + CF2_Fixed width ) + { + CFF_Decoder* decoder = outline->decoder; + + + FT_ASSERT( decoder ); + + decoder->glyph_width = cf2_fixedToInt( width ); + } + + + /* Clean up font instance. */ + static void + cf2_free_instance( void* ptr ) + { + CF2_Font font = (CF2_Font)ptr; + + + if ( font ) + { + FT_Memory memory = font->memory; + + + (void)memory; + } + } + + + /********************************************/ + /* */ + /* functions for handling client outline; */ + /* FreeType uses coordinates in 26.6 format */ + /* */ + /********************************************/ + + static void + cf2_builder_moveTo( CF2_OutlineCallbacks callbacks, + const CF2_CallbackParams params ) + { + /* downcast the object pointer */ + CF2_Outline outline = (CF2_Outline)callbacks; + CFF_Builder* builder; + + (void)params; /* only used in debug mode */ + + + FT_ASSERT( outline && outline->decoder ); + FT_ASSERT( params->op == CF2_PathOpMoveTo ); + + builder = &outline->decoder->builder; + + /* note: two successive moves simply close the contour twice */ + cff_builder_close_contour( builder ); + builder->path_begun = 0; + } + + + static void + cf2_builder_lineTo( CF2_OutlineCallbacks callbacks, + const CF2_CallbackParams params ) + { + /* downcast the object pointer */ + CF2_Outline outline = (CF2_Outline)callbacks; + CFF_Builder* builder; + + + FT_ASSERT( outline && outline->decoder ); + FT_ASSERT( params->op == CF2_PathOpLineTo ); + + builder = &outline->decoder->builder; + + if ( !builder->path_begun ) + { + /* record the move before the line; also check points and set */ + /* `path_begun' */ + cff_builder_start_point( builder, + params->pt0.x, + params->pt0.y ); + } + + /* `cff_builder_add_point1' includes a check_points call for one point */ + cff_builder_add_point1( builder, + params->pt1.x, + params->pt1.y ); + } + + + static void + cf2_builder_cubeTo( CF2_OutlineCallbacks callbacks, + const CF2_CallbackParams params ) + { + /* downcast the object pointer */ + CF2_Outline outline = (CF2_Outline)callbacks; + CFF_Builder* builder; + + + FT_ASSERT( outline && outline->decoder ); + FT_ASSERT( params->op == CF2_PathOpCubeTo ); + + builder = &outline->decoder->builder; + + if ( !builder->path_begun ) + { + /* record the move before the line; also check points and set */ + /* `path_begun' */ + cff_builder_start_point( builder, + params->pt0.x, + params->pt0.y ); + } + + /* prepare room for 3 points: 2 off-curve, 1 on-curve */ + cff_check_points( builder, 3 ); + + cff_builder_add_point( builder, + params->pt1.x, + params->pt1.y, 0 ); + cff_builder_add_point( builder, + params->pt2.x, + params->pt2.y, 0 ); + cff_builder_add_point( builder, + params->pt3.x, + params->pt3.y, 1 ); + } + + + static void + cf2_outline_init( CF2_Outline outline, + FT_Memory memory, + FT_Error* error ) + { + FT_MEM_ZERO( outline, sizeof ( CF2_OutlineRec ) ); + + outline->root.memory = memory; + outline->root.error = error; + + outline->root.moveTo = cf2_builder_moveTo; + outline->root.lineTo = cf2_builder_lineTo; + outline->root.cubeTo = cf2_builder_cubeTo; + } + + + /* get scaling and hint flag from GlyphSlot */ + static void + cf2_getScaleAndHintFlag( CFF_Decoder* decoder, + CF2_Fixed* x_scale, + CF2_Fixed* y_scale, + FT_Bool* hinted, + FT_Bool* scaled ) + { + FT_ASSERT( decoder && decoder->builder.glyph ); + + /* note: FreeType scale includes a factor of 64 */ + *hinted = decoder->builder.glyph->hint; + *scaled = decoder->builder.glyph->scaled; + + if ( *hinted ) + { + *x_scale = FT_DivFix( decoder->builder.glyph->x_scale, + cf2_intToFixed( 64 ) ); + *y_scale = FT_DivFix( decoder->builder.glyph->y_scale, + cf2_intToFixed( 64 ) ); + } + else + { + /* for unhinted outlines, `cff_slot_load' does the scaling, */ + /* thus render at `unity' scale */ + + *x_scale = 0x0400; /* 1/64 as 16.16 */ + *y_scale = 0x0400; + } + } + + + /* get units per em from `FT_Face' */ + /* TODO: should handle font matrix concatenation? */ + static FT_UShort + cf2_getUnitsPerEm( CFF_Decoder* decoder ) + { + FT_ASSERT( decoder && decoder->builder.face ); + FT_ASSERT( decoder->builder.face->root.units_per_EM ); + + return decoder->builder.face->root.units_per_EM; + } + + + /* Main entry point: Render one glyph. */ + FT_LOCAL_DEF( FT_Error ) + cf2_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ) + { + FT_Memory memory; + FT_Error error = FT_Err_Ok; + CF2_Font font; + + + FT_ASSERT( decoder && decoder->cff ); + + memory = decoder->builder.memory; + + /* CF2 data is saved here across glyphs */ + font = (CF2_Font)decoder->cff->cf2_instance.data; + + /* on first glyph, allocate instance structure */ + if ( decoder->cff->cf2_instance.data == NULL ) + { + decoder->cff->cf2_instance.finalizer = + (FT_Generic_Finalizer)cf2_free_instance; + + if ( FT_ALLOC( decoder->cff->cf2_instance.data, + sizeof ( CF2_FontRec ) ) ) + return FT_THROW( Out_Of_Memory ); + + font = (CF2_Font)decoder->cff->cf2_instance.data; + + font->memory = memory; + + /* initialize a client outline, to be shared by each glyph rendered */ + cf2_outline_init( &font->outline, font->memory, &font->error ); + } + + /* save decoder; it is a stack variable and will be different on each */ + /* call */ + font->decoder = decoder; + font->outline.decoder = decoder; + + { + /* build parameters for Adobe engine */ + + CFF_Builder* builder = &decoder->builder; + CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + + /* local error */ + FT_Error error2 = FT_Err_Ok; + CF2_BufferRec buf; + CF2_Matrix transform; + CF2_F16Dot16 glyphWidth; + + FT_Bool hinted; + FT_Bool scaled; + + + /* FreeType has already looked up the GID; convert to */ + /* `RegionBuffer', assuming that the input has been validated */ + FT_ASSERT( charstring_base + charstring_len >= charstring_base ); + + FT_ZERO( &buf ); + buf.start = + buf.ptr = charstring_base; + buf.end = charstring_base + charstring_len; + + FT_ZERO( &transform ); + + cf2_getScaleAndHintFlag( decoder, + &transform.a, + &transform.d, + &hinted, + &scaled ); + + font->renderingFlags = 0; + if ( hinted ) + font->renderingFlags |= CF2_FlagsHinted; + if ( scaled && !driver->no_stem_darkening ) + font->renderingFlags |= CF2_FlagsDarkened; + + /* now get an outline for this glyph; */ + /* also get units per em to validate scale */ + font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder ); + + error2 = cf2_checkTransform( &transform, font->unitsPerEm ); + if ( error2 ) + return error2; + + error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth ); + if ( error2 ) + return FT_ERR( Invalid_File_Format ); + + cf2_setGlyphWidth( &font->outline, glyphWidth ); + + return FT_Err_Ok; + } + } + + + /* get pointer to current FreeType subfont (based on current glyphID) */ + FT_LOCAL_DEF( CFF_SubFont ) + cf2_getSubfont( CFF_Decoder* decoder ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + return decoder->current_subfont; + } + + + /* get `y_ppem' from `CFF_Size' */ + FT_LOCAL_DEF( CF2_Fixed ) + cf2_getPpemY( CFF_Decoder* decoder ) + { + FT_ASSERT( decoder && + decoder->builder.face && + decoder->builder.face->root.size ); + FT_ASSERT( decoder->builder.face->root.size->metrics.y_ppem ); + + return cf2_intToFixed( + decoder->builder.face->root.size->metrics.y_ppem ); + } + + + /* get standard stem widths for the current subfont; */ + /* FreeType stores these as integer font units */ + /* (note: variable names seem swapped) */ + FT_LOCAL_DEF( CF2_Fixed ) + cf2_getStdVW( CFF_Decoder* decoder ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + return cf2_intToFixed( + decoder->current_subfont->private_dict.standard_height ); + } + + + FT_LOCAL_DEF( CF2_Fixed ) + cf2_getStdHW( CFF_Decoder* decoder ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + return cf2_intToFixed( + decoder->current_subfont->private_dict.standard_width ); + } + + + /* note: FreeType stores 1000 times the actual value for `BlueScale' */ + FT_LOCAL_DEF( void ) + cf2_getBlueMetrics( CFF_Decoder* decoder, + CF2_Fixed* blueScale, + CF2_Fixed* blueShift, + CF2_Fixed* blueFuzz ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + *blueScale = FT_DivFix( + decoder->current_subfont->private_dict.blue_scale, + cf2_intToFixed( 1000 ) ); + *blueShift = cf2_intToFixed( + decoder->current_subfont->private_dict.blue_shift ); + *blueFuzz = cf2_intToFixed( + decoder->current_subfont->private_dict.blue_fuzz ); + } + + + /* get blue values counts and arrays; the FreeType parser has validated */ + /* the counts and verified that each is an even number */ + FT_LOCAL_DEF( void ) + cf2_getBlueValues( CFF_Decoder* decoder, + size_t* count, + FT_Pos* *data ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + *count = decoder->current_subfont->private_dict.num_blue_values; + *data = (FT_Pos*) + &decoder->current_subfont->private_dict.blue_values; + } + + + FT_LOCAL_DEF( void ) + cf2_getOtherBlues( CFF_Decoder* decoder, + size_t* count, + FT_Pos* *data ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + *count = decoder->current_subfont->private_dict.num_other_blues; + *data = (FT_Pos*) + &decoder->current_subfont->private_dict.other_blues; + } + + + FT_LOCAL_DEF( void ) + cf2_getFamilyBlues( CFF_Decoder* decoder, + size_t* count, + FT_Pos* *data ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + *count = decoder->current_subfont->private_dict.num_family_blues; + *data = (FT_Pos*) + &decoder->current_subfont->private_dict.family_blues; + } + + + FT_LOCAL_DEF( void ) + cf2_getFamilyOtherBlues( CFF_Decoder* decoder, + size_t* count, + FT_Pos* *data ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + *count = decoder->current_subfont->private_dict.num_family_other_blues; + *data = (FT_Pos*) + &decoder->current_subfont->private_dict.family_other_blues; + } + + + FT_LOCAL_DEF( CF2_Int ) + cf2_getLanguageGroup( CFF_Decoder* decoder ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + return decoder->current_subfont->private_dict.language_group; + } + + + /* convert unbiased subroutine index to `CF2_Buffer' and */ + /* return 0 on success */ + FT_LOCAL_DEF( CF2_Int ) + cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, + CF2_UInt idx, + CF2_Buffer buf ) + { + FT_ASSERT( decoder && decoder->globals ); + + FT_ZERO( buf ); + + idx += decoder->globals_bias; + if ( idx >= decoder->num_globals ) + return TRUE; /* error */ + + buf->start = + buf->ptr = decoder->globals[idx]; + buf->end = decoder->globals[idx + 1]; + + return FALSE; /* success */ + } + + + /* convert AdobeStandardEncoding code to CF2_Buffer; */ + /* used for seac component */ + FT_LOCAL_DEF( FT_Error ) + cf2_getSeacComponent( CFF_Decoder* decoder, + CF2_UInt code, + CF2_Buffer buf ) + { + CF2_Int gid; + FT_Byte* charstring; + FT_ULong len; + FT_Error error; + + + FT_ASSERT( decoder ); + + FT_ZERO( buf ); + + gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code ); + if ( gid < 0 ) + return FT_THROW( Invalid_Glyph_Format ); + + error = cff_get_glyph_data( decoder->builder.face, + gid, + &charstring, + &len ); + /* TODO: for now, just pass the FreeType error through */ + if ( error ) + return error; + + /* assume input has been validated */ + FT_ASSERT( charstring + len >= charstring ); + + buf->start = charstring; + buf->end = charstring + len; + buf->ptr = buf->start; + + return FT_Err_Ok; + } + + + FT_LOCAL_DEF( void ) + cf2_freeSeacComponent( CFF_Decoder* decoder, + CF2_Buffer buf ) + { + FT_ASSERT( decoder ); + + cff_free_glyph_data( decoder->builder.face, + (FT_Byte**)&buf->start, + (FT_ULong)( buf->end - buf->start ) ); + } + + + FT_LOCAL_DEF( CF2_Int ) + cf2_initLocalRegionBuffer( CFF_Decoder* decoder, + CF2_UInt idx, + CF2_Buffer buf ) + { + FT_ASSERT( decoder && decoder->locals ); + + FT_ZERO( buf ); + + idx += decoder->locals_bias; + if ( idx >= decoder->num_locals ) + return TRUE; /* error */ + + buf->start = + buf->ptr = decoder->locals[idx]; + buf->end = decoder->locals[idx + 1]; + + return FALSE; /* success */ + } + + + FT_LOCAL_DEF( CF2_Fixed ) + cf2_getDefaultWidthX( CFF_Decoder* decoder ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + return cf2_intToFixed( + decoder->current_subfont->private_dict.default_width ); + } + + + FT_LOCAL_DEF( CF2_Fixed ) + cf2_getNominalWidthX( CFF_Decoder* decoder ) + { + FT_ASSERT( decoder && decoder->current_subfont ); + + return cf2_intToFixed( + decoder->current_subfont->private_dict.nominal_width ); + } + + + FT_LOCAL_DEF( void ) + cf2_outline_reset( CF2_Outline outline ) + { + CFF_Decoder* decoder = outline->decoder; + + + FT_ASSERT( decoder ); + + outline->root.windingMomentum = 0; + + FT_GlyphLoader_Rewind( decoder->builder.loader ); + } + + + FT_LOCAL_DEF( void ) + cf2_outline_close( CF2_Outline outline ) + { + CFF_Decoder* decoder = outline->decoder; + + + FT_ASSERT( decoder ); + + cff_builder_close_contour( &decoder->builder ); + + FT_GlyphLoader_Add( decoder->builder.loader ); + } + + +/* END */ diff --git a/freetype/src/cff/cf2ft.h b/freetype/src/cff/cf2ft.h new file mode 100644 index 000000000..731da3ca8 --- /dev/null +++ b/freetype/src/cff/cf2ft.h @@ -0,0 +1,147 @@ +/***************************************************************************/ +/* */ +/* cf2ft.h */ +/* */ +/* FreeType Glue Component to Adobe's Interpreter (specification). */ +/* */ +/* Copyright 2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2FT_H__ +#define __CF2FT_H__ + + +#include "cf2types.h" + + + /* TODO: disable asserts for now */ +#define CF2_NDEBUG + + +#include FT_SYSTEM_H + +#include "cf2glue.h" +#include "cffgload.h" /* for CFF_Decoder */ + + +FT_BEGIN_HEADER + + + FT_LOCAL( FT_Error ) + cf2_decoder_parse_charstrings( CFF_Decoder* decoder, + FT_Byte* charstring_base, + FT_ULong charstring_len ); + + FT_LOCAL( CFF_SubFont ) + cf2_getSubfont( CFF_Decoder* decoder ); + + + FT_LOCAL( CF2_Fixed ) + cf2_getPpemY( CFF_Decoder* decoder ); + FT_LOCAL( CF2_Fixed ) + cf2_getStdVW( CFF_Decoder* decoder ); + FT_LOCAL( CF2_Fixed ) + cf2_getStdHW( CFF_Decoder* decoder ); + + FT_LOCAL( void ) + cf2_getBlueMetrics( CFF_Decoder* decoder, + CF2_Fixed* blueScale, + CF2_Fixed* blueShift, + CF2_Fixed* blueFuzz ); + FT_LOCAL( void ) + cf2_getBlueValues( CFF_Decoder* decoder, + size_t* count, + FT_Pos* *data ); + FT_LOCAL( void ) + cf2_getOtherBlues( CFF_Decoder* decoder, + size_t* count, + FT_Pos* *data ); + FT_LOCAL( void ) + cf2_getFamilyBlues( CFF_Decoder* decoder, + size_t* count, + FT_Pos* *data ); + FT_LOCAL( void ) + cf2_getFamilyOtherBlues( CFF_Decoder* decoder, + size_t* count, + FT_Pos* *data ); + + FT_LOCAL( CF2_Int ) + cf2_getLanguageGroup( CFF_Decoder* decoder ); + + FT_LOCAL( CF2_Int ) + cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, + CF2_UInt idx, + CF2_Buffer buf ); + FT_LOCAL( FT_Error ) + cf2_getSeacComponent( CFF_Decoder* decoder, + CF2_UInt code, + CF2_Buffer buf ); + FT_LOCAL( void ) + cf2_freeSeacComponent( CFF_Decoder* decoder, + CF2_Buffer buf ); + FT_LOCAL( CF2_Int ) + cf2_initLocalRegionBuffer( CFF_Decoder* decoder, + CF2_UInt idx, + CF2_Buffer buf ); + + FT_LOCAL( CF2_Fixed ) + cf2_getDefaultWidthX( CFF_Decoder* decoder ); + FT_LOCAL( CF2_Fixed ) + cf2_getNominalWidthX( CFF_Decoder* decoder ); + + + /* + * FreeType client outline + * + * process output from the charstring interpreter + */ + typedef struct CF2_OutlineRec_ + { + CF2_OutlineCallbacksRec root; /* base class must be first */ + CFF_Decoder* decoder; + + } CF2_OutlineRec, *CF2_Outline; + + + FT_LOCAL( void ) + cf2_outline_reset( CF2_Outline outline ); + FT_LOCAL( void ) + cf2_outline_close( CF2_Outline outline ); + + +FT_END_HEADER + + +#endif /* __CF2FT_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2glue.h b/freetype/src/cff/cf2glue.h new file mode 100644 index 000000000..a24da39e9 --- /dev/null +++ b/freetype/src/cff/cf2glue.h @@ -0,0 +1,144 @@ +/***************************************************************************/ +/* */ +/* cf2glue.h */ +/* */ +/* Adobe's code for shared stuff (specification only). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2GLUE_H__ +#define __CF2GLUE_H__ + + +/* common includes for other modules */ +#include "cf2error.h" +#include "cf2fixed.h" +#include "cf2arrst.h" +#include "cf2read.h" + + +FT_BEGIN_HEADER + + + /* rendering parameters */ + + /* apply hints to rendered glyphs */ +#define CF2_FlagsHinted 1 + /* for testing */ +#define CF2_FlagsDarkened 2 + + /* type for holding the flags */ + typedef CF2_Int CF2_RenderingFlags; + + + /* elements of a glyph outline */ + typedef enum CF2_PathOp_ + { + CF2_PathOpMoveTo = 1, /* change the current point */ + CF2_PathOpLineTo = 2, /* line */ + CF2_PathOpQuadTo = 3, /* quadratic curve */ + CF2_PathOpCubeTo = 4 /* cubic curve */ + + } CF2_PathOp; + + + /* a matrix of fixed point values */ + typedef struct CF2_Matrix_ + { + CF2_F16Dot16 a; + CF2_F16Dot16 b; + CF2_F16Dot16 c; + CF2_F16Dot16 d; + CF2_F16Dot16 tx; + CF2_F16Dot16 ty; + + } CF2_Matrix; + + + /* these typedefs are needed by more than one header file */ + /* and gcc compiler doesn't allow redefinition */ + typedef struct CF2_FontRec_ CF2_FontRec, *CF2_Font; + typedef struct CF2_HintRec_ CF2_HintRec, *CF2_Hint; + + + /* A common structure for all callback parameters. */ + /* */ + /* Some members may be unused. For example, `pt0' is not used for */ + /* `moveTo' and `pt3' is not used for `quadTo'. The initial point `pt0' */ + /* is included for each path element for generality; curve conversions */ + /* need it. The `op' parameter allows one function to handle multiple */ + /* element types. */ + + typedef struct CF2_CallbackParamsRec_ + { + FT_Vector pt0; + FT_Vector pt1; + FT_Vector pt2; + FT_Vector pt3; + + CF2_Int op; + + } CF2_CallbackParamsRec, *CF2_CallbackParams; + + + /* forward reference */ + typedef struct CF2_OutlineCallbacksRec_ CF2_OutlineCallbacksRec, + *CF2_OutlineCallbacks; + + /* callback function pointers */ + typedef void + (*CF2_Callback_Type)( CF2_OutlineCallbacks callbacks, + const CF2_CallbackParams params ); + + + struct CF2_OutlineCallbacksRec_ + { + CF2_Callback_Type moveTo; + CF2_Callback_Type lineTo; + CF2_Callback_Type quadTo; + CF2_Callback_Type cubeTo; + + CF2_Int windingMomentum; /* for winding order detection */ + + FT_Memory memory; + FT_Error* error; + }; + + +FT_END_HEADER + + +#endif /* __CF2GLUE_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2hints.c b/freetype/src/cff/cf2hints.c new file mode 100644 index 000000000..96bd49f18 --- /dev/null +++ b/freetype/src/cff/cf2hints.c @@ -0,0 +1,1734 @@ +/***************************************************************************/ +/* */ +/* cf2hints.c */ +/* */ +/* Adobe's code for handling CFF hints (body). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" +#include FT_INTERNAL_DEBUG_H + +#include "cf2glue.h" +#include "cf2font.h" +#include "cf2hints.h" +#include "cf2intrp.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_cf2hints + + + typedef struct CF2_HintMoveRec_ + { + size_t j; /* index of upper hint map edge */ + CF2_Fixed moveUp; /* adjustment to optimum position */ + + } CF2_HintMoveRec, *CF2_HintMove; + + + /* Compute angular momentum for winding order detection. It is called */ + /* for all lines and curves, but not necessarily in element order. */ + static CF2_Int + cf2_getWindingMomentum( CF2_Fixed x1, + CF2_Fixed y1, + CF2_Fixed x2, + CF2_Fixed y2 ) + { + /* cross product of pt1 position from origin with pt2 position from */ + /* pt1; we reduce the precision so that the result fits into 32 bits */ + + return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) - + ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 ); + } + + + /* + * Construct from a StemHint; this is used as a parameter to + * `cf2_blues_capture'. + * `hintOrigin' is the character space displacement of a seac accent. + * Adjust stem hint for darkening here. + * + */ + static void + cf2_hint_init( CF2_Hint hint, + const CF2_ArrStack stemHintArray, + size_t indexStemHint, + const CF2_Font font, + CF2_Fixed hintOrigin, + CF2_Fixed scale, + FT_Bool bottom ) + { + CF2_Fixed width; + const CF2_StemHintRec* stemHint; + + + FT_ZERO( hint ); + + stemHint = (const CF2_StemHintRec*)cf2_arrstack_getPointer( + stemHintArray, + indexStemHint ); + + width = stemHint->max - stemHint->min; + + if ( width == cf2_intToFixed( -21 ) ) + { + /* ghost bottom */ + + if ( bottom ) + { + hint->csCoord = stemHint->max; + hint->flags = CF2_GhostBottom; + } + else + hint->flags = 0; + } + + else if ( width == cf2_intToFixed( -20 ) ) + { + /* ghost top */ + + if ( bottom ) + hint->flags = 0; + else + { + hint->csCoord = stemHint->min; + hint->flags = CF2_GhostTop; + } + } + + else if ( width < 0 ) + { + /* inverted pair */ + + /* + * Hints with negative widths were produced by an early version of a + * non-Adobe font tool. The Type 2 spec allows edge (ghost) hints + * with negative widths, but says + * + * All other negative widths have undefined meaning. + * + * CoolType has a silent workaround that negates the hint width; for + * permissive mode, we do the same here. + * + * Note: Such fonts cannot use ghost hints, but should otherwise work. + * Note: Some poor hints in our faux fonts can produce negative + * widths at some blends. For example, see a light weight of + * `u' in ASerifMM. + * + */ + if ( bottom ) + { + hint->csCoord = stemHint->max; + hint->flags = CF2_PairBottom; + } + else + { + hint->csCoord = stemHint->min; + hint->flags = CF2_PairTop; + } + } + + else + { + /* normal pair */ + + if ( bottom ) + { + hint->csCoord = stemHint->min; + hint->flags = CF2_PairBottom; + } + else + { + hint->csCoord = stemHint->max; + hint->flags = CF2_PairTop; + } + } + + /* Now that ghost hints have been detected, adjust this edge for */ + /* darkening. Bottoms are not changed; tops are incremented by twice */ + /* `darkenY'. */ + if ( cf2_hint_isTop( hint ) ) + hint->csCoord += 2 * font->darkenY; + + hint->csCoord += hintOrigin; + hint->scale = scale; + hint->index = indexStemHint; /* index in original stem hint array */ + + /* if original stem hint has been used, use the same position */ + if ( hint->flags != 0 && stemHint->used ) + { + if ( cf2_hint_isTop( hint ) ) + hint->dsCoord = stemHint->maxDS; + else + hint->dsCoord = stemHint->minDS; + + cf2_hint_lock( hint ); + } + else + hint->dsCoord = FT_MulFix( hint->csCoord, scale ); + } + + + /* initialize an invalid hint map element */ + static void + cf2_hint_initZero( CF2_Hint hint ) + { + FT_ZERO( hint ); + } + + + FT_LOCAL_DEF( FT_Bool ) + cf2_hint_isValid( const CF2_Hint hint ) + { + return (FT_Bool)( hint->flags != 0 ); + } + + + static FT_Bool + cf2_hint_isPair( const CF2_Hint hint ) + { + return (FT_Bool)( ( hint->flags & + ( CF2_PairBottom | CF2_PairTop ) ) != 0 ); + } + + + static FT_Bool + cf2_hint_isPairTop( const CF2_Hint hint ) + { + return (FT_Bool)( ( hint->flags & CF2_PairTop ) != 0 ); + } + + + FT_LOCAL_DEF( FT_Bool ) + cf2_hint_isTop( const CF2_Hint hint ) + { + return (FT_Bool)( ( hint->flags & + ( CF2_PairTop | CF2_GhostTop ) ) != 0 ); + } + + + FT_LOCAL_DEF( FT_Bool ) + cf2_hint_isBottom( const CF2_Hint hint ) + { + return (FT_Bool)( ( hint->flags & + ( CF2_PairBottom | CF2_GhostBottom ) ) != 0 ); + } + + + static FT_Bool + cf2_hint_isLocked( const CF2_Hint hint ) + { + return (FT_Bool)( ( hint->flags & CF2_Locked ) != 0 ); + } + + + static FT_Bool + cf2_hint_isSynthetic( const CF2_Hint hint ) + { + return (FT_Bool)( ( hint->flags & CF2_Synthetic ) != 0 ); + } + + + FT_LOCAL_DEF( void ) + cf2_hint_lock( CF2_Hint hint ) + { + hint->flags |= CF2_Locked; + } + + + FT_LOCAL_DEF( void ) + cf2_hintmap_init( CF2_HintMap hintmap, + CF2_Font font, + CF2_HintMap initialMap, + CF2_ArrStack hintMoves, + CF2_Fixed scale ) + { + FT_ZERO( hintmap ); + + /* copy parameters from font instance */ + hintmap->hinted = font->hinted; + hintmap->scale = scale; + hintmap->font = font; + hintmap->initialHintMap = initialMap; + /* will clear in `cf2_hintmap_adjustHints' */ + hintmap->hintMoves = hintMoves; + } + + + static FT_Bool + cf2_hintmap_isValid( const CF2_HintMap hintmap ) + { + return hintmap->isValid; + } + + + /* transform character space coordinate to device space using hint map */ + static CF2_Fixed + cf2_hintmap_map( CF2_HintMap hintmap, + CF2_Fixed csCoord ) + { + FT_ASSERT( hintmap->isValid ); /* must call Build before Map */ + FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES ); + + if ( hintmap->count == 0 || ! hintmap->hinted ) + { + /* there are no hints; use uniform scale and zero offset */ + return FT_MulFix( csCoord, hintmap->scale ); + } + else + { + /* start linear search from last hit */ + CF2_UInt i = hintmap->lastIndex; + + + /* search up */ + while ( i < hintmap->count - 1 && + csCoord >= hintmap->edge[i + 1].csCoord ) + i += 1; + + /* search down */ + while ( i > 0 && csCoord < hintmap->edge[i].csCoord ) + i -= 1; + + hintmap->lastIndex = i; + + if ( i == 0 && csCoord < hintmap->edge[0].csCoord ) + { + /* special case for points below first edge: use uniform scale */ + return FT_MulFix( csCoord - hintmap->edge[0].csCoord, + hintmap->scale ) + + hintmap->edge[0].dsCoord; + } + else + { + /* + * Note: entries with duplicate csCoord are allowed. + * Use edge[i], the highest entry where csCoord >= entry[i].csCoord + */ + return FT_MulFix( csCoord - hintmap->edge[i].csCoord, + hintmap->edge[i].scale ) + + hintmap->edge[i].dsCoord; + } + } + } + + + /* + * This hinting policy moves a hint pair in device space so that one of + * its two edges is on a device pixel boundary (its fractional part is + * zero). `cf2_hintmap_insertHint' guarantees no overlap in CS + * space. Ensure here that there is no overlap in DS. + * + * In the first pass, edges are adjusted relative to adjacent hints. + * Those that are below have already been adjusted. Those that are + * above have not yet been adjusted. If a hint above blocks an + * adjustment to an optimal position, we will try again in a second + * pass. The second pass is top-down. + * + */ + + static void + cf2_hintmap_adjustHints( CF2_HintMap hintmap ) + { + size_t i, j; + + + cf2_arrstack_clear( hintmap->hintMoves ); /* working storage */ + + /* + * First pass is bottom-up (font hint order) without look-ahead. + * Locked edges are already adjusted. + * Unlocked edges begin with dsCoord from `initialHintMap'. + * Save edges that are not optimally adjusted in `hintMoves' array, + * and process them in second pass. + */ + + for ( i = 0; i < hintmap->count; i++ ) + { + FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] ); + + + /* index of upper edge (same value for ghost hint) */ + j = isPair ? i + 1 : i; + + FT_ASSERT( j < hintmap->count ); + FT_ASSERT( cf2_hint_isValid( &hintmap->edge[i] ) ); + FT_ASSERT( cf2_hint_isValid( &hintmap->edge[j] ) ); + FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) == + cf2_hint_isLocked( &hintmap->edge[j] ) ); + + if ( !cf2_hint_isLocked( &hintmap->edge[i] ) ) + { + /* hint edge is not locked, we can adjust it */ + CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord ); + CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord ); + + /* calculate all four possibilities; moves down are negative */ + CF2_Fixed downMoveDown = 0 - fracDown; + CF2_Fixed upMoveDown = 0 - fracUp; + CF2_Fixed downMoveUp = fracDown == 0 + ? 0 + : cf2_intToFixed( 1 ) - fracDown; + CF2_Fixed upMoveUp = fracUp == 0 + ? 0 + : cf2_intToFixed( 1 ) - fracUp; + + /* smallest move up */ + CF2_Fixed moveUp = FT_MIN( downMoveUp, upMoveUp ); + /* smallest move down */ + CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown ); + + /* final amount to move edge or edge pair */ + CF2_Fixed move; + + CF2_Fixed downMinCounter = CF2_MIN_COUNTER; + CF2_Fixed upMinCounter = CF2_MIN_COUNTER; + FT_Bool saveEdge = FALSE; + + + /* minimum counter constraint doesn't apply when adjacent edges */ + /* are synthetic */ + /* TODO: doesn't seem a big effect; for now, reduce the code */ +#if 0 + if ( i == 0 || + cf2_hint_isSynthetic( &hintmap->edge[i - 1] ) ) + downMinCounter = 0; + + if ( j >= hintmap->count - 1 || + cf2_hint_isSynthetic( &hintmap->edge[j + 1] ) ) + upMinCounter = 0; +#endif + + /* is there room to move up? */ + /* there is if we are at top of array or the next edge is at or */ + /* beyond proposed move up? */ + if ( j >= hintmap->count - 1 || + hintmap->edge[j + 1].dsCoord >= + hintmap->edge[j].dsCoord + moveUp + upMinCounter ) + { + /* there is room to move up; is there also room to move down? */ + if ( i == 0 || + hintmap->edge[i - 1].dsCoord <= + hintmap->edge[i].dsCoord + moveDown - downMinCounter ) + { + /* move smaller absolute amount */ + move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */ + } + else + move = moveUp; + } + else + { + /* is there room to move down? */ + if ( i == 0 || + hintmap->edge[i - 1].dsCoord <= + hintmap->edge[i].dsCoord + moveDown - downMinCounter ) + { + move = moveDown; + /* true if non-optimum move */ + saveEdge = (FT_Bool)( moveUp < -moveDown ); + } + else + { + /* no room to move either way without overlapping or reducing */ + /* the counter too much */ + move = 0; + saveEdge = TRUE; + } + } + + /* Identify non-moves and moves down that aren't optimal, and save */ + /* them for second pass. */ + /* Do this only if there is an unlocked edge above (which could */ + /* possibly move). */ + if ( saveEdge && + j < hintmap->count - 1 && + !cf2_hint_isLocked( &hintmap->edge[j + 1] ) ) + { + CF2_HintMoveRec savedMove; + + + savedMove.j = j; + /* desired adjustment in second pass */ + savedMove.moveUp = moveUp - move; + + cf2_arrstack_push( hintmap->hintMoves, &savedMove ); + } + + /* move the edge(s) */ + hintmap->edge[i].dsCoord += move; + if ( isPair ) + hintmap->edge[j].dsCoord += move; + } + + /* assert there are no overlaps in device space */ + FT_ASSERT( i == 0 || + hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord ); + FT_ASSERT( i < j || + hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord ); + + /* adjust the scales, avoiding divide by zero */ + if ( i > 0 ) + { + if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord ) + hintmap->edge[i - 1].scale = + FT_DivFix( + hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord, + hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord ); + } + + if ( isPair ) + { + if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord ) + hintmap->edge[j - 1].scale = + FT_DivFix( + hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord, + hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord ); + + i += 1; /* skip upper edge on next loop */ + } + } + + /* second pass tries to move non-optimal hints up, in case there is */ + /* room now */ + for ( i = cf2_arrstack_size( hintmap->hintMoves ); i > 0; i-- ) + { + CF2_HintMove hintMove = (CF2_HintMove) + cf2_arrstack_getPointer( hintmap->hintMoves, i - 1 ); + + + j = hintMove->j; + + /* this was tested before the push, above */ + FT_ASSERT( j < hintmap->count - 1 ); + + /* is there room to move up? */ + if ( hintmap->edge[j + 1].dsCoord >= + hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER ) + { + /* there is more room now, move edge up */ + hintmap->edge[j].dsCoord += hintMove->moveUp; + + if ( cf2_hint_isPair( &hintmap->edge[j] ) ) + { + FT_ASSERT( j > 0 ); + hintmap->edge[j - 1].dsCoord += hintMove->moveUp; + } + } + } + } + + + /* insert hint edges into map, sorted by csCoord */ + static void + cf2_hintmap_insertHint( CF2_HintMap hintmap, + CF2_Hint bottomHintEdge, + CF2_Hint topHintEdge ) + { + CF2_UInt indexInsert; + + /* set default values, then check for edge hints */ + FT_Bool isPair = TRUE; + CF2_Hint firstHintEdge = bottomHintEdge; + CF2_Hint secondHintEdge = topHintEdge; + + + /* one or none of the input params may be invalid when dealing with */ + /* edge hints; at least one edge must be valid */ + FT_ASSERT( cf2_hint_isValid( bottomHintEdge ) || + cf2_hint_isValid( topHintEdge ) ); + + /* determine how many and which edges to insert */ + if ( !cf2_hint_isValid( bottomHintEdge ) ) + { + /* insert only the top edge */ + firstHintEdge = topHintEdge; + isPair = FALSE; + } + else if ( !cf2_hint_isValid( topHintEdge ) ) + { + /* insert only the bottom edge */ + isPair = FALSE; + } + + /* paired edges must be in proper order */ + FT_ASSERT( !isPair || + topHintEdge->csCoord >= bottomHintEdge->csCoord ); + + /* linear search to find index value of insertion point */ + indexInsert = 0; + for ( ; indexInsert < hintmap->count; indexInsert++ ) + { + if ( hintmap->edge[indexInsert].csCoord > firstHintEdge->csCoord ) + break; + } + + /* + * Discard any hints that overlap in character space. Most often, + * this is while building the initial map, but in theory, it can also + * occur because of darkening. + * + */ + if ( indexInsert < hintmap->count ) + { + /* we are inserting before an existing edge: */ + /* verify that a new pair does not straddle the next edge */ + if ( isPair && + hintmap->edge[indexInsert].csCoord < secondHintEdge->csCoord ) + return; /* ignore overlapping stem hint */ + + /* verify that we are not inserting between paired edges */ + if ( cf2_hint_isPairTop( &hintmap->edge[indexInsert] ) ) + return; /* ignore overlapping stem hint */ + } + + /* recompute device space locations using initial hint map */ + if ( cf2_hintmap_isValid( hintmap->initialHintMap ) && + !cf2_hint_isLocked( firstHintEdge ) ) + { + if ( isPair ) + { + /* Use hint map to position the center of stem, and nominal scale */ + /* to position the two edges. This preserves the stem width. */ + CF2_Fixed midpoint = cf2_hintmap_map( + hintmap->initialHintMap, + ( secondHintEdge->csCoord + + firstHintEdge->csCoord ) / 2 ); + CF2_Fixed halfWidth = FT_MulFix( + ( secondHintEdge->csCoord - + firstHintEdge->csCoord ) / 2, + hintmap->scale ); + + + firstHintEdge->dsCoord = midpoint - halfWidth; + secondHintEdge->dsCoord = midpoint + halfWidth; + } + else + firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap, + firstHintEdge->csCoord ); + } + + /* discard any hints that overlap in device space; this can occur */ + /* because locked hints have been moved to align with blue zones */ + if ( indexInsert > 0 ) + { + /* we are inserting after an existing edge */ + if ( firstHintEdge->dsCoord < hintmap->edge[indexInsert - 1].dsCoord ) + return; + } + + if ( indexInsert < hintmap->count ) + { + /* we are inserting before an existing edge */ + if ( isPair ) + { + if ( secondHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord ) + return; + } + else + { + if ( firstHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord ) + return; + } + } + + /* make room to insert */ + { + CF2_Int iSrc = hintmap->count - 1; + CF2_Int iDst = isPair ? hintmap->count + 1 : hintmap->count; + + CF2_Int count = hintmap->count - indexInsert; + + + if ( iDst >= CF2_MAX_HINT_EDGES ) + { + FT_TRACE4(( "cf2_hintmap_insertHint: too many hintmaps\n" )); + return; + } + + while ( count-- ) + hintmap->edge[iDst--] = hintmap->edge[iSrc--]; + + /* insert first edge */ + hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */ + hintmap->count += 1; + + if ( isPair ) + { + /* insert second edge */ + hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */ + hintmap->count += 1; + } + } + + return; + } + + + /* + * Build a map from hints and mask. + * + * This function may recur one level if `hintmap->initialHintMap' is not yet + * valid. + * If `initialMap' is true, simply build initial map. + * + * Synthetic hints are used in two ways. A hint at zero is inserted, if + * needed, in the initial hint map, to prevent translations from + * propagating across the origin. If synthetic em box hints are enabled + * for ideographic dictionaries, then they are inserted in all hint + * maps, including the initial one. + * + */ + FT_LOCAL_DEF( void ) + cf2_hintmap_build( CF2_HintMap hintmap, + CF2_ArrStack hStemHintArray, + CF2_ArrStack vStemHintArray, + CF2_HintMask hintMask, + CF2_Fixed hintOrigin, + FT_Bool initialMap ) + { + FT_Byte* maskPtr; + + CF2_Font font = hintmap->font; + CF2_HintMaskRec tempHintMask; + + size_t bitCount, i; + FT_Byte maskByte; + + + /* check whether initial map is constructed */ + if ( !initialMap && !cf2_hintmap_isValid( hintmap->initialHintMap ) ) + { + /* make recursive call with initialHintMap and temporary mask; */ + /* temporary mask will get all bits set, below */ + cf2_hintmask_init( &tempHintMask, hintMask->error ); + cf2_hintmap_build( hintmap->initialHintMap, + hStemHintArray, + vStemHintArray, + &tempHintMask, + hintOrigin, + TRUE ); + } + + if ( !cf2_hintmask_isValid( hintMask ) ) + { + /* without a hint mask, assume all hints are active */ + cf2_hintmask_setAll( hintMask, + cf2_arrstack_size( hStemHintArray ) + + cf2_arrstack_size( vStemHintArray ) ); + } + + /* begin by clearing the map */ + hintmap->count = 0; + hintmap->lastIndex = 0; + + /* make a copy of the hint mask so we can modify it */ + tempHintMask = *hintMask; + maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask ); + + /* use the hStem hints only, which are first in the mask */ + /* TODO: compare this to cffhintmaskGetBitCount */ + bitCount = cf2_arrstack_size( hStemHintArray ); + + /* synthetic embox hints get highest priority */ + if ( font->blues.doEmBoxHints ) + { + CF2_HintRec dummy; + + + cf2_hint_initZero( &dummy ); /* invalid hint map element */ + + /* ghost bottom */ + cf2_hintmap_insertHint( hintmap, + &font->blues.emBoxBottomEdge, + &dummy ); + /* ghost top */ + cf2_hintmap_insertHint( hintmap, + &dummy, + &font->blues.emBoxTopEdge ); + } + + /* insert hints captured by a blue zone or already locked (higher */ + /* priority) */ + for ( i = 0, maskByte = 0x80; i < bitCount; i++ ) + { + if ( maskByte & *maskPtr ) + { + /* expand StemHint into two `CF2_Hint' elements */ + CF2_HintRec bottomHintEdge, topHintEdge; + + + cf2_hint_init( &bottomHintEdge, + hStemHintArray, + i, + font, + hintOrigin, + hintmap->scale, + TRUE /* bottom */ ); + cf2_hint_init( &topHintEdge, + hStemHintArray, + i, + font, + hintOrigin, + hintmap->scale, + FALSE /* top */ ); + + if ( cf2_hint_isLocked( &bottomHintEdge ) || + cf2_hint_isLocked( &topHintEdge ) || + cf2_blues_capture( &font->blues, + &bottomHintEdge, + &topHintEdge ) ) + { + /* insert captured hint into map */ + cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge ); + + *maskPtr &= ~maskByte; /* turn off the bit for this hint */ + } + } + + if ( ( i & 7 ) == 7 ) + { + /* move to next mask byte */ + maskPtr++; + maskByte = 0x80; + } + else + maskByte >>= 1; + } + + /* initial hint map includes only captured hints plus maybe one at 0 */ + + /* + * TODO: There is a problem here because we are trying to build a + * single hint map containing all captured hints. It is + * possible for there to be conflicts between captured hints, + * either because of darkening or because the hints are in + * separate hint zones (we are ignoring hint zones for the + * initial map). An example of the latter is MinionPro-Regular + * v2.030 glyph 883 (Greek Capital Alpha with Psili) at 15ppem. + * A stem hint for the psili conflicts with the top edge hint + * for the base character. The stem hint gets priority because + * of its sort order. In glyph 884 (Greek Capital Alpha with + * Psili and Oxia), the top of the base character gets a stem + * hint, and the psili does not. This creates different initial + * maps for the two glyphs resulting in different renderings of + * the base character. Will probably defer this either as not + * worth the cost or as a font bug. I don't think there is any + * good reason for an accent to be captured by an alignment + * zone. -darnold 2/12/10 + */ + + if ( initialMap ) + { + /* Apply a heuristic that inserts a point for (0,0), unless it's */ + /* already covered by a mapping. This locks the baseline for glyphs */ + /* that have no baseline hints. */ + + if ( hintmap->count == 0 || + hintmap->edge[0].csCoord > 0 || + hintmap->edge[hintmap->count - 1].csCoord < 0 ) + { + /* all edges are above 0 or all edges are below 0; */ + /* construct a locked edge hint at 0 */ + + CF2_HintRec edge, invalid; + + + cf2_hint_initZero( &edge ); + + edge.flags = CF2_GhostBottom | + CF2_Locked | + CF2_Synthetic; + edge.scale = hintmap->scale; + + cf2_hint_initZero( &invalid ); + cf2_hintmap_insertHint( hintmap, &edge, &invalid ); + } + } + else + { + /* insert remaining hints */ + + maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask ); + + for ( i = 0, maskByte = 0x80; i < bitCount; i++ ) + { + if ( maskByte & *maskPtr ) + { + CF2_HintRec bottomHintEdge, topHintEdge; + + + cf2_hint_init( &bottomHintEdge, + hStemHintArray, + i, + font, + hintOrigin, + hintmap->scale, + TRUE /* bottom */ ); + cf2_hint_init( &topHintEdge, + hStemHintArray, + i, + font, + hintOrigin, + hintmap->scale, + FALSE /* top */ ); + + cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge ); + } + + if ( ( i & 7 ) == 7 ) + { + /* move to next mask byte */ + maskPtr++; + maskByte = 0x80; + } + else + maskByte >>= 1; + } + } + + /* + * Note: The following line is a convenient place to break when + * debugging hinting. Examine `hintmap->edge' for the list of + * enabled hints, then step over the call to see the effect of + * adjustment. We stop here first on the recursive call that + * creates the initial map, and then on each counter group and + * hint zone. + */ + + /* adjust positions of hint edges that are not locked to blue zones */ + cf2_hintmap_adjustHints( hintmap ); + + /* save the position of all hints that were used in this hint map; */ + /* if we use them again, we'll locate them in the same position */ + if ( !initialMap ) + { + for ( i = 0; i < hintmap->count; i++ ) + { + if ( !cf2_hint_isSynthetic( &hintmap->edge[i] ) ) + { + /* Note: include both valid and invalid edges */ + /* Note: top and bottom edges are copied back separately */ + CF2_StemHint stemhint = (CF2_StemHint) + cf2_arrstack_getPointer( hStemHintArray, + hintmap->edge[i].index ); + + + if ( cf2_hint_isTop( &hintmap->edge[i] ) ) + stemhint->maxDS = hintmap->edge[i].dsCoord; + else + stemhint->minDS = hintmap->edge[i].dsCoord; + + stemhint->used = TRUE; + } + } + } + + /* hint map is ready to use */ + hintmap->isValid = TRUE; + + /* remember this mask has been used */ + cf2_hintmask_setNew( hintMask, FALSE ); + } + + + FT_LOCAL_DEF( void ) + cf2_glyphpath_init( CF2_GlyphPath glyphpath, + CF2_Font font, + CF2_OutlineCallbacks callbacks, + CF2_Fixed scaleY, + /* CF2_Fixed hShift, */ + CF2_ArrStack hStemHintArray, + CF2_ArrStack vStemHintArray, + CF2_HintMask hintMask, + CF2_Fixed hintOriginY, + const CF2_Blues blues, + const FT_Vector* fractionalTranslation ) + { + FT_ZERO( glyphpath ); + + glyphpath->font = font; + glyphpath->callbacks = callbacks; + + cf2_arrstack_init( &glyphpath->hintMoves, + font->memory, + &font->error, + sizeof ( CF2_HintMoveRec ) ); + + cf2_hintmap_init( &glyphpath->initialHintMap, + font, + &glyphpath->initialHintMap, + &glyphpath->hintMoves, + scaleY ); + cf2_hintmap_init( &glyphpath->firstHintMap, + font, + &glyphpath->initialHintMap, + &glyphpath->hintMoves, + scaleY ); + cf2_hintmap_init( &glyphpath->hintMap, + font, + &glyphpath->initialHintMap, + &glyphpath->hintMoves, + scaleY ); + + glyphpath->scaleX = font->innerTransform.a; + glyphpath->scaleC = font->innerTransform.c; + glyphpath->scaleY = font->innerTransform.d; + + glyphpath->fractionalTranslation = *fractionalTranslation; + +#if 0 + glyphpath->hShift = hShift; /* for fauxing */ +#endif + + glyphpath->hStemHintArray = hStemHintArray; + glyphpath->vStemHintArray = vStemHintArray; + glyphpath->hintMask = hintMask; /* ptr to current mask */ + glyphpath->hintOriginY = hintOriginY; + glyphpath->blues = blues; + glyphpath->darken = font->darkened; /* TODO: should we make copies? */ + glyphpath->xOffset = font->darkenX; + glyphpath->yOffset = font->darkenY; + glyphpath->miterLimit = 2 * FT_MAX( + cf2_fixedAbs( glyphpath->xOffset ), + cf2_fixedAbs( glyphpath->yOffset ) ); + + /* .1 character space unit */ + glyphpath->snapThreshold = cf2_floatToFixed( 0.1f ); + + glyphpath->moveIsPending = TRUE; + glyphpath->pathIsOpen = FALSE; + glyphpath->elemIsQueued = FALSE; + } + + + FT_LOCAL_DEF( void ) + cf2_glyphpath_finalize( CF2_GlyphPath glyphpath ) + { + cf2_arrstack_finalize( &glyphpath->hintMoves ); + } + + + /* + * Hint point in y-direction and apply outerTransform. + * Input `current' hint map (which is actually delayed by one element). + * Input x,y point in Character Space. + * Output x,y point in Device Space, including translation. + */ + static void + cf2_glyphpath_hintPoint( CF2_GlyphPath glyphpath, + CF2_HintMap hintmap, + FT_Vector* ppt, + CF2_Fixed x, + CF2_Fixed y ) + { + FT_Vector pt; /* hinted point in upright DS */ + + + pt.x = FT_MulFix( glyphpath->scaleX, x ) + + FT_MulFix( glyphpath->scaleC, y ); + pt.y = cf2_hintmap_map( hintmap, y ); + + ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) + + FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) + + glyphpath->fractionalTranslation.x; + ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x ) + + FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) + + glyphpath->fractionalTranslation.y; + } + + + /* + * From two line segments, (u1,u2) and (v1,v2), compute a point of + * intersection on the corresponding lines. + * Return false if no intersection is found, or if the intersection is + * too far away from the ends of the line segments, u2 and v1. + * + */ + static FT_Bool + cf2_glyphpath_computeIntersection( CF2_GlyphPath glyphpath, + const FT_Vector* u1, + const FT_Vector* u2, + const FT_Vector* v1, + const FT_Vector* v2, + FT_Vector* intersection ) + { + /* + * Let `u' be a zero-based vector from the first segment, `v' from the + * second segment. + * Let `w 'be the zero-based vector from `u1' to `v1'. + * `perp' is the `perpendicular dot product'; see + * http://mathworld.wolfram.com/PerpDotProduct.html. + * `s' is the parameter for the parametric line for the first segment + * (`u'). + * + * See notation in + * http://softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm. + * Calculations are done in 16.16, but must handle the squaring of + * line lengths in character space. We scale all vectors by 1/32 to + * avoid overflow. This allows values up to 4095 to be squared. The + * scale factor cancels in the divide. + * + * TODO: the scale factor could be computed from UnitsPerEm. + * + */ + +#define cf2_perp( a, b ) \ + ( FT_MulFix( a.x, b.y ) - FT_MulFix( a.y, b.x ) ) + + /* round and divide by 32 */ +#define CF2_CS_SCALE( x ) \ + ( ( (x) + 0x10 ) >> 5 ) + + FT_Vector u, v, w; /* scaled vectors */ + CF2_Fixed denominator, s; + + + u.x = CF2_CS_SCALE( u2->x - u1->x ); + u.y = CF2_CS_SCALE( u2->y - u1->y ); + v.x = CF2_CS_SCALE( v2->x - v1->x ); + v.y = CF2_CS_SCALE( v2->y - v1->y ); + w.x = CF2_CS_SCALE( v1->x - u1->x ); + w.y = CF2_CS_SCALE( v1->y - u1->y ); + + denominator = cf2_perp( u, v ); + + if ( denominator == 0 ) + return FALSE; /* parallel or coincident lines */ + + s = FT_DivFix( cf2_perp( w, v ), denominator ); + + intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x ); + intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y ); + + /* + * Special case snapping for horizontal and vertical lines. + * This cleans up intersections and reduces problems with winding + * order detection. + * Sample case is sbc cd KozGoPr6N-Medium.otf 20 16685. + * Note: these calculations are in character space. + * + */ + + if ( u1->x == u2->x && + cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold ) + intersection->x = u1->x; + if ( u1->y == u2->y && + cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold ) + intersection->y = u1->y; + + if ( v1->x == v2->x && + cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold ) + intersection->x = v1->x; + if ( v1->y == v2->y && + cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold ) + intersection->y = v1->y; + + /* limit the intersection distance from midpoint of u2 and v1 */ + if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) > + glyphpath->miterLimit || + cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) > + glyphpath->miterLimit ) + return FALSE; + + return TRUE; + } + + + /* + * Push the cached element (glyphpath->prevElem*) to the outline + * consumer. When a darkening offset is used, the end point of the + * cached element may be adjusted to an intersection point or it may be + * connected by a line to the current element. This calculation must + * use a HintMap that was valid at the time the element was saved. For + * the first point in a subpath, that is a saved HintMap. For most + * elements, it just means the caller has delayed building a HintMap + * from the current HintMask. + * + * Transform each point with outerTransform and call the outline + * callbacks. This is a general 3x3 transform: + * + * x' = a*x + c*y + tx, y' = b*x + d*y + ty + * + * but it uses 4 elements from CF2_Font and the translation part + * from CF2_GlyphPath. + * + */ + static void + cf2_glyphpath_pushPrevElem( CF2_GlyphPath glyphpath, + CF2_HintMap hintmap, + FT_Vector* nextP0, + FT_Vector nextP1, + FT_Bool close ) + { + CF2_CallbackParamsRec params; + + FT_Vector* prevP0; + FT_Vector* prevP1; + + FT_Vector intersection = { 0, 0 }; + FT_Bool useIntersection = FALSE; + + + FT_ASSERT( glyphpath->prevElemOp == CF2_PathOpLineTo || + glyphpath->prevElemOp == CF2_PathOpCubeTo ); + + if ( glyphpath->prevElemOp == CF2_PathOpLineTo ) + { + prevP0 = &glyphpath->prevElemP0; + prevP1 = &glyphpath->prevElemP1; + } + else + { + prevP0 = &glyphpath->prevElemP2; + prevP1 = &glyphpath->prevElemP3; + } + + /* optimization: if previous and next elements are offset by the same */ + /* amount, then there will be no gap, and no need to compute an */ + /* intersection. */ + if ( prevP1->x != nextP0->x || prevP1->y != nextP0->y ) + { + /* previous element does not join next element: */ + /* adjust end point of previous element to the intersection */ + useIntersection = cf2_glyphpath_computeIntersection( glyphpath, + prevP0, + prevP1, + nextP0, + &nextP1, + &intersection ); + if ( useIntersection ) + { + /* modify the last point of the cached element (either line or */ + /* curve) */ + *prevP1 = intersection; + } + } + + params.pt0 = glyphpath->currentDS; + + switch( glyphpath->prevElemOp ) + { + case CF2_PathOpLineTo: + params.op = CF2_PathOpLineTo; + + /* note: pt2 and pt3 are unused */ + cf2_glyphpath_hintPoint( glyphpath, + hintmap, + ¶ms.pt1, + glyphpath->prevElemP1.x, + glyphpath->prevElemP1.y ); + + glyphpath->callbacks->lineTo( glyphpath->callbacks, ¶ms ); + + glyphpath->currentDS = params.pt1; + + break; + + case CF2_PathOpCubeTo: + params.op = CF2_PathOpCubeTo; + + /* TODO: should we intersect the interior joins (p1-p2 and p2-p3)? */ + cf2_glyphpath_hintPoint( glyphpath, + hintmap, + ¶ms.pt1, + glyphpath->prevElemP1.x, + glyphpath->prevElemP1.y ); + cf2_glyphpath_hintPoint( glyphpath, + hintmap, + ¶ms.pt2, + glyphpath->prevElemP2.x, + glyphpath->prevElemP2.y ); + cf2_glyphpath_hintPoint( glyphpath, + hintmap, + ¶ms.pt3, + glyphpath->prevElemP3.x, + glyphpath->prevElemP3.y ); + + glyphpath->callbacks->cubeTo( glyphpath->callbacks, ¶ms ); + + glyphpath->currentDS = params.pt3; + + break; + } + + if ( !useIntersection || close ) + { + /* insert connecting line between end of previous element and start */ + /* of current one */ + /* note: at the end of a subpath, we might do both, so use `nextP0' */ + /* before we change it, below */ + + cf2_glyphpath_hintPoint( glyphpath, + hintmap, + ¶ms.pt1, + nextP0->x, + nextP0->y ); + + if ( params.pt1.x != glyphpath->currentDS.x || + params.pt1.y != glyphpath->currentDS.y ) + { + /* length is nonzero */ + params.op = CF2_PathOpLineTo; + params.pt0 = glyphpath->currentDS; + + /* note: pt2 and pt3 are unused */ + glyphpath->callbacks->lineTo( glyphpath->callbacks, ¶ms ); + + glyphpath->currentDS = params.pt1; + } + } + + if ( useIntersection ) + { + /* return intersection point to caller */ + *nextP0 = intersection; + } + } + + + /* push a MoveTo element based on current point and offset of current */ + /* element */ + static void + cf2_glyphpath_pushMove( CF2_GlyphPath glyphpath, + FT_Vector start ) + { + CF2_CallbackParamsRec params; + + + params.op = CF2_PathOpMoveTo; + params.pt0 = glyphpath->currentDS; + + /* Test if move has really happened yet; it would have called */ + /* `cf2_hintmap_build' to set `isValid'. */ + if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) ) + { + /* we are here iff first subpath is missing a moveto operator: */ + /* synthesize first moveTo to finish initialization of hintMap */ + cf2_glyphpath_moveTo( glyphpath, + glyphpath->start.x, + glyphpath->start.y ); + } + + cf2_glyphpath_hintPoint( glyphpath, + &glyphpath->hintMap, + ¶ms.pt1, + start.x, + start.y ); + + /* note: pt2 and pt3 are unused */ + glyphpath->callbacks->moveTo( glyphpath->callbacks, ¶ms ); + + glyphpath->currentDS = params.pt1; + glyphpath->offsetStart0 = start; + } + + + /* + * All coordinates are in character space. + * On input, (x1, y1) and (x2, y2) give line segment. + * On output, (x, y) give offset vector. + * We use a piecewise approximation to trig functions. + * + * TODO: Offset true perpendicular and proper length + * supply the y-translation for hinting here, too, + * that adds yOffset unconditionally to *y. + */ + static void + cf2_glyphpath_computeOffset( CF2_GlyphPath glyphpath, + CF2_Fixed x1, + CF2_Fixed y1, + CF2_Fixed x2, + CF2_Fixed y2, + CF2_Fixed* x, + CF2_Fixed* y ) + { + CF2_Fixed dx = x2 - x1; + CF2_Fixed dy = y2 - y1; + + + /* note: negative offsets don't work here; negate deltas to change */ + /* quadrants, below */ + if ( glyphpath->font->reverseWinding ) + { + dx = -dx; + dy = -dy; + } + + *x = *y = 0; + + if ( !glyphpath->darken ) + return; + + /* add momentum for this path element */ + glyphpath->callbacks->windingMomentum += + cf2_getWindingMomentum( x1, y1, x2, y2 ); + + /* note: allow mixed integer and fixed multiplication here */ + if ( dx >= 0 ) + { + if ( dy >= 0 ) + { + /* first quadrant, +x +y */ + + if ( dx > 2 * dy ) + { + /* +x */ + *x = 0; + *y = 0; + } + else if ( dy > 2 * dx ) + { + /* +y */ + *x = glyphpath->xOffset; + *y = glyphpath->yOffset; + } + else + { + /* +x +y */ + *x = FT_MulFix( cf2_floatToFixed( 0.7 ), + glyphpath->xOffset ); + *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), + glyphpath->yOffset ); + } + } + else + { + /* fourth quadrant, +x -y */ + + if ( dx > -2 * dy ) + { + /* +x */ + *x = 0; + *y = 0; + } + else if ( -dy > 2 * dx ) + { + /* -y */ + *x = -glyphpath->xOffset; + *y = glyphpath->yOffset; + } + else + { + /* +x -y */ + *x = FT_MulFix( cf2_floatToFixed( -0.7 ), + glyphpath->xOffset ); + *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ), + glyphpath->yOffset ); + } + } + } + else + { + if ( dy >= 0 ) + { + /* second quadrant, -x +y */ + + if ( -dx > 2 * dy ) + { + /* -x */ + *x = 0; + *y = 2 * glyphpath->yOffset; + } + else if ( dy > -2 * dx ) + { + /* +y */ + *x = glyphpath->xOffset; + *y = glyphpath->yOffset; + } + else + { + /* -x +y */ + *x = FT_MulFix( cf2_floatToFixed( 0.7 ), + glyphpath->xOffset ); + *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), + glyphpath->yOffset ); + } + } + else + { + /* third quadrant, -x -y */ + + if ( -dx > -2 * dy ) + { + /* -x */ + *x = 0; + *y = 2 * glyphpath->yOffset; + } + else if ( -dy > -2 * dx ) + { + /* -y */ + *x = -glyphpath->xOffset; + *y = glyphpath->xOffset; + } + else + { + /* -x -y */ + *x = FT_MulFix( cf2_floatToFixed( -0.7 ), + glyphpath->xOffset ); + *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ), + glyphpath->yOffset ); + } + } + } + } + + + FT_LOCAL_DEF( void ) + cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath, + CF2_Fixed x, + CF2_Fixed y ) + { + cf2_glyphpath_closeOpenPath( glyphpath ); + + /* save the parameters of the move for later, when we'll know how to */ + /* offset it; */ + /* also save last move point */ + glyphpath->currentCS.x = glyphpath->start.x = x; + glyphpath->currentCS.y = glyphpath->start.y = y; + + glyphpath->moveIsPending = TRUE; + + /* ensure we have a valid map with current mask */ + if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) || + cf2_hintmask_isNew( glyphpath->hintMask ) ) + cf2_hintmap_build( &glyphpath->hintMap, + glyphpath->hStemHintArray, + glyphpath->vStemHintArray, + glyphpath->hintMask, + glyphpath->hintOriginY, + FALSE ); + + /* save a copy of current HintMap to use when drawing initial point */ + glyphpath->firstHintMap = glyphpath->hintMap; /* structure copy */ + } + + + FT_LOCAL_DEF( void ) + cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath, + CF2_Fixed x, + CF2_Fixed y ) + { + CF2_Fixed xOffset, yOffset; + FT_Vector P0, P1; + + + /* can't compute offset of zero length line, so ignore them */ + if ( glyphpath->currentCS.x == x && glyphpath->currentCS.y == y ) + return; + + cf2_glyphpath_computeOffset( glyphpath, + glyphpath->currentCS.x, + glyphpath->currentCS.y, + x, + y, + &xOffset, + &yOffset ); + + /* construct offset points */ + P0.x = glyphpath->currentCS.x + xOffset; + P0.y = glyphpath->currentCS.y + yOffset; + P1.x = x + xOffset; + P1.y = y + yOffset; + + if ( glyphpath->moveIsPending ) + { + /* emit offset 1st point as MoveTo */ + cf2_glyphpath_pushMove( glyphpath, P0 ); + + glyphpath->moveIsPending = FALSE; /* adjust state machine */ + glyphpath->pathIsOpen = TRUE; + + glyphpath->offsetStart1 = P1; /* record second point */ + } + + if ( glyphpath->elemIsQueued ) + { + FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ); + + cf2_glyphpath_pushPrevElem( glyphpath, + &glyphpath->hintMap, + &P0, + P1, + FALSE ); + } + + /* queue the current element with offset points */ + glyphpath->elemIsQueued = TRUE; + glyphpath->prevElemOp = CF2_PathOpLineTo; + glyphpath->prevElemP0 = P0; + glyphpath->prevElemP1 = P1; + + /* update current map */ + if ( cf2_hintmask_isNew( glyphpath->hintMask ) ) + cf2_hintmap_build( &glyphpath->hintMap, + glyphpath->hStemHintArray, + glyphpath->vStemHintArray, + glyphpath->hintMask, + glyphpath->hintOriginY, + FALSE ); + + glyphpath->currentCS.x = x; /* pre-offset current point */ + glyphpath->currentCS.y = y; + } + + + FT_LOCAL_DEF( void ) + cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath, + CF2_Fixed x1, + CF2_Fixed y1, + CF2_Fixed x2, + CF2_Fixed y2, + CF2_Fixed x3, + CF2_Fixed y3 ) + { + CF2_Fixed xOffset1, yOffset1, xOffset3, yOffset3; + FT_Vector P0, P1, P2, P3; + + + /* TODO: ignore zero length portions of curve?? */ + cf2_glyphpath_computeOffset( glyphpath, + glyphpath->currentCS.x, + glyphpath->currentCS.y, + x1, + y1, + &xOffset1, + &yOffset1 ); + cf2_glyphpath_computeOffset( glyphpath, + x2, + y2, + x3, + y3, + &xOffset3, + &yOffset3 ); + + /* add momentum from the middle segment */ + glyphpath->callbacks->windingMomentum += + cf2_getWindingMomentum( x1, y1, x2, y2 ); + + /* construct offset points */ + P0.x = glyphpath->currentCS.x + xOffset1; + P0.y = glyphpath->currentCS.y + yOffset1; + P1.x = x1 + xOffset1; + P1.y = y1 + yOffset1; + /* note: preserve angle of final segment by using offset3 at both ends */ + P2.x = x2 + xOffset3; + P2.y = y2 + yOffset3; + P3.x = x3 + xOffset3; + P3.y = y3 + yOffset3; + + if ( glyphpath->moveIsPending ) + { + /* emit offset 1st point as MoveTo */ + cf2_glyphpath_pushMove( glyphpath, P0 ); + + glyphpath->moveIsPending = FALSE; + glyphpath->pathIsOpen = TRUE; + + glyphpath->offsetStart1 = P1; /* record second point */ + } + + if ( glyphpath->elemIsQueued ) + { + FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ); + + cf2_glyphpath_pushPrevElem( glyphpath, + &glyphpath->hintMap, + &P0, + P1, + FALSE ); + } + + /* queue the current element with offset points */ + glyphpath->elemIsQueued = TRUE; + glyphpath->prevElemOp = CF2_PathOpCubeTo; + glyphpath->prevElemP0 = P0; + glyphpath->prevElemP1 = P1; + glyphpath->prevElemP2 = P2; + glyphpath->prevElemP3 = P3; + + /* update current map */ + if ( cf2_hintmask_isNew( glyphpath->hintMask ) ) + cf2_hintmap_build( &glyphpath->hintMap, + glyphpath->hStemHintArray, + glyphpath->vStemHintArray, + glyphpath->hintMask, + glyphpath->hintOriginY, + FALSE ); + + glyphpath->currentCS.x = x3; /* pre-offset current point */ + glyphpath->currentCS.y = y3; + } + + + FT_LOCAL_DEF( void ) + cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath ) + { + if ( glyphpath->pathIsOpen ) + { + FT_ASSERT( cf2_hintmap_isValid( &glyphpath->firstHintMap ) ); + + /* since we need to apply an offset to the implicit lineto, we make */ + /* it explicit here */ + cf2_glyphpath_lineTo( glyphpath, + glyphpath->start.x, + glyphpath->start.y ); + + /* Draw previous element (the explicit LineTo we just created, */ + /* above) and connect it to the start point, but with the offset we */ + /* saved from the first element. */ + /* Use the saved HintMap, too. */ + FT_ASSERT( glyphpath->elemIsQueued ); + + cf2_glyphpath_pushPrevElem( glyphpath, + &glyphpath->firstHintMap, + &glyphpath->offsetStart0, + glyphpath->offsetStart1, + TRUE ); + + /* reset state machine */ + glyphpath->moveIsPending = TRUE; + glyphpath->pathIsOpen = FALSE; + glyphpath->elemIsQueued = FALSE; + } + } + + +/* END */ diff --git a/freetype/src/cff/cf2hints.h b/freetype/src/cff/cf2hints.h new file mode 100644 index 000000000..c4fa922a3 --- /dev/null +++ b/freetype/src/cff/cf2hints.h @@ -0,0 +1,287 @@ +/***************************************************************************/ +/* */ +/* cf2hints.h */ +/* */ +/* Adobe's code for handling CFF hints (body). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2HINTS_H__ +#define __CF2HINTS_H__ + + +FT_BEGIN_HEADER + + + enum + { + CF2_MAX_HINTS = 96 /* maximum # of hints */ + }; + + + /* + * A HintMask object stores a bit mask that specifies which hints in the + * charstring are active at a given time. Hints in CFF must be declared + * at the start, before any drawing operators, with horizontal hints + * preceding vertical hints. The HintMask is ordered the same way, with + * horizontal hints immediately followed by vertical hints. Clients are + * responsible for knowing how many of each type are present. + * + * The maximum total number of hints is 96, as specified by the CFF + * specification. + * + * A HintMask is built 0 or more times while interpreting a charstring, by + * the HintMask operator. There is only one HintMask, but it is built or + * rebuilt each time there is a hint substitution (HintMask operator) in + * the charstring. A default HintMask with all bits set is built if there + * has been no HintMask operator prior to the first drawing operator. + * + */ + + typedef struct CF2_HintMaskRec_ + { + FT_Error* error; + + FT_Bool isValid; + FT_Bool isNew; + + size_t bitCount; + size_t byteCount; + + FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8]; + + } CF2_HintMaskRec, *CF2_HintMask; + + + typedef struct CF2_StemHintRec_ + { + FT_Bool used; /* DS positions are valid */ + + CF2_Fixed min; /* original character space value */ + CF2_Fixed max; + + CF2_Fixed minDS; /* DS position after first use */ + CF2_Fixed maxDS; + + } CF2_StemHintRec, *CF2_StemHint; + + + /* + * A HintMap object stores a piecewise linear function for mapping + * y-coordinates from character space to device space, providing + * appropriate pixel alignment to stem edges. + * + * The map is implemented as an array of `CF2_Hint' elements, each + * representing an edge. When edges are paired, as from stem hints, the + * bottom edge must immediately precede the top edge in the array. + * Element character space AND device space positions must both increase + * monotonically in the array. `CF2_Hint' elements are also used as + * parameters to `cf2_blues_capture'. + * + * The `cf2_hintmap_build' method must be called before any drawing + * operation (beginning with a Move operator) and at each hint + * substitution (HintMask operator). + * + * The `cf2_hintmap_map' method is called to transform y-coordinates at + * each drawing operation (move, line, curve). + * + */ + + /* TODO: make this a CF2_ArrStack and add a deep copy method */ + enum + { + CF2_MAX_HINT_EDGES = CF2_MAX_HINTS * 2 + }; + + + typedef struct CF2_HintMapRec_ + { + CF2_Font font; + + /* initial map based on blue zones */ + struct CF2_HintMapRec_* initialHintMap; + + /* working storage for 2nd pass adjustHints */ + CF2_ArrStack hintMoves; + + FT_Bool isValid; + FT_Bool hinted; + + CF2_Fixed scale; + CF2_UInt count; + + /* start search from this index */ + CF2_UInt lastIndex; + + CF2_HintRec edge[CF2_MAX_HINT_EDGES]; /* 192 */ + + } CF2_HintMapRec, *CF2_HintMap; + + + FT_LOCAL( FT_Bool ) + cf2_hint_isValid( const CF2_Hint hint ); + FT_LOCAL( FT_Bool ) + cf2_hint_isTop( const CF2_Hint hint ); + FT_LOCAL( FT_Bool ) + cf2_hint_isBottom( const CF2_Hint hint ); + FT_LOCAL( void ) + cf2_hint_lock( CF2_Hint hint ); + + + FT_LOCAL( void ) + cf2_hintmap_init( CF2_HintMap hintmap, + CF2_Font font, + CF2_HintMap initialMap, + CF2_ArrStack hintMoves, + CF2_Fixed scale ); + FT_LOCAL( void ) + cf2_hintmap_build( CF2_HintMap hintmap, + CF2_ArrStack hStemHintArray, + CF2_ArrStack vStemHintArray, + CF2_HintMask hintMask, + CF2_Fixed hintOrigin, + FT_Bool initialMap ); + + + /* + * GlyphPath is a wrapper for drawing operations that scales the + * coordinates according to the render matrix and HintMap. It also tracks + * open paths to control ClosePath and to insert MoveTo for broken fonts. + * + */ + typedef struct CF2_GlyphPathRec_ + { + /* TODO: gather some of these into a hinting context */ + + CF2_Font font; /* font instance */ + CF2_OutlineCallbacks callbacks; /* outline consumer */ + + + CF2_HintMapRec hintMap; /* current hint map */ + CF2_HintMapRec firstHintMap; /* saved copy */ + CF2_HintMapRec initialHintMap; /* based on all captured hints */ + + CF2_ArrStackRec hintMoves; /* list of hint moves for 2nd pass */ + + CF2_Fixed scaleX; /* matrix a */ + CF2_Fixed scaleC; /* matrix c */ + CF2_Fixed scaleY; /* matrix d */ + + FT_Vector fractionalTranslation; /* including deviceXScale */ +#if 0 + CF2_Fixed hShift; /* character space horizontal shift */ + /* (for fauxing) */ +#endif + + FT_Bool pathIsOpen; /* true after MoveTo */ + FT_Bool darken; /* true if stem darkening */ + FT_Bool moveIsPending; /* true between MoveTo and offset MoveTo */ + + /* references used to call `cf2_hintmap_build', if necessary */ + CF2_ArrStack hStemHintArray; + CF2_ArrStack vStemHintArray; + CF2_HintMask hintMask; /* ptr to the current mask */ + CF2_Fixed hintOriginY; /* copy of current origin */ + const CF2_BluesRec* blues; + + CF2_Fixed xOffset; /* character space offsets */ + CF2_Fixed yOffset; + + /* character space miter limit threshold */ + CF2_Fixed miterLimit; + /* vertical/horzizontal snap distance in character space */ + CF2_Fixed snapThreshold; + + FT_Vector offsetStart0; /* first and second points of first */ + FT_Vector offsetStart1; /* element with offset applied */ + + /* current point, character space, before offset */ + FT_Vector currentCS; + /* current point, device space */ + FT_Vector currentDS; + FT_Vector start; /* start point of subpath */ + + /* the following members constitute the `queue' of one element */ + FT_Bool elemIsQueued; + CF2_Int prevElemOp; + + FT_Vector prevElemP0; + FT_Vector prevElemP1; + FT_Vector prevElemP2; + FT_Vector prevElemP3; + + } CF2_GlyphPathRec, *CF2_GlyphPath; + + + FT_LOCAL( void ) + cf2_glyphpath_init( CF2_GlyphPath glyphpath, + CF2_Font font, + CF2_OutlineCallbacks callbacks, + CF2_Fixed scaleY, + /* CF2_Fixed hShift, */ + CF2_ArrStack hStemHintArray, + CF2_ArrStack vStemHintArray, + CF2_HintMask hintMask, + CF2_Fixed hintOrigin, + const CF2_Blues blues, + const FT_Vector* fractionalTranslation ); + FT_LOCAL( void ) + cf2_glyphpath_finalize( CF2_GlyphPath glyphpath ); + + FT_LOCAL( void ) + cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath, + CF2_Fixed x, + CF2_Fixed y ); + FT_LOCAL( void ) + cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath, + CF2_Fixed x, + CF2_Fixed y ); + FT_LOCAL( void ) + cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath, + CF2_Fixed x1, + CF2_Fixed y1, + CF2_Fixed x2, + CF2_Fixed y2, + CF2_Fixed x3, + CF2_Fixed y3 ); + FT_LOCAL( void ) + cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath ); + + +FT_END_HEADER + + +#endif /* __CF2HINTS_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2intrp.c b/freetype/src/cff/cf2intrp.c new file mode 100644 index 000000000..5610917cc --- /dev/null +++ b/freetype/src/cff/cf2intrp.c @@ -0,0 +1,1538 @@ +/***************************************************************************/ +/* */ +/* cf2intrp.c */ +/* */ +/* Adobe's CFF Interpreter (body). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" +#include FT_INTERNAL_DEBUG_H + +#include "cf2glue.h" +#include "cf2font.h" +#include "cf2stack.h" +#include "cf2hints.h" + +#include "cf2error.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_cf2interp + + + /* some operators are not implemented yet */ +#define CF2_FIXME FT_TRACE4(( "cf2_interpT2CharString:" \ + " operator not implemented yet\n" )) + + + + FT_LOCAL_DEF( void ) + cf2_hintmask_init( CF2_HintMask hintmask, + FT_Error* error ) + { + FT_ZERO( hintmask ); + + hintmask->error = error; + } + + + FT_LOCAL_DEF( FT_Bool ) + cf2_hintmask_isValid( const CF2_HintMask hintmask ) + { + return hintmask->isValid; + } + + + FT_LOCAL_DEF( FT_Bool ) + cf2_hintmask_isNew( const CF2_HintMask hintmask ) + { + return hintmask->isNew; + } + + + FT_LOCAL_DEF( void ) + cf2_hintmask_setNew( CF2_HintMask hintmask, + FT_Bool val ) + { + hintmask->isNew = val; + } + + + /* clients call `getMaskPtr' in order to iterate */ + /* through hint mask */ + + FT_LOCAL_DEF( FT_Byte* ) + cf2_hintmask_getMaskPtr( CF2_HintMask hintmask ) + { + return hintmask->mask; + } + + + static size_t + cf2_hintmask_setCounts( CF2_HintMask hintmask, + size_t bitCount ) + { + if ( bitCount > CF2_MAX_HINTS ) + { + /* total of h and v stems must be <= 96 */ + CF2_SET_ERROR( hintmask->error, Invalid_Glyph_Format ); + return 0; + } + + hintmask->bitCount = bitCount; + hintmask->byteCount = ( hintmask->bitCount + 7 ) / 8; + + hintmask->isValid = TRUE; + hintmask->isNew = TRUE; + + return bitCount; + } + + + /* consume the hintmask bytes from the charstring, advancing the src */ + /* pointer */ + static void + cf2_hintmask_read( CF2_HintMask hintmask, + CF2_Buffer charstring, + size_t bitCount ) + { + size_t i; + +#ifndef CF2_NDEBUG + /* these are the bits in the final mask byte that should be zero */ + /* Note: this variable is only used in an assert expression below */ + /* and then only if CF2_NDEBUG is not defined */ + CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1; +#endif + + + /* initialize counts and isValid */ + if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 ) + return; + + FT_ASSERT( hintmask->byteCount > 0 ); + + FT_TRACE4(( " (maskbytes:" )); + + /* set mask and advance interpreter's charstring pointer */ + for ( i = 0; i < hintmask->byteCount; i++ ) + { + hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring ); + FT_TRACE4(( " 0x%02X", hintmask->mask[i] )); + } + + FT_TRACE4(( ")\n" )); + + /* assert any unused bits in last byte are zero unless there's a prior */ + /* error */ + /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */ +#ifndef CF2_NDEBUG + FT_ASSERT( ( hintmask->mask[hintmask->byteCount - 1] & mask ) == 0 || + *hintmask->error ); +#endif + } + + + FT_LOCAL_DEF( void ) + cf2_hintmask_setAll( CF2_HintMask hintmask, + size_t bitCount ) + { + size_t i; + CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1; + + + /* initialize counts and isValid */ + if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 ) + return; + + FT_ASSERT( hintmask->byteCount > 0 ); + FT_ASSERT( hintmask->byteCount < + sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) ); + + /* set mask to all ones */ + for ( i = 0; i < hintmask->byteCount; i++ ) + hintmask->mask[i] = 0xFF; + + /* clear unused bits */ + /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */ + hintmask->mask[hintmask->byteCount - 1] &= ~mask; + } + + + /* Type2 charstring opcodes */ + enum + { + cf2_cmdRESERVED_0, /* 0 */ + cf2_cmdHSTEM, /* 1 */ + cf2_cmdRESERVED_2, /* 2 */ + cf2_cmdVSTEM, /* 3 */ + cf2_cmdVMOVETO, /* 4 */ + cf2_cmdRLINETO, /* 5 */ + cf2_cmdHLINETO, /* 6 */ + cf2_cmdVLINETO, /* 7 */ + cf2_cmdRRCURVETO, /* 8 */ + cf2_cmdRESERVED_9, /* 9 */ + cf2_cmdCALLSUBR, /* 10 */ + cf2_cmdRETURN, /* 11 */ + cf2_cmdESC, /* 12 */ + cf2_cmdRESERVED_13, /* 13 */ + cf2_cmdENDCHAR, /* 14 */ + cf2_cmdRESERVED_15, /* 15 */ + cf2_cmdRESERVED_16, /* 16 */ + cf2_cmdRESERVED_17, /* 17 */ + cf2_cmdHSTEMHM, /* 18 */ + cf2_cmdHINTMASK, /* 19 */ + cf2_cmdCNTRMASK, /* 20 */ + cf2_cmdRMOVETO, /* 21 */ + cf2_cmdHMOVETO, /* 22 */ + cf2_cmdVSTEMHM, /* 23 */ + cf2_cmdRCURVELINE, /* 24 */ + cf2_cmdRLINECURVE, /* 25 */ + cf2_cmdVVCURVETO, /* 26 */ + cf2_cmdHHCURVETO, /* 27 */ + cf2_cmdEXTENDEDNMBR, /* 28 */ + cf2_cmdCALLGSUBR, /* 29 */ + cf2_cmdVHCURVETO, /* 30 */ + cf2_cmdHVCURVETO /* 31 */ + }; + + enum + { + cf2_escDOTSECTION, /* 0 */ + cf2_escRESERVED_1, /* 1 */ + cf2_escRESERVED_2, /* 2 */ + cf2_escAND, /* 3 */ + cf2_escOR, /* 4 */ + cf2_escNOT, /* 5 */ + cf2_escRESERVED_6, /* 6 */ + cf2_escRESERVED_7, /* 7 */ + cf2_escRESERVED_8, /* 8 */ + cf2_escABS, /* 9 */ + cf2_escADD, /* 10 like otherADD */ + cf2_escSUB, /* 11 like otherSUB */ + cf2_escDIV, /* 12 */ + cf2_escRESERVED_13, /* 13 */ + cf2_escNEG, /* 14 */ + cf2_escEQ, /* 15 */ + cf2_escRESERVED_16, /* 16 */ + cf2_escRESERVED_17, /* 17 */ + cf2_escDROP, /* 18 */ + cf2_escRESERVED_19, /* 19 */ + cf2_escPUT, /* 20 like otherPUT */ + cf2_escGET, /* 21 like otherGET */ + cf2_escIFELSE, /* 22 like otherIFELSE */ + cf2_escRANDOM, /* 23 like otherRANDOM */ + cf2_escMUL, /* 24 like otherMUL */ + cf2_escRESERVED_25, /* 25 */ + cf2_escSQRT, /* 26 */ + cf2_escDUP, /* 27 like otherDUP */ + cf2_escEXCH, /* 28 like otherEXCH */ + cf2_escINDEX, /* 29 */ + cf2_escROLL, /* 30 */ + cf2_escRESERVED_31, /* 31 */ + cf2_escRESERVED_32, /* 32 */ + cf2_escRESERVED_33, /* 33 */ + cf2_escHFLEX, /* 34 */ + cf2_escFLEX, /* 35 */ + cf2_escHFLEX1, /* 36 */ + cf2_escFLEX1 /* 37 */ + }; + + + /* `stemHintArray' does not change once we start drawing the outline. */ + static void + cf2_doStems( const CF2_Font font, + CF2_Stack opStack, + CF2_ArrStack stemHintArray, + CF2_Fixed* width, + FT_Bool* haveWidth, + CF2_Fixed hintOffset ) + { + CF2_UInt i; + CF2_UInt count = cf2_stack_count( opStack ); + FT_Bool hasWidthArg = (FT_Bool)( count & 1 ); + + /* variable accumulates delta values from operand stack */ + CF2_Fixed position = hintOffset; + + if ( hasWidthArg && ! *haveWidth ) + *width = cf2_stack_getReal( opStack, 0 ) + + cf2_getNominalWidthX( font->decoder ); + + if ( font->decoder->width_only ) + goto exit; + + for ( i = hasWidthArg ? 1 : 0; i < count; i += 2 ) + { + /* construct a CF2_StemHint and push it onto the list */ + CF2_StemHintRec stemhint; + + + stemhint.min = + position += cf2_stack_getReal( opStack, i ); + stemhint.max = + position += cf2_stack_getReal( opStack, i + 1 ); + + stemhint.used = FALSE; + stemhint.maxDS = + stemhint.minDS = 0; + + cf2_arrstack_push( stemHintArray, &stemhint ); /* defer error check */ + } + + cf2_stack_clear( opStack ); + + exit: + /* cf2_doStems must define a width (may be default) */ + *haveWidth = TRUE; + } + + + static void + cf2_doFlex( CF2_Stack opStack, + CF2_Fixed* curX, + CF2_Fixed* curY, + CF2_GlyphPath glyphPath, + const FT_Bool* readFromStack, + FT_Bool doConditionalLastRead ) + { + CF2_Fixed vals[14]; + CF2_UInt index; + FT_Bool isHFlex; + CF2_Int top, i, j; + + + vals[0] = *curX; + vals[1] = *curY; + index = 0; + isHFlex = readFromStack[9] == FALSE; + top = isHFlex ? 9 : 10; + + for ( i = 0; i < top; i++ ) + { + vals[i + 2] = vals[i]; + if ( readFromStack[i] ) + vals[i + 2] += cf2_stack_getReal( opStack, index++ ); + } + + if ( isHFlex ) + vals[9 + 2] = *curY; + + if ( doConditionalLastRead ) + { + FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) > + cf2_fixedAbs( vals[11] - *curY ) ); + CF2_Fixed lastVal = cf2_stack_getReal( opStack, index ); + + + if ( lastIsX ) + { + vals[12] = vals[10] + lastVal; + vals[13] = *curY; + } + else + { + vals[12] = *curX; + vals[13] = vals[11] + lastVal; + } + } + else + { + if ( readFromStack[10] ) + vals[12] = vals[10] + cf2_stack_getReal( opStack, index++ ); + else + vals[12] = *curX; + + if ( readFromStack[11] ) + vals[13] = vals[11] + cf2_stack_getReal( opStack, index ); + else + vals[13] = *curY; + } + + for ( j = 0; j < 2; j++ ) + cf2_glyphpath_curveTo( glyphPath, vals[j * 6 + 2], + vals[j * 6 + 3], + vals[j * 6 + 4], + vals[j * 6 + 5], + vals[j * 6 + 6], + vals[j * 6 + 7] ); + + cf2_stack_clear( opStack ); + + *curX = vals[12]; + *curY = vals[13]; + } + + + /* + * `error' is a shared error code used by many objects in this + * routine. Before the code continues from an error, it must check and + * record the error in `*error'. The idea is that this shared + * error code will record the first error encountered. If testing + * for an error anyway, the cost of `goto exit' is small, so we do it, + * even if continuing would be safe. In this case, `lastError' is + * set, so the testing and storing can be done in one place, at `exit'. + * + * Continuing after an error is intended for objects which do their own + * testing of `*error', e.g., array stack functions. This allows us to + * avoid an extra test after the call. + * + * Unimplemented opcodes are ignored. + * + */ + FT_LOCAL_DEF( void ) + cf2_interpT2CharString( CF2_Font font, + CF2_Buffer buf, + CF2_OutlineCallbacks callbacks, + const FT_Vector* translation, + FT_Bool doingSeac, + CF2_Fixed curX, + CF2_Fixed curY, + CF2_Fixed* width ) + { + /* lastError is used for errors that are immediately tested */ + FT_Error lastError = FT_Err_Ok; + + /* pointer to parsed font object */ + CFF_Decoder* decoder = font->decoder; + + FT_Error* error = &font->error; + FT_Memory memory = font->memory; + + CF2_Fixed scaleY = font->innerTransform.d; + CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder ); + + /* save this for hinting seac accents */ + CF2_Fixed hintOriginY = curY; + + CF2_Stack opStack = NULL; + FT_Byte op1; /* first opcode byte */ + + /* instruction limit; 20,000,000 matches Avalon */ + FT_UInt32 instructionLimit = 20000000UL; + + CF2_ArrStackRec subrStack; + + FT_Bool haveWidth; + CF2_Buffer charstring = NULL; + + CF2_Int charstringIndex = -1; /* initialize to empty */ + + /* TODO: placeholders for hint structures */ + + /* objects used for hinting */ + CF2_ArrStackRec hStemHintArray; + CF2_ArrStackRec vStemHintArray; + + CF2_HintMaskRec hintMask; + CF2_GlyphPathRec glyphPath; + + + /* initialize the remaining objects */ + cf2_arrstack_init( &subrStack, + memory, + error, + sizeof ( CF2_BufferRec ) ); + cf2_arrstack_init( &hStemHintArray, + memory, + error, + sizeof ( CF2_StemHintRec ) ); + cf2_arrstack_init( &vStemHintArray, + memory, + error, + sizeof ( CF2_StemHintRec ) ); + + /* initialize CF2_StemHint arrays */ + cf2_hintmask_init( &hintMask, error ); + + /* initialize path map to manage drawing operations */ + + /* Note: last 4 params are used to handle `MoveToPermissive', which */ + /* may need to call `hintMap.Build' */ + /* TODO: MoveToPermissive is gone; are these still needed? */ + cf2_glyphpath_init( &glyphPath, + font, + callbacks, + scaleY, + /* hShift, */ + &hStemHintArray, + &vStemHintArray, + &hintMask, + hintOriginY, + &font->blues, + translation ); + + /* + * Initialize state for width parsing. From the CFF Spec: + * + * The first stack-clearing operator, which must be one of hstem, + * hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto, + * rmoveto, or endchar, takes an additional argument - the width (as + * described earlier), which may be expressed as zero or one numeric + * argument. + * + * What we implement here uses the first validly specified width, but + * does not detect errors for specifying more than one width. + * + * If one of the above operators occurs without explicitly specifying + * a width, we assume the default width. + * + */ + haveWidth = FALSE; + *width = cf2_getDefaultWidthX( decoder ); + + /* + * Note: at this point, all pointers to resources must be NULL + * and all local objects must be initialized. + * There must be no branches to exit: above this point. + * + */ + + /* allocate an operand stack */ + opStack = cf2_stack_init( memory, error ); + if ( !opStack ) + { + lastError = FT_THROW( Out_Of_Memory ); + goto exit; + } + + /* initialize subroutine stack by placing top level charstring as */ + /* first element (max depth plus one for the charstring) */ + /* Note: Caller owns and must finalize the first charstring. */ + /* Our copy of it does not change that requirement. */ + cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 ); + + charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack ); + *charstring = *buf; /* structure copy */ + + charstringIndex = 0; /* entry is valid now */ + + /* catch errors so far */ + if ( *error ) + goto exit; + + /* main interpreter loop */ + while ( 1 ) + { + if ( cf2_buf_isEnd( charstring ) ) + { + /* If we've reached the end of the charstring, simulate a */ + /* cf2_cmdRETURN or cf2_cmdENDCHAR. */ + if ( charstringIndex ) + op1 = cf2_cmdRETURN; /* end of buffer for subroutine */ + else + op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */ + } + else + op1 = (FT_Byte)cf2_buf_readByte( charstring ); + + /* check for errors once per loop */ + if ( *error ) + goto exit; + + instructionLimit--; + if ( instructionLimit == 0 ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; + } + + switch( op1 ) + { + case cf2_cmdRESERVED_0: + case cf2_cmdRESERVED_2: + case cf2_cmdRESERVED_9: + case cf2_cmdRESERVED_13: + case cf2_cmdRESERVED_15: + case cf2_cmdRESERVED_16: + case cf2_cmdRESERVED_17: + /* we may get here if we have a prior error */ + FT_TRACE4(( " unknown op (%d)\n", op1 )); + break; + + case cf2_cmdHSTEMHM: + case cf2_cmdHSTEM: + FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" )); + + /* never add hints after the mask is computed */ + if ( cf2_hintmask_isValid( &hintMask ) ) + FT_TRACE4(( "cf2_interpT2CharString:" + " invalid horizontal hint mask\n" )); + + cf2_doStems( font, + opStack, + &hStemHintArray, + width, + &haveWidth, + 0 ); + + if ( font->decoder->width_only ) + goto exit; + + break; + + case cf2_cmdVSTEMHM: + case cf2_cmdVSTEM: + FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" )); + + /* never add hints after the mask is computed */ + if ( cf2_hintmask_isValid( &hintMask ) ) + FT_TRACE4(( "cf2_interpT2CharString:" + " invalid vertical hint mask\n" )); + + cf2_doStems( font, + opStack, + &vStemHintArray, + width, + &haveWidth, + 0 ); + + if ( font->decoder->width_only ) + goto exit; + + break; + + case cf2_cmdVMOVETO: + FT_TRACE4(( " vmoveto\n" )); + + if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) + *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + + /* width is defined or default after this */ + haveWidth = TRUE; + + if ( font->decoder->width_only ) + goto exit; + + curY += cf2_stack_popFixed( opStack ); + + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + break; + + case cf2_cmdRLINETO: + { + CF2_UInt index; + CF2_UInt count = cf2_stack_count( opStack ); + + + FT_TRACE4(( " rlineto\n" )); + + for ( index = 0; index < count; index += 2 ) + { + curX += cf2_stack_getReal( opStack, index + 0 ); + curY += cf2_stack_getReal( opStack, index + 1 ); + + cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdHLINETO: + case cf2_cmdVLINETO: + { + CF2_UInt index; + CF2_UInt count = cf2_stack_count( opStack ); + + FT_Bool isX = op1 == cf2_cmdHLINETO; + + + FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" )); + + for ( index = 0; index < count; index++ ) + { + CF2_Fixed v = cf2_stack_getReal( opStack, index ); + + + if ( isX ) + curX += v; + else + curY += v; + + isX = !isX; + + cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + } + + cf2_stack_clear( opStack ); + } + continue; + + case cf2_cmdRCURVELINE: + case cf2_cmdRRCURVETO: + { + CF2_UInt count = cf2_stack_count( opStack ); + CF2_UInt index = 0; + + + FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n" + : " rrcurveto\n" )); + + while ( index + 6 <= count ) + { + CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; + CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY; + CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1; + CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1; + CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; + CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2; + + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + index += 6; + } + + if ( op1 == cf2_cmdRCURVELINE ) + { + curX += cf2_stack_getReal( opStack, index + 0 ); + curY += cf2_stack_getReal( opStack, index + 1 ); + + cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdCALLGSUBR: + case cf2_cmdCALLSUBR: + { + CF2_UInt subrIndex; + + + FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr" + : " callsubr" )); + + if ( charstringIndex > CF2_MAX_SUBR ) + { + /* max subr plus one for charstring */ + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* overflow of stack */ + } + + /* push our current CFF charstring region on subrStack */ + charstring = (CF2_Buffer) + cf2_arrstack_getPointer( &subrStack, + charstringIndex + 1 ); + + /* set up the new CFF region and pointer */ + subrIndex = cf2_stack_popInt( opStack ); + + switch ( op1 ) + { + case cf2_cmdCALLGSUBR: + FT_TRACE4(( "(%d)\n", subrIndex + decoder->globals_bias )); + + if ( cf2_initGlobalRegionBuffer( decoder, + subrIndex, + charstring ) ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* subroutine lookup or stream error */ + } + break; + + default: + /* cf2_cmdCALLSUBR */ + FT_TRACE4(( "(%d)\n", subrIndex + decoder->locals_bias )); + + if ( cf2_initLocalRegionBuffer( decoder, + subrIndex, + charstring ) ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* subroutine lookup or stream error */ + } + } + + charstringIndex += 1; /* entry is valid now */ + } + continue; /* do not clear the stack */ + + case cf2_cmdRETURN: + FT_TRACE4(( " return\n" )); + + if ( charstringIndex < 1 ) + { + /* Note: cannot return from top charstring */ + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* underflow of stack */ + } + + /* restore position in previous charstring */ + charstring = (CF2_Buffer) + cf2_arrstack_getPointer( &subrStack, + --charstringIndex ); + continue; /* do not clear the stack */ + + case cf2_cmdESC: + { + FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring ); + + + switch ( op2 ) + { + case cf2_escDOTSECTION: + /* something about `flip type of locking' -- ignore it */ + FT_TRACE4(( " dotsection\n" )); + + break; + + /* TODO: should these operators be supported? */ + case cf2_escAND: /* in spec */ + FT_TRACE4(( " and\n" )); + + CF2_FIXME; + break; + + case cf2_escOR: /* in spec */ + FT_TRACE4(( " or\n" )); + + CF2_FIXME; + break; + + case cf2_escNOT: /* in spec */ + FT_TRACE4(( " not\n" )); + + CF2_FIXME; + break; + + case cf2_escABS: /* in spec */ + FT_TRACE4(( " abs\n" )); + + CF2_FIXME; + break; + + case cf2_escADD: /* in spec */ + FT_TRACE4(( " add\n" )); + + CF2_FIXME; + break; + + case cf2_escSUB: /* in spec */ + FT_TRACE4(( " sub\n" )); + + CF2_FIXME; + break; + + case cf2_escDIV: /* in spec */ + FT_TRACE4(( " div\n" )); + + CF2_FIXME; + break; + + case cf2_escNEG: /* in spec */ + FT_TRACE4(( " neg\n" )); + + CF2_FIXME; + break; + + case cf2_escEQ: /* in spec */ + FT_TRACE4(( " eq\n" )); + + CF2_FIXME; + break; + + case cf2_escDROP: /* in spec */ + FT_TRACE4(( " drop\n" )); + + CF2_FIXME; + break; + + case cf2_escPUT: /* in spec */ + FT_TRACE4(( " put\n" )); + + CF2_FIXME; + break; + + case cf2_escGET: /* in spec */ + FT_TRACE4(( " get\n" )); + + CF2_FIXME; + break; + + case cf2_escIFELSE: /* in spec */ + FT_TRACE4(( " ifelse\n" )); + + CF2_FIXME; + break; + + case cf2_escRANDOM: /* in spec */ + FT_TRACE4(( " random\n" )); + + CF2_FIXME; + break; + + case cf2_escMUL: /* in spec */ + FT_TRACE4(( " mul\n" )); + + CF2_FIXME; + break; + + case cf2_escSQRT: /* in spec */ + FT_TRACE4(( " sqrt\n" )); + + CF2_FIXME; + break; + + case cf2_escDUP: /* in spec */ + FT_TRACE4(( " dup\n" )); + + CF2_FIXME; + break; + + case cf2_escEXCH: /* in spec */ + FT_TRACE4(( " exch\n" )); + + CF2_FIXME; + break; + + case cf2_escINDEX: /* in spec */ + FT_TRACE4(( " index\n" )); + + CF2_FIXME; + break; + + case cf2_escROLL: /* in spec */ + FT_TRACE4(( " roll\n" )); + + CF2_FIXME; + break; + + case cf2_escHFLEX: + { + static const FT_Bool readFromStack[12] = + { + TRUE /* dx1 */, FALSE /* dy1 */, + TRUE /* dx2 */, TRUE /* dy2 */, + TRUE /* dx3 */, FALSE /* dy3 */, + TRUE /* dx4 */, FALSE /* dy4 */, + TRUE /* dx5 */, FALSE /* dy5 */, + TRUE /* dx6 */, FALSE /* dy6 */ + }; + + + FT_TRACE4(( " hflex\n" )); + + cf2_doFlex( opStack, + &curX, + &curY, + &glyphPath, + readFromStack, + FALSE /* doConditionalLastRead */ ); + } + continue; + + case cf2_escFLEX: + { + static const FT_Bool readFromStack[12] = + { + TRUE /* dx1 */, TRUE /* dy1 */, + TRUE /* dx2 */, TRUE /* dy2 */, + TRUE /* dx3 */, TRUE /* dy3 */, + TRUE /* dx4 */, TRUE /* dy4 */, + TRUE /* dx5 */, TRUE /* dy5 */, + TRUE /* dx6 */, TRUE /* dy6 */ + }; + + + FT_TRACE4(( " flex\n" )); + + cf2_doFlex( opStack, + &curX, + &curY, + &glyphPath, + readFromStack, + FALSE /* doConditionalLastRead */ ); + } + break; /* TODO: why is this not a continue? */ + + case cf2_escHFLEX1: + { + static const FT_Bool readFromStack[12] = + { + TRUE /* dx1 */, TRUE /* dy1 */, + TRUE /* dx2 */, TRUE /* dy2 */, + TRUE /* dx3 */, FALSE /* dy3 */, + TRUE /* dx4 */, FALSE /* dy4 */, + TRUE /* dx5 */, TRUE /* dy5 */, + TRUE /* dx6 */, FALSE /* dy6 */ + }; + + + FT_TRACE4(( " hflex1\n" )); + + cf2_doFlex( opStack, + &curX, + &curY, + &glyphPath, + readFromStack, + FALSE /* doConditionalLastRead */ ); + } + continue; + + case cf2_escFLEX1: + { + static const FT_Bool readFromStack[12] = + { + TRUE /* dx1 */, TRUE /* dy1 */, + TRUE /* dx2 */, TRUE /* dy2 */, + TRUE /* dx3 */, TRUE /* dy3 */, + TRUE /* dx4 */, TRUE /* dy4 */, + TRUE /* dx5 */, TRUE /* dy5 */, + FALSE /* dx6 */, FALSE /* dy6 */ + }; + + + FT_TRACE4(( " flex1\n" )); + + cf2_doFlex( opStack, + &curX, + &curY, + &glyphPath, + readFromStack, + TRUE /* doConditionalLastRead */ ); + } + continue; + + case cf2_escRESERVED_1: + case cf2_escRESERVED_2: + case cf2_escRESERVED_6: + case cf2_escRESERVED_7: + case cf2_escRESERVED_8: + case cf2_escRESERVED_13: + case cf2_escRESERVED_16: + case cf2_escRESERVED_17: + case cf2_escRESERVED_19: + case cf2_escRESERVED_25: + case cf2_escRESERVED_31: + case cf2_escRESERVED_32: + case cf2_escRESERVED_33: + default: + FT_TRACE4(( " unknown op (12, %d)\n", op2 )); + + }; /* end of switch statement checking `op2' */ + + } /* case cf2_cmdESC */ + break; + + case cf2_cmdENDCHAR: + FT_TRACE4(( " endchar\n" )); + + if ( cf2_stack_count( opStack ) == 1 || + cf2_stack_count( opStack ) == 5 ) + { + if ( !haveWidth ) + *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + } + + /* width is defined or default after this */ + haveWidth = TRUE; + + if ( font->decoder->width_only ) + goto exit; + + /* close path if still open */ + cf2_glyphpath_closeOpenPath( &glyphPath ); + + if ( cf2_stack_count( opStack ) > 1 ) + { + /* must be either 4 or 5 -- */ + /* this is a (deprecated) implied `seac' operator */ + + CF2_UInt achar; + CF2_UInt bchar; + CF2_BufferRec component; + CF2_Fixed dummyWidth; /* ignore component width */ + FT_Error error2; + + + if ( doingSeac ) + { + lastError = FT_THROW( Invalid_Glyph_Format ); + goto exit; /* nested seac */ + } + + achar = cf2_stack_popInt( opStack ); + bchar = cf2_stack_popInt( opStack ); + + curY = cf2_stack_popFixed( opStack ); + curX = cf2_stack_popFixed( opStack ); + + error2 = cf2_getSeacComponent( decoder, achar, &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + curX, + curY, + &dummyWidth ); + cf2_freeSeacComponent( decoder, &component ); + + error2 = cf2_getSeacComponent( decoder, bchar, &component ); + if ( error2 ) + { + lastError = error2; /* pass FreeType error through */ + goto exit; + } + cf2_interpT2CharString( font, + &component, + callbacks, + translation, + TRUE, + 0, + 0, + &dummyWidth ); + cf2_freeSeacComponent( decoder, &component ); + } + goto exit; + + case cf2_cmdCNTRMASK: + case cf2_cmdHINTMASK: + /* the final \n in the tracing message gets added in */ + /* `cf2_hintmask_read' (which also traces the mask bytes) */ + FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" )); + + /* if there are arguments on the stack, there this is an */ + /* implied cf2_cmdVSTEMHM */ + if ( cf2_stack_count( opStack ) != 0 ) + { + /* never add hints after the mask is computed */ + if ( cf2_hintmask_isValid( &hintMask ) ) + FT_TRACE4(( "cf2_interpT2CharString: invalid hint mask\n" )); + } + + cf2_doStems( font, + opStack, + &vStemHintArray, + width, + &haveWidth, + 0 ); + + if ( font->decoder->width_only ) + goto exit; + + if ( op1 == cf2_cmdHINTMASK ) + { + /* consume the hint mask bytes which follow the operator */ + cf2_hintmask_read( &hintMask, + charstring, + cf2_arrstack_size( &hStemHintArray ) + + cf2_arrstack_size( &vStemHintArray ) ); + } + else + { + /* + * Consume the counter mask bytes which follow the operator: + * Build a temporary hint map, just to place and lock those + * stems participating in the counter mask. These are most + * likely the dominant hstems, and are grouped together in a + * few counter groups, not necessarily in correspondence + * with the hint groups. This reduces the chances of + * conflicts between hstems that are initially placed in + * separate hint groups and then brought together. The + * positions are copied back to `hStemHintArray', so we can + * discard `counterMask' and `counterHintMap'. + * + */ + CF2_HintMapRec counterHintMap; + CF2_HintMaskRec counterMask; + + + cf2_hintmap_init( &counterHintMap, + font, + &glyphPath.initialHintMap, + &glyphPath.hintMoves, + scaleY ); + cf2_hintmask_init( &counterMask, error ); + + cf2_hintmask_read( &counterMask, + charstring, + cf2_arrstack_size( &hStemHintArray ) + + cf2_arrstack_size( &vStemHintArray ) ); + cf2_hintmap_build( &counterHintMap, + &hStemHintArray, + &vStemHintArray, + &counterMask, + 0, + FALSE ); + } + break; + + case cf2_cmdRMOVETO: + FT_TRACE4(( " rmoveto\n" )); + + if ( cf2_stack_count( opStack ) > 2 && !haveWidth ) + *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + + /* width is defined or default after this */ + haveWidth = TRUE; + + if ( font->decoder->width_only ) + goto exit; + + curY += cf2_stack_popFixed( opStack ); + curX += cf2_stack_popFixed( opStack ); + + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + break; + + case cf2_cmdHMOVETO: + FT_TRACE4(( " hmoveto\n" )); + + if ( cf2_stack_count( opStack ) > 1 && !haveWidth ) + *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX; + + /* width is defined or default after this */ + haveWidth = TRUE; + + if ( font->decoder->width_only ) + goto exit; + + curX += cf2_stack_popFixed( opStack ); + + cf2_glyphpath_moveTo( &glyphPath, curX, curY ); + + break; + + case cf2_cmdRLINECURVE: + { + CF2_UInt count = cf2_stack_count( opStack ); + CF2_UInt index = 0; + + + FT_TRACE4(( " rlinecurve\n" )); + + while ( index + 6 < count ) + { + curX += cf2_stack_getReal( opStack, index + 0 ); + curY += cf2_stack_getReal( opStack, index + 1 ); + + cf2_glyphpath_lineTo( &glyphPath, curX, curY ); + index += 2; + } + + while ( index < count ) + { + CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; + CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY; + CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1; + CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1; + CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; + CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2; + + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + index += 6; + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdVVCURVETO: + { + CF2_UInt count = cf2_stack_count( opStack ); + CF2_UInt index = 0; + + + FT_TRACE4(( " vvcurveto\n" )); + + while ( index < count ) + { + CF2_Fixed x1, y1, x2, y2, x3, y3; + + + if ( ( count - index ) & 1 ) + { + x1 = cf2_stack_getReal( opStack, index ) + curX; + + ++index; + } + else + x1 = curX; + + y1 = cf2_stack_getReal( opStack, index + 0 ) + curY; + x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; + y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; + x3 = x2; + y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + index += 4; + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdHHCURVETO: + { + CF2_UInt count = cf2_stack_count( opStack ); + CF2_UInt index = 0; + + + FT_TRACE4(( " hhcurveto\n" )); + + while ( index < count ) + { + CF2_Fixed x1, y1, x2, y2, x3, y3; + + + if ( ( count - index ) & 1 ) + { + y1 = cf2_stack_getReal( opStack, index ) + curY; + + ++index; + } + else + y1 = curY; + + x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; + x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; + y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; + x3 = cf2_stack_getReal( opStack, index + 3 ) + x2; + y3 = y2; + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + index += 4; + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdVHCURVETO: + case cf2_cmdHVCURVETO: + { + CF2_UInt count = cf2_stack_count( opStack ); + CF2_UInt index = 0; + + FT_Bool alternate = op1 == cf2_cmdHVCURVETO; + + + FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" )); + + while ( index < count ) + { + CF2_Fixed x1, x2, x3, y1, y2, y3; + + + if ( alternate ) + { + x1 = cf2_stack_getReal( opStack, index + 0 ) + curX; + y1 = curY; + x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; + y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; + y3 = cf2_stack_getReal( opStack, index + 3 ) + y2; + + if ( count - index == 5 ) + { + x3 = cf2_stack_getReal( opStack, index + 4 ) + x2; + + ++index; + } + else + x3 = x2; + + alternate = FALSE; + } + else + { + x1 = curX; + y1 = cf2_stack_getReal( opStack, index + 0 ) + curY; + x2 = cf2_stack_getReal( opStack, index + 1 ) + x1; + y2 = cf2_stack_getReal( opStack, index + 2 ) + y1; + x3 = cf2_stack_getReal( opStack, index + 3 ) + x2; + + if ( count - index == 5 ) + { + y3 = cf2_stack_getReal( opStack, index + 4 ) + y2; + + ++index; + } + else + y3 = y2; + + alternate = TRUE; + } + + cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 ); + + curX = x3; + curY = y3; + index += 4; + } + + cf2_stack_clear( opStack ); + } + continue; /* no need to clear stack again */ + + case cf2_cmdEXTENDEDNMBR: + { + CF2_Int v; + + + v = (FT_Short)( ( cf2_buf_readByte( charstring ) << 8 ) | + cf2_buf_readByte( charstring ) ); + + FT_TRACE4(( " %d", v )); + + cf2_stack_pushInt( opStack, v ); + } + continue; + + default: + /* numbers */ + { + if ( /* op1 >= 32 && */ op1 <= 246 ) + { + CF2_Int v; + + + v = op1 - 139; + + FT_TRACE4(( " %d", v )); + + /* -107 .. 107 */ + cf2_stack_pushInt( opStack, v ); + } + + else if ( /* op1 >= 247 && */ op1 <= 250 ) + { + CF2_Int v; + + + v = op1; + v -= 247; + v *= 256; + v += cf2_buf_readByte( charstring ); + v += 108; + + FT_TRACE4(( " %d", v )); + + /* 108 .. 1131 */ + cf2_stack_pushInt( opStack, v ); + } + + else if ( /* op1 >= 251 && */ op1 <= 254 ) + { + CF2_Int v; + + + v = op1; + v -= 251; + v *= 256; + v += cf2_buf_readByte( charstring ); + v = -v - 108; + + FT_TRACE4(( " %d", v )); + + /* -1131 .. -108 */ + cf2_stack_pushInt( opStack, v ); + } + + else /* op1 == 255 */ + { + CF2_Fixed v; + + + v = (CF2_Fixed) + ( ( (FT_UInt32)cf2_buf_readByte( charstring ) << 24 ) | + ( (FT_UInt32)cf2_buf_readByte( charstring ) << 16 ) | + ( (FT_UInt32)cf2_buf_readByte( charstring ) << 8 ) | + (FT_UInt32)cf2_buf_readByte( charstring ) ); + + FT_TRACE4(( " %.2f", v / 65536.0 )); + + cf2_stack_pushFixed( opStack, v ); + } + } + continue; /* don't clear stack */ + + } /* end of switch statement checking `op1' */ + + cf2_stack_clear( opStack ); + + } /* end of main interpreter loop */ + + /* we get here if the charstring ends without cf2_cmdENDCHAR */ + FT_TRACE4(( "cf2_interpT2CharString:" + " charstring ends without ENDCHAR\n" )); + + exit: + /* check whether last error seen is also the first one */ + cf2_setError( error, lastError ); + + /* free resources from objects we've used */ + cf2_glyphpath_finalize( &glyphPath ); + cf2_arrstack_finalize( &vStemHintArray ); + cf2_arrstack_finalize( &hStemHintArray ); + cf2_arrstack_finalize( &subrStack ); + cf2_stack_free( opStack ); + + FT_TRACE4(( "\n" )); + + return; + } + + +/* END */ diff --git a/freetype/src/cff/cf2intrp.h b/freetype/src/cff/cf2intrp.h new file mode 100644 index 000000000..b5d894783 --- /dev/null +++ b/freetype/src/cff/cf2intrp.h @@ -0,0 +1,83 @@ +/***************************************************************************/ +/* */ +/* cf2font.h */ +/* */ +/* Adobe's CFF Interpreter (specification). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2INTRP_H__ +#define __CF2INTRP_H__ + + +#include "cf2ft.h" +#include "cf2hints.h" + + +FT_BEGIN_HEADER + + + FT_LOCAL( void ) + cf2_hintmask_init( CF2_HintMask hintmask, + FT_Error* error ); + FT_LOCAL( FT_Bool ) + cf2_hintmask_isValid( const CF2_HintMask hintmask ); + FT_LOCAL( FT_Bool ) + cf2_hintmask_isNew( const CF2_HintMask hintmask ); + FT_LOCAL( void ) + cf2_hintmask_setNew( CF2_HintMask hintmask, + FT_Bool val ); + FT_LOCAL( FT_Byte* ) + cf2_hintmask_getMaskPtr( CF2_HintMask hintmask ); + FT_LOCAL( void ) + cf2_hintmask_setAll( CF2_HintMask hintmask, + size_t bitCount ); + + FT_LOCAL( void ) + cf2_interpT2CharString( CF2_Font font, + CF2_Buffer charstring, + CF2_OutlineCallbacks callbacks, + const FT_Vector* translation, + FT_Bool doingSeac, + CF2_Fixed curX, + CF2_Fixed curY, + CF2_Fixed* width ); + + +FT_END_HEADER + + +#endif /* __CF2INTRP_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2read.c b/freetype/src/cff/cf2read.c new file mode 100644 index 000000000..2b429e3ee --- /dev/null +++ b/freetype/src/cff/cf2read.c @@ -0,0 +1,112 @@ +/***************************************************************************/ +/* */ +/* cf2read.c */ +/* */ +/* Adobe's code for stream handling (body). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" +#include FT_INTERNAL_DEBUG_H + +#include "cf2glue.h" + +#include "cf2error.h" + + + /* Define CF2_IO_FAIL as 1 to enable random errors and random */ + /* value errors in I/O. */ +#define CF2_IO_FAIL 0 + + +#if CF2_IO_FAIL + + /* set the .00 value to a nonzero probability */ + static int + randomError2( void ) + { + /* for region buffer ReadByte (interp) function */ + return (double)rand() / RAND_MAX < .00; + } + + /* set the .00 value to a nonzero probability */ + static CF2_Int + randomValue() + { + return (double)rand() / RAND_MAX < .00 ? rand() : 0; + } + +#endif /* CF2_IO_FAIL */ + + + /* Region Buffer */ + /* */ + /* Can be constructed from a copied buffer managed by */ + /* `FCM_getDatablock'. */ + /* Reads bytes with check for end of buffer. */ + + /* reading past the end of the buffer sets error and returns zero */ + FT_LOCAL_DEF( CF2_Int ) + cf2_buf_readByte( CF2_Buffer buf ) + { + if ( buf->ptr < buf->end ) + { +#if CF2_IO_FAIL + if ( randomError2() ) + { + CF2_SET_ERROR( buf->error, Invalid_Stream_Operation ); + return 0; + } + + return *(buf->ptr)++ + randomValue(); +#else + return *(buf->ptr)++; +#endif + } + else + { + CF2_SET_ERROR( buf->error, Invalid_Stream_Operation ); + return 0; + } + } + + + /* note: end condition can occur without error */ + FT_LOCAL_DEF( FT_Bool ) + cf2_buf_isEnd( CF2_Buffer buf ) + { + return (FT_Bool)( buf->ptr >= buf->end ); + } + + +/* END */ diff --git a/freetype/src/cff/cf2read.h b/freetype/src/cff/cf2read.h new file mode 100644 index 000000000..7ef7c8c14 --- /dev/null +++ b/freetype/src/cff/cf2read.h @@ -0,0 +1,68 @@ +/***************************************************************************/ +/* */ +/* cf2read.h */ +/* */ +/* Adobe's code for stream handling (specification). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2READ_H__ +#define __CF2READ_H__ + + +FT_BEGIN_HEADER + + + typedef struct CF2_BufferRec_ + { + FT_Error* error; + const FT_Byte* start; + const FT_Byte* end; + const FT_Byte* ptr; + + } CF2_BufferRec, *CF2_Buffer; + + + FT_LOCAL( CF2_Int ) + cf2_buf_readByte( CF2_Buffer buf ); + FT_LOCAL( FT_Bool ) + cf2_buf_isEnd( CF2_Buffer buf ); + + +FT_END_HEADER + + +#endif /* __CF2READ_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2stack.c b/freetype/src/cff/cf2stack.c new file mode 100644 index 000000000..8332b5d91 --- /dev/null +++ b/freetype/src/cff/cf2stack.c @@ -0,0 +1,205 @@ +/***************************************************************************/ +/* */ +/* cf2stack.c */ +/* */ +/* Adobe's code for emulating a CFF stack (body). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#include "cf2ft.h" +#include FT_INTERNAL_DEBUG_H + +#include "cf2glue.h" +#include "cf2font.h" +#include "cf2stack.h" + +#include "cf2error.h" + + + /* Allocate and initialize an instance of CF2_Stack. */ + /* Note: This function returns NULL on error (does not set */ + /* `error'). */ + FT_LOCAL_DEF( CF2_Stack ) + cf2_stack_init( FT_Memory memory, + FT_Error* e ) + { + FT_Error error = FT_Err_Ok; /* for FT_QNEW */ + + CF2_Stack stack = NULL; + + + if ( !FT_QNEW( stack ) ) + { + /* initialize the structure; FT_QNEW zeroes it */ + stack->memory = memory; + stack->error = e; + stack->top = &stack->buffer[0]; /* empty stack */ + } + + return stack; + } + + + FT_LOCAL_DEF( void ) + cf2_stack_free( CF2_Stack stack ) + { + if ( stack ) + { + FT_Memory memory = stack->memory; + + + /* free the main structure */ + FT_FREE( stack ); + } + } + + + FT_LOCAL_DEF( CF2_UInt ) + cf2_stack_count( CF2_Stack stack ) + { + return (CF2_UInt)( stack->top - &stack->buffer[0] ); + } + + + FT_LOCAL_DEF( void ) + cf2_stack_pushInt( CF2_Stack stack, + CF2_Int val ) + { + if ( stack->top == &stack->buffer[CF2_OPERAND_STACK_SIZE] ) + { + CF2_SET_ERROR( stack->error, Stack_Overflow ); + return; /* stack overflow */ + } + + stack->top->u.i = val; + stack->top->type = CF2_NumberInt; + ++stack->top; + } + + + FT_LOCAL_DEF( void ) + cf2_stack_pushFixed( CF2_Stack stack, + CF2_Fixed val ) + { + if ( stack->top == &stack->buffer[CF2_OPERAND_STACK_SIZE] ) + { + CF2_SET_ERROR( stack->error, Stack_Overflow ); + return; /* stack overflow */ + } + + stack->top->u.r = val; + stack->top->type = CF2_NumberFixed; + ++stack->top; + } + + + /* this function is only allowed to pop an integer type */ + FT_LOCAL_DEF( CF2_Int ) + cf2_stack_popInt( CF2_Stack stack ) + { + if ( stack->top == &stack->buffer[0] ) + { + CF2_SET_ERROR( stack->error, Stack_Underflow ); + return 0; /* underflow */ + } + if ( stack->top[-1].type != CF2_NumberInt ) + { + CF2_SET_ERROR( stack->error, Syntax_Error ); + return 0; /* type mismatch */ + } + + --stack->top; + + return stack->top->u.i; + } + + + /* Note: type mismatch is silently cast */ + /* TODO: check this */ + FT_LOCAL_DEF( CF2_Fixed ) + cf2_stack_popFixed( CF2_Stack stack ) + { + if ( stack->top == &stack->buffer[0] ) + { + CF2_SET_ERROR( stack->error, Stack_Underflow ); + return cf2_intToFixed( 0 ); /* underflow */ + } + + --stack->top; + + switch ( stack->top->type ) + { + case CF2_NumberInt: + return cf2_intToFixed( stack->top->u.i ); + case CF2_NumberFrac: + return cf2_fracToFixed( stack->top->u.f ); + default: + return stack->top->u.r; + } + } + + + /* Note: type mismatch is silently cast */ + /* TODO: check this */ + FT_LOCAL_DEF( CF2_Fixed ) + cf2_stack_getReal( CF2_Stack stack, + CF2_UInt idx ) + { + FT_ASSERT( cf2_stack_count( stack ) <= CF2_OPERAND_STACK_SIZE ); + + if ( idx >= cf2_stack_count( stack ) ) + { + CF2_SET_ERROR( stack->error, Stack_Overflow ); + return cf2_intToFixed( 0 ); /* bounds error */ + } + + switch ( stack->buffer[idx].type ) + { + case CF2_NumberInt: + return cf2_intToFixed( stack->buffer[idx].u.i ); + case CF2_NumberFrac: + return cf2_fracToFixed( stack->buffer[idx].u.f ); + default: + return stack->buffer[idx].u.r; + } + } + + + FT_LOCAL_DEF( void ) + cf2_stack_clear( CF2_Stack stack ) + { + stack->top = &stack->buffer[0]; + } + + +/* END */ diff --git a/freetype/src/cff/cf2stack.h b/freetype/src/cff/cf2stack.h new file mode 100644 index 000000000..7d6d1961f --- /dev/null +++ b/freetype/src/cff/cf2stack.h @@ -0,0 +1,106 @@ +/***************************************************************************/ +/* */ +/* cf2stack.h */ +/* */ +/* Adobe's code for emulating a CFF stack (specification). */ +/* */ +/* Copyright 2007-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2STACK_H__ +#define __CF2STACK_H__ + + +FT_BEGIN_HEADER + + + /* CFF operand stack; specified maximum of 48 or 192 values */ + typedef struct CF2_StackNumber_ + { + union + { + CF2_Fixed r; /* 16.16 fixed point */ + CF2_Frac f; /* 2.30 fixed point (for font matrix) */ + CF2_Int i; + } u; + + CF2_NumberType type; + + } CF2_StackNumber; + + + typedef struct CF2_StackRec_ + { + FT_Memory memory; + FT_Error* error; + CF2_StackNumber buffer[CF2_OPERAND_STACK_SIZE]; + CF2_StackNumber* top; + + } CF2_StackRec, *CF2_Stack; + + + FT_LOCAL( CF2_Stack ) + cf2_stack_init( FT_Memory memory, + FT_Error* error ); + FT_LOCAL( void ) + cf2_stack_free( CF2_Stack stack ); + + FT_LOCAL( CF2_UInt ) + cf2_stack_count( CF2_Stack stack ); + + FT_LOCAL( void ) + cf2_stack_pushInt( CF2_Stack stack, + CF2_Int val ); + FT_LOCAL( void ) + cf2_stack_pushFixed( CF2_Stack stack, + CF2_Fixed val ); + + FT_LOCAL( CF2_Int ) + cf2_stack_popInt( CF2_Stack stack ); + FT_LOCAL( CF2_Fixed ) + cf2_stack_popFixed( CF2_Stack stack ); + + FT_LOCAL( CF2_Fixed ) + cf2_stack_getReal( CF2_Stack stack, + CF2_UInt idx ); + + FT_LOCAL( void ) + cf2_stack_clear( CF2_Stack stack ); + + +FT_END_HEADER + + +#endif /* __CF2STACK_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cf2types.h b/freetype/src/cff/cf2types.h new file mode 100644 index 000000000..ac6a02266 --- /dev/null +++ b/freetype/src/cff/cf2types.h @@ -0,0 +1,78 @@ +/***************************************************************************/ +/* */ +/* cf2types.h */ +/* */ +/* Adobe's code for defining data types (specification only). */ +/* */ +/* Copyright 2011-2013 Adobe Systems Incorporated. */ +/* */ +/* This software, and all works of authorship, whether in source or */ +/* object code form as indicated by the copyright notice(s) included */ +/* herein (collectively, the "Work") is made available, and may only be */ +/* used, modified, and distributed under the FreeType Project License, */ +/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ +/* FreeType Project License, each contributor to the Work hereby grants */ +/* to any individual or legal entity exercising permissions granted by */ +/* the FreeType Project License and this section (hereafter, "You" or */ +/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ +/* royalty-free, irrevocable (except as stated in this section) patent */ +/* license to make, have made, use, offer to sell, sell, import, and */ +/* otherwise transfer the Work, where such license applies only to those */ +/* patent claims licensable by such contributor that are necessarily */ +/* infringed by their contribution(s) alone or by combination of their */ +/* contribution(s) with the Work to which such contribution(s) was */ +/* submitted. If You institute patent litigation against any entity */ +/* (including a cross-claim or counterclaim in a lawsuit) alleging that */ +/* the Work or a contribution incorporated within the Work constitutes */ +/* direct or contributory patent infringement, then any patent licenses */ +/* granted to You under this License for that Work shall terminate as of */ +/* the date such litigation is filed. */ +/* */ +/* By using, modifying, or distributing the Work you indicate that you */ +/* have read and understood the terms and conditions of the */ +/* FreeType Project License as well as those provided in this section, */ +/* and you accept them fully. */ +/* */ +/***************************************************************************/ + + +#ifndef __CF2TYPES_H__ +#define __CF2TYPES_H__ + +#include <ft2build.h> +#include FT_FREETYPE_H + + +FT_BEGIN_HEADER + + + /* + * The data models that we expect to support are as follows: + * + * name char short int long long-long pointer example + * ----------------------------------------------------- + * ILP32 8 16 32 32 64* 32 32-bit MacOS, x86 + * LLP64 8 16 32 32 64 64 x64 + * LP64 8 16 32 64 64 64 64-bit MacOS + * + * *) type may be supported by emulation on a 32-bit architecture + * + */ + + + /* integers at least 32 bits wide */ +#define CF2_UInt FT_UFast +#define CF2_Int FT_Fast + + + /* fixed-float numbers */ + typedef FT_Int32 CF2_F16Dot16; + + +FT_END_HEADER + + +#endif /* __CF2TYPES_H__ */ + + +/* END */ diff --git a/freetype/src/cff/cff.c b/freetype/src/cff/cff.c index fccfd442f..c3840b583 100644 --- a/freetype/src/cff/cff.c +++ b/freetype/src/cff/cff.c @@ -4,7 +4,7 @@ /* */ /* FreeType OpenType driver component (body only). */ /* */ -/* Copyright 1996-2001, 2002 by */ +/* Copyright 1996-2001, 2002, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,6 +19,7 @@ #define FT_MAKE_OPTION_SINGLE_OBJECT #include <ft2build.h> + #include "cffpic.c" #include "cffdrivr.c" #include "cffparse.c" @@ -27,4 +28,14 @@ #include "cffgload.c" #include "cffcmap.c" +#include "cf2arrst.c" +#include "cf2blues.c" +#include "cf2error.c" +#include "cf2font.c" +#include "cf2ft.c" +#include "cf2hints.c" +#include "cf2intrp.c" +#include "cf2read.c" +#include "cf2stack.c" + /* END */ diff --git a/freetype/src/cff/cffcmap.c b/freetype/src/cff/cffcmap.c index 129837110..f6e03c642 100644 --- a/freetype/src/cff/cffcmap.c +++ b/freetype/src/cff/cffcmap.c @@ -4,7 +4,7 @@ /* */ /* CFF character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2010 by */ +/* Copyright 2002-2007, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,6 +16,8 @@ /***************************************************************************/ +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H #include "cffcmap.h" #include "cffload.h" @@ -145,7 +147,7 @@ /* can't build Unicode map for CID-keyed font */ /* because we don't know glyph names. */ if ( !charset->sids ) - return CFF_Err_No_Unicode_Glyph_Name; + return FT_THROW( No_Unicode_Glyph_Name ); return psnames->unicodes_init( memory, unicodes, diff --git a/freetype/src/cff/cffdrivr.c b/freetype/src/cff/cffdrivr.c index b5fda95d7..c8ca96ba4 100644 --- a/freetype/src/cff/cffdrivr.c +++ b/freetype/src/cff/cffdrivr.c @@ -4,7 +4,7 @@ /* */ /* OpenType font driver implementation (body). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -37,6 +37,8 @@ #include FT_SERVICE_XFREE86_NAME_H #include FT_SERVICE_GLYPH_DICT_H +#include FT_SERVICE_PROPERTIES_H +#include FT_CFF_DRIVER_H /*************************************************************************/ @@ -115,7 +117,7 @@ if ( sfnt ) kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); - return CFF_Err_Ok; + return FT_Err_Ok; } @@ -160,7 +162,7 @@ if ( !slot ) - return CFF_Err_Invalid_Slot_Handle; + return FT_THROW( Invalid_Slot_Handle ); /* check whether we want a scaled outline or bitmap */ if ( !size ) @@ -174,7 +176,7 @@ { /* these two objects must have the same parent */ if ( cffsize->face != cffslot->face ) - return CFF_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); } /* now load the glyph outline if necessary */ @@ -195,7 +197,7 @@ FT_Fixed* advances ) { FT_UInt nn; - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_GlyphSlot slot = face->glyph; @@ -239,7 +241,7 @@ " cannot get glyph name from CFF & CEF fonts\n" " " " without the `PSNames' module\n" )); - error = CFF_Err_Missing_Module; + error = FT_THROW( Missing_Module ); goto Exit; } @@ -252,7 +254,7 @@ if ( gname ) FT_STRCPYN( buffer, gname, buffer_max ); - error = CFF_Err_Ok; + error = FT_Err_Ok; Exit: return error; @@ -298,7 +300,8 @@ } - FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict, + FT_DEFINE_SERVICE_GLYPHDICTREC( + cff_service_glyph_dict, (FT_GlyphDict_GetNameFunc) cff_get_glyph_name, (FT_GlyphDict_NameIndexFunc)cff_get_name_index ) @@ -321,7 +324,7 @@ PS_FontInfoRec* afont_info ) { CFF_Font cff = (CFF_Font)face->extra.data; - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; if ( cff && cff->font_info == NULL ) @@ -360,7 +363,8 @@ } - FT_DEFINE_SERVICE_PSINFOREC(cff_service_ps_info, + FT_DEFINE_SERVICE_PSINFOREC( + cff_service_ps_info, (PS_GetFontInfoFunc) cff_ps_get_font_info, (PS_GetFontExtraFunc) NULL, (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, @@ -384,7 +388,8 @@ } - FT_DEFINE_SERVICE_PSFONTNAMEREC(cff_service_ps_name, + FT_DEFINE_SERVICE_PSFONTNAMEREC( + cff_service_ps_name, (FT_PsName_GetFunc)cff_get_ps_name ) @@ -404,9 +409,10 @@ TT_CMapInfo *cmap_info ) { FT_CMap cmap = FT_CMAP( charmap ); - FT_Error error = CFF_Err_Ok; - FT_Face face = FT_CMAP_FACE( cmap ); - FT_Library library = FT_FACE_LIBRARY( face ); + FT_Error error = FT_Err_Ok; + + FT_Face face = FT_CMAP_FACE( cmap ); + FT_Library library = FT_FACE_LIBRARY( face ); cmap_info->language = 0; @@ -429,7 +435,8 @@ } - FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info, + FT_DEFINE_SERVICE_TTCMAPSREC( + cff_service_get_cmap_info, (TT_CMap_Info_GetFunc)cff_get_cmap_info ) @@ -444,7 +451,7 @@ const char* *ordering, FT_Int *supplement ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; CFF_Font cff = (CFF_Font)face->extra.data; @@ -455,7 +462,7 @@ if ( dict->cid_registry == 0xFFFFU ) { - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Fail; } @@ -499,7 +506,7 @@ cff_get_is_cid( CFF_Face face, FT_Bool *is_cid ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; CFF_Font cff = (CFF_Font)face->extra.data; @@ -523,7 +530,7 @@ FT_UInt glyph_index, FT_UInt *cid ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; CFF_Font cff; @@ -537,13 +544,13 @@ if ( dict->cid_registry == 0xFFFFU ) { - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Fail; } if ( glyph_index > cff->num_glyphs ) { - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Fail; } @@ -558,13 +565,100 @@ } - FT_DEFINE_SERVICE_CIDREC(cff_service_cid_info, + FT_DEFINE_SERVICE_CIDREC( + cff_service_cid_info, (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros, (FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid, (FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index ) + /* + * PROPERTY SERVICE + * + */ + static FT_Error + cff_property_set( FT_Module module, /* CFF_Driver */ + const char* property_name, + const void* value ) + { + FT_Error error = FT_Err_Ok; + CFF_Driver driver = (CFF_Driver)module; + + + if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { + FT_UInt* hinting_engine = (FT_UInt*)value; + + +#ifndef CFF_CONFIG_OPTION_OLD_ENGINE + if ( *hinting_engine != FT_CFF_HINTING_ADOBE ) + error = FT_ERR( Unimplemented_Feature ); + else +#endif + driver->hinting_engine = *hinting_engine; + + return error; + } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { + FT_Bool* no_stem_darkening = (FT_Bool*)value; + + + driver->no_stem_darkening = *no_stem_darkening; + + return error; + } + + FT_TRACE0(( "cff_property_set: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + static FT_Error + cff_property_get( FT_Module module, /* CFF_Driver */ + const char* property_name, + const void* value ) + { + FT_Error error = FT_Err_Ok; + CFF_Driver driver = (CFF_Driver)module; + + FT_UInt hinting_engine = driver->hinting_engine; + FT_Bool no_stem_darkening = driver->no_stem_darkening; + + + if ( !ft_strcmp( property_name, "hinting-engine" ) ) + { + FT_UInt* val = (FT_UInt*)value; + + + *val = hinting_engine; + + return error; + } + else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) + { + FT_Bool* val = (FT_Bool*)value; + + + *val = no_stem_darkening; + + return error; + } + + FT_TRACE0(( "cff_property_get: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + FT_DEFINE_SERVICE_PROPERTIESREC( + cff_service_properties, + (FT_Properties_SetFunc)cff_property_set, + (FT_Properties_GetFunc)cff_property_get ) + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -576,25 +670,31 @@ /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ + #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES - FT_DEFINE_SERVICEDESCREC6(cff_services, + FT_DEFINE_SERVICEDESCREC7( + cff_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF, FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET + FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET ) #else - FT_DEFINE_SERVICEDESCREC5(cff_services, + FT_DEFINE_SERVICEDESCREC6( + cff_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF, FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET, FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET, FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET + FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET, + FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET ) #endif + FT_CALLBACK_DEF( FT_Module_Interface ) cff_get_interface( FT_Module driver, /* CFF_Driver */ const char* module_interface ) @@ -641,7 +741,8 @@ #define CFF_SIZE_SELECT 0 #endif - FT_DEFINE_DRIVER( cff_driver_class, + FT_DEFINE_DRIVER( + cff_driver_class, FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | @@ -670,9 +771,6 @@ cff_slot_init, cff_slot_done, - ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - cff_glyph_load, cff_get_kerning, diff --git a/freetype/src/cff/cffgload.c b/freetype/src/cff/cffgload.c index 84847fda5..6a8494fa9 100644 --- a/freetype/src/cff/cffgload.c +++ b/freetype/src/cff/cffgload.c @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,10 +21,12 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include FT_OUTLINE_H +#include FT_CFF_DRIVER_H #include "cffobjs.h" #include "cffload.h" #include "cffgload.h" +#include "cf2ft.h" /* for cf2_decoder_parse_charstrings */ #include "cfferrs.h" @@ -39,6 +41,8 @@ #define FT_COMPONENT trace_cffgload +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + typedef enum CFF_Operator_ { cff_op_unknown = 0, @@ -209,6 +213,8 @@ 2 /* setcurrentpoint */ }; +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + /*************************************************************************/ /*************************************************************************/ @@ -412,7 +418,7 @@ CFF_Builder *builder = &decoder->builder; CFF_Font cff = (CFF_Font)builder->face->extra.data; CFF_SubFont sub = &cff->top_font; - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; /* manage CID fonts */ @@ -424,7 +430,7 @@ if ( fd_index >= cff->num_subfonts ) { FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -455,22 +461,24 @@ decoder->glyph_width = sub->private_dict.default_width; decoder->nominal_width = sub->private_dict.nominal_width; + decoder->current_subfont = sub; /* for Adobe's CFF handler */ + Exit: return error; } /* check that there is enough space for `count' more points */ - static FT_Error - check_points( CFF_Builder* builder, - FT_Int count ) + FT_LOCAL_DEF( FT_Error ) + cff_check_points( CFF_Builder* builder, + FT_Int count ) { return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); } /* add a new point, do not check space */ - static void + FT_LOCAL_DEF( void ) cff_builder_add_point( CFF_Builder* builder, FT_Pos x, FT_Pos y, @@ -484,9 +492,22 @@ FT_Vector* point = outline->points + outline->n_points; FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face ); + - point->x = x >> 16; - point->y = y >> 16; + if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) + { + point->x = x >> 16; + point->y = y >> 16; + } + else +#endif + { + /* cf2_decoder_parse_charstrings uses 16.16 coordinates */ + point->x = x >> 10; + point->y = y >> 10; + } *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); } @@ -495,7 +516,7 @@ /* check space for a new on-curve point, then add it */ - static FT_Error + FT_LOCAL_DEF( FT_Error ) cff_builder_add_point1( CFF_Builder* builder, FT_Pos x, FT_Pos y ) @@ -503,7 +524,7 @@ FT_Error error; - error = check_points( builder, 1 ); + error = cff_check_points( builder, 1 ); if ( !error ) cff_builder_add_point( builder, x, y, 1 ); @@ -522,7 +543,7 @@ if ( !builder->load_points ) { outline->n_contours++; - return CFF_Err_Ok; + return FT_Err_Ok; } error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); @@ -540,12 +561,12 @@ /* if a path was begun, add its first on-curve point */ - static FT_Error + FT_LOCAL_DEF( FT_Error ) cff_builder_start_point( CFF_Builder* builder, FT_Pos x, FT_Pos y ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; /* test whether we are building a new contour */ @@ -562,7 +583,7 @@ /* close the current contour */ - static void + FT_LOCAL_DEF( void ) cff_builder_close_contour( CFF_Builder* builder ) { FT_Outline* outline = builder->current; @@ -607,7 +628,7 @@ } - static FT_Int + FT_LOCAL_DEF( FT_Int ) cff_lookup_glyph_by_stdcharcode( CFF_Font cff, FT_Int charcode ) { @@ -636,7 +657,7 @@ } - static FT_Error + FT_LOCAL_DEF( FT_Error ) cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, FT_Byte** pointer, @@ -672,7 +693,7 @@ } - static void + FT_LOCAL_DEF( void ) cff_free_glyph_data( TT_Face face, FT_Byte** pointer, FT_ULong length ) @@ -707,6 +728,8 @@ } +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + static FT_Error cff_operator_seac( CFF_Decoder* decoder, FT_Pos asb, @@ -728,7 +751,7 @@ if ( decoder->seac ) { FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); - return CFF_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } adx += decoder->builder.left_bearing.x; @@ -756,7 +779,7 @@ { FT_ERROR(( "cff_operator_seac:" " invalid seac character code arguments\n" )); - return CFF_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } /* If we are trying to load a composite glyph, do not load the */ @@ -925,7 +948,7 @@ limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; - error = CFF_Err_Ok; + error = FT_Err_Ok; x = builder->pos_x; y = builder->pos_y; @@ -953,11 +976,14 @@ /* this is an operand, push it on the stack */ + + /* if we use shifts, all computations are done with unsigned */ + /* values; the conversion to a signed value is the last step */ if ( v == 28 ) { if ( ip + 1 >= limit ) goto Syntax_Error; - val = (FT_Short)( ( (FT_Short)ip[0] << 8 ) | ip[1] ); + val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] ); ip += 2; } else if ( v < 247 ) @@ -978,10 +1004,10 @@ { if ( ip + 3 >= limit ) goto Syntax_Error; - val = ( (FT_Int32)ip[0] << 24 ) | - ( (FT_Int32)ip[1] << 16 ) | - ( (FT_Int32)ip[2] << 8 ) | - ip[3]; + val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); ip += 4; if ( charstring_type == 2 ) shift = 0; @@ -989,12 +1015,12 @@ if ( decoder->top - stack >= CFF_MAX_OPERANDS ) goto Stack_Overflow; - val <<= shift; + val = (FT_Int32)( (FT_UInt32)val << shift ); *decoder->top++ = val; #ifdef FT_DEBUG_LEVEL_TRACE if ( !( val & 0xFFFFL ) ) - FT_TRACE4(( " %ld", (FT_Int32)( val >> 16 ) )); + FT_TRACE4(( " %hd", (FT_Short)( (FT_UInt32)val >> 16 ) )); else FT_TRACE4(( " %.2f", val / 65536.0 )); #endif @@ -1411,8 +1437,8 @@ case cff_op_rlineto: FT_TRACE4(( " rlineto\n" )); - if ( cff_builder_start_point ( builder, x, y ) || - check_points( builder, num_args / 2 ) ) + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_args / 2 ) ) goto Fail; if ( num_args < 2 ) @@ -1446,8 +1472,8 @@ if ( num_args == 0 ) break; - if ( cff_builder_start_point ( builder, x, y ) || - check_points( builder, num_args ) ) + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_args ) ) goto Fail; args = stack; @@ -1480,8 +1506,8 @@ nargs = num_args - num_args % 6; - if ( cff_builder_start_point ( builder, x, y ) || - check_points( builder, nargs / 2 ) ) + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, nargs / 2 ) ) goto Fail; args -= nargs; @@ -1529,7 +1555,7 @@ nargs--; } - if ( check_points( builder, 3 * ( nargs / 4 ) ) ) + if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) goto Fail; while ( args < decoder->top ) @@ -1573,7 +1599,7 @@ nargs--; } - if ( check_points( builder, 3 * ( nargs / 4 ) ) ) + if ( cff_check_points( builder, 3 * ( nargs / 4 ) ) ) goto Fail; while ( args < decoder->top ) @@ -1613,7 +1639,7 @@ nargs = num_args & ~2; args -= nargs; - if ( check_points( builder, ( nargs / 4 ) * 3 ) ) + if ( cff_check_points( builder, ( nargs / 4 ) * 3 ) ) goto Stack_Underflow; phase = ( op == cff_op_hvcurveto ); @@ -1666,8 +1692,8 @@ nargs = num_args & ~1; num_lines = ( nargs - 6 ) / 2; - if ( cff_builder_start_point( builder, x, y ) || - check_points( builder, num_lines + 3 ) ) + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_lines + 3 ) ) goto Fail; args -= nargs; @@ -1711,8 +1737,8 @@ nargs = nargs - nargs % 6 + 2; num_curves = ( nargs - 2 ) / 6; - if ( cff_builder_start_point ( builder, x, y ) || - check_points( builder, num_curves * 3 + 2 ) ) + if ( cff_builder_start_point( builder, x, y ) || + cff_check_points( builder, num_curves * 3 + 2 ) ) goto Fail; args -= nargs; @@ -1752,7 +1778,7 @@ /* -- make sure we have enough space for the start point if it */ /* needs to be added */ if ( cff_builder_start_point( builder, x, y ) || - check_points( builder, 6 ) ) + cff_check_points( builder, 6 ) ) goto Fail; /* record the starting point's y position for later use */ @@ -1801,7 +1827,7 @@ /* adding six more points; 4 control points, 2 on-curve points */ if ( cff_builder_start_point( builder, x, y ) || - check_points( builder, 6 ) ) + cff_check_points( builder, 6 ) ) goto Fail; /* record the starting point's y-position for later use */ @@ -1854,7 +1880,7 @@ /* adding six more points; 4 control points, 2 on-curve points */ if ( cff_builder_start_point( builder, x, y ) || - check_points( builder, 6 ) ) + cff_check_points( builder, 6 ) ) goto Fail; /* record the starting point's x, y position for later use */ @@ -1917,7 +1943,7 @@ FT_TRACE4(( " flex\n" )); if ( cff_builder_start_point( builder, x, y ) || - check_points( builder, 6 ) ) + cff_check_points( builder, 6 ) ) goto Fail; for ( count = 6; count > 0; count-- ) @@ -1968,7 +1994,7 @@ else { if ( !error ) - error = CFF_Err_Ok; + error = FT_Err_Ok; cff_builder_close_contour( builder ); @@ -2470,7 +2496,7 @@ FT_ERROR(( " %d", ip[0] )); FT_ERROR(( "\n" )); - return CFF_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } decoder->top = args; @@ -2489,17 +2515,19 @@ Syntax_Error: FT_TRACE4(( "cff_decoder_parse_charstrings: syntax error\n" )); - return CFF_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); Stack_Underflow: FT_TRACE4(( "cff_decoder_parse_charstrings: stack underflow\n" )); - return CFF_Err_Too_Few_Arguments; + return FT_THROW( Too_Few_Arguments ); Stack_Overflow: FT_TRACE4(( "cff_decoder_parse_charstrings: stack overflow\n" )); - return CFF_Err_Stack_Overflow; + return FT_THROW( Stack_Overflow ); } +#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ + /*************************************************************************/ /*************************************************************************/ @@ -2526,7 +2554,7 @@ cff_compute_max_advance( TT_Face face, FT_Int* max_advance ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; CFF_Decoder decoder; FT_Int glyph_index; CFF_Font cff = (CFF_Font)face->other; @@ -2564,12 +2592,12 @@ } /* ignore the error if one has occurred -- skip to next glyph */ - error = CFF_Err_Ok; + error = FT_Err_Ok; } *max_advance = decoder.builder.advance.x; - return CFF_Err_Ok; + return FT_Err_Ok; } @@ -2585,7 +2613,7 @@ FT_Error error; CFF_Decoder decoder; TT_Face face = (TT_Face)glyph->root.face; - FT_Bool hinting, force_scaling; + FT_Bool hinting, scaled, force_scaling; CFF_Font cff = (CFF_Font)face->extra.data; FT_Matrix font_matrix; @@ -2606,11 +2634,11 @@ glyph_index = cff_charset_cid_to_gindex( &cff->charset, glyph_index ); if ( glyph_index == 0 ) - return CFF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } } else if ( glyph_index >= cff->num_glyphs ) - return CFF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( load_flags & FT_LOAD_NO_RECURSE ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; @@ -2653,6 +2681,11 @@ if ( !error ) { + FT_Bool has_vertical_info; + FT_UShort advance; + FT_Short dummy; + + glyph->root.outline.n_points = 0; glyph->root.outline.n_contours = 0; @@ -2679,6 +2712,39 @@ glyph->root.bitmap_left = metrics.horiBearingX; glyph->root.bitmap_top = metrics.horiBearingY; } + + /* compute linear advance widths */ + + ( (SFNT_Service)face->sfnt )->get_metrics( face, 0, + glyph_index, + &dummy, + &advance ); + glyph->root.linearHoriAdvance = advance; + + has_vertical_info = FT_BOOL( + face->vertical_info && + face->vertical.number_Of_VMetrics > 0 ); + + /* get the vertical metrics from the vtmx table if we have one */ + if ( has_vertical_info ) + { + ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, + glyph_index, + &dummy, + &advance ); + glyph->root.linearVertAdvance = advance; + } + else + { + /* make up vertical ones */ + if ( face->os2.version != 0xFFFFU ) + glyph->root.linearVertAdvance = (FT_Pos) + ( face->os2.sTypoAscender - face->os2.sTypoDescender ); + else + glyph->root.linearVertAdvance = (FT_Pos) + ( face->horizontal.Ascender - face->horizontal.Descender ); + } + return error; } } @@ -2688,7 +2754,7 @@ /* return immediately if we only want the embedded bitmaps */ if ( load_flags & FT_LOAD_SBITS_ONLY ) - return CFF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* if we have a CID subfont, use its matrix (which has already */ /* been multiplied with the root matrix) */ @@ -2700,6 +2766,7 @@ FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); + if ( fd_index >= cff->num_subfonts ) fd_index = (FT_Byte)( cff->num_subfonts - 1 ); @@ -2727,12 +2794,21 @@ glyph->root.outline.n_points = 0; glyph->root.outline.n_contours = 0; - hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && - ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); + /* top-level code ensures that FT_LOAD_NO_HINTING is set */ + /* if FT_LOAD_NO_SCALE is active */ + hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); + scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ); + glyph->hint = hinting; + glyph->scaled = scaled; glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; /* by default */ { +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face ); +#endif + + FT_Byte* charstring; FT_ULong charstring_len; @@ -2756,9 +2832,35 @@ if ( error ) goto Glyph_Build_Finished; - error = cff_decoder_parse_charstrings( &decoder, - charstring, - charstring_len ); +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + /* choose which CFF renderer to use */ + if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE ) + error = cff_decoder_parse_charstrings( &decoder, + charstring, + charstring_len ); + else +#endif + { + error = cf2_decoder_parse_charstrings( &decoder, + charstring, + charstring_len ); + + /* Adobe's engine uses 16.16 numbers everywhere; */ + /* as a consequence, glyphs larger than 2000ppem get rejected */ + if ( FT_ERR_EQ( error, Glyph_Too_Big ) ) + { + /* this time, we retry unhinted and scale up the glyph later on */ + /* (the engine uses and sets the hardcoded value 0x10000 / 64 = */ + /* 0x400 for both `x_scale' and `y_scale' in this case) */ + hinting = FALSE; + force_scaling = TRUE; + glyph->hint = hinting; + + error = cf2_decoder_parse_charstrings( &decoder, + charstring, + charstring_len ); + } + } cff_free_glyph_data( face, &charstring, charstring_len ); @@ -2856,14 +2958,8 @@ glyph->root.linearHoriAdvance = decoder.glyph_width; glyph->root.internal->glyph_transformed = 0; -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - has_vertical_info = FT_BOOL( face->vertical_info && - face->vertical.number_Of_VMetrics > 0 && - face->vertical.long_metrics ); -#else has_vertical_info = FT_BOOL( face->vertical_info && face->vertical.number_Of_VMetrics > 0 ); -#endif /* get the vertical metrics from the vtmx table if we have one */ if ( has_vertical_info ) diff --git a/freetype/src/cff/cffgload.h b/freetype/src/cff/cffgload.h index 38937be5c..41df7db69 100644 --- a/freetype/src/cff/cffgload.h +++ b/freetype/src/cff/cffgload.h @@ -4,7 +4,7 @@ /* */ /* OpenType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */ +/* Copyright 1996-2004, 2006-2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -106,6 +106,41 @@ FT_BEGIN_HEADER } CFF_Builder; + FT_LOCAL( FT_Error ) + cff_check_points( CFF_Builder* builder, + FT_Int count ); + + FT_LOCAL( void ) + cff_builder_add_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y, + FT_Byte flag ); + FT_LOCAL( FT_Error ) + cff_builder_add_point1( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + FT_LOCAL( FT_Error ) + cff_builder_start_point( CFF_Builder* builder, + FT_Pos x, + FT_Pos y ); + FT_LOCAL( void ) + cff_builder_close_contour( CFF_Builder* builder ); + + + FT_LOCAL( FT_Int ) + cff_lookup_glyph_by_stdcharcode( CFF_Font cff, + FT_Int charcode ); + FT_LOCAL( FT_Error ) + cff_get_glyph_data( TT_Face face, + FT_UInt glyph_index, + FT_Byte** pointer, + FT_ULong* length ); + FT_LOCAL( void ) + cff_free_glyph_data( TT_Face face, + FT_Byte** pointer, + FT_ULong length ); + + /* execution context charstring zone */ typedef struct CFF_Decoder_Zone_ @@ -156,6 +191,8 @@ FT_BEGIN_HEADER FT_Bool seac; + CFF_SubFont current_subfont; /* for current glyph_index */ + } CFF_Decoder; @@ -181,10 +218,12 @@ FT_BEGIN_HEADER #endif /* 0 */ +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE FT_LOCAL( FT_Error ) cff_decoder_parse_charstrings( CFF_Decoder* decoder, FT_Byte* charstring_base, FT_ULong charstring_len ); +#endif FT_LOCAL( FT_Error ) cff_slot_load( CFF_GlyphSlot glyph, diff --git a/freetype/src/cff/cffload.c b/freetype/src/cff/cffload.c index d5433c80b..64b497168 100644 --- a/freetype/src/cff/cffload.c +++ b/freetype/src/cff/cffload.c @@ -4,7 +4,7 @@ /* */ /* OpenType and CFF data/program tables loader (body). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -250,7 +250,7 @@ if ( offsize < 1 || offsize > 4 ) { - error = CFF_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -269,7 +269,7 @@ if ( size == 0 ) { - error = CFF_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -318,7 +318,7 @@ static FT_Error cff_index_load_offsets( CFF_Index idx ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Stream stream = idx->stream; FT_Memory memory = stream->memory; @@ -384,9 +384,10 @@ FT_Byte*** table, FT_Byte** pool ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = idx->stream->memory; - FT_Byte** t = NULL; + + FT_Byte** t = NULL; FT_Byte* new_bytes = NULL; @@ -471,7 +472,7 @@ FT_Byte** pbytes, FT_ULong* pbyte_len ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; if ( idx && idx->count > element ) @@ -556,7 +557,7 @@ } } else - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); Exit: return error; @@ -696,7 +697,7 @@ break; default: /* hmm... that's wrong */ - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); } Exit: @@ -780,7 +781,7 @@ FT_UInt num_glyphs, FT_Memory memory ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UInt i; FT_Long j; FT_UShort max_cid = 0; @@ -859,7 +860,7 @@ FT_Bool invert ) { FT_Memory memory = stream->memory; - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UShort glyph_sid; @@ -943,7 +944,7 @@ default: FT_ERROR(( "cff_charset_load: invalid table format\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } } @@ -966,7 +967,7 @@ { FT_ERROR(( "cff_charset_load: implicit charset larger than\n" "predefined charset (Adobe ISO-Latin)\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -984,7 +985,7 @@ { FT_ERROR(( "cff_charset_load: implicit charset larger than\n" "predefined charset (Adobe Expert)\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1002,7 +1003,7 @@ { FT_ERROR(( "cff_charset_load: implicit charset larger than\n" "predefined charset (Adobe Expert Subset)\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1016,7 +1017,7 @@ break; default: - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } } @@ -1057,7 +1058,7 @@ FT_ULong base_offset, FT_ULong offset ) { - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UInt count; FT_UInt j; FT_UShort glyph_sid; @@ -1067,7 +1068,7 @@ /* Check for charset->sids. If we do not have this, we fail. */ if ( !charset->sids ) { - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1187,7 +1188,7 @@ default: FT_ERROR(( "cff_encoding_load: invalid table format\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1280,7 +1281,7 @@ default: FT_ERROR(( "cff_encoding_load: invalid table format\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } } @@ -1313,7 +1314,7 @@ /* set defaults */ FT_MEM_ZERO( top, sizeof ( *top ) ); - top->underline_position = -100L << 16; + top->underline_position = -( 100L << 16 ); top->underline_thickness = 50L << 16; top->charstring_type = 2; top->font_matrix.xx = 0x10000L; @@ -1460,7 +1461,7 @@ font->absolute_offsize > 4 ) { FT_TRACE2(( " not a CFF font header\n" )); - error = CFF_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -1494,7 +1495,7 @@ FT_ERROR(( "cff_font_load:" " invalid subfont index for pure CFF font (%d)\n", subfont_index )); - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1510,7 +1511,7 @@ " invalid CFF font with multiple subfonts\n" " " " in SFNT wrapper\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } } @@ -1599,7 +1600,7 @@ if ( dict->charstrings_offset == 0 ) { FT_ERROR(( "cff_font_load: no charstrings offset\n" )); - error = CFF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1683,6 +1684,12 @@ FT_FREE( font->global_subrs ); FT_FREE( font->strings ); FT_FREE( font->string_pool ); + + if ( font->cf2_instance.finalizer ) + { + font->cf2_instance.finalizer( font->cf2_instance.data ); + FT_FREE( font->cf2_instance.data ); + } } diff --git a/freetype/src/cff/cffobjs.c b/freetype/src/cff/cffobjs.c index b4dddb747..dd750d104 100644 --- a/freetype/src/cff/cffobjs.c +++ b/freetype/src/cff/cffobjs.c @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (body). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,7 @@ #include <ft2build.h> + #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H #include FT_INTERNAL_STREAM_H @@ -24,12 +25,15 @@ #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H +#include FT_CFF_DRIVER_H + #include "cffobjs.h" #include "cffload.h" #include "cffcmap.h" -#include "cfferrs.h" #include "cffpic.h" +#include "cfferrs.h" + /*************************************************************************/ /* */ @@ -153,7 +157,7 @@ cff_size_init( FT_Size cffsize ) /* CFF_Size */ { CFF_Size size = (CFF_Size)cffsize; - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size ); @@ -253,7 +257,7 @@ } } - return CFF_Err_Ok; + return FT_Err_Ok; } #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ @@ -325,7 +329,7 @@ } } - return CFF_Err_Ok; + return FT_Err_Ok; } @@ -367,7 +371,7 @@ } } - return CFF_Err_Ok; + return FT_Err_Ok; } @@ -401,7 +405,7 @@ remove_subset_prefix( FT_String* name ) { FT_Int32 idx = 0; - FT_Int32 length = strlen( name ) + 1; + FT_Int32 length = (FT_Int32)strlen( name ) + 1; FT_Bool continue_search = 1; @@ -438,8 +442,8 @@ FT_Int32 family_name_length, style_name_length; - family_name_length = strlen( family_name ); - style_name_length = strlen( style_name ); + family_name_length = (FT_Int32)strlen( family_name ); + style_name_length = (FT_Int32)strlen( style_name ); if ( family_name_length > style_name_length ) { @@ -496,7 +500,7 @@ if ( !sfnt ) { FT_ERROR(( "cff_face_init: cannot access `sfnt' module\n" )); - error = CFF_Err_Missing_Module; + error = FT_THROW( Missing_Module ); goto Exit; } @@ -518,13 +522,13 @@ if ( face->format_tag != TTAG_OTTO ) /* `OTTO'; OpenType/CFF font */ { FT_TRACE2(( " not an OpenType/CFF font\n" )); - error = CFF_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } /* if we are performing a simple font format check, exit immediately */ if ( face_index < 0 ) - return CFF_Err_Ok; + return FT_Err_Ok; sfnt_format = 1; @@ -559,7 +563,7 @@ /* 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; + error = FT_Err_Ok; } /* now load and parse the CFF table in the file */ @@ -600,7 +604,7 @@ " cannot open CFF & CEF fonts\n" " " " without the `PSNames' module\n" )); - error = CFF_Err_Missing_Module; + error = FT_THROW( Missing_Module ); goto Exit; } @@ -959,7 +963,8 @@ error = FT_CMap_New( &CFF_CMAP_UNICODE_CLASS_REC_GET, NULL, &cmaprec, NULL ); - if ( error && FT_Err_No_Unicode_Glyph_Name != error ) + if ( error && + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) goto Exit; error = FT_Err_Ok; @@ -1045,16 +1050,25 @@ FT_LOCAL_DEF( FT_Error ) - cff_driver_init( FT_Module module ) + cff_driver_init( FT_Module module ) /* CFF_Driver */ { - FT_UNUSED( module ); + CFF_Driver driver = (CFF_Driver)module; + + + /* set default property values */ +#ifdef CFF_CONFIG_OPTION_OLD_ENGINE + driver->hinting_engine = FT_CFF_HINTING_FREETYPE; +#else + driver->hinting_engine = FT_CFF_HINTING_ADOBE; +#endif + driver->no_stem_darkening = FALSE; - return CFF_Err_Ok; + return FT_Err_Ok; } FT_LOCAL_DEF( void ) - cff_driver_done( FT_Module module ) + cff_driver_done( FT_Module module ) /* CFF_Driver */ { FT_UNUSED( module ); } diff --git a/freetype/src/cff/cffobjs.h b/freetype/src/cff/cffobjs.h index 3c81cee00..b375c20c7 100644 --- a/freetype/src/cff/cffobjs.h +++ b/freetype/src/cff/cffobjs.h @@ -4,7 +4,7 @@ /* */ /* OpenType objects manager (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */ +/* Copyright 1996-2004, 2006-2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -112,12 +112,14 @@ FT_BEGIN_HEADER /***********************************************************************/ /* */ - /* TrueType driver class. */ + /* CFF driver class. */ /* */ typedef struct CFF_DriverRec_ { FT_DriverRec root; - void* extension_component; + + FT_UInt hinting_engine; + FT_Bool no_stem_darkening; } CFF_DriverRec; @@ -167,10 +169,10 @@ FT_BEGIN_HEADER /* Driver functions */ /* */ FT_LOCAL( FT_Error ) - cff_driver_init( FT_Module module ); + cff_driver_init( FT_Module module ); /* CFF_Driver */ FT_LOCAL( void ) - cff_driver_done( FT_Module module ); + cff_driver_done( FT_Module module ); /* CFF_Driver */ FT_END_HEADER diff --git a/freetype/src/cff/cffparse.c b/freetype/src/cff/cffparse.c index 5e58c8bbb..96222120b 100644 --- a/freetype/src/cff/cffparse.c +++ b/freetype/src/cff/cffparse.c @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2004, 2007-2012 by */ +/* Copyright 1996-2004, 2007-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -65,7 +65,7 @@ if ( p + 2 > limit ) goto Bad; - val = (FT_Short)( ( (FT_Int)p[0] << 8 ) | p[1] ); + val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] ); p += 2; } else if ( v == 29 ) @@ -73,10 +73,10 @@ if ( p + 4 > limit ) goto Bad; - val = ( (FT_Long)p[0] << 24 ) | - ( (FT_Long)p[1] << 16 ) | - ( (FT_Long)p[2] << 8 ) | - p[3]; + val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) | + ( (FT_ULong)p[1] << 16 ) | + ( (FT_ULong)p[2] << 8 ) | + (FT_ULong)p[3] ); p += 4; } else if ( v < 247 ) @@ -316,7 +316,7 @@ else exponent -= fraction_length; - result = number << 16; + result = (FT_Long)( (FT_ULong)number << 16 ); *scaling = exponent; } } @@ -373,7 +373,7 @@ if ( number > 0x7FFFL ) goto Overflow; - result = number << 16; + result = (FT_Long)( (FT_ULong)number << 16 ); } } @@ -435,7 +435,7 @@ goto Overflow; } - return val << 16; + return (FT_Long)( (FT_ULong)val << 16 ); Overflow: FT_TRACE4(( "!!!OVERFLOW:!!!" )); @@ -501,7 +501,7 @@ else { *scaling = 0; - return number << 16; + return (FT_Long)( (FT_ULong)number << 16 ); } } } @@ -515,7 +515,7 @@ FT_Vector* offset = &dict->font_offset; FT_ULong* upm = &dict->units_per_em; FT_Byte** data = parser->stack; - FT_Error error = CFF_Err_Stack_Underflow; + FT_Error error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 6 ) @@ -523,7 +523,7 @@ FT_Long scaling; - error = CFF_Err_Ok; + error = FT_Err_Ok; dict->has_font_matrix = TRUE; @@ -588,7 +588,7 @@ FT_Error error; - error = CFF_Err_Stack_Underflow; + error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 4 ) { @@ -596,7 +596,7 @@ bbox->yMin = FT_RoundFix( cff_parse_fixed( data++ ) ); bbox->xMax = FT_RoundFix( cff_parse_fixed( data++ ) ); bbox->yMax = FT_RoundFix( cff_parse_fixed( data ) ); - error = CFF_Err_Ok; + error = FT_Err_Ok; FT_TRACE4(( " [%d %d %d %d]\n", bbox->xMin / 65536, @@ -617,7 +617,7 @@ FT_Error error; - error = CFF_Err_Stack_Underflow; + error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 2 ) { @@ -626,7 +626,7 @@ FT_TRACE4(( " %lu %lu\n", dict->private_size, dict->private_offset )); - error = CFF_Err_Ok; + error = FT_Err_Ok; } return error; @@ -641,7 +641,7 @@ FT_Error error; - error = CFF_Err_Stack_Underflow; + error = FT_ERR( Stack_Underflow ); if ( parser->top >= parser->stack + 3 ) { @@ -653,7 +653,7 @@ if ( dict->cid_supplement < 0 ) FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n", dict->cid_supplement )); - error = CFF_Err_Ok; + error = FT_Err_Ok; FT_TRACE4(( " %d %d %d\n", dict->cid_registry, @@ -922,7 +922,7 @@ *output_class = clazz; - return CFF_Err_Ok; + return FT_Err_Ok; } @@ -935,7 +935,7 @@ FT_Byte* limit ) { FT_Byte* p = start; - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Library library = parser->library; FT_UNUSED( library ); @@ -1161,15 +1161,15 @@ return error; Stack_Overflow: - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; Stack_Underflow: - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; Syntax_Error: - error = CFF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } diff --git a/freetype/src/cff/cffpic.c b/freetype/src/cff/cffpic.c index fe4fa496f..f22e4f0d5 100644 --- a/freetype/src/cff/cffpic.c +++ b/freetype/src/cff/cffpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009, 2010, 2012 by */ +/* Copyright 2009, 2010, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,65 +23,51 @@ #include "cffpic.h" #include "cfferrs.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from cffdrivr.c */ FT_Error - FT_Create_Class_cff_services( - FT_Library library, - FT_ServiceDescRec** output_class ); - + FT_Create_Class_cff_services( FT_Library library, + FT_ServiceDescRec** output_class ); void - FT_Destroy_Class_cff_services( - FT_Library library, - FT_ServiceDescRec* clazz ); - + FT_Destroy_Class_cff_services( FT_Library library, + FT_ServiceDescRec* clazz ); void - FT_Init_Class_cff_service_ps_info( - FT_Library library, - FT_Service_PsInfoRec* clazz ); - + FT_Init_Class_cff_service_ps_info( FT_Library library, + FT_Service_PsInfoRec* clazz ); void - FT_Init_Class_cff_service_glyph_dict( - FT_Library library, - FT_Service_GlyphDictRec* clazz ); - + FT_Init_Class_cff_service_glyph_dict( FT_Library library, + FT_Service_GlyphDictRec* clazz ); void - FT_Init_Class_cff_service_ps_name( - FT_Library library, - FT_Service_PsFontNameRec* clazz ); - + FT_Init_Class_cff_service_ps_name( FT_Library library, + FT_Service_PsFontNameRec* clazz ); void - FT_Init_Class_cff_service_get_cmap_info( - FT_Library library, - FT_Service_TTCMapsRec* clazz ); - + FT_Init_Class_cff_service_get_cmap_info( FT_Library library, + FT_Service_TTCMapsRec* clazz ); void - FT_Init_Class_cff_service_cid_info( - FT_Library library, - FT_Service_CIDRec* clazz ); + FT_Init_Class_cff_service_cid_info( FT_Library library, + FT_Service_CIDRec* clazz ); /* forward declaration of PIC init functions from cffparse.c */ FT_Error - FT_Create_Class_cff_field_handlers( - FT_Library library, - CFF_Field_Handler** output_class ); - + FT_Create_Class_cff_field_handlers( FT_Library library, + CFF_Field_Handler** output_class ); void - FT_Destroy_Class_cff_field_handlers( - FT_Library library, - CFF_Field_Handler* clazz ); + FT_Destroy_Class_cff_field_handlers( FT_Library library, + CFF_Field_Handler* clazz ); + void cff_driver_class_pic_free( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_Memory memory = library->memory; if ( pic_container->cff ) { - CffModulePIC* container = ( CffModulePIC* )pic_container->cff; + CffModulePIC* container = (CffModulePIC*)pic_container->cff; if ( container->cff_services ) @@ -102,7 +88,7 @@ cff_driver_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = CFF_Err_Ok; + FT_Error error = FT_Err_Ok; CffModulePIC* container = NULL; FT_Memory memory = library->memory; @@ -113,15 +99,18 @@ FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->cff = container; - /* initialize pointer table - this is how the module usually expects this data */ + /* initialize pointer table - */ + /* this is how the module usually expects this data */ error = FT_Create_Class_cff_services( library, &container->cff_services ); if ( error ) goto Exit; + error = FT_Create_Class_cff_field_handlers( library, &container->cff_field_handlers ); if ( error ) goto Exit; + FT_Init_Class_cff_service_ps_info( library, &container->cff_service_ps_info ); FT_Init_Class_cff_service_glyph_dict( @@ -136,7 +125,8 @@ library, &container->cff_cmap_encoding_class_rec ); FT_Init_Class_cff_cmap_unicode_class_rec( library, &container->cff_cmap_unicode_class_rec ); -Exit: + + Exit: if ( error ) cff_driver_class_pic_free( library ); return error; diff --git a/freetype/src/cff/cffpic.h b/freetype/src/cff/cffpic.h index b27f093db..50bab4c17 100644 --- a/freetype/src/cff/cffpic.h +++ b/freetype/src/cff/cffpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009, 2012 by */ +/* Copyright 2009, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,6 +32,7 @@ FT_BEGIN_HEADER #define CFF_SERVICE_PS_NAME_GET cff_service_ps_name #define CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info #define CFF_SERVICE_CID_INFO_GET cff_service_cid_info +#define CFF_SERVICE_PROPERTIES_GET cff_service_properties #define CFF_SERVICES_GET cff_services #define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec #define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec @@ -45,6 +46,7 @@ FT_BEGIN_HEADER #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_TT_CMAP_H #include FT_SERVICE_CID_H +#include FT_SERVICE_PROPERTIES_H typedef struct CffModulePIC_ @@ -56,32 +58,35 @@ FT_BEGIN_HEADER FT_Service_PsFontNameRec cff_service_ps_name; FT_Service_TTCMapsRec cff_service_get_cmap_info; FT_Service_CIDRec cff_service_cid_info; + FT_Service_PropertiesRec cff_service_properties; FT_CMap_ClassRec cff_cmap_encoding_class_rec; FT_CMap_ClassRec cff_cmap_unicode_class_rec; } CffModulePIC; -#define GET_PIC( lib ) \ - ( (CffModulePIC*)((lib)->pic_container.cff) ) +#define GET_PIC( lib ) \ + ( (CffModulePIC*)( (lib)->pic_container.cff ) ) -#define CFF_SERVICE_PS_INFO_GET \ +#define CFF_SERVICE_PS_INFO_GET \ ( GET_PIC( library )->cff_service_ps_info ) -#define CFF_SERVICE_GLYPH_DICT_GET \ +#define CFF_SERVICE_GLYPH_DICT_GET \ ( GET_PIC( library )->cff_service_glyph_dict ) -#define CFF_SERVICE_PS_NAME_GET \ +#define CFF_SERVICE_PS_NAME_GET \ ( GET_PIC( library )->cff_service_ps_name ) -#define CFF_SERVICE_GET_CMAP_INFO_GET \ +#define CFF_SERVICE_GET_CMAP_INFO_GET \ ( GET_PIC( library )->cff_service_get_cmap_info ) -#define CFF_SERVICE_CID_INFO_GET \ +#define CFF_SERVICE_CID_INFO_GET \ ( GET_PIC( library )->cff_service_cid_info ) -#define CFF_SERVICES_GET \ +#define CFF_SERVICE_PROPERTIES_GET \ + ( GET_PIC( library )->cff_service_properties ) +#define CFF_SERVICES_GET \ ( GET_PIC( library )->cff_services ) -#define CFF_CMAP_ENCODING_CLASS_REC_GET \ +#define CFF_CMAP_ENCODING_CLASS_REC_GET \ ( GET_PIC( library )->cff_cmap_encoding_class_rec ) -#define CFF_CMAP_UNICODE_CLASS_REC_GET \ +#define CFF_CMAP_UNICODE_CLASS_REC_GET \ ( GET_PIC( library )->cff_cmap_unicode_class_rec ) -#define CFF_FIELD_HANDLERS_GET \ +#define CFF_FIELD_HANDLERS_GET \ ( GET_PIC( library )->cff_field_handlers ) /* see cffpic.c for the implementation */ diff --git a/freetype/src/cff/cfftypes.h b/freetype/src/cff/cfftypes.h index 7c99036b5..872744666 100644 --- a/freetype/src/cff/cfftypes.h +++ b/freetype/src/cff/cfftypes.h @@ -5,7 +5,7 @@ /* Basic OpenType/CFF type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2003, 2006-2008, 2010-2011 by */ +/* Copyright 1996-2003, 2006-2008, 2010-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -270,6 +270,9 @@ FT_BEGIN_HEADER FT_String* registry; FT_String* ordering; + /* since version 2.4.12 */ + FT_Generic cf2_instance; + } CFF_FontRec, *CFF_Font; diff --git a/freetype/src/cff/rules.mk b/freetype/src/cff/rules.mk index ca7aa5de8..13115c255 100644 --- a/freetype/src/cff/rules.mk +++ b/freetype/src/cff/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003, 2011 by +# Copyright 1996-2001, 2003, 2011, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -29,14 +29,27 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ $(CFF_DIR)/cffload.c \ $(CFF_DIR)/cffobjs.c \ $(CFF_DIR)/cffparse.c \ - $(CFF_DIR)/cffpic.c + $(CFF_DIR)/cffpic.c \ + $(CFF_DIR)/cf2arrst.c \ + $(CFF_DIR)/cf2blues.c \ + $(CFF_DIR)/cf2error.c \ + $(CFF_DIR)/cf2font.c \ + $(CFF_DIR)/cf2ft.c \ + $(CFF_DIR)/cf2hints.c \ + $(CFF_DIR)/cf2intrp.c \ + $(CFF_DIR)/cf2read.c \ + $(CFF_DIR)/cf2stack.c + # CFF driver headers # CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \ $(CFF_DIR)/cfferrs.h \ $(CFF_DIR)/cfftoken.h \ - $(CFF_DIR)/cfftypes.h + $(CFF_DIR)/cfftypes.h \ + $(CFF_DIR)/cf2fixed.h \ + $(CFF_DIR)/cf2glue.h \ + $(CFF_DIR)/cf2types.h # CFF driver object(s) diff --git a/freetype/src/cid/cidgload.c b/freetype/src/cid/cidgload.c index bd8402340..a1a865869 100644 --- a/freetype/src/cid/cidgload.c +++ b/freetype/src/cid/cidgload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 1996-2007, 2009, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -46,7 +46,7 @@ FT_Byte* p; FT_UInt fd_select; FT_Stream stream = face->cid_stream; - FT_Error error = CID_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte* charstring = 0; FT_Memory memory = face->root.memory; FT_ULong glyph_length = 0; @@ -117,7 +117,7 @@ if ( fd_select >= (FT_UInt)cid->num_dicts ) { - error = CID_Err_Invalid_Offset; + error = FT_THROW( Invalid_Offset ); goto Exit; } if ( glyph_length == 0 ) @@ -258,7 +258,7 @@ psaux->t1_decoder_funcs->done( &decoder ); - return CID_Err_Ok; + return FT_Err_Ok; } @@ -284,7 +284,7 @@ if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) { - error = CID_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } diff --git a/freetype/src/cid/cidload.c b/freetype/src/cid/cidload.c index cbb59850f..f2a18ea51 100644 --- a/freetype/src/cid/cidload.c +++ b/freetype/src/cid/cidload.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (body). */ /* */ -/* Copyright 1996-2006, 2009, 2011-2012 by */ +/* Copyright 1996-2006, 2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -42,7 +42,7 @@ cid_get_offset( FT_Byte* *start, FT_Byte offsize ) { - FT_Long result; + FT_ULong result; FT_Byte* p = *start; @@ -53,7 +53,7 @@ } *start = p; - return result; + return (FT_Long)result; } @@ -114,7 +114,7 @@ { FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n", keyword->ident )); - error = CID_Err_Syntax_Error; + error = FT_THROW( Syntax_Error ); goto Exit; } @@ -195,7 +195,7 @@ offset->y = temp[5] >> 16; } - return CID_Err_Ok; /* this is a callback function; */ + return FT_Err_Ok; /* this is a callback function; */ /* we must return an error code */ } @@ -206,7 +206,7 @@ { CID_FaceInfo cid = &face->cid; FT_Memory memory = face->root.memory; - FT_Error error = CID_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Long num_dicts; @@ -257,7 +257,7 @@ dict->private_dict.expansion_factor = dict->expansion_factor; } - return CID_Err_Ok; + return FT_Err_Ok; } @@ -286,7 +286,7 @@ parser->root.cursor = base; parser->root.limit = base + size; - parser->root.error = CID_Err_Ok; + parser->root.error = FT_Err_Ok; { FT_Byte* cur = base; @@ -416,7 +416,7 @@ /* Check for possible overflow. */ if ( num_subrs == FT_UINT_MAX ) { - error = CID_Err_Syntax_Error; + error = FT_THROW( Syntax_Error ); goto Fail; } @@ -428,7 +428,7 @@ if ( new_max <= max_offsets ) { - error = CID_Err_Syntax_Error; + error = FT_THROW( Syntax_Error ); goto Fail; } @@ -571,7 +571,7 @@ if ( size == 0 ) { - error = CID_Err_Syntax_Error; + error = FT_THROW( Syntax_Error ); goto Exit; } @@ -604,7 +604,7 @@ } else { - error = CID_Err_Syntax_Error; + error = FT_THROW( Syntax_Error ); goto Exit; } @@ -624,7 +624,7 @@ p++; } - error = CID_Err_Ok; + error = FT_Err_Ok; Exit: return error; diff --git a/freetype/src/cid/cidobjs.c b/freetype/src/cid/cidobjs.c index cc2a2008e..46555e2dc 100644 --- a/freetype/src/cid/cidobjs.c +++ b/freetype/src/cid/cidobjs.c @@ -4,7 +4,7 @@ /* */ /* CID objects manager (body). */ /* */ -/* Copyright 1996-2006, 2008, 2010-2011 by */ +/* Copyright 1996-2006, 2008, 2010-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -131,7 +131,7 @@ cid_size_init( FT_Size cidsize ) /* CID_Size */ { CID_Size size = (CID_Size)cidsize; - FT_Error error = CID_Err_Ok; + FT_Error error = FT_Err_Ok; PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size ); @@ -169,7 +169,7 @@ size->metrics.y_scale, 0, 0 ); - return CID_Err_Ok; + return FT_Err_Ok; } @@ -302,7 +302,7 @@ if ( !psaux ) { FT_ERROR(( "cid_face_init: cannot access `psaux' module\n" )); - error = CID_Err_Missing_Module; + error = FT_THROW( Missing_Module ); goto Exit; } @@ -337,7 +337,7 @@ if ( face_index != 0 ) { FT_ERROR(( "cid_face_init: invalid face index\n" )); - error = CID_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -466,7 +466,7 @@ { FT_UNUSED( driver ); - return CID_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/cid/cidparse.c b/freetype/src/cid/cidparse.c index 4d21160ce..53df3155d 100644 --- a/freetype/src/cid/cidparse.c +++ b/freetype/src/cid/cidparse.c @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 parser (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */ +/* Copyright 1996-2007, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -74,7 +74,7 @@ "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) ) { FT_TRACE2(( " not a CID-keyed font\n" )); - error = CID_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); } FT_FRAME_EXIT(); @@ -99,7 +99,7 @@ if ( stream_len == 0 ) { FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" )); - error = CID_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -117,12 +117,12 @@ if ( p[0] == 'S' && ft_strncmp( (char*)p, "StartData", 9 ) == 0 ) { /* save offset of binary data after `StartData' */ - offset += p - buffer + 10; + offset += (FT_ULong)( p - buffer + 10 ); goto Found; } else if ( p[1] == 's' && ft_strncmp( (char*)p, "/sfnts", 6 ) == 0 ) { - offset += p - buffer + 7; + offset += (FT_ULong)( p - buffer + 7 ); goto Found; } } @@ -185,7 +185,7 @@ else if ( cur[1] == 's' && ft_strncmp( (char*)cur, "/sfnts", 6 ) == 0 ) { FT_TRACE2(( "cid_parser_new: cannot handle Type 11 fonts\n" )); - error = CID_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } diff --git a/freetype/src/cid/cidriver.c b/freetype/src/cid/cidriver.c index 694070aab..6132a2776 100644 --- a/freetype/src/cid/cidriver.c +++ b/freetype/src/cid/cidriver.c @@ -4,7 +4,7 @@ /* */ /* CID driver interface (body). */ /* */ -/* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -74,7 +74,7 @@ { *afont_info = ((CID_Face)face)->cid.font_info; - return CID_Err_Ok; + return FT_Err_Ok; } static FT_Error @@ -83,7 +83,7 @@ { *afont_extra = ((CID_Face)face)->font_extra; - return CID_Err_Ok; + return FT_Err_Ok; } static const FT_Service_PsInfoRec cid_service_ps_info = @@ -118,7 +118,7 @@ if ( supplement ) *supplement = cid->supplement; - return CID_Err_Ok; + return FT_Err_Ok; } @@ -126,7 +126,7 @@ cid_get_is_cid( CID_Face face, FT_Bool *is_cid ) { - FT_Error error = CID_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( face ); @@ -142,7 +142,7 @@ FT_UInt glyph_index, FT_UInt *cid ) { - FT_Error error = CID_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( face ); @@ -221,11 +221,6 @@ cid_slot_init, cid_slot_done, -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - ft_stub_set_char_sizes, - ft_stub_set_pixel_sizes, -#endif - cid_slot_load_glyph, 0, /* FT_Face_GetKerningFunc */ diff --git a/freetype/src/gxvalid/gxvcommn.c b/freetype/src/gxvalid/gxvcommn.c index 72efd6ff5..2ac80be8c 100644 --- a/freetype/src/gxvalid/gxvcommn.c +++ b/freetype/src/gxvalid/gxvcommn.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT common tables validation (body). */ /* */ -/* Copyright 2004, 2005, 2009, 2010 */ +/* Copyright 2004, 2005, 2009, 2010, 2013 */ /* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -900,7 +900,7 @@ nnames = FT_Get_Sfnt_Name_Count( valid->face ); for ( i = 0; i < nnames; i++ ) { - if ( FT_Get_Sfnt_Name( valid->face, i, &name ) != GXV_Err_Ok ) + if ( FT_Get_Sfnt_Name( valid->face, i, &name ) != FT_Err_Ok ) continue ; if ( name.name_id == name_index ) diff --git a/freetype/src/gxvalid/gxverror.h b/freetype/src/gxvalid/gxverror.h index 7d2ef7809..c573b72de 100644 --- a/freetype/src/gxvalid/gxverror.h +++ b/freetype/src/gxvalid/gxverror.h @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT validation module error codes (specification only). */ /* */ -/* Copyright 2004, 2005, 2012 */ +/* Copyright 2004, 2005, 2012-2013 */ /* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -41,9 +41,7 @@ #undef FT_ERR_PREFIX #define FT_ERR_PREFIX GXV_Err_ -#define FT_ERR_BASE FT_Mod_Err_GXV - -#define FT_KEEP_ERR_PREFIX +#define FT_ERR_BASE FT_Mod_Err_GXvalid #include FT_ERRORS_H diff --git a/freetype/src/gxvalid/gxvkern.c b/freetype/src/gxvalid/gxvkern.c index 0ec978f7b..557c5f1fe 100644 --- a/freetype/src/gxvalid/gxvkern.c +++ b/freetype/src/gxvalid/gxvkern.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT kern table validation (body). */ /* */ -/* Copyright 2004, 2005, 2006, 2007 */ +/* Copyright 2004-2007, 2013 */ /* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -303,8 +303,6 @@ #ifdef GXV_LOAD_UNUSED_VARS kernAction = FT_NEXT_USHORT( p ); kernValue = FT_NEXT_USHORT( p ); -#else - p += 4; #endif } } diff --git a/freetype/src/gxvalid/gxvmod.c b/freetype/src/gxvalid/gxvmod.c index 502fe5dca..278d47688 100644 --- a/freetype/src/gxvalid/gxvmod.c +++ b/freetype/src/gxvalid/gxvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's TrueTypeGX/AAT validation module implementation (body). */ /* */ -/* Copyright 2004, 2005, 2006 */ +/* Copyright 2004-2006, 2013 */ /* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -58,8 +58,8 @@ error = FT_Load_Sfnt_Table( face, tag, 0, NULL, table_len ); - if ( error == GXV_Err_Table_Missing ) - return GXV_Err_Ok; + if ( FT_ERR_EQ( error, Table_Missing ) ) + return FT_Err_Ok; if ( error ) goto Exit; @@ -112,7 +112,7 @@ { FT_Memory volatile memory = FT_FACE_MEMORY( face ); - FT_Error error = GXV_Err_Ok; + FT_Error error = FT_Err_Ok; FT_ValidatorRec volatile valid; FT_UInt i; @@ -200,7 +200,7 @@ /* without volatile on `error' GCC 4.1.1. emits: */ /* warning: variable 'error' might be clobbered by 'longjmp' or 'vfork' */ /* this warning seems spurious but --- */ - FT_Error volatile error = GXV_Err_Ok; + FT_Error volatile error; FT_ValidatorRec volatile valid; diff --git a/freetype/src/gxvalid/gxvmort.c b/freetype/src/gxvalid/gxvmort.c index 465462a05..5356e67ca 100644 --- a/freetype/src/gxvalid/gxvmort.c +++ b/freetype/src/gxvalid/gxvmort.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT mort table validation (body). */ /* */ -/* Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ +/* Copyright 2005, 2013 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -163,14 +163,15 @@ }; - GXV_Validate_Func func; - FT_UShort i; + FT_UShort i; GXV_NAME_ENTER( "subtables in a chain" ); for ( i = 0; i < nSubtables; i++ ) { + GXV_Validate_Func func; + FT_UShort length; FT_UShort coverage; #ifdef GXV_LOAD_UNUSED_VARS diff --git a/freetype/src/gxvalid/gxvmorx.c b/freetype/src/gxvalid/gxvmorx.c index 4b1dd0050..5ae04d321 100644 --- a/freetype/src/gxvalid/gxvmorx.c +++ b/freetype/src/gxvalid/gxvmorx.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT morx table validation (body). */ /* */ -/* Copyright 2005, 2008 by */ +/* Copyright 2005, 2008, 2013 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -57,8 +57,6 @@ }; - GXV_Validate_Func func; - FT_UShort i; @@ -66,6 +64,8 @@ for ( i = 0; i < nSubtables; i++ ) { + GXV_Validate_Func func; + FT_ULong length; FT_ULong coverage; #ifdef GXV_LOAD_UNUSED_VARS diff --git a/freetype/src/gzip/ftgzip.c b/freetype/src/gzip/ftgzip.c index f3d2ef94f..f26755834 100644 --- a/freetype/src/gzip/ftgzip.c +++ b/freetype/src/gzip/ftgzip.c @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2002-2006, 2009-2012 by */ +/* Copyright 2002-2006, 2009-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -68,6 +68,15 @@ #undef SLOW #define SLOW 1 /* we can't use asm-optimized sources here! */ +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + /* We disable the warning `conversion from XXX to YYY, */ + /* possible loss of data' in order to compile cleanly with */ + /* the maximum level of warnings: zlib is non-FreeType */ + /* code. */ +#pragma warning( push ) +#pragma warning( disable : 4244 ) +#endif /* _MSC_VER */ + /* Urgh. `inflate_mask' must not be declared twice -- C++ doesn't like this. We temporarily disable it and load all necessary header files. */ #define NO_INFLATE_MASK @@ -87,6 +96,10 @@ #include "inflate.c" #include "adler32.c" +#if defined( _MSC_VER ) +#pragma warning( pop ) +#endif + #endif /* !FT_CONFIG_OPTION_SYSTEM_ZLIB */ @@ -200,7 +213,7 @@ head[2] != Z_DEFLATED || (head[3] & FT_GZIP_RESERVED) ) { - error = Gzip_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -262,7 +275,7 @@ FT_Stream source ) { z_stream* zstream = &zip->zstream; - FT_Error error = Gzip_Err_Ok; + FT_Error error = FT_Err_Ok; zip->stream = stream; @@ -294,7 +307,7 @@ if ( inflateInit2( zstream, -MAX_WBITS ) != Z_OK || zstream->next_in == NULL ) - error = Gzip_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); Exit: return error; @@ -365,7 +378,7 @@ size = stream->read( stream, stream->pos, zip->input, FT_GZIP_BUFFER_SIZE ); if ( size == 0 ) - return Gzip_Err_Invalid_Stream_Operation; + return FT_THROW( Invalid_Stream_Operation ); } else { @@ -374,7 +387,7 @@ size = FT_GZIP_BUFFER_SIZE; if ( size == 0 ) - return Gzip_Err_Invalid_Stream_Operation; + return FT_THROW( Invalid_Stream_Operation ); FT_MEM_COPY( zip->input, stream->base + stream->pos, size ); } @@ -383,7 +396,7 @@ zstream->next_in = zip->input; zstream->avail_in = size; - return Gzip_Err_Ok; + return FT_Err_Ok; } @@ -391,7 +404,7 @@ ft_gzip_file_fill_output( FT_GZipFile zip ) { z_stream* zstream = &zip->zstream; - FT_Error error = Gzip_Err_Ok; + FT_Error error = FT_Err_Ok; zip->cursor = zip->buffer; @@ -416,12 +429,12 @@ { zip->limit = zstream->next_out; if ( zip->limit == zip->cursor ) - error = Gzip_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); break; } else if ( err != Z_OK ) { - error = Gzip_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); break; } } @@ -435,7 +448,7 @@ ft_gzip_file_skip_output( FT_GZipFile zip, FT_ULong count ) { - FT_Error error = Gzip_Err_Ok; + FT_Error error = FT_Err_Ok; FT_ULong delta; @@ -657,7 +670,7 @@ ft_gzip_file_io( zip, 0, NULL, 0 ); FT_FREE( zip_buff ); } - error = Gzip_Err_Ok; + error = FT_Err_Ok; } } @@ -680,7 +693,7 @@ FT_UNUSED( stream ); FT_UNUSED( source ); - return Gzip_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } #endif /* !FT_CONFIG_OPTION_USE_ZLIB */ diff --git a/freetype/src/lzw/ftlzw.c b/freetype/src/lzw/ftlzw.c index 35e392b43..82e6c0070 100644 --- a/freetype/src/lzw/ftlzw.c +++ b/freetype/src/lzw/ftlzw.c @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2004-2006, 2009, 2010, 2012 by */ +/* Copyright 2004-2006, 2009, 2010, 2012, 2013 by */ /* Albert Chin-A-Young. */ /* */ /* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */ @@ -98,7 +98,7 @@ /* head[0] && head[1] are the magic numbers */ if ( head[0] != 0x1f || head[1] != 0x9d ) - error = LZW_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); Exit: return error; @@ -111,7 +111,7 @@ FT_Stream source ) { FT_LzwState lzw = &zip->lzw; - FT_Error error = LZW_Err_Ok; + FT_Error error; zip->stream = stream; @@ -172,7 +172,7 @@ { FT_LzwState lzw = &zip->lzw; FT_ULong count; - FT_Error error = LZW_Err_Ok; + FT_Error error = FT_Err_Ok; zip->cursor = zip->buffer; @@ -182,7 +182,7 @@ zip->limit = zip->cursor + count; if ( count == 0 ) - error = LZW_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); return error; } @@ -193,7 +193,7 @@ ft_lzw_file_skip_output( FT_LZWFile zip, FT_ULong count ) { - FT_Error error = LZW_Err_Ok; + FT_Error error = FT_Err_Ok; /* first, we skip what we can from the output buffer */ @@ -224,7 +224,7 @@ if ( numread < delta ) { /* not enough bytes */ - error = LZW_Err_Invalid_Stream_Operation; + error = FT_THROW( Invalid_Stream_Operation ); break; } @@ -403,7 +403,7 @@ FT_UNUSED( stream ); FT_UNUSED( source ); - return LZW_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } diff --git a/freetype/src/otvalid/otverror.h b/freetype/src/otvalid/otverror.h index 522f4a200..b6f00c9db 100644 --- a/freetype/src/otvalid/otverror.h +++ b/freetype/src/otvalid/otverror.h @@ -4,7 +4,7 @@ /* */ /* OpenType validation module error codes (specification only). */ /* */ -/* Copyright 2004, 2005, 2012 by */ +/* Copyright 2004, 2005, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -34,8 +34,6 @@ #define FT_ERR_PREFIX OTV_Err_ #define FT_ERR_BASE FT_Mod_Err_OTvalid -#define FT_KEEP_ERR_PREFIX - #include FT_ERRORS_H #endif /* __OTVERROR_H__ */ diff --git a/freetype/src/otvalid/otvmod.c b/freetype/src/otvalid/otvmod.c index acf213f23..37c6e869d 100644 --- a/freetype/src/otvalid/otvmod.c +++ b/freetype/src/otvalid/otvmod.c @@ -4,7 +4,7 @@ /* */ /* FreeType's OpenType validation module implementation (body). */ /* */ -/* Copyright 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 2004-2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -49,8 +49,8 @@ error = FT_Load_Sfnt_Table( face, tag, 0, NULL, table_len ); - if ( error == OTV_Err_Table_Missing ) - return OTV_Err_Ok; + if ( FT_ERR_EQ( error, Table_Missing ) ) + return FT_Err_Ok; if ( error ) goto Exit; @@ -73,7 +73,7 @@ FT_Bytes *ot_gsub, FT_Bytes *ot_jstf ) { - FT_Error error = OTV_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte* volatile base; FT_Byte* volatile gdef; FT_Byte* volatile gpos; diff --git a/freetype/src/pcf/pcfdrivr.c b/freetype/src/pcf/pcfdrivr.c index ba5448842..df25a645a 100644 --- a/freetype/src/pcf/pcfdrivr.c +++ b/freetype/src/pcf/pcfdrivr.c @@ -2,7 +2,7 @@ FreeType font driver for pcf files - Copyright (C) 2000-2004, 2006-2011 by + Copyright (C) 2000-2004, 2006-2011, 2013 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -83,7 +83,7 @@ THE SOFTWARE. cmap->num_encodings = (FT_UInt)face->nencodings; cmap->encodings = face->encodings; - return PCF_Err_Ok; + return FT_Err_Ok; } @@ -264,7 +264,7 @@ THE SOFTWARE. FT_Parameter* params ) { PCF_Face face = (PCF_Face)pcfface; - FT_Error error = PCF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -289,7 +289,7 @@ THE SOFTWARE. /* this didn't work, try gzip support! */ error2 = FT_Stream_OpenGzip( &face->comp_stream, stream ); - if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature ) + if ( FT_ERR_EQ( error2, Unimplemented_Feature ) ) goto Fail; error = error2; @@ -304,7 +304,7 @@ THE SOFTWARE. /* this didn't work, try LZW support! */ error3 = FT_Stream_OpenLZW( &face->comp_stream, stream ); - if ( FT_ERROR_BASE( error3 ) == FT_Err_Unimplemented_Feature ) + if ( FT_ERR_EQ( error3, Unimplemented_Feature ) ) goto Fail; error = error3; @@ -319,7 +319,7 @@ THE SOFTWARE. /* this didn't work, try Bzip2 support! */ error4 = FT_Stream_OpenBzip2( &face->comp_stream, stream ); - if ( FT_ERROR_BASE( error4 ) == FT_Err_Unimplemented_Feature ) + if ( FT_ERR_EQ( error4, Unimplemented_Feature ) ) goto Fail; error = error4; @@ -406,7 +406,7 @@ THE SOFTWARE. Fail: FT_TRACE2(( " not a PCF file\n" )); PCF_Face_Done( pcfface ); - error = PCF_Err_Unknown_File_Format; /* error */ + error = FT_THROW( Unknown_File_Format ); /* error */ goto Exit; } @@ -424,7 +424,7 @@ THE SOFTWARE. size->metrics.descender = -accel->fontDescent << 6; size->metrics.max_advance = accel->maxbounds.characterWidth << 6; - return PCF_Err_Ok; + return FT_Err_Ok; } @@ -434,7 +434,7 @@ THE SOFTWARE. { PCF_Face face = (PCF_Face)size->face; FT_Bitmap_Size* bsize = size->face->available_sizes; - FT_Error error = PCF_Err_Invalid_Pixel_Size; + FT_Error error = FT_ERR( Invalid_Pixel_Size ); FT_Long height; @@ -445,17 +445,17 @@ THE SOFTWARE. { case FT_SIZE_REQUEST_TYPE_NOMINAL: if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) ) - error = PCF_Err_Ok; + error = FT_Err_Ok; break; case FT_SIZE_REQUEST_TYPE_REAL_DIM: if ( height == ( face->accel.fontAscent + face->accel.fontDescent ) ) - error = PCF_Err_Ok; + error = FT_Err_Ok; break; default: - error = PCF_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); break; } @@ -474,7 +474,7 @@ THE SOFTWARE. { PCF_Face face = (PCF_Face)FT_SIZE_FACE( size ); FT_Stream stream; - FT_Error error = PCF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Bitmap* bitmap = &slot->bitmap; PCF_Metric metric; FT_Offset bytes; @@ -486,7 +486,7 @@ THE SOFTWARE. if ( !face || glyph_index >= (FT_UInt)face->root.num_glyphs ) { - error = PCF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -526,13 +526,13 @@ THE SOFTWARE. break; default: - return PCF_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); } /* XXX: to do: are there cases that need repadding the bitmap? */ bytes = bitmap->pitch * bitmap->rows; - error = ft_glyphslot_alloc_bitmap( slot, bytes ); + error = ft_glyphslot_alloc_bitmap( slot, (FT_ULong)bytes ); if ( error ) goto Exit; @@ -622,7 +622,7 @@ THE SOFTWARE. return 0; } - return PCF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } @@ -699,10 +699,6 @@ THE SOFTWARE. 0, /* FT_Slot_InitFunc */ 0, /* FT_Slot_DoneFunc */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - ft_stub_set_char_sizes, - ft_stub_set_pixel_sizes, -#endif PCF_Glyph_Load, 0, /* FT_Face_GetKerningFunc */ diff --git a/freetype/src/pcf/pcfread.c b/freetype/src/pcf/pcfread.c index d9914c03a..3c1bb7dfa 100644 --- a/freetype/src/pcf/pcfread.c +++ b/freetype/src/pcf/pcfread.c @@ -2,7 +2,7 @@ FreeType font driver for pcf fonts - Copyright 2000-2010, 2012 by + Copyright 2000-2010, 2012, 2013 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -92,21 +92,21 @@ THE SOFTWARE. PCF_Toc toc = &face->toc; PCF_Table tables; - FT_Memory memory = FT_FACE(face)->memory; + FT_Memory memory = FT_FACE( face )->memory; FT_UInt n; if ( FT_STREAM_SEEK ( 0 ) || FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) ) - return PCF_Err_Cannot_Open_Resource; + return FT_THROW( Cannot_Open_Resource ); if ( toc->version != PCF_FILE_VERSION || toc->count > FT_ARRAY_MAX( face->toc.tables ) || toc->count == 0 ) - return PCF_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) ) - return PCF_Err_Out_Of_Memory; + return FT_THROW( Out_Of_Memory ); tables = face->toc.tables; for ( n = 0; n < toc->count; n++ ) @@ -144,7 +144,7 @@ THE SOFTWARE. if ( ( tables[i].size > tables[i + 1].offset ) || ( tables[i].offset > tables[i + 1].offset - tables[i].size ) ) - return PCF_Err_Invalid_Offset; + return FT_THROW( Invalid_Offset ); } if ( !have_change ) @@ -181,7 +181,7 @@ THE SOFTWARE. #endif - return PCF_Err_Ok; + return FT_Err_Ok; Exit: FT_FREE( face->toc.tables ); @@ -248,7 +248,7 @@ THE SOFTWARE. FT_ULong format, PCF_Metric metric ) { - FT_Error error = PCF_Err_Ok; + FT_Error error = FT_Err_Ok; if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) @@ -294,7 +294,7 @@ THE SOFTWARE. FT_ULong *aformat, FT_ULong *asize ) { - FT_Error error = PCF_Err_Invalid_File_Format; + FT_Error error = FT_ERR( Invalid_File_Format ); FT_ULong i; @@ -303,20 +303,20 @@ THE SOFTWARE. { if ( stream->pos > tables[i].offset ) { - error = PCF_Err_Invalid_Stream_Skip; + error = FT_THROW( Invalid_Stream_Skip ); goto Fail; } if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) ) { - error = PCF_Err_Invalid_Stream_Skip; + error = FT_THROW( Invalid_Stream_Skip ); goto Fail; } *asize = tables[i].size; *aformat = tables[i].format; - return PCF_Err_Ok; + return FT_Err_Ok; } Fail: @@ -402,7 +402,7 @@ THE SOFTWARE. FT_ULong nprops, i; FT_ULong format, size; FT_Error error; - FT_Memory memory = FT_FACE(face)->memory; + FT_Memory memory = FT_FACE( face )->memory; FT_ULong string_size; FT_String* strings = 0; @@ -441,7 +441,7 @@ THE SOFTWARE. /* rough estimate */ if ( nprops > size / PCF_PROPERTY_SIZE ) { - error = PCF_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Bail; } @@ -474,7 +474,7 @@ THE SOFTWARE. i = 4 - ( nprops & 3 ); if ( FT_STREAM_SKIP( i ) ) { - error = PCF_Err_Invalid_Stream_Skip; + error = FT_THROW( Invalid_Stream_Skip ); goto Bail; } } @@ -491,7 +491,7 @@ THE SOFTWARE. /* rough estimate */ if ( string_size > size - nprops * PCF_PROPERTY_SIZE ) { - error = PCF_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Bail; } @@ -516,7 +516,7 @@ THE SOFTWARE. if ( ( name_offset < 0 ) || ( (FT_ULong)name_offset > string_size ) ) { - error = PCF_Err_Invalid_Offset; + error = FT_THROW( Invalid_Offset ); goto Bail; } @@ -535,7 +535,7 @@ THE SOFTWARE. if ( ( value_offset < 0 ) || ( (FT_ULong)value_offset > string_size ) ) { - error = PCF_Err_Invalid_Offset; + error = FT_THROW( Invalid_Offset ); goto Bail; } @@ -552,7 +552,7 @@ THE SOFTWARE. } } - error = PCF_Err_Ok; + error = FT_Err_Ok; Bail: FT_FREE( props ); @@ -566,10 +566,10 @@ THE SOFTWARE. pcf_get_metrics( FT_Stream stream, PCF_Face face ) { - FT_Error error = PCF_Err_Ok; - FT_Memory memory = FT_FACE(face)->memory; + FT_Error error; + FT_Memory memory = FT_FACE( face )->memory; FT_ULong format, size; - PCF_Metric metrics = 0; + PCF_Metric metrics = 0; FT_ULong nmetrics, i; @@ -587,7 +587,7 @@ THE SOFTWARE. if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) ) - return PCF_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { @@ -604,12 +604,12 @@ THE SOFTWARE. (void)FT_READ_USHORT_LE( nmetrics ); } if ( error ) - return PCF_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); face->nmetrics = nmetrics; if ( !nmetrics ) - return PCF_Err_Invalid_Table; + return FT_THROW( Invalid_Table ); FT_TRACE4(( "pcf_get_metrics:\n" )); @@ -619,16 +619,16 @@ THE SOFTWARE. if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( nmetrics > size / PCF_METRIC_SIZE ) - return PCF_Err_Invalid_Table; + return FT_THROW( Invalid_Table ); } else { if ( nmetrics > size / PCF_COMPRESSED_METRIC_SIZE ) - return PCF_Err_Invalid_Table; + return FT_THROW( Invalid_Table ); } if ( FT_NEW_ARRAY( face->metrics, nmetrics ) ) - return PCF_Err_Out_Of_Memory; + return FT_THROW( Out_Of_Memory ); metrics = face->metrics; for ( i = 0; i < nmetrics; i++ ) @@ -663,8 +663,8 @@ THE SOFTWARE. pcf_get_bitmaps( FT_Stream stream, PCF_Face face ) { - FT_Error error = PCF_Err_Ok; - FT_Memory memory = FT_FACE(face)->memory; + FT_Error error; + FT_Memory memory = FT_FACE( face )->memory; FT_Long* offsets = NULL; FT_Long bitmapSizes[GLYPHPADOPTIONS]; FT_ULong format, size; @@ -693,7 +693,7 @@ THE SOFTWARE. FT_Stream_ExitFrame( stream ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) - return PCF_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); FT_TRACE4(( "pcf_get_bitmaps:\n" )); @@ -701,7 +701,7 @@ THE SOFTWARE. /* XXX: PCF_Face->nmetrics is singed FT_Long, see pcf.h */ if ( face->nmetrics < 0 || nbitmaps != ( FT_ULong )face->nmetrics ) - return PCF_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); if ( FT_NEW_ARRAY( offsets, nbitmaps ) ) return error; @@ -765,14 +765,14 @@ THE SOFTWARE. pcf_get_encodings( FT_Stream stream, PCF_Face face ) { - FT_Error error = PCF_Err_Ok; - FT_Memory memory = FT_FACE(face)->memory; + FT_Error error; + 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 = NULL, encoding = 0; + int i, j, k; + PCF_Encoding encoding = NULL; error = pcf_seek_to_table_type( stream, @@ -810,7 +810,7 @@ THE SOFTWARE. FT_Stream_ExitFrame( stream ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) - return PCF_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); FT_TRACE4(( "pdf_get_encodings:\n" )); @@ -819,56 +819,47 @@ THE SOFTWARE. nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 ); - if ( FT_NEW_ARRAY( tmpEncoding, nencoding ) ) - return PCF_Err_Out_Of_Memory; + if ( FT_NEW_ARRAY( encoding, nencoding ) ) + return FT_THROW( Out_Of_Memory ); error = FT_Stream_EnterFrame( stream, 2 * nencoding ); if ( error ) goto Bail; - for ( i = 0, j = 0 ; i < nencoding; i++ ) + k = 0; + for ( i = firstRow; i <= lastRow; i++ ) { - if ( PCF_BYTE_ORDER( format ) == MSBFirst ) - encodingOffset = FT_GET_SHORT(); - else - encodingOffset = FT_GET_SHORT_LE(); - - if ( encodingOffset != -1 ) + for ( j = firstCol; j <= lastCol; j++ ) { - tmpEncoding[j].enc = ( ( ( i / ( lastCol - firstCol + 1 ) ) + - firstRow ) * 256 ) + - ( ( i % ( lastCol - firstCol + 1 ) ) + - firstCol ); + if ( PCF_BYTE_ORDER( format ) == MSBFirst ) + encodingOffset = FT_GET_SHORT(); + else + encodingOffset = FT_GET_SHORT_LE(); - tmpEncoding[j].glyph = (FT_Short)encodingOffset; + if ( encodingOffset != -1 ) + { + encoding[k].enc = i * 256 + j; + encoding[k].glyph = (FT_Short)encodingOffset; - FT_TRACE5(( " code %d (0x%04X): idx %d\n", - tmpEncoding[j].enc, tmpEncoding[j].enc, - tmpEncoding[j].glyph )); + FT_TRACE5(( " code %d (0x%04X): idx %d\n", + encoding[k].enc, encoding[k].enc, encoding[k].glyph )); - j++; + k++; + } } } FT_Stream_ExitFrame( stream ); - if ( FT_NEW_ARRAY( encoding, j ) ) + if ( FT_RENEW_ARRAY( encoding, nencoding, k ) ) goto Bail; - for ( i = 0; i < j; i++ ) - { - encoding[i].enc = tmpEncoding[i].enc; - encoding[i].glyph = tmpEncoding[i].glyph; - } - - face->nencodings = j; + face->nencodings = k; face->encodings = encoding; - FT_FREE( tmpEncoding ); return error; Bail: FT_FREE( encoding ); - FT_FREE( tmpEncoding ); return error; } @@ -923,7 +914,7 @@ THE SOFTWARE. FT_ULong type ) { FT_ULong format, size; - FT_Error error = PCF_Err_Ok; + FT_Error error; PCF_Accel accel = &face->accel; @@ -994,7 +985,7 @@ THE SOFTWARE. static FT_Error pcf_interpret_style( PCF_Face pcf ) { - FT_Error error = PCF_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Face face = FT_FACE( pcf ); FT_Memory memory = face->memory; @@ -1023,20 +1014,20 @@ THE SOFTWARE. ( *(prop->value.atom) == 'B' || *(prop->value.atom) == 'b' ) ) { face->style_flags |= FT_STYLE_FLAG_BOLD; - strings[1] = (char *)"Bold"; + strings[1] = (char*)"Bold"; } prop = pcf_find_property( pcf, "SETWIDTH_NAME" ); if ( prop && prop->isString && *(prop->value.atom) && !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) - strings[3] = (char *)(prop->value.atom); + strings[3] = (char*)( prop->value.atom ); prop = pcf_find_property( pcf, "ADD_STYLE_NAME" ); if ( prop && prop->isString && *(prop->value.atom) && !( *(prop->value.atom) == 'N' || *(prop->value.atom) == 'n' ) ) - strings[0] = (char *)(prop->value.atom); + strings[0] = (char*)( prop->value.atom ); for ( len = 0, nn = 0; nn < 4; nn++ ) { @@ -1050,7 +1041,7 @@ THE SOFTWARE. if ( len == 0 ) { - strings[0] = (char *)"Regular"; + strings[0] = (char*)"Regular"; lengths[0] = ft_strlen( strings[0] ); len = lengths[0] + 1; } @@ -1088,7 +1079,7 @@ THE SOFTWARE. for ( mm = 0; mm < len; mm++ ) - if (s[mm] == ' ') + if ( s[mm] == ' ' ) s[mm] = '-'; } @@ -1105,8 +1096,8 @@ THE SOFTWARE. pcf_load_font( FT_Stream stream, PCF_Face face ) { - FT_Error error = PCF_Err_Ok; - FT_Memory memory = FT_FACE(face)->memory; + FT_Error error = FT_Err_Ok; + FT_Memory memory = FT_FACE( face )->memory; FT_Bool hasBDFAccelerators; @@ -1268,7 +1259,7 @@ THE SOFTWARE. { /* This is done to respect the behaviour of the original */ /* PCF font driver. */ - error = PCF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); } return error; diff --git a/freetype/src/pfr/pfrcmap.c b/freetype/src/pfr/pfrcmap.c index 9c8f9ed8e..740c433d6 100644 --- a/freetype/src/pfr/pfrcmap.c +++ b/freetype/src/pfr/pfrcmap.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR cmap handling (body). */ /* */ -/* Copyright 2002, 2007, 2009 by */ +/* Copyright 2002, 2007, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,6 +16,8 @@ /***************************************************************************/ +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H #include "pfrcmap.h" #include "pfrobjs.h" @@ -25,7 +27,7 @@ FT_CALLBACK_DEF( FT_Error ) pfr_cmap_init( PFR_CMap cmap ) { - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; PFR_Face face = (PFR_Face)FT_CMAP_FACE( cmap ); @@ -42,7 +44,7 @@ { if ( cmap->chars[n - 1].char_code >= cmap->chars[n].char_code ) { - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } } diff --git a/freetype/src/pfr/pfrdrivr.c b/freetype/src/pfr/pfrdrivr.c index c59d8ae98..4c43947bf 100644 --- a/freetype/src/pfr/pfrdrivr.c +++ b/freetype/src/pfr/pfrdrivr.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver interface (body). */ /* */ -/* Copyright 2002-2004, 2006, 2008, 2010, 2011 by */ +/* Copyright 2002-2004, 2006, 2008, 2010, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -51,7 +51,7 @@ phys->metrics_resolution ); } - return PFR_Err_Ok; + return FT_Err_Ok; } @@ -66,7 +66,7 @@ FT_Pos *anadvance ) { PFR_Face face = (PFR_Face)pfrface; - FT_Error error = PFR_Err_Invalid_Argument; + FT_Error error = FT_ERR( Invalid_Argument ); *anadvance = 0; @@ -84,7 +84,7 @@ if ( gindex < phys->num_chars ) { *anadvance = phys->chars[gindex].advance; - error = PFR_Err_Ok; + error = FT_Err_Ok; } } @@ -130,7 +130,7 @@ if ( ametrics_y_scale ) *ametrics_y_scale = y_scale; - return PFR_Err_Ok; + return FT_Err_Ok; } @@ -197,10 +197,6 @@ pfr_slot_init, pfr_slot_done, -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - ft_stub_set_char_sizes, - ft_stub_set_pixel_sizes, -#endif pfr_slot_load, pfr_get_kerning, diff --git a/freetype/src/pfr/pfrgload.c b/freetype/src/pfr/pfrgload.c index 6f65b01f5..88b4d66a1 100644 --- a/freetype/src/pfr/pfrgload.c +++ b/freetype/src/pfr/pfrgload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR glyph loader (body). */ /* */ -/* Copyright 2002, 2003, 2005, 2007, 2010 by */ +/* Copyright 2002, 2003, 2005, 2007, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -135,7 +135,7 @@ /* check that we have begun a new path */ if ( !glyph->path_begun ) { - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_glyph_line_to: invalid glyph data\n" )); goto Exit; } @@ -171,7 +171,7 @@ /* check that we have begun a new path */ if ( !glyph->path_begun ) { - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_glyph_line_to: invalid glyph data\n" )); goto Exit; } @@ -248,7 +248,7 @@ FT_Byte* p, FT_Byte* limit ) { - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = glyph->loader->memory; FT_UInt flags, x_count, y_count, i, count, mask; FT_Int x; @@ -546,7 +546,7 @@ Failure: Too_Short: - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_glyph_load_simple: invalid glyph data\n" )); goto Exit; } @@ -558,7 +558,7 @@ FT_Byte* p, FT_Byte* limit ) { - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; FT_GlyphLoader loader = glyph->loader; FT_Memory memory = loader->memory; PFR_SubGlyph subglyph; @@ -602,7 +602,7 @@ /* to avoid endless recursion */ if ( new_max > 64 ) { - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_glyph_load_compound:" " too many compound glyphs components\n" )); goto Exit; @@ -709,7 +709,7 @@ Failure: Too_Short: - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_glyph_load_compound: invalid glyph data\n" )); goto Exit; } diff --git a/freetype/src/pfr/pfrload.c b/freetype/src/pfr/pfrload.c index 325322e98..c19fceb1e 100644 --- a/freetype/src/pfr/pfrload.c +++ b/freetype/src/pfr/pfrload.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR loader (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2007, 2009, 2010 by */ +/* Copyright 2002-2005, 2007, 2009, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -49,7 +49,7 @@ PFR_ExtraItem item_list, FT_Pointer item_data ) { - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte* p = *pp; FT_UInt num_items, item_type, item_size; @@ -91,7 +91,7 @@ Too_Short: FT_ERROR(( "pfr_extra_items_parse: invalid extra items table\n" )); - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -236,7 +236,7 @@ goto Exit; if ( idx >= num_log_fonts ) - return PFR_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( FT_STREAM_SKIP( idx * 5 ) || FT_READ_USHORT( size ) || @@ -329,7 +329,7 @@ Too_Short: FT_ERROR(( "pfr_log_font_load: invalid logical font table\n" )); - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Fail; } @@ -353,7 +353,7 @@ PFR_Strike strike; FT_UInt flags0; FT_UInt n, count, size1; - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; PFR_CHECK( 5 ); @@ -427,7 +427,7 @@ return error; Too_Short: - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_extra_item_load_bitmap_info:" " invalid bitmap info table\n" )); goto Exit; @@ -449,7 +449,7 @@ FT_Byte* limit, PFR_PhyFont phy_font ) { - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = phy_font->memory; FT_PtrDist len = limit - p; @@ -477,7 +477,7 @@ { FT_UInt count, num_vert, num_horz; FT_Int* snaps = NULL; - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = phy_font->memory; @@ -506,7 +506,7 @@ return error; Too_Short: - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_exta_item_load_stem_snaps:" " invalid stem snaps table\n" )); goto Exit; @@ -521,7 +521,7 @@ PFR_PhyFont phy_font ) { PFR_KernItem item = NULL; - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = phy_font->memory; @@ -604,7 +604,7 @@ Too_Short: FT_FREE( item ); - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_extra_item_load_kerning_pairs:" " invalid kerning pairs table\n" )); goto Exit; @@ -631,7 +631,7 @@ FT_Memory memory, FT_String* *astring ) { - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; FT_String* result = NULL; FT_UInt n, ok; @@ -932,7 +932,7 @@ return error; Too_Short: - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_phy_font_load: invalid physical font table\n" )); goto Fail; } diff --git a/freetype/src/pfr/pfrobjs.c b/freetype/src/pfr/pfrobjs.c index c65cf2990..75fc4c3f1 100644 --- a/freetype/src/pfr/pfrobjs.c +++ b/freetype/src/pfr/pfrobjs.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (body). */ /* */ -/* Copyright 2002-2008, 2010-2011 by */ +/* Copyright 2002-2008, 2010-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -87,7 +87,7 @@ if ( !pfr_header_check( &face->header ) ) { FT_TRACE2(( " not a PFR font\n" )); - error = PFR_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -111,7 +111,7 @@ if ( face_index >= pfrface->num_faces ) { FT_ERROR(( "pfr_face_init: invalid face index\n" )); - error = PFR_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -156,7 +156,7 @@ else { FT_ERROR(( "pfr_face_init: font doesn't contain glyphs\n" )); - error = PFR_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } } @@ -329,7 +329,7 @@ if ( !face || gindex >= face->phy_font.num_chars ) { - error = PFR_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -343,7 +343,7 @@ if ( load_flags & FT_LOAD_SBITS_ONLY ) { - error = PFR_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -468,7 +468,7 @@ FT_Vector* kerning ) { PFR_Face face = (PFR_Face)pfrface; - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; PFR_PhyFont phy_font = &face->phy_font; FT_UInt32 code1, code2, pair; diff --git a/freetype/src/pfr/pfrsbit.c b/freetype/src/pfr/pfrsbit.c index 52bc2c8c3..2da150070 100644 --- a/freetype/src/pfr/pfrsbit.c +++ b/freetype/src/pfr/pfrsbit.c @@ -4,7 +4,7 @@ /* */ /* FreeType PFR bitmap loader (body). */ /* */ -/* Copyright 2002, 2003, 2006, 2009, 2010 by */ +/* Copyright 2002, 2003, 2006, 2009, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -353,7 +353,7 @@ FT_Long *aadvance, FT_UInt *aformat ) { - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte flags; FT_Char b; FT_Byte* p = *pdata; @@ -471,7 +471,7 @@ return error; Too_Short: - error = PFR_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); FT_ERROR(( "pfr_load_bitmap_metrics: invalid glyph data\n" )); goto Exit; } @@ -484,7 +484,7 @@ FT_Bool decreasing, FT_Bitmap* target ) { - FT_Error error = PFR_Err_Ok; + FT_Error error = FT_Err_Ok; PFR_BitWriterRec writer; @@ -508,7 +508,7 @@ default: FT_ERROR(( "pfr_read_bitmap_data: invalid image type\n" )); - error = PFR_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); } } @@ -560,7 +560,7 @@ } /* couldn't find it */ - return PFR_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } Found_Strike: @@ -593,7 +593,7 @@ if ( gps_size == 0 ) { /* Could not find a bitmap program string for this glyph */ - error = PFR_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } } @@ -641,7 +641,7 @@ FT_TRACE1(( "pfr_slot_load_bitmap:" )); FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n", xpos, ypos )); - error = PFR_Err_Invalid_Pixel_Size; + error = FT_THROW( Invalid_Pixel_Size ); } if ( !error ) diff --git a/freetype/src/psaux/afmparse.c b/freetype/src/psaux/afmparse.c index 5f3f9e615..6a40e110d 100644 --- a/freetype/src/psaux/afmparse.c +++ b/freetype/src/psaux/afmparse.c @@ -4,7 +4,7 @@ /* */ /* AFM parser (body). */ /* */ -/* Copyright 2006-2010, 2012 by */ +/* Copyright 2006-2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,7 @@ #include <ft2build.h> #include FT_FREETYPE_H +#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_POSTSCRIPT_AUX_H #include "afmparse.h" @@ -119,7 +120,6 @@ afm_stream_read_one( AFM_Stream stream ) { char* str; - int ch; afm_stream_skip_spaces( stream ); @@ -130,7 +130,9 @@ while ( 1 ) { - ch = AFM_GETC(); + int ch = AFM_GETC(); + + if ( AFM_IS_SPACE( ch ) ) break; else if ( AFM_IS_NEWLINE( ch ) ) @@ -159,7 +161,6 @@ afm_stream_read_string( AFM_Stream stream ) { char* str; - int ch; afm_stream_skip_spaces( stream ); @@ -171,7 +172,9 @@ /* scan to eol */ while ( 1 ) { - ch = AFM_GETC(); + int ch = AFM_GETC(); + + if ( AFM_IS_NEWLINE( ch ) ) { stream->status = AFM_STREAM_STATUS_EOL; @@ -545,7 +548,7 @@ parser->FontInfo = NULL; parser->get_index = NULL; - return PSaux_Err_Ok; + return FT_Err_Ok; } @@ -572,10 +575,10 @@ { *aint = val.u.i; - return PSaux_Err_Ok; + return FT_Err_Ok; } else - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } @@ -637,7 +640,7 @@ case AFM_TOKEN_ENDKERNDATA: case AFM_TOKEN_ENDFONTMETRICS: fi->NumTrackKern = n + 1; - return PSaux_Err_Ok; + return FT_Err_Ok; case AFM_TOKEN_UNKNOWN: break; @@ -648,7 +651,7 @@ } Fail: - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } @@ -753,7 +756,7 @@ ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ), afm_compare_kern_pairs ); - return PSaux_Err_Ok; + return FT_Err_Ok; case AFM_TOKEN_UNKNOWN: break; @@ -764,7 +767,7 @@ } Fail: - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } @@ -795,7 +798,7 @@ case AFM_TOKEN_ENDKERNDATA: case AFM_TOKEN_ENDFONTMETRICS: - return PSaux_Err_Ok; + return FT_Err_Ok; case AFM_TOKEN_UNKNOWN: break; @@ -806,7 +809,7 @@ } Fail: - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } @@ -832,11 +835,11 @@ if ( token == end_section || token == AFM_TOKEN_ENDFONTMETRICS ) - return PSaux_Err_Ok; + return FT_Err_Ok; } Fail: - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } @@ -845,19 +848,19 @@ { FT_Memory memory = parser->memory; AFM_FontInfo fi = parser->FontInfo; - FT_Error error = PSaux_Err_Syntax_Error; + FT_Error error = FT_ERR( Syntax_Error ); char* key; FT_Offset len; FT_Int metrics_sets = 0; if ( !fi ) - return PSaux_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); key = afm_parser_next_key( parser, 1, &len ); if ( !key || len != 16 || ft_strncmp( key, "StartFontMetrics", 16 ) != 0 ) - return PSaux_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 ) { @@ -872,7 +875,7 @@ if ( metrics_sets != 0 && metrics_sets != 2 ) { - error = PSaux_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); goto Fail; } @@ -938,7 +941,7 @@ /* fall through since we only support kern data */ case AFM_TOKEN_ENDFONTMETRICS: - return PSaux_Err_Ok; + return FT_Err_Ok; default: break; diff --git a/freetype/src/psaux/psconv.c b/freetype/src/psaux/psconv.c index b7870c5ae..d0d8861c2 100644 --- a/freetype/src/psaux/psconv.c +++ b/freetype/src/psaux/psconv.c @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (body). */ /* */ -/* Copyright 2006, 2008, 2009, 2012 by */ +/* Copyright 2006, 2008, 2009, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -229,7 +229,7 @@ if ( integral > 0x7FFF ) have_overflow = 1; else - integral <<= 16; + integral = (FT_Fixed)( (FT_UInt32)integral << 16 ); } /* read the decimal part */ diff --git a/freetype/src/psaux/psobjs.c b/freetype/src/psaux/psobjs.c index 06df6e664..dd976d3a9 100644 --- a/freetype/src/psaux/psobjs.c +++ b/freetype/src/psaux/psobjs.c @@ -4,7 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (body). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -113,8 +113,8 @@ static FT_Error - reallocate_t1_table( PS_Table table, - FT_Long new_size ) + reallocate_t1_table( PS_Table table, + FT_Offset new_size ) { FT_Memory memory = table->memory; FT_Byte* old_base = table->block; @@ -138,7 +138,7 @@ table->capacity = new_size; - return PSaux_Err_Ok; + return FT_Err_Ok; } @@ -173,13 +173,13 @@ if ( idx < 0 || idx >= table->max_elems ) { FT_ERROR(( "ps_table_add: invalid index\n" )); - return PSaux_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } if ( length < 0 ) { FT_ERROR(( "ps_table_add: invalid length\n" )); - return PSaux_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } /* grow the base block if needed */ @@ -216,7 +216,7 @@ FT_MEM_COPY( table->block + table->cursor, object, length ); table->cursor += length; - return PSaux_Err_Ok; + return FT_Err_Ok; } @@ -341,7 +341,7 @@ { FT_Byte* cur = *acur; FT_Int embed = 0; - FT_Error error = PSaux_Err_Invalid_File_Format; + FT_Error error = FT_ERR( Invalid_File_Format ); unsigned int i; @@ -397,7 +397,7 @@ embed--; if ( embed == 0 ) { - error = PSaux_Err_Ok; + error = FT_Err_Ok; break; } } @@ -416,7 +416,7 @@ FT_Byte* limit ) { FT_Byte* cur = *acur; - FT_Error err = PSaux_Err_Ok; + FT_Error err = FT_Err_Ok; while ( ++cur < limit ) @@ -433,7 +433,7 @@ if ( cur < limit && *cur != '>' ) { FT_ERROR(( "skip_string: missing closing delimiter `>'\n" )); - err = PSaux_Err_Invalid_File_Format; + err = FT_THROW( Invalid_File_Format ); } else cur++; @@ -456,12 +456,12 @@ { FT_Byte* cur; FT_Int embed = 0; - FT_Error error = PSaux_Err_Ok; + FT_Error error = FT_Err_Ok; FT_ASSERT( **acur == '{' ); - for ( cur = *acur; cur < limit && error == PSaux_Err_Ok; ++cur ) + for ( cur = *acur; cur < limit && error == FT_Err_Ok; ++cur ) { switch ( *cur ) { @@ -494,7 +494,7 @@ end: if ( embed != 0 ) - error = PSaux_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); *acur = cur; @@ -519,7 +519,7 @@ FT_Byte* cur = parser->cursor; FT_Byte* limit = parser->limit; - FT_Error error = PSaux_Err_Ok; + FT_Error error = FT_Err_Ok; skip_spaces( &cur, limit ); /* this also skips comments */ @@ -567,7 +567,7 @@ { FT_ERROR(( "ps_parser_skip_PS_token:" " unexpected closing delimiter `>'\n" )); - error = PSaux_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } cur++; @@ -597,7 +597,7 @@ " but invalid at this point\n", *cur )); - error = PSaux_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); } parser->error = error; @@ -644,7 +644,7 @@ token->type = T1_TOKEN_TYPE_STRING; token->start = cur; - if ( skip_literal_string( &cur, limit ) == PSaux_Err_Ok ) + if ( skip_literal_string( &cur, limit ) == FT_Err_Ok ) token->limit = cur; break; @@ -653,7 +653,7 @@ token->type = T1_TOKEN_TYPE_ARRAY; token->start = cur; - if ( skip_procedure( &cur, limit ) == PSaux_Err_Ok ) + if ( skip_procedure( &cur, limit ) == FT_Err_Ok ) token->limit = cur; break; @@ -1027,12 +1027,13 @@ FT_UInt max_objects, FT_ULong* pflags ) { - T1_TokenRec token; - FT_Byte* cur; - FT_Byte* limit; - FT_UInt count; - FT_UInt idx; - FT_Error error; + T1_TokenRec token; + FT_Byte* cur; + FT_Byte* limit; + FT_UInt count; + FT_UInt idx; + FT_Error error; + T1_FieldType type; /* this also skips leading whitespace */ @@ -1045,8 +1046,10 @@ cur = token.start; limit = token.limit; + type = field->type; + /* we must detect arrays in /FontBBox */ - if ( field->type == T1_FIELD_TYPE_BBOX ) + if ( type == T1_FIELD_TYPE_BBOX ) { T1_TokenRec token2; FT_Byte* old_cur = parser->cursor; @@ -1062,17 +1065,21 @@ parser->limit = old_limit; if ( token2.type == T1_TOKEN_TYPE_ARRAY ) + { + type = T1_FIELD_TYPE_MM_BBOX; goto FieldArray; + } } else if ( token.type == T1_TOKEN_TYPE_ARRAY ) { + count = max_objects; + FieldArray: /* if this is an array and we have no blend, an error occurs */ if ( max_objects == 0 ) goto Fail; - count = max_objects; - idx = 1; + idx = 1; /* don't include delimiters */ cur++; @@ -1088,7 +1095,7 @@ skip_spaces( &cur, limit ); - switch ( field->type ) + switch ( type ) { case T1_FIELD_TYPE_BOOL: val = ps_tobool( &cur, limit ); @@ -1160,7 +1167,7 @@ " " " but found token of type %d instead\n", token.type )); - error = PSaux_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1197,7 +1204,7 @@ { FT_ERROR(( "ps_parser_load_field:" " expected four integers in bounding box\n" )); - error = PSaux_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1208,6 +1215,54 @@ } break; + case T1_FIELD_TYPE_MM_BBOX: + { + FT_Memory memory = parser->memory; + FT_Fixed* temp; + FT_Int result; + FT_UInt i; + + + if ( FT_NEW_ARRAY( temp, max_objects * 4 ) ) + goto Exit; + + for ( i = 0; i < 4; i++ ) + { + result = ps_tofixedarray( &cur, limit, max_objects, + temp + i * max_objects, 0 ); + if ( result < 0 ) + { + FT_ERROR(( "ps_parser_load_field:" + " expected %d integers in the %s subarray\n" + " " + " of /FontBBox in the /Blend dictionary\n", + max_objects, + i == 0 ? "first" + : ( i == 1 ? "second" + : ( i == 2 ? "third" + : "fourth" ) ) )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + skip_spaces( &cur, limit ); + } + + for ( i = 0; i < max_objects; i++ ) + { + FT_BBox* bbox = (FT_BBox*)objects[i]; + + + bbox->xMin = FT_RoundFix( temp[i ] ); + bbox->yMin = FT_RoundFix( temp[i + max_objects] ); + bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] ); + bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] ); + } + + FT_FREE( temp ); + } + break; + default: /* an error occurred */ goto Fail; @@ -1221,13 +1276,13 @@ FT_UNUSED( pflags ); #endif - error = PSaux_Err_Ok; + error = FT_Err_Ok; Exit: return error; Fail: - error = PSaux_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1245,7 +1300,7 @@ T1_TokenRec elements[T1_MAX_TABLE_ELEMENTS]; T1_Token token; FT_Int num_elements; - FT_Error error = PSaux_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte* old_cursor; FT_Byte* old_limit; T1_FieldRec fieldrec = *(T1_Field)field; @@ -1260,7 +1315,7 @@ T1_MAX_TABLE_ELEMENTS, &num_elements ); if ( num_elements < 0 ) { - error = PSaux_Err_Ignore; + error = FT_ERR( Ignore ); goto Exit; } if ( (FT_UInt)num_elements > field->array_max ) @@ -1317,7 +1372,7 @@ FT_Long* pnum_bytes, FT_Bool delimiters ) { - FT_Error error = PSaux_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte* cur; @@ -1332,7 +1387,7 @@ if ( *cur != '<' ) { FT_ERROR(( "ps_parser_to_bytes: Missing starting delimiter `<'\n" )); - error = PSaux_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1349,7 +1404,7 @@ if ( cur < parser->limit && *cur != '>' ) { FT_ERROR(( "ps_parser_to_bytes: Missing closing delimiter `>'\n" )); - error = PSaux_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1419,7 +1474,7 @@ FT_Byte* limit, FT_Memory memory ) { - parser->error = PSaux_Err_Ok; + parser->error = FT_Err_Ok; parser->base = base; parser->limit = limit; parser->cursor = base; @@ -1592,13 +1647,13 @@ if ( !outline ) { FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" )); - return PSaux_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); } if ( !builder->load_points ) { outline->n_contours++; - return PSaux_Err_Ok; + return FT_Err_Ok; } error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); @@ -1621,13 +1676,13 @@ FT_Pos x, FT_Pos y ) { - FT_Error error = PSaux_Err_Invalid_File_Format; + FT_Error error = FT_ERR( Invalid_File_Format ); /* test whether we are building a new contour */ if ( builder->parse_state == T1_Parse_Have_Path ) - error = PSaux_Err_Ok; + error = FT_Err_Ok; else { builder->parse_state = T1_Parse_Have_Path; diff --git a/freetype/src/psaux/t1decode.c b/freetype/src/psaux/t1decode.c index 8afe02193..6ce370bfa 100644 --- a/freetype/src/psaux/t1decode.c +++ b/freetype/src/psaux/t1decode.c @@ -4,7 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (body). */ /* */ -/* Copyright 2000-2012 by */ +/* Copyright 2000-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -205,13 +205,13 @@ if ( decoder->seac ) { FT_ERROR(( "t1operator_seac: invalid nested seac\n" )); - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } if ( decoder->builder.metrics_only ) { FT_ERROR(( "t1operator_seac: unexpected seac\n" )); - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } /* seac weirdness */ @@ -228,7 +228,7 @@ { FT_ERROR(( "t1operator_seac:" " glyph names table not available in this font\n" )); - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } #ifdef FT_CONFIG_OPTION_INCREMENTAL @@ -249,7 +249,7 @@ { FT_ERROR(( "t1operator_seac:" " invalid seac character code arguments\n" )); - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); } /* if we are trying to load a composite glyph, do not load the */ @@ -415,7 +415,7 @@ limit = zone->limit = charstring_base + charstring_len; ip = zone->cursor = zone->base; - error = PSaux_Err_Ok; + error = FT_Err_Ok; x = orig_x = builder->pos_x; y = orig_y = builder->pos_y; @@ -565,10 +565,10 @@ goto Syntax_Error; } - value = (FT_Int32)( ( (FT_Long)ip[0] << 24 ) | - ( (FT_Long)ip[1] << 16 ) | - ( (FT_Long)ip[2] << 8 ) | - ip[3] ); + value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); ip += 4; /* According to the specification, values > 32000 or < -32000 must */ @@ -591,7 +591,7 @@ else { if ( !large_int ) - value <<= 16; + value = (FT_Int32)( (FT_UInt32)value << 16 ); } break; @@ -611,13 +611,13 @@ } if ( ip[-2] < 251 ) - value = ( ( (FT_Int32)ip[-2] - 247 ) << 8 ) + ip[-1] + 108; + value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108; else - value = -( ( ( (FT_Int32)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 ); + value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 ); } if ( !large_int ) - value <<= 16; + value = (FT_Int32)( (FT_UInt32)value << 16 ); } else { @@ -756,9 +756,9 @@ decoder->flex_state = 1; decoder->num_flex_vectors = 0; if ( ( error = t1_builder_start_point( builder, x, y ) ) - != PSaux_Err_Ok || + != FT_Err_Ok || ( error = t1_builder_check_points( builder, 6 ) ) - != PSaux_Err_Ok ) + != FT_Err_Ok ) goto Fail; break; @@ -1129,7 +1129,7 @@ FT_TRACE4(( "\n" )); /* return now! */ - return PSaux_Err_Ok; + return FT_Err_Ok; case op_hsbw: FT_TRACE4(( " hsbw" )); @@ -1149,7 +1149,7 @@ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) - return PSaux_Err_Ok; + return FT_Err_Ok; break; @@ -1178,7 +1178,7 @@ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) - return PSaux_Err_Ok; + return FT_Err_Ok; break; @@ -1197,7 +1197,7 @@ FT_TRACE4(( " hlineto" )); if ( ( error = t1_builder_start_point( builder, x, y ) ) - != PSaux_Err_Ok ) + != FT_Err_Ok ) goto Fail; x += top[0]; @@ -1219,9 +1219,9 @@ FT_TRACE4(( " hvcurveto" )); if ( ( error = t1_builder_start_point( builder, x, y ) ) - != PSaux_Err_Ok || + != FT_Err_Ok || ( error = t1_builder_check_points( builder, 3 ) ) - != PSaux_Err_Ok ) + != FT_Err_Ok ) goto Fail; x += top[0]; @@ -1237,7 +1237,7 @@ FT_TRACE4(( " rlineto" )); if ( ( error = t1_builder_start_point( builder, x, y ) ) - != PSaux_Err_Ok ) + != FT_Err_Ok ) goto Fail; x += top[0]; @@ -1245,7 +1245,7 @@ Add_Line: if ( ( error = t1_builder_add_point1( builder, x, y ) ) - != PSaux_Err_Ok ) + != FT_Err_Ok ) goto Fail; break; @@ -1266,9 +1266,9 @@ FT_TRACE4(( " rrcurveto" )); if ( ( error = t1_builder_start_point( builder, x, y ) ) - != PSaux_Err_Ok || + != FT_Err_Ok || ( error = t1_builder_check_points( builder, 3 ) ) - != PSaux_Err_Ok ) + != FT_Err_Ok ) goto Fail; x += top[0]; @@ -1288,9 +1288,9 @@ FT_TRACE4(( " vhcurveto" )); if ( ( error = t1_builder_start_point( builder, x, y ) ) - != PSaux_Err_Ok || + != FT_Err_Ok || ( error = t1_builder_check_points( builder, 3 ) ) - != PSaux_Err_Ok ) + != FT_Err_Ok ) goto Fail; y += top[0]; @@ -1306,7 +1306,7 @@ FT_TRACE4(( " vlineto" )); if ( ( error = t1_builder_start_point( builder, x, y ) ) - != PSaux_Err_Ok ) + != FT_Err_Ok ) goto Fail; y += top[0]; @@ -1545,10 +1545,10 @@ return error; Syntax_Error: - return PSaux_Err_Syntax_Error; + return FT_THROW( Syntax_Error ); Stack_Underflow: - return PSaux_Err_Stack_Underflow; + return FT_THROW( Stack_Underflow ); } @@ -1585,7 +1585,7 @@ { FT_ERROR(( "t1_decoder_init:" " the `psnames' module is not available\n" )); - return PSaux_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); } decoder->psnames = psnames; @@ -1605,7 +1605,7 @@ decoder->funcs = t1_decoder_funcs; - return PSaux_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/pshinter/pshalgo.c b/freetype/src/pshinter/pshalgo.c index f4fbb4d35..343472ddb 100644 --- a/freetype/src/pshinter/pshalgo.c +++ b/freetype/src/pshinter/pshalgo.c @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (body). */ /* */ -/* Copyright 2001-2010, 2012 by */ +/* Copyright 2001-2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -401,13 +401,13 @@ FT_Fixed delta, FT_Int dimension ) { - PSH_Hint hint; - FT_UInt count; + FT_UInt count; for ( count = 0; count < table->max_hints; count++ ) { - hint = table->hints + count; + PSH_Hint hint = table->hints + count; + hint->cur_pos = FT_MulFix( hint->org_pos, scale ) + delta; hint->cur_len = FT_MulFix( hint->org_len, scale ); @@ -1161,8 +1161,8 @@ int result = PSH_DIR_NONE; - ax = ( dx >= 0 ) ? dx : -dx; - ay = ( dy >= 0 ) ? dy : -dy; + ax = FT_ABS( dx ); + ay = FT_ABS( dy ); if ( ay * 12 < ax ) { @@ -2193,7 +2193,7 @@ /* something to do? */ if ( outline->n_points == 0 || outline->n_contours == 0 ) - return PSH_Err_Ok; + return FT_Err_Ok; #ifdef DEBUG_HINTER diff --git a/freetype/src/pshinter/pshalgo.h b/freetype/src/pshinter/pshalgo.h index 1a248a705..c70f31ea9 100644 --- a/freetype/src/pshinter/pshalgo.h +++ b/freetype/src/pshinter/pshalgo.h @@ -4,7 +4,7 @@ /* */ /* PostScript hinting algorithm (specification). */ /* */ -/* Copyright 2001, 2002, 2003, 2008 by */ +/* Copyright 2001-2003, 2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,7 +22,6 @@ #include "pshrec.h" #include "pshglob.h" -#include FT_TRIGONOMETRY_H FT_BEGIN_HEADER @@ -168,8 +167,6 @@ FT_BEGIN_HEADER FT_UInt flags2; FT_Char dir_in; FT_Char dir_out; - FT_Angle angle_in; - FT_Angle angle_out; PSH_Hint hint; FT_Pos org_u; FT_Pos org_v; @@ -186,12 +183,6 @@ FT_BEGIN_HEADER } PSH_PointRec; -#define PSH_POINT_EQUAL_ORG( a, b ) ( (a)->org_u == (b)->org_u && \ - (a)->org_v == (b)->org_v ) - -#define PSH_POINT_ANGLE( a, b ) FT_Atan2( (b)->org_u - (a)->org_u, \ - (b)->org_v - (a)->org_v ) - typedef struct PSH_ContourRec_ { PSH_Point start; diff --git a/freetype/src/pshinter/pshpic.c b/freetype/src/pshinter/pshpic.c index bf7f2009d..568f4ac4b 100644 --- a/freetype/src/pshinter/pshpic.c +++ b/freetype/src/pshinter/pshpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009, 2010, 2012 by */ +/* Copyright 2009, 2010, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -49,13 +49,13 @@ pshinter_module_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; PSHinterPIC* container = NULL; FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->pshinter = container; @@ -64,8 +64,9 @@ FT_Init_Class_pshinter_interface( library, &container->pshinter_interface ); - if( error ) + if ( error ) pshinter_module_class_pic_free( library ); + return error; } diff --git a/freetype/src/pshinter/pshpic.h b/freetype/src/pshinter/pshpic.h index 62abf322c..b46f85311 100644 --- a/freetype/src/pshinter/pshpic.h +++ b/freetype/src/pshinter/pshpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009, 2012 by */ +/* Copyright 2009, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -40,7 +40,7 @@ FT_BEGIN_HEADER } PSHinterPIC; -#define GET_PIC( lib ) ( (PSHinterPIC*)((lib)->pic_container.autofit) ) +#define GET_PIC( lib ) ( (PSHinterPIC*)( (lib)->pic_container.pshinter ) ) #define PSHINTER_INTERFACE_GET ( GET_PIC( library )->pshinter_interface ) diff --git a/freetype/src/pshinter/pshrec.c b/freetype/src/pshinter/pshrec.c index 0910cc5e6..cd66ea869 100644 --- a/freetype/src/pshinter/pshrec.c +++ b/freetype/src/pshinter/pshrec.c @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript hints recorder (body). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2007, 2009 by */ +/* Copyright 2001-2004, 2007, 2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -64,7 +64,7 @@ { FT_UInt old_max = table->max_hints; FT_UInt new_max = count; - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; if ( new_max > old_max ) @@ -83,7 +83,7 @@ FT_Memory memory, PS_Hint *ahint ) { - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UInt count; PS_Hint hint = 0; @@ -139,7 +139,7 @@ { FT_UInt old_max = ( mask->max_bits + 7 ) >> 3; FT_UInt new_max = ( count + 7 ) >> 3; - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; if ( new_max > old_max ) @@ -186,7 +186,7 @@ FT_Int idx, FT_Memory memory ) { - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte* p; @@ -236,7 +236,7 @@ { FT_UInt old_max = table->max_masks; FT_UInt new_max = count; - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; if ( new_max > old_max ) @@ -256,7 +256,7 @@ PS_Mask *amask ) { FT_UInt count; - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; PS_Mask mask = 0; @@ -287,7 +287,7 @@ FT_Memory memory, PS_Mask *amask ) { - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UInt count; PS_Mask mask; @@ -316,7 +316,7 @@ FT_UInt bit_count, FT_Memory memory ) { - FT_Error error = PSH_Err_Ok; + FT_Error error; PS_Mask mask; @@ -384,7 +384,7 @@ FT_UInt count; - count = ( count1 <= count2 ) ? count1 : count2; + count = FT_MIN( count1, count2 ); for ( ; count >= 8; count -= 8 ) { if ( p1[0] & p2[0] ) @@ -409,7 +409,7 @@ FT_Memory memory ) { FT_UInt temp; - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; /* swap index1 and index2 so that index1 < index2 */ @@ -499,7 +499,7 @@ FT_Memory memory ) { FT_Int index1, index2; - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; for ( index1 = table->num_masks - 1; index1 > 0; index1-- ) @@ -561,7 +561,7 @@ FT_Memory memory ) { PS_Mask mask; - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; /* get last hint mask */ @@ -583,12 +583,13 @@ FT_UInt end_point ) { FT_UInt count = dim->masks.num_masks; - PS_Mask mask; if ( count > 0 ) { - mask = dim->masks.masks + count - 1; + PS_Mask mask = dim->masks.masks + count - 1; + + mask->end_point = end_point; } } @@ -621,7 +622,7 @@ FT_UInt end_point, FT_Memory memory ) { - FT_Error error = PSH_Err_Ok; + FT_Error error; /* reset current mask, if any */ @@ -646,7 +647,7 @@ FT_Memory memory, FT_Int *aindex ) { - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UInt flags = 0; @@ -717,7 +718,7 @@ FT_Int hint3, FT_Memory memory ) { - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UInt count = dim->counters.num_masks; PS_Mask counter = dim->counters.masks; @@ -791,7 +792,7 @@ ps_dimension_done( &hints->dimension[0], memory ); ps_dimension_done( &hints->dimension[1], memory ); - hints->error = PSH_Err_Ok; + hints->error = FT_Err_Ok; hints->memory = 0; } @@ -802,7 +803,7 @@ { FT_MEM_ZERO( hints, sizeof ( *hints ) ); hints->memory = memory; - return PSH_Err_Ok; + return FT_Err_Ok; } @@ -815,7 +816,7 @@ { case PS_HINT_TYPE_1: case PS_HINT_TYPE_2: - hints->error = PSH_Err_Ok; + hints->error = FT_Err_Ok; hints->hint_type = hint_type; ps_dimension_init( &hints->dimension[0] ); @@ -823,7 +824,7 @@ break; default: - hints->error = PSH_Err_Invalid_Argument; + hints->error = FT_THROW( Invalid_Argument ); hints->hint_type = hint_type; FT_TRACE0(( "ps_hints_open: invalid charstring type\n" )); @@ -894,7 +895,7 @@ FT_Int dimension, FT_Fixed* stems ) { - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; if ( !hints->error ) @@ -938,7 +939,7 @@ else { FT_ERROR(( "ps_hints_t1stem3: called with invalid hint type\n" )); - error = PSH_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Fail; } } @@ -956,7 +957,7 @@ ps_hints_t1reset( PS_Hints hints, FT_UInt end_point ) { - FT_Error error = PSH_Err_Ok; + FT_Error error = FT_Err_Ok; if ( !hints->error ) @@ -979,7 +980,7 @@ else { /* invalid hint type */ - error = PSH_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Fail; } } diff --git a/freetype/src/psnames/psmodule.c b/freetype/src/psnames/psmodule.c index cae60ef47..0a5bcb7d2 100644 --- a/freetype/src/psnames/psmodule.c +++ b/freetype/src/psnames/psmodule.c @@ -4,7 +4,7 @@ /* */ /* PSNames module implementation (body). */ /* */ -/* Copyright 1996-2003, 2005-2008, 2012 by */ +/* Copyright 1996-2003, 2005-2008, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,7 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H #include FT_SERVICE_POSTSCRIPT_CMAPS_H @@ -369,7 +370,7 @@ /* No unicode chars here! */ FT_FREE( table->maps ); if ( !error ) - error = PSnames_Err_No_Unicode_Glyph_Name; + error = FT_THROW( No_Unicode_Glyph_Name ); } else { @@ -377,7 +378,7 @@ if ( count < num_glyphs / 2 ) { (void)FT_RENEW_ARRAY( table->maps, num_glyphs, count ); - error = PSnames_Err_Ok; + error = FT_Err_Ok; } /* Sort the table in increasing order of unicode values, */ diff --git a/freetype/src/psnames/pspic.c b/freetype/src/psnames/pspic.c index dc5374b0b..3820f65a7 100644 --- a/freetype/src/psnames/pspic.c +++ b/freetype/src/psnames/pspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009, 2010, 2012 by */ +/* Copyright 2009, 2010, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -64,13 +64,13 @@ psnames_module_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = PSnames_Err_Ok; + FT_Error error = FT_Err_Ok; PSModulePIC* container = NULL; FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->psnames = container; diff --git a/freetype/src/raster/ftraster.c b/freetype/src/raster/ftraster.c index 7d5bcaef5..bbd503d97 100644 --- a/freetype/src/raster/ftraster.c +++ b/freetype/src/raster/ftraster.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2003, 2005, 2007-2012 by */ +/* Copyright 1996-2003, 2005, 2007-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -179,6 +179,9 @@ #ifdef _STANDALONE_ + /* Auxiliary macros for token concatenation. */ +#define FT_ERR_XCAT( x, y ) x ## y +#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) /* This macro is used to indicate that a function parameter is unused. */ /* Its purpose is simply to reduce compiler warnings. Note also that */ @@ -187,7 +190,7 @@ #define FT_UNUSED( x ) (x) = (x) /* Disable the tracing mechanism for simplicity -- developers can */ - /* activate it easily by redefining these two macros. */ + /* activate it easily by redefining these macros. */ #ifndef FT_ERROR #define FT_ERROR( x ) do { } while ( 0 ) /* nothing */ #endif @@ -198,6 +201,10 @@ #define FT_TRACE6( x ) do { } while ( 0 ) /* nothing */ #endif +#ifndef FT_THROW +#define FT_THROW( e ) FT_ERR_CAT( Raster_Err_, e ) +#endif + #define Raster_Err_None 0 #define Raster_Err_Not_Ini -1 #define Raster_Err_Overflow -2 @@ -224,11 +231,11 @@ #include FT_INTERNAL_OBJECTS_H -#include FT_INTERNAL_DEBUG_H /* for FT_TRACE() and FT_ERROR() */ +#include FT_INTERNAL_DEBUG_H /* for FT_TRACE, FT_ERROR, and FT_THROW */ #include "rasterrs.h" -#define Raster_Err_None Raster_Err_Ok +#define Raster_Err_None FT_Err_Ok #define Raster_Err_Not_Ini Raster_Err_Raster_Uninitialized #define Raster_Err_Overflow Raster_Err_Raster_Overflow #define Raster_Err_Neg_Height Raster_Err_Raster_Negative_Height @@ -303,6 +310,7 @@ typedef short Short; typedef unsigned short UShort, *PUShort; typedef long Long, *PLong; + typedef unsigned long ULong; typedef unsigned char Byte, *PByte; typedef char Bool; @@ -441,12 +449,14 @@ #define FLOOR( x ) ( (x) & -ras.precision ) #define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision ) -#define TRUNC( x ) ( (signed long)(x) >> ras.precision_bits ) +#define TRUNC( x ) ( (Long)(x) >> ras.precision_bits ) #define FRAC( x ) ( (x) & ( ras.precision - 1 ) ) -#define SCALED( x ) ( ( (x) << ras.scale_shift ) - ras.precision_half ) +#define SCALED( x ) ( ( (ULong)(x) << ras.scale_shift ) - ras.precision_half ) -#define IS_BOTTOM_OVERSHOOT( x ) ( CEILING( x ) - x >= ras.precision_half ) -#define IS_TOP_OVERSHOOT( x ) ( x - FLOOR( x ) >= ras.precision_half ) +#define IS_BOTTOM_OVERSHOOT( x ) \ + (Bool)( CEILING( x ) - x >= ras.precision_half ) +#define IS_TOP_OVERSHOOT( x ) \ + (Bool)( x - FLOOR( x ) >= ras.precision_half ) /* The most used variables are positioned at the top of the structure. */ /* Thus, their offset can be coded with less opcodes, resulting in a */ @@ -655,7 +665,7 @@ /* Set precision variables according to param flag. */ /* */ /* <Input> */ - /* High :: Set to True for high precision (typically for ppem < 18), */ + /* High :: Set to True for high precision (typically for ppem < 24), */ /* false otherwise. */ /* */ static void @@ -735,7 +745,7 @@ if ( ras.top >= ras.maxBuff ) { - ras.error = Raster_Err_Overflow; + ras.error = FT_THROW( Overflow ); return FAILURE; } @@ -765,7 +775,7 @@ default: FT_ERROR(( "New_Profile: invalid profile direction\n" )); - ras.error = Raster_Err_Invalid; + ras.error = FT_THROW( Invalid ); return FAILURE; } @@ -798,8 +808,7 @@ static Bool End_Profile( RAS_ARGS Bool overshoot ) { - Long h; - PProfile oldProfile; + Long h; h = (Long)( ras.top - ras.cProfile->offset ); @@ -807,12 +816,15 @@ if ( h < 0 ) { FT_ERROR(( "End_Profile: negative height encountered\n" )); - ras.error = Raster_Err_Neg_Height; + ras.error = FT_THROW( Neg_Height ); return FAILURE; } if ( h > 0 ) { + PProfile oldProfile; + + FT_TRACE6(( "Ending profile %p, start = %ld, height = %ld\n", ras.cProfile, ras.cProfile->start, h )); @@ -840,7 +852,7 @@ if ( ras.top >= ras.maxBuff ) { FT_TRACE1(( "overflow in End_Profile\n" )); - ras.error = Raster_Err_Overflow; + ras.error = FT_THROW( Overflow ); return FAILURE; } @@ -869,7 +881,7 @@ Insert_Y_Turn( RAS_ARGS Int y ) { PLong y_turns; - Int y2, n; + Int n; n = ras.numTurns - 1; @@ -883,7 +895,9 @@ if ( n >= 0 && y > y_turns[n] ) while ( n >= 0 ) { - y2 = (Int)y_turns[n]; + Int y2 = (Int)y_turns[n]; + + y_turns[n] = y; y = y2; n--; @@ -894,7 +908,7 @@ ras.maxBuff--; if ( ras.maxBuff <= ras.top ) { - ras.error = Raster_Err_Overflow; + ras.error = FT_THROW( Overflow ); return FAILURE; } ras.numTurns++; @@ -919,7 +933,6 @@ static Bool Finalize_Profile_Table( RAS_ARG ) { - Int bottom, top; UShort n; PProfile p; @@ -931,6 +944,9 @@ { while ( n > 0 ) { + Int bottom, top; + + if ( n > 1 ) p->link = (PProfile)( p->offset + p->height ); else @@ -1145,7 +1161,7 @@ size = e2 - e1 + 1; if ( ras.top + size >= ras.maxBuff ) { - ras.error = Raster_Err_Overflow; + ras.error = FT_THROW( Overflow ); return FAILURE; } @@ -1320,7 +1336,7 @@ if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff ) { ras.top = top; - ras.error = Raster_Err_Overflow; + ras.error = FT_THROW( Overflow ); return FAILURE; } @@ -1995,7 +2011,7 @@ return SUCCESS; Invalid_Outline: - ras.error = Raster_Err_Invalid; + ras.error = FT_THROW( Invalid ); Fail: return FAILURE; @@ -2024,8 +2040,6 @@ int i; unsigned start; - PProfile lastProfile; - ras.fProfile = NULL; ras.joint = FALSE; @@ -2043,7 +2057,8 @@ for ( i = 0; i < ras.outline.n_contours; i++ ) { - Bool o; + PProfile lastProfile; + Bool o; ras.state = Unknown_State; @@ -2267,8 +2282,6 @@ PProfile right ) { Long e1, e2; - int c1, c2; - Byte f1, f2; Byte* target; FT_UNUSED( y ); @@ -2287,6 +2300,10 @@ if ( e2 >= 0 && e1 < ras.bWidth ) { + int c1, c2; + Byte f1, f2; + + if ( e1 < 0 ) e1 = 0; if ( e2 >= ras.bWidth ) @@ -2510,21 +2527,24 @@ PProfile left, PProfile right ) { - Long e1, e2; - PByte bits; - Byte f1; - FT_UNUSED( left ); FT_UNUSED( right ); if ( x2 - x1 < ras.precision ) { + Long e1, e2; + + e1 = CEILING( x1 ); e2 = FLOOR ( x2 ); if ( e1 == e2 ) { + Byte f1; + PByte bits; + + bits = ras.bTarget + ( y >> 3 ); f1 = (Byte)( 0x80 >> ( y & 7 ) ); @@ -2721,8 +2741,6 @@ static void Vertical_Gray_Sweep_Step( RAS_ARG ) { - Int c1, c2; - PByte pix, bit, bit2; short* count = (short*)count_table; Byte* grays; @@ -2731,6 +2749,9 @@ if ( ras.traceOfs > ras.gray_width ) { + PByte pix; + + pix = ras.gTarget + ras.traceG + ras.gray_min_x * 4; grays = ras.grays; @@ -2741,6 +2762,9 @@ Int last_bit = last_pixel & 3; Bool over = 0; + Int c1, c2; + PByte bit, bit2; + if ( ras.gray_max_x >= last_cell && last_bit != 3 ) { @@ -2833,7 +2857,6 @@ { Long e1, e2; PByte pixel; - Byte color; /* During the horizontal sweep, we only take care of drop-outs */ @@ -2887,6 +2910,9 @@ if ( e1 >= 0 ) { + Byte color; + + if ( x2 - x1 >= ras.precision_half ) color = ras.grays[2]; else @@ -2964,7 +2990,7 @@ /* check the Y-turns */ if ( ras.numTurns == 0 ) { - ras.error = Raster_Err_Invalid; + ras.error = FT_THROW( Invalid ); return FAILURE; } @@ -3205,7 +3231,7 @@ if ( ras.band_top >= 7 || k < i ) { ras.band_top = 0; - ras.error = Raster_Err_Invalid; + ras.error = FT_THROW( Invalid ); return ras.error; } @@ -3394,7 +3420,7 @@ { FT_UNUSED_RASTER; - return Raster_Err_Unsupported; + return FT_THROW( Unsupported ); } #endif /* !FT_RASTER_OPTION_ANTI_ALIASING */ @@ -3499,7 +3525,8 @@ raster->buffer = pool_base + ( ( sizeof ( *worker ) + 7 ) & ~7 ); - raster->buffer_size = pool_base + pool_size - (char*)raster->buffer; + raster->buffer_size = (long)( pool_base + pool_size - + (char*)raster->buffer ); raster->worker = worker; } else @@ -3549,37 +3576,37 @@ if ( !raster || !raster->buffer || !raster->buffer_size ) - return Raster_Err_Not_Ini; + return FT_THROW( Not_Ini ); if ( !outline ) - return Raster_Err_Invalid; + return FT_THROW( Invalid ); /* return immediately if the outline is empty */ if ( outline->n_points == 0 || outline->n_contours <= 0 ) return Raster_Err_None; if ( !outline->contours || !outline->points ) - return Raster_Err_Invalid; + return FT_THROW( Invalid ); if ( outline->n_points != outline->contours[outline->n_contours - 1] + 1 ) - return Raster_Err_Invalid; + return FT_THROW( Invalid ); worker = raster->worker; /* this version of the raster does not support direct rendering, sorry */ if ( params->flags & FT_RASTER_FLAG_DIRECT ) - return Raster_Err_Unsupported; + return FT_THROW( Unsupported ); if ( !target_map ) - return Raster_Err_Invalid; + return FT_THROW( Invalid ); /* nothing to do */ if ( !target_map->width || !target_map->rows ) return Raster_Err_None; if ( !target_map->buffer ) - return Raster_Err_Invalid; + return FT_THROW( Invalid ); ras.outline = *outline; ras.target = *target_map; diff --git a/freetype/src/raster/ftrend1.c b/freetype/src/raster/ftrend1.c index 859cb7d86..aa7f6d566 100644 --- a/freetype/src/raster/ftrend1.c +++ b/freetype/src/raster/ftrend1.c @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (body). */ /* */ -/* Copyright 1996-2003, 2005, 2006, 2011 by */ +/* Copyright 1996-2003, 2005, 2006, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +17,7 @@ #include <ft2build.h> +#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_OBJECTS_H #include FT_OUTLINE_H #include "ftrend1.h" @@ -37,7 +38,7 @@ library->raster_pool, library->raster_pool_size ); - return Raster_Err_Ok; + return FT_Err_Ok; } @@ -61,12 +62,12 @@ const FT_Matrix* matrix, const FT_Vector* delta ) { - FT_Error error = Raster_Err_Ok; + FT_Error error = FT_Err_Ok; if ( slot->format != render->glyph_format ) { - error = Raster_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -114,7 +115,7 @@ /* check glyph image format */ if ( slot->format != render->glyph_format ) { - error = Raster_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -124,13 +125,13 @@ { /* raster1 is only capable of producing monochrome bitmaps */ if ( render->clazz == &ft_raster1_renderer_class ) - return Raster_Err_Cannot_Render_Glyph; + return FT_THROW( Cannot_Render_Glyph ); } else { /* raster5 is only capable of producing 5-gray-levels bitmaps */ if ( render->clazz == &ft_raster5_renderer_class ) - return Raster_Err_Cannot_Render_Glyph; + return FT_THROW( Cannot_Render_Glyph ); } #else /* FT_CONFIG_OPTION_PIC */ /* When PIC is enabled, we cannot get to the class object */ @@ -142,13 +143,13 @@ { /* raster1 is only capable of producing monochrome bitmaps */ if ( render->clazz->root.module_name[6] == '1' ) - return Raster_Err_Cannot_Render_Glyph; + return FT_THROW( Cannot_Render_Glyph ); } else { /* raster5 is only capable of producing 5-gray-levels bitmaps */ if ( render->clazz->root.module_name[6] == '5' ) - return Raster_Err_Cannot_Render_Glyph; + return FT_THROW( Cannot_Render_Glyph ); } #endif /* FT_CONFIG_OPTION_PIC */ @@ -179,7 +180,7 @@ if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) { - error = Raster_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } diff --git a/freetype/src/raster/rastpic.c b/freetype/src/raster/rastpic.c index 853286309..5e9f7cc9c 100644 --- a/freetype/src/raster/rastpic.c +++ b/freetype/src/raster/rastpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009, 2010, 2012 by */ +/* Copyright 2009, 2010, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,22 +22,26 @@ #include "rastpic.h" #include "rasterrs.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ftraster.c */ void FT_Init_Class_ft_standard_raster( FT_Raster_Funcs* funcs ); + void ft_raster1_renderer_class_pic_free( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_Memory memory = library->memory; if ( pic_container->raster ) { - RasterPIC* container = (RasterPIC*)pic_container->raster; + RasterPIC* container = (RasterPIC*)pic_container->raster; + + if ( --container->ref_count ) return; FT_FREE( container ); @@ -49,14 +53,14 @@ FT_Error ft_raster1_renderer_class_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = Raster_Err_Ok; - RasterPIC* container = NULL; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Error error = FT_Err_Ok; + RasterPIC* container = NULL; + FT_Memory memory = library->memory; - /* since this function also serve raster5 renderer, - it implements reference counting */ + /* since this function also serves raster5 renderer, */ + /* it implements reference counting */ if ( pic_container->raster ) { ((RasterPIC*)pic_container->raster)->ref_count++; @@ -68,16 +72,17 @@ return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->raster = container; + container->ref_count = 1; - /* initialize pointer table - this is how the module usually expects this data */ + /* initialize pointer table - */ + /* this is how the module usually expects this data */ FT_Init_Class_ft_standard_raster( &container->ft_standard_raster ); -/*Exit:*/ - if( error ) - ft_raster1_renderer_class_pic_free( library ); + return error; } + /* re-route these init and free functions to the above functions */ FT_Error ft_raster5_renderer_class_pic_init( FT_Library library ) @@ -85,6 +90,7 @@ return ft_raster1_renderer_class_pic_init( library ); } + void ft_raster5_renderer_class_pic_free( FT_Library library ) { diff --git a/freetype/src/raster/rastpic.h b/freetype/src/raster/rastpic.h index 7822a24b4..e0ddba624 100644 --- a/freetype/src/raster/rastpic.h +++ b/freetype/src/raster/rastpic.h @@ -24,19 +24,25 @@ FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H + #ifndef FT_CONFIG_OPTION_PIC -#define FT_STANDARD_RASTER_GET ft_standard_raster + +#define FT_STANDARD_RASTER_GET ft_standard_raster #else /* FT_CONFIG_OPTION_PIC */ - typedef struct RasterPIC_ + typedef struct RasterPIC_ { - int ref_count; - FT_Raster_Funcs ft_standard_raster; + int ref_count; + FT_Raster_Funcs ft_standard_raster; + } RasterPIC; -#define GET_PIC(lib) ((RasterPIC*)((lib)->pic_container.raster)) -#define FT_STANDARD_RASTER_GET (GET_PIC(library)->ft_standard_raster) + +#define GET_PIC( lib ) \ + ( (RasterPIC*)( (lib)->pic_container.raster ) ) +#define FT_STANDARD_RASTER_GET ( GET_PIC( library )->ft_standard_raster ) + /* see rastpic.c for the implementation */ void diff --git a/freetype/src/sfnt/pngshim.c b/freetype/src/sfnt/pngshim.c new file mode 100644 index 000000000..408f879c3 --- /dev/null +++ b/freetype/src/sfnt/pngshim.c @@ -0,0 +1,336 @@ +/***************************************************************************/ +/* */ +/* pngshim.c */ +/* */ +/* PNG Bitmap glyph support. */ +/* */ +/* Copyright 2013 by Google, Inc. */ +/* Written by Stuart Gill and Behdad Esfahbod. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + + +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_STREAM_H +#include FT_TRUETYPE_TAGS_H +#include FT_CONFIG_STANDARD_LIBRARY_H + + +#ifdef FT_CONFIG_OPTION_USE_PNG + + /* We always include <stjmp.h>, so make libpng shut up! */ +#define PNG_SKIP_SETJMP_CHECK 1 +#include <png.h> +#include "pngshim.h" + +#include "sferrors.h" + + + /* This code is freely based on cairo-png.c. There's so many ways */ + /* to call libpng, and the way cairo does it is defacto standard. */ + + static int + multiply_alpha( int alpha, + int color ) + { + int temp = ( alpha * color ) + 0x80; + + + return ( temp + ( temp >> 8 ) ) >> 8; + } + + + /* Premultiplies data and converts RGBA bytes => native endian. */ + static void + premultiply_data( png_structp png, + png_row_infop row_info, + png_bytep data ) + { + unsigned int i; + + FT_UNUSED( png ); + + + for ( i = 0; i < row_info->rowbytes; i += 4 ) + { + unsigned char* base = &data[i]; + unsigned int alpha = base[3]; + + + if ( alpha == 0 ) + base[0] = base[1] = base[2] = base[3] = 0; + + else + { + unsigned int red = base[0]; + unsigned int green = base[1]; + unsigned int blue = base[2]; + + + if ( alpha != 0xFF ) + { + red = multiply_alpha( alpha, red ); + green = multiply_alpha( alpha, green ); + blue = multiply_alpha( alpha, blue ); + } + + base[0] = blue; + base[1] = green; + base[2] = red; + base[3] = alpha; + } + } + } + + + /* Converts RGBx bytes to BGRA. */ + static void + convert_bytes_to_data( png_structp png, + png_row_infop row_info, + png_bytep data ) + { + unsigned int i; + + FT_UNUSED( png ); + + + for ( i = 0; i < row_info->rowbytes; i += 4 ) + { + unsigned char* base = &data[i]; + unsigned int red = base[0]; + unsigned int green = base[1]; + unsigned int blue = base[2]; + + + base[0] = blue; + base[1] = green; + base[2] = red; + base[3] = 0xFF; + } + } + + + /* Use error callback to avoid png writing to stderr. */ + static void + error_callback( png_structp png, + png_const_charp error_msg ) + { + FT_Error* error = png_get_error_ptr( png ); + + FT_UNUSED( error_msg ); + + + *error = FT_THROW( Out_Of_Memory ); +#ifdef PNG_SETJMP_SUPPORTED + longjmp( png_jmpbuf( png ), 1 ); +#endif + /* if we get here, then we have no choice but to abort ... */ + } + + + /* Use warning callback to avoid png writing to stderr. */ + static void + warning_callback( png_structp png, + png_const_charp error_msg ) + { + FT_UNUSED( png ); + FT_UNUSED( error_msg ); + + /* Just ignore warnings. */ + } + + + static void + read_data_from_FT_Stream( png_structp png, + png_bytep data, + png_size_t length ) + { + FT_Error error; + png_voidp p = png_get_io_ptr( png ); + FT_Stream stream = (FT_Stream)p; + + + if ( FT_FRAME_ENTER( length ) ) + { + FT_Error* e = png_get_error_ptr( png ); + + + *e = FT_THROW( Invalid_Stream_Read ); + png_error( png, NULL ); + + return; + } + + memcpy( data, stream->cursor, length ); + + FT_FRAME_EXIT(); + } + + + static FT_Error + Load_SBit_Png( FT_Bitmap* map, + FT_Int x_offset, + FT_Int y_offset, + FT_Int pix_bits, + TT_SBit_Metrics metrics, + FT_Memory memory, + FT_Byte* data, + FT_UInt png_len ) + { + FT_Error error = FT_Err_Ok; + FT_StreamRec stream; + + png_structp png; + png_infop info; + png_uint_32 imgWidth, imgHeight; + + int bitdepth, color_type, interlace; + FT_Int i; + png_byte* *rows; + + + if ( x_offset < 0 || x_offset + metrics->width > map->width || + y_offset < 0 || y_offset + metrics->height > map->rows || + pix_bits != 32 || map->pixel_mode != FT_PIXEL_MODE_BGRA ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + } + + FT_Stream_OpenMemory( &stream, data, png_len ); + + png = png_create_read_struct( PNG_LIBPNG_VER_STRING, + &error, + error_callback, + warning_callback ); + if ( !png ) + { + error = FT_THROW( Out_Of_Memory ); + goto Exit; + } + + info = png_create_info_struct( png ); + if ( !info ) + { + error = FT_THROW( Out_Of_Memory ); + png_destroy_read_struct( &png, NULL, NULL ); + goto Exit; + } + + if ( ft_setjmp( png_jmpbuf( png ) ) ) + { + error = FT_THROW( Invalid_File_Format ); + goto DestroyExit; + } + + png_set_read_fn( png, &stream, read_data_from_FT_Stream ); + + png_read_info( png, info ); + png_get_IHDR( png, info, + &imgWidth, &imgHeight, + &bitdepth, &color_type, &interlace, + NULL, NULL ); + + if ( error != FT_Err_Ok || + (FT_Int)imgWidth != metrics->width || + (FT_Int)imgHeight != metrics->height ) + goto DestroyExit; + + /* convert palette/gray image to rgb */ + if ( color_type == PNG_COLOR_TYPE_PALETTE ) + png_set_palette_to_rgb( png ); + + /* expand gray bit depth if needed */ + if ( color_type == PNG_COLOR_TYPE_GRAY ) + { +#if PNG_LIBPNG_VER >= 10209 + png_set_expand_gray_1_2_4_to_8( png ); +#else + png_set_gray_1_2_4_to_8( png ); +#endif + } + + /* transform transparency to alpha */ + if ( png_get_valid(png, info, PNG_INFO_tRNS ) ) + png_set_tRNS_to_alpha( png ); + + if ( bitdepth == 16 ) + png_set_strip_16( png ); + + if ( bitdepth < 8 ) + png_set_packing( png ); + + /* convert grayscale to RGB */ + if ( color_type == PNG_COLOR_TYPE_GRAY || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) + png_set_gray_to_rgb( png ); + + if ( interlace != PNG_INTERLACE_NONE ) + png_set_interlace_handling( png ); + + png_set_filler( png, 0xFF, PNG_FILLER_AFTER ); + + /* recheck header after setting EXPAND options */ + png_read_update_info(png, info ); + png_get_IHDR( png, info, + &imgWidth, &imgHeight, + &bitdepth, &color_type, &interlace, + NULL, NULL ); + + if ( bitdepth != 8 || + !( color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA ) ) + { + error = FT_THROW( Invalid_File_Format ); + goto DestroyExit; + } + + switch ( color_type ) + { + default: + /* Shouldn't happen, but fall through. */ + + case PNG_COLOR_TYPE_RGB_ALPHA: + png_set_read_user_transform_fn( png, premultiply_data ); + break; + + case PNG_COLOR_TYPE_RGB: + /* Humm, this smells. Carry on though. */ + png_set_read_user_transform_fn( png, convert_bytes_to_data ); + break; + } + + if ( FT_NEW_ARRAY( rows, imgHeight ) ) + { + error = FT_THROW( Out_Of_Memory ); + goto DestroyExit; + } + + for ( i = 0; i < (FT_Int)imgHeight; i++ ) + rows[i] = map->buffer + ( y_offset + i ) * map->pitch + x_offset * 4; + + png_read_image( png, rows ); + + FT_FREE( rows ); + + png_read_end( png, info ); + + DestroyExit: + png_destroy_read_struct( &png, &info, NULL ); + FT_Stream_Close( &stream ); + + Exit: + return error; + } + +#endif /* FT_CONFIG_OPTION_USE_PNG */ + + +/* END */ diff --git a/freetype/src/sfnt/pngshim.h b/freetype/src/sfnt/pngshim.h new file mode 100644 index 000000000..8a2e69ccf --- /dev/null +++ b/freetype/src/sfnt/pngshim.h @@ -0,0 +1,48 @@ +/***************************************************************************/ +/* */ +/* pngshim.h */ +/* */ +/* PNG Bitmap glyph support. */ +/* */ +/* Copyright 2013 by Google, Inc. */ +/* Written by Stuart Gill and Behdad Esfahbod. */ +/* */ +/* 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 __PNGSHIM_H__ +#define __PNGSHIM_H__ + + +#include <ft2build.h> +#include "ttload.h" + + +FT_BEGIN_HEADER + +#ifdef FT_CONFIG_OPTION_USE_PNG + + FT_LOCAL( FT_Error ) + Load_SBit_Png( FT_Bitmap* map, + FT_Int x_offset, + FT_Int y_offset, + FT_Int pix_bits, + TT_SBit_Metrics metrics, + FT_Memory memory, + FT_Byte* data, + FT_UInt png_len ); + +#endif + +FT_END_HEADER + +#endif /* __PNGSHIM_H__ */ + + +/* END */ diff --git a/freetype/src/sfnt/rules.mk b/freetype/src/sfnt/rules.mk index 02cee585d..a6c956ab6 100644 --- a/freetype/src/sfnt/rules.mk +++ b/freetype/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011 by +# Copyright 1996-2000, 2002-2007, 2009, 2011, 2013 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -34,15 +34,13 @@ SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c \ $(SFNT_DIR)/ttbdf.c \ $(SFNT_DIR)/sfobjs.c \ $(SFNT_DIR)/sfdriver.c \ - $(SFNT_DIR)/sfntpic.c + $(SFNT_DIR)/sfntpic.c \ + $(SFNT_DIR)/pngshim.c # SFNT driver headers # -# Note that ttsbit0.c gets #included by ttsbit.c. -# SFNT_DRV_H := $(SFNT_DRV_SRC:%c=%h) \ - $(SFNT_DIR)/sferrors.h \ - $(SFNT_DIR)/ttsbit0.c + $(SFNT_DIR)/sferrors.h # SFNT driver object(s) diff --git a/freetype/src/sfnt/sfdriver.c b/freetype/src/sfnt/sfdriver.c index 2b7f80fc9..a368b8cae 100644 --- a/freetype/src/sfnt/sfdriver.c +++ b/freetype/src/sfnt/sfdriver.c @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (body). */ /* */ -/* Copyright 1996-2007, 2009-2012 by */ +/* Copyright 1996-2007, 2009-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -119,21 +119,21 @@ FT_ULong *length ) { if ( !offset || !length ) - return SFNT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( !tag ) *length = face->num_tables; else { if ( idx >= face->num_tables ) - return SFNT_Err_Table_Missing; + return FT_THROW( Table_Missing ); *tag = face->dir_tables[idx].Tag; *offset = face->dir_tables[idx].Offset; *length = face->dir_tables[idx].Length; } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -257,7 +257,7 @@ FT_Memory memory = face->root.memory; TT_NameEntryRec* name = face->name_table.names + found_win; FT_UInt len = name->stringLength / 2; - FT_Error error = SFNT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( error ); @@ -299,7 +299,7 @@ FT_Memory memory = face->root.memory; TT_NameEntryRec* name = face->name_table.names + found_apple; FT_UInt len = name->stringLength; - FT_Error error = SFNT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( error ); @@ -371,7 +371,7 @@ *acharset_registry = registry.u.atom; } else - error = SFNT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); } } @@ -445,134 +445,6 @@ } -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - - FT_CALLBACK_DEF( FT_Error ) - tt_face_load_sfnt_header_stub( TT_Face face, - FT_Stream stream, - FT_Long face_index, - SFNT_Header header ) - { - FT_UNUSED( face ); - FT_UNUSED( stream ); - FT_UNUSED( face_index ); - FT_UNUSED( header ); - - return SFNT_Err_Unimplemented_Feature; - } - - - FT_CALLBACK_DEF( FT_Error ) - tt_face_load_directory_stub( TT_Face face, - FT_Stream stream, - SFNT_Header header ) - { - FT_UNUSED( face ); - FT_UNUSED( stream ); - FT_UNUSED( header ); - - return SFNT_Err_Unimplemented_Feature; - } - - - FT_CALLBACK_DEF( FT_Error ) - tt_face_load_hdmx_stub( TT_Face face, - FT_Stream stream ) - { - FT_UNUSED( face ); - FT_UNUSED( stream ); - - return SFNT_Err_Unimplemented_Feature; - } - - - FT_CALLBACK_DEF( void ) - tt_face_free_hdmx_stub( TT_Face face ) - { - FT_UNUSED( face ); - } - - - FT_CALLBACK_DEF( FT_Error ) - tt_face_set_sbit_strike_stub( TT_Face face, - FT_UInt x_ppem, - FT_UInt y_ppem, - FT_ULong* astrike_index ) - { - /* - * We simply forge a FT_Size_Request and call the real function - * that does all the work. - * - * This stub might be called by libXfont in the X.Org Xserver, - * compiled against version 2.1.8 or newer. - */ - - FT_Size_RequestRec req; - - - req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; - req.width = (FT_F26Dot6)x_ppem; - req.height = (FT_F26Dot6)y_ppem; - req.horiResolution = 0; - req.vertResolution = 0; - - *astrike_index = 0x7FFFFFFFUL; - - return tt_face_set_sbit_strike( face, &req, astrike_index ); - } - - - FT_CALLBACK_DEF( FT_Error ) - tt_face_load_sbit_stub( TT_Face face, - FT_Stream stream ) - { - FT_UNUSED( face ); - FT_UNUSED( stream ); - - /* - * This function was originally implemented to load the sbit table. - * However, it has been replaced by `tt_face_load_eblc', and this stub - * is only there for some rogue clients which would want to call it - * directly (which doesn't make much sense). - */ - return SFNT_Err_Unimplemented_Feature; - } - - - FT_CALLBACK_DEF( void ) - tt_face_free_sbit_stub( TT_Face face ) - { - /* nothing to do in this stub */ - FT_UNUSED( face ); - } - - - FT_CALLBACK_DEF( FT_Error ) - tt_face_load_charmap_stub( TT_Face face, - void* cmap, - FT_Stream input ) - { - FT_UNUSED( face ); - FT_UNUSED( cmap ); - FT_UNUSED( input ); - - return SFNT_Err_Unimplemented_Feature; - } - - - FT_CALLBACK_DEF( FT_Error ) - tt_face_free_charmap_stub( TT_Face face, - void* cmap ) - { - FT_UNUSED( face ); - FT_UNUSED( cmap ); - - return SFNT_Err_Ok; - } - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS #define PUT_EMBEDDED_BITMAPS( a ) a #else @@ -596,9 +468,6 @@ tt_face_load_any, - tt_face_load_sfnt_header_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_face_load_directory_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_face_load_head, tt_face_load_hhea, tt_face_load_cmap, @@ -609,9 +478,6 @@ tt_face_load_name, tt_face_free_name, - tt_face_load_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_face_free_hdmx_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_face_load_kern, tt_face_load_gasp, tt_face_load_pclt, @@ -619,29 +485,16 @@ /* see `ttload.h' */ PUT_EMBEDDED_BITMAPS( tt_face_load_bhed ), - tt_face_set_sbit_strike_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_face_load_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - - tt_find_sbit_image, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_load_sbit_metrics, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - PUT_EMBEDDED_BITMAPS( tt_face_load_sbit_image ), - tt_face_free_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - /* see `ttpost.h' */ PUT_PS_NAMES( tt_face_get_ps_name ), PUT_PS_NAMES( tt_face_free_ps_names ), - tt_face_load_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_face_free_charmap_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - /* since version 2.1.8 */ - tt_face_get_kerning, /* since version 2.2 */ - tt_face_load_font_dir, tt_face_load_hmtx, diff --git a/freetype/src/sfnt/sferrors.h b/freetype/src/sfnt/sferrors.h index 564a3fe39..e981e1d26 100644 --- a/freetype/src/sfnt/sferrors.h +++ b/freetype/src/sfnt/sferrors.h @@ -4,7 +4,7 @@ /* */ /* SFNT error codes (specification only). */ /* */ -/* Copyright 2001, 2004, 2012 by */ +/* Copyright 2001, 2004, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,8 +33,6 @@ #define FT_ERR_PREFIX SFNT_Err_ #define FT_ERR_BASE FT_Mod_Err_SFNT -#define FT_KEEP_ERR_PREFIX - #include FT_ERRORS_H #endif /* __SFERRORS_H__ */ diff --git a/freetype/src/sfnt/sfnt.c b/freetype/src/sfnt/sfnt.c index fc507b496..d62ed4e0b 100644 --- a/freetype/src/sfnt/sfnt.c +++ b/freetype/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ /* */ /* Single object library component. */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ +/* Copyright 1996-2006, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,6 +28,7 @@ #include "sfdriver.c" #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS +#include "pngshim.c" #include "ttsbit.c" #endif diff --git a/freetype/src/sfnt/sfntpic.c b/freetype/src/sfnt/sfntpic.c index 220998ecc..b3fb24b3f 100644 --- a/freetype/src/sfnt/sfntpic.c +++ b/freetype/src/sfnt/sfntpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009, 2010, 2012 by */ +/* Copyright 2009, 2010, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,42 +29,35 @@ FT_Error FT_Create_Class_sfnt_services( FT_Library library, FT_ServiceDescRec** output_class ); - void FT_Destroy_Class_sfnt_services( FT_Library library, FT_ServiceDescRec* clazz ); - void FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec* clazz ); - void FT_Init_Class_sfnt_interface( FT_Library library, SFNT_Interface* clazz ); - void FT_Init_Class_sfnt_service_glyph_dict( FT_Library library, FT_Service_GlyphDictRec* clazz ); - void FT_Init_Class_sfnt_service_ps_name( FT_Library library, FT_Service_PsFontNameRec* clazz ); - void FT_Init_Class_tt_service_get_cmap_info( FT_Library library, FT_Service_TTCMapsRec* clazz ); - void FT_Init_Class_sfnt_service_sfnt_table( FT_Service_SFNT_TableRec* clazz ); + /* forward declaration of PIC init functions from ttcmap.c */ FT_Error FT_Create_Class_tt_cmap_classes( FT_Library library, TT_CMap_Class** output_class ); - void FT_Destroy_Class_tt_cmap_classes( FT_Library library, TT_CMap_Class* clazz ); @@ -99,16 +92,16 @@ FT_Error - sfnt_module_class_pic_init( FT_Library library ) + sfnt_module_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = SFNT_Err_Ok; + FT_Error error = FT_Err_Ok; sfntModulePIC* container = NULL; FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->sfnt = container; diff --git a/freetype/src/sfnt/sfobjs.c b/freetype/src/sfnt/sfobjs.c index ef4784aeb..f975e71c3 100644 --- a/freetype/src/sfnt/sfobjs.c +++ b/freetype/src/sfnt/sfobjs.c @@ -4,7 +4,7 @@ /* */ /* SFNT object management (base). */ /* */ -/* Copyright 1996-2008, 2010-2012 by */ +/* Copyright 1996-2008, 2010-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -145,7 +145,7 @@ FT_String** name ) { FT_Memory memory = face->root.memory; - FT_Error error = SFNT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_String* result = NULL; FT_UShort n; TT_NameEntryRec* rec; @@ -386,7 +386,7 @@ tag != 0x00020000UL ) { FT_TRACE2(( " not a font using the SFNT container format\n" )); - return SFNT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); } face->ttc_header.tag = TTAG_ttcf; @@ -402,7 +402,7 @@ return error; if ( face->ttc_header.count == 0 ) - return SFNT_Err_Invalid_Table; + return FT_THROW( Invalid_Table ); /* a rough size estimate: let's conservatively assume that there */ /* is just a single table info in each subfont header (12 + 16*1 = */ @@ -410,7 +410,7 @@ /* size of the TTC header plus `28*count' bytes for all subfont */ /* headers */ if ( (FT_ULong)face->ttc_header.count > stream->size / ( 28 + 4 ) ) - return SFNT_Err_Array_Too_Large; + return FT_THROW( Array_Too_Large ); /* now read the offsets of each font in the file */ if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) ) @@ -465,7 +465,7 @@ if ( !sfnt ) { FT_ERROR(( "sfnt_init_face: cannot access `sfnt' module\n" )); - return SFNT_Err_Missing_Module; + return FT_THROW( Missing_Module ); } face->sfnt = sfnt; @@ -486,7 +486,7 @@ face_index = 0; if ( face_index >= face->ttc_header.count ) - return SFNT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) ) return error; @@ -503,35 +503,35 @@ } -#define LOAD_( x ) \ - do { \ - FT_TRACE2(( "`" #x "' " )); \ - FT_TRACE3(( "-->\n" )); \ - \ - error = sfnt->load_ ## x( face, stream ); \ - \ - FT_TRACE2(( "%s\n", ( !error ) \ - ? "loaded" \ - : ( error == SFNT_Err_Table_Missing ) \ - ? "missing" \ - : "failed to load" )); \ - FT_TRACE3(( "\n" )); \ +#define LOAD_( x ) \ + do { \ + FT_TRACE2(( "`" #x "' " )); \ + FT_TRACE3(( "-->\n" )); \ + \ + error = sfnt->load_ ## x( face, stream ); \ + \ + FT_TRACE2(( "%s\n", ( !error ) \ + ? "loaded" \ + : FT_ERR_EQ( error, Table_Missing ) \ + ? "missing" \ + : "failed to load" )); \ + FT_TRACE3(( "\n" )); \ } while ( 0 ) -#define LOADM_( x, vertical ) \ - do { \ - FT_TRACE2(( "`%s" #x "' ", \ - vertical ? "vertical " : "" )); \ - FT_TRACE3(( "-->\n" )); \ - \ - error = sfnt->load_ ## x( face, stream, vertical ); \ - \ - FT_TRACE2(( "%s\n", ( !error ) \ - ? "loaded" \ - : ( error == SFNT_Err_Table_Missing ) \ - ? "missing" \ - : "failed to load" )); \ - FT_TRACE3(( "\n" )); \ +#define LOADM_( x, vertical ) \ + do { \ + FT_TRACE2(( "`%s" #x "' ", \ + vertical ? "vertical " : "" )); \ + FT_TRACE3(( "-->\n" )); \ + \ + error = sfnt->load_ ## x( face, stream, vertical ); \ + \ + FT_TRACE2(( "%s\n", ( !error ) \ + ? "loaded" \ + : FT_ERR_EQ( error, Table_Missing ) \ + ? "missing" \ + : "failed to load" )); \ + FT_TRACE3(( "\n" )); \ } while ( 0 ) #define GET_NAME( id, field ) \ @@ -628,7 +628,7 @@ if ( face->header.Units_Per_EM == 0 ) { - error = SFNT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -656,9 +656,9 @@ if ( !error ) { LOADM_( hmtx, 0 ); - if ( error == SFNT_Err_Table_Missing ) + if ( FT_ERR_EQ( error, Table_Missing ) ) { - error = SFNT_Err_Hmtx_Table_Missing; + error = FT_THROW( Hmtx_Table_Missing ); #ifdef FT_CONFIG_OPTION_INCREMENTAL /* If this is an incrementally loaded font and there are */ @@ -668,12 +668,12 @@ get_glyph_metrics ) { face->horizontal.number_Of_HMetrics = 0; - error = SFNT_Err_Ok; + error = FT_Err_Ok; } #endif } } - else if ( error == SFNT_Err_Table_Missing ) + else if ( FT_ERR_EQ( error, Table_Missing ) ) { /* No `hhea' table necessary for SFNT Mac fonts. */ if ( face->format_tag == TTAG_true ) @@ -681,11 +681,11 @@ FT_TRACE2(( "This is an SFNT Mac font.\n" )); has_outline = 0; - error = SFNT_Err_Ok; + error = FT_Err_Ok; } else { - error = SFNT_Err_Horiz_Header_Missing; + error = FT_THROW( Horiz_Header_Missing ); #ifdef FT_CONFIG_OPTION_INCREMENTAL /* If this is an incrementally loaded font and there are */ @@ -695,7 +695,7 @@ get_glyph_metrics ) { face->horizontal.number_Of_HMetrics = 0; - error = SFNT_Err_Ok; + error = FT_Err_Ok; } #endif @@ -714,7 +714,7 @@ face->vertical_info = 1; } - if ( error && error != SFNT_Err_Table_Missing ) + if ( error && FT_ERR_NEQ( error, Table_Missing ) ) goto Exit; LOAD_( os2 ); @@ -736,8 +736,8 @@ /* a font which contains neither bitmaps nor outlines is */ /* still valid (although rather useless in most cases); */ /* however, you can find such stripped fonts in PDFs */ - if ( error == SFNT_Err_Table_Missing ) - error = SFNT_Err_Ok; + if ( FT_ERR_EQ( error, Table_Missing ) ) + error = FT_Err_Ok; else goto Exit; } @@ -746,7 +746,7 @@ LOAD_( pclt ); if ( error ) { - if ( error != SFNT_Err_Table_Missing ) + if ( FT_ERR_NEQ( error, Table_Missing ) ) goto Exit; face->pclt.Version = 0; @@ -812,7 +812,7 @@ FT_FACE_FLAG_HORIZONTAL; /* horizontal data */ #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES - if ( psnames_error == SFNT_Err_Ok && + if ( !psnames_error && face->postscript.FormatType != 0x00030000L ) flags |= FT_FACE_FLAG_GLYPH_NAMES; #endif @@ -919,11 +919,7 @@ FT_UInt i, count; -#ifndef FT_CONFIG_OPTION_OLD_INTERNALS count = face->sbit_num_strikes; -#else - count = (FT_UInt)face->num_sbit_strikes; -#endif if ( count > 0 ) { @@ -1124,7 +1120,6 @@ } /* freeing the horizontal metrics */ -#ifndef FT_CONFIG_OPTION_OLD_INTERNALS { FT_Stream stream = FT_FACE_STREAM( face ); @@ -1134,10 +1129,6 @@ face->horz_metrics_size = 0; face->vert_metrics_size = 0; } -#else - FT_FREE( face->horizontal.long_metrics ); - FT_FREE( face->horizontal.short_metrics ); -#endif /* freeing the vertical ones, if any */ if ( face->vertical_info ) diff --git a/freetype/src/sfnt/ttbdf.c b/freetype/src/sfnt/ttbdf.c index 18845c39c..9401dae5f 100644 --- a/freetype/src/sfnt/ttbdf.c +++ b/freetype/src/sfnt/ttbdf.c @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded BDF properties (body). */ /* */ -/* Copyright 2005, 2006, 2010 by */ +/* Copyright 2005, 2006, 2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -74,7 +74,7 @@ length < 8 || FT_FRAME_EXTRACT( length, bdf->table ) ) { - error = SFNT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -131,7 +131,7 @@ BadTable: FT_FRAME_RELEASE( bdf->table ); FT_ZERO( bdf ); - error = SFNT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -143,7 +143,7 @@ { TT_BDF bdf = &face->bdf; FT_Size size = FT_FACE(face)->size; - FT_Error error = SFNT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte* p; FT_UInt count; FT_Byte* strike; @@ -163,7 +163,7 @@ p = bdf->table + 8; strike = p + 4 * count; - error = SFNT_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( size == NULL || property_name == NULL ) goto Exit; @@ -215,7 +215,7 @@ { aprop->type = BDF_PROPERTY_TYPE_ATOM; aprop->u.atom = (const char*)bdf->strings + value; - error = SFNT_Err_Ok; + error = FT_Err_Ok; goto Exit; } break; @@ -223,13 +223,13 @@ case 0x02: aprop->type = BDF_PROPERTY_TYPE_INTEGER; aprop->u.integer = (FT_Int32)value; - error = SFNT_Err_Ok; + error = FT_Err_Ok; goto Exit; case 0x03: aprop->type = BDF_PROPERTY_TYPE_CARDINAL; aprop->u.cardinal = value; - error = SFNT_Err_Ok; + error = FT_Err_Ok; goto Exit; default: diff --git a/freetype/src/sfnt/ttcmap.c b/freetype/src/sfnt/ttcmap.c index f1504d621..1507202ea 100644 --- a/freetype/src/sfnt/ttcmap.c +++ b/freetype/src/sfnt/ttcmap.c @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002-2010, 2012 by */ +/* Copyright 2002-2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -56,7 +56,7 @@ FT_Byte* table ) { cmap->data = table; - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -110,7 +110,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -161,7 +161,7 @@ cmap_info->format = 0; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -369,7 +369,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -541,7 +541,7 @@ cmap_info->format = 2; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -670,7 +670,7 @@ cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL; cmap->cur_gindex = 0; - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -820,7 +820,7 @@ FT_UInt length = TT_NEXT_USHORT( p ); FT_Byte *ends, *starts, *offsets, *deltas, *glyph_ids; FT_UInt num_segs; - FT_Error error = SFNT_Err_Ok; + FT_Error error = FT_Err_Ok; if ( length < 16 ) @@ -1381,7 +1381,7 @@ cmap_info->format = 4; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -1468,7 +1468,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -1544,7 +1544,7 @@ cmap_info->format = 6; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -1716,7 +1716,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -1801,7 +1801,7 @@ cmap_info->format = 8; cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -1887,7 +1887,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -1954,7 +1954,7 @@ cmap_info->format = 10; cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2034,7 +2034,7 @@ cmap->valid = 0; - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2087,7 +2087,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2278,7 +2278,7 @@ cmap_info->format = 12; cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2358,7 +2358,7 @@ cmap->valid = 0; - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2411,7 +2411,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2597,7 +2597,7 @@ cmap_info->format = 13; cmap_info->language = (FT_ULong)TT_PEEK_ULONG( p ); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2720,7 +2720,7 @@ FT_Memory memory ) { FT_UInt32 old_max = cmap->max_results; - FT_Error error = SFNT_Err_Ok; + FT_Error error = FT_Err_Ok; if ( num_results > cmap->max_results ) @@ -2748,7 +2748,7 @@ cmap->max_results = 0; cmap->results = NULL; - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2850,7 +2850,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -2888,7 +2888,7 @@ /* subtable 14 does not define a language field */ cmap_info->language = 0xFFFFFFFFUL; - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -3420,7 +3420,7 @@ clazz[i] = NULL; *output_class = clazz; - return SFNT_Err_Ok; + return FT_Err_Ok; } #endif /*FT_CONFIG_OPTION_PIC*/ @@ -3442,7 +3442,7 @@ if ( !p || p + 4 > limit ) - return SFNT_Err_Invalid_Table; + return FT_THROW( Invalid_Table ); /* only recognize format 0 */ if ( TT_NEXT_USHORT( p ) != 0 ) @@ -3451,7 +3451,7 @@ FT_ERROR(( "tt_face_build_cmaps:" " unsupported `cmap' table format = %d\n", TT_PEEK_USHORT( p ) )); - return SFNT_Err_Invalid_Table; + return FT_THROW( Invalid_Table ); } num_cmaps = TT_NEXT_USHORT( p ); @@ -3490,7 +3490,7 @@ if ( clazz->format == format ) { volatile TT_ValidatorRec valid; - volatile FT_Error error = SFNT_Err_Ok; + volatile FT_Error error = FT_Err_Ok; ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit, @@ -3538,7 +3538,7 @@ } } - return SFNT_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/sfnt/ttkern.c b/freetype/src/sfnt/ttkern.c index 46888988e..60ee546d7 100644 --- a/freetype/src/sfnt/ttkern.c +++ b/freetype/src/sfnt/ttkern.c @@ -61,7 +61,7 @@ { FT_ERROR(( "tt_face_load_kern:" " kerning table is too small - ignored\n" )); - error = SFNT_Err_Table_Missing; + error = FT_THROW( Table_Missing ); goto Exit; } diff --git a/freetype/src/sfnt/ttload.c b/freetype/src/sfnt/ttload.c index 7ffdbeeff..fbe70f797 100644 --- a/freetype/src/sfnt/ttload.c +++ b/freetype/src/sfnt/ttload.c @@ -5,7 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2010, 2012 by */ +/* Copyright 1996-2010, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -142,7 +142,7 @@ goto Exit; } else - error = SFNT_Err_Table_Missing; + error = FT_THROW( Table_Missing ); Exit: return error; @@ -237,7 +237,7 @@ if ( table.Length < 0x36 ) { FT_TRACE2(( "check_table_dir: `head' table too small\n" )); - error = SFNT_Err_Table_Missing; + error = FT_THROW( Table_Missing ); goto Exit; } @@ -249,7 +249,7 @@ { FT_TRACE2(( "check_table_dir:" " no magic number found in `head' table\n")); - error = SFNT_Err_Table_Missing; + error = FT_THROW( Table_Missing ); goto Exit; } @@ -267,14 +267,14 @@ if ( sfnt->num_tables == 0 ) { FT_TRACE2(( "check_table_dir: no tables found\n" )); - error = SFNT_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } /* if `sing' and `meta' tables are present, there is no `head' table */ if ( has_head || ( has_sing && has_meta ) ) { - error = SFNT_Err_Ok; + error = FT_Err_Ok; goto Exit; } else @@ -285,7 +285,7 @@ #else FT_TRACE2(( " neither `head' nor `sing' table found\n" )); #endif - error = SFNT_Err_Table_Missing; + error = FT_THROW( Table_Missing ); } Exit: @@ -353,7 +353,7 @@ #if 0 if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 ) || sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 ) - return SFNT_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); #endif /* load the table directory */ @@ -482,7 +482,7 @@ table = tt_face_lookup_table( face, tag ); if ( !table ) { - error = SFNT_Err_Table_Missing; + error = FT_THROW( Table_Missing ); goto Exit; } @@ -497,7 +497,7 @@ { *length = size; - return SFNT_Err_Ok; + return FT_Err_Ok; } if ( length ) @@ -801,7 +801,7 @@ if ( storage_start > storage_limit ) { FT_ERROR(( "tt_face_load_name: invalid `name' table\n" )); - error = SFNT_Err_Name_Table_Missing; + error = FT_THROW( Name_Table_Missing ); goto Exit; } @@ -1127,7 +1127,7 @@ FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch ? " yes" : " no" )); - return SFNT_Err_Ok; + return FT_Err_Ok; } @@ -1235,7 +1235,7 @@ if ( face->gasp.version >= 2 ) { face->gasp.numRanges = 0; - error = SFNT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } diff --git a/freetype/src/sfnt/ttmtx.c b/freetype/src/sfnt/ttmtx.c index 8f7b2a93b..371a9edab 100644 --- a/freetype/src/sfnt/ttmtx.c +++ b/freetype/src/sfnt/ttmtx.c @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (body). */ /* */ -/* Copyright 2006-2009, 2011-2012 by */ +/* Copyright 2006-2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -35,13 +35,6 @@ #define FT_COMPONENT trace_ttmtx - /* - * Unfortunately, we can't enable our memory optimizations if - * FT_CONFIG_OPTION_OLD_INTERNALS is defined. This is because at least - * one rogue client (libXfont in the X.Org XServer) is directly accessing - * the metrics. - */ - /*************************************************************************/ /* */ /* <Function> */ @@ -60,8 +53,6 @@ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ -#ifndef FT_CONFIG_OPTION_OLD_INTERNALS - FT_LOCAL_DEF( FT_Error ) tt_face_load_hmtx( TT_Face face, FT_Stream stream, @@ -97,142 +88,6 @@ return error; } -#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */ - - FT_LOCAL_DEF( FT_Error ) - tt_face_load_hmtx( TT_Face face, - FT_Stream stream, - FT_Bool vertical ) - { - FT_Error error; - FT_Memory memory = stream->memory; - - FT_ULong table_len; - FT_Long num_shorts, num_longs, num_shorts_checked; - - TT_LongMetrics* longs; - TT_ShortMetrics** shorts; - FT_Byte* p; - - - if ( vertical ) - { - void* lm = &face->vertical.long_metrics; - void** sm = &face->vertical.short_metrics; - - - error = face->goto_table( face, TTAG_vmtx, stream, &table_len ); - if ( error ) - goto Fail; - - num_longs = face->vertical.number_Of_VMetrics; - if ( (FT_ULong)num_longs > table_len / 4 ) - num_longs = (FT_Long)( table_len / 4 ); - - face->vertical.number_Of_VMetrics = 0; - - longs = (TT_LongMetrics*)lm; - shorts = (TT_ShortMetrics**)sm; - } - else - { - void* lm = &face->horizontal.long_metrics; - void** sm = &face->horizontal.short_metrics; - - - error = face->goto_table( face, TTAG_hmtx, stream, &table_len ); - if ( error ) - goto Fail; - - num_longs = face->horizontal.number_Of_HMetrics; - if ( (FT_ULong)num_longs > table_len / 4 ) - num_longs = (FT_Long)( table_len / 4 ); - - face->horizontal.number_Of_HMetrics = 0; - - longs = (TT_LongMetrics*)lm; - shorts = (TT_ShortMetrics**)sm; - } - - /* 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_TRACE0(( "tt_face_load_hmtx:" - " %cmtx has more metrics than glyphs.\n", - vertical ? 'v' : 'h' )); - - /* Adobe simply ignores this problem. So we shall do the same. */ -#if 0 - error = vertical ? SFNT_Err_Invalid_Vert_Metrics - : SFNT_Err_Invalid_Horiz_Metrics; - goto Exit; -#else - num_shorts = 0; -#endif - } - - if ( FT_QNEW_ARRAY( *longs, num_longs ) || - FT_QNEW_ARRAY( *shorts, num_shorts ) ) - goto Fail; - - if ( FT_FRAME_ENTER( table_len ) ) - goto Fail; - - p = stream->cursor; - - { - TT_LongMetrics cur = *longs; - TT_LongMetrics limit = cur + num_longs; - - - for ( ; cur < limit; cur++ ) - { - cur->advance = FT_NEXT_USHORT( p ); - cur->bearing = FT_NEXT_SHORT( p ); - } - } - - /* do we have an inconsistent number of metric values? */ - { - TT_ShortMetrics* cur = *shorts; - TT_ShortMetrics* limit = cur + - FT_MIN( num_shorts, num_shorts_checked ); - - - for ( ; cur < limit; cur++ ) - *cur = FT_NEXT_SHORT( p ); - - /* We fill up the missing left side bearings with the */ - /* last valid value. Since this will occur for buggy CJK */ - /* fonts usually only, nothing serious will happen. */ - if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 ) - { - FT_Short val = (*shorts)[num_shorts_checked - 1]; - - - limit = *shorts + num_shorts; - for ( ; cur < limit; cur++ ) - *cur = val; - } - } - - FT_FRAME_EXIT(); - - if ( vertical ) - face->vertical.number_Of_VMetrics = (FT_UShort)num_longs; - else - face->horizontal.number_Of_HMetrics = (FT_UShort)num_longs; - - Fail: - return error; - } - -#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */ - /*************************************************************************/ /* */ @@ -343,8 +198,6 @@ /* */ /* advance :: The advance width resp. advance height. */ /* */ -#ifndef FT_CONFIG_OPTION_OLD_INTERNALS - FT_LOCAL_DEF( FT_Error ) tt_face_get_metrics( TT_Face face, FT_Bool vertical, @@ -419,50 +272,8 @@ *aadvance = 0; } - return SFNT_Err_Ok; - } - -#else /* !FT_CONFIG_OPTION_OLD_INTERNALS */ - - FT_LOCAL_DEF( FT_Error ) - tt_face_get_metrics( TT_Face face, - FT_Bool vertical, - FT_UInt gindex, - FT_Short* abearing, - FT_UShort* aadvance ) - { - void* v = &face->vertical; - void* h = &face->horizontal; - TT_HoriHeader* header = vertical ? (TT_HoriHeader*)v - : (TT_HoriHeader*)h; - TT_LongMetrics longs_m; - FT_UShort k = header->number_Of_HMetrics; - - - if ( k == 0 || - !header->long_metrics || - gindex >= (FT_UInt)face->max_profile.numGlyphs ) - { - *abearing = *aadvance = 0; - return SFNT_Err_Ok; - } - - if ( gindex < (FT_UInt)k ) - { - longs_m = (TT_LongMetrics)header->long_metrics + gindex; - *abearing = longs_m->bearing; - *aadvance = longs_m->advance; - } - else - { - *abearing = ((TT_ShortMetrics*)header->short_metrics)[gindex - k]; - *aadvance = ((TT_LongMetrics)header->long_metrics)[k - 1].advance; - } - - return SFNT_Err_Ok; + return FT_Err_Ok; } -#endif /* !FT_CONFIG_OPTION_OLD_INTERNALS */ - /* END */ diff --git a/freetype/src/sfnt/ttpost.c b/freetype/src/sfnt/ttpost.c index 6f4bb1d0d..47a85c0c9 100644 --- a/freetype/src/sfnt/ttpost.c +++ b/freetype/src/sfnt/ttpost.c @@ -5,7 +5,7 @@ /* Postcript name table processing for TrueType and OpenType fonts */ /* (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 1996-2003, 2006-2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -178,7 +178,7 @@ if ( num_glyphs > face->max_profile.numGlyphs ) { - error = SFNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -284,7 +284,7 @@ table->glyph_indices = glyph_indices; table->glyph_names = name_strings; } - return SFNT_Err_Ok; + return FT_Err_Ok; Fail1: { @@ -325,7 +325,7 @@ /* check the number of glyphs */ if ( num_glyphs > face->max_profile.numGlyphs || num_glyphs > 258 ) { - error = SFNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -345,7 +345,7 @@ if ( idx < 0 || idx > num_glyphs ) { - error = SFNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } } @@ -360,7 +360,7 @@ table->offsets = offset_table; } - return SFNT_Err_Ok; + return FT_Err_Ok; Fail: FT_FREE( offset_table ); @@ -402,7 +402,7 @@ else if ( format == 0x00028000L ) error = load_format_25( face, stream, post_limit ); else - error = SFNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); face->postscript_names.loaded = 1; @@ -488,15 +488,15 @@ if ( !face ) - return SFNT_Err_Invalid_Face_Handle; + return FT_THROW( Invalid_Face_Handle ); if ( idx >= (FT_UInt)face->max_profile.numGlyphs ) - return SFNT_Err_Invalid_Glyph_Index; + return FT_THROW( Invalid_Glyph_Index ); #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES psnames = (FT_Service_PsCMaps)face->psnames; if ( !psnames ) - return SFNT_Err_Unimplemented_Feature; + return FT_THROW( Unimplemented_Feature ); #endif names = &face->postscript_names; @@ -556,7 +556,7 @@ /* nothing to do for format == 0x00030000L */ End: - return SFNT_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/sfnt/ttsbit.c b/freetype/src/sfnt/ttsbit.c index 283ba7ef7..cd3e5a4a0 100644 --- a/freetype/src/sfnt/ttsbit.c +++ b/freetype/src/sfnt/ttsbit.c @@ -4,10 +4,12 @@ /* */ /* TrueType and OpenType embedded bitmap support (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 2005-2009, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ +/* Copyright 2013 by Google, Inc. */ +/* Google Author(s): Behdad Esfahbod. */ +/* */ /* 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 */ @@ -16,29 +18,18 @@ /* */ /***************************************************************************/ -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H - - /* - * Alas, the memory-optimized sbit loader can't be used when implementing - * the `old internals' hack - */ -#ifndef FT_CONFIG_OPTION_OLD_INTERNALS - -#include "ttsbit0.c" - -#else /* FT_CONFIG_OPTION_OLD_INTERNALS */ #include <ft2build.h> #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H +#include FT_BITMAP_H #include "ttsbit.h" #include "sferrors.h" +#include "pngshim.h" + /*************************************************************************/ /* */ @@ -50,1398 +41,1108 @@ #define FT_COMPONENT trace_ttsbit - /*************************************************************************/ - /* */ - /* <Function> */ - /* blit_sbit */ - /* */ - /* <Description> */ - /* Blits a bitmap from an input stream into a given target. Supports */ - /* x and y offsets as well as byte padded lines. */ - /* */ - /* <Input> */ - /* target :: The target bitmap/pixmap. */ - /* */ - /* source :: The input packed bitmap data. */ - /* */ - /* line_bits :: The number of bits per line. */ - /* */ - /* byte_padded :: A flag which is true if lines are byte-padded. */ - /* */ - /* x_offset :: The horizontal offset. */ - /* */ - /* y_offset :: The vertical offset. */ - /* */ - /* <Note> */ - /* IMPORTANT: The x and y offsets are relative to the top corner of */ - /* the target bitmap (unlike the normal TrueType */ - /* convention). A positive y offset indicates a downwards */ - /* direction! */ - /* */ - static void - blit_sbit( FT_Bitmap* target, - FT_Byte* source, - FT_Int line_bits, - FT_Bool byte_padded, - FT_Int x_offset, - FT_Int y_offset, - FT_Int source_height ) + FT_LOCAL_DEF( FT_Error ) + tt_face_load_eblc( TT_Face face, + FT_Stream stream ) { - FT_Byte* line_buff; - FT_Int line_incr; - FT_Int height; + FT_Error error = FT_Err_Ok; + FT_Fixed version; + FT_ULong num_strikes, table_size; + FT_Byte* p; + FT_Byte* p_limit; + FT_UInt count; - FT_UShort acc; - FT_UInt loaded; + face->sbit_num_strikes = 0; - /* first of all, compute starting write position */ - line_incr = target->pitch; - line_buff = target->buffer; + /* this table is optional */ + error = face->goto_table( face, TTAG_CBLC, stream, &table_size ); + if ( error ) + error = face->goto_table( face, TTAG_EBLC, stream, &table_size ); + if ( error ) + error = face->goto_table( face, TTAG_bloc, stream, &table_size ); + if ( error ) + goto Exit; - if ( line_incr < 0 ) - line_buff -= line_incr * ( target->rows - 1 ); + if ( table_size < 8 ) + { + FT_ERROR(( "tt_face_load_sbit_strikes: table too short\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } - line_buff += ( x_offset >> 3 ) + y_offset * line_incr; + if ( FT_FRAME_EXTRACT( table_size, face->sbit_table ) ) + goto Exit; + + face->sbit_table_size = table_size; - /***********************************************************************/ - /* */ - /* We use the extra-classic `accumulator' trick to extract the bits */ - /* from the source byte stream. */ - /* */ - /* Namely, the variable `acc' is a 16-bit accumulator containing the */ - /* last `loaded' bits from the input stream. The bits are shifted to */ - /* the upmost position in `acc'. */ - /* */ - /***********************************************************************/ + p = face->sbit_table; + p_limit = p + table_size; - acc = 0; /* clear accumulator */ - loaded = 0; /* no bits were loaded */ + version = FT_NEXT_ULONG( p ); + num_strikes = FT_NEXT_ULONG( p ); - for ( height = source_height; height > 0; height-- ) + if ( version != 0x00020000UL || num_strikes >= 0x10000UL ) { - FT_Byte* cur = line_buff; /* current write cursor */ - FT_Int count = line_bits; /* # of bits to extract per line */ - FT_Byte shift = (FT_Byte)( x_offset & 7 ); /* current write shift */ - FT_Byte space = (FT_Byte)( 8 - shift ); + FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Fail; + } + /* + * Count the number of strikes available in the table. We are a bit + * paranoid there and don't trust the data. + */ + count = (FT_UInt)num_strikes; + if ( 8 + 48UL * count > table_size ) + count = (FT_UInt)( ( p_limit - p ) / 48 ); - /* first of all, read individual source bytes */ - if ( count >= 8 ) - { - count -= 8; - { - do - { - FT_Byte val; - - - /* ensure that there are at least 8 bits in the accumulator */ - if ( loaded < 8 ) - { - acc |= (FT_UShort)((FT_UShort)*source++ << ( 8 - loaded )); - loaded += 8; - } - - /* now write one byte */ - val = (FT_Byte)( acc >> 8 ); - if ( shift ) - { - cur[0] |= (FT_Byte)( val >> shift ); - cur[1] |= (FT_Byte)( val << space ); - } - else - cur[0] |= val; - - cur++; - acc <<= 8; /* remove bits from accumulator */ - loaded -= 8; - count -= 8; - - } while ( count >= 0 ); - } + face->sbit_num_strikes = count; - /* restore `count' to correct value */ - count += 8; - } + FT_TRACE3(( "sbit_num_strikes: %u\n", count )); + Exit: + return error; - /* now write remaining bits (count < 8) */ - if ( count > 0 ) - { - FT_Byte val; + Fail: + FT_FRAME_RELEASE( face->sbit_table ); + face->sbit_table_size = 0; + goto Exit; + } - /* ensure that there are at least `count' bits in the accumulator */ - if ( (FT_Int)loaded < count ) - { - acc |= (FT_UShort)((FT_UShort)*source++ << ( 8 - loaded )); - loaded += 8; - } - - /* now write remaining bits */ - val = (FT_Byte)( ( (FT_Byte)( acc >> 8 ) ) & ~( 0xFF >> count ) ); - cur[0] |= (FT_Byte)( val >> shift ); + FT_LOCAL_DEF( void ) + tt_face_free_eblc( TT_Face face ) + { + FT_Stream stream = face->root.stream; - if ( count > space ) - cur[1] |= (FT_Byte)( val << space ); - acc <<= count; - loaded -= count; - } + FT_FRAME_RELEASE( face->sbit_table ); + face->sbit_table_size = 0; + face->sbit_num_strikes = 0; + } - /* now, skip to next line */ - if ( byte_padded ) - { - acc = 0; - loaded = 0; /* clear accumulator on byte-padded lines */ - } - line_buff += line_incr; - } + FT_LOCAL_DEF( FT_Error ) + tt_face_set_sbit_strike( TT_Face face, + FT_Size_Request req, + FT_ULong* astrike_index ) + { + return FT_Match_Size( (FT_Face)face, req, 0, astrike_index ); } - static const FT_Frame_Field sbit_metrics_fields[] = + FT_LOCAL_DEF( FT_Error ) + tt_face_load_strike_metrics( TT_Face face, + FT_ULong strike_index, + FT_Size_Metrics* metrics ) { -#undef FT_STRUCTURE -#define FT_STRUCTURE TT_SBit_MetricsRec + FT_Byte* strike; - FT_FRAME_START( 8 ), - FT_FRAME_BYTE( height ), - FT_FRAME_BYTE( width ), - FT_FRAME_CHAR( horiBearingX ), - FT_FRAME_CHAR( horiBearingY ), - FT_FRAME_BYTE( horiAdvance ), + if ( strike_index >= (FT_ULong)face->sbit_num_strikes ) + return FT_THROW( Invalid_Argument ); - FT_FRAME_CHAR( vertBearingX ), - FT_FRAME_CHAR( vertBearingY ), - FT_FRAME_BYTE( vertAdvance ), - FT_FRAME_END - }; + strike = face->sbit_table + 8 + strike_index * 48; + metrics->x_ppem = (FT_UShort)strike[44]; + metrics->y_ppem = (FT_UShort)strike[45]; - /*************************************************************************/ - /* */ - /* <Function> */ - /* Load_SBit_Const_Metrics */ - /* */ - /* <Description> */ - /* Loads the metrics for `EBLC' index tables format 2 and 5. */ - /* */ - /* <Input> */ - /* range :: The target range. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - static FT_Error - Load_SBit_Const_Metrics( TT_SBit_Range range, - FT_Stream stream ) + metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */ + metrics->descender = (FT_Char)strike[17] << 6; /* hori.descender */ + metrics->height = metrics->ascender - metrics->descender; + + /* XXX: Is this correct? */ + metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */ + strike[18] + /* max_width */ + (FT_Char)strike[23] /* min_advance_SB */ + ) << 6; + + return FT_Err_Ok; + } + + + typedef struct TT_SBitDecoderRec_ { - FT_Error error; + TT_Face face; + FT_Stream stream; + FT_Bitmap* bitmap; + TT_SBit_Metrics metrics; + FT_Bool metrics_loaded; + FT_Bool bitmap_allocated; + FT_Byte bit_depth; + FT_ULong ebdt_start; + FT_ULong ebdt_size; - if ( FT_READ_ULONG( range->image_size ) ) - return error; + FT_ULong strike_index_array; + FT_ULong strike_index_count; + FT_Byte* eblc_base; + FT_Byte* eblc_limit; - return FT_STREAM_READ_FIELDS( sbit_metrics_fields, &range->metrics ); - } + } TT_SBitDecoderRec, *TT_SBitDecoder; - /*************************************************************************/ - /* */ - /* <Function> */ - /* Load_SBit_Range_Codes */ - /* */ - /* <Description> */ - /* Loads the range codes for `EBLC' index tables format 4 and 5. */ - /* */ - /* <Input> */ - /* range :: The target range. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* load_offsets :: A flag whether to load the glyph offset table. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ static FT_Error - Load_SBit_Range_Codes( TT_SBit_Range range, - FT_Stream stream, - FT_Bool load_offsets ) + tt_sbit_decoder_init( TT_SBitDecoder decoder, + TT_Face face, + FT_ULong strike_index, + TT_SBit_MetricsRec* metrics ) { FT_Error error; - FT_ULong count, n, size; - FT_Memory memory = stream->memory; + FT_Stream stream = face->root.stream; + FT_ULong ebdt_size; - if ( FT_READ_ULONG( count ) ) + error = face->goto_table( face, TTAG_CBDT, stream, &ebdt_size ); + if ( error ) + error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size ); + if ( error ) + error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size ); + if ( error ) goto Exit; - range->num_glyphs = count; + decoder->face = face; + decoder->stream = stream; + decoder->bitmap = &face->root.glyph->bitmap; + decoder->metrics = metrics; - /* Allocate glyph offsets table if needed */ - if ( load_offsets ) - { - if ( FT_NEW_ARRAY( range->glyph_offsets, count ) ) - goto Exit; + decoder->metrics_loaded = 0; + decoder->bitmap_allocated = 0; - size = count * 4L; - } - else - size = count * 2L; + decoder->ebdt_start = FT_STREAM_POS(); + decoder->ebdt_size = ebdt_size; - /* Allocate glyph codes table and access frame */ - if ( FT_NEW_ARRAY ( range->glyph_codes, count ) || - FT_FRAME_ENTER( size ) ) - goto Exit; + decoder->eblc_base = face->sbit_table; + decoder->eblc_limit = face->sbit_table + face->sbit_table_size; - for ( n = 0; n < count; n++ ) + /* now find the strike corresponding to the index */ { - range->glyph_codes[n] = FT_GET_USHORT(); + FT_Byte* p; - if ( load_offsets ) - range->glyph_offsets[n] = (FT_ULong)range->image_offset + - FT_GET_USHORT(); - } - FT_FRAME_EXIT(); + if ( 8 + 48 * strike_index + 3 * 4 + 34 + 1 > face->sbit_table_size ) + { + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + p = decoder->eblc_base + 8 + 48 * strike_index; + + decoder->strike_index_array = FT_NEXT_ULONG( p ); + p += 4; + decoder->strike_index_count = FT_NEXT_ULONG( p ); + p += 34; + decoder->bit_depth = *p; + + if ( decoder->strike_index_array > face->sbit_table_size || + decoder->strike_index_array + 8 * decoder->strike_index_count > + face->sbit_table_size ) + error = FT_THROW( Invalid_File_Format ); + } Exit: return error; } - /*************************************************************************/ - /* */ - /* <Function> */ - /* Load_SBit_Range */ - /* */ - /* <Description> */ - /* Loads a given `EBLC' index/range table. */ - /* */ - /* <Input> */ - /* range :: The target range. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - static FT_Error - Load_SBit_Range( TT_SBit_Range range, - FT_Stream stream ) + static void + tt_sbit_decoder_done( TT_SBitDecoder decoder ) { - FT_Error error; - FT_Memory memory = stream->memory; - - - switch( range->index_format ) - { - case 1: /* variable metrics with 4-byte offsets */ - case 3: /* variable metrics with 2-byte offsets */ - { - FT_ULong num_glyphs, n; - FT_Int size_elem; - FT_Bool large = FT_BOOL( range->index_format == 1 ); + FT_UNUSED( decoder ); + } + static FT_Error + tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder decoder, + FT_UInt load_flags ) + { + FT_Error error = FT_Err_Ok; + FT_UInt width, height; + FT_Bitmap* map = decoder->bitmap; + FT_Long size; - if ( range->last_glyph < range->first_glyph ) - { - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - num_glyphs = range->last_glyph - range->first_glyph + 1L; - range->num_glyphs = num_glyphs; - num_glyphs++; /* XXX: BEWARE - see spec */ + if ( !decoder->metrics_loaded ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + } - size_elem = large ? 4 : 2; + width = decoder->metrics->width; + height = decoder->metrics->height; - if ( FT_NEW_ARRAY( range->glyph_offsets, num_glyphs ) || - FT_FRAME_ENTER( num_glyphs * size_elem ) ) - goto Exit; + map->width = (int)width; + map->rows = (int)height; - for ( n = 0; n < num_glyphs; n++ ) - range->glyph_offsets[n] = (FT_ULong)( range->image_offset + - ( large ? FT_GET_ULONG() - : FT_GET_USHORT() ) ); - FT_FRAME_EXIT(); - } + switch ( decoder->bit_depth ) + { + case 1: + map->pixel_mode = FT_PIXEL_MODE_MONO; + map->pitch = ( map->width + 7 ) >> 3; + map->num_grays = 2; break; - case 2: /* all glyphs have identical metrics */ - error = Load_SBit_Const_Metrics( range, stream ); + case 2: + map->pixel_mode = FT_PIXEL_MODE_GRAY2; + map->pitch = ( map->width + 3 ) >> 2; + map->num_grays = 4; break; case 4: - error = Load_SBit_Range_Codes( range, stream, 1 ); + map->pixel_mode = FT_PIXEL_MODE_GRAY4; + map->pitch = ( map->width + 1 ) >> 1; + map->num_grays = 16; break; - case 5: - error = Load_SBit_Const_Metrics( range, stream ); - if ( !error ) - error = Load_SBit_Range_Codes( range, stream, 0 ); + case 8: + map->pixel_mode = FT_PIXEL_MODE_GRAY; + map->pitch = map->width; + map->num_grays = 256; + break; + + case 32: + if ( load_flags & FT_LOAD_COLOR ) + { + map->pixel_mode = FT_PIXEL_MODE_BGRA; + map->pitch = map->width * 4; + map->num_grays = 256; + } + else + { + map->pixel_mode = FT_PIXEL_MODE_GRAY; + map->pitch = map->width; + map->num_grays = 256; + } break; default: - error = SFNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); + goto Exit; } + size = map->rows * map->pitch; + + /* check that there is no empty image */ + if ( size == 0 ) + goto Exit; /* exit successfully! */ + + error = ft_glyphslot_alloc_bitmap( decoder->face->root.glyph, size ); + if ( error ) + goto Exit; + + decoder->bitmap_allocated = 1; + Exit: return error; } - /*************************************************************************/ - /* */ - /* <Function> */ - /* tt_face_load_eblc */ - /* */ - /* <Description> */ - /* Loads the table of embedded bitmap sizes for this face. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - /* stream :: The input stream. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - FT_LOCAL_DEF( FT_Error ) - tt_face_load_eblc( TT_Face face, - FT_Stream stream ) + static FT_Error + tt_sbit_decoder_load_metrics( TT_SBitDecoder decoder, + FT_Byte* *pp, + FT_Byte* limit, + FT_Bool big ) { - FT_Error error = SFNT_Err_Ok; - FT_Memory memory = stream->memory; - FT_Fixed version; - FT_ULong num_strikes; - FT_ULong table_base; + FT_Byte* p = *pp; + TT_SBit_Metrics metrics = decoder->metrics; - static const FT_Frame_Field sbit_line_metrics_fields[] = - { -#undef FT_STRUCTURE -#define FT_STRUCTURE TT_SBit_LineMetricsRec - - /* no FT_FRAME_START */ - FT_FRAME_CHAR( ascender ), - FT_FRAME_CHAR( descender ), - FT_FRAME_BYTE( max_width ), - - FT_FRAME_CHAR( caret_slope_numerator ), - FT_FRAME_CHAR( caret_slope_denominator ), - FT_FRAME_CHAR( caret_offset ), - - FT_FRAME_CHAR( min_origin_SB ), - FT_FRAME_CHAR( min_advance_SB ), - FT_FRAME_CHAR( max_before_BL ), - FT_FRAME_CHAR( min_after_BL ), - FT_FRAME_CHAR( pads[0] ), - FT_FRAME_CHAR( pads[1] ), - FT_FRAME_END - }; - - static const FT_Frame_Field strike_start_fields[] = - { -#undef FT_STRUCTURE -#define FT_STRUCTURE TT_SBit_StrikeRec - - /* no FT_FRAME_START */ - FT_FRAME_ULONG( ranges_offset ), - FT_FRAME_SKIP_LONG, - FT_FRAME_ULONG( num_ranges ), - FT_FRAME_ULONG( color_ref ), - FT_FRAME_END - }; - - static const FT_Frame_Field strike_end_fields[] = + + if ( p + 5 > limit ) + goto Fail; + + metrics->height = p[0]; + metrics->width = p[1]; + metrics->horiBearingX = (FT_Char)p[2]; + metrics->horiBearingY = (FT_Char)p[3]; + metrics->horiAdvance = p[4]; + + p += 5; + if ( big ) { - /* no FT_FRAME_START */ - FT_FRAME_USHORT( start_glyph ), - FT_FRAME_USHORT( end_glyph ), - FT_FRAME_BYTE ( x_ppem ), - FT_FRAME_BYTE ( y_ppem ), - FT_FRAME_BYTE ( bit_depth ), - FT_FRAME_CHAR ( flags ), - FT_FRAME_END - }; + if ( p + 3 > limit ) + goto Fail; + metrics->vertBearingX = (FT_Char)p[0]; + metrics->vertBearingY = (FT_Char)p[1]; + metrics->vertAdvance = p[2]; - face->num_sbit_strikes = 0; + p += 3; + } - /* this table is optional */ - error = face->goto_table( face, TTAG_EBLC, stream, 0 ); - if ( error ) - error = face->goto_table( face, TTAG_bloc, stream, 0 ); - if ( error ) - goto Exit; + decoder->metrics_loaded = 1; + *pp = p; + return FT_Err_Ok; - table_base = FT_STREAM_POS(); - if ( FT_FRAME_ENTER( 8L ) ) - goto Exit; + Fail: + FT_TRACE1(( "tt_sbit_decoder_load_metrics: broken table" )); + return FT_THROW( Invalid_Argument ); + } - version = FT_GET_LONG(); - num_strikes = FT_GET_ULONG(); - FT_FRAME_EXIT(); + /* forward declaration */ + static FT_Error + tt_sbit_decoder_load_image( TT_SBitDecoder decoder, + FT_UInt load_flags, + FT_UInt glyph_index, + FT_Int x_pos, + FT_Int y_pos ); - /* check version number and strike count */ - if ( version != 0x00020000L || - num_strikes >= 0x10000L ) - { - FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" )); - error = SFNT_Err_Invalid_File_Format; + typedef FT_Error (*TT_SBitDecoder_LoadFunc)( TT_SBitDecoder decoder, + FT_UInt load_flags, + FT_Byte* p, + FT_Byte* plimit, + FT_Int x_pos, + FT_Int y_pos ); - goto Exit; - } - /* allocate the strikes table */ - if ( FT_NEW_ARRAY( face->sbit_strikes, num_strikes ) ) - goto Exit; + static FT_Error + tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder decoder, + FT_UInt load_flags, + FT_Byte* p, + FT_Byte* limit, + FT_Int x_pos, + FT_Int y_pos ) + { + FT_Error error = FT_Err_Ok; + FT_Byte* line; + FT_Int bit_height, bit_width, pitch, width, height, line_bits, h; + FT_Bitmap* bitmap; - face->num_sbit_strikes = num_strikes; + FT_UNUSED( load_flags ); - /* now read each strike table separately */ - { - TT_SBit_Strike strike = face->sbit_strikes; - FT_ULong count = num_strikes; + /* check that we can write the glyph into the bitmap */ + bitmap = decoder->bitmap; + bit_width = bitmap->width; + bit_height = bitmap->rows; + pitch = bitmap->pitch; + line = bitmap->buffer; - if ( FT_FRAME_ENTER( 48L * num_strikes ) ) - goto Exit; + width = decoder->metrics->width; + height = decoder->metrics->height; - while ( count > 0 ) - { - if ( FT_STREAM_READ_FIELDS( strike_start_fields, strike ) || - FT_STREAM_READ_FIELDS( sbit_line_metrics_fields, &strike->hori ) || - FT_STREAM_READ_FIELDS( sbit_line_metrics_fields, &strike->vert ) || - FT_STREAM_READ_FIELDS( strike_end_fields, strike ) ) - break; - - count--; - strike++; - } + line_bits = width * decoder->bit_depth; - FT_FRAME_EXIT(); + if ( x_pos < 0 || x_pos + width > bit_width || + y_pos < 0 || y_pos + height > bit_height ) + { + FT_TRACE1(( "tt_sbit_decoder_load_byte_aligned:" + " invalid bitmap dimensions\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; } - /* allocate the index ranges for each strike table */ + if ( p + ( ( line_bits + 7 ) >> 3 ) * height > limit ) { - TT_SBit_Strike strike = face->sbit_strikes; - FT_ULong count = num_strikes; + FT_TRACE1(( "tt_sbit_decoder_load_byte_aligned: broken bitmap\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + /* now do the blit */ + line += y_pos * pitch + ( x_pos >> 3 ); + x_pos &= 7; - while ( count > 0 ) + if ( x_pos == 0 ) /* the easy one */ + { + for ( h = height; h > 0; h--, line += pitch ) { - TT_SBit_Range range; - FT_ULong count2 = strike->num_ranges; + FT_Byte* pwrite = line; + FT_Int w; - /* read each range */ - if ( FT_STREAM_SEEK( table_base + strike->ranges_offset ) || - FT_FRAME_ENTER( strike->num_ranges * 8L ) ) - goto Exit; - - if ( FT_NEW_ARRAY( strike->sbit_ranges, strike->num_ranges ) ) - goto Exit; - - range = strike->sbit_ranges; - while ( count2 > 0 ) + for ( w = line_bits; w >= 8; w -= 8 ) { - range->first_glyph = FT_GET_USHORT(); - range->last_glyph = FT_GET_USHORT(); - range->table_offset = table_base + strike->ranges_offset + - FT_GET_ULONG(); - count2--; - range++; + pwrite[0] = (FT_Byte)( pwrite[0] | *p++ ); + pwrite += 1; } - FT_FRAME_EXIT(); + if ( w > 0 ) + pwrite[0] = (FT_Byte)( pwrite[0] | ( *p++ & ( 0xFF00U >> w ) ) ); + } + } + else /* x_pos > 0 */ + { + for ( h = height; h > 0; h--, line += pitch ) + { + FT_Byte* pwrite = line; + FT_Int w; + FT_UInt wval = 0; + - /* Now, read each index table */ - count2 = strike->num_ranges; - range = strike->sbit_ranges; - while ( count2 > 0 ) + for ( w = line_bits; w >= 8; w -= 8 ) { - /* Read the header */ - if ( FT_STREAM_SEEK( range->table_offset ) || - FT_FRAME_ENTER( 8L ) ) - goto Exit; + wval = (FT_UInt)( wval | *p++ ); + pwrite[0] = (FT_Byte)( pwrite[0] | ( wval >> x_pos ) ); + pwrite += 1; + wval <<= 8; + } - range->index_format = FT_GET_USHORT(); - range->image_format = FT_GET_USHORT(); - range->image_offset = FT_GET_ULONG(); + if ( w > 0 ) + wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) ); - FT_FRAME_EXIT(); + /* all bits read and there are `x_pos + w' bits to be written */ - error = Load_SBit_Range( range, stream ); - if ( error ) - goto Exit; + pwrite[0] = (FT_Byte)( pwrite[0] | ( wval >> x_pos ) ); - count2--; - range++; + if ( x_pos + w > 8 ) + { + pwrite++; + wval <<= 8; + pwrite[0] = (FT_Byte)( pwrite[0] | ( wval >> x_pos ) ); } - - count--; - strike++; } } Exit: + if ( !error ) + FT_TRACE3(( "tt_sbit_decoder_load_byte_aligned: loaded\n" )); return error; } - /*************************************************************************/ - /* */ - /* <Function> */ - /* tt_face_free_eblc */ - /* */ - /* <Description> */ - /* Releases the embedded bitmap tables. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - FT_LOCAL_DEF( void ) - tt_face_free_eblc( TT_Face face ) + /* + * Load a bit-aligned bitmap (with pointer `p') into a line-aligned bitmap + * (with pointer `pwrite'). In the example below, the width is 3 pixel, + * and `x_pos' is 1 pixel. + * + * p p+1 + * | | | + * | 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 |... + * | | | + * +-------+ +-------+ +-------+ ... + * . . . + * . . . + * v . . + * +-------+ . . + * | | . + * | 7 6 5 4 3 2 1 0 | . + * | | . + * pwrite . . + * . . + * v . + * +-------+ . + * | | + * | 7 6 5 4 3 2 1 0 | + * | | + * pwrite+1 . + * . + * v + * +-------+ + * | | + * | 7 6 5 4 3 2 1 0 | + * | | + * pwrite+2 + * + */ + + static FT_Error + tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder decoder, + FT_UInt load_flags, + FT_Byte* p, + FT_Byte* limit, + FT_Int x_pos, + FT_Int y_pos ) { - FT_Memory memory = face->root.memory; - TT_SBit_Strike strike = face->sbit_strikes; - TT_SBit_Strike strike_limit = strike + face->num_sbit_strikes; + FT_Error error = FT_Err_Ok; + FT_Byte* line; + FT_Int bit_height, bit_width, pitch, width, height, line_bits, h, nbits; + FT_Bitmap* bitmap; + FT_UShort rval; + FT_UNUSED( load_flags ); - if ( strike ) - { - for ( ; strike < strike_limit; strike++ ) - { - TT_SBit_Range range = strike->sbit_ranges; - TT_SBit_Range range_limit = range + strike->num_ranges; + /* check that we can write the glyph into the bitmap */ + bitmap = decoder->bitmap; + bit_width = bitmap->width; + bit_height = bitmap->rows; + pitch = bitmap->pitch; + line = bitmap->buffer; - if ( range ) - { - for ( ; range < range_limit; range++ ) - { - /* release the glyph offsets and codes tables */ - /* where appropriate */ - FT_FREE( range->glyph_offsets ); - FT_FREE( range->glyph_codes ); - } - } - FT_FREE( strike->sbit_ranges ); - strike->num_ranges = 0; - } - FT_FREE( face->sbit_strikes ); + width = decoder->metrics->width; + height = decoder->metrics->height; + + line_bits = width * decoder->bit_depth; + + if ( x_pos < 0 || x_pos + width > bit_width || + y_pos < 0 || y_pos + height > bit_height ) + { + FT_TRACE1(( "tt_sbit_decoder_load_bit_aligned:" + " invalid bitmap dimensions\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; } - face->num_sbit_strikes = 0; - } + if ( p + ( ( line_bits * height + 7 ) >> 3 ) > limit ) + { + FT_TRACE1(( "tt_sbit_decoder_load_bit_aligned: broken bitmap\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } - FT_LOCAL_DEF( FT_Error ) - tt_face_set_sbit_strike( TT_Face face, - FT_Size_Request req, - FT_ULong* astrike_index ) - { - return FT_Match_Size( (FT_Face)face, req, 0, astrike_index ); - } + /* now do the blit */ + /* adjust `line' to point to the first byte of the bitmap */ + line += y_pos * pitch + ( x_pos >> 3 ); + x_pos &= 7; - FT_LOCAL_DEF( FT_Error ) - tt_face_load_strike_metrics( TT_Face face, - FT_ULong strike_index, - FT_Size_Metrics* metrics ) - { - TT_SBit_Strike strike; + /* the higher byte of `rval' is used as a buffer */ + rval = 0; + nbits = 0; + for ( h = height; h > 0; h--, line += pitch ) + { + FT_Byte* pwrite = line; + FT_Int w = line_bits; - if ( strike_index >= face->num_sbit_strikes ) - return SFNT_Err_Invalid_Argument; - strike = face->sbit_strikes + strike_index; + /* handle initial byte (in target bitmap) specially if necessary */ + if ( x_pos ) + { + w = ( line_bits < 8 - x_pos ) ? line_bits : 8 - x_pos; - metrics->x_ppem = strike->x_ppem; - metrics->y_ppem = strike->y_ppem; + if ( h == height ) + { + rval = *p++; + nbits = x_pos; + } + else if ( nbits < w ) + { + if ( p < limit ) + rval |= *p++; + nbits += 8 - w; + } + else + { + rval >>= 8; + nbits -= w; + } - metrics->ascender = strike->hori.ascender << 6; - metrics->descender = strike->hori.descender << 6; + *pwrite++ |= ( ( rval >> nbits ) & 0xFF ) & + ( ~( 0xFF << w ) << ( 8 - w - x_pos ) ); + rval <<= 8; - /* XXX: Is this correct? */ - metrics->max_advance = ( strike->hori.min_origin_SB + - strike->hori.max_width + - strike->hori.min_advance_SB ) << 6; + w = line_bits - w; + } - metrics->height = metrics->ascender - metrics->descender; + /* handle medial bytes */ + for ( ; w >= 8; w -= 8 ) + { + rval |= *p++; + *pwrite++ |= ( rval >> nbits ) & 0xFF; - return SFNT_Err_Ok; + rval <<= 8; + } + + /* handle final byte if necessary */ + if ( w > 0 ) + { + if ( nbits < w ) + { + if ( p < limit ) + rval |= *p++; + *pwrite |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w ); + nbits += 8 - w; + + rval <<= 8; + } + else + { + *pwrite |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w ); + nbits -= w; + } + } + } + + Exit: + if ( !error ) + FT_TRACE3(( "tt_sbit_decoder_load_bit_aligned: loaded\n" )); + return error; } - /*************************************************************************/ - /* */ - /* <Function> */ - /* find_sbit_range */ - /* */ - /* <Description> */ - /* Scans a given strike's ranges and return, for a given glyph */ - /* index, the corresponding sbit range, and `EBDT' offset. */ - /* */ - /* <Input> */ - /* glyph_index :: The glyph index. */ - /* */ - /* strike :: The source/current sbit strike. */ - /* */ - /* <Output> */ - /* arange :: The sbit range containing the glyph index. */ - /* */ - /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means the glyph index was found. */ - /* */ static FT_Error - find_sbit_range( FT_UInt glyph_index, - TT_SBit_Strike strike, - TT_SBit_Range *arange, - FT_ULong *aglyph_offset ) + tt_sbit_decoder_load_compound( TT_SBitDecoder decoder, + FT_UInt load_flags, + FT_Byte* p, + FT_Byte* limit, + FT_Int x_pos, + FT_Int y_pos ) { - TT_SBit_RangeRec *range, *range_limit; + FT_Error error = FT_Err_Ok; + FT_UInt num_components, nn; + FT_Char horiBearingX = decoder->metrics->horiBearingX; + FT_Char horiBearingY = decoder->metrics->horiBearingY; + FT_Byte horiAdvance = decoder->metrics->horiAdvance; + FT_Char vertBearingX = decoder->metrics->vertBearingX; + FT_Char vertBearingY = decoder->metrics->vertBearingY; + FT_Byte vertAdvance = decoder->metrics->vertAdvance; - /* check whether the glyph index is within this strike's */ - /* glyph range */ - if ( glyph_index < (FT_UInt)strike->start_glyph || - glyph_index > (FT_UInt)strike->end_glyph ) - goto Fail; - /* scan all ranges in strike */ - range = strike->sbit_ranges; - range_limit = range + strike->num_ranges; - if ( !range ) + if ( p + 2 > limit ) goto Fail; - for ( ; range < range_limit; range++ ) + num_components = FT_NEXT_USHORT( p ); + if ( p + 4 * num_components > limit ) { - if ( glyph_index >= (FT_UInt)range->first_glyph && - glyph_index <= (FT_UInt)range->last_glyph ) - { - FT_UShort delta = (FT_UShort)( glyph_index - range->first_glyph ); + FT_TRACE1(( "tt_sbit_decoder_load_compound: broken table\n" )); + goto Fail; + } + FT_TRACE3(( "tt_sbit_decoder_load_compound: loading %d components\n", + num_components )); - switch ( range->index_format ) - { - case 1: - case 3: - *aglyph_offset = range->glyph_offsets[delta]; - break; - - case 2: - *aglyph_offset = range->image_offset + - range->image_size * delta; - break; - - case 4: - case 5: - { - FT_ULong n; - - - for ( n = 0; n < range->num_glyphs; n++ ) - { - if ( (FT_UInt)range->glyph_codes[n] == glyph_index ) - { - if ( range->index_format == 4 ) - *aglyph_offset = range->glyph_offsets[n]; - else - *aglyph_offset = range->image_offset + - n * range->image_size; - goto Found; - } - } - } + for ( nn = 0; nn < num_components; nn++ ) + { + FT_UInt gindex = FT_NEXT_USHORT( p ); + FT_Byte dx = FT_NEXT_BYTE( p ); + FT_Byte dy = FT_NEXT_BYTE( p ); - /* fall-through */ - default: - goto Fail; - } - Found: - /* return successfully! */ - *arange = range; - return SFNT_Err_Ok; - } + /* NB: a recursive call */ + error = tt_sbit_decoder_load_image( decoder, load_flags, gindex, + x_pos + dx, y_pos + dy ); + if ( error ) + break; } - Fail: - *arange = 0; - *aglyph_offset = 0; + FT_TRACE3(( "tt_sbit_decoder_load_compound: done\n" )); - return SFNT_Err_Invalid_Argument; - } + decoder->metrics->horiBearingX = horiBearingX; + decoder->metrics->horiBearingY = horiBearingY; + decoder->metrics->horiAdvance = horiAdvance; + decoder->metrics->vertBearingX = vertBearingX; + decoder->metrics->vertBearingY = vertBearingY; + decoder->metrics->vertAdvance = vertAdvance; + decoder->metrics->width = (FT_Byte)decoder->bitmap->width; + decoder->metrics->height = (FT_Byte)decoder->bitmap->rows; + Exit: + return error; - /*************************************************************************/ - /* */ - /* <Function> */ - /* tt_find_sbit_image */ - /* */ - /* <Description> */ - /* Checks whether an embedded bitmap (an `sbit') exists for a given */ - /* glyph, at a given strike. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - /* glyph_index :: The glyph index. */ - /* */ - /* strike_index :: The current strike index. */ - /* */ - /* <Output> */ - /* arange :: The SBit range containing the glyph index. */ - /* */ - /* astrike :: The SBit strike containing the glyph index. */ - /* */ - /* aglyph_offset :: The offset of the glyph data in `EBDT' table. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. Returns */ - /* SFNT_Err_Invalid_Argument if no sbit exists for the requested */ - /* glyph. */ - /* */ - FT_LOCAL( FT_Error ) - tt_find_sbit_image( TT_Face face, - FT_UInt glyph_index, - FT_ULong strike_index, - TT_SBit_Range *arange, - TT_SBit_Strike *astrike, - FT_ULong *aglyph_offset ) - { - FT_Error error; - TT_SBit_Strike strike; + Fail: + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } - if ( !face->sbit_strikes || - ( face->num_sbit_strikes <= strike_index ) ) - goto Fail; +#ifdef FT_CONFIG_OPTION_USE_PNG - strike = &face->sbit_strikes[strike_index]; + static FT_Error + tt_sbit_decoder_load_png( TT_SBitDecoder decoder, + FT_UInt load_flags, + FT_Byte* p, + FT_Byte* limit, + FT_Int x_pos, + FT_Int y_pos ) + { + FT_Error error = FT_Err_Ok; + FT_ULong png_len; - error = find_sbit_range( glyph_index, strike, - arange, aglyph_offset ); - if ( error ) - goto Fail; + FT_UNUSED( load_flags ); - *astrike = strike; - return SFNT_Err_Ok; + if ( limit - p < 4 ) + { + FT_TRACE1(( "tt_sbit_decoder_load_png: broken bitmap\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } - Fail: - /* no embedded bitmap for this glyph in face */ - *arange = 0; - *astrike = 0; - *aglyph_offset = 0; + png_len = FT_NEXT_ULONG( p ); + if ( (FT_ULong)( limit - p ) < png_len ) + { + FT_TRACE1(( "tt_sbit_decoder_load_png: broken bitmap\n" )); + error = FT_THROW( Invalid_File_Format ); + goto Exit; + } + + error = Load_SBit_Png( decoder->bitmap, + x_pos, + y_pos, + decoder->bit_depth, + decoder->metrics, + decoder->stream->memory, + p, + png_len ); - return SFNT_Err_Invalid_Argument; + Exit: + if ( !error ) + FT_TRACE3(( "tt_sbit_decoder_load_png: loaded\n" )); + return error; } +#endif /* FT_CONFIG_OPTION_USE_PNG */ - /*************************************************************************/ - /* */ - /* <Function> */ - /* tt_load_sbit_metrics */ - /* */ - /* <Description> */ - /* Gets the big metrics for a given SBit. */ - /* */ - /* <Input> */ - /* stream :: The input stream. */ - /* */ - /* range :: The SBit range containing the glyph. */ - /* */ - /* <Output> */ - /* big_metrics :: A big SBit metrics structure for the glyph. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. */ - /* */ - /* <Note> */ - /* The stream cursor must be positioned at the glyph's offset within */ - /* the `EBDT' table before the call. */ - /* */ - /* If the image format uses variable metrics, the stream cursor is */ - /* positioned just after the metrics header in the `EBDT' table on */ - /* function exit. */ - /* */ - FT_LOCAL( FT_Error ) - tt_load_sbit_metrics( FT_Stream stream, - TT_SBit_Range range, - TT_SBit_Metrics metrics ) + + static FT_Error + tt_sbit_decoder_load_bitmap( TT_SBitDecoder decoder, + FT_UInt load_flags, + FT_UInt glyph_format, + FT_ULong glyph_start, + FT_ULong glyph_size, + FT_Int x_pos, + FT_Int y_pos ) { - FT_Error error = SFNT_Err_Ok; + FT_Error error; + FT_Stream stream = decoder->stream; + FT_Byte* p; + FT_Byte* p_limit; + FT_Byte* data; - switch ( range->image_format ) + /* seek into the EBDT table now */ + if ( glyph_start + glyph_size > decoder->ebdt_size ) + { + error = FT_THROW( Invalid_Argument ); + goto Exit; + } + + if ( FT_STREAM_SEEK( decoder->ebdt_start + glyph_start ) || + FT_FRAME_EXTRACT( glyph_size, data ) ) + goto Exit; + + p = data; + p_limit = p + glyph_size; + + /* read the data, depending on the glyph format */ + switch ( glyph_format ) { case 1: case 2: case 8: - /* variable small metrics */ - { - TT_SBit_SmallMetricsRec smetrics; - - static const FT_Frame_Field sbit_small_metrics_fields[] = - { -#undef FT_STRUCTURE -#define FT_STRUCTURE TT_SBit_SmallMetricsRec - - FT_FRAME_START( 5 ), - FT_FRAME_BYTE( height ), - FT_FRAME_BYTE( width ), - FT_FRAME_CHAR( bearingX ), - FT_FRAME_CHAR( bearingY ), - FT_FRAME_BYTE( advance ), - FT_FRAME_END - }; - - - /* read small metrics */ - if ( FT_STREAM_READ_FIELDS( sbit_small_metrics_fields, &smetrics ) ) - goto Exit; - - /* convert it to a big metrics */ - metrics->height = smetrics.height; - metrics->width = smetrics.width; - metrics->horiBearingX = smetrics.bearingX; - metrics->horiBearingY = smetrics.bearingY; - metrics->horiAdvance = smetrics.advance; - - /* these metrics are made up at a higher level when */ - /* needed. */ - metrics->vertBearingX = 0; - metrics->vertBearingY = 0; - metrics->vertAdvance = 0; - } + case 17: + error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 0 ); break; case 6: case 7: case 9: - /* variable big metrics */ - if ( FT_STREAM_READ_FIELDS( sbit_metrics_fields, metrics ) ) - goto Exit; + case 18: + error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ); break; - case 5: - default: /* constant metrics */ - if ( range->index_format == 2 || range->index_format == 5 ) - *metrics = range->metrics; - else - return SFNT_Err_Invalid_File_Format; - } - - Exit: - return error; - } + default: + error = FT_Err_Ok; + } + if ( error ) + goto Fail; - /*************************************************************************/ - /* */ - /* <Function> */ - /* crop_bitmap */ - /* */ - /* <Description> */ - /* Crops a bitmap to its tightest bounding box, and adjusts its */ - /* metrics. */ - /* */ - /* <InOut> */ - /* map :: The bitmap. */ - /* */ - /* metrics :: The corresponding metrics structure. */ - /* */ - static void - crop_bitmap( FT_Bitmap* map, - TT_SBit_Metrics metrics ) - { - /***********************************************************************/ - /* */ - /* In this situation, some bounding boxes of embedded bitmaps are too */ - /* large. We need to crop it to a reasonable size. */ - /* */ - /* --------- */ - /* | | ----- */ - /* | *** | |***| */ - /* | * | | * | */ - /* | * | ------> | * | */ - /* | * | | * | */ - /* | * | | * | */ - /* | *** | |***| */ - /* --------- ----- */ - /* */ - /***********************************************************************/ - - FT_Int rows, count; - FT_Long line_len; - FT_Byte* line; - - - /***********************************************************************/ - /* */ - /* first of all, check the top-most lines of the bitmap, and remove */ - /* them if they're empty. */ - /* */ { - line = (FT_Byte*)map->buffer; - rows = map->rows; - line_len = map->pitch; + TT_SBitDecoder_LoadFunc loader; - for ( count = 0; count < rows; count++ ) + switch ( glyph_format ) { - FT_Byte* cur = line; - FT_Byte* limit = line + line_len; - - - for ( ; cur < limit; cur++ ) - if ( cur[0] ) - goto Found_Top; + case 1: + case 6: + loader = tt_sbit_decoder_load_byte_aligned; + break; - /* the current line was empty - skip to next one */ - line = limit; - } + case 2: + case 5: + case 7: + loader = tt_sbit_decoder_load_bit_aligned; + break; - Found_Top: - /* check that we have at least one filled line */ - if ( count >= rows ) - goto Empty_Bitmap; + case 8: + if ( p + 1 > p_limit ) + goto Fail; - /* now, crop the empty upper lines */ - if ( count > 0 ) - { - line = (FT_Byte*)map->buffer; + p += 1; /* skip padding */ + /* fall-through */ - FT_MEM_MOVE( line, line + count * line_len, - ( rows - count ) * line_len ); + case 9: + loader = tt_sbit_decoder_load_compound; + break; - metrics->height = (FT_Byte)( metrics->height - count ); - metrics->horiBearingY = (FT_Char)( metrics->horiBearingY - count ); - metrics->vertBearingY = (FT_Char)( metrics->vertBearingY - count ); +#ifdef FT_CONFIG_OPTION_USE_PNG + case 17: /* small metrics, PNG image data */ + case 18: /* big metrics, PNG image data */ + case 19: /* metrics in EBLC, PNG image data */ + loader = tt_sbit_decoder_load_png; + break; +#endif /* FT_CONFIG_OPTION_USE_PNG */ - map->rows -= count; - rows -= count; + default: + error = FT_THROW( Invalid_Table ); + goto Fail; } - } - /***********************************************************************/ - /* */ - /* second, crop the lower lines */ - /* */ - { - line = (FT_Byte*)map->buffer + ( rows - 1 ) * line_len; - - for ( count = 0; count < rows; count++ ) + if ( !decoder->bitmap_allocated ) { - FT_Byte* cur = line; - FT_Byte* limit = line + line_len; - - - for ( ; cur < limit; cur++ ) - if ( cur[0] ) - goto Found_Bottom; - - /* the current line was empty - skip to previous one */ - line -= line_len; + error = tt_sbit_decoder_alloc_bitmap( decoder, load_flags ); + if ( error ) + goto Fail; } - Found_Bottom: - if ( count > 0 ) + if ( decoder->bit_depth == 32 && + decoder->bitmap->pixel_mode != FT_PIXEL_MODE_BGRA ) { - metrics->height = (FT_Byte)( metrics->height - count ); - rows -= count; - map->rows -= count; - } - } - - /***********************************************************************/ - /* */ - /* third, get rid of the space on the left side of the glyph */ - /* */ - do - { - FT_Byte* limit; - + /* Flatten color bitmaps if color was not requested. */ - line = (FT_Byte*)map->buffer; - limit = line + rows * line_len; + FT_Library library = decoder->face->root.glyph->library; + FT_Memory memory = decoder->stream->memory; - for ( ; line < limit; line += line_len ) - if ( line[0] & 0x80 ) - goto Found_Left; + FT_Bitmap color, *orig; - /* shift the whole glyph one pixel to the left */ - line = (FT_Byte*)map->buffer; - limit = line + rows * line_len; - for ( ; line < limit; line += line_len ) - { - FT_Int n, width = map->width; - FT_Byte old; - FT_Byte* cur = line; - - - old = (FT_Byte)(cur[0] << 1); - for ( n = 8; n < width; n += 8 ) + if ( decoder->bitmap->pixel_mode != FT_PIXEL_MODE_GRAY || + x_pos != 0 || y_pos != 0 ) { - FT_Byte val; - - - val = cur[1]; - cur[0] = (FT_Byte)( old | ( val >> 7 ) ); - old = (FT_Byte)( val << 1 ); - cur++; + /* Shouldn't happen. */ + error = FT_THROW( Invalid_Table ); + goto Fail; } - cur[0] = old; - } - map->width--; - metrics->horiBearingX++; - metrics->vertBearingX++; - metrics->width--; + FT_Bitmap_New( &color ); - } while ( map->width > 0 ); + color.rows = decoder->bitmap->rows; + color.width = decoder->bitmap->width; + color.pitch = color.width * 4; + color.pixel_mode = FT_PIXEL_MODE_BGRA; - Found_Left: + if ( FT_ALLOC( color.buffer, color.rows * color.pitch ) ) + goto Fail; - /***********************************************************************/ - /* */ - /* finally, crop the bitmap width to get rid of the space on the right */ - /* side of the glyph. */ - /* */ - do - { - FT_Int right = map->width - 1; - FT_Byte* limit; - FT_Byte mask; + orig = decoder->bitmap; + decoder->bitmap = &color; + error = loader( decoder, load_flags, p, p_limit, x_pos, y_pos ); - line = (FT_Byte*)map->buffer + ( right >> 3 ); - limit = line + rows * line_len; - mask = (FT_Byte)( 0x80 >> ( right & 7 ) ); + decoder->bitmap = orig; - for ( ; line < limit; line += line_len ) - if ( line[0] & mask ) - goto Found_Right; + /* explicitly test against FT_Err_Ok to avoid compiler warnings */ + /* (we do an assignment within a conditional) */ + if ( error || + ( error = FT_Bitmap_Convert( library, + &color, + decoder->bitmap, + 1 ) ) != FT_Err_Ok ) + { + FT_Bitmap_Done( library, &color ); + goto Fail; + } - /* crop the whole glyph to the right */ - map->width--; - metrics->width--; + FT_Bitmap_Done( library, &color ); + } - } while ( map->width > 0 ); + else + error = loader( decoder, load_flags, p, p_limit, x_pos, y_pos ); + } - Found_Right: - /* all right, the bitmap was cropped */ - return; + Fail: + FT_FRAME_RELEASE( data ); - Empty_Bitmap: - map->width = 0; - map->rows = 0; - map->pitch = 0; - map->pixel_mode = FT_PIXEL_MODE_MONO; + Exit: + return error; } static FT_Error - Load_SBit_Single( FT_Bitmap* map, - FT_Int x_offset, - FT_Int y_offset, - FT_Int pix_bits, - FT_UShort image_format, - TT_SBit_Metrics metrics, - FT_Stream stream ) + tt_sbit_decoder_load_image( TT_SBitDecoder decoder, + FT_UInt load_flags, + FT_UInt glyph_index, + FT_Int x_pos, + FT_Int y_pos ) { - FT_Error error; + /* + * First, we find the correct strike range that applies to this + * glyph index. + */ + + FT_Byte* p = decoder->eblc_base + decoder->strike_index_array; + FT_Byte* p_limit = decoder->eblc_limit; + FT_ULong num_ranges = decoder->strike_index_count; + FT_UInt start, end, index_format, image_format; + FT_ULong image_start = 0, image_end = 0, image_offset; - /* check that the source bitmap fits into the target pixmap */ - if ( x_offset < 0 || x_offset + metrics->width > map->width || - y_offset < 0 || y_offset + metrics->height > map->rows ) + for ( ; num_ranges > 0; num_ranges-- ) { - error = SFNT_Err_Invalid_Argument; + start = FT_NEXT_USHORT( p ); + end = FT_NEXT_USHORT( p ); - goto Exit; - } + if ( glyph_index >= start && glyph_index <= end ) + goto FoundRange; - { - FT_Int glyph_width = metrics->width; - FT_Int glyph_height = metrics->height; - FT_Int glyph_size; - FT_Int line_bits = pix_bits * glyph_width; - FT_Bool pad_bytes = 0; + p += 4; /* ignore index offset */ + } + goto NoBitmap; + FoundRange: + image_offset = FT_NEXT_ULONG( p ); - /* compute size of glyph image */ - switch ( image_format ) - { - case 1: /* byte-padded formats */ - case 6: - { - FT_Int line_length; + /* overflow check */ + p = decoder->eblc_base + decoder->strike_index_array; + if ( image_offset > (FT_ULong)( p_limit - p ) ) + goto Failure; + p += image_offset; + if ( p + 8 > p_limit ) + goto NoBitmap; - switch ( pix_bits ) - { - case 1: - line_length = ( glyph_width + 7 ) >> 3; - break; - case 2: - line_length = ( glyph_width + 3 ) >> 2; - break; - case 4: - line_length = ( glyph_width + 1 ) >> 1; - break; - default: - line_length = glyph_width; - } + /* now find the glyph's location and extend within the ebdt table */ + index_format = FT_NEXT_USHORT( p ); + image_format = FT_NEXT_USHORT( p ); + image_offset = FT_NEXT_ULONG ( p ); - glyph_size = glyph_height * line_length; - pad_bytes = 1; - } - break; + switch ( index_format ) + { + case 1: /* 4-byte offsets relative to `image_offset' */ + { + p += 4 * ( glyph_index - start ); + if ( p + 8 > p_limit ) + goto NoBitmap; - case 2: - case 5: - case 7: - line_bits = glyph_width * pix_bits; - glyph_size = ( glyph_height * line_bits + 7 ) >> 3; - break; + image_start = FT_NEXT_ULONG( p ); + image_end = FT_NEXT_ULONG( p ); - default: /* invalid format */ - return SFNT_Err_Invalid_File_Format; + if ( image_start == image_end ) /* missing glyph */ + goto NoBitmap; } + break; - /* Now read data and draw glyph into target pixmap */ - if ( FT_FRAME_ENTER( glyph_size ) ) - goto Exit; + case 2: /* big metrics, constant image size */ + { + FT_ULong image_size; - /* don't forget to multiply `x_offset' by `map->pix_bits' as */ - /* the sbit blitter doesn't make a difference between pixmap */ - /* depths. */ - blit_sbit( map, (FT_Byte*)stream->cursor, line_bits, pad_bytes, - x_offset * pix_bits, y_offset, metrics->height ); - FT_FRAME_EXIT(); - } + if ( p + 12 > p_limit ) + goto NoBitmap; - Exit: - return error; - } + image_size = FT_NEXT_ULONG( p ); + if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) ) + goto NoBitmap; - static FT_Error - Load_SBit_Image( TT_SBit_Strike strike, - TT_SBit_Range range, - FT_ULong ebdt_pos, - FT_ULong glyph_offset, - FT_GlyphSlot slot, - FT_Int x_offset, - FT_Int y_offset, - FT_Stream stream, - TT_SBit_Metrics metrics, - FT_Int depth ) - { - FT_Memory memory = stream->memory; - FT_Bitmap* map = &slot->bitmap; - FT_Error error; + image_start = image_size * ( glyph_index - start ); + image_end = image_start + image_size; + } + break; + case 3: /* 2-byte offsets relative to 'image_offset' */ + { + p += 2 * ( glyph_index - start ); + if ( p + 4 > p_limit ) + goto NoBitmap; - /* place stream at beginning of glyph data and read metrics */ - if ( FT_STREAM_SEEK( ebdt_pos + glyph_offset ) ) - goto Exit; + image_start = FT_NEXT_USHORT( p ); + image_end = FT_NEXT_USHORT( p ); - error = tt_load_sbit_metrics( stream, range, metrics ); - if ( error ) - goto Exit; + if ( image_start == image_end ) /* missing glyph */ + goto NoBitmap; + } + break; - /* This function is recursive. At the top-level call, we */ - /* compute the dimensions of the higher-level glyph to */ - /* allocate the final pixmap buffer. */ - if ( depth == 0 ) - { - FT_Long size; + case 4: /* sparse glyph array with (glyph,offset) pairs */ + { + FT_ULong mm, num_glyphs; - map->width = metrics->width; - map->rows = metrics->height; + if ( p + 4 > p_limit ) + goto NoBitmap; - switch ( strike->bit_depth ) - { - case 1: - map->pixel_mode = FT_PIXEL_MODE_MONO; - map->pitch = ( map->width + 7 ) >> 3; - break; + num_glyphs = FT_NEXT_ULONG( p ); - case 2: - map->pixel_mode = FT_PIXEL_MODE_GRAY2; - map->pitch = ( map->width + 3 ) >> 2; - break; + /* overflow check for p + ( num_glyphs + 1 ) * 4 */ + if ( num_glyphs > (FT_ULong)( ( ( p_limit - p ) >> 2 ) - 1 ) ) + goto NoBitmap; - case 4: - map->pixel_mode = FT_PIXEL_MODE_GRAY4; - map->pitch = ( map->width + 1 ) >> 1; - break; + for ( mm = 0; mm < num_glyphs; mm++ ) + { + FT_UInt gindex = FT_NEXT_USHORT( p ); - case 8: - map->pixel_mode = FT_PIXEL_MODE_GRAY; - map->pitch = map->width; - break; - default: - return SFNT_Err_Invalid_File_Format; - } + if ( gindex == glyph_index ) + { + image_start = FT_NEXT_USHORT( p ); + p += 2; + image_end = FT_PEEK_USHORT( p ); + break; + } + p += 2; + } - size = map->rows * map->pitch; + if ( mm >= num_glyphs ) + goto NoBitmap; + } + break; - /* check that there is no empty image */ - if ( size == 0 ) - goto Exit; /* exit successfully! */ + case 5: /* constant metrics with sparse glyph codes */ + case 19: + { + FT_ULong image_size, mm, num_glyphs; - error = ft_glyphslot_alloc_bitmap( slot, size ); - if (error) - goto Exit; - } - switch ( range->image_format ) - { - case 1: /* single sbit image - load it */ - case 2: - case 5: - case 6: - case 7: - return Load_SBit_Single( map, x_offset, y_offset, strike->bit_depth, - range->image_format, metrics, stream ); + if ( p + 16 > p_limit ) + goto NoBitmap; - case 8: /* compound format */ - if ( FT_STREAM_SKIP( 1L ) ) - { - error = SFNT_Err_Invalid_Stream_Skip; - goto Exit; - } - /* fallthrough */ + image_size = FT_NEXT_ULONG( p ); - case 9: - break; + if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) ) + goto NoBitmap; - default: /* invalid image format */ - return SFNT_Err_Invalid_File_Format; - } + num_glyphs = FT_NEXT_ULONG( p ); - /* All right, we have a compound format. First of all, read */ - /* the array of elements. */ - { - TT_SBit_Component components = NULL; - TT_SBit_Component comp; - FT_UShort num_components, count; + /* overflow check for p + 2 * num_glyphs */ + if ( num_glyphs > (FT_ULong)( ( p_limit - p ) >> 1 ) ) + goto NoBitmap; + for ( mm = 0; mm < num_glyphs; mm++ ) + { + FT_UInt gindex = FT_NEXT_USHORT( p ); - if ( FT_READ_USHORT( num_components ) || - FT_NEW_ARRAY( components, num_components ) ) - goto Exit; - count = num_components; + if ( gindex == glyph_index ) + break; + } - if ( FT_FRAME_ENTER( 4L * num_components ) ) - goto Fail_Memory; + if ( mm >= num_glyphs ) + goto NoBitmap; - for ( comp = components; count > 0; count--, comp++ ) - { - comp->glyph_code = FT_GET_USHORT(); - comp->x_offset = FT_GET_CHAR(); - comp->y_offset = FT_GET_CHAR(); + image_start = image_size * mm; + image_end = image_start + image_size; } + break; - FT_FRAME_EXIT(); + default: + goto NoBitmap; + } - /* Now recursively load each element glyph */ - count = num_components; - comp = components; - for ( ; count > 0; count--, comp++ ) - { - TT_SBit_Range elem_range; - TT_SBit_MetricsRec elem_metrics; - FT_ULong elem_offset; + if ( image_start > image_end ) + goto NoBitmap; + image_end -= image_start; + image_start = image_offset + image_start; - /* find the range for this element */ - error = find_sbit_range( comp->glyph_code, - strike, - &elem_range, - &elem_offset ); - if ( error ) - goto Fail_Memory; - - /* now load the element, recursively */ - error = Load_SBit_Image( strike, - elem_range, - ebdt_pos, - elem_offset, - slot, - x_offset + comp->x_offset, - y_offset + comp->y_offset, - stream, - &elem_metrics, - depth + 1 ); - if ( error ) - goto Fail_Memory; - } + FT_TRACE3(( "tt_sbit_decoder_load_image:" + " found sbit (format %d) for glyph index %d\n", + image_format, glyph_index )); - Fail_Memory: - FT_FREE( components ); - } + return tt_sbit_decoder_load_bitmap( decoder, + load_flags, + image_format, + image_start, + image_end, + x_pos, + y_pos ); - Exit: - return error; + Failure: + return FT_THROW( Invalid_Table ); + + NoBitmap: + FT_TRACE4(( "tt_sbit_decoder_load_image:" + " no sbit found for glyph index %d\n", glyph_index )); + + return FT_THROW( Invalid_Argument ); } - /*************************************************************************/ - /* */ - /* <Function> */ - /* tt_face_load_sbit_image */ - /* */ - /* <Description> */ - /* Loads a given glyph sbit image from the font resource. This also */ - /* returns its metrics. */ - /* */ - /* <Input> */ - /* face :: The target face object. */ - /* */ - /* strike_index :: The current strike index. */ - /* */ - /* glyph_index :: The current glyph index. */ - /* */ - /* load_flags :: The glyph load flags (the code checks for the flag */ - /* FT_LOAD_CROP_BITMAP). */ - /* */ - /* stream :: The input stream. */ - /* */ - /* <Output> */ - /* map :: The target pixmap. */ - /* */ - /* metrics :: A big sbit metrics structure for the glyph image. */ - /* */ - /* <Return> */ - /* FreeType error code. 0 means success. Returns an error if no */ - /* glyph sbit exists for the index. */ - /* */ - /* <Note> */ - /* The `map.buffer' field is always freed before the glyph is loaded. */ - /* */ - FT_LOCAL_DEF( FT_Error ) + FT_LOCAL( FT_Error ) tt_face_load_sbit_image( TT_Face face, FT_ULong strike_index, FT_UInt glyph_index, @@ -1450,59 +1151,27 @@ FT_Bitmap *map, TT_SBit_MetricsRec *metrics ) { - FT_Error error; - FT_ULong ebdt_pos, glyph_offset; + TT_SBitDecoderRec decoder[1]; + FT_Error error; - TT_SBit_Strike strike; - TT_SBit_Range range; + FT_UNUSED( load_flags ); + FT_UNUSED( stream ); + FT_UNUSED( map ); - /* Check whether there is a glyph sbit for the current index */ - error = tt_find_sbit_image( face, glyph_index, strike_index, - &range, &strike, &glyph_offset ); - if ( error ) - goto Exit; - - /* now, find the location of the `EBDT' table in */ - /* the font file */ - error = face->goto_table( face, TTAG_EBDT, stream, 0 ); - if ( error ) - error = face->goto_table( face, TTAG_bdat, stream, 0 ); - if ( error ) - goto Exit; - - ebdt_pos = FT_STREAM_POS(); - - error = Load_SBit_Image( strike, range, ebdt_pos, glyph_offset, - face->root.glyph, 0, 0, stream, metrics, 0 ); - if ( error ) - goto Exit; - - /* setup vertical metrics if needed */ - if ( strike->flags & 1 ) + error = tt_sbit_decoder_init( decoder, face, strike_index, metrics ); + if ( !error ) { - /* in case of a horizontal strike only */ - FT_Int advance; - - - advance = strike->hori.ascender - strike->hori.descender; - - /* some heuristic values */ - - metrics->vertBearingX = (FT_Char)(-metrics->width / 2 ); - metrics->vertBearingY = (FT_Char)( ( advance - metrics->height ) / 2 ); - metrics->vertAdvance = (FT_Char)( advance * 12 / 10 ); + error = tt_sbit_decoder_load_image( decoder, + load_flags, + glyph_index, + 0, + 0 ); + tt_sbit_decoder_done( decoder ); } - /* Crop the bitmap now, unless specified otherwise */ - if ( load_flags & FT_LOAD_CROP_BITMAP ) - crop_bitmap( map, metrics ); - - Exit: return error; } -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - -/* END */ +/* EOF */ diff --git a/freetype/src/sfnt/ttsbit.h b/freetype/src/sfnt/ttsbit.h index 7ea2af184..ea0b5f8ad 100644 --- a/freetype/src/sfnt/ttsbit.h +++ b/freetype/src/sfnt/ttsbit.h @@ -4,7 +4,7 @@ /* */ /* TrueType and OpenType embedded bitmap support (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2008, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -45,22 +45,6 @@ FT_BEGIN_HEADER FT_ULong strike_index, FT_Size_Metrics* metrics ); -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - FT_LOCAL( FT_Error ) - tt_find_sbit_image( TT_Face face, - FT_UInt glyph_index, - FT_ULong strike_index, - TT_SBit_Range *arange, - TT_SBit_Strike *astrike, - FT_ULong *aglyph_offset ); - - FT_LOCAL( FT_Error ) - tt_load_sbit_metrics( FT_Stream stream, - TT_SBit_Range range, - TT_SBit_Metrics metrics ); - -#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - FT_LOCAL( FT_Error ) tt_face_load_sbit_image( TT_Face face, FT_ULong strike_index, diff --git a/freetype/src/sfnt/ttsbit0.c b/freetype/src/sfnt/ttsbit0.c deleted file mode 100644 index 38bcf210e..000000000 --- a/freetype/src/sfnt/ttsbit0.c +++ /dev/null @@ -1,1011 +0,0 @@ -/***************************************************************************/ -/* */ -/* ttsbit0.c */ -/* */ -/* TrueType and OpenType embedded bitmap support (body). */ -/* This is a heap-optimized version. */ -/* */ -/* Copyright 2005, 2006, 2007, 2008, 2009 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -/* This file is included by ttsbit.c */ - - -#include <ft2build.h> -#include FT_INTERNAL_DEBUG_H -#include FT_INTERNAL_STREAM_H -#include FT_TRUETYPE_TAGS_H -#include "ttsbit.h" - -#include "sferrors.h" - - - /*************************************************************************/ - /* */ - /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ - /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ - /* messages during execution. */ - /* */ -#undef FT_COMPONENT -#define FT_COMPONENT trace_ttsbit - - - FT_LOCAL_DEF( FT_Error ) - tt_face_load_eblc( TT_Face face, - FT_Stream stream ) - { - FT_Error error = SFNT_Err_Ok; - FT_Fixed version; - FT_ULong num_strikes, table_size; - FT_Byte* p; - FT_Byte* p_limit; - FT_UInt count; - - - face->sbit_num_strikes = 0; - - /* this table is optional */ - error = face->goto_table( face, TTAG_EBLC, stream, &table_size ); - if ( error ) - error = face->goto_table( face, TTAG_bloc, stream, &table_size ); - if ( error ) - goto Exit; - - if ( table_size < 8 ) - { - FT_ERROR(( "tt_face_load_sbit_strikes: table too short\n" )); - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - - if ( FT_FRAME_EXTRACT( table_size, face->sbit_table ) ) - goto Exit; - - face->sbit_table_size = table_size; - - p = face->sbit_table; - p_limit = p + table_size; - - version = FT_NEXT_ULONG( p ); - num_strikes = FT_NEXT_ULONG( p ); - - if ( version != 0x00020000UL || num_strikes >= 0x10000UL ) - { - FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" )); - error = SFNT_Err_Invalid_File_Format; - goto Fail; - } - - /* - * Count the number of strikes available in the table. We are a bit - * paranoid there and don't trust the data. - */ - count = (FT_UInt)num_strikes; - if ( 8 + 48UL * count > table_size ) - count = (FT_UInt)( ( p_limit - p ) / 48 ); - - face->sbit_num_strikes = count; - - FT_TRACE3(( "sbit_num_strikes: %u\n", count )); - Exit: - return error; - - Fail: - FT_FRAME_RELEASE( face->sbit_table ); - face->sbit_table_size = 0; - goto Exit; - } - - - FT_LOCAL_DEF( void ) - tt_face_free_eblc( TT_Face face ) - { - FT_Stream stream = face->root.stream; - - - FT_FRAME_RELEASE( face->sbit_table ); - face->sbit_table_size = 0; - face->sbit_num_strikes = 0; - } - - - FT_LOCAL_DEF( FT_Error ) - tt_face_set_sbit_strike( TT_Face face, - FT_Size_Request req, - FT_ULong* astrike_index ) - { - return FT_Match_Size( (FT_Face)face, req, 0, astrike_index ); - } - - - FT_LOCAL_DEF( FT_Error ) - tt_face_load_strike_metrics( TT_Face face, - FT_ULong strike_index, - FT_Size_Metrics* metrics ) - { - FT_Byte* strike; - - - if ( strike_index >= (FT_ULong)face->sbit_num_strikes ) - return SFNT_Err_Invalid_Argument; - - strike = face->sbit_table + 8 + strike_index * 48; - - metrics->x_ppem = (FT_UShort)strike[44]; - metrics->y_ppem = (FT_UShort)strike[45]; - - metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */ - metrics->descender = (FT_Char)strike[17] << 6; /* hori.descender */ - metrics->height = metrics->ascender - metrics->descender; - - /* XXX: Is this correct? */ - metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */ - strike[18] + /* max_width */ - (FT_Char)strike[23] /* min_advance_SB */ - ) << 6; - - return SFNT_Err_Ok; - } - - - typedef struct TT_SBitDecoderRec_ - { - TT_Face face; - FT_Stream stream; - FT_Bitmap* bitmap; - TT_SBit_Metrics metrics; - FT_Bool metrics_loaded; - FT_Bool bitmap_allocated; - FT_Byte bit_depth; - - FT_ULong ebdt_start; - FT_ULong ebdt_size; - - FT_ULong strike_index_array; - FT_ULong strike_index_count; - FT_Byte* eblc_base; - FT_Byte* eblc_limit; - - } TT_SBitDecoderRec, *TT_SBitDecoder; - - - static FT_Error - tt_sbit_decoder_init( TT_SBitDecoder decoder, - TT_Face face, - FT_ULong strike_index, - TT_SBit_MetricsRec* metrics ) - { - FT_Error error; - FT_Stream stream = face->root.stream; - FT_ULong ebdt_size; - - - error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size ); - if ( error ) - error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size ); - if ( error ) - goto Exit; - - decoder->face = face; - decoder->stream = stream; - decoder->bitmap = &face->root.glyph->bitmap; - decoder->metrics = metrics; - - decoder->metrics_loaded = 0; - decoder->bitmap_allocated = 0; - - decoder->ebdt_start = FT_STREAM_POS(); - decoder->ebdt_size = ebdt_size; - - decoder->eblc_base = face->sbit_table; - decoder->eblc_limit = face->sbit_table + face->sbit_table_size; - - /* now find the strike corresponding to the index */ - { - FT_Byte* p; - - - if ( 8 + 48 * strike_index + 3 * 4 + 34 + 1 > face->sbit_table_size ) - { - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - - p = decoder->eblc_base + 8 + 48 * strike_index; - - decoder->strike_index_array = FT_NEXT_ULONG( p ); - p += 4; - decoder->strike_index_count = FT_NEXT_ULONG( p ); - p += 34; - decoder->bit_depth = *p; - - if ( decoder->strike_index_array > face->sbit_table_size || - decoder->strike_index_array + 8 * decoder->strike_index_count > - face->sbit_table_size ) - error = SFNT_Err_Invalid_File_Format; - } - - Exit: - return error; - } - - - static void - tt_sbit_decoder_done( TT_SBitDecoder decoder ) - { - FT_UNUSED( decoder ); - } - - - static FT_Error - tt_sbit_decoder_alloc_bitmap( TT_SBitDecoder decoder ) - { - FT_Error error = SFNT_Err_Ok; - FT_UInt width, height; - FT_Bitmap* map = decoder->bitmap; - FT_Long size; - - - if ( !decoder->metrics_loaded ) - { - error = SFNT_Err_Invalid_Argument; - goto Exit; - } - - width = decoder->metrics->width; - height = decoder->metrics->height; - - map->width = (int)width; - map->rows = (int)height; - - switch ( decoder->bit_depth ) - { - case 1: - map->pixel_mode = FT_PIXEL_MODE_MONO; - map->pitch = ( map->width + 7 ) >> 3; - break; - - case 2: - map->pixel_mode = FT_PIXEL_MODE_GRAY2; - map->pitch = ( map->width + 3 ) >> 2; - break; - - case 4: - map->pixel_mode = FT_PIXEL_MODE_GRAY4; - map->pitch = ( map->width + 1 ) >> 1; - break; - - case 8: - map->pixel_mode = FT_PIXEL_MODE_GRAY; - map->pitch = map->width; - break; - - default: - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - - size = map->rows * map->pitch; - - /* check that there is no empty image */ - if ( size == 0 ) - goto Exit; /* exit successfully! */ - - error = ft_glyphslot_alloc_bitmap( decoder->face->root.glyph, size ); - if ( error ) - goto Exit; - - decoder->bitmap_allocated = 1; - - Exit: - return error; - } - - - static FT_Error - tt_sbit_decoder_load_metrics( TT_SBitDecoder decoder, - FT_Byte* *pp, - FT_Byte* limit, - FT_Bool big ) - { - FT_Byte* p = *pp; - TT_SBit_Metrics metrics = decoder->metrics; - - - if ( p + 5 > limit ) - goto Fail; - - metrics->height = p[0]; - metrics->width = p[1]; - metrics->horiBearingX = (FT_Char)p[2]; - metrics->horiBearingY = (FT_Char)p[3]; - metrics->horiAdvance = p[4]; - - p += 5; - if ( big ) - { - if ( p + 3 > limit ) - goto Fail; - - metrics->vertBearingX = (FT_Char)p[0]; - metrics->vertBearingY = (FT_Char)p[1]; - metrics->vertAdvance = p[2]; - - p += 3; - } - - decoder->metrics_loaded = 1; - *pp = p; - return SFNT_Err_Ok; - - Fail: - return SFNT_Err_Invalid_Argument; - } - - - /* forward declaration */ - static FT_Error - tt_sbit_decoder_load_image( TT_SBitDecoder decoder, - FT_UInt glyph_index, - FT_Int x_pos, - FT_Int y_pos ); - - typedef FT_Error (*TT_SBitDecoder_LoadFunc)( TT_SBitDecoder decoder, - FT_Byte* p, - FT_Byte* plimit, - FT_Int x_pos, - FT_Int y_pos ); - - - static FT_Error - tt_sbit_decoder_load_byte_aligned( TT_SBitDecoder decoder, - FT_Byte* p, - FT_Byte* limit, - FT_Int x_pos, - FT_Int y_pos ) - { - FT_Error error = SFNT_Err_Ok; - FT_Byte* line; - FT_Int bit_height, bit_width, pitch, width, height, h; - FT_Bitmap* bitmap; - - - if ( !decoder->bitmap_allocated ) - { - error = tt_sbit_decoder_alloc_bitmap( decoder ); - if ( error ) - goto Exit; - } - - /* check that we can write the glyph into the bitmap */ - bitmap = decoder->bitmap; - bit_width = bitmap->width; - bit_height = bitmap->rows; - pitch = bitmap->pitch; - line = bitmap->buffer; - - width = decoder->metrics->width; - height = decoder->metrics->height; - - if ( x_pos < 0 || x_pos + width > bit_width || - y_pos < 0 || y_pos + height > bit_height ) - { - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - - if ( p + ( ( width + 7 ) >> 3 ) * height > limit ) - { - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - - /* now do the blit */ - line += y_pos * pitch + ( x_pos >> 3 ); - x_pos &= 7; - - if ( x_pos == 0 ) /* the easy one */ - { - for ( h = height; h > 0; h--, line += pitch ) - { - FT_Byte* write = line; - FT_Int w; - - - for ( w = width; w >= 8; w -= 8 ) - { - write[0] = (FT_Byte)( write[0] | *p++ ); - write += 1; - } - - if ( w > 0 ) - write[0] = (FT_Byte)( write[0] | ( *p++ & ( 0xFF00U >> w ) ) ); - } - } - else /* x_pos > 0 */ - { - for ( h = height; h > 0; h--, line += pitch ) - { - FT_Byte* write = line; - FT_Int w; - FT_UInt wval = 0; - - - for ( w = width; w >= 8; w -= 8 ) - { - wval = (FT_UInt)( wval | *p++ ); - write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) ); - write += 1; - wval <<= 8; - } - - if ( w > 0 ) - wval = (FT_UInt)( wval | ( *p++ & ( 0xFF00U >> w ) ) ); - - /* all bits read and there are `x_pos + w' bits to be written */ - - write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) ); - - if ( x_pos + w > 8 ) - { - write++; - wval <<= 8; - write[0] = (FT_Byte)( write[0] | ( wval >> x_pos ) ); - } - } - } - - Exit: - return error; - } - - - /* - * Load a bit-aligned bitmap (with pointer `p') into a line-aligned bitmap - * (with pointer `write'). In the example below, the width is 3 pixel, - * and `x_pos' is 1 pixel. - * - * p p+1 - * | | | - * | 7 6 5 4 3 2 1 0 | 7 6 5 4 3 2 1 0 |... - * | | | - * +-------+ +-------+ +-------+ ... - * . . . - * . . . - * v . . - * +-------+ . . - * | | . - * | 7 6 5 4 3 2 1 0 | . - * | | . - * write . . - * . . - * v . - * +-------+ . - * | | - * | 7 6 5 4 3 2 1 0 | - * | | - * write+1 . - * . - * v - * +-------+ - * | | - * | 7 6 5 4 3 2 1 0 | - * | | - * write+2 - * - */ - - static FT_Error - tt_sbit_decoder_load_bit_aligned( TT_SBitDecoder decoder, - FT_Byte* p, - FT_Byte* limit, - FT_Int x_pos, - FT_Int y_pos ) - { - FT_Error error = SFNT_Err_Ok; - FT_Byte* line; - FT_Int bit_height, bit_width, pitch, width, height, h, nbits; - FT_Bitmap* bitmap; - FT_UShort rval; - - - if ( !decoder->bitmap_allocated ) - { - error = tt_sbit_decoder_alloc_bitmap( decoder ); - if ( error ) - goto Exit; - } - - /* check that we can write the glyph into the bitmap */ - bitmap = decoder->bitmap; - bit_width = bitmap->width; - bit_height = bitmap->rows; - pitch = bitmap->pitch; - line = bitmap->buffer; - - width = decoder->metrics->width; - height = decoder->metrics->height; - - if ( x_pos < 0 || x_pos + width > bit_width || - y_pos < 0 || y_pos + height > bit_height ) - { - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - - if ( p + ( ( width * height + 7 ) >> 3 ) > limit ) - { - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - - /* now do the blit */ - - /* adjust `line' to point to the first byte of the bitmap */ - line += y_pos * pitch + ( x_pos >> 3 ); - x_pos &= 7; - - /* the higher byte of `rval' is used as a buffer */ - rval = 0; - nbits = 0; - - for ( h = height; h > 0; h--, line += pitch ) - { - FT_Byte* write = line; - FT_Int w = width; - - - /* handle initial byte (in target bitmap) specially if necessary */ - if ( x_pos ) - { - w = ( width < 8 - x_pos ) ? width : 8 - x_pos; - - if ( h == height ) - { - rval = *p++; - nbits = x_pos; - } - else if ( nbits < w ) - { - if ( p < limit ) - rval |= *p++; - nbits += 8 - w; - } - else - { - rval >>= 8; - nbits -= w; - } - - *write++ |= ( ( rval >> nbits ) & 0xFF ) & - ( ~( 0xFF << w ) << ( 8 - w - x_pos ) ); - rval <<= 8; - - w = width - w; - } - - /* handle medial bytes */ - for ( ; w >= 8; w -= 8 ) - { - rval |= *p++; - *write++ |= ( rval >> nbits ) & 0xFF; - - rval <<= 8; - } - - /* handle final byte if necessary */ - if ( w > 0 ) - { - if ( nbits < w ) - { - if ( p < limit ) - rval |= *p++; - *write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w ); - nbits += 8 - w; - - rval <<= 8; - } - else - { - *write |= ( ( rval >> nbits ) & 0xFF ) & ( 0xFF00U >> w ); - nbits -= w; - } - } - } - - Exit: - return error; - } - - - static FT_Error - tt_sbit_decoder_load_compound( TT_SBitDecoder decoder, - FT_Byte* p, - FT_Byte* limit, - FT_Int x_pos, - FT_Int y_pos ) - { - FT_Error error = SFNT_Err_Ok; - FT_UInt num_components, nn; - - FT_Char horiBearingX = decoder->metrics->horiBearingX; - FT_Char horiBearingY = decoder->metrics->horiBearingY; - FT_Byte horiAdvance = decoder->metrics->horiAdvance; - FT_Char vertBearingX = decoder->metrics->vertBearingX; - FT_Char vertBearingY = decoder->metrics->vertBearingY; - FT_Byte vertAdvance = decoder->metrics->vertAdvance; - - - if ( p + 2 > limit ) - goto Fail; - - num_components = FT_NEXT_USHORT( p ); - if ( p + 4 * num_components > limit ) - goto Fail; - - if ( !decoder->bitmap_allocated ) - { - error = tt_sbit_decoder_alloc_bitmap( decoder ); - if ( error ) - goto Exit; - } - - for ( nn = 0; nn < num_components; nn++ ) - { - FT_UInt gindex = FT_NEXT_USHORT( p ); - FT_Byte dx = FT_NEXT_BYTE( p ); - FT_Byte dy = FT_NEXT_BYTE( p ); - - - /* NB: a recursive call */ - error = tt_sbit_decoder_load_image( decoder, gindex, - x_pos + dx, y_pos + dy ); - if ( error ) - break; - } - - decoder->metrics->horiBearingX = horiBearingX; - decoder->metrics->horiBearingY = horiBearingY; - decoder->metrics->horiAdvance = horiAdvance; - decoder->metrics->vertBearingX = vertBearingX; - decoder->metrics->vertBearingY = vertBearingY; - decoder->metrics->vertAdvance = vertAdvance; - decoder->metrics->width = (FT_UInt)decoder->bitmap->width; - decoder->metrics->height = (FT_UInt)decoder->bitmap->rows; - - Exit: - return error; - - Fail: - error = SFNT_Err_Invalid_File_Format; - goto Exit; - } - - - static FT_Error - tt_sbit_decoder_load_bitmap( TT_SBitDecoder decoder, - FT_UInt glyph_format, - FT_ULong glyph_start, - FT_ULong glyph_size, - FT_Int x_pos, - FT_Int y_pos ) - { - FT_Error error; - FT_Stream stream = decoder->stream; - FT_Byte* p; - FT_Byte* p_limit; - FT_Byte* data; - - - /* seek into the EBDT table now */ - if ( glyph_start + glyph_size > decoder->ebdt_size ) - { - error = SFNT_Err_Invalid_Argument; - goto Exit; - } - - if ( FT_STREAM_SEEK( decoder->ebdt_start + glyph_start ) || - FT_FRAME_EXTRACT( glyph_size, data ) ) - goto Exit; - - p = data; - p_limit = p + glyph_size; - - /* read the data, depending on the glyph format */ - switch ( glyph_format ) - { - case 1: - case 2: - case 8: - error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 0 ); - break; - - case 6: - case 7: - case 9: - error = tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ); - break; - - default: - error = SFNT_Err_Ok; - } - - if ( error ) - goto Fail; - - { - TT_SBitDecoder_LoadFunc loader; - - - switch ( glyph_format ) - { - case 1: - case 6: - loader = tt_sbit_decoder_load_byte_aligned; - break; - - case 2: - case 5: - case 7: - loader = tt_sbit_decoder_load_bit_aligned; - break; - - case 8: - if ( p + 1 > p_limit ) - goto Fail; - - p += 1; /* skip padding */ - /* fall-through */ - - case 9: - loader = tt_sbit_decoder_load_compound; - break; - - default: - goto Fail; - } - - error = loader( decoder, p, p_limit, x_pos, y_pos ); - } - - Fail: - FT_FRAME_RELEASE( data ); - - Exit: - return error; - } - - - static FT_Error - tt_sbit_decoder_load_image( TT_SBitDecoder decoder, - FT_UInt glyph_index, - FT_Int x_pos, - FT_Int y_pos ) - { - /* - * First, we find the correct strike range that applies to this - * glyph index. - */ - - FT_Byte* p = decoder->eblc_base + decoder->strike_index_array; - FT_Byte* p_limit = decoder->eblc_limit; - FT_ULong num_ranges = decoder->strike_index_count; - FT_UInt start, end, index_format, image_format; - FT_ULong image_start = 0, image_end = 0, image_offset; - - - for ( ; num_ranges > 0; num_ranges-- ) - { - start = FT_NEXT_USHORT( p ); - end = FT_NEXT_USHORT( p ); - - if ( glyph_index >= start && glyph_index <= end ) - goto FoundRange; - - p += 4; /* ignore index offset */ - } - goto NoBitmap; - - FoundRange: - image_offset = FT_NEXT_ULONG( p ); - - /* overflow check */ - if ( decoder->eblc_base + decoder->strike_index_array + image_offset < - decoder->eblc_base ) - goto Failure; - - p = decoder->eblc_base + decoder->strike_index_array + image_offset; - if ( p + 8 > p_limit ) - goto NoBitmap; - - /* now find the glyph's location and extend within the ebdt table */ - index_format = FT_NEXT_USHORT( p ); - image_format = FT_NEXT_USHORT( p ); - image_offset = FT_NEXT_ULONG ( p ); - - switch ( index_format ) - { - case 1: /* 4-byte offsets relative to `image_offset' */ - { - p += 4 * ( glyph_index - start ); - if ( p + 8 > p_limit ) - goto NoBitmap; - - image_start = FT_NEXT_ULONG( p ); - image_end = FT_NEXT_ULONG( p ); - - if ( image_start == image_end ) /* missing glyph */ - goto NoBitmap; - } - break; - - case 2: /* big metrics, constant image size */ - { - FT_ULong image_size; - - - if ( p + 12 > p_limit ) - goto NoBitmap; - - image_size = FT_NEXT_ULONG( p ); - - if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) ) - goto NoBitmap; - - image_start = image_size * ( glyph_index - start ); - image_end = image_start + image_size; - } - break; - - case 3: /* 2-byte offsets relative to 'image_offset' */ - { - p += 2 * ( glyph_index - start ); - if ( p + 4 > p_limit ) - goto NoBitmap; - - image_start = FT_NEXT_USHORT( p ); - image_end = FT_NEXT_USHORT( p ); - - if ( image_start == image_end ) /* missing glyph */ - goto NoBitmap; - } - break; - - case 4: /* sparse glyph array with (glyph,offset) pairs */ - { - FT_ULong mm, num_glyphs; - - - if ( p + 4 > p_limit ) - goto NoBitmap; - - num_glyphs = FT_NEXT_ULONG( p ); - - /* overflow check */ - if ( p + ( num_glyphs + 1 ) * 4 < p ) - goto Failure; - - if ( p + ( num_glyphs + 1 ) * 4 > p_limit ) - goto NoBitmap; - - for ( mm = 0; mm < num_glyphs; mm++ ) - { - FT_UInt gindex = FT_NEXT_USHORT( p ); - - - if ( gindex == glyph_index ) - { - image_start = FT_NEXT_USHORT( p ); - p += 2; - image_end = FT_PEEK_USHORT( p ); - break; - } - p += 2; - } - - if ( mm >= num_glyphs ) - goto NoBitmap; - } - break; - - case 5: /* constant metrics with sparse glyph codes */ - { - FT_ULong image_size, mm, num_glyphs; - - - if ( p + 16 > p_limit ) - goto NoBitmap; - - image_size = FT_NEXT_ULONG( p ); - - if ( tt_sbit_decoder_load_metrics( decoder, &p, p_limit, 1 ) ) - goto NoBitmap; - - num_glyphs = FT_NEXT_ULONG( p ); - - /* overflow check */ - if ( p + 2 * num_glyphs < p ) - goto Failure; - - if ( p + 2 * num_glyphs > p_limit ) - goto NoBitmap; - - for ( mm = 0; mm < num_glyphs; mm++ ) - { - FT_UInt gindex = FT_NEXT_USHORT( p ); - - - if ( gindex == glyph_index ) - break; - } - - if ( mm >= num_glyphs ) - goto NoBitmap; - - image_start = image_size * mm; - image_end = image_start + image_size; - } - break; - - default: - goto NoBitmap; - } - - if ( image_start > image_end ) - goto NoBitmap; - - image_end -= image_start; - image_start = image_offset + image_start; - - return tt_sbit_decoder_load_bitmap( decoder, - image_format, - image_start, - image_end, - x_pos, - y_pos ); - - Failure: - return SFNT_Err_Invalid_Table; - - NoBitmap: - return SFNT_Err_Invalid_Argument; - } - - - FT_LOCAL( FT_Error ) - tt_face_load_sbit_image( TT_Face face, - FT_ULong strike_index, - FT_UInt glyph_index, - FT_UInt load_flags, - FT_Stream stream, - FT_Bitmap *map, - TT_SBit_MetricsRec *metrics ) - { - TT_SBitDecoderRec decoder[1]; - FT_Error error; - - FT_UNUSED( load_flags ); - FT_UNUSED( stream ); - FT_UNUSED( map ); - - - error = tt_sbit_decoder_init( decoder, face, strike_index, metrics ); - if ( !error ) - { - error = tt_sbit_decoder_load_image( decoder, glyph_index, 0, 0 ); - tt_sbit_decoder_done( decoder ); - } - - return error; - } - -/* EOF */ diff --git a/freetype/src/smooth/ftgrays.c b/freetype/src/smooth/ftgrays.c index f0db12380..7532a3582 100644 --- a/freetype/src/smooth/ftgrays.c +++ b/freetype/src/smooth/ftgrays.c @@ -4,7 +4,7 @@ /* */ /* A new `perfect' anti-aliasing renderer (body). */ /* */ -/* Copyright 2000-2003, 2005-2012 by */ +/* Copyright 2000-2003, 2005-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -94,6 +94,11 @@ #ifdef _STANDALONE_ + /* Auxiliary macros for token concatenation. */ +#define FT_ERR_XCAT( x, y ) x ## y +#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) + + /* define this to dump debugging information */ /* #define FT_DEBUG_LEVEL_TRACE */ @@ -154,6 +159,21 @@ typedef ptrdiff_t FT_PtrDist; va_end( ap ); } + + /* empty function useful for setting a breakpoint to catch errors */ + int + FT_Throw( int error, + int line, + const char* file ) + { + FT_UNUSED( error ); + FT_UNUSED( line ); + FT_UNUSED( file ); + + return 0; + } + + /* we don't handle tracing levels in stand-alone mode; */ #ifndef FT_TRACE5 #define FT_TRACE5( varformat ) FT_Message varformat @@ -165,11 +185,19 @@ typedef ptrdiff_t FT_PtrDist; #define FT_ERROR( varformat ) FT_Message varformat #endif +#define FT_THROW( e ) \ + ( FT_Throw( FT_ERR_CAT( ErrRaster, e ), \ + __LINE__, \ + __FILE__ ) | \ + FT_ERR_CAT( ErrRaster, e ) ) + #else /* !FT_DEBUG_LEVEL_TRACE */ #define FT_TRACE5( x ) do { } while ( 0 ) /* nothing */ #define FT_TRACE7( x ) do { } while ( 0 ) /* nothing */ #define FT_ERROR( x ) do { } while ( 0 ) /* nothing */ +#define FT_THROW( e ) FT_ERR_CAT( ErrRaster_, e ) + #endif /* !FT_DEBUG_LEVEL_TRACE */ @@ -202,6 +230,7 @@ typedef ptrdiff_t FT_PtrDist; raster_done_ \ }; + #else /* !_STANDALONE_ */ @@ -215,13 +244,14 @@ typedef ptrdiff_t FT_PtrDist; #include "ftspic.h" -#define ErrRaster_Invalid_Mode Smooth_Err_Cannot_Render_Glyph -#define ErrRaster_Invalid_Outline Smooth_Err_Invalid_Outline +#define Smooth_Err_Invalid_Mode Smooth_Err_Cannot_Render_Glyph +#define Smooth_Err_Memory_Overflow Smooth_Err_Out_Of_Memory #define ErrRaster_Memory_Overflow Smooth_Err_Out_Of_Memory -#define ErrRaster_Invalid_Argument Smooth_Err_Invalid_Argument + #endif /* !_STANDALONE_ */ + #ifndef FT_MEM_SET #define FT_MEM_SET( d, s, c ) ft_memset( d, s, c ) #endif @@ -328,6 +358,14 @@ typedef ptrdiff_t FT_PtrDist; } TCell; +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + /* We disable the warning `structure was padded due to */ + /* __declspec(align())' in order to compile cleanly with */ + /* the maximum level of warnings. */ +#pragma warning( push ) +#pragma warning( disable : 4324 ) +#endif /* _MSC_VER */ + typedef struct gray_TWorker_ { TCoord ex, ey; @@ -375,6 +413,10 @@ typedef ptrdiff_t FT_PtrDist; } gray_TWorker, *gray_PWorker; +#if defined( _MSC_VER ) +#pragma warning( pop ) +#endif + #ifndef FT_STATIC_RASTER #define ras (*worker) @@ -600,7 +642,7 @@ typedef ptrdiff_t FT_PtrDist; TPos x2, TCoord y2 ) { - TCoord ex1, ex2, fx1, fx2, delta, mod, lift, rem; + TCoord ex1, ex2, fx1, fx2, delta, mod; long p, first, dx; int incr; @@ -661,6 +703,9 @@ typedef ptrdiff_t FT_PtrDist; if ( ex1 != ex2 ) { + TCoord lift, rem; + + p = ONE_PIXEL * ( y2 - y1 + delta ); lift = (TCoord)( p / dx ); rem = (TCoord)( p % dx ); @@ -1092,7 +1137,7 @@ typedef ptrdiff_t FT_PtrDist; goto Split; /* Split super curvy segments where the off points are so far - from the chord that the angles P0-P1-P3 or P0-P2-P3 become + from the chord that the angles P0-P1-P3 or P0-P2-P3 become acute as detected by appropriate dot products. */ if ( dx1 * ( dx1 - dx ) + dy1 * ( dy1 - dy ) > 0 || dx2 * ( dx2 - dx ) + dy2 * ( dy2 - dy ) > 0 ) @@ -1227,9 +1272,7 @@ typedef ptrdiff_t FT_PtrDist; TPos area, TCoord acount ) { - FT_Span* span; - int count; - int coverage; + int coverage; /* compute the coverage line's coverage, depending on the */ @@ -1271,6 +1314,10 @@ typedef ptrdiff_t FT_PtrDist; if ( coverage ) { + FT_Span* span; + int count; + + /* see whether we can add this span to the current list */ count = ras.num_gray_spans; span = ras.gray_spans + count - 1; @@ -1486,7 +1533,7 @@ typedef ptrdiff_t FT_PtrDist; if ( !outline || !func_interface ) - return ErrRaster_Invalid_Argument; + return FT_THROW( Invalid_Argument ); shift = func_interface->shift; delta = func_interface->delta; @@ -1699,7 +1746,7 @@ typedef ptrdiff_t FT_PtrDist; return error; Invalid_Outline: - return ErrRaster_Invalid_Outline; + return FT_THROW( Invalid_Outline ); } #endif /* _STANDALONE_ */ @@ -1737,7 +1784,7 @@ typedef ptrdiff_t FT_PtrDist; gray_record_cell( RAS_VAR ); } else - error = ErrRaster_Memory_Overflow; + error = FT_THROW( Memory_Overflow ); return error; } @@ -1890,21 +1937,21 @@ typedef ptrdiff_t FT_PtrDist; if ( !raster || !raster->buffer || !raster->buffer_size ) - return ErrRaster_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( !outline ) - return ErrRaster_Invalid_Outline; + return FT_THROW( Invalid_Outline ); /* return immediately if the outline is empty */ if ( outline->n_points == 0 || outline->n_contours <= 0 ) return 0; if ( !outline->contours || !outline->points ) - return ErrRaster_Invalid_Outline; + return FT_THROW( Invalid_Outline ); if ( outline->n_points != outline->contours[outline->n_contours - 1] + 1 ) - return ErrRaster_Invalid_Outline; + return FT_THROW( Invalid_Outline ); worker = raster->worker; @@ -1912,19 +1959,19 @@ typedef ptrdiff_t FT_PtrDist; if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) ) { if ( !target_map ) - return ErrRaster_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* nothing to do */ if ( !target_map->width || !target_map->rows ) return 0; if ( !target_map->buffer ) - return ErrRaster_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } /* this version does not support monochrome rendering */ if ( !( params->flags & FT_RASTER_FLAG_AA ) ) - return ErrRaster_Invalid_Mode; + return FT_THROW( Invalid_Mode ); /* compute clipping box */ if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) ) diff --git a/freetype/src/smooth/ftsmooth.c b/freetype/src/smooth/ftsmooth.c index 8f5300dbb..89088cd09 100644 --- a/freetype/src/smooth/ftsmooth.c +++ b/freetype/src/smooth/ftsmooth.c @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (body). */ /* */ -/* Copyright 2000-2006, 2009-2012 by */ +/* Copyright 2000-2006, 2009-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,12 +61,12 @@ const FT_Matrix* matrix, const FT_Vector* delta ) { - FT_Error error = Smooth_Err_Ok; + FT_Error error = FT_Err_Ok; if ( slot->format != render->glyph_format ) { - error = Smooth_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -109,11 +109,13 @@ #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING FT_Pos height_org, width_org; #endif - FT_Bitmap* bitmap; - FT_Memory memory; - FT_Int hmul = mode == FT_RENDER_MODE_LCD; - FT_Int vmul = mode == FT_RENDER_MODE_LCD_V; - FT_Pos x_shift, y_shift, x_left, y_top; + FT_Bitmap* bitmap = &slot->bitmap; + FT_Memory memory = render->root.memory; + FT_Int hmul = mode == FT_RENDER_MODE_LCD; + FT_Int vmul = mode == FT_RENDER_MODE_LCD_V; + FT_Pos x_shift = 0; + FT_Pos y_shift = 0; + FT_Pos x_left, y_top; FT_Raster_Params params; @@ -125,14 +127,14 @@ /* check glyph image format */ if ( slot->format != render->glyph_format ) { - error = Smooth_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } /* check mode */ if ( mode != required_mode ) { - error = Smooth_Err_Cannot_Render_Glyph; + error = FT_THROW( Cannot_Render_Glyph ); goto Exit; } @@ -158,7 +160,7 @@ FT_ERROR(( "ft_smooth_render_generic: glyph too large:" " xMin = %d, xMax = %d\n", cbox.xMin >> 6, cbox.xMax >> 6 )); - error = Smooth_Err_Raster_Overflow; + error = FT_THROW( Raster_Overflow ); goto Exit; } else @@ -169,15 +171,12 @@ FT_ERROR(( "ft_smooth_render_generic: glyph too large:" " yMin = %d, yMax = %d\n", cbox.yMin >> 6, cbox.yMax >> 6 )); - error = Smooth_Err_Raster_Overflow; + error = FT_THROW( Raster_Overflow ); goto Exit; } else height = ( cbox.yMax - cbox.yMin ) >> 6; - bitmap = &slot->bitmap; - memory = render->root.memory; - #ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING width_org = width; height_org = height; @@ -239,7 +238,7 @@ { FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n", width, height )); - error = Smooth_Err_Raster_Overflow; + error = FT_THROW( Raster_Overflow ); goto Exit; } @@ -373,7 +372,7 @@ */ if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX ) { - error = Smooth_Err_Invalid_Pixel_Size; + error = FT_THROW( Invalid_Pixel_Size ); goto Exit; } @@ -384,7 +383,7 @@ /* everything is fine; don't deallocate buffer */ have_buffer = FALSE; - error = Smooth_Err_Ok; + error = FT_Err_Ok; Exit: if ( have_outline_shifted ) diff --git a/freetype/src/smooth/ftspic.c b/freetype/src/smooth/ftspic.c index 4714828fc..67a2b8310 100644 --- a/freetype/src/smooth/ftspic.c +++ b/freetype/src/smooth/ftspic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009, 2010, 2012 by */ +/* Copyright 2009, 2010, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,17 +22,19 @@ #include "ftspic.h" #include "ftsmerrs.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ftgrays.c */ void FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs ); + void ft_smooth_renderer_class_pic_free( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_Memory memory = library->memory; if ( pic_container->smooth ) @@ -42,6 +44,7 @@ if ( --container->ref_count ) return; + FT_FREE( container ); pic_container->smooth = NULL; } @@ -52,7 +55,7 @@ ft_smooth_renderer_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = Smooth_Err_Ok; + FT_Error error = FT_Err_Ok; SmoothPIC* container = NULL; FT_Memory memory = library->memory; @@ -66,37 +69,45 @@ } /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->smooth = container; + container->ref_count = 1; - /* initialize pointer table - this is how the module usually expects this data */ + /* initialize pointer table - */ + /* this is how the module usually expects this data */ FT_Init_Class_ft_grays_raster( &container->ft_grays_raster ); -/*Exit:*/ - if ( error ) - ft_smooth_renderer_class_pic_free( library ); + return error; } + /* re-route these init and free functions to the above functions */ - FT_Error ft_smooth_lcd_renderer_class_pic_init( FT_Library library ) + FT_Error + ft_smooth_lcd_renderer_class_pic_init( FT_Library library ) { return ft_smooth_renderer_class_pic_init( library ); } - void ft_smooth_lcd_renderer_class_pic_free( FT_Library library ) + + void + ft_smooth_lcd_renderer_class_pic_free( FT_Library library ) { ft_smooth_renderer_class_pic_free( library ); } - FT_Error ft_smooth_lcdv_renderer_class_pic_init( FT_Library library ) + + FT_Error + ft_smooth_lcdv_renderer_class_pic_init( FT_Library library ) { return ft_smooth_renderer_class_pic_init( library ); } - void ft_smooth_lcdv_renderer_class_pic_free( FT_Library library ) + + void + ft_smooth_lcdv_renderer_class_pic_free( FT_Library library ) { ft_smooth_renderer_class_pic_free( library ); } diff --git a/freetype/src/smooth/ftspic.h b/freetype/src/smooth/ftspic.h index 4686f5e35..334b51c3f 100644 --- a/freetype/src/smooth/ftspic.h +++ b/freetype/src/smooth/ftspic.h @@ -25,18 +25,23 @@ FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H #ifndef FT_CONFIG_OPTION_PIC -#define FT_GRAYS_RASTER_GET ft_grays_raster + +#define FT_GRAYS_RASTER_GET ft_grays_raster #else /* FT_CONFIG_OPTION_PIC */ - typedef struct SmoothPIC_ + typedef struct SmoothPIC_ { - int ref_count; - FT_Raster_Funcs ft_grays_raster; + int ref_count; + FT_Raster_Funcs ft_grays_raster; + } SmoothPIC; -#define GET_PIC(lib) ((SmoothPIC*)((lib)->pic_container.smooth)) -#define FT_GRAYS_RASTER_GET (GET_PIC(library)->ft_grays_raster) + +#define GET_PIC( lib ) \ + ( (SmoothPIC*)( (lib)->pic_container.smooth ) ) +#define FT_GRAYS_RASTER_GET ( GET_PIC( library )->ft_grays_raster ) + /* see ftspic.c for the implementation */ void diff --git a/freetype/src/tools/apinames.c b/freetype/src/tools/apinames.c index 3dc6559e4..c85df721a 100644 --- a/freetype/src/tools/apinames.c +++ b/freetype/src/tools/apinames.c @@ -10,7 +10,7 @@ * accepted if you are using GCC for compilation (and probably by * other compilers too). * - * Author: David Turner, 2005, 2006, 2008-2012 + * Author: David Turner, 2005, 2006, 2008-2013 * * This code is explicitly placed into the public domain. * @@ -22,7 +22,7 @@ #include <ctype.h> #define PROGRAM_NAME "apinames" -#define PROGRAM_VERSION "0.1" +#define PROGRAM_VERSION "0.2" #define LINEBUFF_SIZE 1024 @@ -31,7 +31,8 @@ typedef enum OutputFormat_ OUTPUT_LIST = 0, /* output the list of names, one per line */ OUTPUT_WINDOWS_DEF, /* output a Windows .DEF file for Visual C++ or Mingw */ OUTPUT_BORLAND_DEF, /* output a Windows .DEF file for Borland C++ */ - OUTPUT_WATCOM_LBC /* output a Watcom Linker Command File */ + OUTPUT_WATCOM_LBC, /* output a Watcom Linker Command File */ + OUTPUT_NETWARE_IMP /* output a NetWare ImportFile */ } OutputFormat; @@ -154,8 +155,6 @@ names_dump( FILE* out, case OUTPUT_WATCOM_LBC: { - /* we must omit the .dll suffix from the library name */ - char temp[512]; const char* dot; @@ -166,10 +165,12 @@ names_dump( FILE* out, exit( 4 ); } + /* we must omit the .dll suffix from the library name */ dot = strchr( dll_name, '.' ); if ( dot != NULL ) { - int len = dot - dll_name; + char temp[512]; + int len = dot - dll_name; if ( len > (int)( sizeof ( temp ) - 1 ) ) @@ -187,6 +188,16 @@ names_dump( FILE* out, } break; + case OUTPUT_NETWARE_IMP: + { + if ( dll_name != NULL ) + fprintf( out, " (%s)\n", dll_name ); + for ( nn = 0; nn < num_names - 1; nn++ ) + fprintf( out, " %s,\n", the_names[nn].name ); + fprintf( out, " %s\n", the_names[num_names - 1].name ); + } + break; + default: /* LIST */ for ( nn = 0; nn < num_names; nn++ ) fprintf( out, "%s\n", the_names[nn].name ); @@ -311,6 +322,7 @@ usage( void ) " -w : output .DEF file for Visual C++ and Mingw\n" " -wB : output .DEF file for Borland C++\n" " -wW : output Watcom Linker Response File\n" + " -wN : output NetWare Import File\n" "\n"; fprintf( stderr, @@ -394,6 +406,10 @@ int main( int argc, const char* const* argv ) format = OUTPUT_WATCOM_LBC; break; + case 'N': + format = OUTPUT_NETWARE_IMP; + break; + case 0: break; diff --git a/freetype/src/tools/cordic.py b/freetype/src/tools/cordic.py index 3f80c5f09..6742c90df 100644 --- a/freetype/src/tools/cordic.py +++ b/freetype/src/tools/cordic.py @@ -2,65 +2,20 @@ import sys, math #units = 64*65536.0 # don't change !! -units = 256 +units = 180 * 2**16 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) +for n in range(1,32): - angle = math.atan(x) # arctangent - angle2 = angle*scale # arctangent in FT_Angle units + x = 0.5**n # tangent value - # 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 + angle = math.atan(x) # arctangent + angle2 = round(angle*scale) # arctangent in FT_Angle units if angle2 <= 0: break @@ -68,12 +23,11 @@ for n in r: sys.stdout.write( comma + repr( int(angle2) ) ) comma = ", " - shrink = shrink * math.cos( angle2/scale) - + shrink /= math.sqrt( 1 + x*x ) print print "shrink factor = " + repr( shrink ) -print "shrink factor 2 = " + repr( shrink * (2.0**32) ) -print "expansion factor = " + repr(1/shrink) +print "shrink factor 2 = " + repr( int( shrink * (2**32) ) ) +print "expansion factor = " + repr( 1/shrink ) print "" diff --git a/freetype/src/tools/ftrandom/ftrandom.c b/freetype/src/tools/ftrandom/ftrandom.c index 4daac0dc1..7c9795711 100644 --- a/freetype/src/tools/ftrandom/ftrandom.c +++ b/freetype/src/tools/ftrandom/ftrandom.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2007, 2008 by George Williams */ +/* Copyright (C) 2005, 2007, 2008, 2013 by George Williams */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -184,7 +184,6 @@ { FT_Library context; FT_Face face; - int i, num; if ( FT_Init_FreeType( &context ) ) @@ -203,6 +202,9 @@ TestFace( face ); else { + int i, num; + + num = face->num_faces; FT_Done_Face( face ); @@ -327,12 +329,9 @@ FindFonts( char** fontdirs, char** extensions ) { - DIR* examples; - struct dirent* ent; - - int i, max; - char buffer[1025]; - struct stat statb; + int i, max; + char buffer[1025]; + struct stat statb; max = 0; @@ -340,6 +339,10 @@ for ( i = 0; fontdirs[i] != NULL; ++i ) { + DIR* examples; + struct dirent* ent; + + examples = opendir( fontdirs[i] ); if ( examples == NULL ) { @@ -555,7 +558,6 @@ char** argv ) { char **dirs, **exts; - char *pt, *end; int dcnt = 0, ecnt = 0, rset = false, allexts = false; int i; time_t now; @@ -567,7 +569,10 @@ for ( i = 1; i < argc; ++i ) { - pt = argv[i]; + char* pt = argv[i]; + char* end; + + if ( pt[0] == '-' && pt[1] == '-' ) ++pt; @@ -633,12 +638,21 @@ } if ( allexts ) + { + free( exts ); exts = NULL; + } else if ( ecnt == 0 ) + { + free( exts ); exts = default_ext_list; + } if ( dcnt == 0 ) + { + free( dirs ); dirs = default_dir_list; + } if ( testfile != NULL ) ExecuteTest( testfile ); /* This should never return */ diff --git a/freetype/src/tools/test_afm.c b/freetype/src/tools/test_afm.c index f5f99363c..24cd0c4f0 100644 --- a/freetype/src/tools/test_afm.c +++ b/freetype/src/tools/test_afm.c @@ -118,7 +118,7 @@ if ( argc < 2 ) - return FT_Err_Invalid_Argument; + return FT_ERR( Invalid_Argument ); error = FT_Init_FreeType( &library ); if ( error ) diff --git a/freetype/src/tools/test_bbox.c b/freetype/src/tools/test_bbox.c index e085c5b3d..64b82c384 100644 --- a/freetype/src/tools/test_bbox.c +++ b/freetype/src/tools/test_bbox.c @@ -88,6 +88,26 @@ }; + /* dummy outline #3 with bbox of [0 100 128 128] precisely */ + static FT_Vector dummy_vec_3[4] = + { + XVEC( 100.0, 127.0 ), + XVEC( 200.0, 127.0 ), + XVEC( 0.0, 136.0 ), + XVEC( 0.0, 100.0 ) + }; + + static FT_Outline dummy_outline_3 = + { + 1, + 4, + dummy_vec_3, + dummy_tag_1, + dummy_contour_1, + 0 + }; + + static void dump_outline( FT_Outline* outline ) { @@ -125,12 +145,14 @@ FT_Outline_Get_CBox( outline, &bbox ); time0 = get_time() - time0; - printf( "time = %5.2f cbox = [%.2f %.2f %.2f %.2f]\n", + printf( "time = %6.3f cbox = [%8.4f %8.4f %8.4f %8.4f]\n", ((double)time0/10000.0), XVAL( bbox.xMin ), XVAL( bbox.yMin ), XVAL( bbox.xMax ), XVAL( bbox.yMax ) ); + printf( "cbox_hex = [%08X %08X %08X %08X]\n", + bbox.xMin, bbox.yMin, bbox.xMax, bbox.yMax ); time0 = get_time(); @@ -138,15 +160,17 @@ FT_Outline_Get_BBox( outline, &bbox ); time0 = get_time() - time0; - printf( "time = %5.2f bbox = [%.2f %.2f %.2f %.2f]\n", + printf( "time = %6.3f bbox = [%8.4f %8.4f %8.4f %8.4f]\n", ((double)time0/10000.0), XVAL( bbox.xMin ), XVAL( bbox.yMin ), XVAL( bbox.xMax ), XVAL( bbox.yMax ) ); + printf( "bbox_hex = [%08X %08X %08X %08X]\n", + bbox.xMin, bbox.yMin, bbox.xMax, bbox.yMax ); } -#define REPEAT 100000L +#define REPEAT 1000000L int main( int argc, char** argv ) { @@ -155,6 +179,10 @@ printf( "outline #2\n" ); profile_outline( &dummy_outline_2, REPEAT ); + + printf( "outline #3\n" ); + profile_outline( &dummy_outline_3, REPEAT ); + return 0; } diff --git a/freetype/src/tools/test_trig.c b/freetype/src/tools/test_trig.c index 8c8a544aa..49d927e36 100644 --- a/freetype/src/tools/test_trig.c +++ b/freetype/src/tools/test_trig.c @@ -8,9 +8,8 @@ #define PI 3.14159265358979323846 #define SPI (PI/FT_ANGLE_PI) -/* the precision in 16.16 fixed float points of the checks. Expect */ -/* between 2 and 5 noise LSB bits during operations, due to */ -/* rounding errors.. */ +/* the precision in 16.16 fixed-point checks. Expect between 2 and 5 */ +/* noise LSB bits during operations, due to rounding errors.. */ #define THRESHOLD 64 static error = 0; @@ -18,14 +17,16 @@ static void test_cos( void ) { - FT_Fixed f1, f2; - double d1, d2; - int i; + int i; + for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 ) { + FT_Fixed f1, f2; + double d2; + + f1 = FT_Cos(i); - d1 = f1/65536.0; d2 = cos( i*SPI ); f2 = (FT_Fixed)(d2*65536.0); @@ -39,18 +40,19 @@ } - static void test_sin( void ) { - FT_Fixed f1, f2; - double d1, d2; - int i; + int i; + for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 ) { + FT_Fixed f1, f2; + double d2; + + f1 = FT_Sin(i); - d1 = f1/65536.0; d2 = sin( i*SPI ); f2 = (FT_Fixed)(d2*65536.0); @@ -67,14 +69,16 @@ static void test_tan( void ) { - FT_Fixed f1, f2; - double d1, d2; - int i; + int i; + for ( i = 0; i < FT_ANGLE_PI2-0x2000000; i += 0x10000 ) { + FT_Fixed f1, f2; + double d2; + + f1 = FT_Tan(i); - d1 = f1/65536.0; d2 = tan( i*SPI ); f2 = (FT_Fixed)(d2*65536.0); @@ -91,12 +95,16 @@ static void test_atan2( void ) { - FT_Fixed c2, s2; - double l, a, c1, s1; - int i, j; + int i; + for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 ) { + FT_Fixed c2, s2; + double l, a, c1, s1; + int j; + + l = 5.0; a = i*SPI; @@ -118,16 +126,20 @@ } } + static void test_unit( void ) { - FT_Vector v; - double a, c1, s1; - FT_Fixed c2, s2; - int i; + int i; + for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 ) { + FT_Vector v; + double a, c1, s1; + FT_Fixed c2, s2; + + FT_Vector_Unit( &v, i ); a = ( i*SPI ); c1 = cos(a); @@ -151,12 +163,15 @@ static void test_length( void ) { - FT_Vector v; - FT_Fixed l, l2; - int i; + int i; + for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 ) { + FT_Vector v; + FT_Fixed l, l2; + + l = (FT_Fixed)(500.0*65536.0); v.x = (FT_Fixed)( l * cos( i*SPI ) ); v.y = (FT_Fixed)( l * sin( i*SPI ) ); @@ -175,19 +190,26 @@ static void test_rotate( void ) { - FT_Fixed c2, s2, c4, s4; - FT_Vector v; - double l, ra, a, c1, s1, cra, sra, c3, s3; - int i, j, rotate; + int rotate; + for ( rotate = 0; rotate < FT_ANGLE_2PI; rotate += 0x10000 ) { + double ra, cra, sra; + int i; + + ra = rotate*SPI; cra = cos( ra ); sra = sin( ra ); for ( i = 0; i < FT_ANGLE_2PI; i += 0x10000 ) { + FT_Fixed c2, s2, c4, s4; + FT_Vector v; + double l, a, c1, s1, c3, s3; + + l = 500.0; a = i*SPI; diff --git a/freetype/src/truetype/ttdriver.c b/freetype/src/truetype/ttdriver.c index 60c0f3e13..fb25706ab 100644 --- a/freetype/src/truetype/ttdriver.c +++ b/freetype/src/truetype/ttdriver.c @@ -4,7 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,8 @@ #include FT_SERVICE_TRUETYPE_ENGINE_H #include FT_SERVICE_TRUETYPE_GLYF_H +#include FT_SERVICE_PROPERTIES_H +#include FT_TRUETYPE_DRIVER_H #include "ttdriver.h" #include "ttgload.h" @@ -52,6 +54,73 @@ #define FT_COMPONENT trace_ttdriver + /* + * PROPERTY SERVICE + * + */ + static FT_Error + tt_property_set( FT_Module module, /* TT_Driver */ + const char* property_name, + const void* value ) + { + FT_Error error = FT_Err_Ok; + TT_Driver driver = (TT_Driver)module; + + + if ( !ft_strcmp( property_name, "interpreter-version" ) ) + { + FT_UInt* interpreter_version = (FT_UInt*)value; + + +#ifndef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( *interpreter_version != TT_INTERPRETER_VERSION_35 ) + error = FT_ERR( Unimplemented_Feature ); + else +#endif + driver->interpreter_version = *interpreter_version; + + return error; + } + + FT_TRACE0(( "tt_property_set: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + static FT_Error + tt_property_get( FT_Module module, /* TT_Driver */ + const char* property_name, + const void* value ) + { + FT_Error error = FT_Err_Ok; + TT_Driver driver = (TT_Driver)module; + + FT_UInt interpreter_version = driver->interpreter_version; + + + if ( !ft_strcmp( property_name, "interpreter-version" ) ) + { + FT_UInt* val = (FT_UInt*)value; + + + *val = interpreter_version; + + return error; + } + + FT_TRACE0(( "tt_property_get: missing property `%s'\n", + property_name )); + return FT_THROW( Missing_Property ); + } + + + FT_DEFINE_SERVICE_PROPERTIESREC( + tt_service_properties, + (FT_Properties_SetFunc)tt_property_set, + (FT_Properties_GetFunc)tt_property_get ) + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -163,7 +232,7 @@ } } - return TT_Err_Ok; + return FT_Err_Ok; } /*************************************************************************/ @@ -187,7 +256,7 @@ { TT_Face ttface = (TT_Face)size->face; TT_Size ttsize = (TT_Size)size; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; ttsize->strike_index = strike_index; @@ -221,7 +290,7 @@ FT_Size_Request req ) { TT_Size ttsize = (TT_Size)size; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS @@ -294,13 +363,13 @@ if ( !slot ) - return TT_Err_Invalid_Slot_Handle; + return FT_THROW( Invalid_Slot_Handle ); if ( !size ) - return TT_Err_Invalid_Size_Handle; + return FT_THROW( Invalid_Size_Handle ); if ( !face ) - return TT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); #ifdef FT_CONFIG_OPTION_INCREMENTAL if ( glyph_index >= (FT_UInt)face->num_glyphs && @@ -308,7 +377,7 @@ #else if ( glyph_index >= (FT_UInt)face->num_glyphs ) #endif - return TT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( load_flags & FT_LOAD_NO_HINTING ) { @@ -384,18 +453,20 @@ (TT_Glyf_GetLocationFunc)tt_face_get_location ) #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC4( + FT_DEFINE_SERVICEDESCREC5( tt_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE, FT_SERVICE_ID_MULTI_MASTERS, &TT_SERVICE_GX_MULTI_MASTERS_GET, FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine, - FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET ) + FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET, + FT_SERVICE_ID_PROPERTIES, &TT_SERVICE_PROPERTIES_GET ) #else - FT_DEFINE_SERVICEDESCREC3( + FT_DEFINE_SERVICEDESCREC4( tt_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE, FT_SERVICE_ID_TRUETYPE_ENGINE, &tt_service_truetype_engine, - FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET ) + FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET, + FT_SERVICE_ID_PROPERTIES, &TT_SERVICE_PROPERTIES_GET ) #endif @@ -457,7 +528,8 @@ #define TT_SIZE_SELECT 0 #endif - FT_DEFINE_DRIVER( tt_driver_class, + FT_DEFINE_DRIVER( + tt_driver_class, FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE | @@ -486,9 +558,6 @@ tt_slot_init, 0, /* FT_Slot_DoneFunc */ - ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_glyph_load, tt_get_kerning, diff --git a/freetype/src/truetype/ttgload.c b/freetype/src/truetype/ttgload.c index 374f89dce..f640a6c78 100644 --- a/freetype/src/truetype/ttgload.c +++ b/freetype/src/truetype/ttgload.c @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (body). */ /* */ -/* Copyright 1996-2012 */ +/* Copyright 1996-2013 */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,6 +23,7 @@ #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H +#include FT_TRUETYPE_DRIVER_H #include "ttgload.h" #include "ttpload.h" @@ -132,7 +133,10 @@ tt_get_metrics( TT_Loader loader, FT_UInt glyph_index ) { - TT_Face face = (TT_Face)loader->face; + TT_Face face = (TT_Face)loader->face; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); +#endif FT_Short left_bearing = 0, top_bearing = 0; FT_UShort advance_width = 0, advance_height = 0; @@ -151,12 +155,15 @@ loader->vadvance = advance_height; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( loader->exec ) - loader->exec->sph_tweak_flags = 0; + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) + { + if ( loader->exec ) + loader->exec->sph_tweak_flags = 0; - /* this may not be the right place for this, but it works */ - if ( loader->exec && loader->exec->ignore_x_mode ) - sph_set_tweaks( loader, glyph_index ); + /* this may not be the right place for this, but it works */ + if ( loader->exec && loader->exec->ignore_x_mode ) + sph_set_tweaks( loader, glyph_index ); + } #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ if ( !loader->linear_def ) @@ -292,7 +299,7 @@ loader->cursor = stream->cursor; loader->limit = stream->limit; - return TT_Err_Ok; + return FT_Err_Ok; } @@ -314,7 +321,7 @@ if ( p + 10 > limit ) - return TT_Err_Invalid_Outline; + return FT_THROW( Invalid_Outline ); loader->n_contours = FT_NEXT_SHORT( p ); @@ -330,7 +337,7 @@ loader->bbox.yMax )); loader->cursor = p; - return TT_Err_Ok; + return FT_Err_Ok; } @@ -415,14 +422,14 @@ { FT_TRACE0(( "TT_Load_Simple_Glyph: too many instructions (%d)\n", n_ins )); - error = TT_Err_Too_Many_Hints; + error = FT_THROW( Too_Many_Hints ); goto Fail; } if ( ( limit - p ) < n_ins ) { FT_TRACE0(( "TT_Load_Simple_Glyph: instruction count mismatch\n" )); - error = TT_Err_Too_Many_Hints; + error = FT_THROW( Too_Many_Hints ); goto Fail; } @@ -552,7 +559,7 @@ return error; Invalid_Outline: - error = TT_Err_Invalid_Outline; + error = FT_THROW( Invalid_Outline ); goto Fail; } @@ -673,7 +680,7 @@ return error; Invalid_Composite: - error = TT_Err_Invalid_Composite; + error = FT_THROW( Invalid_Composite ); goto Fail; } @@ -720,6 +727,11 @@ TT_Hint_Glyph( TT_Loader loader, FT_Bool is_composite ) { +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + TT_Face face = (TT_Face)loader->face; + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); +#endif + TT_GlyphZone zone = &loader->zone; FT_Pos origin; @@ -820,13 +832,17 @@ } #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( loader->exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN ) - FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 ); + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) + { + if ( loader->exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN ) + FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 ); - else if ( loader->exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN ) - FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 ); -#endif - return TT_Err_Ok; + else if ( loader->exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN ) + FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 ); + } +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + return FT_Err_Ok; } @@ -844,18 +860,10 @@ TT_Process_Simple_Glyph( TT_Loader loader ) { FT_GlyphLoader gloader = loader->gloader; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Outline* outline; FT_Int n_points; -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - TT_Face face = (TT_Face)loader->face; - FT_String* family = face->root.family_name; - FT_Int ppem = loader->size->metrics.x_ppem; - FT_String* style = face->root.style_name; - FT_Int x_scale_factor = 1000; -#endif - outline = &gloader->current.outline; n_points = outline->n_points; @@ -910,52 +918,83 @@ loader->zone.n_points + 4 ); } -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - /* scale, but only if enabled and only if TT hinting is being used */ - if ( IS_HINTED( loader->load_flags ) ) - x_scale_factor = scale_test_tweak( face, family, ppem, style, - loader->glyph_index, X_SCALING_Rules, - X_SCALING_RULES_SIZE ); - /* scale the glyph */ - if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 || - x_scale_factor != 1000 ) { - FT_Vector* vec = outline->points; - FT_Vector* limit = outline->points + n_points; - FT_Fixed x_scale = FT_MulDiv( - ((TT_Size)loader->size)->metrics.x_scale, - x_scale_factor, 1000 ); - FT_Fixed y_scale = ((TT_Size)loader->size)->metrics.y_scale; - - - /* compensate for any scaling by de/emboldening; */ - /* the amount was determined via experimentation */ - if ( x_scale_factor != 1000 && ppem > 11 ) - FT_Outline_EmboldenXY( outline, - FT_MulFix( 1280 * ppem, - 1000 - x_scale_factor ), - 0 ); -#else - /* scale the glyph */ - if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) - { - FT_Vector* vec = outline->points; - FT_Vector* limit = outline->points + n_points; - FT_Fixed x_scale = ((TT_Size)loader->size)->metrics.x_scale; - FT_Fixed y_scale = ((TT_Size)loader->size)->metrics.y_scale; -#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + TT_Face face = (TT_Face)loader->face; + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); + + FT_String* family = face->root.family_name; + FT_Int ppem = loader->size->metrics.x_ppem; + FT_String* style = face->root.style_name; + FT_Int x_scale_factor = 1000; +#endif + + FT_Vector* vec = outline->points; + FT_Vector* limit = outline->points + n_points; + + FT_Fixed x_scale = 0; /* pacify compiler */ + FT_Fixed y_scale = 0; + FT_Bool do_scale = FALSE; - for ( ; vec < limit; vec++ ) + +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) { - vec->x = FT_MulFix( vec->x, x_scale ); - vec->y = FT_MulFix( vec->y, y_scale ); + /* scale, but only if enabled and only if TT hinting is being used */ + if ( IS_HINTED( loader->load_flags ) ) + x_scale_factor = sph_test_tweak_x_scaling( face, + family, + ppem, + style, + loader->glyph_index ); + /* scale the glyph */ + if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 || + x_scale_factor != 1000 ) + { + x_scale = FT_MulDiv( ((TT_Size)loader->size)->metrics.x_scale, + x_scale_factor, 1000 ); + y_scale = ((TT_Size)loader->size)->metrics.y_scale; + + /* compensate for any scaling by de/emboldening; */ + /* the amount was determined via experimentation */ + if ( x_scale_factor != 1000 && ppem > 11 ) + FT_Outline_EmboldenXY( outline, + FT_MulFix( 1280 * ppem, + 1000 - x_scale_factor ), + 0 ); + do_scale = TRUE; + } + } + else + +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + { + /* scale the glyph */ + if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) + { + x_scale = ((TT_Size)loader->size)->metrics.x_scale; + y_scale = ((TT_Size)loader->size)->metrics.y_scale; + + do_scale = TRUE; + } } - loader->pp1 = outline->points[n_points - 4]; - loader->pp2 = outline->points[n_points - 3]; - loader->pp3 = outline->points[n_points - 2]; - loader->pp4 = outline->points[n_points - 1]; + if ( do_scale ) + { + for ( ; vec < limit; vec++ ) + { + vec->x = FT_MulFix( vec->x, x_scale ); + vec->y = FT_MulFix( vec->y, y_scale ); + } + + loader->pp1 = outline->points[n_points - 4]; + loader->pp2 = outline->points[n_points - 3]; + loader->pp3 = outline->points[n_points - 2]; + loader->pp4 = outline->points[n_points - 1]; + } } if ( IS_HINTED( loader->load_flags ) ) @@ -1022,7 +1061,7 @@ l += num_base_points; if ( k >= num_base_points || l >= num_points ) - return TT_Err_Invalid_Composite; + return FT_THROW( Invalid_Composite ); p1 = gloader->base.outline.points + k; p2 = gloader->base.outline.points + l; @@ -1036,7 +1075,7 @@ y = subglyph->arg2; if ( !x && !y ) - return TT_Err_Ok; + return FT_Err_Ok; /* Use a default value dependent on */ /* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old TT */ @@ -1081,16 +1120,10 @@ /* */ /* This algorithm is a guess and works much better than the above. */ /* */ - FT_Fixed mac_xscale = FT_SqrtFixed( - (FT_Int32)FT_MulFix( subglyph->transform.xx, - subglyph->transform.xx ) + - (FT_Int32)FT_MulFix( subglyph->transform.xy, - subglyph->transform.xy ) ); - FT_Fixed mac_yscale = FT_SqrtFixed( - (FT_Int32)FT_MulFix( subglyph->transform.yy, - subglyph->transform.yy ) + - (FT_Int32)FT_MulFix( subglyph->transform.yx, - subglyph->transform.yx ) ); + FT_Fixed mac_xscale = FT_Hypot( subglyph->transform.xx, + subglyph->transform.xy ); + FT_Fixed mac_yscale = FT_Hypot( subglyph->transform.yy, + subglyph->transform.yx ); x = FT_MulFix( x, mac_xscale ); @@ -1122,7 +1155,7 @@ base_vec + num_base_points, x, y ); - return TT_Err_Ok; + return FT_Err_Ok; } @@ -1191,7 +1224,7 @@ FT_TRACE1(( "TT_Process_Composite_Glyph: " "too many instructions (%d) for glyph with length %d\n", n_ins, loader->byte_len )); - return TT_Err_Too_Many_Hints; + return FT_THROW( Too_Many_Hints ); } tmp = loader->exec->glyphSize; @@ -1205,7 +1238,7 @@ return error; } else if ( n_ins == 0 ) - return TT_Err_Ok; + return FT_Err_Ok; if ( FT_STREAM_READ( loader->exec->glyphIns, n_ins ) ) return error; @@ -1261,7 +1294,7 @@ FT_UInt recurse_count, FT_Bool header_only ) { - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Fixed x_scale, y_scale; FT_ULong offset; TT_Face face = (TT_Face)loader->face; @@ -1284,14 +1317,14 @@ if ( recurse_count > 1 && recurse_count > face->max_profile.maxComponentDepth ) { - error = TT_Err_Invalid_Composite; + error = FT_THROW( Invalid_Composite ); goto Exit; } /* check glyph index */ if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) { - error = TT_Err_Invalid_Glyph_Index; + error = FT_THROW( Invalid_Glyph_Index ); goto Exit; } @@ -1355,7 +1388,7 @@ #endif /* FT_CONFIG_OPTION_INCREMENTAL */ { FT_TRACE2(( "no `glyf' table but non-zero `loca' entry\n" )); - error = TT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -1422,7 +1455,7 @@ loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); } - error = TT_Err_Ok; + error = FT_Err_Ok; goto Exit; } @@ -1636,7 +1669,7 @@ else { /* invalid composite count (negative but not -1) */ - error = TT_Err_Invalid_Outline; + error = FT_THROW( Invalid_Outline ); goto Exit; } @@ -1666,11 +1699,15 @@ compute_glyph_metrics( TT_Loader loader, FT_UInt glyph_index ) { + TT_Face face = (TT_Face)loader->face; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); +#endif + FT_BBox bbox; - TT_Face face = (TT_Face)loader->face; FT_Fixed y_scale; TT_GlyphSlot glyph = loader->glyph; - TT_Size size = (TT_Size)loader->size; + TT_Size size = (TT_Size)loader->size; y_scale = 0x10000L; @@ -1696,27 +1733,35 @@ { FT_Byte* widthp; -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - FT_Bool ignore_x_mode; - - - ignore_x_mode = FT_BOOL( FT_LOAD_TARGET_MODE( loader->load_flags ) != - FT_RENDER_MODE_MONO ); -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ widthp = tt_face_get_device_metrics( face, size->root.metrics.x_ppem, glyph_index ); #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( widthp && - ( ( ignore_x_mode && loader->exec->compatible_widths ) || - !ignore_x_mode || - SPH_OPTION_BITMAP_WIDTHS ) ) -#else - if ( widthp ) + + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) + { + FT_Bool ignore_x_mode; + + + ignore_x_mode = FT_BOOL( FT_LOAD_TARGET_MODE( loader->load_flags ) != + FT_RENDER_MODE_MONO ); + + if ( widthp && + ( ( ignore_x_mode && loader->exec->compatible_widths ) || + !ignore_x_mode || + SPH_OPTION_BITMAP_WIDTHS ) ) + glyph->metrics.horiAdvance = *widthp << 6; + } + else + #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - glyph->metrics.horiAdvance = *widthp << 6; + + { + if ( widthp ) + glyph->metrics.horiAdvance = *widthp << 6; + } } /* set glyph dimensions */ @@ -1912,17 +1957,24 @@ { TT_ExecContext exec; FT_Bool grayscale; + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - FT_Bool subpixel_hinting; - FT_Bool grayscale_hinting; + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); + + FT_Bool subpixel_hinting = FALSE; + FT_Bool grayscale_hinting = TRUE; + #if 0 - FT_Bool compatible_widths; - FT_Bool symmetrical_smoothing; - FT_Bool bgr; - FT_Bool subpixel_positioned; + /* not used yet */ + FT_Bool compatible_widths; + FT_Bool symmetrical_smoothing; + FT_Bool bgr; + FT_Bool subpixel_positioned; #endif #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + FT_Bool reexecute = FALSE; + if ( !size->cvt_ready ) { @@ -1937,111 +1989,119 @@ exec = size->debug ? size->context : ( (TT_Driver)FT_FACE_DRIVER( face ) )->context; if ( !exec ) - return TT_Err_Could_Not_Find_Context; + return FT_THROW( Could_Not_Find_Context ); #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) - != FT_RENDER_MODE_MONO ) && - SPH_OPTION_SET_SUBPIXEL ); - - if ( subpixel_hinting ) - grayscale = grayscale_hinting = FALSE; - - else if ( SPH_OPTION_SET_GRAYSCALE ) + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) { - grayscale = grayscale_hinting = TRUE; - subpixel_hinting = FALSE; - } + subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) + != FT_RENDER_MODE_MONO ) && + SPH_OPTION_SET_SUBPIXEL ); - if ( FT_IS_TRICKY( glyph->face ) ) - subpixel_hinting = grayscale_hinting = FALSE; + if ( subpixel_hinting ) + grayscale = grayscale_hinting = FALSE; + else if ( SPH_OPTION_SET_GRAYSCALE ) + { + grayscale = grayscale_hinting = TRUE; + subpixel_hinting = FALSE; + } + else + grayscale = grayscale_hinting = FALSE; + + if ( FT_IS_TRICKY( glyph->face ) ) + subpixel_hinting = grayscale_hinting = FALSE; - exec->ignore_x_mode = subpixel_hinting || grayscale_hinting; - exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION; - if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 ) - exec->rasterizer_version = 35; + exec->ignore_x_mode = subpixel_hinting || grayscale_hinting; + exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION; + if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 ) + exec->rasterizer_version = TT_INTERPRETER_VERSION_35; #if 1 - exec->compatible_widths = SPH_OPTION_SET_COMPATIBLE_WIDTHS; - exec->symmetrical_smoothing = FALSE; - exec->bgr = FALSE; - exec->subpixel_positioned = TRUE; + exec->compatible_widths = SPH_OPTION_SET_COMPATIBLE_WIDTHS; + exec->symmetrical_smoothing = FALSE; + exec->bgr = FALSE; + exec->subpixel_positioned = TRUE; #else /* 0 */ - exec->compatible_widths = - FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != - TT_LOAD_COMPATIBLE_WIDTHS ); - exec->symmetrical_smoothing = - FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != - TT_LOAD_SYMMETRICAL_SMOOTHING ); - exec->bgr = - FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != - TT_LOAD_BGR ); - exec->subpixel_positioned = - FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != - TT_LOAD_SUBPIXEL_POSITIONED ); + exec->compatible_widths = + FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != + TT_LOAD_COMPATIBLE_WIDTHS ); + exec->symmetrical_smoothing = + FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != + TT_LOAD_SYMMETRICAL_SMOOTHING ); + exec->bgr = + FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != + TT_LOAD_BGR ); + exec->subpixel_positioned = + FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != + TT_LOAD_SUBPIXEL_POSITIONED ); #endif /* 0 */ -#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + } + else - grayscale = - FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != FT_RENDER_MODE_MONO ); +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ -#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + { + grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != + FT_RENDER_MODE_MONO ); + } TT_Load_Context( exec, face, size ); #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - /* a change from mono to subpixel rendering (and vice versa) */ - /* requires a re-execution of the CVT program */ - if ( subpixel_hinting != exec->subpixel_hinting ) + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) { - FT_UInt i; + /* a change from mono to subpixel rendering (and vice versa) */ + /* requires a re-execution of the CVT program */ + if ( subpixel_hinting != exec->subpixel_hinting ) + { + FT_TRACE4(( "tt_loader_init: subpixel hinting change," + " re-executing `prep' table\n" )); + exec->subpixel_hinting = subpixel_hinting; + reexecute = TRUE; + } - exec->subpixel_hinting = subpixel_hinting; + /* a change from mono to grayscale rendering (and vice versa) */ + /* requires a re-execution of the CVT program */ + if ( grayscale != exec->grayscale_hinting ) + { + FT_TRACE4(( "tt_loader_init: grayscale hinting change," + " re-executing `prep' table\n" )); - for ( i = 0; i < size->cvt_size; i++ ) - size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); - tt_size_run_prep( size, pedantic ); + exec->grayscale_hinting = grayscale_hinting; + reexecute = TRUE; + } } + else - /* a change from mono to grayscale rendering (and vice versa) */ - /* requires a re-execution of the CVT program */ - if ( grayscale != exec->grayscale_hinting ) - { - FT_UInt i; - +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - exec->grayscale_hinting = grayscale_hinting; + { + /* a change from mono to grayscale rendering (and vice versa) */ + /* requires a re-execution of the CVT program */ + if ( grayscale != exec->grayscale ) + { + FT_TRACE4(( "tt_loader_init: grayscale change," + " re-executing `prep' table\n" )); - for ( i = 0; i < size->cvt_size; i++ ) - size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); - tt_size_run_prep( size, pedantic ); + exec->grayscale = grayscale; + reexecute = TRUE; + } } -#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - - /* a change from mono to grayscale rendering (and vice versa) */ - /* requires a re-execution of the CVT program */ - if ( grayscale != exec->grayscale ) + if ( reexecute ) { FT_UInt i; - FT_TRACE4(( "tt_loader_init: grayscale change," - " re-executing `prep' table\n" )); - - exec->grayscale = grayscale; - for ( i = 0; i < size->cvt_size; i++ ) size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); tt_size_run_prep( size, pedantic ); } -#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - /* see whether the cvt program has disabled hinting */ if ( exec->GS.instruct_control & 1 ) load_flags |= FT_LOAD_NO_HINTING; @@ -2073,7 +2133,7 @@ FT_Error error = face->goto_table( face, TTAG_glyf, stream, 0 ); - if ( error == TT_Err_Table_Missing ) + if ( FT_ERR_EQ( error, Table_Missing ) ) loader->glyf_offset = 0; else if ( error ) { @@ -2101,7 +2161,7 @@ loader->glyph = (FT_GlyphSlot)glyph; loader->stream = stream; - return TT_Err_Ok; + return FT_Err_Ok; } @@ -2142,7 +2202,7 @@ TT_LoaderRec loader; - error = TT_Err_Ok; + error = FT_Err_Ok; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS @@ -2164,9 +2224,16 @@ glyph->linearHoriAdvance = loader.linear; glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax - loader.vadvance; + + /* sanity check: if `horiAdvance' in the sbit metric */ + /* structure isn't set, use `linearHoriAdvance' */ + if ( !glyph->metrics.horiAdvance && glyph->linearHoriAdvance ) + glyph->metrics.horiAdvance = + FT_MulFix( glyph->linearHoriAdvance, + size->root.metrics.x_scale ); } - return TT_Err_Ok; + return FT_Err_Ok; } } @@ -2174,10 +2241,10 @@ /* if FT_LOAD_NO_SCALE is not set, `ttmetrics' must be valid */ if ( !( load_flags & FT_LOAD_NO_SCALE ) && !size->ttmetrics.valid ) - return TT_Err_Invalid_Size_Handle; + return FT_THROW( Invalid_Size_Handle ); if ( load_flags & FT_LOAD_SBITS_ONLY ) - return TT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); error = tt_loader_init( &loader, size, glyph, load_flags, FALSE ); if ( error ) diff --git a/freetype/src/truetype/ttgxvar.c b/freetype/src/truetype/ttgxvar.c index 4edcb07ab..7899d3671 100644 --- a/freetype/src/truetype/ttgxvar.c +++ b/freetype/src/truetype/ttgxvar.c @@ -4,7 +4,7 @@ /* */ /* TrueType GX Font Variation loader */ /* */ -/* Copyright 2004-2012 by */ +/* Copyright 2004-2013 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,9 +61,9 @@ #define FT_Stream_FTell( stream ) \ - ( (stream)->cursor - (stream)->base ) + (FT_ULong)( (stream)->cursor - (stream)->base ) #define FT_Stream_SeekSet( stream, off ) \ - ( (stream)->cursor = (stream)->base+(off) ) + ( (stream)->cursor = (stream)->base + (off) ) /*************************************************************************/ @@ -91,7 +91,9 @@ /* indicates that there is a delta for every point without needing to */ /* enumerate all of them. */ /* */ -#define ALL_POINTS (FT_UShort*)( ~0 ) + + /* ensure that value `0' has the same width as a pointer */ +#define ALL_POINTS (FT_UShort*)~(FT_PtrDist)0 #define GX_PT_POINTS_ARE_WORDS 0x80 @@ -130,7 +132,7 @@ FT_Int j; FT_Int first; FT_Memory memory = stream->memory; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( error ); @@ -215,7 +217,7 @@ FT_Offset i; FT_UInt j; FT_Memory memory = stream->memory; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_UNUSED( error ); @@ -283,7 +285,7 @@ FT_Memory memory = stream->memory; GX_Blend blend = face->blend; GX_AVarSegment segment; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_ULong version; FT_Long axisCount; FT_Int i, j; @@ -412,7 +414,7 @@ if ( gvar_head.version != (FT_Long)0x00010000L || gvar_head.axisCount != (FT_UShort)blend->mmvar->num_axis ) { - error = TT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -610,7 +612,7 @@ FT_Stream stream = face->root.stream; FT_Memory memory = face->root.memory; FT_ULong table_len; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_ULong fvar_start; FT_Int i, j; FT_MM_Var* mmvar = NULL; @@ -681,7 +683,7 @@ fvar_head.offsetToData + fvar_head.axisCount * 20U + fvar_head.instanceCount * fvar_head.instanceSize > table_len ) { - error = TT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } @@ -703,7 +705,7 @@ mmvar->num_axis = fvar_head.axisCount; mmvar->num_designs = - ~0; /* meaningless in this context; each glyph */ + ~0U; /* meaningless in this context; each glyph */ /* may have a different number of designs */ /* (or tuples, as called by Apple) */ mmvar->num_namedstyles = @@ -847,7 +849,7 @@ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; GX_Blend blend; FT_MM_Var* mmvar; FT_UInt i; @@ -875,14 +877,14 @@ if ( num_coords != mmvar->num_axis ) { - error = TT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } for ( i = 0; i < num_coords; ++i ) if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L ) { - error = TT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -983,7 +985,7 @@ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Fixed* normalized = NULL; GX_Blend blend; FT_MM_Var* mmvar; @@ -1004,7 +1006,7 @@ if ( num_coords != mmvar->num_axis ) { - error = TT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1020,7 +1022,7 @@ { if ( coords[i] > a->maximum || coords[i] < a->minimum ) { - error = TT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1120,7 +1122,7 @@ { FT_TRACE2(( "tt_face_vary_cvt: no blend specified\n" )); - error = TT_Err_Ok; + error = FT_Err_Ok; goto Exit; } @@ -1128,7 +1130,7 @@ { FT_TRACE2(( "tt_face_vary_cvt: no `cvt ' table\n" )); - error = TT_Err_Ok; + error = FT_Err_Ok; goto Exit; } @@ -1137,13 +1139,13 @@ { FT_TRACE2(( "is missing\n" )); - error = TT_Err_Ok; + error = FT_Err_Ok; goto Exit; } if ( FT_FRAME_ENTER( table_len ) ) { - error = TT_Err_Ok; + error = FT_Err_Ok; goto Exit; } @@ -1152,7 +1154,7 @@ { FT_TRACE2(( "bad table version\n" )); - error = TT_Err_Ok; + error = FT_Err_Ok; goto FExit; } @@ -1323,7 +1325,7 @@ if ( !face->doblend || blend == NULL ) - return TT_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); /* to be freed by the caller */ if ( FT_NEW_ARRAY( delta_xy, n_points ) ) @@ -1333,7 +1335,7 @@ 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 */ + return FT_Err_Ok; /* no variation data for this glyph */ if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) || FT_FRAME_ENTER( blend->glyphoffsets[glyph_index + 1] - @@ -1383,7 +1385,7 @@ } else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount ) { - error = TT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Fail3; } else diff --git a/freetype/src/truetype/ttinterp.c b/freetype/src/truetype/ttinterp.c index 19fb66c17..e7ffb987c 100644 --- a/freetype/src/truetype/ttinterp.c +++ b/freetype/src/truetype/ttinterp.c @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (body). */ /* */ -/* Copyright 1996-2012 */ +/* Copyright 1996-2013 */ /* by David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,6 +25,7 @@ #include FT_INTERNAL_CALC_H #include FT_TRIGONOMETRY_H #include FT_SYSTEM_H +#include FT_TRUETYPE_DRIVER_H #include "ttinterp.h" #include "tterrors.h" @@ -34,10 +35,6 @@ #ifdef TT_USE_BYTECODE_INTERPRETER -#define xxxSPH_DEBUG -#define xxxSPH_DEBUG_MORE_VERBOSE - - /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -135,6 +132,11 @@ #define FT_UNUSED_ARG FT_UNUSED_EXEC; FT_UNUSED( args ) +#define SUBPIXEL_HINTING \ + ( ((TT_Driver)FT_FACE_DRIVER( CUR.face ))->interpreter_version == \ + TT_INTERPRETER_VERSION_38 ) + + /*************************************************************************/ /* */ /* The following macros hide the use of EXEC_ARG and EXEC_ARG_ to */ @@ -308,7 +310,7 @@ exec->IP = IP; exec->curRange = range; - return TT_Err_Ok; + return FT_Err_Ok; } @@ -344,7 +346,7 @@ exec->codeRangeTable[range - 1].base = (FT_Byte*)base; exec->codeRangeTable[range - 1].size = length; - return TT_Err_Ok; + return FT_Err_Ok; } @@ -377,7 +379,7 @@ exec->codeRangeTable[range - 1].base = NULL; exec->codeRangeTable[range - 1].size = 0; - return TT_Err_Ok; + return FT_Err_Ok; } @@ -435,7 +437,7 @@ FT_FREE( exec ); - return TT_Err_Ok; + return FT_Err_Ok; } @@ -485,7 +487,7 @@ exec->face = NULL; exec->size = NULL; - return TT_Err_Ok; + return FT_Err_Ok; Fail_Memory: FT_ERROR(( "Init_Context: not enough memory for %p\n", exec )); @@ -537,7 +539,7 @@ *size = new_max; } - return TT_Err_Ok; + return FT_Err_Ok; } @@ -644,7 +646,7 @@ exec->instruction_trap = FALSE; - return TT_Err_Ok; + return FT_Err_Ok; } @@ -687,7 +689,7 @@ for ( i = 0; i < TT_MAX_CODE_RANGES; i++ ) size->codeRangeTable[i] = exec->codeRangeTable[i]; - return TT_Err_Ok; + return FT_Err_Ok; } @@ -723,7 +725,7 @@ if ( ( error = TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ) ) - != TT_Err_Ok ) + != FT_Err_Ok ) return error; exec->zp0 = exec->pts; @@ -760,7 +762,7 @@ if ( !debug ) return TT_RunIns( exec ); else - return TT_Err_Ok; + return FT_Err_Ok; #endif } @@ -1483,7 +1485,7 @@ l = (FT_UInt32)( ( a & 0xFFFFU ) * b ); m = ( a >> 16 ) * b; - lo = l + (FT_UInt32)( m << 16 ); + lo = l + ( (FT_UInt32)m << 16 ); hi = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo < l ); /* divide the result by 2^14 with rounding */ @@ -1495,7 +1497,7 @@ l = lo + 0x2000U; hi += l < lo; - return ( hi << 18 ) | ( l >> 14 ); + return (FT_Int32)( ( (FT_UInt32)hi << 18 ) | ( l >> 14 ) ); } #endif @@ -1515,14 +1517,14 @@ l = (FT_UInt32)( ( ax & 0xFFFFU ) * bx ); m = ( ax >> 16 ) * bx; - lo1 = l + (FT_UInt32)( m << 16 ); + lo1 = l + ( (FT_UInt32)m << 16 ); hi1 = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo1 < l ); /* compute ay*by as 64-bit value */ l = (FT_UInt32)( ( ay & 0xFFFFU ) * by ); m = ( ay >> 16 ) * by; - lo2 = l + (FT_UInt32)( m << 16 ); + lo2 = l + ( (FT_UInt32)m << 16 ); hi2 = ( m >> 16 ) + ( (FT_Int32)l >> 31 ) + ( lo2 < l ); /* add them */ @@ -1538,99 +1540,9 @@ l = lo + 0x2000U; hi += ( l < lo ); - return ( hi << 18 ) | ( l >> 14 ); - } - - - /* return length of given vector */ - -#if 0 - - static FT_Int32 - TT_VecLen( FT_Int32 x, - FT_Int32 y ) - { - FT_Int32 m, hi1, hi2, hi; - FT_UInt32 l, lo1, lo2, lo; - - - /* compute x*x as 64-bit value */ - lo = (FT_UInt32)( x & 0xFFFFU ); - hi = x >> 16; - - l = lo * lo; - m = hi * lo; - hi = hi * hi; - - lo1 = l + (FT_UInt32)( m << 17 ); - hi1 = hi + ( m >> 15 ) + ( lo1 < l ); - - /* compute y*y as 64-bit value */ - lo = (FT_UInt32)( y & 0xFFFFU ); - hi = y >> 16; - - l = lo * lo; - m = hi * lo; - hi = hi * hi; - - lo2 = l + (FT_UInt32)( m << 17 ); - hi2 = hi + ( m >> 15 ) + ( lo2 < l ); - - /* add them to get 'x*x+y*y' as 64-bit value */ - lo = lo1 + lo2; - hi = hi1 + hi2 + ( lo < lo1 ); - - /* compute the square root of this value */ - { - FT_UInt32 root, rem, test_div; - FT_Int count; - - - root = 0; - - { - rem = 0; - count = 32; - do - { - rem = ( rem << 2 ) | ( (FT_UInt32)hi >> 30 ); - hi = ( hi << 2 ) | ( lo >> 30 ); - lo <<= 2; - root <<= 1; - test_div = ( root << 1 ) + 1; - - if ( rem >= test_div ) - { - rem -= test_div; - root += 1; - } - } while ( --count ); - } - - return (FT_Int32)root; - } + return (FT_Int32)( ( (FT_UInt32)hi << 18 ) | ( l >> 14 ) ); } -#else - - /* this version uses FT_Vector_Length which computes the same value */ - /* much, much faster.. */ - /* */ - static FT_F26Dot6 - TT_VecLen( FT_F26Dot6 X, - FT_F26Dot6 Y ) - { - FT_Vector v; - - - v.x = X; - v.y = Y; - - return FT_Vector_Length( &v ); - } - -#endif - /*************************************************************************/ /* */ @@ -1675,7 +1587,7 @@ CUR.GS.projVector.x ); y = TT_MulFix14( CUR.tt_metrics.y_ratio, CUR.GS.projVector.y ); - CUR.tt_metrics.ratio = TT_VecLen( x, y ); + CUR.tt_metrics.ratio = FT_Hypot( x, y ); } } } @@ -1793,7 +1705,7 @@ if ( aRange < 1 || aRange > 3 ) { - CUR.error = TT_Err_Bad_Argument; + CUR.error = FT_THROW( Bad_Argument ); return FAILURE; } @@ -1801,7 +1713,7 @@ if ( range->base == NULL ) /* invalid coderange */ { - CUR.error = TT_Err_Invalid_CodeRange; + CUR.error = FT_THROW( Invalid_CodeRange ); return FAILURE; } @@ -1811,7 +1723,7 @@ if ( aIP > range->size ) { - CUR.error = TT_Err_Code_Overflow; + CUR.error = FT_THROW( Code_Overflow ); return FAILURE; } @@ -1858,10 +1770,11 @@ if ( v != 0 ) { #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !CUR.ignore_x_mode || - ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) + if ( !SUBPIXEL_HINTING || + ( !CUR.ignore_x_mode || + ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) ) #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - zone->cur[point].x += FT_MulDiv( distance, v, CUR.F_dot_P ); + zone->cur[point].x += FT_MulDiv( distance, v, CUR.F_dot_P ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1936,10 +1849,11 @@ FT_UNUSED_EXEC; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !CUR.ignore_x_mode || - ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVEX ) ) + if ( !SUBPIXEL_HINTING || + !CUR.ignore_x_mode ) #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - zone->cur[point].x += distance; + zone->cur[point].x += distance; + zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -2710,98 +2624,33 @@ /* In case Vx and Vy are both zero, Normalize() returns SUCCESS, and */ /* R is undefined. */ /* */ - - static FT_Bool Normalize( EXEC_OP_ FT_F26Dot6 Vx, FT_F26Dot6 Vy, FT_UnitVector* R ) { FT_F26Dot6 W; - FT_Bool S1, S2; FT_UNUSED_EXEC; - if ( FT_ABS( Vx ) < 0x10000L && FT_ABS( Vy ) < 0x10000L ) + if ( FT_ABS( Vx ) < 0x4000L && FT_ABS( Vy ) < 0x4000L ) { - Vx *= 0x100; - Vy *= 0x100; - - W = TT_VecLen( Vx, Vy ); - - if ( W == 0 ) + if ( Vx == 0 && Vy == 0 ) { /* XXX: UNDOCUMENTED! It seems that it is possible to try */ /* to normalize the vector (0,0). Return immediately. */ return SUCCESS; } - R->x = (FT_F2Dot14)TT_DivFix14( Vx, W ); - R->y = (FT_F2Dot14)TT_DivFix14( Vy, W ); - - return SUCCESS; - } - - W = TT_VecLen( Vx, Vy ); - - Vx = TT_DivFix14( Vx, W ); - Vy = TT_DivFix14( Vy, W ); - - W = Vx * Vx + Vy * Vy; - - /* Now, we want that Sqrt( W ) = 0x4000 */ - /* Or 0x10000000 <= W < 0x10004000 */ - - if ( Vx < 0 ) - { - Vx = -Vx; - S1 = TRUE; - } - else - S1 = FALSE; - - if ( Vy < 0 ) - { - Vy = -Vy; - S2 = TRUE; - } - else - S2 = FALSE; - - while ( W < 0x10000000L ) - { - /* We need to increase W by a minimal amount */ - if ( Vx < Vy ) - Vx++; - else - Vy++; - - W = Vx * Vx + Vy * Vy; - } - - while ( W >= 0x10004000L ) - { - /* We need to decrease W by a minimal amount */ - if ( Vx < Vy ) - Vx--; - else - Vy--; - - W = Vx * Vx + Vy * Vy; + Vx *= 0x4000; + Vy *= 0x4000; } - /* Note that in various cases, we can only */ - /* compute a Sqrt(W) of 0x3FFF, eg. Vx = Vy */ - - if ( S1 ) - Vx = -Vx; - - if ( S2 ) - Vy = -Vy; + W = FT_Hypot( Vx, Vy ); - R->x = (FT_F2Dot14)Vx; /* Type conversion */ - R->y = (FT_F2Dot14)Vy; /* Type conversion */ + R->x = (FT_F2Dot14)TT_DivFix14( Vx, W ); + R->y = (FT_F2Dot14)TT_DivFix14( Vy, W ); return SUCCESS; } @@ -2829,7 +2678,7 @@ BOUNDS( aIdx2, CUR.zp1.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return FAILURE; } @@ -3085,10 +2934,10 @@ CUR.func_round = (TT_Round_Func)Round_Super_45; -#define DO_SLOOP \ - if ( args[0] < 0 ) \ - CUR.error = TT_Err_Bad_Argument; \ - else \ +#define DO_SLOOP \ + if ( args[0] < 0 ) \ + CUR.error = FT_THROW( Bad_Argument ); \ + else \ CUR.GS.loop = args[0]; @@ -3170,21 +3019,21 @@ args[0] = CUR.top; -#define DO_CINDEX \ - { \ - FT_Long L; \ - \ - \ - L = args[0]; \ - \ - if ( L <= 0 || L > CUR.args ) \ - { \ - if ( CUR.pedantic_hinting ) \ - CUR.error = TT_Err_Invalid_Reference; \ - args[0] = 0; \ - } \ - else \ - args[0] = CUR.stack[CUR.args - L]; \ +#define DO_CINDEX \ + { \ + FT_Long L; \ + \ + \ + L = args[0]; \ + \ + if ( L <= 0 || L > CUR.args ) \ + { \ + if ( CUR.pedantic_hinting ) \ + CUR.error = FT_THROW( Invalid_Reference ); \ + args[0] = 0; \ + } \ + else \ + args[0] = CUR.stack[CUR.args - L]; \ } @@ -3192,24 +3041,24 @@ if ( args[1] != 0 ) \ { \ if ( args[0] == 0 && CUR.args == 0 ) \ - CUR.error = TT_Err_Bad_Argument; \ + CUR.error = FT_THROW( Bad_Argument ); \ CUR.IP += args[0]; \ if ( CUR.IP < 0 || \ ( CUR.callTop > 0 && \ CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ - CUR.error = TT_Err_Bad_Argument; \ + CUR.error = FT_THROW( Bad_Argument ); \ CUR.step_ins = FALSE; \ } #define DO_JMPR \ if ( args[0] == 0 && CUR.args == 0 ) \ - CUR.error = TT_Err_Bad_Argument; \ + CUR.error = FT_THROW( Bad_Argument ); \ CUR.IP += args[0]; \ if ( CUR.IP < 0 || \ ( CUR.callTop > 0 && \ CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ - CUR.error = TT_Err_Bad_Argument; \ + CUR.error = FT_THROW( Bad_Argument ); \ CUR.step_ins = FALSE; @@ -3217,12 +3066,12 @@ if ( args[1] == 0 ) \ { \ if ( args[0] == 0 && CUR.args == 0 ) \ - CUR.error = TT_Err_Bad_Argument; \ + CUR.error = FT_THROW( Bad_Argument ); \ CUR.IP += args[0]; \ if ( CUR.IP < 0 || \ ( CUR.callTop > 0 && \ CUR.IP > CUR.callStack[CUR.callTop - 1].Cur_End ) ) \ - CUR.error = TT_Err_Bad_Argument; \ + CUR.error = FT_THROW( Bad_Argument ); \ CUR.step_ins = FALSE; \ } @@ -3281,7 +3130,7 @@ #define DO_DIV \ if ( args[1] == 0 ) \ - CUR.error = TT_Err_Divide_By_Zero; \ + CUR.error = FT_THROW( Divide_By_Zero ); \ else \ args[0] = FT_MulDiv_No_Round( args[0], 64L, args[1] ); @@ -3324,8 +3173,19 @@ /* subpixel hinting - avoid Typeman Dstroke and */ \ /* IStroke and Vacuform rounds */ \ \ - if ( CUR.compatibility_mode && \ - ( I == 24 || I == 22 || I == 8 ) ) \ + if ( SUBPIXEL_HINTING && \ + CUR.ignore_x_mode && \ + ( ( I == 24 && \ + ( CUR.face->sph_found_func_flags & \ + ( SPH_FDEF_SPACING_1 | \ + SPH_FDEF_SPACING_2 ) ) ) || \ + ( I == 22 && \ + ( CUR.sph_in_func_flags & \ + SPH_FDEF_TYPEMAN_STROKES ) ) || \ + ( I == 8 && \ + ( CUR.face->sph_found_func_flags & \ + SPH_FDEF_VACUFORM_ROUND_1 ) && \ + CUR.iup_called ) ) ) \ args[0] = 0; \ else \ args[0] = CUR.storage[I]; \ @@ -3425,8 +3285,8 @@ } -#define DO_DEBUG \ - CUR.error = TT_Err_Debug_OpCode; +#define DO_DEBUG \ + CUR.error = FT_THROW( Debug_OpCode ); #define DO_ROUND \ @@ -3454,10 +3314,10 @@ #undef ARRAY_BOUND_ERROR -#define ARRAY_BOUND_ERROR \ - { \ - CUR.error = TT_Err_Invalid_Reference; \ - return; \ +#define ARRAY_BOUND_ERROR \ + { \ + CUR.error = FT_THROW( Invalid_Reference ); \ + return; \ } @@ -4436,7 +4296,7 @@ if ( L <= 0 || L > CUR.args ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); } else { @@ -4506,7 +4366,7 @@ } Fail_Overflow: - CUR.error = TT_Err_Code_Overflow; + CUR.error = FT_THROW( Code_Overflow ); return FAILURE; } @@ -4613,8 +4473,57 @@ #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING /* arguments to opcodes are skipped by `SKIP_Code' */ - FT_Byte opcode_pattern[1][12] = { - /* #0 TTFautohint bytecode (old) */ + FT_Byte opcode_pattern[9][12] = { + /* #0 inline delta function 1 */ + { + 0x4B, /* PPEM */ + 0x53, /* GTEQ */ + 0x23, /* SWAP */ + 0x4B, /* PPEM */ + 0x51, /* LTEQ */ + 0x5A, /* AND */ + 0x58, /* IF */ + 0x38, /* SHPIX */ + 0x1B, /* ELSE */ + 0x21, /* POP */ + 0x21, /* POP */ + 0x59 /* EIF */ + }, + /* #1 inline delta function 2 */ + { + 0x4B, /* PPEM */ + 0x54, /* EQ */ + 0x58, /* IF */ + 0x38, /* SHPIX */ + 0x1B, /* ELSE */ + 0x21, /* POP */ + 0x21, /* POP */ + 0x59 /* EIF */ + }, + /* #2 diagonal stroke function */ + { + 0x20, /* DUP */ + 0x20, /* DUP */ + 0xB0, /* PUSHB_1 */ + /* 1 */ + 0x60, /* ADD */ + 0x46, /* GC_cur */ + 0xB0, /* PUSHB_1 */ + /* 64 */ + 0x23, /* SWAP */ + 0x42 /* WS */ + }, + /* #3 VacuFormRound function */ + { + 0x45, /* RCVT */ + 0x23, /* SWAP */ + 0x46, /* GC_cur */ + 0x60, /* ADD */ + 0x20, /* DUP */ + 0xB0 /* PUSHB_1 */ + /* 38 */ + }, + /* #4 TTFautohint bytecode (old) */ { 0x20, /* DUP */ 0x64, /* ABS */ @@ -4625,10 +4534,40 @@ 0x23, /* SWAP */ 0xB0 /* PUSHB_1 */ }, + /* #5 spacing function 1 */ + { + 0x01, /* SVTCA_x */ + 0xB0, /* PUSHB_1 */ + /* 24 */ + 0x43, /* RS */ + 0x58 /* IF */ + }, + /* #6 spacing function 2 */ + { + 0x01, /* SVTCA_x */ + 0x18, /* RTG */ + 0xB0, /* PUSHB_1 */ + /* 24 */ + 0x43, /* RS */ + 0x58 /* IF */ + }, + /* #7 TypeMan Talk DiagEndCtrl function */ + { + 0x01, /* SVTCA_x */ + 0x20, /* DUP */ + 0xB0, /* PUSHB_1 */ + /* 3 */ + 0x25, /* CINDEX */ + }, + /* #8 TypeMan Talk Align */ + { + 0x06, /* SPVTL */ + 0x7D, /* RDTG */ + }, }; - FT_UShort opcode_patterns = 1; - FT_UShort opcode_pointer[1] = { 0, }; - FT_UShort opcode_size[1] = { 7, }; + FT_UShort opcode_patterns = 9; + FT_UShort opcode_pointer[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + FT_UShort opcode_size[9] = { 12, 8, 8, 6, 7, 4, 5, 4, 2 }; FT_UShort i; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -4651,7 +4590,7 @@ /* check that there is enough room for new functions */ if ( CUR.numFDefs >= CUR.maxFDefs ) { - CUR.error = TT_Err_Too_Many_Function_Defs; + CUR.error = FT_THROW( Too_Many_Function_Defs ); return; } CUR.numFDefs++; @@ -4661,60 +4600,140 @@ /* func # must be within unsigned 16-bit integer */ if ( n > 0xFFFFU ) { - CUR.error = TT_Err_Too_Many_Function_Defs; + CUR.error = FT_THROW( Too_Many_Function_Defs ); return; } - rec->range = CUR.curRange; - rec->opc = (FT_UInt16)n; - rec->start = CUR.IP + 1; - rec->active = TRUE; - rec->inline_delta = FALSE; + rec->range = CUR.curRange; + rec->opc = (FT_UInt16)n; + rec->start = CUR.IP + 1; + rec->active = TRUE; + rec->inline_delta = FALSE; + rec->sph_fdef_flags = 0x0000; if ( n > CUR.maxFunc ) CUR.maxFunc = (FT_UInt16)n; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* We don't know for sure these are typeman functions, */ + /* however they are only active when RS 22 is called */ + if ( n >= 64 && n <= 66 ) + rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_STROKES; +#endif + /* Now skip the whole function definition. */ /* We don't allow nested IDEFS & FDEFs. */ while ( SKIP_Code() == SUCCESS ) { -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING -#ifdef SPH_DEBUG_MORE_VERBOSE - printf ( "Opcode: %d ", CUR.opcode ); -#endif +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - for ( i = 0; i < opcode_patterns; i++ ) + if ( SUBPIXEL_HINTING ) { - if ( opcode_pointer[i] < opcode_size[i] && - CUR.opcode == opcode_pattern[i][opcode_pointer[i]] ) + for ( i = 0; i < opcode_patterns; i++ ) { -#ifdef SPH_DEBUG_MORE_VERBOSE - printf( "function %d, opcode ptrn: %d" - " op# %d: %d FOUND \n", - n, i, opcode_pointer[i], CUR.opcode ); -#endif - opcode_pointer[i] += 1; - - if ( opcode_pointer[i] == opcode_size[i] ) + if ( opcode_pointer[i] < opcode_size[i] && + CUR.opcode == opcode_pattern[i][opcode_pointer[i]] ) { -#ifdef SPH_DEBUG - printf( "Function signature %d detected in FDEF %d\n", i, n); -#endif + opcode_pointer[i] += 1; - switch ( i ) + if ( opcode_pointer[i] == opcode_size[i] ) { - case 0: - CUR.size->ttfautohinted = TRUE; - break; + FT_TRACE7(( "sph: Function %d, opcode ptrn: %d, %s %s\n", + i, n, + CUR.face->root.family_name, + CUR.face->root.style_name )); + + switch ( i ) + { + case 0: + rec->sph_fdef_flags |= SPH_FDEF_INLINE_DELTA_1; + CUR.face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_1; + break; + + case 1: + rec->sph_fdef_flags |= SPH_FDEF_INLINE_DELTA_2; + CUR.face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_2; + break; + + case 2: + switch ( n ) + { + /* needs to be implemented still */ + case 58: + rec->sph_fdef_flags |= SPH_FDEF_DIAGONAL_STROKE; + CUR.face->sph_found_func_flags |= SPH_FDEF_DIAGONAL_STROKE; + } + break; + + case 3: + switch ( n ) + { + case 0: + rec->sph_fdef_flags |= SPH_FDEF_VACUFORM_ROUND_1; + CUR.face->sph_found_func_flags |= SPH_FDEF_VACUFORM_ROUND_1; + } + break; + + case 4: + /* probably not necessary to detect anymore */ + rec->sph_fdef_flags |= SPH_FDEF_TTFAUTOHINT_1; + CUR.face->sph_found_func_flags |= SPH_FDEF_TTFAUTOHINT_1; + break; + + case 5: + switch ( n ) + { + case 0: + case 1: + case 2: + case 4: + case 7: + case 8: + rec->sph_fdef_flags |= SPH_FDEF_SPACING_1; + CUR.face->sph_found_func_flags |= SPH_FDEF_SPACING_1; + } + break; + + case 6: + switch ( n ) + { + case 0: + case 1: + case 2: + case 4: + case 7: + case 8: + rec->sph_fdef_flags |= SPH_FDEF_SPACING_2; + CUR.face->sph_found_func_flags |= SPH_FDEF_SPACING_2; + } + break; + + case 7: + rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; + CUR.face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; + break; + + case 8: +#if 0 + rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; + CUR.face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; +#endif + break; + } + opcode_pointer[i] = 0; } - opcode_pointer[i] = 0; } + + else + opcode_pointer[i] = 0; } - else - opcode_pointer[i] = 0; + /* Set sph_compatibility_mode only when deltas are detected */ + CUR.face->sph_compatibility_mode = + ( ( CUR.face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_1 ) | + ( CUR.face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ); } #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -4723,7 +4742,7 @@ { case 0x89: /* IDEF */ case 0x2C: /* FDEF */ - CUR.error = TT_Err_Nested_DEFS; + CUR.error = FT_THROW( Nested_DEFS ); return; case 0x2D: /* ENDF */ @@ -4748,9 +4767,13 @@ FT_UNUSED_ARG; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + CUR.sph_in_func_flags = 0x0000; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + if ( CUR.callTop <= 0 ) /* We encountered an ENDF without a call */ { - CUR.error = TT_Err_ENDF_In_Exec_Stream; + CUR.error = FT_THROW( ENDF_In_Exec_Stream ); return; } @@ -4762,15 +4785,6 @@ CUR.step_ins = FALSE; -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - /* - * CUR.ignore_x_mode may be turned off prior to function calls. This - * ensures it is turned back on. - */ - CUR.ignore_x_mode = ( CUR.subpixel_hinting || CUR.grayscale_hinting ) && - !( CUR.sph_tweak_flags & SPH_TWEAK_PIXEL_HINTING ); -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - if ( pRec->Cur_Count > 0 ) { CUR.callTop++; @@ -4841,11 +4855,21 @@ if ( !def->active ) goto Fail; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + ( ( CUR.iup_called && + ( CUR.sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) || + ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) ) ) + goto Fail; + else + CUR.sph_in_func_flags = def->sph_fdef_flags; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ /* check the call stack */ if ( CUR.callTop >= CUR.callSize ) { - CUR.error = TT_Err_Stack_Overflow; + CUR.error = FT_THROW( Stack_Overflow ); return; } @@ -4863,10 +4887,11 @@ def->start ); CUR.step_ins = FALSE; + return; Fail: - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); } @@ -4919,10 +4944,19 @@ if ( !def->active ) goto Fail; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) ) + goto Fail; + else + CUR.sph_in_func_flags = def->sph_fdef_flags; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + /* check stack */ if ( CUR.callTop >= CUR.callSize ) { - CUR.error = TT_Err_Stack_Overflow; + CUR.error = FT_THROW( Stack_Overflow ); return; } @@ -4946,7 +4980,7 @@ return; Fail: - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); } @@ -4977,7 +5011,7 @@ /* check that there is enough room for a new instruction */ if ( CUR.numIDefs >= CUR.maxIDefs ) { - CUR.error = TT_Err_Too_Many_Instruction_Defs; + CUR.error = FT_THROW( Too_Many_Instruction_Defs ); return; } CUR.numIDefs++; @@ -4986,7 +5020,7 @@ /* opcode must be unsigned 8-bit integer */ if ( 0 > args[0] || args[0] > 0x00FF ) { - CUR.error = TT_Err_Too_Many_Instruction_Defs; + CUR.error = FT_THROW( Too_Many_Instruction_Defs ); return; } @@ -5007,7 +5041,7 @@ { case 0x89: /* IDEF */ case 0x2C: /* FDEF */ - CUR.error = TT_Err_Nested_DEFS; + CUR.error = FT_THROW( Nested_DEFS ); return; case 0x2D: /* ENDF */ return; @@ -5041,7 +5075,7 @@ if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) ) { - CUR.error = TT_Err_Stack_Overflow; + CUR.error = FT_THROW( Stack_Overflow ); return; } @@ -5068,7 +5102,7 @@ if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) ) { - CUR.error = TT_Err_Stack_Overflow; + CUR.error = FT_THROW( Stack_Overflow ); return; } @@ -5098,7 +5132,7 @@ if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) ) { - CUR.error = TT_Err_Stack_Overflow; + CUR.error = FT_THROW( Stack_Overflow ); return; } @@ -5123,7 +5157,7 @@ if ( BOUNDS( L, CUR.stackSize + 1 - CUR.top ) ) { - CUR.error = TT_Err_Stack_Overflow; + CUR.error = FT_THROW( Stack_Overflow ); return; } @@ -5166,7 +5200,7 @@ if ( BOUNDSL( L, CUR.zp2.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); R = 0; } else @@ -5203,7 +5237,7 @@ if ( BOUNDS( L, CUR.zp2.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5247,7 +5281,7 @@ BOUNDS( K, CUR.zp1.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); D = 0; } else @@ -5294,7 +5328,8 @@ #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING /* Disable Type 2 Vacuform Rounds - e.g. Arial Narrow */ - if ( CUR.ignore_x_mode && FT_ABS( D ) == 64 ) + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && FT_ABS( D ) == 64 ) D += 1; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -5323,7 +5358,7 @@ BOUNDS( p1, CUR.zp2.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5363,6 +5398,12 @@ A = v1->x - v2->x; B = v1->y - v2->y; + + if ( A == 0 && B == 0 ) + { + A = 0x4000; + aOpc = 0; + } } if ( ( aOpc & 1 ) != 0 ) @@ -5401,7 +5442,7 @@ default: if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5430,7 +5471,7 @@ default: if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5459,7 +5500,7 @@ default: if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5488,7 +5529,7 @@ default: if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5519,7 +5560,7 @@ if ( K < 1 || K > 2 ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5617,7 +5658,7 @@ if ( CUR.top < CUR.GS.loop ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Too_Few_Arguments; + CUR.error = FT_THROW( Too_Few_Arguments ); goto Fail; } @@ -5631,7 +5672,7 @@ { if ( CUR.pedantic_hinting ) { - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } } @@ -5666,7 +5707,7 @@ BOUNDS( L, CUR.pts.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5694,7 +5735,7 @@ BOUNDS( L, CUR.pts.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5728,7 +5769,7 @@ if ( BOUNDS( p, zp.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); *refp = 0; return FAILURE; } @@ -5790,12 +5831,7 @@ if ( CUR.GS.freeVector.x != 0 ) { -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !CUR.ignore_x_mode || - ( CUR.ignore_x_mode && - ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_MOVE_ZP2 ) ) ) -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - CUR.zp2.cur[point].x += dx; + CUR.zp2.cur[point].x += dx; if ( touch ) CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -5831,7 +5867,7 @@ if ( CUR.top < CUR.GS.loop ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } @@ -5847,11 +5883,18 @@ { if ( CUR.pedantic_hinting ) { - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } } else +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* doesn't follow Cleartype spec but produces better result */ + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode ) + MOVE_Zp2_Point( point, 0, dy, TRUE ); + else +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ MOVE_Zp2_Point( point, dx, dy, TRUE ); CUR.GS.loop--; @@ -5890,7 +5933,7 @@ if ( BOUNDS( contour, bounds ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5938,7 +5981,7 @@ if ( BOUNDS( args[0], 2 ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -5984,7 +6027,7 @@ if ( CUR.top < CUR.GS.loop + 1 ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } @@ -6019,7 +6062,7 @@ { if ( CUR.pedantic_hinting ) { - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } } @@ -6029,12 +6072,13 @@ /* If not using ignore_x_mode rendering, allow ZP2 move. */ /* If inline deltas aren't allowed, skip ZP2 move. */ /* If using ignore_x_mode rendering, allow ZP2 point move if: */ - /* - freedom vector is y and compatibility_mode is off */ + /* - freedom vector is y and sph_compatibility_mode is off */ /* - the glyph is composite and the move is in the Y direction */ /* - the glyph is specifically set to allow SHPIX moves */ /* - the move is on a previously Y-touched point */ - if ( CUR.ignore_x_mode ) + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode ) { /* save point for later comparison */ if ( CUR.GS.freeVector.y != 0 ) @@ -6042,62 +6086,70 @@ else B1 = CUR.zp2.cur[point].x; - if ( CUR.GS.freeVector.y != 0 && - ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_INLINE_DELTAS ) ) - goto Skip; - - if ( CUR.ignore_x_mode && - !CUR.compatibility_mode && CUR.GS.freeVector.y != 0 ) + if ( !CUR.face->sph_compatibility_mode && + CUR.GS.freeVector.y != 0 ) + { MOVE_Zp2_Point( point, dx, dy, TRUE ); - else if ( CUR.ignore_x_mode && CUR.compatibility_mode ) + /* save new point */ + if ( CUR.GS.freeVector.y != 0 ) + { + B2 = CUR.zp2.cur[point].y; + + /* reverse any disallowed moves */ + if ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && + ( B1 & 63 ) != 0 && + ( B2 & 63 ) != 0 && + B1 != B2 ) + MOVE_Zp2_Point( point, -dx, -dy, TRUE ); + } + } + else if ( CUR.face->sph_compatibility_mode ) { - if ( CUR.ignore_x_mode && - ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) ) + if ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) { dx = FT_PIX_ROUND( B1 + dx ) - B1; dy = FT_PIX_ROUND( B1 + dy ) - B1; } + /* skip post-iup deltas */ + if ( CUR.iup_called && + ( ( CUR.sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) || + ( CUR.sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) ) + goto Skip; + if ( !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) && ( ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) || ( CUR.zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y ) || ( CUR.sph_tweak_flags & SPH_TWEAK_DO_SHPIX ) ) ) - MOVE_Zp2_Point( point, dx, dy, TRUE ); - } + MOVE_Zp2_Point( point, 0, dy, TRUE ); - /* save new point */ - if ( CUR.GS.freeVector.y != 0 ) - B2 = CUR.zp2.cur[point].y; - else - B2 = CUR.zp2.cur[point].x; - - /* reverse any disallowed moves */ - if ( ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && - CUR.GS.freeVector.y != 0 && - B1 % 64 != 0 && - B2 % 64 != 0 && - B1 != B2 ) || - ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES ) && - CUR.GS.freeVector.y != 0 && - B1 % 64 == 0 && - B2 % 64 != 0 && - B1 != B2 && - !CUR.size->ttfautohinted ) ) - { -#ifdef SPH_DEBUG - printf( "Reversing ZP2 move\n" ); -#endif - MOVE_Zp2_Point( point, -dx, -dy, TRUE ); + /* save new point */ + if ( CUR.GS.freeVector.y != 0 ) + { + B2 = CUR.zp2.cur[point].y; + + /* reverse any disallowed moves */ + if ( ( B1 & 63 ) == 0 && + ( B2 & 63 ) != 0 && + B1 != B2 ) + MOVE_Zp2_Point( point, 0, -dy, TRUE ); + } } - } + else if ( CUR.sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL ) + MOVE_Zp2_Point( point, dx, dy, TRUE ); + } else MOVE_Zp2_Point( point, dx, dy, TRUE ); } - Skip: -#else + + Skip: + +#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + MOVE_Zp2_Point( point, dx, dy, TRUE ); -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + +#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ CUR.GS.loop--; } @@ -6119,16 +6171,21 @@ { FT_UShort point; FT_F26Dot6 distance; + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - FT_F26Dot6 control_value_cutin; + FT_F26Dot6 control_value_cutin = 0; /* pacify compiler */ - control_value_cutin = CUR.GS.control_value_cutin; + if ( SUBPIXEL_HINTING ) + { + control_value_cutin = CUR.GS.control_value_cutin; + + if ( CUR.ignore_x_mode && + CUR.GS.freeVector.x != 0 && + !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + control_value_cutin = 0; + } - if ( CUR.ignore_x_mode && - CUR.GS.freeVector.x != 0 && - !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) - control_value_cutin = 0; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ point = (FT_UShort)args[0]; @@ -6137,7 +6194,7 @@ BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -6155,7 +6212,8 @@ #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING /* subpixel hinting - make MSIRP respect CVT cut-in; */ - if ( CUR.ignore_x_mode && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 && FT_ABS( distance - args[1] ) >= control_value_cutin ) distance = args[1]; @@ -6190,7 +6248,7 @@ if ( BOUNDS( point, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -6198,7 +6256,8 @@ { cur_dist = CUR_fast_project( &CUR.zp0.cur[point] ); #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 ) distance = ROUND_None( cur_dist, @@ -6240,8 +6299,10 @@ point = (FT_UShort)args[0]; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 && + CUR.GS.freeVector.y == 0 && !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) control_value_cutin = 0; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -6250,7 +6311,7 @@ BOUNDSL( cvtEntry, CUR.cvtSize ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } @@ -6279,8 +6340,11 @@ if ( CUR.GS.gep0 == 0 ) /* If in twilight zone */ { #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - /* only adjust legacy fonts x otherwise breaks Calibri italic */ - if ( CUR.compatibility_mode ) + /* Only adjust if not in sph_compatibility_mode or ignore_x_mode. */ + /* Determined via experimentation and may be incorrect... */ + if ( !SUBPIXEL_HINTING || + ( !CUR.ignore_x_mode || + !CUR.face->sph_compatibility_mode ) ) #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ CUR.zp0.org[point].x = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.x ); @@ -6289,7 +6353,9 @@ CUR.zp0.cur[point] = CUR.zp0.org[point]; } #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( ( CUR.sph_tweak_flags & SPH_TWEAK_MIAP_HACK ) && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + ( CUR.sph_tweak_flags & SPH_TWEAK_MIAP_HACK ) && distance > 0 && CUR.GS.freeVector.y != 0 ) distance = 0; @@ -6303,7 +6369,8 @@ distance = org_dist; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 ) distance = ROUND_None( distance, CUR.tt_metrics.compensations[0] ); @@ -6337,20 +6404,20 @@ minimum_distance = CUR.GS.minimum_distance; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 && !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) minimum_distance = 0; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - point = (FT_UShort)args[0]; if ( BOUNDS( point, CUR.zp1.n_points ) || BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } @@ -6407,7 +6474,9 @@ if ( ( CUR.opcode & 4 ) != 0 ) { #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 ) + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + CUR.GS.freeVector.x != 0 ) distance = ROUND_None( org_dist, CUR.tt_metrics.compensations[CUR.opcode & 3] ); @@ -6473,8 +6542,8 @@ control_value_cutin, minimum_distance; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - FT_Int B1; - FT_Int B2; + FT_Int B1 = 0; /* pacify compiler */ + FT_Int B2 = 0; FT_Bool reverse_move = FALSE; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -6485,7 +6554,8 @@ cvtEntry = (FT_ULong)( args[1] + 1 ); #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 && !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) control_value_cutin = minimum_distance = 0; @@ -6498,7 +6568,7 @@ BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } @@ -6506,10 +6576,6 @@ cvt_dist = 0; else cvt_dist = CUR_Func_read_cvt( cvtEntry - 1 ); -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.sph_tweak_flags & SPH_TWEAK_MIRP_CVT_ZERO ) - cvt_dist = 0; -#endif /* single width test */ @@ -6547,8 +6613,11 @@ if ( ( org_dist ^ cvt_dist ) < 0 ) cvt_dist = -cvt_dist; } + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.GS.freeVector.y != 0 && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + CUR.GS.freeVector.y != 0 && ( CUR.sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) ) { if ( cur_dist < -64 ) @@ -6557,6 +6626,7 @@ cvt_dist += 32; } #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + /* control value cut-in and round */ if ( ( CUR.opcode & 4 ) != 0 ) @@ -6587,9 +6657,23 @@ CUR.tt_metrics.compensations[CUR.opcode & 3] ); } else + { + +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* do cvt cut-in always in MIRP for sph */ + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + CUR.GS.gep0 == CUR.GS.gep1 ) + { + if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin ) + cvt_dist = org_dist; + } +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + distance = ROUND_None( cvt_dist, CUR.tt_metrics.compensations[CUR.opcode & 3] ); + } /* minimum distance test */ @@ -6608,52 +6692,52 @@ } #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - B1 = CUR.zp1.cur[point].y; - - /* Round moves if necessary */ - if ( CUR.ignore_x_mode && - CUR.GS.freeVector.y != 0 && - ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) ) - distance = FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist; - - if ( CUR.GS.freeVector.y != 0 && - ( CUR.opcode & 16 ) == 0 && - ( CUR.opcode & 8 ) == 0 && - ( CUR.sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) ) - distance += 64; + if ( SUBPIXEL_HINTING ) + { + B1 = CUR.zp1.cur[point].y; + + /* Round moves if necessary */ + if ( CUR.ignore_x_mode && + CUR.GS.freeVector.y != 0 && + ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) ) + distance = FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist; + + if ( CUR.ignore_x_mode && + CUR.GS.freeVector.y != 0 && + ( CUR.opcode & 16 ) == 0 && + ( CUR.opcode & 8 ) == 0 && + ( CUR.sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) ) + distance += 64; + } #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ CUR_Func_move( &CUR.zp1, point, distance - cur_dist ); #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - B2 = CUR.zp1.cur[point].y; - - /* Reverse move if necessary */ - if ( CUR.ignore_x_mode ) + if ( SUBPIXEL_HINTING ) { - if ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES ) && - CUR.GS.freeVector.y != 0 && - B1 % 64 == 0 && - B2 % 64 != 0 && - !CUR.size->ttfautohinted ) - reverse_move = TRUE; + B2 = CUR.zp1.cur[point].y; - if ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && - CUR.GS.freeVector.y != 0 && - B2 % 64 != 0 && - B1 % 64 != 0 ) - reverse_move = TRUE; + /* Reverse move if necessary */ + if ( CUR.ignore_x_mode ) + { + if ( CUR.face->sph_compatibility_mode && + CUR.GS.freeVector.y != 0 && + ( B1 & 63 ) == 0 && + ( B2 & 63 ) != 0 ) + reverse_move = TRUE; + + if ( ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && + CUR.GS.freeVector.y != 0 && + ( B2 & 63 ) != 0 && + ( B1 & 63 ) != 0 ) + reverse_move = TRUE; + } - if ( ( CUR.sph_tweak_flags & - SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES ) && - !reverse_move && - FT_ABS( B1 - B2 ) >= 64 ) - reverse_move = TRUE; + if ( reverse_move ) + CUR_Func_move( &CUR.zp1, point, -( distance - cur_dist ) ); } - if ( reverse_move ) - CUR_Func_move( &CUR.zp1, point, -( distance - cur_dist ) ); - #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ Fail: @@ -6682,11 +6766,12 @@ #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode && + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && CUR.iup_called && ( CUR.sph_tweak_flags & SPH_TWEAK_NO_ALIGNRP_AFTER_IUP ) ) { - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -6695,7 +6780,7 @@ BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } @@ -6709,7 +6794,7 @@ { if ( CUR.pedantic_hinting ) { - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } } @@ -6768,7 +6853,7 @@ BOUNDS( point, CUR.zp2.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -6844,7 +6929,7 @@ BOUNDS( p2, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -6879,7 +6964,7 @@ if ( CUR.top < CUR.GS.loop ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } @@ -6893,7 +6978,7 @@ if ( BOUNDS( CUR.GS.rp1, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto Fail; } @@ -6949,7 +7034,7 @@ { if ( CUR.pedantic_hinting ) { - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } continue; @@ -6975,9 +7060,24 @@ cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base ); if ( org_dist ) - new_dist = ( old_range != 0 ) - ? FT_MulDiv( org_dist, cur_range, old_range ) - : cur_dist; + { + if ( old_range ) + new_dist = FT_MulDiv( org_dist, cur_range, old_range ); + else + { + /* This is the same as what MS does for the invalid case: */ + /* */ + /* delta = (Original_Pt - Original_RP1) - */ + /* (Current_Pt - Current_RP1) */ + /* */ + /* In FreeType speak: */ + /* */ + /* new_dist = cur_dist - */ + /* org_dist - cur_dist; */ + + new_dist = -org_dist; + } + } else new_dist = 0; @@ -7008,7 +7108,7 @@ if ( BOUNDS( point, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } @@ -7198,9 +7298,10 @@ point = 0; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode ) + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode ) { - CUR.iup_called = 1; + CUR.iup_called = TRUE; if ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_IUP ) return; } @@ -7277,7 +7378,14 @@ FT_Long B; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING FT_UShort B1, B2; -#endif + + + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + CUR.iup_called && + ( CUR.sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) + goto Fail; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING @@ -7290,7 +7398,7 @@ if ( CUR.args < n ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Too_Few_Arguments; + CUR.error = FT_THROW( Too_Few_Arguments ); n = CUR.args; } @@ -7308,7 +7416,7 @@ if ( CUR.args < 2 ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Too_Few_Arguments; + CUR.error = FT_THROW( Too_Few_Arguments ); CUR.args = 0; goto Fail; } @@ -7352,73 +7460,81 @@ B = B * 64 / ( 1L << CUR.GS.delta_shift ); #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - /* - * Allow delta move if - * - * - not using ignore_x_mode rendering - * - glyph is specifically set to allow it - * - glyph is composite and freedom vector is not subpixel vector - */ - if ( !CUR.ignore_x_mode || - ( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_DO_DELTAP ) || - ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) ) - CUR_Func_move( &CUR.zp0, A, B ); - /* Otherwise apply subpixel hinting and compatibility mode rules */ - else if ( CUR.ignore_x_mode ) + if ( SUBPIXEL_HINTING ) { - if ( CUR.GS.freeVector.y != 0 ) - B1 = CUR.zp0.cur[A].y; - else - B1 = CUR.zp0.cur[A].x; - - /* Standard Subpixel Hinting: Allow y move */ - if ( !CUR.compatibility_mode && CUR.GS.freeVector.y != 0 ) + /* + * Allow delta move if + * + * - not using ignore_x_mode rendering + * - glyph is specifically set to allow it + * - glyph is composite and freedom vector is not subpixel + * vector + */ + if ( !CUR.ignore_x_mode || + ( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_DO_DELTAP ) || + ( CUR.is_composite && CUR.GS.freeVector.y != 0 ) ) CUR_Func_move( &CUR.zp0, A, B ); - /* Compatibility Mode: Allow x or y move if point touched in - Y direction */ - else if ( CUR.compatibility_mode && - !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) ) + /* Otherwise apply subpixel hinting and */ + /* compatibility mode rules */ + else if ( CUR.ignore_x_mode ) { - /* save the y value of the point now; compare after move */ - B1 = CUR.zp0.cur[A].y; - - if ( ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) ) - B = FT_PIX_ROUND( B1 + B ) - B1; - - /* - * Allow delta move if using compatibility_mode, IUP has not - * been called, and point is touched on Y. - */ - if ( !CUR.iup_called && - ( CUR.zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) ) + if ( CUR.GS.freeVector.y != 0 ) + B1 = CUR.zp0.cur[A].y; + else + B1 = CUR.zp0.cur[A].x; + +#if 0 + /* Standard Subpixel Hinting: Allow y move. */ + /* This messes up dejavu and may not be needed... */ + if ( !CUR.face->sph_compatibility_mode && + CUR.GS.freeVector.y != 0 ) CUR_Func_move( &CUR.zp0, A, B ); - } + else +#endif /* 0 */ + + /* Compatibility Mode: Allow x or y move if point touched in */ + /* Y direction. */ + if ( CUR.face->sph_compatibility_mode && + !( CUR.sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) ) + { + /* save the y value of the point now; compare after move */ + B1 = CUR.zp0.cur[A].y; - B2 = CUR.zp0.cur[A].y; - - /* Reverse this move if it results in a disallowed move */ - if ( CUR.GS.freeVector.y != 0 && - ( ( ( CUR.sph_tweak_flags & - SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES ) && - B1 % 64 == 0 && - B2 % 64 != 0 && - !CUR.size->ttfautohinted ) || - ( ( CUR.sph_tweak_flags & - SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) && - B1 % 64 != 0 && - B2 % 64 != 0 ) ) ) - CUR_Func_move( &CUR.zp0, A, -B ); + if ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) + B = FT_PIX_ROUND( B1 + B ) - B1; + + /* Allow delta move if using sph_compatibility_mode, */ + /* IUP has not been called, and point is touched on Y. */ + if ( !CUR.iup_called && + ( CUR.zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) ) + CUR_Func_move( &CUR.zp0, A, B ); + } + + B2 = CUR.zp0.cur[A].y; + + /* Reverse this move if it results in a disallowed move */ + if ( CUR.GS.freeVector.y != 0 && + ( ( CUR.face->sph_compatibility_mode && + ( B1 & 63 ) == 0 && + ( B2 & 63 ) != 0 ) || + ( ( CUR.sph_tweak_flags & + SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) && + ( B1 & 63 ) != 0 && + ( B2 & 63 ) != 0 ) ) ) + CUR_Func_move( &CUR.zp0, A, -B ); + } } -#else - CUR_Func_move( &CUR.zp0, A, B ); -#endif /* *TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + else +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + CUR_Func_move( &CUR.zp0, A, B ); } } else if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); } Fail: @@ -7450,7 +7566,7 @@ if ( CUR.args < n ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Too_Few_Arguments; + CUR.error = FT_THROW( Too_Few_Arguments ); n = CUR.args; } @@ -7467,7 +7583,7 @@ if ( CUR.args < 2 ) { if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Too_Few_Arguments; + CUR.error = FT_THROW( Too_Few_Arguments ); CUR.args = 0; goto Fail; } @@ -7481,7 +7597,7 @@ { if ( CUR.pedantic_hinting ) { - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); return; } } @@ -7549,17 +7665,18 @@ /* Selector Bit: 0 */ /* Return Bit(s): 0-7 */ /* */ - if ( ( args[0] & 1 ) != 0 && CUR.ignore_x_mode ) + if ( SUBPIXEL_HINTING && + ( args[0] & 1 ) != 0 && + CUR.ignore_x_mode ) { K = CUR.rasterizer_version; -#ifdef SPH_DEBUG_MORE_VERBOSE - printf(" SETTING AS %d\n", CUR.rasterizer_version ); -#endif + FT_TRACE7(( "Setting rasterizer version %d\n", + CUR.rasterizer_version )); } else #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ if ( ( args[0] & 1 ) != 0 ) - K = 35; + K = TT_INTERPRETER_VERSION_35; /********************************/ /* GLYPH ROTATED */ @@ -7586,7 +7703,10 @@ K |= 1 << 12; #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode && CUR.rasterizer_version >= 35 ) + + if ( SUBPIXEL_HINTING && + CUR.ignore_x_mode && + CUR.rasterizer_version >= TT_INTERPRETER_VERSION_35 ) { /********************************/ /* HINTING FOR GRAYSCALE */ @@ -7649,7 +7769,9 @@ } } } + #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + args[0] = K; } @@ -7672,7 +7794,7 @@ if ( CUR.callTop >= CUR.callSize ) { - CUR.error = TT_Err_Stack_Overflow; + CUR.error = FT_THROW( Stack_Overflow ); return; } @@ -7691,7 +7813,7 @@ } } - CUR.error = TT_Err_Invalid_Opcode; + CUR.error = FT_THROW( Invalid_Opcode ); } @@ -8018,7 +8140,21 @@ FT_EXPORT_DEF( FT_Error ) TT_RunIns( TT_ExecContext exc ) { - FT_Long ins_counter = 0; /* executed instructions counter */ + FT_Long ins_counter = 0; /* executed instructions counter */ + FT_UShort i; + +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + FT_Byte opcode_pattern[1][2] = { + /* #8 TypeMan Talk Align */ + { + 0x06, /* SPVTL */ + 0x7D, /* RDTG */ + }, + }; + FT_UShort opcode_patterns = 1; + FT_UShort opcode_pointer[1] = { 0 }; + FT_UShort opcode_size[1] = { 1 }; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ #ifdef TT_CONFIG_OPTION_STATIC_RASTER @@ -8026,8 +8162,7 @@ #endif #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode ) - CUR.iup_called = FALSE; + CUR.iup_called = FALSE; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ /* set CVT functions */ @@ -8076,12 +8211,9 @@ /* One can also interpret it as the index of the last argument. */ if ( CUR.args < 0 ) { - FT_UShort i; - - if ( CUR.pedantic_hinting ) { - CUR.error = TT_Err_Too_Few_Arguments; + CUR.error = FT_THROW( Too_Few_Arguments ); goto LErrorLabel_; } @@ -8098,12 +8230,45 @@ /* statement. */ if ( CUR.new_top > CUR.stackSize ) { - CUR.error = TT_Err_Stack_Overflow; + CUR.error = FT_THROW( Stack_Overflow ); goto LErrorLabel_; } CUR.step_ins = TRUE; - CUR.error = TT_Err_Ok; + CUR.error = FT_Err_Ok; + +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + + if ( SUBPIXEL_HINTING ) + { + for ( i = 0; i < opcode_patterns; i++ ) + { + if ( opcode_pointer[i] < opcode_size[i] && + CUR.opcode == opcode_pattern[i][opcode_pointer[i]] ) + { + opcode_pointer[i] += 1; + + if ( opcode_pointer[i] == opcode_size[i] ) + { + FT_TRACE7(( "sph: opcode ptrn: %d, %s %s\n", + i, + CUR.face->root.family_name, + CUR.face->root.style_name )); + + switch ( i ) + { + case 0: + break; + } + opcode_pointer[i] = 0; + } + } + else + opcode_pointer[i] = 0; + } + } + +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ #ifdef TT_CONFIG_OPTION_INTERPRETER_SWITCH @@ -8301,13 +8466,7 @@ break; case 0x2B: /* CALL */ -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !CUR.ignore_x_mode || - !CUR.iup_called || - ( CUR.iup_called && - !( CUR.sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) ) -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - Ins_CALL( EXEC_ARG_ args ); + Ins_CALL( EXEC_ARG_ args ); break; case 0x2C: /* FDEF */ @@ -8325,11 +8484,7 @@ case 0x30: /* IUP */ case 0x31: /* IUP */ -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( CUR.ignore_x_mode ) - CUR.iup_called = TRUE; -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - Ins_IUP( EXEC_ARG_ args ); + Ins_IUP( EXEC_ARG_ args ); break; case 0x32: /* SHP */ @@ -8386,7 +8541,7 @@ break; Set_Invalid_Ref: - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); break; case 0x43: /* RS */ @@ -8488,13 +8643,7 @@ break; case 0x5D: /* DELTAP1 */ -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING - if ( !CUR.ignore_x_mode || - !CUR.iup_called || - ( CUR.iup_called && - !( CUR.sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) ) -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - Ins_DELTAP( EXEC_ARG_ args ); + Ins_DELTAP( EXEC_ARG_ args ); break; case 0x5E: /* SDB */ @@ -8682,11 +8831,12 @@ #endif /* TT_CONFIG_OPTION_INTERPRETER_SWITCH */ - if ( CUR.error != TT_Err_Ok ) + if ( CUR.error ) { switch ( CUR.error ) { - case TT_Err_Invalid_Opcode: /* looking for redefined instructions */ + /* looking for redefined instructions */ + case FT_ERR( Invalid_Opcode ): { TT_DefRecord* def = CUR.IDefs; TT_DefRecord* limit = def + CUR.numIDefs; @@ -8701,7 +8851,7 @@ if ( CUR.callTop >= CUR.callSize ) { - CUR.error = TT_Err_Invalid_Reference; + CUR.error = FT_THROW( Invalid_Reference ); goto LErrorLabel_; } @@ -8721,7 +8871,7 @@ } } - CUR.error = TT_Err_Invalid_Opcode; + CUR.error = FT_THROW( Invalid_Opcode ); goto LErrorLabel_; #if 0 @@ -8747,14 +8897,14 @@ /* increment instruction counter and check if we didn't */ /* run this program for too long (e.g. infinite loops). */ if ( ++ins_counter > MAX_RUNNABLE_OPCODES ) - return TT_Err_Execution_Too_Long; + return FT_THROW( Execution_Too_Long ); LSuiteLabel_: if ( CUR.IP >= CUR.codeSize ) { if ( CUR.callTop > 0 ) { - CUR.error = TT_Err_Code_Overflow; + CUR.error = FT_THROW( Code_Overflow ); goto LErrorLabel_; } else @@ -8768,10 +8918,10 @@ *exc = cur; #endif - return TT_Err_Ok; + return FT_Err_Ok; LErrorCodeOverflow_: - CUR.error = TT_Err_Code_Overflow; + CUR.error = FT_THROW( Code_Overflow ); LErrorLabel_: diff --git a/freetype/src/truetype/ttinterp.h b/freetype/src/truetype/ttinterp.h index f4336121b..69f5011ed 100644 --- a/freetype/src/truetype/ttinterp.h +++ b/freetype/src/truetype/ttinterp.h @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (specification). */ /* */ -/* Copyright 1996-2007, 2010, 2012 by */ +/* Copyright 1996-2007, 2010, 2012-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -115,14 +115,14 @@ FT_BEGIN_HEADER /* various fonts. "", 0, "", NULL value indicates to match any value. */ /* */ -#define MAX_NAME_SIZE 32 -#define MAX_CLASS_MEMBERS 100 +#define SPH_MAX_NAME_SIZE 32 +#define SPH_MAX_CLASS_MEMBERS 100 typedef struct SPH_TweakRule_ { - const char family[MAX_NAME_SIZE]; + const char family[SPH_MAX_NAME_SIZE]; const FT_UInt ppem; - const char style[MAX_NAME_SIZE]; + const char style[SPH_MAX_NAME_SIZE]; const FT_ULong glyph; } SPH_TweakRule; @@ -130,21 +130,21 @@ FT_BEGIN_HEADER typedef struct SPH_ScaleRule_ { - const char family[MAX_NAME_SIZE]; + const char family[SPH_MAX_NAME_SIZE]; const FT_UInt ppem; - const char style[MAX_NAME_SIZE]; + const char style[SPH_MAX_NAME_SIZE]; const FT_ULong glyph; const FT_ULong scale; } SPH_ScaleRule; - typedef struct Font_Class_ + typedef struct SPH_Font_Class_ { - const char name[MAX_NAME_SIZE]; - const char member[MAX_CLASS_MEMBERS][MAX_NAME_SIZE]; + const char name[SPH_MAX_NAME_SIZE]; + const char member[SPH_MAX_CLASS_MEMBERS][SPH_MAX_NAME_SIZE]; - } Font_Class; + } SPH_Font_Class; #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ @@ -269,10 +269,6 @@ FT_BEGIN_HEADER FT_Bool ignore_x_mode; /* Standard rendering mode for */ /* subpixel hinting. On if gray */ /* or subpixel hinting is on ) */ - FT_Bool compatibility_mode;/* Additional exceptions to */ - /* native TT rules for legacy */ - /* fonts. Implies */ - /* ignore_x_mode. */ /* The following 4 aren't fully implemented but here for MS rasterizer */ /* compatibility. */ @@ -282,12 +278,16 @@ FT_BEGIN_HEADER FT_Bool subpixel_positioned; /* subpixel positioned */ /* (DirectWrite ClearType)? */ - FT_Int rasterizer_version; /* MS rasterizer version */ + FT_Int rasterizer_version; /* MS rasterizer version */ - FT_Bool iup_called; /* IUP called for glyph? */ + FT_Bool iup_called; /* IUP called for glyph? */ + + FT_ULong sph_tweak_flags; /* flags to control */ + /* hint tweaks */ + + FT_ULong sph_in_func_flags; /* flags to indicate if in */ + /* special functions */ - FT_ULong sph_tweak_flags; /* flags to control */ - /* hint tweaks */ #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ } TT_ExecContextRec; @@ -296,7 +296,7 @@ FT_BEGIN_HEADER extern const TT_GraphicsState tt_default_graphics_state; -#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER +#ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( FT_Error ) TT_Goto_CodeRange( TT_ExecContext exec, FT_Int range, @@ -319,7 +319,7 @@ FT_BEGIN_HEADER FT_Long multiplier, void* _pbuff, FT_ULong new_max ); -#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ +#endif /* TT_USE_BYTECODE_INTERPRETER */ /*************************************************************************/ @@ -345,7 +345,7 @@ FT_BEGIN_HEADER TT_New_Context( TT_Driver driver ); -#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER +#ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( FT_Error ) TT_Done_Context( TT_ExecContext exec ); @@ -361,7 +361,7 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) TT_Run_Context( TT_ExecContext exec, FT_Bool debug ); -#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ +#endif /* TT_USE_BYTECODE_INTERPRETER */ /*************************************************************************/ diff --git a/freetype/src/truetype/ttobjs.c b/freetype/src/truetype/ttobjs.c index c61b218c2..7897efa77 100644 --- a/freetype/src/truetype/ttobjs.c +++ b/freetype/src/truetype/ttobjs.c @@ -4,7 +4,7 @@ /* */ /* Objects manager (body). */ /* */ -/* Copyright 1996-2012 */ +/* Copyright 1996-2013 */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,6 +21,7 @@ #include FT_INTERNAL_STREAM_H #include FT_TRUETYPE_TAGS_H #include FT_INTERNAL_SFNT_H +#include FT_TRUETYPE_DRIVER_H #include "ttgload.h" #include "ttpload.h" @@ -521,7 +522,7 @@ if ( !sfnt ) { FT_ERROR(( "tt_face_init: cannot access `sfnt' module\n" )); - error = TT_Err_Missing_Module; + error = FT_THROW( Missing_Module ); goto Exit; } @@ -551,7 +552,7 @@ /* If we are performing a simple font format check, exit immediately. */ if ( face_index < 0 ) - return TT_Err_Ok; + return FT_Err_Ok; /* Load font directory */ error = sfnt->load_face( stream, face, face_index, num_params, params ); @@ -651,7 +652,7 @@ return error; Bad_Format: - error = TT_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -752,7 +753,7 @@ exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context; if ( !exec ) - return TT_Err_Could_Not_Find_Context; + return FT_THROW( Could_Not_Find_Context ); TT_Load_Context( exec, face, size ); @@ -805,7 +806,7 @@ } } else - error = TT_Err_Ok; + error = FT_Err_Ok; if ( !error ) TT_Save_Context( exec, size ); @@ -846,7 +847,7 @@ exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context; if ( !exec ) - return TT_Err_Could_Not_Find_Context; + return FT_THROW( Could_Not_Find_Context ); TT_Load_Context( exec, face, size ); @@ -876,7 +877,27 @@ } } else - error = TT_Err_Ok; + error = FT_Err_Ok; + + /* UNDOCUMENTED! The MS rasterizer doesn't allow the following */ + /* graphics state variables to be modified by the CVT program. */ + + exec->GS.dualVector.x = 0x4000; + exec->GS.dualVector.y = 0; + exec->GS.projVector.x = 0x4000; + exec->GS.projVector.y = 0x0; + exec->GS.freeVector.x = 0x4000; + exec->GS.freeVector.y = 0x0; + + exec->GS.rp0 = 0; + exec->GS.rp1 = 0; + exec->GS.rp2 = 0; + + exec->GS.gep0 = 1; + exec->GS.gep1 = 1; + exec->GS.gep2 = 1; + + exec->GS.loop = 1; /* save as default graphics state */ size->GS = exec->GS; @@ -1023,7 +1044,7 @@ tt_size_ready_bytecode( TT_Size size, FT_Bool pedantic ) { - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; if ( !size->bytecode_ready ) @@ -1090,7 +1111,7 @@ tt_size_init( FT_Size ttsize ) /* TT_Size */ { TT_Size size = (TT_Size)ttsize; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; #ifdef TT_USE_BYTECODE_INTERPRETER size->bytecode_ready = 0; @@ -1146,7 +1167,7 @@ tt_size_reset( TT_Size size ) { TT_Face face; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Size_Metrics* metrics; @@ -1160,7 +1181,7 @@ *metrics = size->root.metrics; if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 ) - return TT_Err_Invalid_PPem; + return FT_THROW( Invalid_PPem ); /* This bit flag, if set, indicates that the ppems must be */ /* rounded to integers. Nearly all TrueType fonts have this bit */ @@ -1237,15 +1258,21 @@ if ( !TT_New_Context( driver ) ) - return TT_Err_Could_Not_Find_Context; + return FT_THROW( Could_Not_Find_Context ); +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + driver->interpreter_version = TT_INTERPRETER_VERSION_38; #else + driver->interpreter_version = TT_INTERPRETER_VERSION_35; +#endif + +#else /* !TT_USE_BYTECODE_INTERPRETER */ FT_UNUSED( ttdriver ); -#endif +#endif /* !TT_USE_BYTECODE_INTERPRETER */ - return TT_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/truetype/ttobjs.h b/freetype/src/truetype/ttobjs.h index 5c3cb067e..a11dd3752 100644 --- a/freetype/src/truetype/ttobjs.h +++ b/freetype/src/truetype/ttobjs.h @@ -4,7 +4,7 @@ /* */ /* Objects manager (specification). */ /* */ -/* Copyright 1996-2009, 2011-2012 by */ +/* Copyright 1996-2009, 2011-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -173,12 +173,13 @@ FT_BEGIN_HEADER /* */ typedef struct TT_DefRecord_ { - FT_Int range; /* in which code range is it located? */ - FT_Long start; /* where does it start? */ - FT_Long end; /* where does it end? */ - FT_UInt opc; /* function #, or instruction code */ - FT_Bool active; /* is it active? */ - FT_Bool inline_delta; /* is function that defines inline delta? */ + FT_Int range; /* in which code range is it located? */ + FT_Long start; /* where does it start? */ + FT_Long end; /* where does it end? */ + FT_UInt opc; /* function #, or instruction code */ + FT_Bool active; /* is it active? */ + FT_Bool inline_delta; /* is function that defines inline delta? */ + FT_ULong sph_fdef_flags; /* flags to identify special functions */ } TT_DefRecord, *TT_DefArray; @@ -334,7 +335,6 @@ FT_BEGIN_HEADER FT_Bool bytecode_ready; FT_Bool cvt_ready; - FT_Bool ttfautohinted; #endif /* TT_USE_BYTECODE_INTERPRETER */ @@ -347,11 +347,12 @@ FT_BEGIN_HEADER /* */ typedef struct TT_DriverRec_ { - FT_DriverRec root; + FT_DriverRec root; + TT_ExecContext context; /* execution context */ TT_GlyphZoneRec zone; /* glyph loader points zone */ - void* extension_component; + FT_UInt interpreter_version; } TT_DriverRec; diff --git a/freetype/src/truetype/ttpic.c b/freetype/src/truetype/ttpic.c index faece4e81..edefae72c 100644 --- a/freetype/src/truetype/ttpic.c +++ b/freetype/src/truetype/ttpic.c @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009, 2010, 2012 by */ +/* Copyright 2009, 2010, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,21 +22,19 @@ #include "ttpic.h" #include "tterrors.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ttdriver.c */ FT_Error FT_Create_Class_tt_services( FT_Library library, FT_ServiceDescRec** output_class ); - void FT_Destroy_Class_tt_services( FT_Library library, FT_ServiceDescRec* clazz ); - void FT_Init_Class_tt_service_gx_multi_masters( FT_Service_MultiMastersRec* sv_mm ); - void FT_Init_Class_tt_service_truetype_glyf( FT_Service_TTGlyfRec* sv_ttglyf ); @@ -67,13 +65,13 @@ tt_driver_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = TT_Err_Ok; + FT_Error error = FT_Err_Ok; TTModulePIC* container = NULL; FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->truetype = container; @@ -91,7 +89,7 @@ FT_Init_Class_tt_service_truetype_glyf( &container->tt_service_truetype_glyf ); -Exit: + Exit: if ( error ) tt_driver_class_pic_free( library ); return error; diff --git a/freetype/src/truetype/ttpic.h b/freetype/src/truetype/ttpic.h index 625c9f169..cfb4ee628 100644 --- a/freetype/src/truetype/ttpic.h +++ b/freetype/src/truetype/ttpic.h @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009, 2012 by */ +/* Copyright 2009, 2012, 2013 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,21 +27,24 @@ FT_BEGIN_HEADER #define TT_SERVICES_GET tt_services #define TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters #define TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf +#define TT_SERVICE_PROPERTIES_GET tt_service_properties #else /* FT_CONFIG_OPTION_PIC */ #include FT_MULTIPLE_MASTERS_H #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_TRUETYPE_GLYF_H +#include FT_SERVICE_PROPERTIES_H typedef struct TTModulePIC_ { - FT_ServiceDescRec* tt_services; + FT_ServiceDescRec* tt_services; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Service_MultiMastersRec tt_service_gx_multi_masters; + FT_Service_MultiMastersRec tt_service_gx_multi_masters; #endif - FT_Service_TTGlyfRec tt_service_truetype_glyf; + FT_Service_TTGlyfRec tt_service_truetype_glyf; + FT_Service_PropertiesRec tt_service_properties; } TTModulePIC; @@ -54,6 +57,8 @@ FT_BEGIN_HEADER ( GET_PIC( library )->tt_service_gx_multi_masters ) #define TT_SERVICE_TRUETYPE_GLYF_GET \ ( GET_PIC( library )->tt_service_truetype_glyf ) +#define TT_SERVICE_PROPERTIES_GET \ + ( GET_PIC( library )->tt_service_properties ) /* see ttpic.c for the implementation */ @@ -67,6 +72,7 @@ FT_BEGIN_HEADER /* */ + FT_END_HEADER #endif /* __TTPIC_H__ */ diff --git a/freetype/src/truetype/ttpload.c b/freetype/src/truetype/ttpload.c index bb6005d45..9723a515b 100644 --- a/freetype/src/truetype/ttpload.c +++ b/freetype/src/truetype/ttpload.c @@ -4,7 +4,7 @@ /* */ /* TrueType-specific tables loader (body). */ /* */ -/* Copyright 1996-2002, 2004-2012 by */ +/* Copyright 1996-2002, 2004-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -72,7 +72,7 @@ /* it is possible that a font doesn't have a glyf table at all */ /* or its size is zero */ - if ( error == TT_Err_Table_Missing ) + if ( FT_ERR_EQ( error, Table_Missing ) ) face->glyf_len = 0; else if ( error ) goto Exit; @@ -81,7 +81,7 @@ error = face->goto_table( face, TTAG_loca, stream, &table_len ); if ( error ) { - error = TT_Err_Locations_Missing; + error = FT_THROW( Locations_Missing ); goto Exit; } @@ -92,7 +92,7 @@ if ( table_len >= 0x40000L ) { FT_TRACE2(( "table too large\n" )); - error = TT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } face->num_locations = table_len >> shift; @@ -104,7 +104,7 @@ if ( table_len >= 0x20000L ) { FT_TRACE2(( "table too large\n" )); - error = TT_Err_Invalid_Table; + error = FT_THROW( Invalid_Table ); goto Exit; } face->num_locations = table_len >> shift; @@ -296,7 +296,7 @@ face->cvt_size = 0; face->cvt = NULL; - error = TT_Err_Ok; + error = FT_Err_Ok; goto Exit; } @@ -334,7 +334,7 @@ FT_UNUSED( face ); FT_UNUSED( stream ); - return TT_Err_Ok; + return FT_Err_Ok; #endif } @@ -375,7 +375,7 @@ { face->font_program = NULL; face->font_program_size = 0; - error = TT_Err_Ok; + error = FT_Err_Ok; FT_TRACE2(( "is missing\n" )); } @@ -396,7 +396,7 @@ FT_UNUSED( face ); FT_UNUSED( stream ); - return TT_Err_Ok; + return FT_Err_Ok; #endif } @@ -436,7 +436,7 @@ { face->cvt_program = NULL; face->cvt_program_size = 0; - error = TT_Err_Ok; + error = FT_Err_Ok; FT_TRACE2(( "is missing\n" )); } @@ -457,7 +457,7 @@ FT_UNUSED( face ); FT_UNUSED( stream ); - return TT_Err_Ok; + return FT_Err_Ok; #endif } @@ -495,7 +495,7 @@ /* this table is optional */ error = face->goto_table( face, TTAG_hdmx, stream, &table_size ); if ( error || table_size < 8 ) - return TT_Err_Ok; + return FT_Err_Ok; if ( FT_FRAME_EXTRACT( table_size, face->hdmx_table ) ) goto Exit; @@ -525,7 +525,7 @@ if ( version != 0 || num_records > 255 || record_size > 0x10001L ) { - error = TT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } diff --git a/freetype/src/truetype/ttsubpix.c b/freetype/src/truetype/ttsubpix.c index d09d3d89d..28470ad65 100644 --- a/freetype/src/truetype/ttsubpix.c +++ b/freetype/src/truetype/ttsubpix.c @@ -4,7 +4,7 @@ /* */ /* TrueType Subpixel Hinting. */ /* */ -/* Copyright 2010-2012 by */ +/* Copyright 2010-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,12 +22,728 @@ #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_TAGS_H #include FT_OUTLINE_H +#include FT_TRUETYPE_DRIVER_H #include "ttsubpix.h" #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /*************************************************************************/ + /* */ + /* These rules affect how the TT Interpreter does hinting, with the */ + /* goal of doing subpixel hinting by (in general) ignoring x moves. */ + /* Some of these rules are fixes that go above and beyond the */ + /* stated techniques in the MS whitepaper on Cleartype, due to */ + /* artifacts in many glyphs. So, these rules make some glyphs render */ + /* better than they do in the MS rasterizer. */ + /* */ + /* "" string or 0 int/char indicates to apply to all glyphs. */ + /* "-" used as dummy placeholders, but any non-matching string works. */ + /* */ + /* Some of this could arguably be implemented in fontconfig, however: */ + /* */ + /* - Fontconfig can't set things on a glyph-by-glyph basis. */ + /* - The tweaks that happen here are very low-level, from an average */ + /* user's point of view and are best implemented in the hinter. */ + /* */ + /* The goal is to make the subpixel hinting techniques as generalized */ + /* as possible across all fonts to prevent the need for extra rules such */ + /* as these. */ + /* */ + /* The rule structure is designed so that entirely new rules can easily */ + /* be added when a new compatibility feature is discovered. */ + /* */ + /* The rule structures could also use some enhancement to handle ranges. */ + /* */ + /* ****************** WORK IN PROGRESS ******************* */ + /* */ + + /* These are `classes' of fonts that can be grouped together and used in */ + /* rules below. A blank entry "" is required at the end of these! */ +#define FAMILY_CLASS_RULES_SIZE 7 + + static const SPH_Font_Class FAMILY_CLASS_Rules + [FAMILY_CLASS_RULES_SIZE] = + { + { "MS Legacy Fonts", + { "Aharoni", + "Andale Mono", + "Andalus", + "Angsana New", + "AngsanaUPC", + "Arabic Transparent", + "Arial Black", + "Arial Narrow", + "Arial Unicode MS", + "Arial", + "Batang", + "Browallia New", + "BrowalliaUPC", + "Comic Sans MS", + "Cordia New", + "CordiaUPC", + "Courier New", + "DFKai-SB", + "David Transparent", + "David", + "DilleniaUPC", + "Estrangelo Edessa", + "EucrosiaUPC", + "FangSong_GB2312", + "Fixed Miriam Transparent", + "FrankRuehl", + "Franklin Gothic Medium", + "FreesiaUPC", + "Garamond", + "Gautami", + "Georgia", + "Gulim", + "Impact", + "IrisUPC", + "JasmineUPC", + "KaiTi_GB2312", + "KodchiangUPC", + "Latha", + "Levenim MT", + "LilyUPC", + "Lucida Console", + "Lucida Sans Unicode", + "MS Gothic", + "MS Mincho", + "MV Boli", + "Mangal", + "Marlett", + "Microsoft Sans Serif", + "Mingliu", + "Miriam Fixed", + "Miriam Transparent", + "Miriam", + "Narkisim", + "Palatino Linotype", + "Raavi", + "Rod Transparent", + "Rod", + "Shruti", + "SimHei", + "Simplified Arabic Fixed", + "Simplified Arabic", + "Simsun", + "Sylfaen", + "Symbol", + "Tahoma", + "Times New Roman", + "Traditional Arabic", + "Trebuchet MS", + "Tunga", + "Verdana", + "Webdings", + "Wingdings", + "", + }, + }, + { "Core MS Legacy Fonts", + { "Arial Black", + "Arial Narrow", + "Arial Unicode MS", + "Arial", + "Comic Sans MS", + "Courier New", + "Garamond", + "Georgia", + "Impact", + "Lucida Console", + "Lucida Sans Unicode", + "Microsoft Sans Serif", + "Palatino Linotype", + "Tahoma", + "Times New Roman", + "Trebuchet MS", + "Verdana", + "", + }, + }, + { "Apple Legacy Fonts", + { "Geneva", + "Times", + "Monaco", + "Century", + "Chalkboard", + "Lobster", + "Century Gothic", + "Optima", + "Lucida Grande", + "Gill Sans", + "Baskerville", + "Helvetica", + "Helvetica Neue", + "", + }, + }, + { "Legacy Sans Fonts", + { "Andale Mono", + "Arial Unicode MS", + "Arial", + "Century Gothic", + "Comic Sans MS", + "Franklin Gothic Medium", + "Geneva", + "Lucida Console", + "Lucida Grande", + "Lucida Sans Unicode", + "Lucida Sans Typewriter", + "Microsoft Sans Serif", + "Monaco", + "Tahoma", + "Trebuchet MS", + "Verdana", + "", + }, + }, + + { "Misc Legacy Fonts", + { "Dark Courier", "", }, }, + { "Verdana Clones", + { "DejaVu Sans", + "Bitstream Vera Sans", "", }, }, + { "Verdana and Clones", + { "DejaVu Sans", + "Bitstream Vera Sans", + "Verdana", "", }, }, + }; + + + /* Define this to force natural (i.e. not bitmap-compatible) widths. */ + /* The default leans strongly towards natural widths except for a few */ + /* legacy fonts where a selective combination produces nicer results. */ +/* #define FORCE_NATURAL_WIDTHS */ + + + /* Define `classes' of styles that can be grouped together and used in */ + /* rules below. A blank entry "" is required at the end of these! */ +#define STYLE_CLASS_RULES_SIZE 5 + + const SPH_Font_Class STYLE_CLASS_Rules + [STYLE_CLASS_RULES_SIZE] = + { + { "Regular Class", + { "Regular", + "Book", + "Medium", + "Roman", + "Normal", + "", + }, + }, + { "Regular/Italic Class", + { "Regular", + "Book", + "Medium", + "Italic", + "Oblique", + "Roman", + "Normal", + "", + }, + }, + { "Bold/BoldItalic Class", + { "Bold", + "Bold Italic", + "Black", + "", + }, + }, + { "Bold/Italic/BoldItalic Class", + { "Bold", + "Bold Italic", + "Black", + "Italic", + "Oblique", + "", + }, + }, + { "Regular/Bold Class", + { "Regular", + "Book", + "Medium", + "Normal", + "Roman", + "Bold", + "Black", + "", + }, + }, + }; + + + /* Force special legacy fixes for fonts. */ +#define COMPATIBILITY_MODE_RULES_SIZE 1 + + const SPH_TweakRule COMPATIBILITY_MODE_Rules + [COMPATIBILITY_MODE_RULES_SIZE] = + { + { "-", 0, "", 0 }, + }; + + + /* Don't do subpixel (ignore_x_mode) hinting; do normal hinting. */ +#define PIXEL_HINTING_RULES_SIZE 2 + + const SPH_TweakRule PIXEL_HINTING_Rules + [PIXEL_HINTING_RULES_SIZE] = + { + /* these characters are almost always safe */ + { "Courier New", 12, "Italic", 'z' }, + { "Courier New", 11, "Italic", 'z' }, + }; + + + /* Subpixel hinting ignores SHPIX rules on X. Force SHPIX for these. */ +#define DO_SHPIX_RULES_SIZE 1 + + const SPH_TweakRule DO_SHPIX_Rules + [DO_SHPIX_RULES_SIZE] = + { + { "-", 0, "", 0 }, + }; + + + /* Skip Y moves that start with a point that is not on a Y pixel */ + /* boundary and don't move that point to a Y pixel boundary. */ +#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE 4 + + const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules + [SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] = + { + /* fix vwxyz thinness*/ + { "Consolas", 0, "", 0 }, + /* Fix thin middle stems */ + { "Core MS Legacy Fonts", 0, "Regular", 0 }, + /* Cyrillic small letter I */ + { "Legacy Sans Fonts", 0, "", 0 }, + /* Fix artifacts with some Regular & Bold */ + { "Verdana Clones", 0, "", 0 }, + }; + + +#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1 + + const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions + [SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] = + { + /* Fixes < and > */ + { "Courier New", 0, "Regular", 0 }, + }; + + + /* Skip Y moves that start with a point that is not on a Y pixel */ + /* boundary and don't move that point to a Y pixel boundary. */ +#define SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE 2 + + const SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_DELTAP_Rules + [SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE] = + { + /* Maintain thickness of diagonal in 'N' */ + { "Times New Roman", 0, "Regular/Bold Class", 'N' }, + { "Georgia", 0, "Regular/Bold Class", 'N' }, + }; + + + /* Skip Y moves that move a point off a Y pixel boundary. */ +#define SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE 1 + + const SPH_TweakRule SKIP_OFFPIXEL_Y_MOVES_Rules + [SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE] = + { + { "-", 0, "", 0 }, + }; + + +#define SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1 + + const SPH_TweakRule SKIP_OFFPIXEL_Y_MOVES_Rules_Exceptions + [SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] = + { + { "-", 0, "", 0 }, + }; + + + /* Round moves that don't move a point to a Y pixel boundary. */ +#define ROUND_NONPIXEL_Y_MOVES_RULES_SIZE 2 + + const SPH_TweakRule ROUND_NONPIXEL_Y_MOVES_Rules + [ROUND_NONPIXEL_Y_MOVES_RULES_SIZE] = + { + /* Droid font instructions don't snap Y to pixels */ + { "Droid Sans", 0, "Regular/Italic Class", 0 }, + { "Droid Sans Mono", 0, "", 0 }, + }; + + +#define ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1 + + const SPH_TweakRule ROUND_NONPIXEL_Y_MOVES_Rules_Exceptions + [ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] = + { + { "-", 0, "", 0 }, + }; + + + /* Allow a Direct_Move along X freedom vector if matched. */ +#define ALLOW_X_DMOVE_RULES_SIZE 1 + + const SPH_TweakRule ALLOW_X_DMOVE_Rules + [ALLOW_X_DMOVE_RULES_SIZE] = + { + /* Fixes vanishing diagonal in 4 */ + { "Verdana", 0, "Regular", '4' }, + }; + + + /* Return MS rasterizer version 35 if matched. */ +#define RASTERIZER_35_RULES_SIZE 8 + + const SPH_TweakRule RASTERIZER_35_Rules + [RASTERIZER_35_RULES_SIZE] = + { + /* This seems to be the only way to make these look good */ + { "Times New Roman", 0, "Regular", 'i' }, + { "Times New Roman", 0, "Regular", 'j' }, + { "Times New Roman", 0, "Regular", 'm' }, + { "Times New Roman", 0, "Regular", 'r' }, + { "Times New Roman", 0, "Regular", 'a' }, + { "Times New Roman", 0, "Regular", 'n' }, + { "Times New Roman", 0, "Regular", 'p' }, + { "Times", 0, "", 0 }, + }; + + + /* Don't round to the subpixel grid. Round to pixel grid. */ +#define NORMAL_ROUND_RULES_SIZE 1 + + const SPH_TweakRule NORMAL_ROUND_Rules + [NORMAL_ROUND_RULES_SIZE] = + { + /* Fix serif thickness for certain ppems */ + /* Can probably be generalized somehow */ + { "Courier New", 0, "", 0 }, + }; + + + /* Skip IUP instructions if matched. */ +#define SKIP_IUP_RULES_SIZE 1 + + const SPH_TweakRule SKIP_IUP_Rules + [SKIP_IUP_RULES_SIZE] = + { + { "Arial", 13, "Regular", 'a' }, + }; + + + /* Skip MIAP Twilight hack if matched. */ +#define MIAP_HACK_RULES_SIZE 1 + + const SPH_TweakRule MIAP_HACK_Rules + [MIAP_HACK_RULES_SIZE] = + { + { "Geneva", 12, "", 0 }, + }; + + + /* Skip DELTAP instructions if matched. */ +#define ALWAYS_SKIP_DELTAP_RULES_SIZE 23 + + const SPH_TweakRule ALWAYS_SKIP_DELTAP_Rules + [ALWAYS_SKIP_DELTAP_RULES_SIZE] = + { + { "Georgia", 0, "Regular", 'k' }, + /* fix various problems with e in different versions */ + { "Trebuchet MS", 14, "Regular", 'e' }, + { "Trebuchet MS", 13, "Regular", 'e' }, + { "Trebuchet MS", 15, "Regular", 'e' }, + { "Trebuchet MS", 0, "Italic", 'v' }, + { "Trebuchet MS", 0, "Italic", 'w' }, + { "Trebuchet MS", 0, "Regular", 'Y' }, + { "Arial", 11, "Regular", 's' }, + /* prevent problems with '3' and others */ + { "Verdana", 10, "Regular", 0 }, + { "Verdana", 9, "Regular", 0 }, + /* Cyrillic small letter short I */ + { "Legacy Sans Fonts", 0, "", 0x438 }, + { "Legacy Sans Fonts", 0, "", 0x439 }, + { "Arial", 10, "Regular", '6' }, + { "Arial", 0, "Bold/BoldItalic Class", 'a' }, + /* Make horizontal stems consistent with the rest */ + { "Arial", 24, "Bold", 'a' }, + { "Arial", 25, "Bold", 'a' }, + { "Arial", 24, "Bold", 's' }, + { "Arial", 25, "Bold", 's' }, + { "Arial", 34, "Bold", 's' }, + { "Arial", 35, "Bold", 's' }, + { "Arial", 36, "Bold", 's' }, + { "Arial", 25, "Regular", 's' }, + { "Arial", 26, "Regular", 's' }, + }; + + + /* Always do DELTAP instructions if matched. */ +#define ALWAYS_DO_DELTAP_RULES_SIZE 1 + + const SPH_TweakRule ALWAYS_DO_DELTAP_Rules + [ALWAYS_DO_DELTAP_RULES_SIZE] = + { + { "-", 0, "", 0 }, + }; + + + /* Don't allow ALIGNRP after IUP. */ +#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE 1 + + static const SPH_TweakRule NO_ALIGNRP_AFTER_IUP_Rules + [NO_ALIGNRP_AFTER_IUP_RULES_SIZE] = + { + /* Prevent creation of dents in outline */ + { "-", 0, "", 0 }, + }; + + + /* Don't allow DELTAP after IUP. */ +#define NO_DELTAP_AFTER_IUP_RULES_SIZE 1 + + static const SPH_TweakRule NO_DELTAP_AFTER_IUP_Rules + [NO_DELTAP_AFTER_IUP_RULES_SIZE] = + { + { "-", 0, "", 0 }, + }; + + + /* Don't allow CALL after IUP. */ +#define NO_CALL_AFTER_IUP_RULES_SIZE 1 + + static const SPH_TweakRule NO_CALL_AFTER_IUP_Rules + [NO_CALL_AFTER_IUP_RULES_SIZE] = + { + /* Prevent creation of dents in outline */ + { "-", 0, "", 0 }, + }; + + + /* De-embolden these glyphs slightly. */ +#define DEEMBOLDEN_RULES_SIZE 9 + + static const SPH_TweakRule DEEMBOLDEN_Rules + [DEEMBOLDEN_RULES_SIZE] = + { + { "Courier New", 0, "Bold", 'A' }, + { "Courier New", 0, "Bold", 'W' }, + { "Courier New", 0, "Bold", 'w' }, + { "Courier New", 0, "Bold", 'M' }, + { "Courier New", 0, "Bold", 'X' }, + { "Courier New", 0, "Bold", 'K' }, + { "Courier New", 0, "Bold", 'x' }, + { "Courier New", 0, "Bold", 'z' }, + { "Courier New", 0, "Bold", 'v' }, + }; + + + /* Embolden these glyphs slightly. */ +#define EMBOLDEN_RULES_SIZE 2 + + static const SPH_TweakRule EMBOLDEN_Rules + [EMBOLDEN_RULES_SIZE] = + { + { "Courier New", 0, "Regular", 0 }, + { "Courier New", 0, "Italic", 0 }, + }; + + + /* This is a CVT hack that makes thick horizontal stems on 2, 5, 7 */ + /* similar to Windows XP. */ +#define TIMES_NEW_ROMAN_HACK_RULES_SIZE 12 + + static const SPH_TweakRule TIMES_NEW_ROMAN_HACK_Rules + [TIMES_NEW_ROMAN_HACK_RULES_SIZE] = + { + { "Times New Roman", 16, "Italic", '2' }, + { "Times New Roman", 16, "Italic", '5' }, + { "Times New Roman", 16, "Italic", '7' }, + { "Times New Roman", 16, "Regular", '2' }, + { "Times New Roman", 16, "Regular", '5' }, + { "Times New Roman", 16, "Regular", '7' }, + { "Times New Roman", 17, "Italic", '2' }, + { "Times New Roman", 17, "Italic", '5' }, + { "Times New Roman", 17, "Italic", '7' }, + { "Times New Roman", 17, "Regular", '2' }, + { "Times New Roman", 17, "Regular", '5' }, + { "Times New Roman", 17, "Regular", '7' }, + }; + + + /* This fudges distance on 2 to get rid of the vanishing stem issue. */ + /* A real solution to this is certainly welcome. */ +#define COURIER_NEW_2_HACK_RULES_SIZE 15 + + static const SPH_TweakRule COURIER_NEW_2_HACK_Rules + [COURIER_NEW_2_HACK_RULES_SIZE] = + { + { "Courier New", 10, "Regular", '2' }, + { "Courier New", 11, "Regular", '2' }, + { "Courier New", 12, "Regular", '2' }, + { "Courier New", 13, "Regular", '2' }, + { "Courier New", 14, "Regular", '2' }, + { "Courier New", 15, "Regular", '2' }, + { "Courier New", 16, "Regular", '2' }, + { "Courier New", 17, "Regular", '2' }, + { "Courier New", 18, "Regular", '2' }, + { "Courier New", 19, "Regular", '2' }, + { "Courier New", 20, "Regular", '2' }, + { "Courier New", 21, "Regular", '2' }, + { "Courier New", 22, "Regular", '2' }, + { "Courier New", 23, "Regular", '2' }, + { "Courier New", 24, "Regular", '2' }, + }; + + +#ifndef FORCE_NATURAL_WIDTHS + + /* Use compatible widths with these glyphs. Compatible widths is always */ + /* on when doing B/W TrueType instructing, but is used selectively here, */ + /* typically on glyphs with 3 or more vertical stems. */ +#define COMPATIBLE_WIDTHS_RULES_SIZE 38 + + static const SPH_TweakRule COMPATIBLE_WIDTHS_Rules + [COMPATIBLE_WIDTHS_RULES_SIZE] = + { + { "Arial Unicode MS", 12, "Regular Class", 'm' }, + { "Arial Unicode MS", 14, "Regular Class", 'm' }, + /* Cyrillic small letter sha */ + { "Arial", 10, "Regular Class", 0x448 }, + { "Arial", 11, "Regular Class", 'm' }, + { "Arial", 12, "Regular Class", 'm' }, + /* Cyrillic small letter sha */ + { "Arial", 12, "Regular Class", 0x448 }, + { "Arial", 13, "Regular Class", 0x448 }, + { "Arial", 14, "Regular Class", 'm' }, + /* Cyrillic small letter sha */ + { "Arial", 14, "Regular Class", 0x448 }, + { "Arial", 15, "Regular Class", 0x448 }, + { "Arial", 17, "Regular Class", 'm' }, + { "DejaVu Sans", 15, "Regular Class", 0 }, + { "Microsoft Sans Serif", 11, "Regular Class", 0 }, + { "Microsoft Sans Serif", 12, "Regular Class", 0 }, + { "Segoe UI", 11, "Regular Class", 0 }, + { "Monaco", 0, "Regular Class", 0 }, + { "Segoe UI", 12, "Regular Class", 'm' }, + { "Segoe UI", 14, "Regular Class", 'm' }, + { "Tahoma", 11, "Regular Class", 0 }, + { "Times New Roman", 16, "Regular Class", 'c' }, + { "Times New Roman", 16, "Regular Class", 'm' }, + { "Times New Roman", 16, "Regular Class", 'o' }, + { "Times New Roman", 16, "Regular Class", 'w' }, + { "Trebuchet MS", 11, "Regular Class", 0 }, + { "Trebuchet MS", 12, "Regular Class", 0 }, + { "Trebuchet MS", 14, "Regular Class", 0 }, + { "Trebuchet MS", 15, "Regular Class", 0 }, + { "Ubuntu", 12, "Regular Class", 'm' }, + /* Cyrillic small letter sha */ + { "Verdana", 10, "Regular Class", 0x448 }, + { "Verdana", 11, "Regular Class", 0x448 }, + { "Verdana and Clones", 12, "Regular Class", 'i' }, + { "Verdana and Clones", 12, "Regular Class", 'j' }, + { "Verdana and Clones", 12, "Regular Class", 'l' }, + { "Verdana and Clones", 12, "Regular Class", 'm' }, + { "Verdana and Clones", 13, "Regular Class", 'i' }, + { "Verdana and Clones", 13, "Regular Class", 'j' }, + { "Verdana and Clones", 13, "Regular Class", 'l' }, + { "Verdana and Clones", 14, "Regular Class", 'm' }, + }; + + + /* Scaling slightly in the x-direction prior to hinting results in */ + /* more visually pleasing glyphs in certain cases. */ + /* This sometimes needs to be coordinated with compatible width rules. */ + /* A value of 1000 corresponds to a scaled value of 1.0. */ + +#define X_SCALING_RULES_SIZE 50 + + static const SPH_ScaleRule X_SCALING_Rules[X_SCALING_RULES_SIZE] = + { + { "DejaVu Sans", 12, "Regular Class", 'm', 950 }, + { "Verdana and Clones", 12, "Regular Class", 'a', 1100 }, + { "Verdana and Clones", 13, "Regular Class", 'a', 1050 }, + { "Arial", 11, "Regular Class", 'm', 975 }, + { "Arial", 12, "Regular Class", 'm', 1050 }, + /* Cyrillic small letter el */ + { "Arial", 13, "Regular Class", 0x43B, 950 }, + { "Arial", 13, "Regular Class", 'o', 950 }, + { "Arial", 13, "Regular Class", 'e', 950 }, + { "Arial", 14, "Regular Class", 'm', 950 }, + /* Cyrillic small letter el */ + { "Arial", 15, "Regular Class", 0x43B, 925 }, + { "Bitstream Vera Sans", 10, "Regular/Italic Class", 0, 1100 }, + { "Bitstream Vera Sans", 12, "Regular/Italic Class", 0, 1050 }, + { "Bitstream Vera Sans", 16, "Regular Class", 0, 1050 }, + { "Bitstream Vera Sans", 9, "Regular/Italic Class", 0, 1050 }, + { "DejaVu Sans", 12, "Regular Class", 'l', 975 }, + { "DejaVu Sans", 12, "Regular Class", 'i', 975 }, + { "DejaVu Sans", 12, "Regular Class", 'j', 975 }, + { "DejaVu Sans", 13, "Regular Class", 'l', 950 }, + { "DejaVu Sans", 13, "Regular Class", 'i', 950 }, + { "DejaVu Sans", 13, "Regular Class", 'j', 950 }, + { "DejaVu Sans", 10, "Regular/Italic Class", 0, 1100 }, + { "DejaVu Sans", 12, "Regular/Italic Class", 0, 1050 }, + { "Georgia", 10, "", 0, 1050 }, + { "Georgia", 11, "", 0, 1100 }, + { "Georgia", 12, "", 0, 1025 }, + { "Georgia", 13, "", 0, 1050 }, + { "Georgia", 16, "", 0, 1050 }, + { "Georgia", 17, "", 0, 1030 }, + { "Liberation Sans", 12, "Regular Class", 'm', 1100 }, + { "Lucida Grande", 11, "Regular Class", 'm', 1100 }, + { "Microsoft Sans Serif", 11, "Regular Class", 'm', 950 }, + { "Microsoft Sans Serif", 12, "Regular Class", 'm', 1050 }, + { "Segoe UI", 12, "Regular Class", 'H', 1050 }, + { "Segoe UI", 12, "Regular Class", 'm', 1050 }, + { "Segoe UI", 14, "Regular Class", 'm', 1050 }, + { "Tahoma", 11, "Regular Class", 'i', 975 }, + { "Tahoma", 11, "Regular Class", 'l', 975 }, + { "Tahoma", 11, "Regular Class", 'j', 900 }, + { "Tahoma", 11, "Regular Class", 'm', 918 }, + { "Verdana", 10, "Regular/Italic Class", 0, 1100 }, + { "Verdana", 12, "Regular Class", 'm', 975 }, + { "Verdana", 12, "Regular/Italic Class", 0, 1050 }, + { "Verdana", 13, "Regular/Italic Class", 'i', 950 }, + { "Verdana", 13, "Regular/Italic Class", 'j', 950 }, + { "Verdana", 13, "Regular/Italic Class", 'l', 950 }, + { "Verdana", 16, "Regular Class", 0, 1050 }, + { "Verdana", 9, "Regular/Italic Class", 0, 1050 }, + { "Times New Roman", 16, "Regular Class", 'm', 918 }, + { "Trebuchet MS", 11, "Regular Class", 'm', 800 }, + { "Trebuchet MS", 12, "Regular Class", 'm', 800 }, + }; + +#else + +#define COMPATIBLE_WIDTHS_RULES_SIZE 1 + + static const SPH_TweakRule COMPATIBLE_WIDTHS_Rules + [COMPATIBLE_WIDTHS_RULES_SIZE] = + { + { "-", 0, "", 0 }, + }; + + +#define X_SCALING_RULES_SIZE 1 + + static const SPH_ScaleRule X_SCALING_Rules + [X_SCALING_RULES_SIZE] = + { + { "-", 0, "", 0, 1000 }, + }; + +#endif /* FORCE_NATURAL_WIDTHS */ + + FT_LOCAL_DEF( FT_Bool ) is_member_of_family_class( const FT_String* detected_font_name, const FT_String* rule_font_name ) @@ -48,7 +764,7 @@ { if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) { - for ( j = 0; j < MAX_CLASS_MEMBERS; j++ ) + for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { if ( strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) continue; @@ -83,7 +799,7 @@ { if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) { - for ( j = 0; j < MAX_CLASS_MEMBERS; j++ ) + for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { if ( strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) continue; @@ -99,13 +815,13 @@ FT_LOCAL_DEF( FT_Bool ) - sph_test_tweak( TT_Face face, - FT_String* family, - FT_UInt ppem, - FT_String* style, - FT_UInt glyph_index, - SPH_TweakRule* rule, - FT_UInt num_rules ) + sph_test_tweak( TT_Face face, + const FT_String* family, + FT_UInt ppem, + const FT_String* style, + FT_UInt glyph_index, + const SPH_TweakRule* rule, + FT_UInt num_rules ) { FT_UInt i; @@ -129,14 +845,14 @@ } - FT_LOCAL_DEF( FT_UInt ) - scale_test_tweak( TT_Face face, - FT_String* family, - FT_UInt ppem, - FT_String* style, - FT_UInt glyph_index, - SPH_ScaleRule* rule, - FT_UInt num_rules ) + static FT_UInt + scale_test_tweak( TT_Face face, + const FT_String* family, + FT_UInt ppem, + const FT_String* style, + FT_UInt glyph_index, + const SPH_ScaleRule* rule, + FT_UInt num_rules ) { FT_UInt i; @@ -160,6 +876,18 @@ } + FT_LOCAL_DEF( FT_UInt ) + sph_test_tweak_x_scaling( TT_Face face, + const FT_String* family, + FT_UInt ppem, + const FT_String* style, + FT_UInt glyph_index ) + { + return scale_test_tweak( face, family, ppem, style, glyph_index, + X_SCALING_Rules, X_SCALING_RULES_SIZE ); + } + + #define TWEAK_RULES( x ) \ if ( sph_test_tweak( face, family, ppem, style, glyph_index, \ x##_Rules, x##_RULES_SIZE ) ) \ @@ -199,12 +927,9 @@ } TWEAK_RULES( ALLOW_X_DMOVE ); - TWEAK_RULES( ALLOW_X_DMOVEX ); - TWEAK_RULES( ALLOW_X_MOVE_ZP2 ); TWEAK_RULES( ALWAYS_DO_DELTAP ); TWEAK_RULES( ALWAYS_SKIP_DELTAP ); TWEAK_RULES( DEEMBOLDEN ); - TWEAK_RULES( DELTAP_SKIP_EXAGGERATED_VALUES ); TWEAK_RULES( DO_SHPIX ); TWEAK_RULES( EMBOLDEN ); TWEAK_RULES( MIAP_HACK ); @@ -213,13 +938,13 @@ TWEAK_RULES( NO_CALL_AFTER_IUP ); TWEAK_RULES( NO_DELTAP_AFTER_IUP ); TWEAK_RULES( RASTERIZER_35 ); - TWEAK_RULES( SKIP_INLINE_DELTAS ); TWEAK_RULES( SKIP_IUP ); - TWEAK_RULES( MIRP_CVT_ZERO ); TWEAK_RULES( SKIP_OFFPIXEL_Y_MOVES ); TWEAK_RULES_EXCEPTIONS( SKIP_OFFPIXEL_Y_MOVES ); + TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES_DELTAP ); + TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES ); TWEAK_RULES_EXCEPTIONS( SKIP_NONPIXEL_Y_MOVES ); @@ -227,14 +952,34 @@ TWEAK_RULES_EXCEPTIONS( ROUND_NONPIXEL_Y_MOVES ); if ( loader->exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 ) - loader->exec->rasterizer_version = 35; + { + if ( loader->exec->rasterizer_version != TT_INTERPRETER_VERSION_35 ) + { + loader->exec->rasterizer_version = TT_INTERPRETER_VERSION_35; + loader->exec->size->cvt_ready = FALSE; + + tt_size_ready_bytecode( + loader->exec->size, + FT_BOOL( loader->load_flags & FT_LOAD_PEDANTIC ) ); + } + else + loader->exec->rasterizer_version = TT_INTERPRETER_VERSION_35; + } else - loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION; + { + if ( loader->exec->rasterizer_version != + SPH_OPTION_SET_RASTERIZER_VERSION ) + { + loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION; + loader->exec->size->cvt_ready = FALSE; - /* re-execute fpgm always to avoid problems */ - loader->exec->size->cvt_ready = FALSE; - tt_size_ready_bytecode( loader->exec->size, - FT_BOOL( loader->load_flags & FT_LOAD_PEDANTIC ) ); + tt_size_ready_bytecode( + loader->exec->size, + FT_BOOL( loader->load_flags & FT_LOAD_PEDANTIC ) ); + } + else + loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION; + } if ( IS_HINTED( loader->load_flags ) ) { @@ -244,12 +989,8 @@ if ( sph_test_tweak( face, family, ppem, style, glyph_index, COMPATIBILITY_MODE_Rules, COMPATIBILITY_MODE_RULES_SIZE ) ) - { - loader->exec->compatibility_mode |= TRUE; - loader->exec->ignore_x_mode |= TRUE; - } - else - loader->exec->compatibility_mode &= FALSE; + loader->exec->face->sph_compatibility_mode = TRUE; + if ( IS_HINTED( loader->load_flags ) ) { @@ -259,7 +1000,12 @@ } } -#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + /* ANSI C doesn't like empty source files */ + typedef int _tt_subpix_dummy; + +#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ /* END */ diff --git a/freetype/src/truetype/ttsubpix.h b/freetype/src/truetype/ttsubpix.h index 2fbff2681..8a54fc7cc 100644 --- a/freetype/src/truetype/ttsubpix.h +++ b/freetype/src/truetype/ttsubpix.h @@ -4,7 +4,7 @@ /* */ /* TrueType Subpixel Hinting. */ /* */ -/* Copyright 2010-2012 by */ +/* Copyright 2010-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,88 +31,68 @@ FT_BEGIN_HEADER /*************************************************************************/ /* */ + /* ID flags to identify special functions at FDEF and runtime. */ + /* */ + /* */ +#define SPH_FDEF_INLINE_DELTA_1 0x0000001 +#define SPH_FDEF_INLINE_DELTA_2 0x0000002 +#define SPH_FDEF_DIAGONAL_STROKE 0x0000004 +#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008 +#define SPH_FDEF_TTFAUTOHINT_1 0x0000010 +#define SPH_FDEF_SPACING_1 0x0000020 +#define SPH_FDEF_SPACING_2 0x0000040 +#define SPH_FDEF_TYPEMAN_STROKES 0x0000080 +#define SPH_FDEF_TYPEMAN_DIAGENDCTRL 0x0000100 + + + /*************************************************************************/ + /* */ /* Tweak flags that are set for each glyph by the below rules. */ /* */ /* */ #define SPH_TWEAK_ALLOW_X_DMOVE 0x0000001 -#define SPH_TWEAK_ALLOW_X_DMOVEX 0x0000002 -#define SPH_TWEAK_ALLOW_X_MOVE_ZP2 0x0000004 -#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000008 -#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000010 -#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000020 -#define SPH_TWEAK_DEEMBOLDEN 0x0000040 -#define SPH_TWEAK_DELTAP_SKIP_EXAGGERATED_VALUES 0x0000080 -#define SPH_TWEAK_DO_SHPIX 0x0000100 -#define SPH_TWEAK_EMBOLDEN 0x0000200 -#define SPH_TWEAK_MIAP_HACK 0x0000400 -#define SPH_TWEAK_NORMAL_ROUND 0x0000800 -#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0001000 -#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0002000 -#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0004000 -#define SPH_TWEAK_PIXEL_HINTING 0x0008000 -#define SPH_TWEAK_RASTERIZER_35 0x0010000 -#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0020000 -#define SPH_TWEAK_SKIP_INLINE_DELTAS 0x0040000 -#define SPH_TWEAK_SKIP_IUP 0x0080000 -#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0100000 -#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0200000 -#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0400000 -#define SPH_TWEAK_MIRP_CVT_ZERO 0x0800000 +#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000002 +#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000004 +#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000008 +#define SPH_TWEAK_DEEMBOLDEN 0x0000010 +#define SPH_TWEAK_DO_SHPIX 0x0000020 +#define SPH_TWEAK_EMBOLDEN 0x0000040 +#define SPH_TWEAK_MIAP_HACK 0x0000080 +#define SPH_TWEAK_NORMAL_ROUND 0x0000100 +#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0000200 +#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0000400 +#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0000800 +#define SPH_TWEAK_PIXEL_HINTING 0x0001000 +#define SPH_TWEAK_RASTERIZER_35 0x0002000 +#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0004000 +#define SPH_TWEAK_SKIP_IUP 0x0008000 +#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0010000 +#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0020000 +#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0040000 +#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP 0x0080000 FT_LOCAL( FT_Bool ) - sph_test_tweak( TT_Face face, - FT_String* family, - FT_UInt ppem, - FT_String* style, - FT_UInt glyph_index, - SPH_TweakRule* rule, - FT_UInt num_rules ); - - FT_LOCAL_DEF( FT_UInt ) - scale_test_tweak( TT_Face face, - FT_String* family, - FT_UInt ppem, - FT_String* style, - FT_UInt glyph_index, - SPH_ScaleRule* rule, - FT_UInt num_rules ); + sph_test_tweak( TT_Face face, + const FT_String* family, + FT_UInt ppem, + const FT_String* style, + FT_UInt glyph_index, + const SPH_TweakRule* rule, + FT_UInt num_rules ); + + FT_LOCAL( FT_UInt ) + sph_test_tweak_x_scaling( TT_Face face, + const FT_String* family, + FT_UInt ppem, + const FT_String* style, + FT_UInt glyph_index ); FT_LOCAL( void ) sph_set_tweaks( TT_Loader loader, FT_UInt glyph_index ); - /*************************************************************************/ - /* */ - /* These rules affect how the TT Interpreter does hinting, with the */ - /* goal of doing subpixel hinting by (in general) ignoring x moves. */ - /* Some of these rules are fixes that go above and beyond the */ - /* stated techniques in the MS whitepaper on Cleartype, due to */ - /* artifacts in many glyphs. So, these rules make some glyphs render */ - /* better than they do in the MS rasterizer. */ - /* */ - /* "" string or 0 int/char indicates to apply to all glyphs. */ - /* "-" used as dummy placeholders, but any non-matching string works. */ - /* */ - /* Some of this could arguably be implemented in fontconfig, however: */ - /* */ - /* - Fontconfig can't set things on a glyph-by-glyph basis. */ - /* - The tweaks that happen here are very low-level, from an average */ - /* user's point of view and are best implemented in the hinter. */ - /* */ - /* The goal is to make the subpixel hinting techniques as generalized */ - /* as possible across all fonts to prevent the need for extra rules such */ - /* as these. */ - /* */ - /* The rule structure is designed so that entirely new rules can easily */ - /* be added when a new compatibility feature is discovered. */ - /* */ - /* The rule structures could also use some enhancement to handle ranges. */ - /* */ - /* ****************** WORK IN PROGRESS ******************* */ - /* */ - /* These macros are defined absent a method for setting them */ #define SPH_OPTION_BITMAP_WIDTHS FALSE #define SPH_OPTION_SET_SUBPIXEL TRUE @@ -120,784 +100,6 @@ FT_BEGIN_HEADER #define SPH_OPTION_SET_COMPATIBLE_WIDTHS FALSE #define SPH_OPTION_SET_RASTERIZER_VERSION 38 - - /* Define this to force natural (i.e. not bitmap-compatible) widths. */ - /* The default leans strongly towards natural widths except for a few */ - /* legacy fonts where a selective combination produces nicer results. */ -/* #define FORCE_NATURAL_WIDTHS */ - - - /* These are `classes' of fonts that can be grouped together and used in */ - /* rules below. A blank entry "" is required at the end of these! */ -#define FAMILY_CLASS_RULES_SIZE 7 - - Font_Class FAMILY_CLASS_Rules - [FAMILY_CLASS_RULES_SIZE] = - { - { "MS Legacy Fonts", - { "Aharoni", - "Andale Mono", - "Andalus", - "Angsana New", - "AngsanaUPC", - "Arabic Transparent", - "Arial Black", - "Arial Narrow", - "Arial Unicode MS", - "Arial", - "Batang", - "Browallia New", - "BrowalliaUPC", - "Comic Sans MS", - "Cordia New", - "CordiaUPC", - "Courier New", - "DFKai-SB", - "David Transparent", - "David", - "DilleniaUPC", - "Estrangelo Edessa", - "EucrosiaUPC", - "FangSong_GB2312", - "Fixed Miriam Transparent", - "FrankRuehl", - "Franklin Gothic Medium", - "FreesiaUPC", - "Garamond", - "Gautami", - "Georgia", - "Gulim", - "Impact", - "IrisUPC", - "JasmineUPC", - "KaiTi_GB2312", - "KodchiangUPC", - "Latha", - "Levenim MT", - "LilyUPC", - "Lucida Console", - "Lucida Sans Unicode", - "MS Gothic", - "MS Mincho", - "MV Boli", - "Mangal", - "Marlett", - "Microsoft Sans Serif", - "Mingliu", - "Miriam Fixed", - "Miriam Transparent", - "Miriam", - "Narkisim", - "Palatino Linotype", - "Raavi", - "Rod Transparent", - "Rod", - "Shruti", - "SimHei", - "Simplified Arabic Fixed", - "Simplified Arabic", - "Simsun", - "Sylfaen", - "Symbol", - "Tahoma", - "Times New Roman", - "Traditional Arabic", - "Trebuchet MS", - "Tunga", - "Verdana", - "Webdings", - "Wingdings", - "", - }, - }, - { "Core MS Legacy Fonts", - { "Arial Black", - "Arial Narrow", - "Arial Unicode MS", - "Arial", - "Comic Sans MS", - "Courier New", - "Garamond", - "Georgia", - "Impact", - "Lucida Console", - "Lucida Sans Unicode", - "Microsoft Sans Serif", - "Palatino Linotype", - "Tahoma", - "Times New Roman", - "Trebuchet MS", - "Verdana", - "", - }, - }, - { "Apple Legacy Fonts", - { "Geneva", - "Times", - "Monaco", - "Century", - "Chalkboard", - "Lobster", - "Century Gothic", - "Optima", - "Lucida Grande", - "Gill Sans", - "Baskerville", - "Helvetica", - "Helvetica Neue", - "", - }, - }, - { "Legacy Sans Fonts", - { "Andale Mono", - "Arial Unicode MS", - "Arial", - "Century Gothic", - "Comic Sans MS", - "Franklin Gothic Medium", - "Geneva", - "Lucida Console", - "Lucida Grande", - "Lucida Sans Unicode", - "Lucida Sans Typewriter", - "Microsoft Sans Serif", - "Monaco", - "Tahoma", - "Trebuchet MS", - "Verdana", - "", - }, - }, - - { "Misc Legacy Fonts", - { "Dark Courier", "", }, }, - { "Verdana Clones", - { "DejaVu Sans", - "Bitstream Vera Sans", "", }, }, - { "Verdana and Clones", - { "DejaVu Sans", - "Bitstream Vera Sans", - "Verdana", "", }, }, - }; - - - /* Define `classes' of styles that can be grouped together and used in */ - /* rules below. A blank entry "" is required at the end of these! */ -#define STYLE_CLASS_RULES_SIZE 5 - - Font_Class STYLE_CLASS_Rules - [STYLE_CLASS_RULES_SIZE] = - { - { "Regular Class", - { "Regular", - "Book", - "Medium", - "Roman", - "Normal", - "", - }, - }, - { "Regular/Italic Class", - { "Regular", - "Book", - "Medium", - "Italic", - "Oblique", - "Roman", - "Normal", - "", - }, - }, - { "Bold/BoldItalic Class", - { "Bold", - "Bold Italic", - "Black", - "", - }, - }, - { "Bold/Italic/BoldItalic Class", - { "Bold", - "Bold Italic", - "Black", - "Italic", - "Oblique", - "", - }, - }, - { "Regular/Bold Class", - { "Regular", - "Book", - "Medium", - "Normal", - "Roman", - "Bold", - "Black", - "", - }, - }, - }; - - - /* Special fixes for known legacy fonts; */ - /* this is the primary workhorse rule for legacy fonts */ -#define COMPATIBILITY_MODE_RULES_SIZE 4 - - SPH_TweakRule COMPATIBILITY_MODE_Rules - [COMPATIBILITY_MODE_RULES_SIZE] = - { - { "MS Legacy Fonts", 0, "", 0 }, - { "Apple Legacy Fonts", 0, "", 0 }, - { "Misc Legacy Fonts", 0, "", 0 }, - { "Verdana Clones", 0, "", 0 }, - }; - - - /* Don't do subpixel (ignore_x_mode) hinting; do normal hinting. */ -#define PIXEL_HINTING_RULES_SIZE 4 - - SPH_TweakRule PIXEL_HINTING_Rules - [PIXEL_HINTING_RULES_SIZE] = - { - /* these characters are almost always safe */ - { "", 0, "", '<' }, - { "", 0, "", '>' }, - /* fixes the vanishing stem */ - { "Times New Roman", 0, "Bold", 'A' }, - { "Times New Roman", 0, "Bold", 'V' }, - }; - - - /* According to Greg Hitchcock and the MS whitepaper, this should work */ - /* on all legacy MS fonts, but creates artifacts with some. Only using */ - /* where absolutely necessary. */ -#define SKIP_INLINE_DELTAS_RULES_SIZE 1 - - SPH_TweakRule SKIP_INLINE_DELTAS_Rules - [SKIP_INLINE_DELTAS_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* Subpixel hinting ignores SHPIX rules on X. Force SHPIX for these. */ -#define DO_SHPIX_RULES_SIZE 1 - - SPH_TweakRule DO_SHPIX_Rules - [DO_SHPIX_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* Skip Y moves that start with a point that is not on a Y pixel */ - /* boundary and don't move that point to a Y pixel boundary. */ -#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE 10 - - SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules - [SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] = - { - /* fix vwxyz thinness*/ - { "Consolas", 0, "Regular", 0 }, - /* fix tiny gap at top of m */ - { "Arial", 0, "Regular", 'm' }, - /* Fix thin middle stems */ - { "Core MS Legacy Fonts", 0, "Regular/Bold Class", 'N' }, - { "Lucida Grande", 0, "", 'N' }, - { "Lucida Grande", 0, "Bold", 'y' }, - /* Cyrillic small letter I */ - { "Legacy Sans Fonts", 0, "", 0x438 }, - { "Verdana Clones", 0, "",'N' }, - { "Ubuntu", 0, "Regular Class", 'N' }, - /* Fix misshapen x */ - { "Verdana", 0, "Bold", 'x' }, - /* Fix misshapen s */ - { "Tahoma", 0, "", 's' }, - }; - - -#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 6 - - SPH_TweakRule SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions - [SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] = - { - { "Tahoma", 0, "", 'N' }, - { "Comic Sans MS", 0, "", 'N' }, - { "Verdana", 0, "Regular/Bold Class", 'N' }, - { "Verdana", 11, "Bold", 'x' }, - /* Cyrillic small letter I */ - { "Arial", 0, "", 0x438 }, - { "Trebuchet MS", 0, "Bold", 0 }, - }; - - - /* Skip Y moves that move a point off a Y pixel boundary. */ - /* This fixes Tahoma, Trebuchet oddities and some issues with `$'. */ -#define SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE 5 - - SPH_TweakRule SKIP_OFFPIXEL_Y_MOVES_Rules - [SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE] = - { - { "MS Legacy Fonts", 0, "", 0 }, - { "Apple Legacy Fonts", 0, "", 0 }, - { "Misc Legacy Fonts", 0, "", 0 }, - { "Ubuntu", 0, "Regular Class", 0 }, - { "Verdana Clones", 0, "", 0 }, - }; - - -#define SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 1 - - SPH_TweakRule SKIP_OFFPIXEL_Y_MOVES_Rules_Exceptions - [SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* Round moves that don't move a point to a Y pixel boundary. */ -#define ROUND_NONPIXEL_Y_MOVES_RULES_SIZE 3 - - SPH_TweakRule ROUND_NONPIXEL_Y_MOVES_Rules - [ROUND_NONPIXEL_Y_MOVES_RULES_SIZE] = - { - /* Droid font instructions don't snap Y to pixels */ - { "Droid Sans", 0, "Regular/Italic Class", 0 }, - { "Droid Sans Mono", 0, "", 0 }, - { "Ubuntu", 0, "", 0 }, - }; - - -#define ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE 3 - - SPH_TweakRule ROUND_NONPIXEL_Y_MOVES_Rules_Exceptions - [ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] = - { - { "Droid Sans", 12, "Bold", 0 }, - { "Droid Sans", 13, "Bold", 0 }, - { "Droid Sans", 16, "Bold", 0 }, - }; - - - /* Allow a Direct_Move_X along X freedom vector if matched. */ -#define ALLOW_X_DMOVEX_RULES_SIZE 1 - - SPH_TweakRule ALLOW_X_DMOVEX_Rules - [ALLOW_X_DMOVEX_RULES_SIZE] = - { - { "-", 0, "Regular", 0 }, - }; - - - /* Allow a Direct_Move along X freedom vector if matched. */ -#define ALLOW_X_DMOVE_RULES_SIZE 1 - - SPH_TweakRule ALLOW_X_DMOVE_Rules - [ALLOW_X_DMOVE_RULES_SIZE] = - { - /* Fixes vanishing diagonal in 4 */ - { "Verdana", 0, "Regular", '4' }, - }; - - - /* Allow a ZP2 move along freedom vector if matched; */ - /* This is called from SHP, SHPIX, SHC, SHZ. */ -#define ALLOW_X_MOVE_ZP2_RULES_SIZE 1 - - SPH_TweakRule ALLOW_X_MOVE_ZP2_Rules - [ALLOW_X_MOVE_ZP2_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* Return MS rasterizer version 35 if matched. */ -#define RASTERIZER_35_RULES_SIZE 8 - - SPH_TweakRule RASTERIZER_35_Rules - [RASTERIZER_35_RULES_SIZE] = - { - /* This seems to be the only way to make these look good */ - { "Times New Roman", 0, "Regular", 'i' }, - { "Times New Roman", 0, "Regular", 'j' }, - { "Times New Roman", 0, "Regular", 'm' }, - { "Times New Roman", 0, "Regular", 'r' }, - { "Times New Roman", 0, "Regular", 'a' }, - { "Times New Roman", 0, "Regular", 'n' }, - { "Times New Roman", 0, "Regular", 'p' }, - { "Times", 0, "", 0 }, - }; - - - /* Don't round to the subpixel grid. Round to pixel grid. */ -#define NORMAL_ROUND_RULES_SIZE 2 - - SPH_TweakRule NORMAL_ROUND_Rules - [NORMAL_ROUND_RULES_SIZE] = - { - /* Fix point "explosions" */ - { "Courier New", 0, "", 0 }, - { "Verdana", 10, "Regular", '4' }, - }; - - - /* Skip IUP instructions if matched. */ -#define SKIP_IUP_RULES_SIZE 1 - - SPH_TweakRule SKIP_IUP_Rules - [SKIP_IUP_RULES_SIZE] = - { - { "Arial", 13, "Regular", 'a' }, - }; - - - /* Skip MIAP Twilight hack if matched. */ -#define MIAP_HACK_RULES_SIZE 1 - - SPH_TweakRule MIAP_HACK_Rules - [MIAP_HACK_RULES_SIZE] = - { - { "Geneva", 12, "", 0 }, - }; - - - /* Skip DELTAP instructions if matched. */ -#define ALWAYS_SKIP_DELTAP_RULES_SIZE 16 - - SPH_TweakRule ALWAYS_SKIP_DELTAP_Rules - [ALWAYS_SKIP_DELTAP_RULES_SIZE] = - { - { "Georgia", 0, "Regular", 'k' }, - /* fixes problems with W M w */ - { "Trebuchet MS", 0, "Italic", 0 }, - /* fix various problems with e in different versions */ - { "Trebuchet MS", 14, "Regular", 'e' }, - { "Trebuchet MS", 13, "Regular", 'e' }, - { "Trebuchet MS", 15, "Regular", 'e' }, - { "Arial", 11, "Regular", 's' }, - { "Verdana", 10, "Regular", 0 }, - { "Verdana", 9, "Regular", 0 }, - /* Cyrillic small letter short I */ - { "Legacy Sans Fonts", 0, "", 0x438 }, - { "Legacy Sans Fonts", 0, "", 0x439 }, - { "Arial", 10, "Regular", '6' }, - { "Arial", 0, "Bold/BoldItalic Class", 'a' }, - /* Make horizontal stems consistent with the rest */ - { "Arial", 24, "Bold", 's' }, - { "Arial", 25, "Bold", 's' }, - { "Arial", 24, "Bold", 'a' }, - { "Arial", 25, "Bold", 'a' }, - }; - - - /* Always do DELTAP instructions if matched. */ -#define ALWAYS_DO_DELTAP_RULES_SIZE 2 - - SPH_TweakRule ALWAYS_DO_DELTAP_Rules - [ALWAYS_DO_DELTAP_RULES_SIZE] = - { - { "Verdana Clones", 17, "Regular Class", 'K' }, - { "Verdana Clones", 17, "Regular Class", 'k' }, - }; - - - /* Do an extra RTG instruction in DELTAP if matched. */ -#define DELTAP_RTG_RULES_SIZE 1 - - SPH_TweakRule DELTAP_RTG_Rules - [DELTAP_RTG_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* Force CVT distance to zero in MIRP. */ -#define MIRP_CVT_ZERO_RULES_SIZE 1 - - SPH_TweakRule MIRP_CVT_ZERO_Rules - [MIRP_CVT_ZERO_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* Skip moves that meet or exceed 1 pixel. */ -#define DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE 1 - - SPH_TweakRule DELTAP_SKIP_EXAGGERATED_VALUES_Rules - [DELTAP_SKIP_EXAGGERATED_VALUES_RULES_SIZE] = - { - /* Fix vanishing stems */ - { "Ubuntu", 0, "Regular", 'M' }, - }; - - - /* Don't allow ALIGNRP after IUP. */ -#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE 4 - - SPH_TweakRule NO_ALIGNRP_AFTER_IUP_Rules - [NO_ALIGNRP_AFTER_IUP_RULES_SIZE] = - { - /* Prevent creation of dents in outline */ - { "Courier New", 0, "Bold", 'C' }, - { "Courier New", 0, "Bold", 'D' }, - { "Courier New", 0, "Bold", 'Q' }, - { "Courier New", 0, "Bold", '0' }, - }; - - - /* Don't allow DELTAP after IUP. */ -#define NO_DELTAP_AFTER_IUP_RULES_SIZE 2 - - SPH_TweakRule NO_DELTAP_AFTER_IUP_Rules - [NO_DELTAP_AFTER_IUP_RULES_SIZE] = - { - { "Arial", 0, "Bold", 'N' }, - { "Verdana", 0, "Regular", '4' }, - }; - - - /* Don't allow CALL after IUP. */ -#define NO_CALL_AFTER_IUP_RULES_SIZE 4 - - SPH_TweakRule NO_CALL_AFTER_IUP_Rules - [NO_CALL_AFTER_IUP_RULES_SIZE] = - { - /* Prevent creation of dents in outline */ - { "Courier New", 0, "Bold", 'O' }, - { "Courier New", 0, "Bold", 'Q' }, - { "Courier New", 0, "Bold", 'k' }, - { "Courier New", 0, "Bold Italic", 'M' }, - }; - - - /* De-embolden these glyphs slightly. */ -#define DEEMBOLDEN_RULES_SIZE 9 - - SPH_TweakRule DEEMBOLDEN_Rules - [DEEMBOLDEN_RULES_SIZE] = - { - { "Courier New", 0, "Bold", 'A' }, - { "Courier New", 0, "Bold", 'W' }, - { "Courier New", 0, "Bold", 'w' }, - { "Courier New", 0, "Bold", 'M' }, - { "Courier New", 0, "Bold", 'X' }, - { "Courier New", 0, "Bold", 'K' }, - { "Courier New", 0, "Bold", 'x' }, - { "Courier New", 0, "Bold", 'z' }, - { "Courier New", 0, "Bold", 'v' }, - }; - - - /* Embolden these glyphs slightly. */ -#define EMBOLDEN_RULES_SIZE 5 - - SPH_TweakRule EMBOLDEN_Rules - [EMBOLDEN_RULES_SIZE] = - { - { "Courier New", 12, "Italic", 'z' }, - { "Courier New", 11, "Italic", 'z' }, - { "Courier New", 10, "Italic", 'z' }, - { "Courier New", 0, "Regular", 0 }, - { "Courier New", 0, "Italic", 0 }, - }; - - - /* Do an extra RDTG instruction in DELTAP if matched. */ -#define DELTAP_RDTG_RULES_SIZE 1 - - SPH_TweakRule DELTAP_RDTG_Rules - [DELTAP_RDTG_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - - /* This is a CVT hack that makes thick horizontal stems on 2, 5, 7 */ - /* similar to Windows XP. */ -#define TIMES_NEW_ROMAN_HACK_RULES_SIZE 12 - - SPH_TweakRule TIMES_NEW_ROMAN_HACK_Rules - [TIMES_NEW_ROMAN_HACK_RULES_SIZE] = - { - { "Times New Roman", 16, "Italic", '2' }, - { "Times New Roman", 16, "Italic", '5' }, - { "Times New Roman", 16, "Italic", '7' }, - { "Times New Roman", 16, "Regular", '2' }, - { "Times New Roman", 16, "Regular", '5' }, - { "Times New Roman", 16, "Regular", '7' }, - { "Times New Roman", 17, "Italic", '2' }, - { "Times New Roman", 17, "Italic", '5' }, - { "Times New Roman", 17, "Italic", '7' }, - { "Times New Roman", 17, "Regular", '2' }, - { "Times New Roman", 17, "Regular", '5' }, - { "Times New Roman", 17, "Regular", '7' }, - }; - - - /* This fudges distance on 2 to get rid of the vanishing stem issue. */ - /* A real solution to this is certainly welcome. */ -#define COURIER_NEW_2_HACK_RULES_SIZE 15 - - SPH_TweakRule COURIER_NEW_2_HACK_Rules - [COURIER_NEW_2_HACK_RULES_SIZE] = - { - { "Courier New", 10, "Regular", '2' }, - { "Courier New", 11, "Regular", '2' }, - { "Courier New", 12, "Regular", '2' }, - { "Courier New", 13, "Regular", '2' }, - { "Courier New", 14, "Regular", '2' }, - { "Courier New", 15, "Regular", '2' }, - { "Courier New", 16, "Regular", '2' }, - { "Courier New", 17, "Regular", '2' }, - { "Courier New", 18, "Regular", '2' }, - { "Courier New", 19, "Regular", '2' }, - { "Courier New", 20, "Regular", '2' }, - { "Courier New", 21, "Regular", '2' }, - { "Courier New", 22, "Regular", '2' }, - { "Courier New", 23, "Regular", '2' }, - { "Courier New", 24, "Regular", '2' }, - }; - - -#ifndef FORCE_NATURAL_WIDTHS - - /* Use compatible widths with these glyphs. Compatible widths is always */ - /* on when doing B/W TrueType instructing, but is used selectively here, */ - /* typically on glyphs with 3 or more vertical stems. */ -#define COMPATIBLE_WIDTHS_RULES_SIZE 38 - - SPH_TweakRule COMPATIBLE_WIDTHS_Rules - [COMPATIBLE_WIDTHS_RULES_SIZE] = - { - { "Arial Unicode MS", 12, "Regular Class", 'm' }, - { "Arial Unicode MS", 14, "Regular Class", 'm' }, - /* Cyrillic small letter sha */ - { "Arial", 10, "Regular Class", 0x448 }, - { "Arial", 11, "Regular Class", 'm' }, - { "Arial", 12, "Regular Class", 'm' }, - /* Cyrillic small letter sha */ - { "Arial", 12, "Regular Class", 0x448 }, - { "Arial", 13, "Regular Class", 0x448 }, - { "Arial", 14, "Regular Class", 'm' }, - /* Cyrillic small letter sha */ - { "Arial", 14, "Regular Class", 0x448 }, - { "Arial", 15, "Regular Class", 0x448 }, - { "Arial", 17, "Regular Class", 'm' }, - { "DejaVu Sans", 15, "Regular Class", 0 }, - { "Microsoft Sans Serif", 11, "Regular Class", 0 }, - { "Microsoft Sans Serif", 12, "Regular Class", 0 }, - { "Segoe UI", 11, "Regular Class", 0 }, - { "Monaco", 0, "Regular Class", 0 }, - { "Segoe UI", 12, "Regular Class", 'm' }, - { "Segoe UI", 14, "Regular Class", 'm' }, - { "Tahoma", 11, "Regular Class", 0 }, - { "Times New Roman", 16, "Regular Class", 'c' }, - { "Times New Roman", 16, "Regular Class", 'm' }, - { "Times New Roman", 16, "Regular Class", 'o' }, - { "Times New Roman", 16, "Regular Class", 'w' }, - { "Trebuchet MS", 11, "Regular Class", 0 }, - { "Trebuchet MS", 12, "Regular Class", 0 }, - { "Trebuchet MS", 14, "Regular Class", 0 }, - { "Trebuchet MS", 15, "Regular Class", 0 }, - { "Ubuntu", 12, "Regular Class", 'm' }, - /* Cyrillic small letter sha */ - { "Verdana", 10, "Regular Class", 0x448 }, - { "Verdana", 11, "Regular Class", 0x448 }, - { "Verdana and Clones", 12, "Regular Class", 'i' }, - { "Verdana and Clones", 12, "Regular Class", 'j' }, - { "Verdana and Clones", 12, "Regular Class", 'l' }, - { "Verdana and Clones", 12, "Regular Class", 'm' }, - { "Verdana and Clones", 13, "Regular Class", 'i' }, - { "Verdana and Clones", 13, "Regular Class", 'j' }, - { "Verdana and Clones", 13, "Regular Class", 'l' }, - { "Verdana and Clones", 14, "Regular Class", 'm' }, - }; - - - /* Scaling slightly in the x-direction prior to hinting results in */ - /* more visually pleasing glyphs in certain cases. */ - /* This sometimes needs to be coordinated with compatible width rules. */ - /* A value of 1000 corresponds to a scaled value of 1.0. */ -#define X_SCALING_RULES_SIZE 50 - - SPH_ScaleRule X_SCALING_Rules - [X_SCALING_RULES_SIZE] = - { - { "DejaVu Sans", 12, "Regular Class", 'm', 950 }, - { "Verdana and Clones", 12, "Regular Class", 'a', 1100 }, - { "Verdana and Clones", 13, "Regular Class", 'a', 1050 }, - { "Arial", 11, "Regular Class", 'm', 975 }, - { "Arial", 12, "Regular Class", 'm', 1050 }, - /* Cyrillic small letter el */ - { "Arial", 13, "Regular Class", 0x43B, 950 }, - { "Arial", 13, "Regular Class", 'o', 950 }, - { "Arial", 13, "Regular Class", 'e', 950 }, - { "Arial", 14, "Regular Class", 'm', 950 }, - /* Cyrillic small letter el */ - { "Arial", 15, "Regular Class", 0x43B, 925 }, - { "Bitstream Vera Sans", 10, "Regular/Italic Class", 0, 1100 }, - { "Bitstream Vera Sans", 12, "Regular/Italic Class", 0, 1050 }, - { "Bitstream Vera Sans", 16, "Regular Class", 0, 1050 }, - { "Bitstream Vera Sans", 9, "Regular/Italic Class", 0, 1050 }, - { "DejaVu Sans", 12, "Regular Class", 'l', 975 }, - { "DejaVu Sans", 12, "Regular Class", 'i', 975 }, - { "DejaVu Sans", 12, "Regular Class", 'j', 975 }, - { "DejaVu Sans", 13, "Regular Class", 'l', 950 }, - { "DejaVu Sans", 13, "Regular Class", 'i', 950 }, - { "DejaVu Sans", 13, "Regular Class", 'j', 950 }, - { "DejaVu Sans", 10, "Regular/Italic Class", 0, 1100 }, - { "DejaVu Sans", 12, "Regular/Italic Class", 0, 1050 }, - { "Georgia", 10, "", 0, 1050 }, - { "Georgia", 11, "", 0, 1100 }, - { "Georgia", 12, "", 0, 1025 }, - { "Georgia", 13, "", 0, 1050 }, - { "Georgia", 16, "", 0, 1050 }, - { "Georgia", 17, "", 0, 1030 }, - { "Liberation Sans", 12, "Regular Class", 'm', 1100 }, - { "Lucida Grande", 11, "Regular Class", 'm', 1100 }, - { "Microsoft Sans Serif", 11, "Regular Class", 'm', 950 }, - { "Microsoft Sans Serif", 12, "Regular Class", 'm', 1050 }, - { "Segoe UI", 12, "Regular Class", 'H', 1050 }, - { "Segoe UI", 12, "Regular Class", 'm', 1050 }, - { "Segoe UI", 14, "Regular Class", 'm', 1050 }, - { "Tahoma", 11, "Regular Class", 'i', 975 }, - { "Tahoma", 11, "Regular Class", 'l', 975 }, - { "Tahoma", 11, "Regular Class", 'j', 900 }, - { "Tahoma", 11, "Regular Class", 'm', 918 }, - { "Verdana", 10, "Regular/Italic Class", 0, 1100 }, - { "Verdana", 12, "Regular Class", 'm', 975 }, - { "Verdana", 12, "Regular/Italic Class", 0, 1050 }, - { "Verdana", 13, "Regular/Italic Class", 'i', 950 }, - { "Verdana", 13, "Regular/Italic Class", 'j', 950 }, - { "Verdana", 13, "Regular/Italic Class", 'l', 950 }, - { "Verdana", 16, "Regular Class", 0, 1050 }, - { "Verdana", 9, "Regular/Italic Class", 0, 1050 }, - { "Times New Roman", 16, "Regular Class", 'm', 918 }, - { "Trebuchet MS", 11, "Regular Class", 'm', 800 }, - { "Trebuchet MS", 12, "Regular Class", 'm', 800 }, - }; - -#else - -#define COMPATIBLE_WIDTHS_RULES_SIZE 1 - - SPH_TweakRule COMPATIBLE_WIDTHS_Rules - [COMPATIBLE_WIDTHS_RULES_SIZE] = - { - { "-", 0, "", 0 }, - }; - - -#define X_SCALING_RULES_SIZE 1 - - SPH_ScaleRule X_SCALING_Rules - [X_SCALING_RULES_SIZE] = - { - { "-", 0, "", 0, 1000 }, - }; - -#endif /* FORCE_NATURAL_WIDTHS */ - #endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ diff --git a/freetype/src/type1/t1afm.c b/freetype/src/type1/t1afm.c index 1fff15d73..de9c1997c 100644 --- a/freetype/src/type1/t1afm.c +++ b/freetype/src/type1/t1afm.c @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (body). */ /* */ -/* Copyright 1996-2011 by */ +/* Copyright 1996-2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,9 +18,10 @@ #include <ft2build.h> #include "t1afm.h" -#include "t1errors.h" +#include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include "t1errors.h" /*************************************************************************/ @@ -107,7 +108,7 @@ FT_Stream stream, AFM_FontInfo fi ) { - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Memory memory = stream->memory; FT_Byte* start; FT_Byte* limit; @@ -121,14 +122,13 @@ start = (FT_Byte*)stream->cursor; limit = (FT_Byte*)stream->limit; - p = start; /* Figure out how long the width table is. */ /* This info is a little-endian short at offset 99. */ p = start + 99; if ( p + 2 > limit ) { - error = T1_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } width_table_length = FT_PEEK_USHORT_LE( p ); @@ -148,7 +148,7 @@ if ( p + 2 > limit ) { - error = T1_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -156,7 +156,7 @@ p += 2; if ( p + 4 * fi->NumKernPair > limit ) { - error = T1_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -238,7 +238,7 @@ FT_Memory memory = stream->memory; AFM_ParserRec parser; AFM_FontInfo fi = NULL; - FT_Error error = T1_Err_Unknown_File_Format; + FT_Error error = FT_ERR( Unknown_File_Format ); T1_Font t1_font = &( (T1_Face)t1_face )->type1; @@ -269,7 +269,7 @@ } } - if ( error == T1_Err_Unknown_File_Format ) + if ( FT_ERR_EQ( error, Unknown_File_Format ) ) { FT_Byte* start = stream->cursor; @@ -366,7 +366,7 @@ if ( !fi ) - return T1_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); for ( i = 0; i < fi->NumTrackKern; i++ ) { @@ -389,7 +389,7 @@ } } - return T1_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/type1/t1driver.c b/freetype/src/type1/t1driver.c index e35d7b11d..697288d66 100644 --- a/freetype/src/type1/t1driver.c +++ b/freetype/src/type1/t1driver.c @@ -4,7 +4,7 @@ /* */ /* Type 1 driver interface (body). */ /* */ -/* Copyright 1996-2004, 2006, 2007, 2009, 2011 by */ +/* Copyright 1996-2004, 2006, 2007, 2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,7 +61,7 @@ { FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max ); - return T1_Err_Ok; + return FT_Err_Ok; } @@ -69,13 +69,13 @@ t1_get_name_index( T1_Face face, FT_String* glyph_name ) { - FT_Int i; - FT_String* gname; + FT_Int i; for ( i = 0; i < face->type1.num_glyphs; i++ ) { - gname = face->type1.glyph_names[i]; + FT_String* gname = face->type1.glyph_names[i]; + if ( !ft_strcmp( glyph_name, gname ) ) return (FT_UInt)i; @@ -138,7 +138,7 @@ { *afont_info = ((T1_Face)face)->type1.font_info; - return T1_Err_Ok; + return FT_Err_Ok; } @@ -148,7 +148,7 @@ { *afont_extra = ((T1_Face)face)->type1.font_extra; - return T1_Err_Ok; + return FT_Err_Ok; } @@ -167,7 +167,7 @@ { *afont_private = ((T1_Face)face)->type1.private_dict; - return T1_Err_Ok; + return FT_Err_Ok; } @@ -258,7 +258,7 @@ break; case PS_DICT_FONT_NAME: - retval = ft_strlen( type1->font_name ) + 1; + retval = (FT_Long)( ft_strlen( type1->font_name ) + 1 ); if ( value && value_len >= retval ) ft_memcpy( value, (void *)( type1->font_name ), retval ); break; @@ -278,7 +278,7 @@ case PS_DICT_CHAR_STRING_KEY: if ( idx < (FT_UInt)type1->num_glyphs ) { - retval = ft_strlen( type1->glyph_names[idx] ) + 1; + retval = (FT_Long)( ft_strlen( type1->glyph_names[idx] ) + 1 ); if ( value && value_len >= retval ) { ft_memcpy( value, (void *)( type1->glyph_names[idx] ), retval ); @@ -290,7 +290,7 @@ case PS_DICT_CHAR_STRING: if ( idx < (FT_UInt)type1->num_glyphs ) { - retval = type1->charstrings_len[idx] + 1; + retval = (FT_Long)( type1->charstrings_len[idx] + 1 ); if ( value && value_len >= retval ) { ft_memcpy( value, (void *)( type1->charstrings[idx] ), @@ -310,7 +310,7 @@ if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY && idx < (FT_UInt)type1->encoding.num_chars ) { - retval = ft_strlen( type1->encoding.char_name[idx] ) + 1; + retval = (FT_Long)( ft_strlen( type1->encoding.char_name[idx] ) + 1 ); if ( value && value_len >= retval ) { ft_memcpy( value, (void *)( type1->encoding.char_name[idx] ), @@ -329,7 +329,7 @@ case PS_DICT_SUBR: if ( idx < (FT_UInt)type1->num_subrs ) { - retval = type1->subrs_len[idx] + 1; + retval = (FT_Long)( type1->subrs_len[idx] + 1 ); if ( value && value_len >= retval ) { ft_memcpy( value, (void *)( type1->subrs[idx] ), retval - 1 ); @@ -523,31 +523,31 @@ break; case PS_DICT_VERSION: - retval = ft_strlen( type1->font_info.version ) + 1; + retval = (FT_Long)( ft_strlen( type1->font_info.version ) + 1 ); if ( value && value_len >= retval ) ft_memcpy( value, (void *)( type1->font_info.version ), retval ); break; case PS_DICT_NOTICE: - retval = ft_strlen( type1->font_info.notice ) + 1; + retval = (FT_Long)( ft_strlen( type1->font_info.notice ) + 1 ); if ( value && value_len >= retval ) ft_memcpy( value, (void *)( type1->font_info.notice ), retval ); break; case PS_DICT_FULL_NAME: - retval = ft_strlen( type1->font_info.full_name ) + 1; + retval = (FT_Long)( ft_strlen( type1->font_info.full_name ) + 1 ); if ( value && value_len >= retval ) ft_memcpy( value, (void *)( type1->font_info.full_name ), retval ); break; case PS_DICT_FAMILY_NAME: - retval = ft_strlen( type1->font_info.family_name ) + 1; + retval = (FT_Long)( ft_strlen( type1->font_info.family_name ) + 1 ); if ( value && value_len >= retval ) ft_memcpy( value, (void *)( type1->font_info.family_name ), retval ); break; case PS_DICT_WEIGHT: - retval = ft_strlen( type1->font_info.weight ) + 1; + retval = (FT_Long)( ft_strlen( type1->font_info.weight ) + 1 ); if ( value && value_len >= retval ) ft_memcpy( value, (void *)( type1->font_info.weight ), retval ); break; @@ -669,7 +669,7 @@ right_glyph, kerning ); - return T1_Err_Ok; + return FT_Err_Ok; } @@ -708,10 +708,6 @@ T1_GlyphSlot_Init, T1_GlyphSlot_Done, -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - ft_stub_set_char_sizes, - ft_stub_set_pixel_sizes, -#endif T1_Load_Glyph, #ifdef T1_CONFIG_OPTION_NO_AFM diff --git a/freetype/src/type1/t1gload.c b/freetype/src/type1/t1gload.c index 80e545331..23478d128 100644 --- a/freetype/src/type1/t1gload.c +++ b/freetype/src/type1/t1gload.c @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */ +/* Copyright 1996-2006, 2008-2010, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,7 +61,7 @@ { T1_Face face = (T1_Face)decoder->builder.face; T1_Font type1 = &face->type1; - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; #ifdef FT_CONFIG_OPTION_INCREMENTAL FT_Incremental_InterfaceRec *inc = @@ -203,7 +203,7 @@ psaux->t1_decoder_funcs->done( &decoder ); - return T1_Err_Ok; + return FT_Err_Ok; } @@ -227,7 +227,7 @@ for ( nn = 0; nn < count; nn++ ) advances[nn] = 0; - return T1_Err_Ok; + return FT_Err_Ok; } error = psaux->t1_decoder_funcs->init( &decoder, @@ -261,7 +261,7 @@ advances[nn] = 0; } - return T1_Err_Ok; + return FT_Err_Ok; } @@ -296,7 +296,7 @@ if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) #endif /* FT_CONFIG_OPTION_INCREMENTAL */ { - error = T1_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } diff --git a/freetype/src/type1/t1load.c b/freetype/src/type1/t1load.c index cc21b1154..1c834a17b 100644 --- a/freetype/src/type1/t1load.c +++ b/freetype/src/type1/t1load.c @@ -4,7 +4,7 @@ /* */ /* Type 1 font loader (body). */ /* */ -/* Copyright 1996-2012 by */ +/* Copyright 1996-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -72,7 +72,7 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL -#define IS_INCREMENTAL ( face->root.internal->incremental_interface != 0 ) +#define IS_INCREMENTAL (FT_Bool)( face->root.internal->incremental_interface != 0 ) #else #define IS_INCREMENTAL 0 #endif @@ -106,7 +106,7 @@ { PS_Blend blend; FT_Memory memory = face->root.memory; - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; blend = face->blend; @@ -130,8 +130,8 @@ /* allocate the blend `private' and `font_info' dictionaries */ if ( FT_NEW_ARRAY( blend->font_infos[1], num_designs ) || - FT_NEW_ARRAY( blend->privates[1], num_designs ) || - FT_NEW_ARRAY( blend->bboxes[1], num_designs ) || + FT_NEW_ARRAY( blend->privates [1], num_designs ) || + FT_NEW_ARRAY( blend->bboxes [1], num_designs ) || FT_NEW_ARRAY( blend->weight_vector, num_designs * 2 ) ) goto Exit; @@ -143,12 +143,12 @@ for ( nn = 2; nn <= num_designs; nn++ ) { - blend->privates[nn] = blend->privates [nn - 1] + 1; blend->font_infos[nn] = blend->font_infos[nn - 1] + 1; - blend->bboxes[nn] = blend->bboxes [nn - 1] + 1; + blend->privates [nn] = blend->privates [nn - 1] + 1; + blend->bboxes [nn] = blend->bboxes [nn - 1] + 1; } - blend->num_designs = num_designs; + blend->num_designs = num_designs; } else if ( blend->num_designs != num_designs ) goto Fail; @@ -182,7 +182,7 @@ return error; Fail: - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -196,7 +196,7 @@ FT_Error error; - error = T1_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); if ( blend ) { @@ -214,7 +214,7 @@ axis->maximum = map->design_points[map->num_points - 1]; } - error = T1_Err_Ok; + error = FT_Err_Ok; } return error; @@ -320,7 +320,7 @@ mmvar->num_axis = mmaster.num_axis; mmvar->num_designs = mmaster.num_designs; - mmvar->num_namedstyles = ~0; /* Does not apply */ + mmvar->num_namedstyles = ~0U; /* Does not apply */ mmvar->axis = (FT_Var_Axis*)&mmvar[1]; /* Point to axes after MM_Var struct */ mmvar->namedstyle = NULL; @@ -333,8 +333,8 @@ 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 = ~0; /* Does not apply */ - mmvar->axis[i].tag = ~0; /* Does not apply */ + mmvar->axis[i].strid = ~0U; /* Does not apply */ + mmvar->axis[i].tag = ~0U; /* Does not apply */ if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 ) mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' ); @@ -372,12 +372,12 @@ FT_UInt n, m; - error = T1_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( blend && blend->num_axis == num_coords ) { /* recompute the weight vector from the blend coordinates */ - error = T1_Err_Ok; + error = FT_Err_Ok; for ( n = 0; n < blend->num_designs; n++ ) { @@ -391,8 +391,10 @@ /* get current blend axis position */ factor = coords[m]; - if ( factor < 0 ) factor = 0; - if ( factor > 0x10000L ) factor = 0x10000L; + if ( factor < 0 ) + factor = 0; + if ( factor > 0x10000L ) + factor = 0x10000L; if ( ( n & ( 1 << m ) ) == 0 ) factor = 0x10000L - factor; @@ -402,7 +404,7 @@ blend->weight_vector[n] = result; } - error = T1_Err_Ok; + error = FT_Err_Ok; } return error; @@ -419,7 +421,7 @@ FT_UInt n, p; - error = T1_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( blend && blend->num_axis == num_coords ) { /* compute the blend coordinates through the blend design map */ @@ -495,7 +497,7 @@ FT_Error error; - error = T1_Err_Invalid_Argument; + error = FT_ERR( Invalid_Argument ); if ( num_coords <= 4 && num_coords > 0 ) { for ( i = 0; i < num_coords; ++i ) @@ -524,7 +526,7 @@ /* release design pos table */ FT_FREE( blend->design_pos[0] ); for ( n = 1; n < num_designs; n++ ) - blend->design_pos[n] = 0; + blend->design_pos[n] = NULL; /* release blend `private' and `font info' dictionaries */ FT_FREE( blend->privates[1] ); @@ -533,14 +535,14 @@ for ( n = 0; n < num_designs; n++ ) { - blend->privates [n] = 0; - blend->font_infos[n] = 0; - blend->bboxes [n] = 0; + blend->privates [n] = NULL; + blend->font_infos[n] = NULL; + blend->bboxes [n] = NULL; } /* release weight vectors */ FT_FREE( blend->weight_vector ); - blend->default_weight_vector = 0; + blend->default_weight_vector = NULL; /* release axis names */ for ( n = 0; n < num_axis; n++ ) @@ -567,7 +569,7 @@ { T1_TokenRec axis_tokens[T1_MAX_MM_AXIS]; FT_Int n, num_axis; - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; PS_Blend blend; FT_Memory memory; @@ -577,14 +579,14 @@ T1_MAX_MM_AXIS, &num_axis ); if ( num_axis < 0 ) { - error = T1_Err_Ignore; + error = FT_ERR( Ignore ); goto Exit; } if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS ) { FT_ERROR(( "parse_blend_axis_types: incorrect number of axes: %d\n", num_axis )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -611,7 +613,7 @@ len = token->limit - token->start; if ( len == 0 ) { - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -620,7 +622,7 @@ name = (FT_Byte*)blend->axis_names[n]; FT_MEM_COPY( name, token->start, len ); - name[len] = 0; + name[len] = '\0'; } Exit: @@ -637,7 +639,7 @@ FT_Int num_axis; T1_Parser parser = &loader->parser; - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; PS_Blend blend; @@ -646,7 +648,7 @@ T1_MAX_MM_DESIGNS, &num_designs ); if ( num_designs < 0 ) { - error = T1_Err_Ignore; + error = FT_ERR( Ignore ); goto Exit; } if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS ) @@ -654,7 +656,7 @@ FT_ERROR(( "parse_blend_design_positions:" " incorrect number of designs: %d\n", num_designs )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -687,7 +689,7 @@ FT_ERROR(( "parse_blend_design_positions:" " invalid number of axes: %d\n", n_axis )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -700,7 +702,7 @@ else if ( n_axis != num_axis ) { FT_ERROR(( "parse_blend_design_positions: incorrect table\n" )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -729,7 +731,7 @@ parse_blend_design_map( T1_Face face, T1_Loader loader ) { - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; T1_Parser parser = &loader->parser; PS_Blend blend; T1_TokenRec axis_tokens[T1_MAX_MM_AXIS]; @@ -743,14 +745,14 @@ T1_MAX_MM_AXIS, &num_axis ); if ( num_axis < 0 ) { - error = T1_Err_Ignore; + error = FT_ERR( Ignore ); goto Exit; } if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS ) { FT_ERROR(( "parse_blend_design_map: incorrect number of axes: %d\n", num_axis )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -781,7 +783,7 @@ if ( num_points <= 0 || num_points > T1_MAX_MM_MAP_POINTS ) { FT_ERROR(( "parse_blend_design_map: incorrect table\n" )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -821,7 +823,7 @@ { T1_TokenRec design_tokens[T1_MAX_MM_DESIGNS]; FT_Int num_designs; - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; T1_Parser parser = &loader->parser; PS_Blend blend = face->blend; T1_Token token; @@ -834,7 +836,7 @@ T1_MAX_MM_DESIGNS, &num_designs ); if ( num_designs < 0 ) { - error = T1_Err_Ignore; + error = FT_ERR( Ignore ); goto Exit; } if ( num_designs == 0 || num_designs > T1_MAX_MM_DESIGNS ) @@ -842,7 +844,7 @@ FT_ERROR(( "parse_weight_vector:" " incorrect number of designs: %d\n", num_designs )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -859,7 +861,7 @@ " /BlendDesignPosition and /WeightVector have\n" " " " different number of elements\n" )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1020,7 +1022,7 @@ " which is not valid at this point\n" " (probably due to missing keywords)\n", field->ident )); - error = T1_Err_Ok; + error = FT_Err_Ok; } Exit: @@ -1080,7 +1082,7 @@ if( !incremental ) { FT_ERROR(( "read_binary_data: invalid size field\n" )); - parser->root.error = T1_Err_Invalid_File_Format; + parser->root.error = FT_THROW( Invalid_File_Format ); } return 0; @@ -1107,7 +1109,7 @@ if ( result < 0 ) { - parser->root.error = T1_Err_Invalid_File_Format; + parser->root.error = FT_THROW( Invalid_File_Format ); return; } @@ -1116,7 +1118,7 @@ if ( temp_scale == 0 ) { FT_ERROR(( "t1_parse_font_matrix: invalid font matrix\n" )); - parser->root.error = T1_Err_Invalid_File_Format; + parser->root.error = FT_THROW( Invalid_File_Format ); return; } @@ -1164,7 +1166,7 @@ if ( cur >= limit ) { FT_ERROR(( "parse_encoding: out of bounds\n" )); - parser->root.error = T1_Err_Invalid_File_Format; + parser->root.error = FT_THROW( Invalid_File_Format ); return; } @@ -1310,7 +1312,7 @@ /* specification (it might be an encoding for a CID type1 */ /* font, however), so we conclude that this font is NOT a */ /* type1 font. */ - parser->root.error = FT_Err_Unknown_File_Format; + parser->root.error = FT_THROW( Unknown_File_Format ); return; } } @@ -1345,7 +1347,7 @@ face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1; else - parser->root.error = T1_Err_Ignore; + parser->root.error = FT_ERR( Ignore ); } } @@ -1373,7 +1375,7 @@ T1_Skip_Spaces ( parser ); if ( parser->root.cursor >= parser->root.limit || *parser->root.cursor != ']' ) - parser->root.error = T1_Err_Invalid_File_Format; + parser->root.error = FT_THROW( Invalid_File_Format ); return; } @@ -1452,7 +1454,7 @@ /* least contain a `return'), but we support them anyway */ if ( size < face->type1.private_dict.lenIV ) { - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -1508,7 +1510,7 @@ num_glyphs = (FT_Int)T1_ToInt( parser ); if ( num_glyphs < 0 ) { - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -1599,7 +1601,7 @@ if ( cur + 1 >= limit ) { - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -1639,7 +1641,7 @@ if ( size <= face->type1.private_dict.lenIV ) { - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -1843,7 +1845,7 @@ parser->root.cursor = base; parser->root.limit = base + size; - parser->root.error = T1_Err_Ok; + parser->root.error = FT_Err_Ok; limit = parser->root.limit; @@ -1896,7 +1898,7 @@ parser->root.cursor = start_binary; if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) - return T1_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); have_integer = 0; } @@ -1909,7 +1911,7 @@ parser->root.cursor = start_binary; if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) - return T1_Err_Invalid_File_Format; + return FT_THROW( Invalid_File_Format ); have_integer = 0; } @@ -1994,10 +1996,10 @@ parser->root.error = t1_load_keyword( face, loader, keyword ); - if ( parser->root.error != T1_Err_Ok ) + if ( parser->root.error != FT_Err_Ok ) { - if ( FT_ERROR_BASE( parser->root.error ) == FT_Err_Ignore ) - parser->root.error = T1_Err_Ok; + if ( FT_ERR_EQ( parser->root.error, Ignore ) ) + parser->root.error = FT_Err_Ok; else return parser->root.error; } @@ -2188,7 +2190,7 @@ if ( !loader.charstrings.init ) { FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); } loader.charstrings.init = 0; diff --git a/freetype/src/type1/t1objs.c b/freetype/src/type1/t1objs.c index b685f2f1b..837b7911d 100644 --- a/freetype/src/type1/t1objs.c +++ b/freetype/src/type1/t1objs.c @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (body). */ /* */ -/* Copyright 1996-2009, 2011 by */ +/* Copyright 1996-2009, 2011, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -95,7 +95,7 @@ T1_Size_Init( FT_Size t1size ) /* T1_Size */ { T1_Size size = (T1_Size)t1size; - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); @@ -131,7 +131,7 @@ size->root.metrics.y_scale, 0, 0 ); - return T1_Err_Ok; + return FT_Err_Ok; } @@ -326,7 +326,7 @@ if ( !psaux ) { FT_ERROR(( "T1_Face_Init: cannot access `psaux' module\n" )); - error = T1_Err_Missing_Module; + error = FT_THROW( Missing_Module ); goto Exit; } @@ -348,7 +348,7 @@ if ( face_index > 0 ) { FT_ERROR(( "T1_Face_Init: invalid face index\n" )); - error = T1_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -489,7 +489,7 @@ if ( !error ) root->max_advance_width = (FT_Short)FIXED_TO_INT( max_advance ); else - error = T1_Err_Ok; /* clear error */ + error = FT_Err_Ok; /* clear error */ } root->max_advance_height = root->height; @@ -517,7 +517,8 @@ charmap.encoding = FT_ENCODING_UNICODE; error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL ); - if ( error && FT_Err_No_Unicode_Glyph_Name != error ) + if ( error && + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) goto Exit; error = FT_Err_Ok; @@ -590,7 +591,7 @@ { FT_UNUSED( driver ); - return T1_Err_Ok; + return FT_Err_Ok; } diff --git a/freetype/src/type1/t1parse.c b/freetype/src/type1/t1parse.c index b48651a01..106e4e7ec 100644 --- a/freetype/src/type1/t1parse.c +++ b/freetype/src/type1/t1parse.c @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (body). */ /* */ -/* Copyright 1996-2005, 2008, 2009, 2012 by */ +/* Copyright 1996-2005, 2008, 2009, 2012, 2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -119,10 +119,10 @@ if ( !FT_FRAME_ENTER( header_length ) ) { - error = T1_Err_Ok; + error = FT_Err_Ok; if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 ) - error = T1_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); FT_FRAME_EXIT(); } @@ -158,7 +158,7 @@ error = check_type1_format( stream, "%!PS-AdobeFont", 14 ); if ( error ) { - if ( error != T1_Err_Unknown_File_Format ) + if ( FT_ERR_NEQ( error, Unknown_File_Format ) ) goto Exit; error = check_type1_format( stream, "%!FontType", 10 ); @@ -263,7 +263,7 @@ { FT_Stream stream = parser->stream; FT_Memory memory = parser->root.memory; - FT_Error error = T1_Err_Ok; + FT_Error error = FT_Err_Ok; FT_ULong size; @@ -299,7 +299,7 @@ { FT_ERROR(( "T1_Get_Private_Dict:" " invalid private dictionary section\n" )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -313,7 +313,7 @@ error = read_pfb_tag( stream, &tag, &size ); if ( error || tag != 0x8002U ) { - error = T1_Err_Ok; + error = FT_Err_Ok; break; } @@ -355,7 +355,7 @@ { FT_ERROR(( "T1_Get_Private_Dict:" " could not find `eexec' keyword\n" )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } } @@ -414,11 +414,11 @@ { FT_ERROR(( "T1_Get_Private_Dict:" " `eexec' not properly terminated\n" )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } - size = parser->base_len - ( cur - parser->base_dict ); + size = (FT_ULong)( parser->base_len - ( cur - parser->base_dict ) ); if ( parser->in_memory ) { @@ -474,7 +474,7 @@ { FT_ERROR(( "T1_Get_Private_Dict:" " invalid private dictionary section\n" )); - error = T1_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } diff --git a/freetype/src/type42/t42drivr.c b/freetype/src/type42/t42drivr.c index 9b93209ad..3ad1bde79 100644 --- a/freetype/src/type42/t42drivr.c +++ b/freetype/src/type42/t42drivr.c @@ -4,7 +4,8 @@ /* */ /* High-level Type 42 driver interface (body). */ /* */ -/* Copyright 2002-2004, 2006, 2007, 2009, 2011 by Roberto Alameda. */ +/* Copyright 2002-2004, 2006, 2007, 2009, 2011, 2013 by */ +/* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -63,7 +64,7 @@ { FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max ); - return T42_Err_Ok; + return FT_Err_Ok; } @@ -71,13 +72,13 @@ t42_get_name_index( T42_Face face, FT_String* glyph_name ) { - FT_Int i; - FT_String* gname; + FT_Int i; for ( i = 0; i < face->type1.num_glyphs; i++ ) { - gname = face->type1.glyph_names[i]; + FT_String* gname = face->type1.glyph_names[i]; + if ( glyph_name[0] == gname[0] && !ft_strcmp( glyph_name, gname ) ) return (FT_UInt)ft_atol( (const char *)face->type1.charstrings[i] ); @@ -125,7 +126,7 @@ { *afont_info = ((T42_Face)face)->type1.font_info; - return T42_Err_Ok; + return FT_Err_Ok; } @@ -135,7 +136,7 @@ { *afont_extra = ((T42_Face)face)->type1.font_extra; - return T42_Err_Ok; + return FT_Err_Ok; } @@ -154,7 +155,7 @@ { *afont_private = ((T42_Face)face)->type1.private_dict; - return T42_Err_Ok; + return FT_Err_Ok; } @@ -229,10 +230,6 @@ T42_GlyphSlot_Init, T42_GlyphSlot_Done, -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - ft_stub_set_char_sizes, - ft_stub_set_pixel_sizes, -#endif T42_GlyphSlot_Load, 0, /* FT_Face_GetKerningFunc */ diff --git a/freetype/src/type42/t42objs.c b/freetype/src/type42/t42objs.c index c6053afed..18e2c0b62 100644 --- a/freetype/src/type42/t42objs.c +++ b/freetype/src/type42/t42objs.c @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (body). */ /* */ -/* Copyright 2002-2009, 2011 */ +/* Copyright 2002-2009, 2011, 2013 */ /* by Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -63,7 +63,7 @@ { FT_ERROR(( "T42_Open_Face: cannot handle FontType %d\n", type1->font_type )); - error = T42_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -74,7 +74,7 @@ if ( !loader.charstrings.init ) { FT_ERROR(( "T42_Open_Face: no charstrings array in face\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); } loader.charstrings.init = 0; @@ -93,7 +93,6 @@ if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY ) { FT_Int charcode, idx, min_char, max_char; - FT_Byte* char_name; FT_Byte* glyph_name; @@ -109,6 +108,9 @@ charcode = 0; for ( ; charcode < loader.encoding_table.max_elems; charcode++ ) { + FT_Byte* char_name; + + type1->encoding.char_index[charcode] = 0; type1->encoding.char_name [charcode] = (char *)".notdef"; @@ -185,7 +187,7 @@ if ( !psaux ) { FT_ERROR(( "T42_Face_Init: cannot access `psaux' module\n" )); - error = T42_Err_Missing_Module; + error = FT_THROW( Missing_Module ); goto Exit; } @@ -204,7 +206,7 @@ if ( face_index > 0 ) { FT_ERROR(( "T42_Face_Init: invalid face index\n" )); - error = T42_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -347,7 +349,8 @@ charmap.encoding = FT_ENCODING_UNICODE; error = FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL ); - if ( error && FT_Err_No_Unicode_Glyph_Name != error ) + if ( error && + FT_ERR_NEQ( error, No_Unicode_Glyph_Name ) ) goto Exit; error = FT_Err_Ok; @@ -481,12 +484,12 @@ if ( !ttmodule ) { FT_ERROR(( "T42_Driver_Init: cannot access `truetype' module\n" )); - return T42_Err_Missing_Module; + return FT_THROW( Missing_Module ); } driver->ttclazz = (FT_Driver_Class)ttmodule->clazz; - return T42_Err_Ok; + return FT_Err_Ok; } @@ -504,7 +507,7 @@ FT_Face face = size->face; T42_Face t42face = (T42_Face)face; FT_Size ttsize; - FT_Error error = T42_Err_Ok; + FT_Error error = FT_Err_Ok; error = FT_New_Size( t42face->ttf_face, &ttsize ); @@ -580,7 +583,7 @@ FT_Face face = t42slot->face; T42_Face t42face = (T42_Face)face; FT_GlyphSlot ttslot; - FT_Error error = T42_Err_Ok; + FT_Error error = FT_Err_Ok; if ( face->glyph == NULL ) diff --git a/freetype/src/type42/t42parse.c b/freetype/src/type42/t42parse.c index 2b2824030..3cdd8a1ac 100644 --- a/freetype/src/type42/t42parse.c +++ b/freetype/src/type42/t42parse.c @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (body). */ /* */ -/* Copyright 2002-2012 by */ +/* Copyright 2002-2013 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -144,7 +144,7 @@ FT_Memory memory, PSAux_Service psaux ) { - FT_Error error = T42_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Long size; @@ -176,7 +176,7 @@ if ( ft_memcmp( stream->cursor, "%!PS-TrueTypeFont", 17 ) != 0 ) { FT_TRACE2(( " not a Type42 font\n" )); - error = T42_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); } FT_FRAME_EXIT(); @@ -305,7 +305,7 @@ if ( cur >= limit ) { FT_ERROR(( "t42_parse_encoding: out of bounds\n" )); - parser->root.error = T42_Err_Invalid_File_Format; + parser->root.error = FT_THROW( Invalid_File_Format ); return; } @@ -473,7 +473,7 @@ else { FT_ERROR(( "t42_parse_encoding: invalid token\n" )); - parser->root.error = T42_Err_Invalid_File_Format; + parser->root.error = FT_THROW( Invalid_File_Format ); } } } @@ -526,7 +526,7 @@ if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' ) { FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -571,7 +571,7 @@ { FT_ERROR(( "t42_parse_sfnts: " "can't handle mixed binary and hex strings\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -579,7 +579,7 @@ if ( string_size < 0 ) { FT_ERROR(( "t42_parse_sfnts: invalid string size\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -592,7 +592,7 @@ if ( limit - parser->root.cursor < string_size ) { FT_ERROR(( "t42_parse_sfnts: too many binary data\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } else @@ -602,7 +602,7 @@ if ( !string_buf ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -614,7 +614,7 @@ if ( !string_size ) { FT_ERROR(( "t42_parse_sfnts: invalid string\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -679,7 +679,7 @@ if ( count >= ttf_size ) { FT_ERROR(( "t42_parse_sfnts: too many binary data\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } face->ttf_data[count++] = string_buf[n]; @@ -690,7 +690,7 @@ } /* if control reaches this point, the format was not valid */ - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); Fail: parser->root.error = error; @@ -726,7 +726,7 @@ if ( parser->root.cursor >= limit ) { FT_ERROR(( "t42_parse_charstrings: out of bounds\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -768,14 +768,14 @@ else { FT_ERROR(( "t42_parse_charstrings: invalid token\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( parser->root.cursor >= limit ) { FT_ERROR(( "t42_parse_charstrings: out of bounds\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -835,7 +835,7 @@ if ( cur + 1 >= limit ) { FT_ERROR(( "t42_parse_charstrings: out of bounds\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -866,7 +866,7 @@ if ( parser->root.cursor >= limit ) { FT_ERROR(( "t42_parse_charstrings: out of bounds\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -889,7 +889,7 @@ if ( !notdef_found ) { FT_ERROR(( "t42_parse_charstrings: no /.notdef glyph\n" )); - error = T42_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -1033,7 +1033,7 @@ parser->root.cursor = base; parser->root.limit = base + size; - parser->root.error = T42_Err_Ok; + parser->root.error = FT_Err_Ok; limit = parser->root.limit; diff --git a/freetype/src/winfonts/winfnt.c b/freetype/src/winfonts/winfnt.c index a55189664..e8055c089 100644 --- a/freetype/src/winfonts/winfnt.c +++ b/freetype/src/winfonts/winfnt.c @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2004, 2006-2012 by */ +/* Copyright 1996-2004, 2006-2013 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2003 Huw D M Davies for Codeweavers */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ @@ -225,7 +225,7 @@ header->version != 0x300 ) { FT_TRACE2(( " not a Windows FNT file\n" )); - error = FNT_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -235,7 +235,7 @@ if ( header->file_size < size ) { FT_TRACE2(( " not a Windows FNT file\n" )); - error = FNT_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -253,7 +253,7 @@ if ( header->file_type & 1 ) { FT_TRACE2(( "[can't handle vector FNT fonts]\n" )); - error = FNT_Err_Unknown_File_Format; + error = FT_THROW( Unknown_File_Format ); goto Exit; } @@ -284,7 +284,7 @@ FT_STREAM_READ_FIELDS( winmz_header_fields, &mz_header ) ) goto Exit; - error = FNT_Err_Unknown_File_Format; + error = FT_ERR( Unknown_File_Format ); if ( mz_header.magic == WINFNT_MZ_MAGIC ) { /* yes, now look for an NE header in the file */ @@ -297,7 +297,7 @@ FT_STREAM_READ_FIELDS( winne_header_fields, &ne_header ) ) goto Exit; - error = FNT_Err_Unknown_File_Format; + error = FT_ERR( Unknown_File_Format ); if ( ne_header.magic == WINFNT_NE_MAGIC ) { /* good, now look into the resource table for each FNT resource */ @@ -344,7 +344,7 @@ if ( !font_count || !font_offset ) { FT_TRACE2(( "this file doesn't contain any FNT resources\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -353,7 +353,7 @@ if ( font_count * 118UL > stream->size ) { FT_TRACE2(( "invalid number of faces\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -361,7 +361,7 @@ if ( face_index >= font_count ) { - error = FNT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } else if ( face_index < 0 ) @@ -417,7 +417,7 @@ pe32_header.magic32 != 0x10b ) { FT_TRACE2(( "this file has an invalid PE header\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -440,7 +440,7 @@ } FT_TRACE2(( "this file doesn't contain any resources\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; Found_rsrc_section: @@ -462,7 +462,7 @@ if ( !(dir_entry1.offset & 0x80000000UL ) /* DataIsDirectory */ ) { - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -486,7 +486,7 @@ if ( !(dir_entry2.offset & 0x80000000UL ) /* DataIsDirectory */ ) { - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -510,7 +510,7 @@ if ( dir_entry2.offset & 0x80000000UL /* DataIsDirectory */ ) { - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -561,13 +561,13 @@ if ( !face->root.num_faces ) { FT_TRACE2(( "this file doesn't contain any RT_FONT resources\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } if ( face_index >= face->root.num_faces ) { - error = FNT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } } @@ -705,7 +705,7 @@ if ( !error && face_index < 0 ) goto Exit; - if ( error == FNT_Err_Unknown_File_Format ) + if ( FT_ERR_EQ( error, Unknown_File_Format ) ) { /* this didn't work; try to load a single FNT font */ FNT_Font font; @@ -724,7 +724,7 @@ if ( !error ) { if ( face_index > 0 ) - error = FNT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); else if ( face_index < 0 ) goto Exit; } @@ -836,7 +836,7 @@ if ( font->header.last_char < font->header.first_char ) { FT_TRACE2(( "invalid number of glyphs\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } @@ -847,7 +847,7 @@ if ( font->header.face_name_offset >= font->header.file_size ) { FT_TRACE2(( "invalid family name offset\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Fail; } family_size = font->header.file_size - font->header.face_name_offset; @@ -909,7 +909,7 @@ header->ascent ) * 64; size->metrics.max_advance = header->max_width * 64; - return FNT_Err_Ok; + return FT_Err_Ok; } @@ -920,7 +920,7 @@ FNT_Face face = (FNT_Face)size->face; FT_WinFNT_Header header = &face->font->header; FT_Bitmap_Size* bsize = size->face->available_sizes; - FT_Error error = FNT_Err_Invalid_Pixel_Size; + FT_Error error = FT_ERR( Invalid_Pixel_Size ); FT_Long height; @@ -931,16 +931,16 @@ { case FT_SIZE_REQUEST_TYPE_NOMINAL: if ( height == ( ( bsize->y_ppem + 32 ) >> 6 ) ) - error = FNT_Err_Ok; + error = FT_Err_Ok; break; case FT_SIZE_REQUEST_TYPE_REAL_DIM: if ( height == header->pixel_height ) - error = FNT_Err_Ok; + error = FT_Err_Ok; break; default: - error = FNT_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); break; } @@ -959,7 +959,7 @@ { FNT_Face face = (FNT_Face)FT_SIZE_FACE( size ); FNT_Font font; - FT_Error error = FNT_Err_Ok; + FT_Error error = FT_Err_Ok; FT_Byte* p; FT_Int len; FT_Bitmap* bitmap = &slot->bitmap; @@ -971,7 +971,7 @@ if ( !face ) { - error = FNT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -980,7 +980,7 @@ if ( !font || glyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs ) ) { - error = FNT_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1005,7 +1005,7 @@ if ( offset >= font->header.file_size ) { FT_TRACE2(( "invalid FNT offset\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1027,7 +1027,7 @@ if ( offset + pitch * bitmap->rows >= font->header.file_size ) { FT_TRACE2(( "invalid bitmap width\n" )); - error = FNT_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1141,10 +1141,6 @@ 0, /* FT_Slot_InitFunc */ 0, /* FT_Slot_DoneFunc */ -#ifdef FT_CONFIG_OPTION_OLD_INTERNALS - ft_stub_set_char_sizes, - ft_stub_set_pixel_sizes, -#endif FNT_Load_Glyph, 0, /* FT_Face_GetKerningFunc */ diff --git a/packages.txt b/packages.txt index bf49b88c2..714839145 100644 --- a/packages.txt +++ b/packages.txt @@ -44,7 +44,7 @@ font-winitzki-cyrillic-1.0.3 font-xfree86-type1-1.0.4
fontconfig git version
fontsproto-2.1.2
-freetype-2.4.11
+freetype-2.5.0.1
glproto git version
inputproto-2.2.99.1
kbproto-1.0.6
|