Index: autogen.sh =================================================================== --- autogen.sh (revision 58178) +++ autogen.sh (working copy) @@ -118,9 +118,12 @@ # On MacOS X, the GNU libtool is named `glibtool'. HOSTOS=`uname` -LIBTOOLIZE=libtoolize -if test "$HOSTOS"x = Darwinx; then +if test "$LIBTOOLIZE"x != x; then + : +elif test "$HOSTOS"x = Darwinx; then LIBTOOLIZE=glibtoolize +else + LIBTOOLIZE=libtoolize fi if test "$ACLOCAL"x = x; then Index: ChangeLog =================================================================== --- ChangeLog (revision 58178) +++ ChangeLog (working copy) @@ -1,3 +1,3885 @@ +2012-12-20 Werner Lemberg + + * Version 2.4.11 released. + ========================== + + + Tag sources with `VER-2-4-11'. + + * docs/CHANGES, docs/release: Updated. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.4.11. + + * 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.10/2.4.11/, s/2410/2411/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 10. + + * builds/unix/configure.raw (version_info): Set to 16:0:10. + + * builds/toplevel.mk (dist): Don't include `.mailmap'. + +2012-12-20 Alexei Podtelezhnikov + + [base] Improve trigonometric core. + + FreeType used to rely on a 24-step iteration CORDIC algorithm to + calculate trigonometric functions and rotate vectors. It turns out + that once the vector is in the right half-plane, the initial rotation + by 63 degrees is not necessary. The algorithm is perfectly capable + to converge to any angle starting from the second 45 degree rotation. + This patch removes the first rotation and makes it a 23-step CORDIC + algorithm. + + * src/base/fttrigon.c (FT_TRIG_SCALE, FT_TRIG_COSCALE): Update macro + values. + (ft_trig_pseudo_rotate, ft_trig_pseudo_polarize): Remove initial + rotation. + +2012-12-19 Werner Lemberg + + * src/base/ftobjs.c (ft_property_do): Fix compiler warning. + +2012-12-19 Alexei Podtelezhnikov + + * src/base/ftrfork.c (FT_Raccess_Guess): Switch to FT_Int counters. + +2012-12-19 Alexei Podtelezhnikov + + [base] Clean up trigonometric core. + + * src/base/fttrrigon.c (ft_trig_pseudo_polarize): Align algorithm + with `ft_trig_pseudo_rotate'. + +2012-12-18 Infinality + + [truetype] Minor performance enhancement. + + * src/truetype/ttgload.c: (TT_Process_Simple_Glyph): Use FT_MulFix + instead of FT_MulDiv. + +2012-12-17 Infinality + + [truetype] Remove unusued code and variables. + + * src/truetype/ttinterp.c: Updated. + (Ins_FDEF): Remove opcode patterns that are not being used. + +2012-12-16 Werner Lemberg + + Various compiler warning fixes. + + * include/freetype/internal/ftserv.h (FT_SERVICE_UNAVAILABLE): Use + `logical not' operator instead of negation. The idea is that `~' + returns exactly the data type enforced by the cast to a pointer (be + it 32bit or 64bit or whatever), while a negative integer has not + this flexibility. + * src/cache/ftccmap.c (FTC_CMAP_UNKNOWN): Ditto. + * src/truetype/ttgxvar.c (ALL_POINTS, TT_Get_MM_Var): Ditto. + * src/type/t1load.c (T1_Get_MM_Var): Ditto. + (parse_blend_axis_types): Use cast. + * src/bdf/bdflib.c (_bdf_readstream): Use cast. + +2012-12-16 Infinality + + [truetype] Remove unusued code and variables. Add minor fixes. + + * src/truetype/ttsubpix.h: Updated. + (SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions): Add Trebuchet MS. + (ALLOW_X_DMOVEX_Rules): Remove Arial characters. + (ALLOW_X_DMOVE_Rules): Remove Arial characters. + (RASTERIZER_35_Rules): Verdana no longer needs to be here. + (SKIP_IUP_Rules): Formatting fix. + (DELTAP_SKIP_EXAGGERATED_VALUES_Rules): Remove Segoe UI. + (COMPATIBLE_WIDTHS_Rules): Add Monaco and Trebuchet MS. + (X_SCALING_Rules): Add misc. corrective fixes. + + * src/truetype/ttgload.c: (TT_Process_Simple_Glyph): Adjust correction + factor for emboldening during scaling. + + * src/truetype/ttinterp.h: Updated. + (TT_ExecContextRec): Remove unused variables. + + * src/truetype/ttobjs.h: Updated. + (TT_SizeRec): Add ttfautohinted variable. + + * src/truetype/ttinterp.c: Updated. + (Ins_FDEF): Rework code to fix bugs and add more detection. + (Ins_CALL): Remove unused code. + (Ins_LOOPCALL): Remove unused code. + (TT_RunIns): Remove unusued code. + (Ins_SHPIX): Add logic to handle ttfautohinted fonts. + (Ins_MIRP): Don't round x in cut-in calculation. Add logic to handle + ttfautohinted fonts. + +2012-12-16 Werner Lemberg + + [sfnt] Fix Savannah bug #37936. + + * src/sfnt/ttload.c (tt_face_load_gasp): Avoid memory leak. + +2012-12-15 Alexei Podtelezhnikov + + [base] Fix 11-year old bug. + + Since the initial commit (ebe85f59) the value of FT_TRIG_SCALE has + always been slightly less than the correct value, which has been + given in the comment as a hexadecimal. As a result, vector lengths + were underestimated and rotated vectors were shortened. + + * src/base/fttrigon.c (FT_TRIG_SCALE): Fix macro value. + +2012-12-15 Werner Lemberg + + [bdf] Fix Savannah bug #37907. + + * src/bdf/bdflib.c (_bdf_parse_glyphs) : Normalize + negative second parameter of `ENCODING' field also. + +2012-12-15 Werner Lemberg + + [bdf] Fix Savannah bug #37906. + + * src/bdf/bdflib.c (_bdf_parse_glyphs) : Use correct array + size for checking `glyph_enc'. + +2012-12-15 Werner Lemberg + + [bdf] Fix Savannah bug #37905. + + * src/bdf/bdflib.c (_bdf_parse_start) : Reset + `props_size' to zero in case of allocation error; this value gets + used in a loop in `bdf_free_font'. + +2012-12-10 Alexei Podtelezhnikov + + [truetype] Scale F_dot_P down. + + 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 + its use throughout the bytecode interpreter. + + This does not lead to the loss of precision because the lower bits + are unreliable anyway. Consider two unit vectors (1,0) and (.6,.8) + for which the true value of F_dot_P is .6 * 0x40000000 = 0x26666666. + These vectors are stored as (0x4000,0) and (0x2666,0x3333) after + rounding and F_dot_P is assigned 0x26660000. The lower bits were + already lost while rounding the unit vector components. + + 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. + + * src/truetype/ttinterp.c (Compute_Funcs): Scale F_dot_P down by 14 + bits and modify its use accordingly. + (Direct_Move, Direct_Move_Orig, Compute_Point_Displacement): Modify + the use of F_dot_P field. + * src/truetype/ttobjs.c (tt_size_run_fpgm): Change arbitrary + assignment of F_dot_P to its theoretical maximum in case we decide + to scale back its type later. + +2012-12-09 Johnson Y. Yan + + [type1] Another fix for 2012-09-17 commit. + + * src/type1/t1parse.c (T1_Get_Private_Dict) : Correctly set + `limit' value. + +2012-12-06 Alexei Podtelezhnikov + + [truetype] Tweak the previous commit. + + * src/truetype/ttinterp.c (Current_Ratio): Put unit vector + components as the second TT_MulFix14 arguments. This is required + on 16-bit systems. + +2012-12-06 Alexei Podtelezhnikov + + [truetype] Microoptimizations in bytecode interpreter. + + * src/truetype/ttinterp.c (TT_DivFix14): New macro. + (Normalize): Use it here. + (Current_Ratio): Use TT_MulFix14 instead of FT_MulDiv. + (Ins_SHPIX): Cancel out two TT_MulFix14 calls. + +2012-12-05 Alexei Podtelezhnikov + + [truetype] Cosmetic improvement in bytecode interpreter. + + * src/truetype/ttinterp.c: Use explicit calls to FT_MulDiv, + FT_MulFix, and FT_DivFix instead of macros. + +2012-12-03 John Tytgat + + [pshinter] Clamp BlueScale value. + + This is Savannah bug #37856. + + * src/pshinter/pshglob.c (psh_calc_max_height): New function. + (psh_globals_new): Use it to limit BlueScale value to + `1 / max_of_blue_zone_heights'. + +2012-12-01 Alexei Podtelezhnikov + + [truetype, type1] Revise the use of FT_MulDiv. + + * src/truetype/ttgxvar.c: Updated. + * src/truetype/ttobjs.c: Updated. + * src/type1/t1load.c: Updated. + +2012-11-30 Werner Lemberg + + [configure] Preserve customized `ftoption.h'. + + Problem reported by Del Merritt . + + * builds/unix/configure.raw : Don't + remove existing FreeType configuration files. + +2012-11-29 John Tytgat + + [type1] Fix Savannah bug #37831. + + The bug report also contains a patch. + + * src/type1/t1parse.c (T1_Get_Private_Dict) : Really fix + change from 2012-09-17. + +2012-11-28 Alexei Podtelezhnikov + + [truetype] Fix formatting and typo. + +2012-11-27 Alexei Podtelezhnikov + + [cid, type1, type42] Clean up units_per_EM calculations. + + * src/cid/cidload.c (cid_parse_font_matrix): Updated. + * src/type1/t1load.c (t1_parse_font_matrix): Updated. + * src/type42/t42parse.c (t42_parse_font_matrix): Updated. + +2012-11-27 Alexei Podtelezhnikov + + [ftstroke] Minor improvement. + + * src/base/ftstroke.c: Replace nested FT_DivFix and FT_MulFix with + FT_MulDiv. + +2012-11-17 Werner Lemberg + + * src/base/fttrigon.c (ft_trig_downscale): Make 64bit version work. + +2012-11-15 Alexei Podtelezhnikov + + [base] Fix integer overflows in dd5718c7d67a. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Use FT_MulDiv. + +2012-11-15 Werner Lemberg + + [autofit] Trace stem widths. + + * src/autofit/aflatin.c (af_latin_metrics_init_widths): Add some + FT_TRACE calls. + +2012-11-13 Werner Lemberg + + [cff] Add support for OpenType Collections (OTC). + + * src/cff/cffload.c (cff_font_load): Separate subfont and face + index handling to load both pure CFFs with multiple subfonts and + OTCs (with multiple faces where each face holds exactly one + subfont). + * src/cff/cffobjs.c (cff_face_init): Updated. + +2012-11-12 Werner Lemberg + + [autofit] Minor improvement. + + * src/autofit/aflatin.c (af_latin_hints_compute_blue_edges): Fix + loop. + +2012-11-10 Werner Lemberg + + [autofit] Improve tracing. + + * src/autofit/aflatin.c (af_latin_hint_edges) + [FT_DEBUG_LEVEL_TRACE]: Count number of actions and emit something + if there weren't any. + +2012-11-04 Alexei Podtelezhnikov + + [base] Fortify emboldening code against egregious distortions. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Threshold emboldening + strength when it leads to segment collapse. + +2012-11-03 Alexei Podtelezhnikov + + [base] Clean up emboldening code and improve comments there. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Replace sequential + calls to FT_MulFix and FT_DivFix with FT_MulDiv. + Mention that bisectors are used to figure out the shift direction. + +2012-10-24 Werner Lemberg + + [autofit] Add standard character to `AF_ScriptClassRec' structure. + + * src/autofit/aftypes.h (AF_ScriptClassRec): Add `standard_char' + member. + (AF_DEFINE_SCRIPT_CLASS): Updated. + + * src/autofit/aflatin.c (af_latin_metrics_init_widths): Use it. + (af_latin_metrics_init, af_latin_script_class): Updated. + + * src/autofit/aflatin.c (af_latin2_metrics_init_widths): Use it. + (af_latin2_metrics_init, af_latin2_script_class): Updated. + + * src/autofit/afcjk.c (af_cjk_metrics_init_widths): Use it. + (af_cjk_metrics_init, af_cjk_script_class): Updated. + + * src/autofit/afindic.c (af_indic_metrics_init, + af_indic_script_class): Updated. + + * src/autofit/afcjk.h, src/autofit/aflatin.h: Updated. + + * src/autofit/afdummy.c: Updated. + +2012-10-24 Werner Lemberg + + [autofit] Only use Unicode CMap. + + * src/autofit/aflatin.c (af_latin_metrics_init): Implement it, to be + in sync with `af_face_globals_compute_script_coverage'. + +2012-10-21 Werner Lemberg + + [psaux] Improve parsing of invalid numbers. + + * src/psaux/psconv.c (PS_Conv_Strtol): Always parse complete number, + even in case of overflow. + (PS_Conv_ToInt): Only increase cursor if parsing was successful. + (PS_Conv_ToFixed): Ditto. + Trace underflow and data error. + +2012-10-21 Werner Lemberg + + [smooth] Improve tracing. + + * src/smooth/ftgrays.c (gray_sweep): Trace last sweep line of + current band also. + +2012-10-20 Alexei Podtelezhnikov + + [truetype] Cheaper way to threshold angles between vectors. + + * src/truetype/ttinterp.c (Ins_ISECT): Thresholding tangent is a lot + cheaper than thresholding sine. + +2012-10-20 Werner Lemberg + + [cff] Improve parsing of invalid real numbers. + + * src/cff/cffparse.c (cff_parse_real): Always parse complete number, + even in case of overflow or underflow. + Also trace one more underflow. + +2012-10-20 Andreas Pehnack + + [sfnt] Load pure CFF fonts wrapped in SFNT container. + + Such fonts only have a `cmap' and a `CFF' table. + + * src/sfnt/ttload.c (tt_face_load_font_dir): Don't call + `check_table_dir' if font signature is `OTTO'. + +2012-10-20 Werner Lemberg + + [psaux] Fix some value overflows and improve tracing. + + * src/psaux/psconv.c: Include FT_INTERNAL_DEBUG_H. + (FT_COMPONENT): Define. + (PS_Conv_Strtol): Return FT_Long. + Handle bad data and overflow. + Emit some tracing messages in case of error. + (PS_Conv_ToInt): Return FT_Long. + (PS_Conv_ToFixed): Updated. + * src/psaux/psconv.h: Updated. + + * include/freetype/internal/fttrace.h: Add `psconv'. + +2012-10-20 Werner Lemberg + + [autofit] Fix `make multi CC=c++'. + + * src/autofit/aflatin.c, src/autofit/aflatin2.c: Include + `afglobal.h'. + * src/autofit/afloader.c: Fix order of header files. + * src/autofit/afmodule.c: Include `afglobal.h' and `aferrors.h'. + +2012-10-19 Werner Lemberg + + [cff] Fix more value errors and improve tracing. + + * src/cff/cffparse.c (cff_parse_integer): Emit tracing message in + case of error. + (cff_parse_real): Handle and trace overflow, underflow, and bad data + consistently. + (do_fixed): New helper function, handling and tracing overflow. + (cff_parse_fixed, cff_parse_fixed_scaled): Use `do_fixed'. + +2012-10-17 Werner Lemberg + + [psaux] Fix some value overflows. + + * src/psaux/psconv.c (PS_Conv_ToFixed): Implement it. + +2012-10-17 Bram Tassyns + + [cff] Fix value overflow. + + * src/cff/cffparse.c (cff_parse_fixed_scaled): Implement it. + +2012-10-17 Werner Lemberg + + [truetype] Fix Savannah bug #37572. + + * src/truetype/ttinterp.c (Ins_ISECT): Use angle between vectors to + avoid grazing intersections. The previous threshold was too coarse, + incorrectly rejecting short but valid vectors. + +2012-09-30 Gilles Espinasse + + Remove useless `rm' detection. + + `rm -f' is directly used in the `configure' script created by + autoconf, thus no availability test is necessary. + + * builds/unix/configure.raw (RMF): Remove test. + * builds/unix/unix-def.in (DELETE): Updated. + +2012-09-29 Werner Lemberg + + [autofit] Minor optimization. + + * src/autofit/afglobals.c (af_face_globals_compute_script_coverage): + Add loop condition. + +2012-09-29 Werner Lemberg + + [autofit] Fix thinko. + + * src/autofit/aftypes.h (AF_SCRIPT): + s/AF_SCRIPT_NONE/AF_SCRIPT_DUMMY/. We already use `AF_SCRIPT_NONE' + as a bit mask. + + * src/autofit/afdummy.c: Updated. + +2012-09-18 Werner Lemberg + + [autofit] Implement `increase-x-height' property. + + * include/freetype/ftautoh.h (FT_Prop_IncreaseXHeight): New + structure. + + * include/autofit/afmodule.c (af_property_get_face_globals): New + function, re-using code from `af_property_get'. + (af_property_set, af_property_get): Handle `increase-x-height'. + Updated. + +2012-09-18 Werner Lemberg + + [autofit] Implement Infinality's `increase glyph heights'. + + This is an improved version of a similar fix contained in the + so-called `Infinality patch', taken from + + http://www.infinality.net/fedora/linux/zips/freetype-infinality-2.4.10-20120616_01-x86_64.tar.bz2 + + which addresses various enhancements of the auto-hinter. Without + properties to control a module's metadata it wasn't possible to + adapt the patches because everything was originally controlled by + environment variables which I consider not suitable in general. + + A patch to control `increase_x_height' follows. + + * src/autofit/afglobal.h (AF_PROP_INCREASE_X_HEIGHT_MIN, + AF_PROP_INCREASE_X_HEIGHT_MAX): New macros. + (AF_FaceGlobalsRec): Add `increase_x_height' member. + * src/autofit/afglobal.c (af_face_globals_new): Initialize it. + + * src/autofit/aflatin.c (af_latin_metrics_scale_dim), + * src/autofit/aflatin2.c (af_latin2_metrics_scale_dim): Implement + handling of `increase_x_height'. + +2012-09-18 Werner Lemberg + + [autofit] Add hierarchical property access to some structures. + + * src/autofit/afglobal.h: Include `afmodule.h'. + (AF_FaceGlobalsRec): Add `module' member. + (AF_FaceGlobals): Typedef moved to... + * src/autofit/aftypes.h: Here. + (AF_ScriptMetricsRec): Add `globals' member. + + * src/autofit/afglobal.c (af_face_globals_new, + af_face_globals_compute_script_coverage, + af_face_globals_get_metrics): Updated. + + * src/autofit/afloader.c (af_loader_reset), src/autofit/afmodule.c + (af_property_get): Updated. + +2012-09-17 Werner Lemberg + + [type1] Fix Savannah bug #37350. + + * src/type1/t1parse.c (T1_Get_Private_Dict) : Check for ASCII + storage only if we actually have at least four bytes. + +2012-09-15 Werner Lemberg + + [autofit] Implement `fallback-script' property. + + * src/autofit/afglobal.c: s/default_script/fallback_script/. + * src/autofit/afglobal.h: s/AF_SCRIPT_DEFAULT/AF_SCRIPT_FALLBACK/. + + * src/autofit/afmodule.c: s/default_script/fallback_script/. + (af_property_set, af_property_get): Implement `fallback-script'. + * src/autofit/afmodule.h: s/default_script/fallback_script/. + + * include/freetype/ftautoh.h: Document it. + +2012-09-15 Werner Lemberg + + [autofit] Correct previous Unicode 6.1.0 change. + + The auto-hinter's latin module only handles latin ligatures in the + `Alphabetical Presentation Forms' block. + + * src/autofit/aflatin.c (af_latin_uniranges): Fix it. + +2012-09-15 Werner Lemberg + + * src/autofit/afmodule.c: s/FT_Err_/AF_Err_/. + +2012-09-15 Werner Lemberg + + [autofit] Make default script a global property. + + * src/autofit/afmodule.h (AF_ModuleRec): Add `default_script' field. + + * src/autofit/afglobal.c (af_face_globals_compute_script_coverage, + af_face_globals_new), src/autofit/afloader.c (af_loader_reset), + src/autofit/afmodule.c (af_property_get) , + af_autofitter_init: + Handle default script. + + * src/autofit/afglobal.h: Updated. + +2012-09-15 Werner Lemberg + + Use `FT_Module' instead of `FT_Library' argument in property funcs. + + This internal change simplifies access to global module data. + + * include/freetype/internal/services/svprop.h + (FT_Properties_SetFunc, FT_Properties_GetFunc): Change accordingly. + + * src/base/ftobjs.c (ft_property_do), src/autofit/afmodule.c + (af_property_set, af_property_get): Updated. + +2012-09-14 Werner Lemberg + + [autofit] Update to Unicode 6.1.0. + + * src/autofit/afcjk.c (af_cjk_uniranges), src/autofit/aflatin.c + (af_latin_uniranges): Add and fix ranges. + +2012-09-14 Werner Lemberg + + [autofit] Pass `AF_Module' instead of `AF_Loader'. + + We want to access the (not yet existing) module's global data later + on. + + * src/autofit/afloader.c: Include `afmodule.h'. + (af_loader_init, af_loader_reset, af_loader_done, + af_loader_load_glyph): Change accordingly. + * src/autofit/afmodule.c (AF_ModuleRec): Move to `afmodule.h'. + Updated. + + * src/autofit/afmodule.h: Include `afloader.h'. + (AF_ModuleRec): Define here. + * src/autofit/afloader.h (AF_Module): Define here. + Updated. + +2012-09-14 Werner Lemberg + + [autofit] Fix `make multi'. + + * include/freetype/internal/fttrace.h: Add `afmodule'. + * src/autofit/afmodule.c: Include FT_INTERNAL_DEBUG_H. + (FT_COMPONENT): Define. + +2012-09-14 Werner Lemberg + + * src/autofit/afmodule.c: s/FT_Autofitter/AF_Module/. + +2012-09-12 Werner Lemberg + + [autofit] Minor reorganization. + + * src/autofit/afglobal.c (AF_SCRIPT_LIST_DEFAULT, + AF_SCRIPT_LIST_NONE, AF_DIGIT): Move to... + * src/autofit/afglobal.h (AF_SCRIPT_DEFAULT, AF_SCRIPT_LIST_NONE, + AF_DIGIT): This and update code. + +2012-09-01 Werner Lemberg + + [autofit] Implement `glyph-to-script-map' property. + + * include/freetype/ftautoh.h: New public header file. + * include/freetype/config/ftheader.h (FT_AUTOHINTER_H): New macro. + + * src/autofit/afglobal.c (AF_FaceGlobalsRec): Move structure to... + * src/autofit/afglobal.h: This header file. + * src/autofit/afmodule.c: Include FT_AUTOHINTER_H. + (af_property_get): Handle `glyph-to-script-map'. + +2012-08-31 Werner Lemberg + + [autofit] Implement properties service framework. + + No properties are added yet. + + * src/autofit/afmodule.c: Include FT_SERVICE_PROPERTIES_H. + (af_property_set, af_property_get): New dummy functions. + (af_service_properties, af_services, af_get_interface): Provide + service setup. + (autofit_moduleclass): Add service interface. + + * src/autofit/afpic.c: Add necessary forward declarations. + (autofit_module_class_pic_init): Add code for service addition. + (autofit_module_pic_free): Add code for service removal. + * src/autofit/afpic.h (AF_SERVICES_GET, AF_SERVICE_PROPERTIES_GET): + New macros which provide necessary syntactical sugar for PIC + support. + +2012-08-30 Werner Lemberg + + Implement properties to control FreeType modules. + + * include/freetype/fterrdef.h (FT_Err_Missing_Property): New error + code. + * include/freetype/ftmodapi.h (FT_Property_Set, FT_Property_Get): + New API. + + * include/freetype/internal/services/svprop.h: New file. + * include/freetype/internal/ftserv.h (FT_SERVICE_PROPERTIES_H): New + macro. + + * src/base/ftobjs.c: Include FT_SERVICE_PROPERTIES_H. + (ft_property_do, FT_Property_Set, FT_Property_Get): New functions. + +2012-08-29 Werner Lemberg + + [docmaker] Allow `-' in tags and identifiers. + + * src/tools/docmaker/content.py (re_identifier), + src/tools/docmaker/sources.py (re_markup_tag1, re_markup_tag2, + re_crossref): Add `-' in patterns. + +2012-08-27 Werner Lemberg + + [FT_CONFIG_OPTION_PIC] Fix g++ 4.6.2 compiler warnings. + + * include/freetype/internal/ftdriver.h (FT_DEFINE_DRIVER), + include/freetype/internal/ftobjs.h (FT_DEFINE_RENDERER, + FT_DEFINE_MODULE), include/freetype/internal/ftserv.h + (FT_DEFINE_SERVICEDESCREC1, FT_DEFINE_SERVICEDESCREC2, + FT_DEFINE_SERVICEDESCREC3, FT_DEFINE_SERVICEDESCREC4, + FT_DEFINE_SERVICEDESCREC5, FT_DEFINE_SERVICEDESCREC6), + src/autofit/afpic.c (autofit_module_class_pic_init), + src/base/basepic.c (ft_base_pic_init), src/base/ftinit.c + (ft_create_default_module_classes), src/cff/cffparse.c + (FT_Create_Class_cff_field_handlers), src/cff/cffpic.c + (cff_driver_class_pic_init), src/pshinter/pshpic.c + (pshinter_module_class_pic_init), src/psnames/pspic.c + (psnames_module_class_pic_init), src/raster/rastpic.c + (ft_raster1_renderer_class_pic_init), src/sfnt/sfntpic.c + (sfnt_module_class_pic_init), src/sfnt/ttcmap.c + (FT_Create_Class_tt_cmap_classes), src/smooth/ftspic.c + (ft_smooth_renderer_class_pic_init), src/truetype/ttpic.c + (tt_driver_class_pic_init): Initialize allocation variable. + +2012-08-27 Werner Lemberg + + [truetype] Fix compilation warning. + + * src/truetype/ttgload.c (IS_HINTED): Move macro to... + * src/truetype/ttobjs.h: This header file. + +2012-08-27 Werner Lemberg + + [autofit, cff, pshinter, psnames] More renamings for orthogonality. + + * src/autofit/afmodule.c, src/autofit/afpic.h: + s/AF_AUTOFITTER_/AF_/. + + * src/cff/cffdrivr.c, src/cff/cffobjs.c, src/cff/cffparse.c, + src/cff/cffpic.h: s/FT_CFF_/CFF_/. + + * src/pshinter/pshmod.c, src/pshinter/pshpic.h: + s/FT_PSHINTER_/PSHINTER_/. + + * src/psnames/psmodule.c, src/psnames/pspic.h: + s/FT_PSCMAPS/PSCMAPS_/. + +2012-08-27 Werner Lemberg + + [sfnt, truetype] More renamings for orthogonality. + + * src/sfnt/sfdriver.c, src/sfnt/sfntpic.h, src/sfnt/ttcmap.c, + src/truetype/ttdriver.c, src/truetype/ttpic.h: s/FT_SFNT_/SFNT_/, + s/FT_TT_/TT_/, s/GET_CMAP_INFO_GET/CMAP_INFO_GET/. + +2012-08-27 Werner Lemberg + + [autofit] Some macro and variable renamings for orthogonality. + + * include/freetype/internal/autohint.h, src/base/ftobjs.c, + src/autofit/afmodule.c, src/autofit/afpic.c, src/autofit/afpic.h: + s/SERVICE/INTERFACE/, s/service/interface/, s/Service/Interface/. + +2012-08-26 Werner Lemberg + + Fix Savannah bug #37178. + + * src/base/ftobjs.c (FT_Open_Face): Initialize `error' with + `FT_Err_Missing_Module' before loop to indicate `no valid drivers'. + +2012-08-17 Werner Lemberg + + * src/base/ftsynth.c (FT_GlyphSlot_Oblique): Fix shear angle. + + The old value was far too large (more than 20°). The new one + corresponds to 12°, quite common in typography. + +2012-08-12 Alexei Podtelezhnikov + + [smooth] Fix Savannah bug #37017. + + * src/smooth/ftgrays.c (gray_render_cubic): Use a different set of + checks when detecting super curvy splines to be split. + +2012-08-05 Werner Lemberg + + [autofit] Improve recognition of flat segments. + + Problem reported by Brad Dunzer . + + * src/autofit/aflatin.c (af_latin_metrics_init_blues): We have + a flat segment if the horizontal distance of best on-points is + larger than a given threshold. + +2012-08-05 Werner Lemberg + + [autofit] Variable renamings. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues): Replace + `glyph' with `outline'. + s/best_first/best_contour_first/. + s/best_last/best_contour_last/. + +2012-07-31 Werner Lemberg + + [type1] Fix Savannah bug #37000. + + * src/type1/t1load.c (parse_encoding): Fix order of checks. + +2012-07-17 Werner Lemberg + + [psaux] Fix Savannah bug #36833. + + * src/psaux/t1decode.c (t1operator_seac): `seac' is not a valid + operator if we want metrics only. + +2012-07-16 Werner Lemberg + + [type1] Fix Savannah bug #36832. + + * src/type1/t1load.c (parse_charstrings): Reject negative number of + glyphs. + +2012-07-13 Werner Lemberg + + [type1] Fix Savannah bug #36829. + + * src/type1/t1load.c (parse_encoding): Check cursor position after + call to T1_Skip_PS_Token. + +2012-07-12 Alexei Podtelezhnikov + + Revert the last commit 45337b07. + + * src/base/ftstroke.c (FT_Stroker_New): Revert the previous change. + +2012-07-11 Alexei Podtelezhnikov + + [ftstroke] Fix uninitialized return value. + + * src/base/ftstroke.c (FT_Stroker_New): Return FT_Err_Ok instead. + +2012-07-11 Werner Lemberg + + [smooth] Avoid memory leak in case of failure. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Use flags to + indicate what to clean up after finishing the function, with and + without errors. + +2012-07-09 Werner Lemberg + + Fix compilation with MSVC 5.0. + + Problem reported by Peter Breitenlohner and Akira Kakuto. + + * include/freetype/config/ftstdlib.h (ft_setjmp): Updated. + * src/sfnt/ttcmap.c (tt_face_build_cmaps): Remove cast. + +2012-07-09 Werner Lemberg + + [autofit] Improve debugging messages; do some code cleanup. + + * src/autofit/aflatin.c (af_latin_align_linked_edge, + af_latin_hint_edges): Synchronize with formatting used in the + ttfautohint project. + +2012-07-07 Gilles Espinasse + + Fix strict-aliasing warning. + + * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Avoid double cast. + +2012-07-07 Dave Thomas + + [ARM] Fix FT_MulFix_arm. + + * include/freetype/config/ftconfig.h (FT_MulFix_arm) [__arm__]: + Avoid ADDS instruction to clobber condition codes. + +2012-07-06 Werner Lemberg + + [autofit] Do some code cleanup. + + * src/autofit/afglobal.c (af_face_globals_new): Simplify. + + * src/autofit/afhints.c: Use `FT_TRACE7' instead of `printf' + everywhere. + (FT_COMPONENT): New macro. + (af_glyph_hints_done): Simplify. + + * include/freetype/internal/fttrace.h: Updated. + +2012-07-05 Werner Lemberg + + [autofit] Improve output of debugging information. + + * src/autofit/afhints.c (af_glyph_hints_dump_segments): Print more + data; report no data. + (af_glyph_hints_dump_edges): Report no data. + +2012-07-04 Werner Lemberg + + [autofit] Fix Savannah bug #36091. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues), + src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Change the + constraint for testing round vs. flat segment: Accept either a + small distance or a small angle. + +2012-07-04 Werner Lemberg + + [autofit] Beautify blue zone tracing. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues), + src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Implement it. + +2012-07-03 Werner Lemberg + + [autofit] Quantize stem widths. + + * src/autofit/afangles.c (af_sort_widths): Rename to... + (af_sort_and_quantize_widths): This. + Add code to avoid stem widths which are almost identical. + * src/autofit/aftypes.h, src/autofit/aflatin.c, src/autofit/afcjk.c: + Updated. + +2012-07-03 Werner Lemberg + + [autofit] Minor speed-up. + + * src/autofit/afangles (af_sort_pos, af_sort_widths): Don't swap + elements if they are equal. + +2012-06-30 Gilles Espinasse + + Fix `checking if gcc static flag -static works' test. + + On my linux build tree, I receive yes answer in in every package I + build except freetype for this test checking if gcc static flag + `-static' works + + On freetype, no is received, unless bzip2 and zlib are disabled using + + ./configure --without-bzip2 --without-zlib + + The reason is that bzip2 and zlib tests add `-lz' and `-lbz2' to + LDFLAGS and this broke static flag test. + + * builds/unix/configure.raw: Update CFLAGS and LDFLAGS only after + LT_INIT has run. + +2012-06-28 Infinality + + [truetype] Fix various artifacts. + + Verdana was broken in the original Infinality commit. Also + includes other minor fixes. + + * src/truetype/ttsubpix.h: Updated. Removed unused macros. + (RASTERIZER_35_Rules): Add Verdana. + (SKIP_NONPIXEL_Y_MOVES_Rules): Add Tahoma `s'. + (MIRP_CVT_ZERO_Rules): Remove Verdana. + (ALWAYS_SKIP_DELTAP_Rules): Add Russian char 0x438. + (COMPATIBLE_WIDTHS_Rules): Rearrange some rules. + (X_SCALING_Rules): Adjust Verdana `a' at 12 and 13 ppem. + + * src/truetype/ttsubpix.c: Updated. + (sph_set_tweaks): Re-execute fpgm always. + +2012-06-28 Gilles Espinasse + + Fix CFLAGS and LDFLAGS share configure test. + + * builds/unix/configure.raw: Fix typo. + +2012-06-28 Werner Lemberg + + [truetype] Set the `subpixel_positioned' flag unconditionally. + + This is how the code currently behaves. + + * src/truetype/ttgload.c (tt_loader_init): Do it. + +2012-06-27 Werner Lemberg + + Fix conditional compilation. + + * src/base/basepic.c: Use FT_CONFIG_OPTION_MAC_FONTS. + +2012-06-27 Werner Lemberg + + Fix conditional compilation. + + * include/freetype/internal/ftcalc.h (FT_MulDiv_No_Round): Don't + enclose with `TT_USE_BYTECODE_INTERPRETER'; we now need the function + elsewhere also. + + * src/autofit/afcjk.h: Use AF_CONFIG_OPTION_CJK. + + * src/truetype/ttgload.c (tt_loader_init): Fix compiler warning. + + * src/truetype/ttinterp.c (Ins_MSIRP): Fix compiler warning. + + * src/truetype/ttinterp.h: Use + TT_CONFIG_OPTION_BYTECODE_INTERPRETER. + +2012-06-26 Infinality + + [truetype] Remove unused rounding functionality. + + The subpixel hinting patch contained the concept of an adjustable + number of gridlines per pixel. This is no longer used due to x + being completely ignored instead. This will return some of the + code to its existing state prior to the original Infinality + commit. + + * include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID, + FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): Removed. + + * src/truetype/ttinterp.c: Updated. + (Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid, + Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45, + SetSuperRound): Remove parameter to handle the number of grid lines per + pixel. + (SET_SuperRound, ROUND_None, CUR_Func_round): Updated. + (DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated. + (DO_ROUND, DO_NROUND): Updated. + (Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP, + Ins_MDRP, Ins_MIRP): Perform Round_None instead of calling a modified + rounding function. Remove gridlines_per_pixel. Create a local + variable to store control value cutin. Simplify the conditional for + ignore_x_mode. Adjust rounding calls to pass only two values. + +2012-06-25 Werner Lemberg + + [cff] Fix Savannah bug #36705. + + Handle numbers like 2.001 correctly. + + * src/cff/cffparse.c (cff_parse_real): Avoid negative values for + `shift'. + +2012-06-18 Infinality + + [truetype] Support subpixel hinting. + + This is the large, famous `Infinality' patch to support ClearType + bytecode which has been available from + http://www.infinality.net/blog/ for some time, and which has been + refined over the last years. While still experimental, it is now + mature enough to be included directly into FreeType. + + Most of the code is based on the ClearType whitepaper written by + Greg Hitchcock + + http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx + + which gives a detailed overview of the necessary changes to the + Microsoft rasterizer so that older fonts are supported. However, a + lot of details are still missing, and this patches provides a + framework to easily handle rendering issues down to the glyph level + of certain fonts. + + Note that ClearType support is not completely implemented! In + particular, full support for the options `compatible_widths', + `symmetrical_smoothing, and `bgr' (via the GETINFO bytecode + instruction) is missing. + + * src/truetype/ttsubpix.c: New file, providing code to handle + `tweaks', this is, rules for certain glyphs in certain fonts + (including wildcards) which need a special treatment. + + * src/truetype/ttsubpix.h: New file, holding the tweaking rules. + + * include/freetype/config/ftoption.h, src/devel/ftoption.h + (TT_CONFIG_OPTION_SUBPIXEL_HINTING): New macro. + + * include/freetype/internal/ftobjs.h (FT_PIX_FLOOR_GRID, + FT_PIX_ROUND_GRID, FT_PIX_CEIL_GRID): New macros. + + * src/truetype/truetype.c [TT_USE_BYTECODE_INTERPRETER]: Include + `ttsubpix.c'. + + * src/truetype/ttgload.c: Include `ttsubpix.h'. + [All changes below are guarded by TT_CONFIG_OPTION_SUBPIXEL_HINTING.] + + (tt_get_metrics): Set tweak flags. + (TT_Hint_Glyph): Call `FT_Outline_EmboldenXY' if necessary. + (TT_Process_Simple_Glyph): Compensate emboldening if necessary. + (compute_glyph_metrics): Handle `compatible widths' option. + (tt_loader_init): Handle ClearType GETINFO information bits. + + * src/truetype/rules.mk (TT_DRC_SRC): Updated. + + * src/truetype/ttinterp.c: Include `ttsubpix.h'. + [Where necessary, changes below are guarded by + TT_CONFIG_OPTION_SUBPIXEL_HINTING.] + + (Direct_Move, Direct_Move_X): Extended. + (Round_None, Round_To_Grid, Round_To_Half_Grid, Round_Down_To_Grid, + Round_Up_To_Grid, Round_To_Double_Grid, Round_Super, Round_Super_45, + SetSuperRound): Add parameter to handle the number of grid lines per + pixel. + (SET_SuperRound, ROUND_None, CUR_Func_round): Updated. + (DO_SROUND, DOS45ROUND, DO_ODD, DO_EVEN): Updated. + (DO_ROUND, DO_NROUND): Updated. + (DO_RS): Take care of `Typeman' bytecode patterns. + (Ins_FDEF): Add some debugging code. Commented out. + (Ins_ENDF): Restore state. + (Ins_CALL, Ins_LOOPCALL): Handle inline delta functions. + (Ins_MD): Handle `Vacuform' rounds. + (Move_Zp2_Point, Ins_SHPIX, Ins_MSIRP, Ins_MDAP, Ins_MIAP, + Ins_MDRP, Ins_MIRP): Handle tweaks. + (Ins_ALIGNRP): Add tweak guard. + (Ins_IUP, Ins_DELTAP): Handle tweaks. + (Ins_GETINFO): Handle new ClearType bits. + (TT_RunIns): Handle tweaks. + + * src/truetype/ttinterp.h: Updated. + (SPH_TweakRule, SPH_ScaleRule): New structures for tweaks. + (TT_ExecContextRec): Add members for subpixel hinting support. + + * src/truetype/ttobjs.h (TT_DefRecord): Add `inline_delta' member. + +2012-06-15 Werner Lemberg + + * Version 2.4.10 released. + ========================= + + + Tag sources with `VER-2-4-10'. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.4.10. + + * 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.9/2.4.10/, s/249/2410/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 10. + + * builds/unix/configure.raw (version_info): Set to 15:0:9. + +2012-06-15 Alexei Podtelezhnikov + + * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Improve spacing. + + * docs/CHANGES: Updated. + +2012-06-14 suzuki toshiya + + * builds/exports.mk: Add CCexe_CFLAGS and CCexe_LDFLAGS. + + to pass special compiler/linker flags under cross development. + Suggested by Savannah bug #36367. + + ChangeLog on 2010-07-15 saying as they were removed was wrong + for the official trunk of FreeType2. This commit is the first + introduction of them. + +2012-06-14 Werner Lemberg + + * docs/CHANGES: Updated. + +2012-06-14 suzuki toshiya + + [truetype] Add new versions of NEC FA family to tricky font list. + + NEC FA family dated in 1996 have different checksum. + Reported by Johnson Y. Yan ; see + + http://lists.gnu.org/archive/html/freetype-devel/2012-06/msg00023.html + + * src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): 4 sets + of fpgm & prep table checksums for FA-Gothic, FA-Minchou, + FA-RoundedGothicM, FA-RoundedGothicB are added. The family + names in sample PDF are truncated, thus the list of the + family names in tt_check_trickyness_family() is not updated yet. + +2012-06-06 Werner Lemberg + + [ftraster] Fix rounding issue causing visual artifacts. + + Problem reported by jola ; see + + http://lists.gnu.org/archive/html/freetype-devel/2012-05/msg00036.html + + * src/raster/ftraster.c (SMulDiv_No_Round): New macro. + (Line_Up): Use it. + * src/raster/ftmisc.h (FT_MulDiv_No_Round): Copied from `ftcalc.c'. + +2012-05-28 Alexei Podtelezhnikov + + * src/base/ftoutln.c (FT_Outline_Get_Orientation): Simplify. + + We now use the cross product of the direction vectors to compute the + outline's orientation. + +2012-05-28 Werner Lemberg + + * docs/CHANGES: Updated. + +2012-05-28 Alexei Podtelezhnikov + + New function FT_Outline_EmboldenXY. + + * include/freetype/ftoutln.h (FT_Outline_EmboldenXY): Define it. + + * src/base/ftoutln.c (FT_Outline_EmboldenXY): Implement it, using a + simplified embolding algorithm. + (FT_Outline_Embolden): Make it a special case of + `FT_Outline_EmboldenXY' + +2012-05-07 Werner Lemberg + + [type1] Fix Savannah bug #36386. + + * src/type1/t1load.c (t1_load_keyword): Ignore keyword if context is + not valid. + +2012-04-07 Werner Lemberg + + Remove compiler warning. + + * src/truetype/ttgload.c (TT_Load_Glyph) + [!TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: Access `glyph->face' directly. + +2012-03-28 Werner Lemberg + + [autofit] Properly copy scaler flags to script metrics object. + + Without this patch, only the dummy and cjk autohinter modules get + them (since they copy the whole scaler object). + + * src/autofit/aflatin.c (af_latin_metrics_scale), + src/autofit/aflatin2.c (af_latin2_metrics_scale): Implement it. + +2012-03-22 Alexei Podtelezhnikov + + [bdflib] Remove redundant macro. + + * src/bdf/bdflib.c (isdigok): Remove and replace with sbitset, which + is exactly the same. + +2012-03-20 suzuki toshiya + + [configure] Fix Savannah bug #35644. + + * builds/unix/configure.raw: Check `-ansi' flag works even if gcc + is used. Bionic libc headers for Android lose the consistency + when they are parsed with __STDC_VERSION__ older than 199901L or + __STRICT_ANSI__. + +2012-03-20 Werner Lemberg + + [bdf] Improvement to Savannah bug #35656. + + * src/bdf/bdflib.c (isdigok): Add cast, as suggested in report. + +2012-03-17 Chris Liddell + + [type1] Fix Savannah bug #35847. + + * src/type1/t1load.c (parse_subrs): Fix the loop exit condition; + we want to exit when we have run out of data. + +2012-03-16 Werner Lemberg + + [bdf] Really fix Savannah bug #35658. + + * src/bdf/bdflib.c (_bdf_list_split): Add one more `field' initializer. + +2012-03-14 Yann Droneaud + + [sfnt] Make arrays static like all others. + + * src/sfnt/ttload.c (tt_face_load_maxp, tt_face_load_os2), + src/sfnt/ttmtx.c (tt_face_load_hhea): Add `static' keyword to frame + fields. + +2012-03-14 Huw Davies + + [sfnt] A refinement of the previous commit. + + * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16, + tt_name_entry_ascii_from_other): Stop at null byte. + +2012-03-14 Huw Davies + + [sfnt] Add `name' table compatibility to MS Windows. + + * src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16, + tt_name_entry_ascii_from_other): Don't replace `\0' with question + marks when converting strings. + +2012-03-14 Werner Lemberg + + [type1] Fix Savannah bug #35833. + + Based on the patch given in the bug report. + + * src/type1/t1load.c (IS_INCREMENTAL): New macro. + (read_binary_data): Add parameter `incremental'. + Update all callers using `IS_INCREMENTAL'. + +2012-03-11 Werner Lemberg + + [autofit] Return correct linear advance width values. + + This was quite a subtle bug which accidentally showed up with glyph + `afii10023' of arial.ttf (version 2.76). This glyph is a composite; + the first component, `E', has an advance width of 1366 font units, + while the advance width of the composite itself (which looks like + uppercase `E' with dieresis) is 1367 font units. I think this is + actually a bug in the font itself, because there is no reason that + this glyph has not the same width as uppercase `E' without the + dieresis. Anyway, it helped identify this problem. + + Using the TrueType hinter, the correct value (1367) of `afii10023' + was returned, but the autohinter mysteriously returned 1366. + + Digging in the code showed that the autohinter recursively calls + FT_Load_Glyph to load the glyph, adding the FT_LOAD_NO_SCALE load + flag. However, the `linearHoriAdvance' field is still returned as a + scaled value. To avoid scaling twice, the old code in autofit reset + `linearHoriAdvance', using the `horiAdvance' field. This seemed to + work since FT_LOAD_NO_SCALE was in use, but it failed actually, + because `horiAdvance' is defined as the distance of the first + subglyph's phantom points, which in turn are initialized using the + advance width of the first subglyph. And as the given example + shows, these widths can differ. + + * src/autofit/afloader.c (af_loader_load_g): Temporarily set + FT_LOAD_LINEAR_DESIGN while calling FT_Load_Glyph to get unscaled + values for the linear advance widths. + +2012-03-10 Werner Lemberg + + [truetype] Fix SSW instruction. + + * src/truetype/ttinterp.c (DO_SSW): SSW *does* use font units. For + verification, it took some time to find a font which actually uses + this instruction. + +2012-03-09 Vinnie Falco + + Prepare source code for amalgamation. + + * include/freetype/freetype.h: Swap order of preprocessor blocks. + +2012-03-08 Werner Lemberg + + * Version 2.4.9 released. + ========================= + + + Tag sources with `VER-2-4-9'. + + * docs/CHANGES: Updated. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.4.9. + + * 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.8/2.4.9/, s/248/249/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 9. + + * builds/unix/configure.raw (version_info): Set to 14:1:8. + +2012-03-08 Werner Lemberg + + [bdf] Add missing overflow check. + + * src/bdf/bdflib.c (_bdf_parse_glyphs) : Add threshold for + `glyph->bpr'. + +2012-03-07 Vinnie Falco + + Prepare source code for amalgamation. + + * src/autofit/aferrors.h, src/bdf/bdferror.h, src/bzip2/ftbzip2.c, + src/cache/ftcerror.h, src/cff/cfferrs.h, src/cid/ciderrs.h, + src/gxvalid/gxverror.h, src/gzip/ftgzip.c, src/lzw/ftlzw.c, + src/otvalid/otverror.h, src/pcf/pcferror.h, src/pfr/pfrerror.h, + src/psaux/psauxerr.h, src/pshinter/pshnterr.h, + src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h, + src/smooth/ftsmerrs.h, src/truetype/tterrors.h, + src/type1/t1errors.h, src/type42/t42error.h, src/winfonts/fnterrs.h: + Add #undef FT_ERR_PREFIX before #define FT_ERR_PREFIX. + +2012-03-03 Werner Lemberg + + Fix Savannah bug #35660. + + For some divisions, we use casts to 32bit entities. Always guard + against division by zero with these casts also. + + * src/base/ftcalc.c (ft_div64by32): Remove redundant cast. + (FT_MulDiv, FT_MulDiv_No_Round): Add 32bit cast. + (FT_DivFix): Add 32bit cast (this omission triggered the bug). + +2012-03-03 Werner Lemberg + + [psaux] Fix handling of track kerning. + + * src/psaux/afmparse.c (afm_parse_track_kern): Don't inverse sign + for `min_kern'. It is indeed quite common that track kerning + *increases* spacing for very small sizes. + +2012-03-02 Werner Lemberg + + [truetype] Fix Savannah bug #35689. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check first outline + point. + +2012-03-01 Werner Lemberg + + [bdf] Fix Savannah bug #35656. + + * src/bdf/bdflib.c (_bdf_parse_glyphs) <_BDF_BITMAP>: Check validity + of nibble characters instead of accessing `a2i' array. + +2012-03-01 Werner Lemberg + + [winfonts] Fix Savannah bug #35659. + + * src/winfonts/winfnt.c (FNT_Face_Init): Check number of glyphs. + +2012-03-01 Werner Lemberg + + [bdf] Fix Savannah bug #35658. + + * src/bdf/bdflib.c (_bdf_list_split): Initialize `field' elements + properly. + +2012-03-01 Werner Lemberg + + [psaux] Fix Savannah bug #35657. + + If in function `skip_spaces' the routine `skip_comment' comes to the + end of buffer, `cur' is still increased by one, so we need to check + for `p >= limit' and not `p == limit'. + + * src/psaux/psconv.c (PS_Conv_Strtol, PS_Conv_ToFixed, + PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Fix boundary checking. + +2012-03-01 Werner Lemberg + + [truetype] Fix Savannah bug #35646. + + * src/truetype/ttinterp.c (Ins_MIRP): Typo, present since ages. The + code is now in sync with the other operators (e.g. MSIRP) which + modify twilight points. + +2012-03-01 Werner Lemberg + + [bdf] Fix Savannah bug #35643. + + * src/bdf/bdflib.c (_bdf_list_ensure): Bring code in sync with + comment before `_bdf_list_split', this is, really allocate at least + five `field' elements. + +2012-03-01 Werner Lemberg + + [bdf] Fix Savannah bug #35641. + + * src/bdf/bdflib.c (_bdf_parse_glyphs) : Abort if + _BDF_ENCODING isn't set. We need this because access to the `glyph' + variable might be undefined otherwise. + +2012-03-01 Werner Lemberg + + [truetype] Fix Savannah bug #35640. + + * src/truetype/ttinterp.c (SkipCode, TT_RunIns): Fix boundary check + for NPUSHB and NPUSHW instructions. + +2012-02-29 Werner Lemberg + + [truetype] Fix Savannah bug #35601. + + * src/truetype/ttinterp.c (Ins_SHZ): Use number of points instead of + last point for loop. + Also remove redundant boundary check. + +2012-02-29 Werner Lemberg + + [truetype] Remove redundant check. + + * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Remove redundant + second check for ordered contour start points. + +2012-02-29 Werner Lemberg + + [truetype] Make SHC instruction behave similar to MS rasterizer. + + * src/truetype/ttinterp.c (Ins_SHC): Handle virtual contour in + twilight zone. + +2012-02-29 Alexei Podtelezhnikov + + Avoid modulo operators against a power-of-two denominator. + + * src/afcjk.c (af_hint_normal_stem), src/base/ftoutln.c + (ft_contour_has), src/cff/cffgload.c (cff_decoder_parse_charstrings) + , + src/gxvalid/gxvcommn.c (GXV_32BIT_ALIGNMENT_VALIDATE), + src/gxvalid/gxvfeat.c (gxv_feat_setting_validate): Replace `%' with + `&' operator. + +2012-02-29 Werner Lemberg + + [autofit] Don't synchronize digit widths for light rendering mode. + + We don't hint horizontally in this mode. + + * src/autofit/afloader.c (af_loader_load_g) : + Implement it. + +2012-02-26 Alexei Podtelezhnikov + + [type42] Minor code optimization (again). + + * src/type42/t42parse.c (t42_parse_sfnts): Simplify previous change. + +2012-02-26 Mateusz Jurczyk + Werner Lemberg + + [smooth] Fix Savannah bug #35604. + + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Use `FT_Pos' + instead of `FT_UInt' for some variables and update comparisons + accordingly. A detailed analysis can be found in the bug report. + +2012-02-26 Alexei Podtelezhnikov + + [type42] Minor code optimization. + + * src/type42/t42parse.c (t42_parse_sfnts): Use bitmask instead of + modulo operator. + +2012-02-26 Werner Lemberg + + * docs/CHANGES: Updated. + +2012-02-26 Werner Lemberg + + [type1] Fix Savannah bug #35608. + + * src/type1/t1parse.c (T1_Get_Private_Dict): Reject too short + dictionaries. + +2012-02-26 Werner Lemberg + + [bdf] Support `ENCODING -1 ' format. + + * src/bdf/bdflib.c (_bdf_parse_glyphs) : Implement it. + +2012-02-26 Werner Lemberg + + [bdf] Fix Savannah bug #35607. + + * src/bdf/bdflib.c (_bdf_parse_glyphs) : Normalize + negative encoding values. + +2012-02-26 Werner Lemberg + + [type1] Fix Savannah bug #35606. + + * src/type1/t1load.c (parse_subrs): Add proper guards for `strncmp'. + + * src/psaux/psobjs.c (ps_parser_skip_PS_token): Emit error message + only if cur < limit. + +2012-02-25 Werner Lemberg + + [pcf] Fix Savannah bug #35603. + + * src/pcf/pcfread.c (pcf_get_properties): Assure final zero byte in + `strings' array. + +2012-02-25 Werner Lemberg + + [type42] Fix Savannah bug #35602. + + * src/type42/t42parse.c (t42_parse_sfnts): Check `string_size' more + thoroughly. + +2012-02-25 Werner Lemberg + + [bdf] Fix Savannah bugs #35599 and #35600. + + * src/bdf/bdflib.c (ACMSG16): New warning message. + (_bdf_parse_glyphs) <_BDF_BITMAP>: Check line length. + +2012-02-24 Werner Lemberg + + [bdf] Fix Savannah bugs #35597 and #35598. + + * src/bdf/bdflib.c (_bdf_is_atom): Fix handling of property value. + +2012-02-24  Vinnie Falco + + Prepare source code for amalgamation (6/6). + + * src/cff/cffdrivr.c: s/Load_Glyph/cff_glyph_load/. + + * src/cid/cidload.c: s/parse_font_matrix/cid_parse_font_matrix/. + s/t1_init_loader/cid_init_loader/. + s/t1_done_loader/cid_done_loader/. + + * src/pxaux/t1cmap.c: s/t1_get_glyph_name/psaux_get_glyph_name/. + + * src/truetype/ttdriver.c: s/Load_Glyph/tt_glyph_load/. + + * src/type1/t1load.c: s/parse_font_matrix/t1_parse_font_matrix/. + +2012-02-24  Vinnie Falco + + Prepare source code for amalgamation (5/6). + + * include/freetype/fterrors.h: Undefine FT_KEEP_ERR_PREFIX after + using it. + +2012-02-22  Vinnie Falco + + Prepare source code for amalgamation (4/6). + + * src/smooth/ftgrays.c, src/raster/ftraster.c: Undefine RAS_ARG, + RAS_ARGS, RAS_VAR, and RAS_VARS before defining it. + + * src/smooth/ftgrays.c: s/TRaster/black_TRaster/, + s/PRaster/black_PRaster/. + * src/raster/ftraster.c: s/TRaster/gray_TRaster/, + s/PRaster/gray_PRaster/. + +2012-02-20  Vinnie Falco + + Prepare source code for amalgamation (3/6). + + * src/smooth/ftgrays.c: s/TWorker/black_TWorker/, + s/PWorker/black_PWorker/. + * src/raster/ftraster.c: s/TWorker/gray_TWorker/, + s/PWorker/gray_PWorker/. + +2012-02-20  Vinnie Falco + + Prepare source code for amalgamation (2/6). + + * src/smooth/ftgrays.c, src/raster/ftraster.c: Undefine FLOOR, + CEILING, TRUNC, and SCALED before defining it. + +2012-02-20  Vinnie Falco + + Prepare source code for amalgamation (1/6). + + See discussion starting at + + http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00037.html + + * src/smooth/ftgrays.c: s/TBand/gray_TBand/. + * src/raster/ftraster.c: s/TBand/black_TBand/. + +2012-02-17 Alexei Podtelezhnikov + + [autofit] Fix outline flags. + + * src/autofit/afloader.c (af_loader_load_g): Don't reassign + `outline.flags' so that this information is preserved. See + discussion starting at + + http://lists.gnu.org/archive/html/freetype-devel/2012-02/msg00046.html + +2012-02-11 Werner Lemberg + + [truetype] Fix Savannah bug #35466. + + Jump instructions are now bound to the current function. The MS + Windows rasterizer behaves the same, as confirmed by Greg Hitchcock. + + * src/truetype/ttinterp.h (TT_CallRec): Add `Cur_End' element. + * src/truetype/ttobjs.h (TT_DefRecord): Add `end' element. + + * src/truetype/ttinterp.c (DO_JROT, DO_JMPR, DO_JROF): Check upper + bound of jump address. + (Ins_FDEF, Ins_CALL, Ins_LOOPCALL, Ins_UNKNOWN, TT_RunIns): Updated. + +2012-02-11 Werner Lemberg + + We don't use `extensions'. + + * include/freetype/internal/ftobjs.h (FT_DriverRec): Remove + `extensions' field. + +2012-02-11 Werner Lemberg + + Clean up `generic' fields. + + * include/freetype/internal/ftobjs.h (FT_ModuleRec, FT_LibraryRec): + Remove `generic' field since users can't access it. + + * src/base/ftobjs.c (FT_Done_GlyphSlot): Call `generic.finalizer' as + advertised in the documentation of FT_Generic. + (Destroy_Module, FT_Done_Library): Updated to changes in `ftobjs.h'. + +2012-02-07 Werner Lemberg + + [autofit] Harmonize function arguments. + + * src/autofit/afloader.c, src/autofit/afloader.h: Use `FT_Int32' for + `load_flags'. + +2012-02-07 Werner Lemberg + + * src/cff/cffobjs.c (cff_face_init): Remove unnecessary casts. + +2012-01-17 suzuki toshiya + + [gxvalid] Fix Savannah bug #35286. + + Patch submitted by anonymous reporter. + + * src/gxvalid/gxvcommn.c (gxv_XStateTable_subtable_setup): + gxv_set_length_by_ulong_offset() must be called with 3, not 4, + the number of the subtables in the state tables; classTable, + stateArray, entryTable. + +2012-01-17 suzuki toshiya + + [raccess] Modify for PIC build. + + Based on the patch provided by Erik Dahlstrom , + http://lists.gnu.org/archive/html/freetype-devel/2012-01/msg00010.html + + Also `raccess_guess_table[]' and `raccess_rule_by_darwin_vfs()' + are renamed with `ft_' suffixes. + + * src/base/ftbase.h: `raccess_rule_by_darwin_vfs()' is renamed + to `ft_raccess_rule_by_darwin_vfs()'. + * src/base/ftobjs.c: Ditto. + + * src/base/ftrfork.c: Declarations of FT_RFork_Rule, + raccess_guess_rec, are moved to... + * include/freetype/internal/ftrfork.h: Here. + + * include/freetype/internal/ftrfork.h: + FT_RFORK_RULE_ARRAY_{BEGIN,ENTRY,END} macros are defined + to replace raccess_guess_table[] in both of PIC and non-PIC + modes. + * src/base/ftrfork.c: raccess_guess_table[] array is rewritten + by FT_RFORK_RULE_ARRAY_{BEGIN,ENTRY,END}. + + * src/base/basepic.h (BasePIC): Add `ft_raccess_guess_table' + storage. (FT_RACCESS_GUESS_TABLE_GET): New macro to retrieve + the function pointer from `ft_raccess_guess_table' storage in + `BasePIC' structure. + * src/base/ftrfork.c (FT_Raccess_Guess): Rewritten with + FT_RACCESS_GUESS_TABLE_GET. + (raccess_get_rule_type_from_rule_index): Add `library' as the + first argument to the function, to retrieve the storage of + `ft_raccess_guess_table' from it. Also `raccess_guess_table' + is replaced by FT_RACCESS_GUESS_TABLE_GET. + (ft_raccess_rule_by_darwin_vfs): Ditto. + +2012-01-16 suzuki toshiya + + Remove trailing spaces. + +2012-01-16 suzuki toshiya + + Formatting PIC related sources. + + * src/autofit/afpic.c: Harmonize to FT2 coding conventions. + * src/base/basepic.c: Ditto. + * src/base/ftpic.c: Ditto. + * src/cff/cffpic.c: Ditto. + * src/pshinter/pshpic.c: Ditto. + * src/psnames/pspic.c: Ditto. + * src/raster/rastpic.c: Ditto. + * src/sfnt/sfntpic.c: Ditto. + * src/smooth/ftspic.c: Ditto. + * src/truetype/ttpic.c: Ditto. + +2012-01-16 suzuki toshiya + + [autofit] Fix the inclusion of `aflatin2.h' in PIC file. + + * src/autofit/afpic.c: Include `aflatin2.h' when + FT_OPTION_AUTOFIT2 is defined, as afglobal.c does so. + Unconditionally inclusion causes declared but unimplemented + warning by GCC 4.6. + +2012-01-16 suzuki toshiya + + [cff] Remove redundant declarations of cff_cmap_XXX_class_rec. + + * src/cff/cffpic.c: The declarations of + FT_Init_Class_cff_cmap_encoding_class_rec() and + FT_Init_Class_cff_cmap_unicode_class_rec() are removed. + They can be obtained by the inclusion of cffcmap.h. + cffcmap.h invokes FT_DECLARE_CMAP_CLASS() and it declares + FT_Init_Class_cff_cmap_encoding_class_rec() etc in PIC mode. + +2012-01-15 suzuki toshiya + + Fix redundant declaration warning in PIC mode. + + Originally FT_DEFINE_{DRIVER,MODULE,RENDERER}() macros were + designed to declare xxx_pic_{free,init} by themselves. + Because these macros are used at the end of the module + interface (e.g. ttdriver.c) and the wrapper source to build + a module as a single object (e.g. truetype.c) includes + the PIC file (e.g. ttpic.c) before the module interface, + these macros are expanded AFTER xxx_pic_{free,init} body + when the modules are built as single object. + The declaration after the implementation causes the redundant + declaration warnings, so the declarations are moved to module + PIC headers (e.g. ttpic.h). Separating to other header files + are needed for multi build. + + * include/freetype/internal/ftdriver.h (FT_DEFINE_DRIVER): + Remove class_##_pic_free and class_##_pic_init declarations. + * include/freetype/internal/ftobjs.h (FT_DEFINE_RENDERER, + FT_DEFINE_MODULE): Ditto. + + * src/base/basepic.h: Insert a comment and fix coding style. + * src/autofit/afpic.h: Declare autofit_module_class_pic_{free, + init}. + * src/cff/cffpic.h: Declare cff_driver_class_pic_{free,init}. + * src/pshinter/pshpic.h: Declare pshinter_module_class_pic_{free, + init}. + * src/psnames/pspic.h: Declare psnames_module_class_pic_{free, + init}. + * src/raster/rastpic.h: Declare + ft_raster{1,5}_renderer_class_pic_{free,init} + * src/sfnt/sfntpic.h: Declare sfnt_module_class_pic_{free,init}. + * src/smooth/ftspic.h: Declare + ft_smooth_{,lcd_,lcdv_}renderer_class_pic_{free,init}. + * src/truetype/ttpic.h: Declare tt_driver_class_pic_{free,init}. + +2012-01-15 suzuki toshiya + + Make pspic.c to include module error header to fix multi build. + + * src/psnames/pspic.c: Include `psnamerr.h'. + +2012-01-14 suzuki toshiya + + [base] Fix a dereference of uninitialized variable in PIC mode. + + * src/base/ftglyph.c (FT_Glyph_To_Bitmap): `glyph' must be + set before derefering to obtain `library'. The initialization + of `clazz', `glyph', `library' and NULL pointer check are + reordered to minimize PIC conditonals. + +2012-01-14 suzuki toshiya + + [base] Insert explicit cast for GCC 4.6 in PIC mode. + + * src/base/ftinit.c (FT_Add_Default_Modules): Under PIC + configuration, FT_DEFAULT_MODULES_GET returns + FT_Module_Class** pointer, GCC 4.6 warns that + const FT_Module_Class* const* variable is warned as + inappropriate to store it. To calm it, explicit cast is + inserted. Also `library' is checked to prevent the NULL + pointer dereference in FT_DEFAULT_MODULES_GET. + +2012-01-13 suzuki toshiya + + Fix PIC build broken by d9145241fe378104ba4c12a42534549faacc92e6. + + Under PIC configuration, FT_{CFF,PSCMAPS,SFNT,TT}_SERVICES_GET + take no arguments but derefer the variable named `library' + internally. + + * src/cff/cffdrivr.c (cff_get_interface): Declare `library' and + set it if non-NULL driver is passed. + * src/truetype/ttdriver.c (tt_get_interface): Ditto. + + * src/sfnt/sfdriver.c (sfnt_get_interface): Declare `library' + under PIC configuration, and set it if non-NULL module is given. + * src/psnames/psmodule.c (psnames_get_interface): Ditto. + +2012-01-13 suzuki toshiya + + Make PIC files include module error headers, to use the error codes + with per-module prefix. + + * src/autofit/afpic.c: Include `aferrors.h'. + * src/cff/cffpic.c: Include `cfferrs.h'. + * src/pshinter/pshpic.c: Include `pshnterr.h'. + * src/raster/rastpic.c: Include `rasterrs.h'. + * src/sfnt/sfntpic.c: Include `sferrors.h'. + * src/smooth/ftspic.c: Include `ftsmerrs.h'. + * src/truetype/ttpic.c: Include `tterrors.h'. + +2012-01-04 Tobias Ringström + + [truetype] Fix IP instruction if x_ppem != y_ppem. + + * src/truetype/ttinterp.c (Ins_IP): Scale `orus' coordinates + properly. + +2012-01-02 Werner Lemberg + + Fix tracing message for `loca' table. + + * src/truetype/ttpload.c (tt_face_get_location): Don't emit a + warning message if the last `loca' entry references an empty glyph. + +2011-12-10 Werner Lemberg + + Add some variable initializations. + Reported by Richard COOK . + + * src/type1/t1driver.c (t1_ps_get_font_value): Initialize `val'. + * src/smooth/ftgrays.c (gray_render_conic): Initialize `levels' + earlier. + +2011-12-08 Werner Lemberg + + Fix serious scaling bug in `FT_Get_Advances'. + + * src/base/ftadvanc.c (FT_Get_Advances): Advance values returned by + `FT_Load_Glyph' must be simply multiplied by 1024. + +2011-12-08 Werner Lemberg + + * src/bdf/bdflib.c (_bdf_parse_start): Drop redundant error tracing. + +2011-12-02 suzuki toshiya + + [mac] Unify DARWIN_NO_CARBON with FT_MACINTOSH. + + Originally FT_MACINTOSH was a pure auto macro and DARWIN_NO_CARBON + was a configurable macro to disable Carbon-dependent code. Because + now configure script sets DARWIN_NO_CARBON by default and disables + Darwin & Carbon-dependent codes, these macros can be unified. + FT_MACINTOSH (undefined by default) is kept and DARWIN_NO_CARBON + (defined by default) is removed, because DARWIN_NO_CARBON violates + FT_XXX naming convention of public macros, and a macro configured by + default is not portable for the building without configure (e.g. + make devel). + + * builds/unix/configure.raw: Define FT_MACINTOSH if Carbon-based + old Mac font support is requested and Carbon is available. + * builds/unix/ftconfig.in: Undefine FT_MACINTOSH when the support + for Mac OS X without Carbon (e.g. Mac OS X 10.4 for ppc64) is + requested. + * include/freetype/config/ftconfig.in: Ditto. + * builds/vms/ftconfig.h: Ditto. + + * src/base/ftbase.h: Remove DARWIN_NO_CARBON. + * src/base/ftbase.c: Ditto. + * src/base/ftobjs.c: Ditto. + * src/base/ftrfork.c: Ditto. + + * src/base/ftmac.c: Compile the body if FT_MACINTOSH is defined + (same with TT_USE_BYTECODE_INTERPRETER in ttinterp.c). + * builds/mac/ftmac.c: Ditto. + + * builds/mac/FreeType.m68k_cfm.make.txt: Define FT_MACINTOSH. + * builds/mac/FreeType.m68k_far.make.txt: Ditto. + * builds/mac/FreeType.ppc_classic.make.txt: Ditto. + * builds/mac/FreeType.ppc_carbon.make.txt: Ditto. + +2011-11-30 suzuki toshiya + + Fix Savannah bug #34728 (`make devel' on Mac OS X). + + * builds/toplevel.mk: Check `/dev/null' to identify the Unix- + like systems without `init' nor `hurd' (e.g. Mac OS X >= 10.4). + * builds/unix/detect.mk: Ditto. + +2011-11-30 suzuki toshiya + + [apinames] Fix the overflow of signed integer hash. + + * src/tools/apinames.c (names_add): Change the type of `h' from + int to unsigned int, to prevent undefined behaviour in the + overflow of signed integers (overflow of unsigned int is defined + to be wrap around). Found by clang test suggested by Sean + McBride. + +2011-11-30 Werner Lemberg + + [winfonts] Remove casts. + + * src/winfonts/winfnt.c (winfnt_driver_class): Remove all casts and + update affected functions. + (FNT_Size_Select): Fix number of arguments. + +2011-11-30 Werner Lemberg + + [type42] Remove casts. + + * src/type42/t42driver.c (t42_driver_class): Remove all casts and + update affected functions. + + * src/type42/t42objs.c, src/type42/t42objs.h: Updated for t42driver + changes. + +2011-11-30 Werner Lemberg + + [type1] Remove casts. + + * src/type1/t1driver.c (t1_driver_class): Remove all casts and + update affected functions. + + * src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1objs.c: + Updated for t1driver changes. + src/type1/t1objs.h (T1_Driver): Remove unused typedef. + Updated for t1driver changes. + +2011-11-27 Werner Lemberg + + [bdf] Fix Savannah bug #34896. + + ENCODING now covers the whole Unicode range. + + Note, however, that this change is quite expensive since it + increases the size of three arrays by almost 400kByte in total. The + right fix is to replace the logic with something smarter. + Additionally, there exist very old BDFs for three-byte CCCII + encoding which exceeds the range of Unicode (another reason to have + a smarter logic). + + * src/bdf/bdf.h (bdf_font_t): Increase size of `nmod' and `umod' + arrays. + * src/bdf/bdflib.c (bdf_parse_t): Increase size of `have' array. + +2011-11-27 Werner Lemberg + + [bdf] Improve tracing. + + * src/bdf/bdflib.c (DBGMSG1, DBGMSG2): New macros. + (_bdf_parse_glyphs): Use them. + +2011-11-26 Werner Lemberg + + Improve tracing. + + * src/bdf/bdfdrivr.c (BDF_Face_Done), src/pcf/pcfdrivr.c + (PCF_Face_Done): Remove tracing message. + + * src/bdf/bdfdrivr.c (BDF_Face_Init), src/cff/cffobjs.c + (cff_face_init), src/cid/cidobjs.c (cid_face_init), + src/pfr/pfrobjs.c (pfr_face_init), src/sfnt/sfobjs.c + (sfnt_init_face), src/truetype/ttobjs.c (tt_face_init), + src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c + (T42_Face_Init), src/winfonts/winfnt.c (FNT_Face_Init): Add + `greeting' message. + + * src/sfnt/sfobjs.c (sfnt_open_font), src/type42/t42objs.c + (T42_Open_Face): Improve tracing. + +2011-11-26 Werner Lemberg + + [cid] Fix error code. + + * src/cid/cidparse.c (cid_parser_new): Do it. + +2011-11-26 Werner Lemberg + + [cff] Fix error code. + + * src/cff/cffload.c (cff_font_load): Do it. + +2011-11-26 Werner Lemberg + + Add new error code FT_Err_Missing_Module. + + Previously, FreeType misleadingly returned + FT_Err_Unknown_File_Format if a module was missing (or a test was + missing completely). + + * include/freetype/fterrdef.h (FT_Err_Missing_Module): Define. + + * src/cff/cffobjs.c (cff_face_init), src/cff/cffdrivr.c + (cff_get_glyph_name), src/cid/cidobjs.c (cid_face_init), + src/sfnt/sfobjs.c (sfnt_init_face), src/truetype/ttobjs.c + (tt_face_init), src/type1/t1objs.c (T1_Face_Init), + src/type42/t42objs.c (T42_Face_Init, T42_Driver_Init): Updated. + + * src/type1/t1afm.c (T1_Read_Metrics), src/type/t1objs.c + (T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Remove now + redundant test for `psaux'. + +2011-11-25 Werner Lemberg + + [bdf] Add more error messages. + + * src/bdf/bdflib.c (_bdf_set_default_spacing, _bdf_add_property): + Add line number argument. + Update all callers. + (ERRMSG5, ERRMSG6, ERRMSG7, ERRMSG8, ERRMSG9): New macros. + (_bdf_readstream, _bdf_set_default_spacing, _bdf_add_property, + _bdf_parse_glyphs, _bdf_parse_start): Add error messages. + +2011-11-24 Werner Lemberg + + * include/freetype/fterrors.h: Remove dead code. + +2011-11-15 Werner Lemberg + + * docs/releases: Updated. + +2011-11-15 Werner Lemberg + + * Version 2.4.8 released. + ========================= + + + Tag sources with `VER-2-4-8'. + + * docs/CHANGES: Updated. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.4.8. + + * 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.7/2.4.8/, s/247/248/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 8. + + * builds/unix/configure.raw (version_info): Set to 14:0:8. + +2011-11-13 Chris Liddell + + Add FT_Get_PS_Font_Value() API. + + This allows a Type 1 font face to be interrogated to retrieve most + of the dictionary keys (keys not relevant to FreeType's Type 1 + interpreter are not available). + + * include/freetype/internal/services/svpsinfo.h + (PS_GetFontValueFunc): New typedef. + (PSInfo): Add `ps_get_font_value'. + (FT_DEFINE_SERVICE_PSINFOREC): Updated. + + * include/freetype/internal/t1types.h (T1_EncodingType): Moved to... + * include/freetype/t1tables.h: Here. + (PS_Dict_Keys): New enumeration. + (FT_Get_PS_Font_Value): New declaration. + + * src/base/fttype1.c (FT_Get_PS_Font_Value): New function. + + * src/type1/t1driver.c (t1_ps_get_font_value): This new function + does the real job. + (t1_service_ps_info): Add it. + + * src/cff/cffdrivr.c (cff_service_ps_info), src/cid/cidriver.c + (cid_service_ps_info), src/type42/t42drivr.c (t42_service_ps_info): + Updated. + +2011-11-08 Braden Thomas + + [cid] Various loading fixes. + + * src/cid/cidload.c (cid_load_keyword) , + (parse_font_matrix, parse_expansion_factor): Correctly check number + of dictionaries. + (cid_read_subrs): Protect against invalid values of `num_subrs'. + Assure that the elements of the `offsets' array are ascending. + +2011-11-05 Werner Lemberg + + * README: We use copyright ranges also. + + According to + + http://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html + + this should be mentioned explicitly. + +2011-10-30 suzuki toshiya + + [raccess] Supplement for previous fix. + + * src/base/ftbase.h (raccess_rule_by_darwin_vfs): Do not declare + it on native Mac OS X. + * src/base/ftrfork.c (raccess_get_rule_type_from_rule_index): + Hide raccess_get_rule_type_from_rule_index() on native Mac OS X + too. + +2011-10-30 suzuki toshiya + + [raccess] Hide raccess_rule_by_darwin_vfs() on native Mac OS X. + + * src/base/ftrfork.c (raccess_rule_by_darwin_vfs): Do not + compile on native Mac OS X because it is not used. + +2011-10-25 Werner Lemberg + + [truetype] Fix MD instruction for twilight zone. + + * src/truetype/ttinterp.c (Ins_MD): Without this fix, the MD + instruction applied to original coordinates of twilight points + always returns zero. + +2011-10-18 Werner Lemberg + + * Version 2.4.7 released. + ========================= + + + Tag sources with `VER-2-4-7'. + + * docs/CHANGES: Updated. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.4.7. + + * 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.6/2.4.7/, s/246/247/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 7. + + * builds/unix/configure.raw (version_info): Set to 13:2:7. + +2011-10-15 Kal Conley + + Fix handling of transformations if no renderer is present. + + * src/base/ftobjs.c (FT_Load_Glyph): Thinko. + +2011-10-15 Kal Conley + + Fix conditions for autohinting. + + * src/base/ftobjs.c (FT_Load_Glyph): Handle + FT_LOAD_IGNORE_TRANSFORM. + +2011-10-07 suzuki toshiya + + [gxvalid] Fix a bug to detect too large offset in morx table. + + * src/gxvalid/gxvmorx2.c + (gxv_morx_subtable_type2_ligActionIndex_validate): Fix a bug + that too large positive offset cannot be detected. + +2011-10-01 Braden Thomas + + Handle some border cases. + + * include/freetype/config/ftstdlib.h (FT_USHORT_MAX): New macro. + + * src/base/ftbitmap.c (FT_Bitmap_Convert): Protect against invalid + value of `target->rows'. + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add check for + flex start. + + * src/raster/ftrend1.c (ft_raster1_render): Check `width' and + `height'. + + * src/truetype/ttgxvar.c (TT_Vary_Get_Glyph_Deltas): Protect against + invalid values in `localpoints' array. + +2011-10-01 Werner Lemberg + + [psnames] Handle zapfdingbats. + Problem reported by Nicolas Rougier . + + * src/tools/glnames.py (adobe_glyph_list): Add data from AGL's + `zapfdingbats.txt' file. + + * src/psnames/pstables.h: Regenerated. + +2011-09-27 Simon Bünzli + + [type1] Fix Savannah bug #34189. + + * src/type1/t1load.c (T1_Open_Face): Initialize + `face->len_buildchar'. + +2011-09-26 Werner Lemberg + + [cff] Dump SIDs while tracing. + + * src/cff/cffobjs.c (cff_face_init): Do it. + + * src/cff/cffparse.c (cff_parser_run) [FT_DEBUG_LEVEL_TRACE] + : Identify as SID. + +2011-09-17 Werner Lemberg + + Remove unused FT_ALIGNMENT macro. + + * builds/unix/ftconfig.in, builds/vms/ftconfig.h, + include/freetype/config/ftconfig.h: Do it. + +2011-09-17 Alexei Podtelezhnikov + + [smooth] Slightly optimize conic and cubic flatterners. + + * src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move + out some code from the main loop to speed it up. + +2011-09-11 Tomas Hoger + + Slightly improve LZW_CLEAR handling. + + * src/lzw/ftzopen.c (ft_lzwstate_io) : + Ensure that subsequent (modulo garbage byte(s)) LZW_CLEAR codes are + handled as clear codes. This also re-sets old_code and old_char to + predictable values, which is a little better than using `random' + ones if the code following LZW_CLEAR is invalid. + +2011-09-11 Tomas Hoger + + Add explicit LZW decompression stack size limit. + + Stack larger than 1<prefix[code - 256] + when traversing prefix table. Such check is less efficient and + should not be required if prefix table is constructed correctly in + the first place. + + * src/lzw/ftzopen.c (ft_lzwstate_stack_grow): Implement it. + +2011-09-11 Tomas Hoger + + Protect against loops in the prefix table. + + LZW decompressor did not sufficiently check codes read from the + input LZW stream. A specially-crafted or corrupted input could + create a loop in the prefix table, which leads to memory usage + spikes, as there's no decompression stack size limit. + + * src/lzw/ftzopen.c (ft_lzwstate_io) : First + code in valid LZW stream must be 0..255. + : In the special KwKwK case, code == free_ent, + code > free_ent is invalid. + +2011-09-09 Werner Lemberg + + Better tracing of metrics. + + * src/base/ftobjs.c (FT_Request_Size, FT_Select_Size): Decorate with + FT_TRACE. + +2011-09-07 Werner Lemberg + + [cff] Fix Savannah bug #33816. + + * src/cff/cfftypes.h (CFF_FontRecDictRec): New member + `has_font_matrix'. + * src/cff/cffparse.c (cff_parse_font_matrix): Set it. + Update tracing output. + * src/cff/cffobjs.c (cff_face_init): Use it so that the heuristics + can be removed. + +2011-08-30 Werner Lemberg + + Better tracing of metrics. + + * src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): + Decorate with FT_TRACE. + +2011-08-25 Werner Lemberg + + [cff] Better tracing of the parsing process. + + * src/cff/cffload.c (cff_subfont_load, cff_font_load): Decorate with + FT_TRACE. + + * src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox, + cff_parse_private_dict, cff_parse_cid_ros): Updated. + (CFF_FIELD_NUM, CFF_FIELD_FIXED, CFF_FIELD_FIXED_1000, + CFF_FIELD_STRING, CFF_FIELD_BOOL, CFF_FIELD_CALLBACK, CFF_FIELD, + CFF_FIELD_DELTA): Add argument for ID. + (cff_parser_run): Decorate with FT_TRACE. + + * src/cff/cffparse.h (CFF_Field_Handler) [FT_DEBUG_LEVEL_TRACE]: Add + `id' member. + + * src/cff/cfftoken.h: Add IDs to all fields. + +2011-08-16 Werner Lemberg + + Fix Savannah bug #34022. + + * README, docs/INSTALL: Remove references to UPGRADE.UNIX. + +2011-08-15 Werner Lemberg + + Fix Savannah bug #34018. + + * docs/UPGRADE.UNIX: Removed. Obsolete. + +2011-08-15 David Bevan + + Fix Savannah bug #33992. + + * src/base/ftstroke.c (FT_Stroker_ParseOutline): Fix border case. + +2011-08-12 Werner Lemberg + + [cff] Fix Savannah bug #33975. + + * src/cff/cffparse.c (cff_parse_font_matrix): Fix typo. + +2011-07-29 Werner Lemberg + + * Version 2.4.6 released. + ========================= + + + Tag sources with `VER-2-4-6'. + + * docs/CHANGES: Updated. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.4.6. + + * 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.5/2.4.6/, s/245/246/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 6. + + * builds/unix/configure.raw (version_info): Set to 13:1:7. + +2011-07-29 Werner Lemberg + + [cff] Add some more tracing infos. + + * src/cff/cffparse.c (cff_parse_font_matrix, cff_parse_font_bbox, + cff_parse_cid_ros): Add tracing. + +2011-07-22 Dirk Müller + + [psaux, type1] Fix null pointer dereferences. + + Found with font fuzzying. + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Check + `decoder->buildchar'. + + * src/type1/t1load.c (t1_load_keyword): Check `blend->num_designs'. + +2011-07-20 Chris Morgan + + Add FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT. + + Useful for embedded systems which don't need file stream support. + + * src/base/ftsystem.c, src/base/ftobjs.c (FT_Stream_New): Implement + it. + +2011-07-20 Elton Chung + + * src/base/ftpatent.c (FT_Face_SetUnpatentedHinting): Fix typo. + +2011-07-16 Steven Chu + + [truetype] Fix metrics on size request for scalable fonts. + + * src/truetype/ttdriver.c (tt_size_request): Fix copying metrics + from TT_Size to FT_Size if scalable font. + + See + + http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00049.html + + for some comparison images. + +2011-07-14 Matthias Drochner . + + [psaux] Fix potential sign extension problems. + + When shifting right a signed value, it is not defined by the + C standard whether one gets a sign extension or not. Use a macro to + do an explicit cast from a signed short (assuming that this is + 16bit) to an int. + + * src/psaux/t1decode.c (Fix2Int): New macro. + Use it where appropriate. + +2011-07-14 Werner Lemberg + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Better handling of subroutine index 0. + From Matthias Drochner . + +2011-07-10 Алексей Подтележников + + [psaux] Optimize previous commit. + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Move error check down to avoid testing twice for + good cases. + +2011-07-08 Werner Lemberg + + [psaux] Add better argument check for `callothersubr'. + + * src/psaux/t1decode.c (t1_decoder_parse_charstrings) + : Reject negative arguments. + +2011-07-07 Werner Lemberg + + [sfnt] Try harder to find non-zero values for ascender and descender. + + * src/sfnt/sfobjs.c (sfnt_load_face): Consult `OS/2' table in case + the `hhea' table's values are zero. + +2011-07-03 Werner Lemberg + + Fix previous commit. + + We want to unset FT_FACE_FLAG_SCALABLE only if there are bitmap + strikes in the font. + + * src/truetype/ttobjs.c (tt_face_init): Implement it. + + * docs/CHANGES: Updated. + +2011-07-02 Just Fill Bugs + + [truetype] Fix Savannah bug #33246. + + * src/truetype/ttobjs.c (tt_check_single_notdef): New function. + (tt_face_init): Use it to test FT_FACE_FLAG_SCALABLE. + +2011-07-02 Werner Lemberg + + * docs/CHANGES: Updated. + +2011-07-02 David Bevan + + [ftstroke] Major revision. + + The main problems + ----------------- + + o If FT_STROKER_LINEJOIN_BEVEL was specified, unlimited miter + joins (not bevel joins) were generated. Indeed, the meanings of + `miter' and `bevel' were incorrectly reversed (consistently) in + both the code and comments. + + o The way bevel joins were constructed (whether specified + explicitly, or created as a result of exceeding the miter limit) + did not match what is required for stroked text in PostScript or + PDF. + + The main fixes + -------------- + + o The behaviour of FT_STROKER_LINEJOIN_BEVEL has been corrected. + + o A new line join style, FT_STROKER_LINEJOIN_MITER_FIXED, has been + introduced to support PostScript and PDF miter joins. + + o FT_STROKER_LINEJOIN_MITER_VARIABLE has been introduced as an + alias for FT_STROKER_LINEJOIN_MITER. + + Additionally, a variety of stroking errors have been fixed. These + would cause various artifacts (including points `at infinity'), + especially when stroking poor quality fonts. + + See + + http://lists.gnu.org/archive/html/freetype-devel/2011-07/msg00001.html + + for example documents. The FreeType stroker now produces results + very similar to that produced by GhostScript and Distiller for these + fonts. + + Other problems + -------------- + + The following problems have been resolved: + + o Inside corners could be generated incorrectly. Intersecting the + inside corner could cause a missing triangular area and other + effects. + + The intersection point can only be used if the join is between + two lines and both lines are long enough. The `optimization' + condition in `ft_stroker_inside' has been corrected; this + requires the line length to be passed into various functions and + stored in `FT_StrokerRec'. + + o Incorrect cubic curves could be generated. The angle + calculations in `FT_Stroker_CubicTo' have been corrected to + handle the case of the curve crossing the +/-PI direction. + + o If the border radius was greater than the radius of curvature of + a curve, then the negative sector would end up outside (not + inside) the border. This situation is now recognized and the + negative sector is circumnavigated in the opposite direction. + (If round line joins are being used, this code is disabled + because the line join will always cover the negative sector.) + + o When a curve is split, the arcs may not join smoothly (especially + if the curve turns sharply back on itself). Changes in + direction between adjacent arcs were not handled. A round + corner is now added if the deviation from one arc to the next is + greater than a suitable threshold. + + o The current direction wasn't retained if a the outline contained + a zero length lineto or a curve that was determined to be + `basically a point'. This could cause a spurious join to be + added. + + o Cubics with close control points could be mishandled. All eight + cases are now distinguished correctly. + + Other improvements + ------------------ + + o Borders for cubic curves could be too `flat'. + FT_SMALL_CUBIC_THRESHOLD has been reduced a little to prevent + this. + + o The handling and use of movable points has been simplified a + little. + + o Various values are now computed only if the results are actually + needed. + + o The directions of the outer and inner borders have been swapped, + as recommended by Graham Asher. + + * src/base/ftstroke.c: Revised. + * include/freetype/ftstroke.h: Updated. + +2011-06-30 İsmail Dönmez + + * builds/toplevel.mk: We use git, not CVS, thus skip `.gitignore'. + +2011-06-29 Werner Lemberg + + [bdf] Fix Savannah bug #33663. + + * src/bdf/bdflib.c (_bdf_parse_glyphs): Handle negative values for + ENCODING correctly. + + * docs/CHANGES: Document it. + +2011-06-24 Werner Lemberg + + * Version 2.4.5 released. + ========================= + + + Tag sources with `VER-2-4-5'. + + * docs/CHANGES: Updated. + + * docs/VERSION.DLL: Update documentation and bump version number to + 2.4.5 + + * 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.4/2.4.5/, s/244/245/. + + * include/freetype/freetype.h (FREETYPE_PATCH): Set to 5. + + * builds/unix/configure.raw (version_info): Set to 13:0:7. + +2011-06-20 Werner Lemberg + + * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Fix change + from 2011-05-04. + +2011-06-19 suzuki toshiya + + [gxvalid] make the `prop' validation tracing verbose. + + * src/gxvalid/gxvprop.c: Add tracing messages for errors. + +2011-06-19 suzuki toshiya + + [autogen.sh] Reflect environment variable LIBTOOLIZE. + +2011-06-18 Werner Lemberg + + Update license documentation. + + * docs/GPL.TXT: Renamed to... + * docs/GPLv2.TXT: This. + + * docs/LICENSE.TXT: Updated. + +2011-06-14 suzuki toshiya + + Fix g++4.6 compiler warnings in module drivers. + + The background is same with previous commit. + + * src/truetype/ttgxvar.c (ft_var_readpackedpoints): + Init `points'. (TT_Vary_Get_Glyph_Deltas): Init + `delta_xy'. (TT_Get_MM_Var): Init `mmvar'. + * src/type1/t1load.c (T1_Get_MM_Var): Ditto. + * src/cff/cffdrivr.c (cff_ps_get_font_info): Init + `font_info'. + * src/cff/cffload.c (cff_index_get_pointers): Init `t'. + (cff_font_load): Init `sub'. + * src/cff/cffobjs.c (cff_size_init): Init `internal'. + (cff_face_init): Init `cff'. + * src/pfr/pfrload.c (pfr_extra_item_load_stem_snaps): + Init `snaps'. + * src/pcf/pcfread.c (pcf_get_properties): Init `properties'. + (pcf_get_bitmaps): Init `offsets'. (pcf_get_encodings): + Init `tmpEncoding'. + * src/sfnt/ttload.c (tt_face_load_gasp): Init `gaspranges'. + * src/sfnt/ttsbit.c (Load_SBit_Image): Init `components'. + * src/cache/ftcmru.c (FTC_MruList_New): Init `node'. + * src/gzip/ftgzip.c (FT_Stream_OpenGzip): Init `zip' and + `zip_buff'. + * src/lzw/ftlzw.c (FT_Stream_OpenLZW): Init `zip'. + * src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Init `zip'. + +2011-06-14 suzuki toshiya + + [base] Fix g++4.6 compiler warnings in src/base/*.c. + + Passing uninitialized pointer to FT_NEW() families is + not problematic theoretically (as far as the returned + pointer is checked before writing), but g++4.6 dislikes + it and warns by -Wuninitialized. Initialize them by NULL. + + * src/base/ftobjs.c (FT_Stream_New): Init `stream'. + (new_memory_stream): Ditto. + (FT_New_GlyphSlot): Init `slot'. + (FT_CMap_New): Init `cmap'. + (open_face_PS_from_sfnt_stream): Init `sfnt_ps'. + (Mac_Read_POST_Resource): Init `pfb_data'. + (Mac_Read_sfnt_Resource): Init `sfnt_data'. + * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): + Init `offsets_internal' and `ref'. + (raccess_guess_darwin_hfsplus): Init `newpath'. + (raccess_guess_darwin_newvfs): Ditto. + * src/base/ftbitmap.c (ft_bitmap_assure_buffer): + Init `buffer'. + * src/base/ftstroke.c (FT_Stroker_New): Init `stroker'. + +2011-06-14 suzuki toshiya + + [gxvalid] Cleanup. + + Some invalid, overrunning, unrecommended non-zero values + are cared in paranoid validation mode only. There are + many lines looking like: + + if ( valid->root->level >= FT_VALIDATE_PARANOID ) + FT_INVALID_xxx; + + To simplify them, GXV_SET_ERR_IF_PARANOID( err ) is + introduced for more paranoid validation in future. + + * src/gxvalid/gxvcommn.h (IS_PARANOID_VALIDATION): + New macro to assure valid->root->level is more or + equal to FT_VALIDATE_PARANOID. (GXV_SET_ERR_IF_PARANOID): + New macro to raise an error if in paranoid validation. + * src/gxvalid/gxvcommn.c: Use GXV_SET_ERR_IF_PARANOID(). + * src/gxvalid/gxvfeat.c: Ditto. + * src/gxvalid/gxvjust.c: Ditto. + * src/gxvalid/gxvkern.c: Ditto. + * src/gxvalid/gxvmort.c: Ditto. + * src/gxvalid/gxvmort0.c: Ditto. + * src/gxvalid/gxvmort1.c: Ditto. + * src/gxvalid/gxvmort2.c: Ditto. + * src/gxvalid/gxvmorx1.c: Ditto. + * src/gxvalid/gxvmorx2.c: Ditto. + +2011-06-14 suzuki toshiya + + [gxvalid] Fix gcc4.6 compiler warnings in gxvtrak.c. + + * src/gxvalid/gxvtrak.c (gxv_trak_trackTable_validate): + Check different entries pointing same traking value. + (gxv_trak_validate): Remove unused variable `table_size'. + +2011-06-14 suzuki toshiya + + [gxvalid] Fix gcc4.6 compiler warnings in gxvmorx*.c. + + * src/gxvalid/gxvmorx.c (gxv_morx_subtables_validate): + Conditionalize unvalidated variable `subFeatureFlags'. + (gxv_morx_chain_validate): Conditionalize unvalidated + variable `defaultFlags'. + + * src/gxvalid/gxmorx0.c + (gxv_morx_subtable_type0_entry_validate): + Conditionalize unvalidated variables; `markFirst', + `dontAdvance', `markLast', `verb'. + + * src/gxvalid/gxmorx1.c + (gxv_morx_subtable_type1_entry_validate): Conditionalize + unvalidated variables; `setMark', `dontAdvance'. + + * src/gxvalid/gxvmorx2.c + (gxv_morx_subtable_type2_ligActionOffset_validate): + Conditionalize unvalidated variables; `last', `store'. + Checking for overrunning offset is added. + (gxv_morx_subtable_type2_entry_validate): + Conditionalize unvalidated variables; `setComponent', + `dontAdvance', `performAction'. + (gxv_morx_subtable_type2_ligatureTable_validate): + Check if the GID for ligature does not exceed the + max GID in `maxp' table. + + * src/gxvalid/gxvmort5.c + (gxv_morx_subtable_type5_InsertList_validate): + Conditionalize unvalidated loading of `insert_glyphID' + array. (gxv_morx_subtable_type5_entry_validate): + Conditionalize unvalidated variables; `setMark', + `dontAdvance', `currentIsKashidaLike', + `markedIsKashidaLike', `currentInsertBefore', + `markedInsertBefore'. + +2011-06-14 suzuki toshiya + + [gxvalid] Fix gcc4.6 compiler warnings in gxvmort*.c. + + * src/gxvalid/gxvmort.c (gxv_mort_subtables_validate): + Conditionalize unvalidated variable `subFeatureFlags'. + (gxv_mort_chain_validate): Conditionalize unvalidated + variable `defaultFlags'. + + * src/gxvalid/gxmort0.c + (gxv_mort_subtable_type0_entry_validate): Check the + conflict of the marks for the glyphs. + + * src/gxvalid/gxmort1.c + (gxv_mort_subtable_type1_offset_to_subst_validate): + Local variables `min_gid', `max_gid' are replaced by + variables in the validator. + (gxv_mort_subtable_type1_entry_validate): Conditionalize + unvalidated variables; `setMark', `dontAdvance'. + (gxv_mort_subtable_type1_substTable_validate): + Validate the GID by the min/max GIDs in the validator. + + * src/gxvalid/gxvmort2.c + (gxv_mort_subtable_type2_ligActionOffset_validate): + Conditionalize unvalidated variables; `last', `store'. + Checking for overrunning offset is added. + (gxv_mort_subtable_type2_entry_validate): + Conditionalize unvalidated variables; `setComponent', + `dontAdvance'. + (gxv_mort_subtable_type2_ligatureTable_validate): + Check if the GID for ligature does not exceed the + max GID in `maxp' table. + + * src/gxvalid/gxvmort5.c + (gxv_mort_subtable_type5_InsertList_validate): + Conditionalize unvalidated loading of `insert_glyphID' + array. (gxv_mort_subtable_type5_entry_validate): + Conditionalize unvalidated variables; `setMark', + `dontAdvance', `currentIsKashidaLike', + `markedIsKashidaLike', `currentInsertBefore', + `markedInsertBefore'. + +2011-06-14 suzuki toshiya + + [gxvalid] Fix gcc4.6 compiler warnings in gxvkern.c. + + * src/gxvalid/gxvkern.c + (gxv_kern_subtable_fmt0_pairs_validate): Conditionalize + unvalidated variable `kernValue'. + (gxv_kern_subtable_fmt1_entry_validate): Conditionalize + unvalidated variables; `push', `dontAdvance', `kernAction', + `kernValue'. + (gxv_kern_coverage_new_apple_validate): Conditionalize + trace-only variables; `kernVertical', `kernCrossStream', + `kernVariation'. + (gxv_kern_coverage_classic_apple_validate): Conditionalize + trace-only variables; `horizontal', `cross_stream'. + (gxv_kern_coverage_classic_microsoft_validate): + Conditionalize trace-only variables; `horizontal', + `minimum', `cross_stream', `override'. + (gxv_kern_subtable_validate): Conditionalize trace-only + variables; `version', `tupleIndex'. + +2011-06-14 suzuki toshiya + + [gxvalid] Fix gcc4.6 compiler warnings in gxvjust.c. + + * src/gxvalid/gxvjust.c (gxv_just_check_max_gid): + New function to unify the checks of too large GID. + (gxv_just_wdp_entry_validate): Conditionalize unvalidated + variables; `beforeGrowLimit', `beforeShrinkGrowLimit', + `afterGrowLimit', `afterShrinkGrowLimit', `growFlags', + `shrinkFlags'. Additional check for non-zero values in + unused storage `justClass' is added. + (gxv_just_actSubrecord_type0_validate): Conditionalize + unvalidated variable `order'. GID is checked by + gxv_just_check_max_gid(). Additional check for upside-down + relationship between `lowerLimit' and `upperLimit' is added. + (gxv_just_actSubrecord_type1_validate): GID is checked by + gxv_just_check_max_gid(). + (gxv_just_actSubrecord_type2_validate): Conditionalize + unvalidated variable `substThreshhold'. GID is checked by + gxv_just_check_max_gid(). + (gxv_just_actSubrecord_type5_validate): GID is checked by + gxv_just_check_max_gid(). + (gxv_just_classTable_entry_validate): Conditionalize + unvalidated variables; `setMark', `dontAdvance', + `markClass', `currentClass'. + +2011-06-14 suzuki toshiya + + [gxvalid] Preparation to fix gcc4.6 compiler warnings. + + * src/gxvalid/gxvcommn.h (GXV_LOAD_TRACE_VARS): New macro to + conditionalize the variable which is only used for trace messages. + Automatically set by FT_DEBUG_LEVEL_TRACE. + (GXV_LOAD_UNUSED_VARS): New macro to conditionalize the loading of + unvalidated variables. Undefined by default to calm gcc4.6 warning. + (GXV_ValidatorRec.{min_gid,max_gid}): New variables to hold defined + GID ranges, for the comparison of GID ranges in different subtables. + +2011-06-08 Werner Lemberg + + [autofit] Remove unused structure member. + + * src/autofit/afhints.h (AF_SegmentRec): Remove `contour'. + * src/autofit/aflatin.c (af_latin_hints_compute_segments), + src/autofit/aflatin2.c (af_latin2_hints_compute_segments): Updated. + +2011-05-30 Werner Lemberg + + Fix g++ 4.6 compilation. + + * src/autofit/afhints.c (af_glyph_hints_dump_segments, + af_glyph_hints_dump_edges): Use cast. + +2011-05-30 Werner Lemberg + + Fix gcc 4.6 compiler warnings. + + * src/autofit/afcjk.c (af_cjk_metrics_init_blues): Use casts and + remove unused variables. + * src/autofit/aflatin.c (af_latin_hints_compute_edges): Comment out + `up_dir'. + * src/smooth/ftsmooth.c (ft_smooth_render_generic): Use `height_org' + and `width_org' conditionalized. + +2011-05-28 suzuki toshiya + + [mac] Conditionalize the inclusion of `AvailabilityMacros.h'. + + The native SDK on earliest Mac OS X (10.0-10.1) did not have + `AvailabilityMacros.h'. To prevent the inclusion of missing + header file, ECANCELED (introduced in 10.2) in POSIX header + file is checked to detect the system version. + + * include/freetype/config/ftconfig.h: Conditionalize the + inclusion of `AvailabilityMacros.h'. + * builds/unix/ftconfig.in: Ditto. + * builds/vms/ftconfig.h: Ditto. + +2011-05-27 Werner Lemberg + + [autofit] Improve tracing of hinting process. + + * src/autofit/aflatin.c (af_latin_hint_edges): Add tracing message + `ADJUST'. + +2011-05-26 Werner Lemberg + + [autofit] Fix trace message. + + * src/autofit/aflatin.c (af_latin_hint_edges): Show correct value in + tracing message. + +2011-05-24 Daniel Zimmermann + + Reduce warnings for MS Visual Studio 2010. + + * src/autofit/afhints.c (af_glyph_hints_get_num_segments, + af_glyph_hints_get_segment_offset) [!FT_DEBUG_AUTOFIT]: Provide + return value. + * src/cff/cffgload.c (cff_slot_load): Add cast. + * src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): Use proper + loop variable type. + +2011-05-16 suzuki toshiya + + Automake component `builds/unix/install-sh' is removed. + + * builds/unix/install-sh: Removed. It is not needed to + include repository, because autogen.sh installs it. + * builds/unix/.gitignore: Register install-sh. + +2011-05-12 suzuki toshiya + + [autofit] Make trace message for CJK bluezone more verbose. + +2011-05-08 Just Fill Bugs + suzuki toshiya + + [autofit] Add bluezones for CJK Ideographs. + + To remove extremas of vertical strokes of CJK Ideographs at + low resolution and make the top and bottom horizontal stems + aligned, bluezones for CJK Ideographs are calculated from + sample glyphs. At present, vertical bluezones (bluezones + to align vertical stems) are disabled by default. For detail, see + http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00070.html + http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00092.html + http://lists.gnu.org/archive/html/freetype-devel/2011-05/msg00001.html + + * include/freetype/internal/fttrace.h: New trace component `afcjk'. + * src/autofit/afcjk.h (AF_CJK{Blue,Axis,Metric}Rec): Add CJK version + for AF_Latin{Blue,Axis,Metric}Rec. + (af_cjk_metrics_check_digits): Ditto, shared with Indic module. + (af_cjk_metrics_init_widths): Ditto. + (af_cjk_metrics_init): Take AF_CJKMetric instead of AF_LatinMetric. + (af_cjk_metrics_scale): Ditto (declaration). + (af_cjk_hints_init): Ditto (declaration). + (af_cjk_hints_apply): Ditto (declaration). + * src/autofit/afcjk.c (af_cjk_metrics_scale): Ditto (body). + (af_cjk_hints_init): Ditto (body). + (af_cjk_hints_apply): Ditto (body). + (af_cjk_metrics_init_widths): Duplicate af_latin_metrics_init_widths. + (af_cjk_metrics_check_digits): Duplicate af_latin_metrics_check_digits. + (af_cjk_metrics_init): Call CJK bluezone initializer. + (af_cjk_metrics_scale_dim): Add code to scale bluezones. + (af_cjk_hints_compute_blue_edges): New function, CJK version of + af_latin_hints_compute_blue_edges. + (af_cjk_metrics_init_blues): New function, CJK version of + af_latin_metrics_init_blues. + (af_cjk_hints_edges): Add code to align the edge stems to blue zones. + + * src/autofit/afindic.c (af_indic_metrics_init): Take AF_CJKMetric + instead of AF_LatinMetric, and initialize as af_cjk_metrics_init. + However bluezones are not initialized. + (af_indic_metrics_scale): Take AF_CJKMetric instead of AF_LatinMetric. + (af_indic_hints_init): Ditto. + (af_indic_hints_apply): Ditto. + + * docs/CHANGES: Note about CJK bluezone support. + +2011-05-06 Werner Lemberg + + [autofit] Remove unused struct member. + + * src/autofit/aflatin.h (AF_LatinAxis): Remove `control_overshoot'. + +2011-05-04 Werner Lemberg + + * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Simplify. + +2011-05-01 Just Fill Bugs + Werner Lemberg + + [autofit] Add more debugging functions. + + * src/autofit/afhints.c (af_glyph_hints_get_num_segments, + af_glyph_hints_get_segment_offset): New functions. + +2011-05-01 suzuki toshiya + + Add new option `--disable-mmap' to configure script. + + * builds/unix/configure.raw: New option `--disable-mmap' + is added. It is for the developers to simulate the systems + without mmap() (like 4.3BSD, minix etc) on POSIX systems. + +2011-04-30 suzuki toshiya + + [truetype] Always recalculate the sfnt table checksum. + + * src/truetype/ttobjs.c (tt_get_sfnt_checksum): Recalculate + the sfnt table checksum even if non-zero value is written in + the TrueType font header. Some bad PDF generators write + wrong values. For details see examples and benchmark tests + of the latency by recalculation: + http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00091.html + http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00096.html + +2011-04-30 suzuki toshiya + + [truetype] Register a set of tricky fonts, NEC FA family. + + * src/truetype/ttobjs.c (tt_check_trickyness_sfnt_ids): + Add 8 checksum sets for NEC FA family. For the tricky fonts + without some tables (e.g. NEC FA fonts lack cvt table), + extra check is added to assure that a zero-length table in the + registry is not included in the font. + +2011-04-29 suzuki toshiya + + [truetype] Fix a bug in the sfnt table checksum getter. + + * src/truetype/ttobjs.c (tt_get_sfnt_checksum): Check the + return value of face->goto_table() correctly. + +2011-04-28 Werner Lemberg + + [autofit] Improve tracing messages. + + * src/autofit/aflatin.c (af_latin_metrics_init_blues, + af_latin_align_linked_edge, af_latin_hint_edges): Do it. + +2011-04-25 Kan-Ru Chen + + [truetype] Always check the checksum to identify tricky fonts. + + Because some PDF generators mangle the family name badly, + the trickyness check by the checksum should be invoked always. + For sample PDF, see + http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00073.html + + * src/truetype/ttobjs.c (tt_check_trickyness): Even when + tt_check_trickyness_family() finds no trickyness, + tt_check_trickyness_sfnt_ids() is invoked. + +2011-04-22 suzuki toshiya + + [autofit] Add more Indic scripts with hanging baseline. + + * src/autofit/afindic.c (af_indic_uniranges): Tibetan, Limbu, + Sundanese, Meetei Mayak, Syloti Nagri and Sharada scripts are + added. + +2011-04-21 Behdad Esfahbod + + Always ignore global advance. + + This makes FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH redundant, + deprecated, and ignored. The new behavior is what every major user + of FreeType has been requesting. Global advance is broken in many + CJK fonts. Just ignoring it by default makes most sense. + + * src/truetype/ttdriver.c (tt_get_advances), + src/truetype/ttgload.c (TT_Get_HMetrics, TT_Get_VMetrics, + tt_get_metrics, compute_glyph_metrics, TT_Load_Glyph), + src/truetype/ttgload.h: Implement it. + + * docs/CHANGES: Updated. + +2011-04-21 rainy6144 + + [autofit] Blur CJK stems if too many to preserve their gaps. + + When there are too many stems to preserve their gaps in the + rasterization of CJK Ideographs at a low resolution, blur the + stems instead of showing clumped stems. See + http://lists.gnu.org/archive/html/freetype-devel/2011-02/msg00011.html + http://lists.gnu.org/archive/html/freetype-devel/2011-04/msg00046.html + for details. + + * src/autofit/afcjk.c (af_cjk_hint_edges): Store the position of + the previous stem by `has_last_stem' and `last_stem_pos', and skip + a stem if the current and previous stem are too near to preserve + the gap. + +2011-04-18 Werner Lemberg + + Integrate autofitter debugging stuff. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (FT_DEBUG_AUTOFIT): New macro. + + * include/freetype/internal/fttrace.h: Add trace components for + autofitter. + + * src/autofit/aftypes.h (AF_LOG): Removed. + (_af_debug): Removed. + + * src/autofit/*: s/AF_DEBUG/FT_DEBUG_AUTOFIT/. + s/AF_LOG/FT_TRACE5/. + Define FT_COMPONENT where necessary. + +2011-04-18 Werner Lemberg + + Synchronize config files. + + * builds/unix/ftconfig.in: Copy missing assembler routines from + include/freetype/config/ftconfig.h. + +2011-04-13 Werner Lemberg + + [psaux] Fix Savannah bug #33047. + + Patch submitted by anonymous reporter. + + * src/psaux/psobjs.c (ps_table_add): Use FT_PtrDist for pointer + difference. + +2011-04-11 Kan-Ru Chen + + Fix reading of signed integers from files on 64bit platforms. + + Previously, signed integers were converted to unsigned integers, but + this can fail because of sign extension. For example, 0xa344a1eb + becomes 0xffffffffa344a1eb. + + We now do the reverse which is always correct because the integer + size is the same during the cast from unsigned to signed. + + * include/freetype/internal/ftstream.h, src/base/ftstream.c + (FT_Stream_Get*): Replace with... + (FT_Stream_GetU*): Functions which read unsigned integers. + Update all macros accordingly. + + * src/gzip/ftgzip.c (ft_gzip_get_uncompressed_size): Updated. + +2011-04-07 Werner Lemberg + + Update Unicode ranges for CJK autofitter; in particular, add Hangul. + + * src/autofit/afcjk.c (af_cjk_uniranges): Update to Unicode 6.0. + +2011-04-04 Werner Lemberg + + Fix formatting of autofit debug dumps. + + * src/autofit/afhints.c (af_glyph_hints_dump_points, + af_glyph_hints_dump_segments, af_glyph_hints_dump_edges): Adjust + column widths. + +2011-03-30 Werner Lemberg + + * src/autofit/aftypes.h (AF_OutlineRec): Removed, unused. + +2011-03-24 Werner Lemberg + + * src/cff/cfftypes.h (CFF_MAX_CID_FONTS): Increase to 256. + This limit is given on p. 37 of Adobe Technical Note #5014. + +2011-03-23 Werner Lemberg + + * src/truetype/ttpload.c (tt_face_load_loca): Fix mismatch warning. + +2011-03-20 Werner Lemberg + + * src/sfnt/sfobjs.c (sfnt_open_font): Check number of TTC subfonts. + +2011-03-19 Werner Lemberg + + More C++ compilation fixes. + + * src/autofit/afhints.c (af_glyph_hints_dump_points, + af_glyph_hints_dump_segments, af_glyph_hints_dump_edges) + [__cplusplus]: Protect with `extern "C"'. + +2011-03-18 Werner Lemberg + + C++ compilation fixes. + + * src/autofit/aflatin.c (af_latin_hints_apply), src/autofit/afcjk.c + (af_cjk_hints_apply): Use cast for `dim'. + +2011-03-17 Alexei Podtelezhnikov + + A better fix for Savannah bug #32671. + + * src/smooth/ftgrays.c (gray_render_conic): Clean up code and + replace WHILE loop with a more natural DO-WHILE construct. + +2011-03-16 Werner Lemberg . + + * src/base/ftstroke.c (FT_StrokerRec): Remove unused `valid' field. + Suggested by Graham Asher. + +2011-03-09 Werner Lemberg + + Make FT_Sfnt_Table_Info return the number of SFNT tables. + + * src/sfnt/sfdriver.c (sfnt_table_info): Implement it. + * include/freetype/tttables.h: Update documentation. + * docs/CHANGES: Updated. + +2011-03-07 Bram Tassyns + + [cff] Fix Savannah bug #27988. + + * src/cff/cffobjs.c (remove_style): New function. + (cff_face_init): Use it to strip off the style part of the family + name. + +2011-03-07 Werner Lemberg + + * docs/CHANGES: Updated. + +2011-03-07 Alexei Podtelezhnikov + + Quick fix for Savannah bug #32671. + + This isn't the optimal solution yet, but it restores the previous + rendering quality (more or less). + + * src/smooth/ftgrays.c (gray_render_conic): Do more splitting. + +2011-03-06 Werner Lemberg + + Fix autohinting fallback. + + * src/base/ftobjs.c (FT_Load_Glyph): Assure that we only check TTFs, + ignoring CFF-based OTFs. + +2011-02-27 Werner Lemberg + + Add AF_CONFIG_OPTION_USE_WARPER to control the autofit warper. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (AF_CONFIG_OPTION_USE_WARPER): New macro. + * src/autofit/aftypes.h (AF_USE_WARPER): Remove. + + * src/autofit/*: s/AF_USE_WARPER/AF_CONFIG_OPTION_USE_WARPER/. + + * src/autofit/afwarp.c [!AF_CONFIG_OPTION_USE_WARPER]: Replace dummy + variable assignment with a typedef. + +2011-02-26 Werner Lemberg + + [autofit] Slight simplifications. + + * src/autofit/aflatin.c (af_latin_hints_link_segments): Remove + test which always returns false. + (af_latin_hints_compute_blue_edges): Remove redundant assignment. + +2011-02-24 Werner Lemberg + + * docs/PROBLEMS: Mention rendering differences on different + platforms. + Suggested and worded by Jason Owen . + +2011-02-24 Werner Lemberg + + [autofit] Comment out unused code. + + * src/autofit/aflatin.c, src/autofit/aflatin2.c + (af_latin_hints_compute_edges): Do it. + +2011-02-24 Werner Lemberg + + * src/autofit/afhints.h (AF_GlyphHints): Remove unused field. + +2011-02-20 suzuki toshiya + + [cache] Fix an off-by-one bug in `FTC_Manager_RemoveFaceID'. + Found by , see detail in + + http://lists.gnu.org/archive/html/freetype/2011-01/msg00023.html + + * src/cache/ftccache.c (FTC_Cache_RemoveFaceID): Check the node + buckets[cache->p + cache->mask] too. + +2011-02-19 Kevin Kofler + + Fall back to autohinting if a TTF/OTF doesn't contain any bytecode. + This is Savannah patch #7471. + + * src/base/ftobjs.c (FT_Load_Glyph): Implement it. + +2011-02-19 John Tytgat + + [cff] Fix subset prefix removal. + This is Savannah patch #7465. + + * src/cff/cffobjs.c (remove_subset_prefix): Update length after + subset prefix removal. + +2011-02-13 Bradley Grainger + + Add inline assembly version of FT_MulFix for MSVC. + + * include/freetype/config/ftconfig.h: Ported the FT_MulFix_i386 + function from GNU inline assembly syntax (see #ifdef __GNUC__ block + above) to MASM syntax for Microsoft Visual C++. + +2011-02-13 Bradley Grainger + + Add project and solution files in Visual Studio 2010 format. + + * builds/win32/.gitignore: Ignore user-specific cache files. + * builds/win32/vc2010/: Add VS2010 project & solution files, created + by upgrading builds/win32/vc2008/freetype.vcproj. + * objs/.gitignore: Ignore Visual Studio output files. + +2011-02-01 Werner Lemberg + + * src/autofit/afdummy.c: Include `aferrors.h'. + Problem reported by Chris Liddell . + +2011-02-01 Werner Lemberg + + [cff] Ignore unknown operators in charstrings. + Patch suggested by Miles.Lau . + + * src/cff/cffgload.c (cff_decoder_parse_charstrings): Emit tracing + message for unknown operators and continue instead of exiting with a + syntax error. + +2011-02-01 Werner Lemberg + + [truetype] FT_LOAD_PEDANTIC now affects `prep' and `fpgm' also. + + * src/truetype/ttgload.c (tt_loader_init): Handle + `FT_LOAD_PEDANTIC'. + * src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep, + tt_size_init_bytecode, tt_size_ready_bytecode): New argument to + handle pedantic mode. + * src/truetype/ttobjs.h: Updated. + +2011-01-31 Werner Lemberg + + [truetype] Protect jump instructions against endless loops. + + * src/truetype/interp.c (DO_JROT, DO_JMPR, DO_JROF): Exit with error + if offset is zero. + +2011-01-31 Werner Lemberg + + [truetype] Improve handling of invalid references. + + * src/truetype/interp.c: Set even more TT_Err_Invalid_Reference + error codes only if pedantic hinting is active. At the same time, + try to provide sane values which hopefully allow useful + continuation. Exception to this is CALL and LOOPCALL – due to + possible stack corruption it is necessary to bail out. + +2011-01-31 Werner Lemberg + + [truetype] Improve handling of stack underflow. + + * src/truetype/ttinterp.c (TT_RunIns, Ins_FLIPPT, Ins_DELTAP, + Ins_DELTAC): Exit with error only if `pedantic_hinting' is set. + Otherwise, try to do something sane. + +2011-01-30 Werner Lemberg + + * src/sfnt/ttmtx.c (tt_face_load_hmtx): Fix tracing message. + +2011-01-30 LIU Sun-Liang + + [truetype]: Fix behaviour of MIAP for invalid arguments. + + * src/truetype/ttinterp.c (Ins_MIAP): Set reference points even in + case of error. + +2011-01-18 Werner Lemberg + + [truetype] Fix handling of MIRP instruction. + + Thanks to Greg Hitchcock who explained the issue. + + * src/truetype/ttinterp.c (Ins_MIRP): Replace a `>=' operator with + `>' since the description in the specification is incorrect. + This fixes, for example, glyph `two' in font `Helvetica Neue LT Com + 65 medium' at 15ppem. + +2011-01-15 suzuki toshiya + + Fix ARM assembly code in include/freetype/config/ftconfig.h. + + * include/freetype/config/ftconfig.h (FT_MulFix_arm): + Copy the maintained code from builds/unix/ftconfig.in. + Old GNU binutils could not accept the reduced syntax + `orr %0, %2, lsl #16'. Un-omitted syntax like RVCT, + `orr %0, %0, %2, lsl #16' is better. Reported by + Johnson Y. Yan. The bug report by Qt developers is + considered too. + + http://bugreports.qt.nokia.com/browse/QTBUG-6521 + +2011-01-15 Werner Lemberg + + [raster] Make bbox handling the same as with Microsoft's rasterizer. + + Right before B/W rasterizing, the bbox gets simply rounded to + integers. This fixes, for example, glyph `three' in font `Helvetica + Neue LT Com 65 Medium' at 11ppem. + + Thanks to Greg Hitchcock who explained this behaviour. + + * src/raster/ftrend1.c (ft_raster1_render): Implement it. + +2011-01-15 suzuki toshiya + + Copy -mcpu=* & -march=* options from CFLAGS to LDFLAGS. + + * builds/unix/configure.raw: Consider recent gcc-standard + flags to specify architecture in CFLAGS & LDFLAGS + harmonization. Requested by Savannah bug #32114, to + support multilib feature of BuildRoot SDK correctly. + +2011-01-15 suzuki toshiya + + Fix off-by-one bug in CFLAGS & LDFLAGS harmonizer. + + * builds/unix/configure.raw: Some important options that + included in CFLAGS but not in LDFLAGS are copied to + LDFLAGS, but the last option in CFLAGS was not checked. + +2011-01-13 Werner Lemberg + + [raster] Add undocumented drop-out rule to the other bbox side also. + + * src/raster/ftraster.c (Vertical_Sweep_Drop, + Horizontal_Sweep_Drop): Implement it. + +2011-01-13 Werner Lemberg + + [raster] Reduce jitter value. + + This catches a rendering problem with glyph `x' from Tahoma at + 10ppem. It seems that the increase of the precision in the change + from 2009-06-11 makes a larger jitter value unnecessary. + + * src/raster/ftraster.c (Set_High_Precision): Implement it. + +2011-01-13 Werner Lemberg + + [raster] Handle drop-outs at glyph borders according to Microsoft. + + If a drop-out rule would switch on a pixel outside of the glyph's + bounding box, use the right (or top) pixel instead. This is an + undocumented feature, but some fonts like `Helvetica Neue LT Com 65 + Medium' heavily rely on it. + + Thanks to Greg Hitchcock who explained this behaviour. + + * src/raster/ftraster.c (Vertical_Sweep_Drop, + Horizontal_Sweep_Drop): Implement it. + +2011-01-09 suzuki toshiya + + [cache] Fix Savannah bug #31923, patch drafted by Harsha. + + When a node comparator changes the cached nodes during the + search of a node matching with queried properties, the + pointers obtained before the function should be updated to + prevent the dereference to freed or reallocated nodes. + To minimize the rescan of the linked list, the update is + executed when the comparator notifies the change of cached + nodes. This change depends previous change: + 38b272ffbbdaae276d636aec4ef84af407d16181 + + * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Rescan the + top node if the cached nodes are changed. + * src/cache/ftccache.c (FTC_Cache_Lookup): Ditto. + +2011-01-09 suzuki toshiya + + [cache] Notice if a cache query induced the node list change. + + Some node comparators (comparing the cache node contents and the + properties specified by the query) can flush the cache node to + prevent the cache inflation. The change may invalidate the pointers + to the node obtained before the node comparison, so it should be + noticed to the caller. The problem caused by the cache node + changing is reported by Harsha, see Savannah bug #31923. + + * src/cache/ftccache.h (FTC_Node_CompareFunc): Add new argument + `FT_Bool* list_changed' to indicate the change of the cached nodes + to the caller. + (FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes by + `_list_changed'. + (FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed' + and update it when `FTC_Manager_FlushN' flushes any nodes. + + * src/cache/ftccback.h (ftc_snode_compare): Updated to fit with new + FTC_Node_CompareFunc type. + (ftc_gnode_compare): Ditto. + + * src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to use + TRUE/FALSE macros. + (ftc_basic_gnode_compare_faceid): New argument `FT_Bool* + list_changed' to indicate the change of the cache nodes (anyway, it + is always FALSE). + + * src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to use + TRUE/FALSE macros. + (ftc_cmap_node_compare): New argument `FT_Bool* list_changed' to + indicate the change of the cache nodes (anyway, it is always FALSE). + (ftc_cmap_node_remove_faceid): Ditto. + + * src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL pointer to + `FTC_CACHE_TRYLOOP_END', because the result is not needed. + (FTC_Cache_Lookup): Watch the change of the cache nodes by + `list_changed'. + (FTC_Cache_RemoveFaceID): Ditto. + + * src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to use + TRUE/FALSE macros. + (ftc_gnode_compare): New argument `FT_Bool* list_changed' to + indicate the change of the cache nodes (anyway, it is always FALSE). + (FTC_GNode_Compare): New argument `FT_Bool* list_changed' to be + passed to `ftc_gnode_compare'. + * src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto. + + * src/cache/ftcsbits.c (ftc_snode_compare): New argument `FT_Bool* + list_changed' to indicate the change of the cache nodes, anyway. It + is updated by `FTC_CACHE_TRYLOOP'. + (FTC_SNode_Compare): New argument `FT_Bool* list_changed' to be + passed to `ftc_snode_compare'. + * src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto. + +2011-01-09 suzuki toshiya + + [cache] Fit `FTC_GNode_Compare' to `FTC_Node_CompareFunc'. + + * src/cache/ftcglyph.h (FTC_GNode_Compare): Add the 3rd + argument `FTC_Cache cache' to fit FTC_Node_CompareFunc + prototype. + * src/cache/ftcglyph.c (FTC_GNode_Compare): Ditto. Anyway, + `cache' is not used by its child `ftc_gnode_compare'. + +2011-01-09 suzuki toshiya + + [cache] Deduplicate the code to get the top node by a hash. + + There are several duplicated code fragments getting the top node + from a cache by a given hash, like: + + idx = hash & cache->mask; + if ( idx < cache->p ) + idx = hash & ( cache->mask * 2 + 1 ); + pnode = cache->buckets + idx; + + To remove duplication, a cpp-macro to do same work + `FTC_NODE__TOP_FOR_HASH' is introduced. For non-inlined + configuration, non-`ftc_get_top_node_for_hash' is also introduced. + + * src/cache/ftccache.h (FTC_NODE__TOP_FOR_HASH): Declare + and implement inlined version. + (FTC_CACHE_LOOKUP_CMP): Use `FTC_NODE__TOP_FOR_HASH'. + * src/cache/ftccache.c (ftc_get_top_node_for_hash): Non-inlined + version. + (ftc_node_hash_unlink): Use `FTC_NODE__TOP_FOR_HASH'. + (ftc_node_hash_link): Ditto. + (FTC_Cache_Lookup): Ditto. + +2011-01-09 suzuki toshiya + + [cache] inline-specific functions are conditionalized. + + * src/cache/ftcglyph.c (FTC_GNode_Compare): Conditionalized for + inlined configuration. This function is a thin wrapper of + `ftc_gnode_compare' for inlined `FTC_CACHE_LOOKUP_CMP' (see + `nodecmp' argument). Under non-inlined configuration, + `ftc_gnode_compare' is invoked by `FTC_Cache_Lookup', via + `FTC_Cache->clazz.node_compare'. + + * src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto. + * src/cache/ftcsbits.c (FTC_SNode_Compare): Ditto, for + `ftc_snode_compare'. + * src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto. + +2011-01-09 suzuki toshiya + + [cache] Correct a type mismatch under non-inlined config. + + * src/cache/ftcglyph.h (FTC_GCACHE_LOOKUP_CMP): `FTC_GCache_Lookup' + takes the node via a pointer `FTC_Node*', differently from cpp-macro + `FTC_CACHE_LOOKUP_CMP'. + +2011-01-06 suzuki toshiya + + Update Jamfile to include Bzip2 support. + + * Jamfile: Include src/bzip2 to project. + Comments for lzw, gzip, bzip2 are changed to clarify that + they are for compressed PCF fonts, not others. + (e.g. compressed BDF fonts are not supported yet) + +2011-01-05 suzuki toshiya + + Update Symbian project files to include Bzip2 support. + + Currently, it provides `FT_Stream_OpenBzip2' that returns + unimplemented error always, to prevent unresolved symbol + error for the applications designed for Unix systems. + + * builds/symbian/bld.inf: Include ftbzip2.h. + * builds/symbian/freetype.mmp: Include ftbzip2.c. + +2011-01-05 suzuki toshiya + + Update classic MacOS makefiles to include Bzip2 support. + + Currently, it provides `FT_Stream_OpenBzip2' that returns + unimplemented error always, to prevent unresolved symbol + error for the applications designed for Unix systems. + + * builds/mac/FreeType.m68k_cfm.make.txt: Include ftbzip2.c.o. + * builds/mac/FreeType.m68k_far.make.txt: Ditto. + * builds/mac/FreeType.ppc_carbon.make.txt: Include ftbzip2.c.x. + * builds/mac/FreeType.ppc_classic.make.txt: Ditto. + +2011-01-05 suzuki toshiya + + Update Amiga makefiles to include Bzip2 support. + + Currently, it provides `FT_Stream_OpenBzip2' that returns + unimplemented error always, to prevent unresolved symbol + error for the applications designed for Unix systems. + + * builds/amiga/makefile: Include bzip2.ppc.o built from ftbzip2.c. + * builds/amiga/makefile.os4: Include bzip2.o built from ftbzip2.c. + * builds/amiga/smakefile: Ditto. + +2011-01-05 suzuki toshiya + + Update pkg-config tools to reflect Bzip2 support. + + * builds/unix/freetype-config.in: Include `-lbz2' to + --libs output, if built with Bzip2 support. + * builds/unix/freetype2.in: Ditto. + +2011-01-05 suzuki toshiya + + * builds/unix/configure.raw: Remove `SYSTEM_BZ2LIB' macro. + + SYSTEM_ZLIB is used to switch the builtin zlib source + or system zlib source out of FreeType2. But ftbzip2 + module has no builtin bzip2 library and always requires + system bzip2 library. Thus SYSTEM_BZ2LIB is always yes, + it is not used. + +2011-01-03 Werner Lemberg + + */rules.mk: Handle `*pic.c' files. + +2010-12-31 Werner Lemberg + + * src/cff/cfftypes.h (CFF_MAX_CID_FONTS): Increase to 64. + Problem reported by Tom Bishop . + +2010-12-31 Werner Lemberg + + Improve bzip2 support. + + * include/freetype/ftmoderr.h: Add bzip2. + + * docs/INSTALL.ANY, docs/CHANGES: Updated. + + * src/pcf/README: Updated. + * include/freetype/internal/pcftypes.h: Obsolete, removed. + +2010-12-31 Joel Klinghed + + Add bzip2 compression support to handle *.pcf.bz2 files. + + * builds/unix/configure.raw: Test for libbz2 library. + + * devel/ftoption.h, include/freetype/config/ftoption.h + (FT_CONFIG_OPTION_USE_BZIP2): Define. + * include/freetype/config/ftheader.h (FT_BZIP2_H): Define. + + * include/freetype/ftbzip2.h: New file. + + * src/bzip2/*: New files. + + * src/pcf/pcf.h: s/gzip_/comp_/. + * src/pcf/pcfdrvr.c: Include FT_BZIP2_H. + s/gzip_/comp_/. + (PCF_Face_Init): Handle bzip2 compressed files. + + * docs/formats.txt, modules.cfg: Updated. + +2010-12-25 Harsha + + Apply Savannah patch #7422. + + If we encounter a space in a string then the sbit buffer is NULL, + height and width are 0s. So the check in ftc_snode_compare will + always pass for spaces (comparision with 255). Here the comments + above the condition are proper but the implementation is not. When + we create an snode I think it is the proper way to initialize the + width to 255 and then put a check for being equal to 255 in snode + compare function. + + * src/cache/ftcsbits.c (FTC_SNode_New): Initialize sbit widths with + value 255. + (ftc_snode_compare): Fix condition. + +2010-12-13 Werner Lemberg + + Fix parameter handling of `FT_Set_Renderer'. + Reported by Kirill Tishin . + + * src/base/ftobjs.c (FT_Set_Renderer): Increment `parameters'. + +2010-12-09 Werner Lemberg + + [cff] Allow `hlineto' and `vlineto' without arguments. + + We simply ignore such instructions. This is invalid, but it doesn't + harm; and indeed, there exist such subsetted fonts in PDFs. + + Reported by Albert Astals Cid . + + * src/cff/cffgload.c (cff_decoder_parse_charstrings) + [cff_op_hlineto]: Ignore instruction if there aren't any arguments + on the stack. + 2010-11-28 Werner Lemberg * Version 2.4.4 released. @@ -102,9 +3984,9 @@ 2010-11-04 suzuki toshiya - [UVS] Fix find_variant_selector_charmap(), Savannah bug #31545. + [UVS] Fix `find_variant_selector_charmap', Savannah bug #31545. - Since 2010-07-04, find_variant_selector_charmap() returns + Since 2010-07-04, `find_variant_selector_charmap' returns the first cmap subtable always under rogue-compatible configuration, it causes NULL pointer dereference and make UVS-related functions crashed. @@ -150,7 +4032,7 @@ 2010-10-25 suzuki toshiya - Revert a change of `_idx' type in FTC_CACHE_LOOKUP_CMP(). + Revert a change of `_idx' type in `FTC_CACHE_LOOKUP_CMP'. * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Revert the type of `_idx' from FT_PtrDist (by previous change) @@ -162,7 +4044,7 @@ On LLP64 platforms (e.g. Win64), FT_ULong (32-bit) variables are inappropriate to calculate hash values - from the memory address (64-bit). The hash variables + from the memory address (64-bit). The hash variables are extended from FT_ULong to FT_PtrDist and new hashing macro functions are introduced. The hash values on 16-bit memory platforms are changed, but @@ -171,9 +4053,9 @@ address, so using signed type FT_PtrDist is safe. * src/cache/ftccache.h (_FTC_FACE_ID_HASH): New hash - function to replace FTC_FACE_ID_HASH() for portability. - * src/cache/ftcmanag.h (FTC_SCALER_HASH): Replace - FTC_FACE_ID_HASH() by _FTC_FACE_ID_HASH(). + function to replace `FTC_FACE_ID_HASH' for portability. + * src/cache/ftcmanag.h (FTC_SCALER_HASH): Replace + `FTC_FACE_ID_HASH' by `_FTC_FACE_ID_HASH'. * src/cache/ftccmap.c (FTC_CMAP_HASH): Ditto. * src/cache/ftccache.h (FTC_NodeRec): The type of the @@ -196,13 +4078,13 @@ * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Ditto. Also the type of the internal variable `_idx' is changed to FT_PtrDist from FT_UFast for better pointer calculation. - + 2010-10-24 suzuki toshiya [cache] Hide internal macros incompatible with LLP64. - FT_POINTER_TO_ULONG(), FTC_FACE_ID_HASH() and - FTC_IMAGE_TYPE_HASH() are enclosed by + `FT_POINTER_TO_ULONG', `FTC_FACE_ID_HASH', and + `FTC_IMAGE_TYPE_HASH' are enclosed by FT_CONFIG_OPTION_OLD_INTERNALS and hidden from normal clients. @@ -211,10 +4093,10 @@ 2010-10-24 suzuki toshiya - Change the type of FT_MEM_VAL() from FT_ULong to FT_PtrDist. + Change the type of `FT_MEM_VAL' from FT_ULong to FT_PtrDist. On LLP64 platforms (e.g. Win64), unsigned long (32-bit) - cannot cover the memory address (64-bit). FT_MEM_VAL() is + cannot cover the memory address (64-bit). `FT_MEM_VAL' is used for hashing only and not dereferred, so using signed type FT_PtrDist is safe. @@ -257,9 +4139,9 @@ http://trac.macports.org/ticket/18859 * src/base/ftobjs.c (load_face_in_embedded_rfork): - When FT_Stream_New() returns FT_Err_Cannot_Open_Stream, it - means that the file is possible to be fopen()-ed but zero-sized. - Also there is a case that the resource fork is not zero-sized, + When `FT_Stream_New' returns FT_Err_Cannot_Open_Stream, it + means that the file is possible to be `fopen'-ed but zero-sized. + Also there is a case that the resource fork is not zero-sized, but no supported font exists in it. If a rule by Darwin VFS falls into such cases, there is no need to try other Darwin VFS rules anymore. Such cases are marked by vfs_rfork_has_no_font. @@ -273,9 +4155,9 @@ a resource fork via ANSI C or POSIX interface. Current resource fork accessor tries all possible methods to support all kernels. But if a method could open a resource fork but no font is found, - there is no need to try other methods older than tested method. + there is no need to try other methods older than tested method. To determine whether the rule index is for Darwin VFS, a local - function ftrfork.c::raccess_rule_by_darwin_vfs() is introduced. + function `ftrfork.c::raccess_rule_by_darwin_vfs' is introduced. To use this function in ftobjs.c etc but it should be inlined, it is exposed by ftbase.h. @@ -306,14 +4188,14 @@ 2010-10-12 Werner Lemberg - Fix Savannah bug #31310. + [truetype] Fix Savannah bug #31310. * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Protect against invalid `runcnt' values. 2010-10-08 Chris Liddell - Fix Savannah bug #31275. + [sfnt] Fix Savannah bug #31275. * src/sfnt/ttpost.c: Include FT_INTERNAL_DEBUG_H. @@ -372,7 +4254,7 @@ 2010-10-02 Werner Lemberg - Fix Savannah bug #31088 (sort of). + [sfnt] Fix Savannah bug #31088 (sort of). * src/sfnt/ttload.c (tt_face_load_maxp): Always allocate at least 64 function entries. @@ -388,7 +4270,7 @@ 2010-10-01 suzuki toshiya - Fix Savannah bug #31040. + [truetype] Fix Savannah bug #31040. * src/truetype/ttinterp.c (free_buffer_in_size): Remove. (TT_RunIns): Updated. @@ -440,7 +4322,7 @@ * src/cff/cffload.c (cff_index_access_element): `off2', the offset to the next element is truncated at the end of the stream to prevent invalid I/O. As `off1', the offset to the requested element has - been checked by FT_STREAM_SEEK(), `off2' should be checked + been checked by `FT_STREAM_SEEK', `off2' should be checked similarly. 2010-09-19 suzuki toshiya @@ -455,7 +4337,7 @@ 2010-09-19 suzuki toshiya - [cff] Make trace message in cff_charset_load() verbose. + [cff] Make trace message in` cff_charset_load' verbose. See Savannah bug #30975. * src/cff/cffload.c (cff_charset_load): Report the original `nleft' @@ -491,8 +4373,8 @@ See Savannah bug #31040. * src/sfnt/ttpost.c (load_post_names): Get the length of `post' - table and pass the limit of `post' table to load_format_20() and - load_format_25(). + table and pass the limit of `post' table to `load_format_20' and + `load_format_25'. (load_format_20): Stop the parsing when we reached at the limit of `post' table. If more glyph names are required, they are filled by NULL names. @@ -504,9 +4386,9 @@ * src/truetype/ttinterp.c (free_buffer_in_size): Don't duplicate FT_GlyphZoneRec size->twilight to be freed. If duplicated, - FT_FREE() erases the duplicated pointers only and leave original + `FT_FREE' erases the duplicated pointers only and leave original pointers. They can cause the double-free crash when the burst - errors occur in TrueType interpreter and free_buffer_in_size() is + errors occur in TrueType interpreter and `free_buffer_in_size' is invoked repeatedly. 2010-09-15 Werner Lemberg @@ -563,7 +4445,7 @@ * src/truetype/ttinterp.c (TT_RunIns): Decrease the trace level showing the error when the interpreter returns with an error, - from FT_TRACE7() to FT_TRACE1(). + from` FT_TRACE7' to `FT_TRACE1'. 2010-08-30 suzuki toshiya @@ -622,7 +4504,7 @@ 2010-08-17 Teijo Kinnunen - Fix Savannah bug #30788. + [cache] Fix Savannah bug #30788. * src/cache/ftccache.c (FTC_Cache_Clear): Check `cache->buckets' for NULL too. @@ -699,7 +4581,7 @@ 2010-08-05 Werner Lemberg - Fix Savannah bug #30657. + [truetype] Fix Savannah bug #30657. * src/truetype/ttinterp.c (BOUNDSL): New macro. Change `BOUNDS' to `BOUNDSL' where appropriate. @@ -709,7 +4591,7 @@ 2010-08-05 Werner Lemberg - Fix Savannah bug #30656. + [type42] Fix Savannah bug #30656. * src/type42/t42parse.c (t42_parse_sfnts): Protect against negative string_size. @@ -720,7 +4602,7 @@ [cff] Don't use any values in decoder after parsing error. * src/cff/cffgload.c (cff_slot_load): Skip the evaluations - of the values in decoder, if cff_decoder_parse_charstrings() + of the values in decoder, if `cff_decoder_parse_charstrings' returns any error. 2010-08-04 Werner Lemberg @@ -908,7 +4790,7 @@ 2010-07-08 Werner Lemberg - Fix Savannah bug #30361. + [truetype] Fix Savannah bug #30361. * src/truetype/ttinterp.c (Ins_IUP): Fix bounds check. @@ -1029,7 +4911,7 @@ 2010-06-30 Werner Lemberg - Fix Savannah bug #30263. + [smooth] Fix Savannah bug #30263. * src/smooth/ftgrays.c (gray_render_span): Use cast to `unsigned int' to avoid integer overflow. @@ -1120,7 +5002,7 @@ 2010-06-26 Werner Lemberg - Fix Savannah bug #30262. + [sfnt] Fix Savannah bug #30262. * src/sfnt/ttload.c (tt_face_load_maxp): Limit `maxComponentDepth' arbitrarily to 100 to avoid stack exhaustion. @@ -1137,14 +5019,14 @@ 2010-06-25 Werner Lemberg - Fix Savannah bug #30261. + [pfr] Fix Savannah bug #30261. * src/pfr/pfrobjs.c (pfr_face_init): Reject fonts which contain neither outline nor bitmap glyphs. 2010-06-25 Werner Lemberg - Fix Savannah bug #30254. + [cff] Fix Savannah bug #30254. * src/cff/cffload.c (cff_index_get_pointers): Do sanity check for first offset also. @@ -1159,7 +5041,7 @@ 2010-06-24 Werner Lemberg - Fix Savannah bug #30247. + [pcf] Fix Savannah bug #30247. * src/pcf/pcfread.c (pcf_get_metrics): Disallow (invalid) fonts with zero metrics. @@ -1176,14 +5058,14 @@ 2010-06-24 Werner Lemberg - Fix Savannah bug #30236. + [sfnt] Fix Savannah bug #30236. * src/sfnt/ttcmap.c (tt_face_build_cmaps): Improve check for pointer to `cmap_table'. 2010-06-24 Werner Lemberg - Fix Savannah bug #30235. + [pfr] Fix Savannah bug #30235. * src/pfr/pfrgload.c (pfr_glyph_load_simple): Protect against invalid indices if there aren't any coordinates for indexing. @@ -1199,7 +5081,7 @@ 2010-06-23 Werner Lemberg - Fix Savannah bug #30220. + [bdf] Fix Savannah bug #30220. * include/freetype/fterrdef.h (BDF_Err_Missing_Fontboundingbox_Field): New error code. @@ -1211,21 +5093,21 @@ 2010-06-21 Werner Lemberg - Fix Savannah bug #30168. + [pfr] Fix Savannah bug #30168. * src/pfr/pfrgload.c (pfr_glyph_load_compound): Limit the number of subglyphs to avoid endless recursion. 2010-06-20 Werner Lemberg - Fix Savannah bug #30145. + [psaux] Fix Savannah bug #30145. * src/psaux/psobjs.c (t1_builder_add_contour): Protect against `outline == NULL' which might happen in invalid fonts. 2010-06-19 Werner Lemberg - Fix Savannah bug #30135. + [bdf] Fix Savannah bug #30135. * src/bdf/bdflib.c (_bdf_list_join): Don't modify value in static string `empty'. @@ -1233,14 +5115,14 @@ 2010-06-15 Werner Lemberg - Fix Savannah bug #30108. + [autofit] Fix Savannah bug #30108. * src/autofit/afglobal.c (af_face_globals_compute_script_coverage): Properly mask AF_DIGIT bit in comparison. 2010-06-11 Werner Lemberg - Fix Savannah bug #30106. + [pshinter] Fix Savannah bug #30106. Point numbers for FreeType's implementation of hinting masks are collected before the final number of points of a glyph has been @@ -1269,14 +5151,14 @@ 2010-06-09 Werner Lemberg - Fix Savannah bug #30082. + [cff] Fix Savannah bug #30082. * src/cff/cffgload.c (cff_decoder_parse_charstrings) : Protect against stack underflow. 2010-06-08 Werner Lemberg - Fix Savannah bug #30053. + [cff] Fix Savannah bug #30053. * src/cff/cffparse.c (cff_parse_real): Handle border case where `fraction_length' has value 10. @@ -1322,7 +5204,7 @@ 2010-05-21 Bram Tassyns - Fix Savannah bug #27987. + [cff] Fix Savannah bug #27987. * src/cff/cffobjs.c (remove_subset_prefix): New function. (cff_face_init): Use it to adjust `cffface->family_name'. @@ -1358,7 +5240,7 @@ 2010-05-10 Ken Sharp - Fix Savannah bug #29846. + [psaux] Fix Savannah bug #29846. Previously we discovered fonts which used `setcurrentpoint' to set the initial point of a contour to 0,0. This caused FreeType to @@ -1377,9 +5259,9 @@ and real proper usage of the operator to work the same way as Adobe interpreters apparently do. - (t1_decoder_parse_charstrings): Make `setcurrentpoint' use the top - two elements of the stack to establish unconditionally the current x - and y coordinates. + * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Make + `setcurrentpoint' use the top two elements of the stack to establish + unconditionally the current x and y coordinates. Make the `flex' subroutine handling (OtherSubr 0) put the current x,y coordinates onto the stack, instead of two dummy uninitialised @@ -1387,7 +5269,7 @@ 2010-04-14 Ken Sharp - Fix Savannah bug #29444. + [psaux] Fix Savannah bug #29444. * src/psaux/psobjs.c (t1_builder_start_point): Accept (invalid) `lineto' immediately after `hsbw', in accordance with Acrobat, GS, @@ -1395,21 +5277,21 @@ 2010-04-14 Michał Cichoń - Fix Savannah bug #27999. + [psaux] Fix Savannah bug #27999. * src/cache/ftcmanag.c (FTC_Manager_RemoveFaceID): Only remove selected entry, not all. 2010-04-06 Jonathan Kew - Add overflow check to `fvar' table. + [truetype] Add overflow check to `fvar' table. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Check axis and instance count. 2010-04-05 Ken Sharp - Fix Savannah bug #29335. + [raster] Fix Savannah bug #29335. * src/raster/ftraster.c (Line_Up): Use slow multiplication to prevent overflow. This shouldn't have any serious impact on speed, @@ -1432,7 +5314,7 @@ 2010-04-01 John Tytgat - Fix Savannah bug #29404. + [truetype] Fix Savannah bug #29404. * src/truetype/ttgload.c: Revert change 2752bd1a (check on bit 1 of `head' table of TrueType fonts). @@ -1451,20 +5333,20 @@ 2010-03-11 Chris Liddell - Fix Savannah bug #27442. + [raster] Fix Savannah bug #27442. * src/raster/ftraster.c (ft_black_reset): Fix `buffer_size'. 2010-03-09 Werner Lemberg - Remove unused variable. + [cff] Remove unused variable. Reported by Graham. * src/cff/cffparse.c (cff_parse_real): Remove `rest'. 2010-03-02 John Tytgat - Improve CFF string (especially glyphname) lookup performance. + [cff] Improve CFF string (especially glyphname) lookup performance. We do this by avoiding memory allocation and file I/O. This is Savannah patch #7104. @@ -1531,7 +5413,7 @@ 2010-02-18 Chris Liddell - Fix Savannah bug #28905. + [truetype] Fix Savannah bug #28905. Initialize phantom points before calling the incremental interface to update glyph metrics. @@ -1544,7 +5426,7 @@ ---------------------------------------------------------------------------- -Copyright 2010 by +Copyright 2010-2012 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, modified, Index: ChangeLog.23 =================================================================== --- ChangeLog.23 (revision 58178) +++ ChangeLog.23 (working copy) @@ -7946,7951 +7946,3 @@ version-control: never coding: utf-8 End: -2010-02-13 Werner Lemberg - - * Version 2.3.12 released. - ========================== - - - Tag sources with `VER-2-3-12'. - - * docs/CHANGES: Updated. - - * docs/VERSION.DLL: Update documentation and bump version number to - 2.3.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/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.3.11/2.3.12/, s/2311/2312/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 12. - - * builds/unix/configure.raw (version_info): Set to 10:0:4. - -2010-02-12 suzuki toshiya - - Improve autotool version checking to work with beta releases. - - * autogen.sh (check_tool_version): Improve the extraction of version - number from "tool --version" output. Some beta releases of - autotools have extra strings before version number. - -2010-02-12 suzuki toshiya - - Fix overallocating bug in FT_Outline_New_Internal(). - - * src/base/ftoutln.c (FT_Outline_New_Internal): The length of - FT_Outline->points[] should be numPoints, not 2 * numPoints. - Found by Paul Messmer, see - http://lists.gnu.org/archive/html/freetype-devel/2010-02/msg00003.html - -2010-02-10 Ken Sharp - - Really fix Savannah bug #28678 (part 2). - - Since we consider `sbw' for the horizontal direction only, we still have - to synthesize vertical metrics if the user wants to use the vertical - writing direction. - - * src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c - (cid_slot_load_glyph), src/type1/t1gload.c (T1_Load_Glyph): - Synthesize vertical metrics (only) if FT_LOAD_VERTICAL_LAYOUT is - set. - -2010-02-10 Ken Sharp - - Really fix Savannah bug #28678 (part 1). - - After long discussion, we now consider the character width vector - (wx,wy) returned by the `sbw' Type 1 operator as being part of *one* - direction only. For example, if you are using the horizontal - writing direction, you get the horizontal and vertical components of - the advance width for this direction. Note that OpenType and CFF fonts - don't have such a vertical component; instead, the GPOS table can be - used to generate two-dimensional advance widths (but this isn't - handled by FreeType). - - * include/freetype/ftincrem.h (FT_Incremental_MetricsRec): Add - `advance_v' field to hold the vertical component of the advance - value. - - * src/truetype/ttgload.c (tt_get_metrics), src/cff/cffgload.c - (cff_slot_load), src/type1/t1gload.c - (T1_Parse_Glyph_And_Get_Char_String), src/cid/cidgload.c - (cid_load_glyph): Use it. - -2010-02-08 Werner Lemberg - - * devel/ftoption.h [FT_CONFIG_OPTION_PIC]: Define. - -2010-02-04 suzuki toshiya - - Prevent NULL pointer dereference passed to FT_Module_Requester. - - * src/sfnt/sfdriver.c (sfnt_get_interface): Don't use `module'. - * src/psnames/psmodule.c (psnames_get_interface): Ditto. - - * src/cff/cffdrivr.c (cff_get_interface): Check NULL `driver'. - * src/truetype/ttdriver.c (tt_get_interface): Ditto. - -2010-01-29 suzuki toshiya - - Fix memory leaks in previous patch. - - * src/sfnt/sfobjs.c (sfnt_load_face): Don't overwrite the strings - allocated for face->root.family_name and style_name. - -2010-01-29 suzuki toshiya - - New parameters for FT_Open_Face() to ignore preferred family names. - - Preferred family names should be used for legacy systems that - can hold only a few faces (<= 4) for a family name. Suggested by - Andreas Heinrich. - http://lists.gnu.org/archive/html/freetype/2010-01/msg00001.html - - * include/freetype/ftsnames.h (FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY, - FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY): Define. - - * src/sfnt/sfobjs.c (sfnt_load_face): Check the arguments and - ignore preferred family and subfamily names if requested. - -2010-01-27 Ken Sharp - - Fix Savannah bug #28678. - - * src/cff/cffgload.c (cff_slot_load), src/cid/cidgload.c - (cid_load_glyph): Handle vertical metrics correctly. - - * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Handle - vertical metrics correctly. - (T1_Load_Glyph): Don't synthesize vertical metrics. - -2010-01-14 Werner Lemberg - - Make FT_Set_Transform work if no renderer is available. - - * src/base/ftobjs.c (FT_Load_Glyph): Apply `standard' transformation - if no renderer is compiled into the library. - -2010-01-14 Werner Lemberg - - Fix compilation warning. - - * src/base/ftbase.h: s/LOCAL_DEF/LOCAL/. - * src/base/ftobjc.s: Include ftbase.h conditionally. - -2010-01-11 Kwang Yul Seo - - Provide inline assembly code for RVCT compiler. - This is Savannah patch #7059. - - * include/freetype/config/ftconfig.h (FT_MULFIX_ASSEMBLER, - FT_MulFix_arm) [__CC_ARM || __ARM_CC]: Define. - -2010-01-08 Ken Sharp - - Fix Savannah bug #28521. - - Issue #28226 involved a work-around for a font which used the - `setcurrentpoint' operator in an invalid way; this operator is only - supposed to be used with the result of OtherSubrs, and the font used - it directly. The supplied patch removed the block of code which - checked this usage entirely. - - This turns out to be a Bad Thing. If `setcurrentpoint' is being - used correctly it should reset the flex flag in the decoder. If we - don't do this then the flag never gets reset and we omit any further - contours from the glyph (at least until we close the path or - similar). - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings) - : Handle `flex_state' correctly. - -2010-01-05 Werner Lemberg - - Apply reports from clang static analyzer. - - * src/lzw/ftlzw.c (ft_lzw_file_init), src/base/ftstroke.c - (FT_Stroker_ParseOutline), src/base/ftsynth.c - (FT_GlyphSlot_Embolden): Remove dead code. - - * src/base/ftpatent.c (_tt_check_patents_in_table): Initialize - `offset_i' and `length_i'. - -2010-01-05 Ralph Giles - - Enable the incremental font interface by default. - - Ghostscript requires the incremental font interface for handling - some Postscript documents. It is moving to using FreeType as its - primary renderer; supporting this in the default build makes it - Ghostscript to be linked against the system FreeType when one is - available. - - * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_INCREMENTAL): - Uncomment. - -2010-01-05 Werner Lemberg - - Fix Savannah bug #28395. - - * src/truetype/ttdriver.c (Load_Glyph), src/type1/t1gload.c - (T1_Loada_Glyph): Don't check `num_glyphs' if incremental interface - is used. - -2010-01-05 Ken Sharp - - Make Type 1 `seac' operator work with incremental interface. - This fixes Savannah bug #28480. - - * src/psaux/t1decode.c (t1operator_seac): Don't check `glyph_names' - if incremental interface is used. - -2010-01-04 Ken Sharp - - Make incremental interface work with TrueType fonts. - This fixes Savannah bug #28478. - - * src/truetype/ttgload.c (load_truetype_glyph): Don't check - `glyf_offset' if incremental interface is used. - -2009-12-31 Lars Abrahamsson - - Make compilation with FT_CONFIG_OPTION_PIC work again. - - * src/base/ftglyph.c (FT_Glyph_To_Bitmap) [FT_CONFIG_OPTION_PIC]: - Declare `library' for FT_BITMAP_GLYPH_CLASS_GET. - - * src/base/ftinit.c (ft_destroy_default_module_classes, - ft_create_default_module_classes): Use proper casts (needed for C++ - compilation). - - * src/sfnt/ttcmap.c (tt_cmap13_class_rec): Use FT_DEFINE_TT_CMAP. - -2009-12-22 Marc Kleine-Budde - - Make freetype-config aware of $SYSROOT. - This is Savannah patch #7040. - - * builds/unix/freetype-config.in: Decorate with ${SYSROOT} where - appropriate. - -2009-12-20 Werner Lemberg - - Fix compiler warning. - Reported by Sean. - - * src/base/ftdbgmem.c [!FT_DEBUG_MEMORY]: ANSI C doesn't like empty - source files; however, some compilers warn about an unused variable - declaration. This is now replaced with a typedef. - -2009-12-18 Werner Lemberg - - Fix Savannah bug #28320. - - There exist corrupt, subsetted fonts (embedded in PDF files) which - contain a private dict that ends with an unterminated floating point - number (no operator following). We now ignore this error (as - acrobat does). - - * src/cff/cffparse.c (cff_parser_run): Don't emit a syntax error for - unterminated floating point numbers. - -2009-12-16 Werner Lemberg - - Really fix compiler warnings. - Reported by Sean. - - * src/truetype/ttgxvar.c (GX_PT_POINTS_ARE_WORDS, - GX_PT_POINT_RUN_COUNT_MASK): Convert enum values to macros. - -2009-12-16 suzuki toshiya - - Improve configure.raw to copy some options from CFLAGS to LDFLAGS. - The linker of Mac OS X 10.6 is sensitive to the architecture. If - the architectures are specified explicitly for the C compiler, the - linker requires the architecture specifications too. - - * builds/unix/configure.raw: Replace `-isysroot' option parser by - more generic argument parser. - -2009-12-15 Werner Lemberg - - Fix compiler warnings. - Reported by Sean. - - * src/truetype/ttgxvar.c (ft_var_readpackeddeltas): Fix counter data - type. - -2009-12-14 Ken Sharp - - Ignore invalid `setcurrentpoint' operations in Type 1 fonts. - This fixes Savannah bug #28226. - - At least two wild PostScript files of unknown provenance contain - Type 1 fonts, apparently converted from TrueType fonts in earlier - PDF versions of the files, which use the `setcurrentpoint' operator - inappropriately. - - FreeType currently throws an error in this case, but Ghostscript and - Adobe Distiller both accept the fonts and ignore the problem. This - commit #ifdefs out the check so PostScript interpreters using - FreeType can render these files. - - The specification says `setcurrentpoint' should only be used to set - the point after a `Subr' call, but these fonts use it to set the - initial point to (0,0). Unnecessarily so, as they correctly use an - `hsbw' operation which implicitly sets the initial point. - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings) - : Comment out code. - -2009-12-14 Bram Tassyns - - Fix parsing of /CIDFontVersion. - This fixes Savannah bug #28287. - - * src/cid/cidtoken.h: `cid_version' in CID_FaceInfoRec (in - t1tables.h) is of type FT_Fixed. - -2009-12-14 Werner Lemberg - - Trace glyph index in CID module. - Suggested in Savannah patch #7023. - - * src/cid/cidgload.c (cid_load_glyph): Add tracing message. - -2009-12-03 Werner Lemberg - - Fix compiler warnings. - - * src/truetype/ttgload.c (tt_get_metrics): Put `Exit' label into the - proper preprocessor conditional. - * src/pfr/pfrobjs.c (pfr_slot_load): Pacify gcc. - -2009-11-25 John Tytgat - - Better handling of start of `eexec' section. - This fixes Savannah bug #28090. - - * src/type1/t1parse.c (T1_Get_Private_Dict): Skip all whitespace - characters before start of `eexec' section. - -2009-11-20 Werner Lemberg - - Fix Savannah bug #27742. - - * src/base/ftstroke.c (ft_stroker_outside): Avoid silent division by - zero, using a threshold for `theta'. - -2009-11-20 Werner Lemberg - - Fix Savannah bug #28036. - - * src/type1/t1afm.c (t1_get_index): Fix comparison. - -2009-11-16 Werner Lemberg - - Fix compiler warnings. - Reported by Kevin Blenkinsopp . - - * src/sfnt/ttload.c (check_table_dir): Use proper data type. - -2009-11-15 Werner Lemberg - - Really fix FreeDesktop bug #21197. - This also fixes Savannah bug #28021. - - * src/autofit/aflatin.c (af_latin_metrics_check_digits), - src/autofit/aflatin2.c (af_latin2_metrics_check_digits): Fix loop. - -2009-11-15 Werner Lemberg - - Add tracing messages for advance values. - - * src/base/ftobjs.c (FT_Load_Glyph), src/truetype/ttgload.c - (TT_Get_HMetrics, TT_Get_VMetrics): Do it. - -2009-11-08 Werner Lemberg - - Fix compiler warning. - Reported by Jeremy Manson . - - * src/truetype/ttgload.c (load_truetype_glyph): Initialize `error'. - -2009-11-04 Werner Lemberg - - Remove compiler warning. - Reported by Sean McBride . - - * src/tools/apinames.c (read_header_file): Use a cast to - `int', as specified in the printf(3) man page. - -2009-11-04 Werner Lemberg - - Fix Savannah bug #27921. - - * src/cff/cffobjs.c (cff_face_init), src/cid/cidobjs.c - (cid_face_init), src/type1/t1afm.c (T1_Read_Metrics), - src/type1/t1objs.c (T1_Face_Init): Don't use unsigned constant - values for rounding if the argument can be negative. - -2009-11-03 Bram Tassyns - - Add basic support for Type1 charstrings in CFF. - This fixes Savannah bug #27922. - - * src/cff/cffgload.c (CFF_Operator, cff_argument_counts): Handle - `seac', `sbw', and `setcurrentpoint' opcodes. - (cff_compute_bias): Add parameter to indicate the charstring type. - Update all callers. - (cff_operator_seac): Add parameter for side bearing. - (cff_decoder_parse_charstrings): Updated for more Type1 support. - -2009-11-03 Werner Lemberg - - Return correct `linearHoriAdvance' value for embedded TT bitmaps too. - Reported by Jeremy Manson . - - src/truetype/ttgload.c (load_truetype_glyph): Add parameter to - quickly load the glyph header only. - Update all callers. - (tt_loader_init): Add parameter to quickly load the `glyf' table - only. - Update all callers. - (TT_Load_Glyph): Compute linear advance values for embedded bitmap - glyphs too. - -2009-11-03 Werner Lemberg - - Improve code readability. - - * src/ttgload.c (load_truetype_glyph): Move metrics calculation - to... - (tt_get_metrics): This new function. - -2009-10-26 Bram Tassyns - - Fix Savannah bug #27811. - - * src/truetype/ttxgvar.c (ft_var_readpackeddeltas): Fix - signed/unsigned mismatch. - -2009-10-19 Ning Dong - - Fix handling of `get' and `put' CFF instructions. - - * src/cff/cffgload.c (cff_decoder_parse_charstrings) : Appendix B of Adobe Technote #5177 limits the number of - elements for the `get' and `put' operators to 32. - * src/cff/cffgload.h (CFF_MAX_TRANS_ELEMENTS): Define. - (CFF_Decoder): Use it for `buildchar' and remove `len_buildchar'. - -2009-10-18 Werner Lemberg - - Fix handling of `dup' CFF instruction. - Problem and solution reported by Ning Dong . - - * src/cff/cffgload.c (cff_decoder_parse_charstrings) : - Increase `args' by 2, not 1. - -2009-10-10 Werner Lemberg - - * Version 2.3.11 released. - ========================== - - - Tag sources with `VER-2-3-11'. - - * docs/VERSION.DLL: Update documentation and bump version number to - 2.3.11. - - * README, Jamfile (RefDoc), builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, - builds/win32/visualce/index.html, - builds/win32/visualce/freetype.dsp, - builds/win32/visualce/freetype.vcproj: s/2.3.10/2.3.11/, s/2310/2311/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 11. - - * builds/unix/configure.raw (version_info): Set to 9:22:3. - -2009-10-10 Werner Lemberg - - * docs/CHANGES, docs/release: Updated. - -2009-10-10 suzuki toshiya - - * src/pcf/pcfread.c (pcf_get_properties): Fix a bug in the nprops - truncation. Reported by Martin von Gagern and Peter Volkov. - https://bugs.gentoo.org/288357 and https://bugs.gentoo.org/288256 - -2009-10-06 Werner Lemberg - - * Version 2.3.10 released. - ========================== - - - Tag sources with `VER-2-3-10'. - - * builds/toplevel.mk (major, minor, patch): Fix regexp to allow more - than a single digit. - (dist): We now use git. - - * docs/VERSION.DLL: Update documentation and bump version number to - 2.3.10. - - * README, Jamfile (RefDoc), builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, - builds/win32/visualce/index.html, - builds/win32/visualce/freetype.dsp, - builds/win32/visualce/freetype.vcproj: s/2.3.9/2.3.10/, s/239/2310/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 10. - - * builds/unix/configure.raw (version_info): Set to 9:21:3. - -2009-10-06 Werner Lemberg - - Fix `make multi'. - - * src/cache/ftccache.c, src/cache/ftcsbits.c (FT_COMPONENT): Define. - - * src/sfnt/sfdriver.c: Include FT_INTERNAL_DEBUG_H. - -2009-09-27 suzuki toshiya - - [cache] Fix Savannah bug #27441, clean up Redhat bugzilla #513582. - Tricky casts in FTC_{CACHE,GCACHE,MRULIST}_LOOKUP_CMP() are removed. - Now these functions should be called with FTC_Node or FTC_MruNode - variable, and the caller should cast them to appropriate pointers to - concrete data. These tricky casts can GCC-4.4 optimizer (-O2) - confused and the crashing binaries are generated. - - * src/cache/ftcmru.h (FTC_MRULIST_LOOKUP_CMP): Drop tricky cast. - Now the 4th argument `node' of this function should be typed as - FTC_MruNode. - - * src/cache/ftcglyph.h (FTC_GCACHE_LOOKUP_CMP): For inline - implementation, new temporal variable FTC_MruNode `_mrunode' to take - the pointer from FTC_MRULIST_LOOKUP_CMP(). For non-inline - implementation, tricky cast is dropped. - - * src/cache/ftcmanag.c (FTC_SIZE_NODE): New macro casting - to FTC_SizeNode. - (FTC_Manager_LookupSize): Replace FTC_SizeNode `node' by FTC_MruNode - `mrunode', and FTC_SIZE_NODE() is inserted. - (FTC_FACE_NODE): New macro casting to FTC_FaceNode. - (FTC_Manager_LookupFace) Replace FTC_FaceNode `node' by FTC_MruNode - `mrunode', and FTC_FACE_NODE() is inserted. - - * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Change the type of - `node' from FTC_INode to FTC_Node. Extra casting macro FTC_NODE() - is dropped. - (FTC_ImageCache_LookupScaler): Ditto. - (FTC_SBitCache_Lookup): Change the type of `node' from FTC_SNode to - FTC_Node. Extra casting macro FTC_NODE() is dropped. FTC_SNODE() - is inserted. - (FTC_SBitCache_LookupScaler): Ditto. - - * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Change the type of - `node' from FTC_CMapNode to FTC_Node. Extra casting macro - FTC_NODE() is dropped, FTC_CMAP_NODE() is inserted. - -2009-09-25 suzuki toshiya - - [cache, psaux, type1] Fix for multi build. - In multi build, some cpp functions are left as unresolved symbols. - - * src/cache/ftcbasic.c: Include FT_INTERNAL_DEBUG_H for FT_TRACE1(). - - * src/psaux/t1decode.c: Include FT_INTERNAL_CALC_H for - FIXED_TO_INT(). - * src/type1/t1gload.c: Ditto. - * src/type1/t1objs.c: Ditto. - -2009-09-25 suzuki toshiya - - [autofit] Fix for multi build. - - * src/autofit/afmodule.h: Include FT_INTERNAL_OBJECTS_H to use - FT_DECLARE_MODULE() macro in multi build. - - * src/autofit/aflatin.c: Include to handle - FT_ADVANCES_H correctly in multi build. - -2009-09-24 suzuki toshiya - - [cache] Check the face filled by FTC_Manager_LookupFace(). - - * src/cache/ftcbasic.c (ftc_basic_family_get_count): Return - immediately if FTC_Manager_LookupFace() fills face by NULL. Such - case can occur when the code is optimized by GCC-4.2.x. - -2009-09-23 Werner Lemberg - - * docs/CHANGES: Updated. - -2009-09-12 Werner Lemberg - - [raster] Fix 5-levels grayscale output. - This was broken since version 2.3.0. - - * src/raster/ftraster.c (count_table): Use pre-2.3.0 values (which - were then computed dynamically). - (Vertical_Gray_Sweep_Step): Updated. - - (ft_black_render): Initialize `worker->gray_lines' (problem found by - valgrind). - - (FT_RASTER_OPTION_ANTI_ALIASING, DEBUG_RASTER): Dont' #undef, just - comment out. - -2009-09-12 suzuki toshiya - - Improve configure.raw for cross build. - - * builds/unix/configure.raw: Remove temporal files created by the - suffix checking for CC_BUILD. Set XX_ANSIFLAGS and XX_CFLAGS when - cross compiler is GCC. AC_PROG_CC checks whether the cross compiler - is GCC, its result is stored in GCC. - -2009-09-12 suzuki toshiya - - [BDF] Modify hash API to take size_t value instead of void *. - - The hash API in BDF driver is designed to be generic, it takes - void * typed data. But BDF driver always gives an unsigned long - integer (the index to a property). To reduce non-essential - casts from unsigned long to void* and from void* to unsigned - long, the hash API is changed to take size_t integer. - The issue of incompatible cast between unsigned long and void* - on LLP64 platform is reported by NightStrike from MinGW-Win64 - project. See - http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html - - * src/bdf/bdf.h: The type of hashnode->data is changed from - void* to size_t. - - * src/bdf/bdflib.c (hash_insert): Get size_t data, instead of - void* data. - (bdf_create_property): Get the name length of new property by - size_t variable, with a cut-off at FT_ULONG_MAX. - (_bdf_set_default_spacing): Get the name length of the face by - size_t variable, with a cut-off at 256. - (bdf_get_property): Get the property id by size_t variable to - reduce the casts between 32-bit prop ID & hashnode->data during - simple copying. - (_bdf_add_property): Ditto. - (_bdf_parse_start): Calculate the index to the property array - by size_t variable. - (bdf_get_font_property): Drop a cast to unsigned long. - -2009-09-10 suzuki toshiya - - [Win64] Improve the computation of random seed from stack address. - - On LLP64 platform, the conversion from pointer to FT_Fixed need - to drop higher 32-bit. Explict casts are required. Reported by - NightStrike from MinGW-w64 project. See - http://lists.gnu.org/archive/html/freetype/2009-09/msg00000.html - - * src/cff/cffgload.c: Convert the pointers to FT_Fixed explicitly. - - * src/psaux/t1decode.c: Ditto. - - -2009-09-03 Werner Lemberg - - [raster] Improvements for stand-alone mode. - - * src/raster/rules.mk: Don't handle ftmisc.h. It is needed for - stand-alone mode only. - - * src/raster/ftmisc.h (FT_MemoryRec , FT_Alloc_Func, FT_Free_Func, - FT_Realloc_Func): Copy declarations from ftsystem.h. - -2009-09-02 Bram Tassyns - - Improve vertical metrics calculation (Savannah bug #27364). - - The calculation of `vertBearingX' is not defined in the OTF font - spec so FreeType does a `best effort' attempt. However, this value - is defined in the PDF and PostScript specs, and that algorithm is - better than the one FreeType currently uses: - - FreeType: Use the middle of the bounding box as the X coordinate - of the vertical origin. - - Adobe PDF spec: Use the middle of the horizontal advance vector as - the X coordinate of the vertical origin. - - FreeType's algorithm goes wrong if you have a really small glyph - (like the full-width, circle-like dot at the end of the sentence, as - used in CJK scripts) with large bearings. With the FreeType - algorithm this dot gets centered on the baseline; with the PDF - algorithm it gets the correct location (in the top right). Note - that this is a serious issue, it's like printing the dot at the end - of a Roman sentence at the center of the textline instead of on the - baseline like it should. So i believe the PDF spec's algorithm - should be used in FreeType as well. - - The `vertBearingY' value for such small glyphs is also very strange - if no `vmtx' information is present, since the height of the bbox is - not representable for the height of the glyph visually (the - whitespace up to the baseline is part of the glyph). The fix also - includes some code for a better estimate of `vertBearingY'. - - * src/base/ftobjs.c (ft_synthesize_vertical_metrics): `vertBearingX' - is now calculated as described by the Adobe PDF Spec. Estimate for - `vertBearingY' now works better for small glyphs completely above or - below the baseline into account. - - * src/cff/cffgload.c (cff_slot_load): `vertBearingX' is now - calculated as described by the Adobe PDF Spec. Vertical metrics - information was always ignored when FT_CONFIG_OPTION_OLD_INTERNALS - was not defined. - - * src/truetype/ttgload.c (compute_glyph_metrics): `vertBearingX' is - now calculated as described by the Adobe PDF Spec. - -2009-09-01 John Tytgat - - Fix custom cmap for empty Type 1 font (Savannah bug #27294). - - * include/freetype/internal/t1types.h (T1_EncodingRecRec_): Update - comment to reflect revised code_last meaning. - * src/type1/t1load.c (T1_Open_Face), src/type42/t42objs.c - (T42_Open_Face): Assign max_char as highest character code + 1 and - use this for T1_EncodingRecRec_::code_last. - * src/psaux/t1cmap.c (t1_cmap_custom_init): Follow revised - T1_EncodingRecRec_::code_last meaning. - -2009-08-25 Werner Lemberg - - Fix rendering of horizontally compressed CFFs. - Bug reported by Ivan Nincic . - - * src/cff/cffgload.c (cff_slot_load): Thinko: Check `xx' element of - `font_matrix' also. - - * docs/CHANGES: Updated. - -2009-08-03 suyu0925@gmail.com - - Don't call `ft_fseek' every time when executing `ft_fread'. - - * src/base/ftstream.c (FT_Stream_Seek), src/base/ftsystem.c - (ft_ansi_stream_io): Implement it. - -2009-07-31 suzuki toshiya - - sfnt: Cast a charcode to 32-bit in cmap format 14 parser. - - * src/sfnt/ttcmap.c (tt_cmap14_char_var_index, - tt_cmap14_char_var_isdefault, tt_cmap14_char_variants, - tt_cmap14_variant_chars): Correct mismatches from - FT_CMap_CharVarIndexFunc prototype, FT_ULong arguments - are replaced by FT_UInt32 arguments. - -2009-07-31 suzuki toshiya - - sfnt: Cast a charcode to 32-bit in cmap format 12 parser. - - * src/sfnt/ttcmap.c (tt_cmap12_char_next): - Insert explicit cast from FT_UFast to FT_UInt32 - for return value. - -2009-07-31 suzuki toshiya - - psaux: Fix a few casts to FT_Int32 value. - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): - Fix a few casts setting `value' from FT_Long to FT_Int32, - because `value' is typed as FT_Int32 since 2009-06-22. - -2009-07-31 suzuki toshiya - - sfnt: Fix a data type mismatching with its source. - - * src/sfnt/ttcmap.c (tt_cmap13_char_next): Fix the - type of `gindex' from FT_ULong to FT_UInt because - it is set by FT_UInt tt_cmap13_char_map_binary() or - TT_CMap13->cur_gindex. - -2009-07-31 suzuki toshiya - - sfnt: Extend a few local variables to load 32-bit values. - - * src/sfnt/ttkern.c (tt_face_load_kern): Extend `count' - and `kern' to load 32-bit values. - -2009-07-31 suzuki toshiya - - pfr: Extend `num_aux' to take 32-bit value. - - * src/pfr/pfrload.c (pfr_phy_font_load): Extend - `num_aux' to load 32-bit value. - -2009-07-31 suzuki toshiya - - pcf: Truncate FT_ULong `nprops' to fit to int PCF_Face->nprops. - - * src/pcf/pcfread.c (pcf_get_properties): Load `nprops' - as FT_ULong value from PCF file, but truncate it as - int to fit PCF_Face->nprops. The number of truncated - properties is shown in the trace message. - -2009-07-31 suzuki toshiya - - gxvalid: Extend a few local variables to reduce the casts. - - * src/gxvalid/gxvmorx.c (gxv_morx_subtables_validate): - Extend `type' and `rest' to take FT_ULong values. - -2009-07-31 suzuki toshiya - - gxvalid: Extend `settingTable' to take 32-bit offset. - - * src/gxvalid/gxvfeat.c (gxv_feat_name_validate): - Extend `settingTable' to take 32-bit offset. - -2009-07-31 suzuki toshiya - - autofit: Cast FT_Long glyph_count to compare with FT_UInt GID. - - * src/autofit/afglobal.c (af_face_globals_is_digit, - af_face_globals_compute_script_coverage): Cast FT_Long - globals->glyph_count to FT_ULong, to compare with FT_UInt - gindex. - -2009-07-31 suzuki toshiya - - smooth: Exclude 16-bit system in invalid pitch/height check. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): - pitch and height are typed as FT_UInt but checked to fit - 16-bit range, to avoid the overflows. On 16-bit system, - this checking inserts a conditional that never occurs. - -2009-07-03 suzuki toshiya - - cff: Type large constants > 0x7FFF as long for 16-bit systems. - - * src/cff/cffload.c (cff_charset_load): Type large - constants > 0x7FFF as long, because normal constants - are typed signed integer that is less than 0x8000 on - 16-bit systems. - -2009-07-31 suzuki toshiya - - base: Remove an unused variable. - - * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Remove an - unused variable `library'. glyph->library is used. - -2009-07-31 suzuki toshiya - - cache: Check higher bits in flags for non ILP32 systems. - - 4 public functions ought to take FT_ULong flags, but take - FT_UInt flags. To keep binary compatibility, we drop higher - bits on non ILP32 platforms, - ILP64 systems: No drop occurs. - LP64 systems: Higher bits are not used. - 16-bit systems: Drop can occur. - See - http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html - These functions will be refined to take FT_ULong flags in - next bump with incompatible API change. - - * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): - Check `flags' in `type', the 2nd argument. - (FTC_SBitCache_Lookup): Ditto. - (FTC_ImageCache_LookupScaler): Check `load_flags', - the 3rd argument. - (FTC_SBitCache_LookupScaler): Ditto. - -2009-07-31 suzuki toshiya - - sfnt: Ignore invalid GIDs in glyph name lookup. - - * include/freetype/internal/fttrace.h: - New trace module for sfdriver.c is added. - - * src/sfnt/sfdriver.c (sfnt_get_name_index): - Restrict glyph name lookup to FT_UInt GID. - Genuine TrueType can hold 16-bit glyphs. - -2009-07-31 suzuki toshiya - - pcf: Fix a comparison between FT_Long and FT_ULong. - - * src/pcf/pcfread.c (pcf_get_bitmaps): Return an error - if PCF_Face->nemetrics is negative. - -2009-07-31 suzuki toshiya - - gxvalid: Guarantee `nFeatureFlags' size up to 32-bit. - - * src/gxvalid/gxvmort.c (gxv_mort_featurearray_validate): - Extend the 3rd argument `nFeatureFlags' to FT_ULong. - * src/gxvalid/gxvmort.h: Ditto. - -2009-07-31 suzuki toshiya - - sfnt: Insert explicit cast for LP64 system. - - * src/sfnt/ttkern.c (tt_face_load_kern): Insert - cast from unsigned long to FT_UInt32. - -2009-07-31 suzuki toshiya - - gxvalid: Guarantee `just' table size upto 32-bit. - - * src/gxvalid/gxvjust.c (gxv_just_validate): - The type of `offset' is changed from FT_UInt to - FT_Offset, for 16-bit platforms. - -2009-07-31 suzuki toshiya - - gxvalid: Guarantee `trak' table size upto 32-bit. - - * src/gxvalid/gxvtrak.c (gxv_trak_validate): - The type of `offset' is changed from FT_UInt to - FT_Offset, for 16-bit platforms. - -2009-07-31 suzuki toshiya - - type1: Fix a data type mismatching with its source. - - * include/freetype/internal/t1types.h: The type of - T1_Face->buildchar is matched with T1_Decorder->top. - -2009-07-31 suzuki toshiya - - pfr: Fix a data type mismatching with its source. - - * src/pfr/pfrtypes.h: The type of PFR_KernItem->offset - is extended from FT_UInt32 to FT_Offset, because it is - calculated with the pointer difference, in - pfr_extra_item_load_kerning_pairs(). - -2009-07-31 suzuki toshiya - - pfr: Fix a data type mismatching with its source. - - * src/pfr/pfrtypes.h: The type of PFR_PhysFont->chars_offset - is extended from FT_UInt32 to FT_Offset, because it is - calculated with the pointer difference in pfr_phy_font_load(). - -2009-07-31 suzuki toshiya - - pfr: Fix a data type mismatching with its source. - - * src/pfr/pfrtypes.h: The type of PFR_PhyFont->bct_offset - is extended from FT_UInt32 to FT_Long, because it is - loaded by FT_STREAM_POS() in pfr_phy_font_load(). - -2009-07-31 suzuki toshiya - - smooth: Improve the format in debug message. - - * src/smooth/ftgrays.c (gray_dump_cells): Improve the - format specifications to dump variables. - -2009-07-31 suzuki toshiya - - sfnt: Fix a data type mismatching with its source. - - * src/sfnt/sfobjs.c (sfnt_load_face): The type of - local `flags' is matched with FT_Face->face_flags. - -2009-07-31 suzuki toshiya - - psaux: Fix a data type mismatching with its source. - - * include/freetype/internal/psaux.h: The type of - T1_DecorderRec.buildchar is matched with - T1_DecorderRec.top. - -2009-07-31 suzuki toshiya - - truetype: Extend TrueType GX packed deltas to FT_Offset. - - * src/truetype/ttgxvar.c (ft_var_readpackeddeltas): - The type of 2nd argument `delta_cnt' is changed from - FT_Int to FT_Offset, because its source can be cvt - table size calculated from stream position. - -2009-07-31 suzuki toshiya - - truetype: Extend mmvar_len to hold size_t values. - - * src/truetype/ttgxvar.h: The type of - GX_BlendRec.mmvar_len is changed from FT_Int to - FT_Offset, because TT_Get_MM_Var() calculates it - by sizeof() results. - -2009-07-31 suzuki toshiya - - truetype: Check invalid function number in IDEF instruction. - - * src/truetype/ttinterp.c (Ins_IDEF): Check - if the operand fits to 8-bit opcode limitation. - -2009-07-31 suzuki toshiya - - truetype: Check invalid function number in FDEF instruction. - - * src/truetype/ttinterp.c (Ins_FDEF): Check - if the operand fits 16-bit function number. - -2009-07-31 suzuki toshiya - - truetype: Truncate the deltas of composite glyph at 16-bit values. - - * src/truetype/ttgload.c (load_truetype_glyph): - Insert cast from FT_Long (deltas[i].{x,y}) to - FT_Int16 in the summation of deltas[] for composite - glyphs. Because deltas[i] is typed as FT_Pos, - its component x, y are typed as FT_Long, but - their sources are always FT_Int16 when they are - loaded by ft_var_readpackeddeltas(). However, - the limitation about the summed deltas is unclear. - -2009-07-31 suzuki toshiya - - truetype: Truncate the instructions upto 16-bit per a glyph. - - * src/truetype/ttgload.c (TT_Hint_Glyph): Truncate - the instructions upto 16-bit length per a glyph. - -2009-07-31 suzuki toshiya - - truetype: Cast the numerical operands to 32-bit for LP64 systems. - - * src/truetype/ttinterp.c (Ins_SPHIX, INS_MIAP, - Ins_MIRP): Insert cast from long (args[], the - operands passed to TrueType operator) to FT_Int32 - (the argument of TT_MulFix14()). - -2009-07-31 suzuki toshiya - - truetype: Cast the project vector to 32-bit for LP64 system. - - * src/truetype/ttinterp.c (Project, DualProject): - Insert casts from FT_Pos (the arguments `dx', `dy') - to FT_UInt32 (the argument to TT_DotFix14()). - -2009-07-31 suzuki toshiya - - truetype: Cast the scaling params to 32-bit for LP64 system. - - * src/truetype/ttgload.c (TT_Process_Composite_Component): - Insert casts from long (return value of FT_MulFix()) to - FT_Int32 (the argument to FT_SqrtFixed()). - -2009-07-31 suzuki toshiya - - sfnt: Cast a character code to FT_UInt32 for LP64 system. - - * src/sfnt/ttcmap.c (tt_cmap14_char_map_nondef_binary, - tt_cmap14_variants, tt_cmap14_char_variants, - tt_cmap14_def_char_count, tt_cmap14_get_def_chars, - tt_cmap14_get_nondef_chars, tt_cmap14_variant_chars) - Insert casts when FT_UInt32 variable is loaded by - TT_NEXT_{UINT24|ULONG}. Because most of them are - compared with FT_UInt32 values in public API, replacing - FT_UFast is not recommended. - -2009-07-31 suzuki toshiya - - sfnt: Cast a character code to FT_UInt32 for LP64 system. - - * src/sfnt/ttcmap.c (tt_cmap4_init, tt_cmap4_next): - Insert the casts from unsigned long constant to - FT_UInt32. - -2009-07-31 suzuki toshiya - - sfnt: Extend TT_BDF->strings_size to FT_ULong for huge BDF. - - * include/freetype/internal/tttypes.h: The type - of TT_BDF->string_size is extended from FT_UInt32 - to FT_ULong, because BDF specification does not - restrict the length of string. - * src/sfnt/ttbdf.c: The scratch variable `strings' - to load TT_BDF->string_size is matched with - TT_BDF->string_size. - -2009-07-31 suzuki toshiya - - psaux: Handle the string length by FT_Offset variables. - - * src/psaux/afmparse.c (afm_parser_next_key, - afm_tokenize, afm_parse_track_kern, - afm_parse_kern_pairs, afm_parse_kern_data, - afm_parser_skip_section, afm_parser_parse): - The length of key is handled by FT_Offset, - instead of FT_UInt. Although the length of - PostScript strings or name object is 16-bit, - AFM_STREAM_KEY_LEN() calculates the length - from the pointer difference. - - * src/psaux/afmparse.h (afm_parser_next_key): - Ditto. - -2009-07-31 suzuki toshiya - - pcf: Fix some data types mismatching with their sources. - - * src/pcf/pcfread.c (pcf_get_bitmaps): The types - of `nbitmaps', `i', `sizebitmaps' are matched with - the type of area FT_Bitmap.pitch * FT_Bitmap.rows. - -2009-07-31 suzuki toshiya - - pcf: Handle the string length by size_t variables. - - * src/pcf/pcfread.c (pcf_interpret_style): The types - of nn, len, lengths[4] are changed to size_t, because - they are loaded by (or compared with) ft_strlen(). - - * src/pcf/pcfutil.c (BitOrderInvert, TwoByteSwap, - FourByteSwap): The type of the 2nd argument `nbytes' - is changed to size_t, for similarity with ANSI C - string functions. - - * src/pcf/pcfdrivr.c (PCF_Glyph_Load): The type of - `bytes' is changed to FT_Offset, because it is passed - to FT_ALLOC(), via ft_glyphslot_alloc_bitmap(). At - least, using unsigned type is better. - -2009-07-31 suzuki toshiya - - pcf: Fix some data types mismatching with their sources. - - * src/pcf/pcfread.c (pcf_seek_to_table_type, - pcf_has_table_type): The type of 3rd argument - `ntables' is matched with PCF_Toc->count. - -2009-07-31 suzuki toshiya - - otvalid: Truncate the glyph index to 16-bit. - - * src/otvalid/otvalid.c (otv_validate): Checks - face->num_glyphs does not exceed 16-bit limit, - pass FT_UInt num_glyphs to backend functions - otv_{GPOS|GSUB|GDEF|JSTF|MATH}_validate(). - -2009-07-31 suzuki toshiya - - cache: Insert explict casts for LP64 systems. - - * src/cache/ftcbasic.c (FTC_ImageCache_Lookup, - FTC_SBitCache_Lookup): The type of FTC_ImageType->width - is FT_Int, so the cast to unsigned larger type FT_ULong - is introduced for the comparisons with 0x10000L for - LP64 platform. - -2009-07-31 suzuki toshiya - - cache: Fix some data types mismatching with their sources. - - * src/cache/ftccache.h: The type of return value - by FTC_Node_WeightFunc function is changed to - FT_Offset. The type of FTC_CacheClass->cache_size - is changed to FT_Offset, too. - - * src/cache/ftccback.h (ft_inode_weight, - ftc_snode_weight): Ditto. - - * src/cache/ftccmap.c (ftc_cmap_node_weight): Ditto. - - * src/cache/ftcimage.c (ftc_inode_weight, - FTC_INode_Weight): Ditto. - - * src/cache/ftcsbits.c (ftc_snode_weight, - FTC_SNode_Weight): Ditto. - - * src/cache/ftcmru.h: The type of - FTC_MruListClass->node_size is changed to FT_Offset, - because it is passed to FT_ALLOC() to specify the - size of buffer. - -2009-07-31 suzuki toshiya - - XXX_cmap_encoding_char_next() return FT_UInt32 values. - - * include/freetype/internal/services/svpscmap.h: - The size of the charcode value returned by - the function typed PS_Unicodes_CharNextFunc is - matched with its input charcode value. - - * src/cff/cffmap.c (cff_cmap_encoding_char_next, - cff_cmap_unicode_char_next): Ditto. - - * src/pfr/pfrmap.c (pfr_cmap_encoding_char_next): - Ditto. - - * src/psaux/t1cmap.c (t1_cmap_std_char_next, - t1_cmap_custom_char_next, t1_cmap_unicode_char_next): - Ditto. - - * src/psnames/psmodule.c (ps_unicodes_char_next): - Ditto. - - * src/winfonts/winfnt.c (fnt_cmap_char_next): - Ditto. - - * src/sfnt/ttcmap.c (tt_cmap0_char_next, - tt_cmap2_char_next, tt_cmap4_char_next, - tt_cmap6_char_next, tt_cmap10_char_next, - tt_cmap12_char_next, tt_cmap13_char_next): Ditto. - (tt_cmap14_char_variants): Handle base unicode - codepoint by FT_UInt32 variable to avoid overflow - on 16-bit platforms. - (tt_cmap14_ensure): The type of `num_results' is - extend to FT_UInt32, to cover unsigned 32-bit - `numVarSelectorRecords' in cmap14 table header. - -2009-07-31 suzuki toshiya - - truetype: Extend TT_Face->num_locations for broken TTFs. - - * include/freetype/internal/tttypes.h: - TT_Face->num_locations are extended from FT_UInt - to FT_ULong, to stand with broken huge loca table. - Some people insists there are broken TTF including - the glyphs over 16-bit limitation, in PRC market. - * src/truetype/ttpload.c (tt_face_load_loca): - Remove unrequired 16-bit truncation for FT_UInt - TT_Face->num_locations. - -2009-07-31 suzuki toshiya - - smooth: Fix some data types mismatching with their sources. - - * src/smooth/ftgrays.c: The type of `TCoord' is - matched to `TPos', because they are mixed in - gray_set_cell(). The type of TCell->x is extended - to `TPos', because gray_find_cell() sets it by - TWorker.ex. The type of TCell->cover is extended - to `TCoord', because gray_render_scanline() adds - TCoord value to it. The type of TWork.cover is matched - with TCell->cover. The types of - TWork.{max_cells,num_cells} are changed to FT_PtrDist, - because they are calculated from the memory addresses. - The type of TWork.ycount is changed to TPos, because - it is calculated from TPos variables. - (gray_find_cell): The type of `x' is matched with - its initial value ras.ex. - (gray_render_scanline): The types of `mod', `lift' - and `rem' are changed to TCoord, because their values - are set with explicit casts to TCoord. When ras.area - is updated by the differential values including - `delta', they are explicitly cast to TArea, because - the type of `delta' is not TArea but TCoord. - (gray_render_line): The type of `mod' is extended - from int to TCoord, because (TCoord)dy is added to mod. - (gray_hline): The argument `acount' is extended to - TCoord, to match with the parameters in the callers. - -2009-07-31 suzuki toshiya - - cff: Fix some data types mismatching with their sources. - - * src/cff/cffobjs.c (cff_face_init): The type of - `scaling' is matched with the scaling parameter - in FT_Matrix_Multiply_Scaled() and - FT_Vector_Transform_Scaled(). - - * src/cff/cffparse.c (cff_parse_real): The type of - `power_ten', `scaling', `exponent_add', - `integer_length', `fraction_length', - `new_fraction_length' and `shift' are matched with - the type of `exponent' to avoid unexpected truncation. - (cff_parse_fixed_scaled): The type of `scaling' is - matched with the `scaling' argument to - cff_parse_real(). - (cff_parse_fixed_dynamic): Ditto. - (cff_parse_font_matrix): The type of `scaling' is - matched with the `scaling' argument to - cff_parse_dynamic(). - -2009-07-31 suzuki toshiya - - autofit: Fix some data types mismatching with their sources. - - * src/autofit/afglobal.c: Correct the type of - AF_FaceGlobalsRec.glyph_count to match with - FT_Face->num_glyphs. - (af_face_globals_compute_script_coverage): - Insert explicit cast to compare - FT_Long AF_FaceGlobalsRec.glyph_count versus - FT_UInt gindex. The type of `nn' is changed - to scan glyph index upto AF_FaceGlobalsRec.glyph_count. - (af_face_globals_get_metrics): The type of `script_max' - is changed to cover size_t value. Insert explicit cast - to compare FT_Long AF_FaceGlobalsRec.glyph_count versus - FT_UInt gindex. - - * src/autofit/afhints.c (af_axis_hints_new_segment): - Insert explicit cast to calculate `big_max' from - integer and size_t values. - (af_axis_hints_new_edge): Ditto. - - * src/autofit/aflatin.c (af_latin_metrics_init_blues): - The type of `best_y' is matched to FT_Vector.y. - (af_latin_compute_stem_width): The type of `delta' is - matched to `dist' and `org_dist'. - -2009-07-31 suzuki toshiya - - autofit: Count the size of the memory object by ptrdiff_t. - - * src/autofit/afcjk.c (af_cjk_hint_edges): The - number of edges `n_edges' should be counted by - FT_PtrDist variable instead of FT_Int. - - * src/autofit/aflatin.c (af_latin_hint_edges): - Ditto. - - * src/autofit/aftypes.h: In AF_ScriptClassRec, - the size of metric `script_metrics_size' should - be counted by FT_Offset variable instead of FT_UInt. - - * src/autofit/afhints.c - (af_glyph_hints_align_strong_points): The cursors - for the edges `min', `max', `mid' in the memory - buffer should be typed FT_PtrDist. - -2009-07-31 suzuki toshiya - - autofit: Fix for unused variable `first'. - - * src/autofit/afhints.c (af_glyph_hints_reload): Insert - FT_UNUSED() to hide the unused variable warning. - -2009-07-31 suzuki toshiya - - Improve bitmap size or pixel variables for 16-bit systems. - - * include/freetype/config/ftstdlib.h: Introduce - FT_INT_MIN, to use in signed integer overflow in - 16-bit and 64-bit platforms. - - * include/freetype/internal/fttrace.h: Add a tracer - to ftsynth.c. - - * src/base/ftbitmap.c (FT_Bitmap_Embolden): Check - invalid strength causing integer overflow on 16-bit - platform. - - * src/base/ftcalc.c (ft_corner_orientation): Change - the internal calculation from FT_Int to FT_Long, to - avoid an overflow on 16-bit platforms. The caller of - this function should use only the sign of result, - so the cast to FT_Int is acceptable. - - * src/base/ftsynth.c: Introduce a tracer for synth module. - (FT_GlyphSlot_Embolden): Check invalid strength causing - integer overflow on 16-bit platform. - - * src/bdf/bdfdrivr.c (BDF_Face_Init): The glyph index - in FT2 API is typed as FT_UInt, although BDF driver - can handle unsigned long glyph index internally. To - avoid integer overflow on 16-bit platform, too large - glyph index should be excluded. - (BDF_Glyph_Load): The glyph pitch in FT2 is typed as - FT_UInt, although BDF driver can handle unsigned long - glyph pitch internally. To avoid integer overflow on - 16-bit platform, too large glyph pitch should not be - returned. - - * src/pfr/pfrsbit.c (pfr_slot_load_bitmap): The glyph - pitch in FT2 is typed as FT_UInt, although PFR font - format can include huge bitmap glyph with 24-bit pitch - (however, a glyph spends 16.7 pixel, it's not realistic). - To avoid integer overflow on 16-bit platform, huge - bitmap glyph should be excluded. - - * src/smooth/ftgrays.c (gray_hline): As FT_Span.x is - truncated to fit its type (16-bit short), FT_Span.y - should be truncated to fit its type (FT_Int). - - * src/cff/cffdrivr.c (cff_get_ros): CFF specification - defines the supplement in ROS as a real number. - Truncate it to fit public FT2 API. - - * src/cff/cffparse.c (cff_parse_cid_ros): Warn the - supplement if it is truncated or rounded in cff_get_ros(). - - * src/cff/cfftypes.h: Change the type of internal variable - `supplement' from FT_Long to FT_ULong to fit the signedness - to the type in public API. - -2009-07-31 suzuki toshiya - - psaux: Prevent invalid arguments to afm_parser_read_vals(). - - * src/psaux/afmparse.c (afm_parser_read_vals): Change - the type of `n' to prevent negative number how many - arguments should be parsed. - - * src/psaux/afmparse.h (afm_parser_read_vals): Ditto. - -2009-07-31 suzuki toshiya - - base: Prevent some overflows on LP64 systems. - - * src/base/ftadvance.c (FT_Get_Advances): Cast the - unsigned long constant FT_LOAD_ADVANCE_ONLY to FT_UInt32 - for LP64 platforms. - - * src/base/ftcalc.c (FT_Sqrt32): All internal variables - are changed to FT_UInt32 from FT_ULong. - (FT_MulDiv): Insert casts to FT_Int32 for LP64 platforms. - This function is designed for 32-bit integer, although - their arguments and return value are FT_Long. - - * src/base/ftobjs.c (FT_Get_Char_Index): Check `charcode' - is within unsigned 32-bit integer for LP64 platforms. - (FT_Face_GetCharVariantIndex): Check `charcode' and - `variantSelector' are within 32-bit integer for LP64 - platforms. - (FT_Face_GetCharsOfVariant): Check `variantSelector' is - within unsigned 32-bit integer for LP64 platforms. - - * src/base/fttrigon.c (ft_trig_downscale): The FT_Fixed - variable `val' and unsigned long constant FT_TRIG_SCALE - are cast to FT_UInt32, when calculates FT_UInt32. - (FT_Vector_Rotate): The long constant 1L is cast to - FT_Int32 to calculate FT_Int32 `half'. - -2009-07-31 suzuki toshiya - - cff: Cast the long variables to 32-bit for LP64 systems. - - * src/cff/cffdrivr.c (cff_get_advances): Insert - explicit cast to modify a 32-bit flag by unsigned - long constant. - - * src/cff/cffobjs.c (cff_face_init): Ditto. - - * src/cff/cffgload.c (cff_decoder_parse_charstrings): - Replace the casts to FT_Long by the casts to FT_Int32 - for LP64 platforms. - -2009-07-31 suzuki toshiya - - pcf: Improve PCF_PropertyRec.value names on LP64 platforms. - - * src/pcf/pcf.h: In PCF_PropertyRec.value, the member - `integer' is replaced by `l', `cardinal' is replaced - by `ul', to fix the difference between the name and - the types on LP64 platforms. - - * src/pcf/pcfdrivr.c (pcf_get_bdf_property): Reflect - PCF_PropertyRec.value change, with appropriate casts - to FT_Int32/FT_UInt32. Their destinations - BDF_PropertyRec.{integer|cardinal} are public and - explicitly defined as FT_Int32/FT_UInt32. - - * src/pcf/pcfread.c (pcf_get_properties, pcf_load_font): - Reflect PCF_PropertyRec.value change. - -2009-07-31 suzuki toshiya - - pcf: Fix some data types mismatching with their sources. - - * src/pcf/pcfdrivr.c (pcf_cmap_char_index): The type of - `code' is matched to PCF_Encoding->enc. - (pcf_cmap_char_next): The type of `charcode' is matched - to PCF_Encoding->enc. When *acharcode is set by charcode, - an overflow is checked and cast to unsigned 32-bit - integer. - -2009-07-31 suzuki toshiya - - bdf: Improve bdf_property_t.value names for LP64 platforms. - - * src/bdf/bdf.h: In bdf_property_t.value, the member - `int32' is replaced by `l', `card32' is replaced by - `ul', to fix the difference between the name and the - types on LP64 platforms. - - * src/bdf/bdfdrivr.c (BDF_Face_Init): Reflect - bdf_property_t.value change. - (bdf_get_bdf_property): Reflect bdf_property_t.value - change, with appropriate casts to FT_Int32/FT_UInt32. - Their destinations BDF_PropertyRec.{integer|cardinal} - are public and explicitly defined as FT_Int32/FT_UInt32. - - * src/bdf/bdflib.c (_bdf_add_property): Reflect - bdf_property_t.value change. - -2009-07-31 suzuki toshiya - - bdf: Fix some data types mismatching with their sources. - - * src/bdf/bdrdrivr.c (bdf_cmap_char_index): The type - of `code' is matched with BDF_encoding_el->enc. - (bdf_cmap_char_next): The type of `charcode' is - matched with BDF_encoding_el->enc. When *acharcode - is set by charcode, an overflow is checked and - cast to unsigned 32-bit integer. - -2009-07-31 suzuki toshiya - - autofit: Improve Unicode range definitions. - - * src/autofit/aftypes.h (AF_UNIRANGE_REC): New macro - to declare a range by two unsigned 32-bit integer, - to avoid 64-bit range definition on LP64 platforms. - - * src/autofit/aflatin.c (af_latin_uniranges): Ditto. - - * src/autofit/aflatin2.c (af_latin2_uniranges): Ditto. - - * src/autofit/afindic.c (af_indic_uniranges): Ditto. - - * src/autofit/afcjk.c (af_cjk_uniranges): Declare - the ranges by AF_UNIRANGE_REC. - -2009-07-31 suzuki toshiya - - smooth: Fix a data type mismatching with its source. - - * src/smooth/ftgrays.c (gray_sweep): The type of - `area' is matched with the 3rd argument `area' - of gray_hline(). - -2009-07-31 suzuki toshiya - - smooth: Fix a data type mismatching with its source. - - * src/smooth/ftgrays.c (gray_render_line): The type - of `area' is matched with TWorker.area. - -2009-07-31 suzuki toshiya - - cache: Disable the legacy compatibility if 16-bit system. - - * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): Exclude - the legacy behaviour from 16-bit platform, because the - current hack cannot detect the caller uses this function - via legacy convension. - (FTC_SBitCache_Lookup): Ditto. - -2009-07-31 suzuki toshiya - - cache: Check 32-bit glyph index on 16-bit systems. - - * src/cache/ftcbasic.c (ftc_basic_family_get_count): - Check overflow caused by the face including large - number of glyphs > 64k. - -2009-07-31 suzuki toshiya - - cache: Fix some data types mismatching with their sources. - - * src/cache/ftccache.c (ftc_cache_resize): The types of - `p', `mask', `count' are matched with FTC_Cache->{p,mask}. - (FTC_Cache_Clear): The type of `old_index' is matched to - FTC_Cache->{p,mask}. - - * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): The type - of `_idx' is matched with FTC_Cache->{p,mask}. - -2009-07-31 suzuki toshiya - - cache: Fix some data types mismatching with their sources. - - * src/cache/ftcsbits.c (ftc_snode_load): The types - of `xadvance' and `yadvance' are matched with - FT_GlyphSlot->advance.{x|y}. - -2009-07-31 suzuki toshiya - - cache: Cast NULL to a required function type explicitly. - - * src/cache/ftcmanag.c (FTC_Manager_RemoveFaceID): - Insert explicit cast from NULL to function type. - -2009-07-31 suzuki toshiya - - fttypes.h: Cast FT_MAKE_TAG output to FT_Tag exlicitly. - - * include/freetype/fttypes.h (FT_MAKE_TAG): - Cast the result to FT_Tag. - -2009-07-31 suzuki toshiya - - psnames: Handle Unicode codepoints by FT_UInt32 variables. - - * src/psnames/psmodule.c (BASE_GLYPH): Cast the result - to unsigned 32-bit integer for LP64 platform. - (ps_unicode_value): Return the value by unsigned 32-bit - integer instead of unsigned long. - -2009-07-31 suzuki toshiya - - psaux: Use size_t variable to pass the buffer size. - - * src/psaux/psaux.h (to_bytes): The type of `max_bytes' - (the argument to pass the buffer size) is changed to - size_t, to match with ANSI C string functions. - - * src/psaux/psconv.h (PS_Conv_StringDecode, - PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Ditto. - - * src/psaux/psconv.c (PS_Conv_StringDecode, - PS_Conv_ASCIIHexDecode, PS_Conv_EexecDecode): Ditto. - - * src/psaux/psobjs.h (ps_parser_to_bytes): Ditto. - - * src/psaux/psobjs.c (ps_parser_to_bytes): Ditto. - -2009-07-31 suzuki toshiya - - type1: Use size_t variable to pass the string length. - - * psaux.h: The type of `len' (the argument to pass - the buffer size to the function in AFM_ParserRec) - is changed to size_t, to match with ANSI C string - functions. - - * t1afm.c (t1_get_index): Ditto. - - * test_afm.c (dummy_get_index): Ditto. - - * afmparse.c (afm_parser_read_vals): To call - AFM_ParserRec.get_index, the length of token - `len' is cast to size_t. - -2009-07-31 suzuki toshiya - - cid: Fix some data types mismatching with their sources. - - * src/cid/cidparse.c (cid_parser_new): The types of - `read_len' and `stream_len' are matched to - FT_Stream->size. Unrequired cast is removed. - -2009-07-31 suzuki toshiya - - cff: Fix for unused variable `rest'. - - * src/cff/cffparse.c (cff_parse_real): Insert - FT_UNUSED() to hide the unused variable warning. - -2009-07-31 suzuki toshiya - - cff: Fix some data types mismatching with their sources. - - * src/cff/cffgload.c (cff_slot_load): The types of - `top_upm' and `sub_upm' are matched with - CFF_FontRecDict->units_per_em. - - * src/cff/cffobjs.c (cff_size_select): Ditto. - (cff_size_request): Ditto. - -2009-07-31 suzuki toshiya - - bdf: Fix some data types mismatching with their sources. - - * bdflib.c (_bdf_list_ensure): The type of `num_items' - is matched with _bdf_list_t.used. Also the types of - `oldsize', `newsize', `bigsize' are matched too. - (_bdf_readstream): `cursor' is used as an offset to - the pointer, it should be typed as FT_Offset. Also - the types of `bytes', `start', `end', `avail' are matched. - - * bdfdrivr.c: The type of BDF_CMap->num_encodings is - matched with FT_CMap->clazz->size. - (bdf_cmap_char_index): The types of `min', `max', `mid' - are matched with BDF_CMap->num_encodings. The type of - `result' is matched with encoding->glyph. - (bdf_cmap_char_next): Ditto, the type of `code' is - matched with BDF_encoding_el.enc. - (bdf_interpret_style): The type of `lengths' is changed - to size_t, to take the value by ft_strlen(). Also the - types of `len', `nn', `mm' are matched. - -2009-07-31 suzuki toshiya - - sfnt: Count the size of the memory object by ptrdiff_t. - - * src/sfnt/ttbdf.c (tt_face_find_bdf_prop): The type of - `peroperty_len' is changed from FT_UInt to FT_Offset, - to match with size_t, which is appropriate type for the - object in the memory buffer. - -2009-07-31 suzuki toshiya - - lzw: Count the size of the memory object by ptrdiff_t. - - * src/lzw/ftzopen.h: The types of FT_LzwState->{buf_total, - stack_size} are changed from FT_UInt to FT_Offset, to match - with size_t, which is appropriate type for the object in - the memory buffer. - - * src/lzw/ftzopen.c (ft_lzwstate_stack_grow): The types of - `old_size' and `new_size' are changed from FT_UInt to - FT_Offset, to match with size_t, which is appropriate type - for the object in the memory buffer. - -2009-07-31 suzuki toshiya - - otvalid: Count the table size on memory by ptrdiff_t. - - * src/otvalid/otvgpos.c (otv_ValueRecord_validate): - Change the type of table size from FT_UInt to - FT_PtrDist because it is calculated by the memory - addresses. - -2009-07-31 suzuki toshiya - - otvalid: Prevent an overflow by GPOS/GSUB 32b-bit offset. - - * src/otvalid/otvgpos.c (otv_ExtensionPos_validate): - Extend ExtensionOffset from FT_UInt to FT_ULong, to - cover 32-bit offset on 16-bit platform. - - * src/otvalid/otvgsub.c (otv_ExtensionSubst_validate): - Ditto. - -2009-07-31 suzuki toshiya - - ftobjs.c: Prevent an overflow in glyph index handling. - - * src/base/ftobjs.c (FT_Face_GetCharsOfVariant): - Improve the cast in comparison to avoid the truncation. - -2009-07-31 suzuki toshiya - - Improve the variable types in raccess_make_file_name(). - - * src/base/ftrfork.c (raccess_make_file_name): - Change the type of cursor variable `tmp' to const char*, - to prevent the unexpected modification of original pathname. - (raccess_make_file_name): Change the type of new_length - to size_t. - -2009-07-31 suzuki toshiya - - ftpatent.c: Fix for unused variable `error'. - - * src/base/ftpatent.c (_tt_check_patents_in_range): - Fix warning for unused variable `error'. - -2009-07-31 suzuki toshiya - - type1: Check invalid string longer than PostScript limit. - - * src/type1/t1afm.c (t1_get_index): Check invalid string - which exceeds the limit of PostScript string/name objects. - -2009-07-31 suzuki toshiya - - gzip: Use FT2 zcalloc() & zfree() in ftgzip.c by default. - - * src/gzip/ftgzip.c (zcalloc, zcfree): Disable all - zcalloc() & zfree() by zlib in zutil.c, those in - ftgzip.c by FT2 are enabled by default. To use - zlib zcalloc() & zfree(), define USE_ZLIB_ZCALLOC. - See discussion: - http://lists.gnu.org/archive/html/freetype-devel/2009-02/msg00000.html - -2009-07-31 suzuki toshiya - - gzip: Distinguish PureC from TurboC on MSDOS. - - * src/gzip/zutil.c (zcalloc, zcfree): Enable only for - MSDOS platform. - -2009-07-31 suzuki toshiya - - gxvalid: Insert PureC pragma to allow unevaluated variables. - - * builds/atari/ATARI.H: Insert PureC pragma not to - warn against set-but-unevaluated variable in gxvalid - module. - -2009-07-31 suzuki toshiya - - gxvalid: Pass the union by the pointer instead of the value. - - * src/gxvalid/gxvcommn.h: - - Declare new type `GXV_LookupValueCPtr'. - - Update the type of the 2nd argument to pass GXV_LookupValueDesc - data to the function prototyped as GXV_Lookup_Value_Validate_Func, - from GXV_LookupValueDesc to GXV_LookupValueCPtr. - - Likewise for the function prototyped as - GXV_Lookup_Fmt4_Transit_Func. - - - Declare new type `GXV_StateTable_GlyphOffsetCPtr'. - - Update the type of the 3rd argument to pass - GXV_StateTable_GlyphOffsetDesc data to the function prototyped - as GXV_StateTable_Entry_Validate_Func, from - GXV_StateTable_GlyphOffsetDesc to GXV_StateTable_GlyphOffsetCPtr. - - - Declare new type `GXV_XStateTable_GlyphOffsetCPtr'. - - Update the type of the 3rd argument to pass - GXV_XStateTable_GlyphOffsetDesc data to the function prototyped - as GXV_XStateTable_Entry_Validate_Func, - from GXV_XStateTable_GlyphOffsetDesc - to GXV_XStateTable_GlyphOffsetCPtr. - - * src/gxvalid/gxvcommn.c (gxv_LookupTable_fmt0_validate, - gxv_XClassTable_lookupval_validate, - gxv_XClassTable_lookupfmt4_transit): - Update from GXV_LookupValueDesc to GXV_LookupValueCPtr. - - * src/gxvalid/gxvbsln.c (gxv_bsln_LookupValue_validate, - gxv_bsln_LookupFmt4_transit): Ditto. - - * src/gxvalid/gxvjust.c - (gxv_just_pcTable_LookupValue_entry_validate, - gxv_just_classTable_entry_validate, - gxv_just_wdcTable_LookupValue_validate): Ditto. - - * src/gxvalid/gxvkern.c - (gxv_kern_subtable_fmt1_entry_validate): Ditto. - - * src/gxvalid/gxvlcar.c (gxv_lcar_LookupValue_validate, - gxv_lcar_LookupFmt4_transit): Ditto. - - * src/gxvalid/gxvopbd.c (gxv_opbd_LookupValue_validate, - gxv_opbd_LookupFmt4_transit): Ditto. - - * src/gxvalid/gxvprop.c (gxv_prop_LookupValue_validate, - gxv_prop_LookupFmt4_transit): Ditto. - - * src/gxvalid/gxvmort4.c - (gxv_mort_subtable_type4_lookupval_validate): Ditto. - - * src/gxvalid/gxvmort0.c - (gxv_mort_subtable_type0_entry_validate): Update - from GXV_StateTable_GlyphOffsetDesc - to GXV_StateTable_GlyphOffsetCPtr. - - * src/gxvalid/gxvmort1.c - (gxv_mort_subtable_type1_entry_validate): Ditto. - - * src/gxvalid/gxvmort2.c - (gxv_mort_subtable_type2_entry_validate): Ditto. - - * src/gxvalid/gxvmort5.c - (gxv_mort_subtable_type5_entry_validate): Ditto. - - * src/gxvalid/gxvmorx2.c - (gxv_morx_subtable_type2_entry_validate): Ditto. - - * src/gxvalid/gxvmorx5.c - (gxv_morx_subtable_type5_entry_validate): Ditto. - - * src/gxvalid/gxvmorx1.c - (gxv_morx_subtable_type1_entry_validate): Ditto. - (gxv_morx_subtable_type1_LookupValue_validate, - gxv_morx_subtable_type1_LookupFmt4_transit): - Update from GXV_LookupValueDesc to GXV_LookupValueCPtr. - - * src/gxvalid/gxvmorx0.c - (gxv_morx_subtable_type0_entry_validate): Update - from GXV_XStateTable_GlyphOffsetDesc - to GXV_XStateTable_GlyphOffsetCPtr. - -2009-07-29 Fabrice Bellet - - Fix Redhat bugzilla #513582 and Savannah bug #26849. - - * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP) : Fix - aliasing bug. - -2009-07-19 Werner Lemberg - - Document recent library changes. - - * docs/CHANGES: Do it. - -2009-07-17 Werner Lemberg - - Fix Savannah bug #23786. - - * src/truetype/ttobjs.c (tt_size_init_bytecode): Don't reset x_ppem - and y_ppem. Otherwise the `*_CVT_Stretched' functions in ttinterp.c - get never called. - An anonymous guy suggested this change on Savannah, and it seems to - be the right solution. - -2009-07-15 Werner Lemberg - - * docs/release: Updated. - -2009-07-15 Werner Lemberg - - README.CVS -> README.git - - * README.CVS: Renamed to... - * README.git: This. - Updated. - -2009-07-15 suzuki toshiya - - Borland C++ compiler patch proposed by Mirco Babin. - http://lists.gnu.org/archive/html/freetype/2009-07/msg00016.html. - - * builds/exports.mk: Delete unused flags, CCexe_{CFLAGS,LDFLAGS}. - Fix APINAMES_C and APINAMES_EXE pathnames to reflect the platform - specific pathname syntax. - * builds/compiler/bcc.mk: Remove unused flag, CCexe_LDFLAGS. - Define TE = `-e' separately (bcc32 cannot specify the pathname of - binary executable by T = `-o'). - Extend the large page size in linking freetype.lib. - Add extra CLEAN target to delete bcc specific temporary files. - * builds/compiler/bcc-dev.mk: Ditto. - -2009-07-14 Werner Lemberg - - Fix Savannah bug #27026. - - * builds/win32/vc2005/freetype.sln: Use correct version number. - -2009-07-12 suzuki toshiya - - Add a script to check the undefined and unused trace macros. - - * src/tools/chktrcmp.py: A script to check trace_XXXX macros - that are used in C source but undefined in fttrace.h, or - defined in fttrace.h but unused in C sources. See - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html. - * docs/DEBUG: Mention on chktrcmp.py. - * docs/release: Ditto. - -2009-07-09 Werner Lemberg - - [ftraster] Make it compile again with -D_STANDALONE_. - - * src/raster/ftraster.c [_STANDALONE_]: Define - FT_CONFIG_STANDARD_LIBRARY_H. - Include `string.h'. - Don't include `rastpic.h'. - Define FT_DEFINE_RASTER_FUNCS. - -2009-07-09 suzuki toshiya - - smooth: Check glyph size by width/height, instead of pitch/height. - Suggested by der Mouse . - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): Improve - the check for too large glyph. Replace the pair of `pitch' and - `height' by the pair of `width' and `height'. `pitch' cannot - be greater than `height'. The required is checking the product - `pitch' * `height' <= FT_ULONG_MAX, but we use cheap checks for - the realistic case only. - -2009-07-09 suzuki toshiya - - Register 2 missing trace components, t1afm and ttbdf. - - * include/freetype/internal/fttrace.h: Add FT_TRACE_DEF( t1afm ) - and FT_TRACE_DEF( ttbdf ). See - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00013.html - -2009-07-09 suzuki toshiya - - Register a trace component for ftgloadr.c. - - * include/freetype/internal/fttrace.h: Add FT_TRACE_DEF( gloader ). - The macro `trace_gloader' was already used in the initial version - on 2002-02-24. - -2009-07-08 suzuki toshiya - - Prevent the overflows by a glyph with too many points or contours. - The bug is reported by Boris Letocha . See - http://lists.gnu.org/archive/html/freetype-devel/2009-06/msg00031.html - http://lists.gnu.org/archive/html/freetype-devel/2009-07/msg00002.html - - * include/freetype/ftimage.h (FT_OUTLINE_CONTOURS_MAX, - FT_OUTLINE_POINTS_MAX): New macros to declare the maximum - values of FT_Outline.{n_contours,n_points}. - * src/base/ftgloadr.c (FT_GlyphLoader_CheckPoints): Check the - total numbers of points and contours cause no overflows in - FT_Outline.{n_contours,n_points}. - - * include/freetype/internal/ftgloadr.h (FT_GLYPHLOADER_CHECK_P, - FT_GLYPHLOADER_CHECK_C): Compare the numbers of points and - contours as unsigned long number, instead of signed int, to - prevent the overflows on 16-bit systems. - -2009-07-05 Bram Tassyns - - Improve compatibility to Acroread. - This fixes Savannah bug #26944. - - * src/cff/cffload.c (cff_charset_compute_cids): For multiple GID to - single CID mappings, make the lowest value win. - -2009-06-28 suzuki toshiya - - ftpatent: Fix a bug by wrong usage of service->table_info(). - http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00039.html - - * include/freetype/internal/services/svsfnt.h: Extend - FT_SFNT_TableInfoFunc() to take new argument to obtain the offset - to the specified table. - * src/sfnt/sfdriver.c (sfnt_table_info): Extend to return the - table-offset to the caller function. - * src/base/ftpatent.c (_tt_check_patents_in_table): Use new - service->table_info(). - * src/base/ftobjs.c (FT_Sfnt_Table_Info): Synchronize to new - service->table_info(). - -2009-06-28 Werner Lemberg - - [psaux, cff] Protect against nested `seac' calls. - - * include/freetype/internal/psaux.h (T1_Decoder), src/cff/cffgload.h - (CFF_Decoder): Add `seac' boolean variable. - - * src/cff/cffgload.c (cff_operator_seac), src/psaux/t1decode.c - (t1operator_seac): Use it. - -2009-06-28 Werner Lemberg - - Thinko. - - * src/psaux/t1decode.c (t1operator_seac) - [FT_CONFIG_OPTION_INCREMENTAL]: Test for existence of incremental - interface. - -2009-06-28 Werner Lemberg - - * devel/ftoption.h [FT_CONFIG_OPTION_INCREMENTAL]: Define. - -2009-06-27 suzuki toshiya - - Add tools to preprocess the source files for AtariST PureC. - - * builds/atari/deflinejoiner.awk: New file to filter C source files - for broken C preprocessor of PureC compiler. - - * builds/atari/gen-purec-patch.sh: New file to generate a patch set - for PureC, by using deflinejoiner.awk. - -2009-06-27 suzuki toshiya - - Keep existing modules.cfg in the building tree. - - * configure: If `configure' is executed outside of the source tree, - an existing `modules.cfg' file in the build directory should be - kept, not overwritten by the version in the source tree. - -2009-06-27 suzuki toshiya - - Filter --srcdir= option before invoking builds/unix/configure. - - * configure: If builds/unix/configure is invoked with --srcdir - option, the option should take `builds/unix' directory instead of - the top source directory. Thus the configure script in the top - directory should modify the --srcdir= option if - `builds/unix/configure' is invoked. - -2009-06-27 suzuki toshiya - - Improve configure.raw for cross-building on exe-suffixed systems. - - * builds/unix/configure.raw: Fix a bug in sed script to extract - native suffix for binary executables, patch by Peter Breitenlohner. - http://lists.gnu.org/archive/html/freetype-devel/2009-04/msg00036.html - -2009-06-26 Werner Lemberg - - [truetype] Remove TT_SubGlyphRec. - - * src/truetype/ttobjs.h (TT_SubGlyphRec): Removed, unused. - -2009-06-26 Werner Lemberg - - * */*: For warning messages, replace FT_ERROR with FT_TRACE0. - - FT_ERROR is now used only if a function produces a non-zero `error' - value. - - Formatting, improving and harmonizing debug strings. - -2009-06-25 Werner Lemberg - - Provide version information better. - - * src/base/ftinit.c (FT_Init_FreeType): Don't set version here - but... - * src/base/ftobjs.c (FT_New_Library): Here. - -2009-06-22 Werner Lemberg - - Use 16.16 format while parsing Type 1 charstrings. - This fixes Savannah bug #26867. - - Previously, only integers have been used which can lead to serious - rounding errors. - - However, fractional values are only used internally; after the - charstrings (of either Type 1 or 2) have been processed, the - resulting coordinates get rounded to integers currently -- before - applying scaling. This should be fixed; at the same time a new load - flag should be introduced, to be used in combination with - FT_LOAD_NO_SCALE, which indicates that font units are returned in - 16.16 format. Similarly, the incremental interface should be - extended to allow fractional values for metrics. - - * include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift' - field. - * include/freetype/internal/pshints.h (T1_Hints_SetStemFunc, - T1_Hints_SetStem3Func): Use FT_Fixed for coordinates. - - * src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H. - (t1_build_add_point): Always convert fixed to integer. - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): - Use 16.16 format everywhere (except for large integers followed by a - `div'). - [CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate - code uncoditionally. - Add support for random numbers and update remaining code - accordingly; this should work now. - (t1_operator_seac): Updated. - * src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H. - (ps_hints_t1stem3, t1_hints_stem): Updated. - - * src/cid/cidgload.c: Include FT_INTERNAL_CALC_H. - (cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL], - (cid_face_compute_max_advance, cid_slot_load_glyph): Updated. - - * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String) - [FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph): - Updated. - * src/type1/t1load.c: Include FT_INTERNAL_CALC_H. - * src/type1/t1objs.c (T1_Face_Init): Updated. - -2009-06-21 Werner Lemberg - - * src/pshinter/pshrec.c: Use PSH_Err_Ok. - -2009-06-21 Werner Lemberg - - Code beautification. - - * src/type1/t1load.c (FT_INT_TO_FIXED): Removed. - Replace everywhere with INT_TO_FIXED. - (FT_FIXED_TO_INT): Move to ... - * include/freetype/internal/ftcalc.h (FIXED_TO_INT): Here. - Update all users. - -2009-06-20 Werner Lemberg - - Remove unused variables. - - * include/freetype/internal/psaux.h (T1_BuilderRec), - src/cff/cffgload.h (CFF_Builder): Remove `last'. - Update all users. - -2009-06-20 Werner Lemberg - - [psaux] Check large integers while parsing charstrings. - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Large - integers must be followed by a `div' operator. - -2009-06-20 Werner Lemberg - - [cff] Revert last change. - - * src/cff/cffgload.c (cff_decoder_parse_charstrings): Do it. - Next time, don't confuse Type 2 charstring opcodes with TOP DICT - values... - -2009-06-20 Werner Lemberg - - * src/autofit/aflatin.c (af_latin_metrics_check_digits): Fix - compiler warning. - -2009-06-20 Werner Lemberg - - * builds/compiler/gcc.mk (CFLAGS): Use -O3, not -O6. - -2009-06-19 Werner Lemberg - - [cff] Fix handling of reserved byte 0xFF. - - * src/cff/cffgload.c (cff_decoder_parse_charstrings): Abort if byte - 0xFF is encountered. - -2009-06-19 Werner Lemberg - - Improve debug messages for Type1 charstrings. - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Emit newlines - after instructions. - Prettify output. - -2009-06-19 Werner Lemberg - - More ftgray fixes for FT_STATIC_RASTER. - Problems reported by suyu@cooee.cn. - - * src/smooth/ftgrays.c (gray_move_to, gray_raster_render): Use - RAS_VAR. - -2009-06-18 Werner Lemberg - - * docs/CHANGES: Updated. - -2009-06-18 Werner Lemberg - - Fix B/W rasterization of subglyphs with different drop-out modes. - - Normally, the SCANMODE instruction (if present) to set the drop-out - mode in a TrueType font is located in the `prep' table only and thus - valid for all glyphs. However, there are fonts like `pala.ttf' - which additionally contain this instruction in the hinting code of - some glyphs (but not all). As a result it can happen that a - composite glyph needs multiple drop-out modes for its subglyphs - since the rendering state gets reset for each subglyph. - - FreeType collects the hinted outlines from all subglyphs, then it - sends the data to the rasterizer. It also sends the drop-out mode - -- after hinting has been applied -- and here is the error: It sends - the drop-out mode of the last subglyph only; drop-out modes of all - other subglyphs are lost. - - This patch fixes the problem; it adds a second, alternative - mechanism to pass the drop-out mode: For each contour, the - rasterizer now checks the first `tags' array element. If bit 2 is - set, bits 5-7 contain the contour's drop-out mode, overriding the - global drop-out mode. - - * include/freetype/ftimage.h (FT_CURVE_TAG_HAS_SCANMODE): New macro. - - * src/truetype/ttgload.c (TT_Hint_Glyph): Store drop-out mode in - `tags[0]'. - - * src/raster/ftraster.c (Flow_Up, Overshoot_Top, Overshoot_Bottom): - Use bits 3-5 instead of 0-2. - (New_Profile): Set the drop-out mode in the profile's `flags' field. - (Decompose_Curve): Check `tags[0]' and set `dropOutControl' if - necessary. - (Vertical_Sweep_Drop, Horizontal_Sweep_Drop, - Horizontal_Gray_Sweep_Drop, Draw_Sweep): Use the profile's drop-out - mode. - -2009-06-16 Werner Lemberg - - Improve scan conversion rules 4 and 6. - - Two new constraints are introduced to better identify a `stub' -- a - concept which is only vaguely described in the OpenType - specification. The old code was too rigorous and suppressed more - pixel than it should. - - . The intersection of the two profiles with the scanline is less - than a half pixel. Code related to this was already present in - the sources but has been commented out. - - . The endpoint of the original contour forming a profile has a - distance (`overshoot') less than half a pixel to the scanline. - - Note that the two additional conditions fix almost all differences - to the Windows rasterizer, but some problematic cases remain. - - * src/raster/ftraster.c (Overshoot_Top, Overshoot_Bottom): New - macros for the `flags' field in the `TProfile' structure. - (IS_BOTTOM_OVERSHOOT, IS_TOP_OVERSHOOT): New macros. - (New_Profile, End_Profile): Pass overshoot flag as an argument and - set it accordingly. - Update callers. - (Vertical_Sweep_Drop, Horizontal_Sweep_Drop): Implement the two new - constraints. - -2009-06-11 Werner Lemberg - - Increase precision for B/W rasterizer. - - * src/raster/ftraster.c (Set_High_Precision): Add two more bits to - the precision. This corrects rendering of some small glyphs, for - example, glyph `xi' in verdana.ttf at 13 ppem. Testing with ftbench - on my GNU/Linux box I don't see a performance degradation. - -2009-06-08 Michael Zucchi - - Handle FT_STROKER_LINECAP_BUTT. - This fixes Savannah bug #26757. - - * src/base/ftstroke.c (ft_stroker_cap): Implement it. - -2009-06-07 Harald Fernengel - - Fix some potential out-of-memory crashes. - - * src/base/ftobjs.c (ft_glyphslot_done): Check `slot->internal'. - * src/base/ftstream.c (FT_Stream_ReleaseFrame): Check `stream'. - * src/truetype/ttinterp.c (TT_New_Context): Avoid double-free of - `exec' in case of failure. - -2009-06-07 Werner Lemberg - - Simplify math. - Suggested by Alexei Podtelezhnikov . - - * src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop, - Horizontal_Gray_Sweep_Drop): Do it. - -2009-06-04 Werner Lemberg - - Preparation for fixing scan conversion rules 4 and 6. - - * src/raster/ftraster.c (TFlow): Replace enumeration with... - (Flow_Up): This macro. - (TProfile): Replace `flow' member with `flags' bit field. - Update all affected code. - -2009-05-29 James Cloos - - Enable autohinting for glyphs rotated by multiples of 90°. - - * src/base/ftobjs.c (FT_Load_Glyph): Alter check for permitted - matrices to allow rotations by multiples of 90°, not only unrotated, - possibly slanted matrices. - -2009-05-28 Werner Lemberg - - Remove compiler warning. - Reported by Krzysztof Kowalczyk . - - * src/autofit/aflatin2.c (af_latin2_hint_edges): Move declaration of - `n_edges' into `#if' block. - -2009-05-28 Werner Lemberg - - Make compilation work with FT_CONFIG_OPTION_USE_ZLIB not defined. - Reported by Krzysztof Kowalczyk . - - * src/pcf/pcfdrivr.c (PCF_Face_Init) [!FT_CONFIG_OPTION_USE_ZLIB]: - Make it work. - Simplify #ifdef logic. - -2009-05-22 Werner Lemberg - - Improve b/w rasterizer. - Problem reported by Krzysztof Kotlenga . - - * src/raster/raster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop, - Horizontal_Gray_Sweep_Drop): For smart drop-out mode, if - intersections are equally distant relative to next pixel center, - select the left pixel, not the right one. - -2009-05-19 Werner Lemberg - - Fix Savannah bug #26600. - - * src/type42/t42parse.c (t42_load_keyword): Handle - T1_FIELD_LOCATION_FONT_EXTRA. - -2009-04-30 Werner Lemberg - - Document recent changes to ftview. - - * docs/CHANGES: Do it. - -2009-04-27 Werner Lemberg - - autohinter: Don't change digit widths if all widths are the same. - This fixes FreeDesktop bug #21197. - - * src/autofit/afglobal.c (AF_DIGIT): New macro. - (af_face_globals_compute_script_coverage): Mark ASCII digits in - `glyph_scripts' array. - (af_face_globals_get_metrics): Updated. - (af_face_globals_is_digit): New function. - * src/autofit/afglobal.h: Updated. - (AF_ScriptMetricsRec): Add `digits_have_same_width' flag. - - * src/autofit/aflatin.c: Include FT_ADVANCES_H. - (af_latin_metrics_check_digits): New function. - (af_latin_metrics_init): Use it. - * src/autofit/aflatin.h: Updated. - * src/autofit/afcjk.c (af_cjk_metrics_init): Updated. - - * src/autofit/aflatin2.c: Similar changes as with aflatin.c. - - * src/autofit/afloader.c (af_loader_load_g): Test digit width. - - * docs/CHANGES: Document it. - -2009-04-26 Werner Lemberg - - Make ftgrays compile with _STANDALONE_ and FT_STATIC_RASTER again. - Problems reported by suyu@cooee.cn. - - * src/smooth/ftgrays.c (FT_DEFINE_OUTLINE_FUNCS, - FT_DEFINE_RASTER_FUNCS) [_STANDALONE_]: Define. - [!_STANDALONE_]: Include ftspic.h only here. - (ras): Define/declare after definition of `TWorker'. - Use `RAS_VAR_' where necessary. - -2009-04-21 Karl Berry - - Fix AC_CHECK_FT2. - - * builds/unix/freetype2.m4: Only check PATH for freetype-config if - we did not already find it from a prefix option. - -2009-04-05 Oran Agra - - Add #error to modules and files that do not support PIC yet. - - When FT_CONFIG_OPTION_PIC is defined the following files will - create #error: - * src/bdf/bdfdrivr.h - * src/cache/ftcmanag.c - * src/cid/cidriver.h - * src/gxvalid/gxvmod.h - * src/gzip/ftgzip.c - * src/lzw/ftlzw.c - * src/otvalid/otvmod.h - * src/pcf/pcfdrivr.h - * src/pfr/pfrdrivr.h - * src/psaux/psauxmod.h - * src/type1/t1driver.h - * src/type42/t42drivr.h - * src/winfonts/winfnt.h - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support in autofit module. - - * include/freetype/internal/autohint.h add macros to init - instances of FT_AutoHinter_ServiceRec. - - * src/autofit/afmodule.h declare autofit_module_class - using macros from ftmodapi.h, - when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/autofit/afmodule.c when FT_CONFIG_OPTION_PIC is defined - af_autofitter_service and autofit_module_class structs - will have functions to init or create and destroy them - instead of being allocated in the global scope. - And macros will be used from afpic.h in order to access them. - - * src/autofit/aftypes.h add macros to init and declare - instances of AF_ScriptClassRec. - - * src/autofit/afcjk.h declare af_cjk_script_class - using macros from aftypes.h, - when FT_CONFIG_OPTION_PIC is defined init function will be declared. - * src/autofit/afcjk.c when FT_CONFIG_OPTION_PIC is defined - af_cjk_script_class struct will have function to init it instead of - being allocated in the global scope. - - * src/autofit/afdummy.h declare af_dummy_script_class - using macros from aftypes.h, - when FT_CONFIG_OPTION_PIC is defined init function will be declared. - * src/autofit/afdummy.c when FT_CONFIG_OPTION_PIC is defined - af_dummy_script_class struct will have function to init it instead of - being allocated in the global scope. - - * src/autofit/afindic.h declare af_indic_script_class - using macros from aftypes.h, - when FT_CONFIG_OPTION_PIC is defined init function will be declared. - * src/autofit/afindic.c when FT_CONFIG_OPTION_PIC is defined - af_indic_script_class struct will have function to init it instead of - being allocated in the global scope. - - * src/autofit/aflatin.h declare af_latin_script_class - using macros from aftypes.h, - when FT_CONFIG_OPTION_PIC is defined init function will be declared. - * src/autofit/aflatin.c when FT_CONFIG_OPTION_PIC is defined - af_latin_script_class struct will have function to init it instead of - being allocated in the global scope. - Change af_latin_blue_chars to be PIC-compatible by being a two - dimentional array rather than array of pointers. - - - * src/autofit/aflatin2.h declare af_latin2_script_class - using macros from aftypes.h, - when FT_CONFIG_OPTION_PIC is defined init function will be declared. - * src/autofit/aflatin2.c when FT_CONFIG_OPTION_PIC is defined - af_latin2_script_class struct will have function to init it instead of - being allocated in the global scope. - Change af_latin2_blue_chars to be PIC-compatible by being a two - dimentional array rather than array of pointers. - - * src/autofit/afglobal.c when FT_CONFIG_OPTION_PIC is defined - af_script_classes array initialization was moved to afpic.c and - is later refered using macros defeined in afpic.h. - - New Files: - * src/autofit/afpic.h declare struct to hold PIC globals for autofit - module and macros to access them. - * src/autofit/afpic.c implement functions to allocate, destroy and - initialize PIC globals for autofit module. - - * src/autofit/autofit.c add new file to build: afpic.c. - * src/autofit/jamfile add new files to FT2_MULTI build: afpic.c. - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support in pshinter module. - - * include/freetype/internal/pshints.h add macros to init - instances of PSHinter_Interface. - - * src/pshinter/pshmod.h declare pshinter_module_class - using macros from ftmodapi.h, - when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/pshinter/pshmod.c when FT_CONFIG_OPTION_PIC is defined - pshinter_interface and pshinter_module_class structs - will have functions to init or create and destroy them - instead of being allocated in the global scope. - And macros will be used from pshpic.h in order to access them. - - New Files: - * src/pshinter/pshpic.h declare struct to hold PIC globals for pshinter - module and macros to access them. - * src/pshinter/pshpic.c implement functions to allocate, destroy and - initialize PIC globals for pshinter module. - - * src/pshinter/pshinter.c add new file to build: pshpic.c. - * src/pshinter/jamfile add new files to FT2_MULTI build: pshpic.c. - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support in psnames module. - - * include/freetype/internal/services/svpscmap.h add macros to init - instances of FT_Service_PsCMapsRec. - - * src/psnames/psmodule.h declare psnames_module_class - using macros from ftmodapi.h, - when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/psnames/psmodule.c when FT_CONFIG_OPTION_PIC is defined - pscmaps_interface and pscmaps_services structs - and psnames_module_class array - will have functions to init or create and destroy them - instead of being allocated in the global scope. - And macros will be used from pspic.h in order to access them. - - New Files: - * src/psnames/pspic.h declare struct to hold PIC globals for psnames - module and macros to access them. - * src/psnames/pspic.c implement functions to allocate, destroy and - initialize PIC globals for psnames module. - - * src/psnames/psnames.c add new file to build: pspic.c. - * src/psnames/jamfile add new files to FT2_MULTI build: pspic.c. - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support in raster renderer. - - * src/raster/ftrend1.h declare ft_raster1_renderer_class - and ft_raster5_renderer_class - using macros from ftrender.h, - when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/smooth/ftrend1.c when FT_CONFIG_OPTION_PIC is defined - ft_raster1_renderer_class and ft_raster5_renderer_class structs - will have functions to init or create and destroy them - instead of being allocated in the global scope. - Macros will be used from rastpic.h in order to access - ft_standard_raster from the pic_container (allocated in ftraster.c). - In ft_raster1_render when PIC is enabled, the last letter of - module_name is used to verfy the renderer class rather than the - class pointer. - - * src/raster/ftraster.c when FT_CONFIG_OPTION_PIC is defined - ft_standard_raster struct will have function to init it - instead of being allocated in the global scope. - - New Files: - * src/raster/rastpic.h declare struct to hold PIC globals for raster - renderer and macros to access them. - * src/raster/rastpic.c implement functions to allocate, destroy and - initialize PIC globals for raster renderer. - - * src/raster/raster.c add new file to build: rastpic.c. - * src/raster/jamfile add new files to FT2_MULTI build: rastpic.c. - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support in smooth renderer. - - * src/smooth/ftsmooth.h declare ft_smooth_renderer_class, - ft_smooth_lcd_renderer_class and ft_smooth_lcd_v_renderer_class - using macros from ftrender.h, - when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/smooth/ftsmooth.c when FT_CONFIG_OPTION_PIC is defined - the following structs: - ft_smooth_renderer_class, ft_smooth_lcd_renderer_class - and ft_smooth_lcd_v_renderer_class - will have functions to init or create and destroy them - instead of being allocated in the global scope. - And macros will be used from ftspic.h in order to access - ft_grays_raster from the pic_container (allocated in ftgrays.c). - - * src/smooth/ftgrays.h include FT_CONFIG_CONFIG_H - * src/smooth/ftgrays.c when FT_CONFIG_OPTION_PIC is NOT defined - func_interface was moved from gray_convert_glyph_inner function - to the global scope. - When FT_CONFIG_OPTION_PIC is defined - func_interface and ft_grays_raster structs - will have functions to init them - instead of being allocated in the global scope. - And func_interface will be allocated on the stack of - gray_convert_glyph_inner. - - New Files: - * src/smooth/ftspic.h declare struct to hold PIC globals for smooth - renderer and macros to access them. - * src/smooth/ftspic.c implement functions to allocate, destroy and - initialize PIC globals for smooth renderer. - - * src/smooth/smooth.c add new file to build: ftspic.c. - * src/smooth/jamfile add new files to FT2_MULTI build: ftspic.c. - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support in cff driver. - - * include/freetype/internal/services/svcid.h add macros to init - instances of FT_Service_CIDRec. - * include/freetype/internal/services/svpsinfo.h add macros to init - instances of FT_Service_PsInfoRec. - - * src/cff/cffcmap.h declare cff_cmap_encoding_class_rec - and cff_cmap_unicode_class_rec using macros from - ftobjs.h, when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/cff/cffcmap.c when FT_CONFIG_OPTION_PIC is defined - the following structs: - cff_cmap_encoding_class_rec and cff_cmap_unicode_class_rec - will have functions to init or create and destroy them - instead of being allocated in the global scope. - - * src/cff/cffdrivr.h declare cff_driver_class using macros from - ftdriver.h, when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/cff/cffdrivr.c when FT_CONFIG_OPTION_PIC is defined - the following structs: - cff_service_glyph_dict, cff_service_ps_info, cff_service_ps_name - cff_service_get_cmap_info, cff_service_cid_info, cff_driver_class, - and cff_services array - will have functions to init or create and destroy them - instead of being allocated in the global scope. - And macros will be used from cffpic.h in order to access them - from the pic_container. - Use macros from cffpic.h in order to access the - structs allocated in cffcmap.c - - * src/cff/cffobjs.c Use macros from cffpic.h in order to access the - structs allocated in cffcmap.c - - * src/cff/parser.c when FT_CONFIG_OPTION_PIC is defined - implement functions to create and destroy cff_field_handlers array - instead of being allocated in the global scope. - And macros will be used from cffpic.h in order to access it - from the pic_container. - - New Files: - * src/cff/cffpic.h declare struct to hold PIC globals for cff - driver and macros to access them. - * src/cff/cffpic.c implement functions to allocate, destroy and - initialize PIC globals for cff driver. - - * src/cff/cff.c add new file to build: cffpic.c. - * src/cff/jamfile add new files to FT2_MULTI build: cffpic.c. - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support in sfnt driver. - - * include/freetype/internal/services/svbdf.h add macros to init - instances of FT_Service_BDFRec. - * include/freetype/internal/services/svgldict.h add macros to init - instances of FT_Service_GlyphDictRec. - * include/freetype/internal/services/svpostnm.h add macros to init - instances of FT_Service_PsFontNameRec. - * include/freetype/internal/services/svsfnt.h add macros to init - instances of FT_Service_SFNT_TableRec. - * include/freetype/internal/services/svttcmap.h add macros to init - instances of FT_Service_TTCMapsRec. - * include/freetype/internal/sfnt.h add macros to init - instances of SFNT_Interface. - - * src/sfnt/sfdriver.h declare sfnt_module_class using macros from - ftmodapi.h, when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/sfnt/sfdriver.c when FT_CONFIG_OPTION_PIC is defined - the following structs: - sfnt_service_sfnt_table, sfnt_service_glyph_dict, sfnt_service_ps_name - tt_service_get_cmap_info, sfnt_service_bdf, sfnt_interface, - sfnt_module_class, and sfnt_services array - will have functions to init or create and destroy them - instead of being allocated in the global scope. - And macros will be used from sfntpic.h in order to access them - from the pic_container. - - * src/sfnt/ttcmap.h add macros to init - instances of TT_CMap_ClassRec. - * src/sfnt/ttcmap.c when FT_CONFIG_OPTION_PIC is defined - the following structs: - tt_cmap0_class_rec, tt_cmap2_class_rec, tt_cmap4_class_rec - tt_cmap6_class_rec, tt_cmap8_class_rec, tt_cmap10_class_rec, - tt_cmap12_class_rec, tt_cmap14_class_rec and tt_cmap_classes array - will have functions to init or create and destroy them - instead of being allocated in the global scope. - And macros will be used from sfntpic.h in order to access them - from the pic_container. - The content of tt_cmap_classes is now described in the - new file 'ttcmapc.h'. - - New Files: - * src/sfnt/sfntpic.h declare struct to hold PIC globals for sfnt - driver and macros to access them. - * src/sfnt/sfntpic.c implement functions to allocate, destroy and - initialize PIC globals for sfnt driver. - * src/sfnt/ttcmapc.h describing the content of - tt_cmap_classes allocated in ttcmap.c - - * src/sfnt/sfnt.c add new file to build: sfntpic.c. - * src/sfnt/jamfile add new files to FT2_MULTI build: sfntpic.c. - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support in truetype driver. - - * include/freetype/internal/services/svmm.h add macros to init - instances of FT_Service_MultiMastersRec. - * include/freetype/internal/services/svttglyf.h add macros to init - instances of FT_Service_TTGlyfRec. - - * src/truetype/ttdriver.h declare tt_driver_class using macros from - ftdriver.h, when FT_CONFIG_OPTION_PIC is defined create and destroy - functions will be declared. - * src/truetype/ttdriver.c when FT_CONFIG_OPTION_PIC is defined - the following structs: - tt_service_gx_multi_masters, tt_service_truetype_glyf, tt_driver_class - and tt_services array, - will have functions to init or create and destroy them - instead of being allocated in the global scope. - And macros will be used from ttpic.h in order to access them - from the pic_container. - * src/truetype/ttobjs.c change trick_names array to be - PIC-compatible by being a two dimentional array rather than array - of pointers. - - New Files: - * src/truetype/ttpic.h declare struct to hold PIC globals for truetype - driver and macros to access them. - * src/truetype/ttpic.c implement functions to allocate, destroy and - initialize PIC globals for truetype driver. - - * src/truetype/truetype.c add new file to build: ttpic.c. - * src/truetype/jamfile add new files to FT2_MULTI build: ttpic.c. - -2009-04-05 Oran Agra - - Position Independent Code (PIC) support and infrastructure in base. - - * include/freetype/config/ftoption.h add FT_CONFIG_OPTION_PIC - * include/freetype/internal/ftobjs.h Add pic_container member to - FT_LibraryRec. - Add macros to declare and init instances of FT_CMap_ClassRec. - Add macros to init instances of FT_Outline_Funcs and FT_Raster_Funcs. - Add macros to declare, allocate and initialize modules - (FT_Module_Class). - Add macros to declare, allocate and initialize renderers - (FT_Renderer_Class). - Add macro to init instances of FT_Glyph_Class. - Add macros to declare, allocate and initialize drivers - (FT_Driver_ClassRec). - * include/freetype/internal/ftpic.h new file to declare the - FT_PIC_Container struct and the functions to allocate and detroy it. - * include/freetype/internal/ftserv.h add macros to allocate and - destory arrays of FT_ServiceDescRec. - * include/freetype/internal/internal.h define macro to include - ftpic.h. - - New Files: - * src/base/ftpic.c implement functions to allocate and destory the - global pic_container. - * src/base/basepic.h declare struct to hold PIC globals for base and - macros to access them. - * src/base/basepic.c implement functions to allocate, destroy and - initialize PIC globals for base. - - * src/base/ftinit.c when FT_CONFIG_OPTION_PIC is defined implement - functions that allocate and destroy ft_default_modules according to - FT_CONFIG_MODULES_H in the pic_container instead of the global scope - and use macro from basepic.h to access it. - * src/base/ftobjs.c add calls to the functions that allocate and - destroy the global pic_container when the library is created and - destroyed. - - * src/base/jamfile add new files to FT2_MULTI build: - ftpic.c and basepic.c. - * src/base/ftbase.c add new files to build: - ftpic.c and basepic.c. - - * src/base/ftglyph.c when FT_CONFIG_OPTION_PIC is defined - ft_bitmap_glyph_class and ft_outline_glyph_class will be allocated - in the pic_container instead of the global scope and use macros from - basepic.h to access them. - * src/base/ftbbox.c allocate bbox_interface stract on the stack - instead of the global scope when FT_CONFIG_OPTION_PIC is defined. - * src/base/ftstroke.c access ft_outline_glyph_class allocated in - ftglyph.c via macros from basepic.h - -2009-04-05 Oran Agra - - Preparing changes in cff parser later needed for PIC version. - - * src/cff/cffload.c, src/cff/cffload.h, src/cff/cffobjs.c, - src/cff/cffparse.c, src/cff/cffparse.h: Add library pointer to - 'CFF_ParserRec' set by `cff_parser_init'. - Route library pointer from 'cff_face_init' to 'cff_subfont_load' - for `cff_parser_init'. - - * src/cff/cffparse.c (CFF_Field_Handler): Move it to... - * src/cff/cffparse.h: This file, to be used by other C files. - -2009-04-05 Oran Agra - - Minor change in ftstroke.c. - - * src/base/ftstroke.c (FT_StrokerRec): Replace `memory' member with - `library' needed for PIC version. - Update all callers. - -2009-04-04 Werner Lemberg - - ftnames.c -> ftsnames.c - - * src/base/ftnames.c: Rename to... - * src/base/ftsnames.c: This. - * src/base/Jamfile, src/base/rules.mk, src/base/ftbase.c: Updated. - -2009-04-04 Werner Lemberg - - Add support for cmap type 13. - - * devel/ftoption.h, include/freetype/config/ftoption.h - (TT_CONFIG_CMAP_FORMAT_13): New macro. - - * src/sfnt/ttcmap.c (TT_CMap13Rec, tt_cmap13_init, - tt_cmap13_validate, tt_cmap13_char_index, tt_cmap13_char_next, - tt_cmap13_get_info, tt_cmap13_char_map_def_binary, - tt_cmap14_class_rec): New functions and structures for cmap 13 - support. - (tt_cmap_classes): Register tt_cmap13_class_rec. - - * docs/CHANGES: Mention cmap 13 support. - -2009-04-01 Werner Lemberg - - Ignore empty contours in CFF glyphs. - - Problem reported by Albert Astals Cid . - - * src/cff/cffgload.c (cff_builder_close_contour): Synchronize with - t1_builder_close_contour. - -2009-03-21 Werner Lemberg - - Another redundant header inclusion. - - * src/truetype/ttgxvar.c: Fix Ghostscript Coverity issue #4041. - -2009-03-21 Werner Lemberg - - Remove redundant header inclusions. - - This covers many Ghostscript Coverity issues. - - * src/*: Do it. - -2009-03-21 Werner Lemberg - - Fix Ghostscript Coverity issue #3904. - - * src/truetype/ttgxvar.c (ft_var_readpackedpoints): Protect against - invalid values of `runcnt'. - -2009-03-20 Werner Lemberg - - Fix `make multi' run. - - * src/smooth/ftsmooth.h: Include FT_INTERNAL_DEBUG_H. - -2009-03-20 Werner Lemberg - - Fix Savannah bug #25923. - - * src/cache/ftccmap.c (FTC_CMAP_HASH): Fix typo. - -2009-03-20 Werner Lemberg - - Protect against too large glyphs. - - Problem reported by Tavis Ormandy . - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): Don't allow - `pitch' or `height' to be larger than 0xFFFF. - -2009-03-20 Werner Lemberg - Tavis Ormandy - - Fix validation for various cmap table formats. - - * src/sfnt/ttcmap.c (tt_cmap8_validate, tt_cmap10_validate, - tt_cmap12_validate): Check `length' correctly. - (tt_cmap_14_validate): Check `length' and `numMappings' correctly. - -2009-03-20 Werner Lemberg - - Protect against malformed compressed data. - - * src/lzw/ftzopen.c (ft_lzwstate_io): Test whether `state->prefix' is - zero. - -2009-03-20 Werner Lemberg - - Protect against invalid SID values in CFFs. - - Problem reported by Tavis Ormandy . - - * src/cff/cffload.c (cff_charset_load): Reject SID values larger - than 64999. - -2009-03-19 Vincent Richomme - - Update WinCE Visual C project files. - - * builds/wince/vc2005-ce/freetype.vcproj, - builds/wince/vc2008-ce/freetype.vcproj: Add missing base extension - files. - -2009-03-19 Werner Lemberg - - Remove unused Win32 code. - - * builds/wince/ftdebug.c: Remove code guarded with `!_WIN32_WCE'. - Since Win32 is handled separately this is no longer needed. - -2009-03-19 Vincent Richomme - - Make `gzip' module compile on WinCE. - - * src/gzip/zconf.h [_WIN32_WCE]: Define NO_ERRNO_H. - -2009-03-19 Werner Lemberg - - Remove unused WinCE code. - - * builds/win32/ftdebug.c: Remove code guarded with `_WIN32_WCE'. - Since WinCE is handled separately this is no longer needed. - -2009-03-16 Werner Lemberg - - docmaker: Don't ignore single-line code blocks. - - * src/tools/docmaker/content.py (DocBlock::_init__): Fix change from - 2009-01-31. - -2009-03-15 Steve Langasek - - Use __asm__ for declaring assembly instead of asm. - - * builds/unix/ftconfig.in (FT_MulFix_arm): Use __asm__ instead of - asm on arm, fixing a build failure on armel with -pedantic. - -2009-03-14 Werner Lemberg - - Fix valgrind warning. - - * src/sfnt/ttsbit0.c (tt_sbit_decoder_load_bit_aligned): Don't read - past the end of the frame. - -2009-03-12 Werner Lemberg - - * Version 2.3.9 released. - ========================= - - - Tag sources with `VER-2-3-9'. - -2009-03-12 Werner Lemberg - - * builds/unix/freetype2.in: Move @FT2_EXTRA_LIBS@ to `Libs.private'. - -2009-03-12 Werner Lemberg - - Fix some FreeType Coverity issues as reported for Ghostscript. - - * src/base/ftobjs.c (FT_New_Face, FT_New_Memory_Face): Initialize - `args.stream' (#3874, #3875). - (open_face_PS_from_sfnt_stream): Improve error management (#3786). - * src/base/ftmm.c (ft_face_get_mm_service): Fix check of `aservice' - (#3870). - * src/base/ftstroke.c (ft_stroke_border_get_counts): Remove dead - code (#3790). - * src/base/ftrfork.c (raccess_guess_apple_generic): Check error - value of `FT_Stream_Skip' (#3784). - - * src/type1/t1gload.c (T1_Load_Glyph): Check `size' before accessing - it (#3872) - - * src/pcf/pcfdrivr.c (PCF_Glyph_Load): Check `face' before accessing - it (#3871). - * src/pcf/pcfread.c (pcf_get_metrics): Handle return value of - `pcf_get_metric' (#3789, #3782). - (pcf_get_properties): Use FT_STREAM_SKIP (#3783). - - * src/cache/ftcmanag.c (FTC_Manager_RegisterCache): Fix check of - `acache' (#3797) - - * src/cff/cffdrivr.c (cff_ps_get_font_info): Fix check of `cff' - (#3796). - * src/cff/cffgload.c (cff_decoder_prepare): Check `size' (#3795). - * src/cff/cffload.c (cff_index_get_pointers): Add comment (#3794). - - * src/bdf/bdflib.c (_bdf_add_property): Check `fp->value.atom' - (#3793). - (_bdf_parse_start): Add comment (#3792). - - * src/raster/ftraster.c (Finalize_Profile_Table): Check - `ras.fProfile' (#3791). - - * src/sfnt/ttsbit.c (Load_SBit_Image): Use FT_STREAM_SKIP (#3785). - - * src/gzip/ftgzip.c (ft_gzip_get_uncompressed_size): Properly ignore - seek error (#3781). - -2009-03-11 Michael Toftdal - - Extend CID service functions to handle CID-keyed CFFs as CID fonts. - - * include/freetype/ftcid.h (FT_Get_CID_Is_Internally_CID_keyed, - FT_Get_CID_From_Glyph_Index): New functions. - - * include/freetype/internal/services/svcid.h - (FT_CID_GetIsInternallyCIDKeyedFunc, - FT_CID_GetCIDFromGlyphIndexFunc): New function typedefs. - (CID Service): Use them. - - * src/base/ftcid.c: Include FT_CID_H. - (FT_Get_CID_Is_Internally_CID_keyed, FT_Get_CID_From_Glyph_Index): - New functions. - - * src/cff/cffdrivr.c (cff_get_is_cid, cff_get_cid_from_glyph_index): - New functions. - (cff_service_cid_info): Add them. - * src/cff/cffload.c (cff_font_load): Don't free `font->charset.sids' - -- it is needed for access as a CID-keyed font. It gets deleted - later on. - - * src/cid/cidriver.c (cid_get_is_cid, cid_get_cid_from_glyph_index): - New functions. - (cid_service_cid_info): Add them. - - * docs/CHANGES: Updated. - -2009-03-11 Bram Tassyns - - Fix Savannah bug #25597. - - * src/cff/cffparse.c (cff_parse_real): Don't allow fraction_length - to become larger than 9. - -2009-03-11 Werner Lemberg - - Fix Savannah bug #25814. - - * builds/unix/freetype2.in: As suggested in the bug report, move - @LIBZ@ to `Libs.private'. - -2009-03-11 Werner Lemberg - - Fix Savannah bug #25781. - We now simply check for a valid `offset', no longer handling `delta - = 1' specially. - - * src/sfnt/ttcmap.c (tt_cmap4_validate): Don't check `delta' for - last segment. - (tt_cmap4_set_range, tt_cmap4_char_map_linear, - tt_cmap4_char_map_binary): Check offset. - -2009-03-11 Werner Lemberg - - * src/base/Jamfile: Fix handling of ftadvanc.c. - Reported by Oran Agra . - -2009-03-10 Vincent Richomme - - Restructure Win32 and Wince compiler support. - - * src/builds/win32: Remove files for WinCE. - Move VC 2005 support to a separate directory. - Add directory for VC 2008 support. - - * src/builds/wince: New directory hierarchy for WinCE compilers - (VC 2005 and VC 2008). - -2009-03-09 Werner Lemberg - - More preparations for 2.3.9 release. - - * docs/CHANGES: Updated. - - * Jamfile, README: s/2.3.8/2.3.9/, s/238/239/. - -2009-03-09 Werner Lemberg - - * src/sfnt/rules.mk (SFNT_DRV_H): Add ttsbit0.c. - -2009-03-09 Alexey Kryukov - - Fix handling of EBDT formats 8 and 9 (part 2). - - This patch fixes the following problems in ttsbit0.c: - - . Bitmaps for compound glyphs were never allocated. - - . `SBitDecoder' refused to load metrics if some other metrics have - already been loaded. This condition certainly makes no sense for - recursive calls, so I've just disabled it. Another possibility - would be resetting `decoder->metrics_loaded' to false before - loading each composite component. However, we must restore the - original metrics after finishing the recursion; otherwise we can - get a misaligned glyph. - - . `tt_sbit_decoder_load_bit_aligned' incorrectly handled `x_pos', - causing some glyph components to be shifted too far to the right - (especially noticeable for small sizes). - - Note that support for grayscale bitmaps (not necessarily compound) is - completely broken in ttsbit0.c. - - * src/sfnt/tt_sbit_decoder_load_metrics: Always load metrics. - (tt_sbit_decoder_load_bit_aligned): Handle `x_pos' correctly in case - of `h == height'. - (tt_sbit_decoder_load_compound): Reset metrics after loading - components. - Allocate bitmap. - -2009-03-09 Werner Lemberg - - * builds/unix/configure.raw (version_info): Set to 9:20:3. - -2009-03-03 David Turner - - Protect SFNT kerning table parser against malformed tables. - - This closes Savannah BUG #25750. - - * src/sfnt/ttkern.c (tt_face_load_kern, tt_face_get_kerning): Fix a - bug where a malformed table would be successfully loaded but later - crash the engine during parsing. - -2009-03-03 David Turner - - Update documentation and bump version number to 2.3.9. - - * include/freetype/freetype.h: Bump patch version to 9. - * docs/CHANGES: Document the ABI break in 2.3.8. - * docs/VERSION.DLL: Update version numbers table for 2.3.9. - -2009-03-03 David Turner - - Remove ABI-breaking field in public PS_InfoFontRec definition. - - Instead, we define a new internal PS_FontExtraRec structure to - hold the additional field, then place it in various internal - positions of the corresponding FT_Face derived objects. - - * include/freetype/t1tables.h (PS_FontInfoRec): Remove the - `fs_type' field from the public structure. - * include/freetype/internal/psaux.h (T1_FieldLocation): New - enumeration `T1_FIELD_LOCATION_FONT_EXTRA'. - * include/freetype/internal/t1types.h (PS_FontExtraRec): New - structure. - (T1_FontRec, CID_FaceRec): Add it. - - * src/cid/cidload.c (cid_load_keyword): Handle - T1_FIELD_LOCATION_FONT_EXTRA. - * src/cid/cidtoken.h, src/type1/t1tokens.h, src/type42/t42parse.c: - Adjust FT_STRUCTURE and T1CODE properly to handle `FSType'. - * src/type1/t1load.c (t1_load_keyword): Handle - T1_FIELD_LOCATION_FONT_EXTRA. - - * include/freetype/internal/services/svpsinfo.h (PsInfo service): - Add `PS_GetFontExtraFunc' function typedef. - - * src/base/ftfstype.c: Include FT_INTERNAL_SERVICE_H and - FT_SERVICE_POSTSCRIPT_INFO_H. - (FT_Get_FSType_Flags): Use POSTSCRIPT_INFO service. - - * src/cff/cffdrivr.c (cff_service_ps_info): Updated. - * src/cid/cidriver.c (cid_ps_get_font_extra): New function. - (cid_service_ps_info): Updated. - * src/type1/t1driver.c (t1_ps_get_font_extra): New function. - (t1_service_ps_info): Updated. - * src/type42/t42drivr.c (t42_ps_get_font_extra): New function. - (t42_service_ps_info): Updated. - -2009-03-02 Alexey Kryukov - - Fix handling of EBDT formats 8 and 9. - - The main cycle in `blit_sbit' makes too many iterations: it actually - needs the count of lines in the source bitmap rather than in the - target image. - - * src/sfnt/ttsbit.c (blit_sbit) [FT_CONFIG_OPTION_OLD_INTERNALS]: - Add parameter `source_height' and use it for main loop. - (Load_SBit_Single) [FT_CONFIG_OPTION_OLD_INTERNALS]: Updated. - -2009-02-23 Werner Lemberg - - Fix Savannah bug #25669. - - * src/base/ftadvanc.h (FT_Get_Advances): Fix serious typo. - - * src/base/ftobjs.c (FT_Select_Metrics, FT_Request_Metrics): Fix - scaling factor for non-scalable fonts. - - * src/cff/cffdrivr.c (cff_get_advances): Use correct advance width - value to prevent incorrect scaling. - - * docs/CHANGES: Document it. - -2009-02-15 Matt Godbolt - - Fix Savannah bug #25588. - - * builds/unix/ftconfig.in (FT_MulFix_arm): Use correct syntax for - `orr' instruction. - -2009-02-11 Werner Lemberg - - * src/truetype/ttobjs.c (tt_check_trickyness): Add `DFKaiShu'. - Reported by David Bevan . - -2009-02-09 Werner Lemberg - - Fix Savannah bug #25495. - - * src/sfnt/sfobjs.c (sfnt_load_face): Test for bitmap strikes before - setting metrics and bbox values. This ensures that the check for a - font with neither a `glyf' table nor bitmap strikes can be performed - early enough to set metrics and bbox values too. - -2009-02-04 Werner Lemberg - - Fix Savannah bug #25480. - - * builds/unix/freetype-config.in: For --ftversion, don't use $prefix - but $includedir. - -2009-01-31 Werner Lemberg - - Minor docmaker improvements. - - * src/tools/docmaker/content.py (DocBlock::__init__): Ignore empty - code blocks. - -2009-01-25 Werner Lemberg - - Fix SCANCTRL handling in TTFs. - Problem reported by Alexey Kryukov . - - * src/truetype/ttinterp.c (Ins_SCANCTRL): Fix threshold handling. - -2009-01-23 Werner Lemberg - - Move FT_Get_FSType_Flags to a separate file. - Problem reported by Mickey Gabel . - - * src/base/ftobjs.c (FT_Get_FSType_Flags): Move to... - * src/base/ftfstype.c: This new file. - - * modules.cfg (BASE_EXTENSION): Add ftfstype.c. - - * docs/INSTALL.ANY: Updated. - - * builds/mac/*.txt, builds/amiga/*makefile*, - builds/win32/{visualc,visualce}/freetype.*, builds/symbian/*: - Updated. - -2009-01-22 suzuki toshiya - - * builds/unix/ftsystem.c (FT_Stream_Open): Fix 2 error - messages ending without "\n". - -2009-01-22 suzuki toshiya - - Fix Savannah bug #25347. - - * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Rewind - the stream to the original position passed to this function, - when ft_lookup_PS_in_sfnt_stream() failed. - (Mac_Read_sfnt_Resource): Rewind the stream to the head of - sfnt resource body, when open_face_PS_from_sfnt_stream() - failed. - -2009-01-19 Michael Lotz - - Fix Savannah bug #25355. - - * include/freetype/config/ftconfig.h (FT_MulFix_i386): Make - assembler code work with gcc 2.95.3 (as used by the Haiku project). - Add `cc' register to the clobber list. - -2009-01-18 Werner Lemberg - - Protect FT_Get_Next_Char. - - * src/sfnt/ttcmap.c (tt_cmap4_set_range): Apply fix similar to - change from 2008-07-22. - - Patch from Ronen Ghoshal . - -2009-01-18 Werner Lemberg - - Implement FT_Get_Name_Index for SFNT driver. - - * src/sfnt/sfdriver.c (sfnt_get_name_index): New function. - (sfnt_service_glyph_dict): Use it. - - Problem reported by Truc Truong . - -2009-01-18 Werner Lemberg - - * include/freetype/ftstroke.h (FT_Outline_GetInsideBorder): Fix - documentation. Problem reported by Truc Truong . - - * docs/CHANGES: Updated. - -2009-01-14 Werner Lemberg - - * Version 2.3.8 released. - ========================= - - - Tag sources with `VER-2-3-8'. - - * docs/VERSION.DLL: Update documentation and bump version number to - 2.3.8. - - * README, Jamfile (RefDoc), builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, - builds/win32/visualce/index.html, - builds/win32/visualce/freetype.dsp, - builds/win32/visualce/freetype.vcproj: s/2.3.7/2.3.8/, s/237/238/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 8. - - * builds/unix/configure.raw (version_info): Set to 9:19:3. - - * docs/release: Updated. - -2009-01-14 Werner Lemberg - - * builds/toplevel.mk (dist): Compress better. - -2009-01-13 Werner Lemberg - - * src/base/ftobjs.c (FT_Get_FSType_Flags): Cast for compilation - with C++. - -2009-01-13 Werner Lemberg - - Don't use stdlib.h and friends directly. - Reported by Mickey Gabel . - - * src/base/ftdbgmem.c: s//FT_CONFIG_STANDARD_LIBRARY_H/. - - * src/gzip/ftgzip.c, src/lzw/ftlzw.c, src/raster/ftmisc.h: - s//FT_CONFIG_STANDARD_LIBRARY_H/. - - * src/autofit/aftypes.h, src/autofit/afhints.c, - src/pshinter/pshalgo.c: s//FT_CONFIG_STANDARD_LIBRARY_H/ - - * src/lzw/ftlzw.c, src/base/ftdbgmem.c: Don't include stdio.h. - -2009-01-12 Werner Lemberg - - Avoid compiler warnings. - - * */*: s/do ; while ( 0 )/do { } while ( 0 )/. - Reported by Sean McBride . - -2009-01-12 Werner Lemberg - - Fix stdlib dependencies. - - Problem reported by Mickey Gabel . - - * include/freetype/config/ftstdlib.h (ft_exit): Removed. Unused. - - * src/autofit/afhints.c, src/base/ftlcdfil.c, src/smooth/ftsmooth.c: - s/memcpy/ft_memcpy/. - * src/psaux/t1decode.c: s/memset/ft_memset/, s/memcpy/ft_memcpy/. - -2009-01-11 Werner Lemberg - - * docs/formats.txt: Add link to PCF specification. - - * include/freetype/ftbdf.h (FT_Get_BDF_Property): Improve - documentation. - -2009-01-09 suzuki toshiya - - * src/base/ftadvanc.c (_ft_face_scale_advances, FT_Get_Advance, - FT_Get_Advances): Change the type of load_flags from FT_UInt32 to - FT_Int32, to match with the flags for FT_Load_Glyph(). - * src/cff/cffdrivr.c (cff_get_advances): Ditto. - * src/truetype/ttdriver.c (tt_get_advances): Ditto. - * include/freetype/ftadvanc.h (FT_Get_Advance, FT_Get_Advances): - Ditto. - * include/freetype/internal/ftdriver.h (FT_Face_GetAdvancesFunc): - Ditto. - -2009-01-09 Daniel Zimmermann - - * src/gxvalid/gxvmort.c (gxv_mort_feature_validate): Fix wrong - length check. From Savannah patch #6682. - -2009-01-09 Werner Lemberg - - Fix problem with T1_FIELD_{NUM,FIXED}_TABLE2. - - * src/psaux/psobjs.c (ps_parser_load_field_table): Don't handle - `count_offset' if it is zero (i.e., unused). Otherwise, the first - element of the structure which holds the data is erroneously - modified. Problem reported by Chi Nguyen . - -2009-01-09 suzuki toshiya - - * src/base/ftadvanc.c (_ft_face_scale_advances, FT_Get_Advance, - FT_Get_Advances): Extend the type of load_flags from FT_UInt to - FT_UInt32, to pass 32-bit flags on 16bit platforms. - * src/cff/cffdrivr.c (cff_get_advances): Ditto. - * src/truetype/ttdriver.c (tt_get_advances): Ditto. - * include/freetype/ftadvanc.h (FT_Get_Advance, FT_Get_Advances): - Ditto. - * include/freetype/internal/ftdriver.h (FT_Face_GetAdvancesFunc): - Ditto. - -2009-01-09 suzuki toshiya - - * src/base/ftobjs.c (FT_Done_Library): Issue an error message when - FT_Done_Face() cannot free all faces. If the list of the opened - faces includes broken face which FT_Done_Face() cannot free, - FT_Done_Library() retries FT_Done_Face() and it can fall into - an endless loop. See the discussion: - http://lists.gnu.org/archive/html/freetype-devel/2008-09/msg00047.html - http://lists.gnu.org/archive/html/freetype-devel/2008-10/msg00000.html - -2009-01-07 Werner Lemberg - - * docs/CHANGES: Document new key `a' in ftdiff. - -2009-01-06 Werner Lemberg - - * autogen.sh: Don't use GNUisms while calling sed. Problem reported - by Sean McBride. - -2009-01-06 Werner Lemberg - - * src/base/ftbitmap.c (FT_Bitmap_Convert): Handle FT_PIXEL_MODE_LCD - and FT_PIXEL_MODE_LCD_V. Problem reported by Chi Nguyen - . - -2009-01-06 Diego Pettenò - - * builds/unix/configure.raw: Don't call AC_CANONICAL_BUILD and - AC_CANONICAL_TARGET and use $host_os only. A nice explanation for - this change can be found at - http://blog.flameeyes.eu/s/canonical-target. - - From Savannah patch #6712. - -2009-01-06 Sean McBride - - * src/base/ftdbgmem.c (_debug_mem_dummy): Make it static. - - * src/base/ftmac.c: Remove some #undefs. - -2008-12-26 Werner Lemberg - - Set `face_index' field in FT_Face for all font formats. - - * cff/cffobjs.c (cff_face_init), winfonts/winfnt.c (FNT_Face_Init), - sfnt/sfobjs.c (sfnt_init_face): Do it. - - * docs/CHANGES: Document it. - -2008-12-22 Steve Grubb - - * builds/unix/ftsystem.c (FT_Stream_Open): Reject zero-length files. - Patch from Savannah bug #25151. - -2008-12-21 Werner Lemberg - - * src/pfr/pfrdrivr.c, src/winfonts/winfnt.c, src/cache/ftcmanag.c, - src/smooth/ftgrays.c, src/base/ftobjc.s, src/sfobjs.c: - s/_Err_Bad_Argument/_Err_Invalid_Argument/. The former is for - errors in the bytecode interpreter only. - -2008-12-21 Werner Lemberg - - * src/base/ftpfr.c (FT_Get_PFR_Metrics): Protect against NULL - arguments. - Fix return value for non-PFR fonts. Both problems reported by Chi - Nguyen . - -2008-12-21 anonymous - - FT_USE_MODULE declares things as: - - extern const FT_Module_Class - - (or similar for C++). However, the actual types of the variables - being declared are often different, e.g., FT_Driver_ClassRec or - FT_Renderer_Class. (Some are, indeed, FT_Module_Class.) - - This works with most C compilers (since those structs begin with an - FT_Module_Class struct), but technically it's undefined behavior. - - To quote the ISO/IEC 9899:TC2 final committee draft, section 6.2.7 - paragraph 2: - - All declarations that refer to the same object or function shall - have compatible type; otherwise, the behavior is undefined. - - (And they are not compatible types.) - - Most C compilers don't reject (or even detect!) code which has this - issue, but the GCC LTO development branch compiler does. (It - outputs the types of the objects while generating .o files, along - with a bunch of other information, then compares them when doing the - final link-time code generation pass.) - - Patch from Savannah bug #25133. - - * src/base/ftinit.c (FT_USE_MODULE): Include variable type. - - * builds/amiga/include/freetype/config/ftmodule.h, - include/freetype/config/ftmodule.h, */module.mk: Updated to declare - pass correct types to FT_USE_MODULE. - -2008-12-21 Hongbo Ni - - * src/autofit/aflatin.c (af_latin_hint_edges), - src/autofit/aflatin2.c (af_latin2_hint_edges), src/autofit/afcjk.c - (af_cjk_hint_edges): Protect against division by zero. This fixes - Savannah bug #25124. - -2008-12-18 Werner Lemberg - - * docs/CHANGES: Updated. - -2008-12-18 Bevan, David - - Provide API for accessing embedding and subsetting restriction - information. - - * include/freetype.h (FT_FSTYPE_INSTALLABLE_EMBEDDING, - FT_FSTYPE_RESTRICTED_LICENSE_EMBEDDING, - FT_FSTYPE_PREVIEW_AND_PRINT_EMBEDDING, FT_FSTYPE_EDITABLE_EMBEDDING, - FT_FSTYPE_NO_SUBSETTING, FT_FSTYPE_BITMAP_EMBEDDING_ONLY): New - macros. - (FT_Get_FSType_Flags): New function declaration. - - * src/base/ftobjs.c (FT_Get_FSType_Flags): New function. - - * src/cid/cidtoken.h, src/type1/t1tokens.h, src/type42/t42parse.c - (t42_keywords): Handle `FSType'. - - * include/freetype/t1tables.h (PS_FontInfoRec): Add `fs_type' field. - -2008-12-17 Werner Lemberg - - * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Don't use internal - macros so that copying the source code into an application works - out of the box. - -2008-12-17 Werner Lemberg - - * include/freetype/ftsynth.h, src/base/ftsynth.c: Move - FT_GlyphSlot_Own_Bitmap to... - * include/freetype/ftbitmap.h, src/base/ftbitmap.c: These files. - - * docs/CHANGES: Document it. - -2008-12-10 Werner Lemberg - - Generalize the concept of `tricky' fonts by introducing - FT_FACE_FLAG_TRICKY to indicate that the font format's hinting - engine is necessary for correct rendering. - - At the same time, slightly modify the behaviour of tricky fonts: - FT_LOAD_NO_HINTING is now ignored. To really force raw loading - of tricky fonts (without hinting), both FT_LOAD_NO_HINTING and - FT_LOAD_NO_AUTOHINT must be used. - - Finally, tricky TrueType fonts always use the bytecode interpreter - even if the patented code is used. - - * include/freetype/freetype.h (FT_FACE_FLAG_TRICKY, FT_IS_TRICKY): - New macros. - - * src/truetype/ttdriver.c (Load_Glyph): Handle new load flags - semantics as described above. - - * src/truetype/ttobjs.c (tt_check_trickyness): New function, using - code of ... - (tt_face_init): This function, now simplified and updated to new - semantics. - - * src/base/ftobjs.c (FT_Load_Glyph): Don't use autohinter for tricky - fonts. - - * docs/CHANGES: Document it. - -2008-12-09 Werner Lemberg - - Really fix Savannah bug #25010: An SFNT font with neither outlines - nor bitmaps can be considered as containing space `glyphs' only. - - * src/truetype/ttpload.c (tt_face_load_loca): Handle the case where - a `glyf' table is missing. - - * src/truetype/ttgload.c (load_truetype_glyph): Abort if we have no - `glyf' table but a non-zero `loca' entry. - (tt_loader_init): Handle missing `glyf' table. - - * src/base/ftobjs.c (FT_Load_Glyph): Undo change 2008-12-05. - - * src/sfnt/sfobjs.c (sfnt_load_face): A font with neither outlines - nor bitmaps is scalable. - -2008-12-05 Werner Lemberg - - * src/autofit/aflatin.c (af_latin_uniranges): Add more ranges. This - fixes Savannah bug #21190 which also provides a basic patch. - -2008-12-05 Werner Lemberg - - * include/freetype/freetype.h (FT_LOAD_ADVANCE_ONLY): Use value - 0x100 instead of 0x10000; the latter value is already occupied by - FT_LOAD_TARGET_LIGHT. Bug reported by James Cloos. - - - Handle SFNT with neither outlines nor bitmaps. This fixes Savannah - bug #25010. - - * src/base/ftobjs.c (FT_Load_Glyph): Reject fonts with neither - outlines nor bitmaps. - - * src/sfnt/sfobjs.c (sfnt_load_face): Don't return an error if there - is no table with glyphs. - - - * src/sfnt/ttload.c (tt_face_lookup_table): Improve debugging - message. - -2008-12-01 Werner Lemberg - - GDEF tables need `glyph_count' too for validation. Problem reported - by Chi Nguyen . - - * src/otvalid/otvgdef.c (otv_GDEF_validate), src/otvalid/otvalid.h - (otv_GDEF_validate), src/otvalid/otvmod.c (otv_validate): Pass - `glyph_count'. - -2008-11-29 Werner Lemberg - - * src/autofit/afcjk.c, src/base/ftoutln.c, src/base/ftrfork.c, - src/bdf/bdfdrivr.c, src/gxvalid/gxvmorx.c, src/otvalid/otvmath.c, - src/pcf/pcfdrivr.c, src/psnames/pstables.h, src/smooth/ftgrays.c, - src/tools/glnames.py, src/truetype/ttinterp.c, src/type1/t1load.c, - src/type42/t42objs.c, src/winfonts/winfnt.c: Fix compiler warnings - (Atari PureC). - -2008-11-29 James Cloos - - * src/type/t1load.c (mm_axis_unmap): Revert previous patch and fix - it correctly by using FT_INT_TO_FIXED (FreeType expects 16.16 values - in the /BlendDesignMap space). - -2008-11-29 James Cloos - - * src/type1/t1load.c (mm_axis_unmap): `blend_points' is FT_Fixed*, - whereas `design_points' is FT_Long*. Therefore, return blend rather - than design points. - -2008-11-27 Werner Lemberg - - * src/cff/cffparse.c (cff_parse_real): Handle more than nine - significant digits correctly. This fixes Savannah bug #24953. - -2008-11-25 Daniel Zimmermann - - * src/base/ftstream.c (FT_Stream_ReadFields): Don't access stream - before the NULL check. From Savannah patch #6681. - -2008-11-24 Werner Lemberg - - Fixes from the gnuwin32 port. - - * src/base/ftlcdfil.c: s/EXPORT/EXPORT_DEF/. - - * src/base/ftotval.c: Include FT_OPENTYPE_VALIDATE_H. - - * src/psaux/psobjs.c (ps_table_add): Check `length'. - -2008-11-15 Werner Lemberg - - * src/truetype/ttinterp.c (tt_default_graphics_state): The default - value for `scan_type' is zero, as confirmed by Greg Hitchcock from - Microsoft. Problem reported by Michal Nowakowski - . - -2008-11-12 Tor Andersson - - * src/cff/cffdrivr.c (cff_get_cmap_info): Initialize `format' field. - This fixes Savannah bug #24819. - -2008-11-08 Werner Lemberg - - * src/sfnt/sfobjs.c (sfnt_load_face): Remove #if 0/#endif guards - since OpenType version 1.5 has been released. - - * include/ttnameid.h (TT_NAME_ID_WWS_FAMILY, - TT_NAME_ID_WWS_SUBFAMILY): New macros for OpenType 1.5. - (TT_URC_COPTIC, TT_URC_VAI, TT_URC_NKO, TT_URC_BALINESE, - TT_URC_PHAGSPA, TT_URC_NON_PLANE_0, TT_URC_PHOENICIAN, - TT_URC_TAI_LE, TT_URC_NEW_TAI_LUE, TT_URC_BUGINESE, - TT_URC_GLAGOLITIC, TT_URC_YIJING, TT_URC_SYLOTI_NAGRI, - TT_URC_LINEAR_B, TT_URC_ANCIENT_GREEK_NUMBERS, TT_URC_UGARITIC, - TT_URC_OLD_PERSIAN, TT_URC_SHAVIAN, TT_URC_OSMANYA, - TT_URC_CYPRIOT_SYLLABARY, TT_URC_KHAROSHTHI, TT_URC_TAI_XUAN_JING, - TT_URC_CUNEIFORM, TT_URC_COUNTING_ROD_NUMERALS, TT_URC_SUNDANESE, - TT_URC_LEPCHA, TT_URC_OL_CHIKI, TT_URC_SAURASHTRA, TT_URC_KAYAH_LI, - TT_URC_REJANG, TT_URC_CHAM, TT_URC_ANCIENT_SYMBOLS, - TT_URC_PHAISTOS_DISC, TT_URC_OLD_ANATOLIAN, TT_URC_GAME_TILES): New - macros for OpenType 1.5. - -2008-11-08 Wenlin Institute - - * src/base/ftobjs.c (ft_glyphslot_free_bitmap): Protect against - slot->internal == NULL. Reported by Graham Asher. - -2008-11-08 Werner Lemberg - - * src/sfnt/sfobjs.c (tt_face_get_name): Modified to return an error - code so that memory allocation problems can be distinguished from - missing table entries. Reported by Graham Asher. - (GET_NAME): New macro. - (sfnt_load_face): Use it. - -2008-11-05 Werner Lemberg - - * devel/ftoption.h, include/freetype/config/ftoption.h - [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Undefine - TT_CONFIG_OPTION_UNPATENTED_HINTING. This fixes the return value of - `FT_Get_TrueType_Engine_Type' (and makes it work as documented). - Reported in bug #441638 of bugzilla.novell.com. - - * docs/CHANGES: Document it. - -2008-11-03 Werner Lemberg - - * src/type1/t1load.c (parse_subrs): Use an endless loop. There are - fonts (like HELVI.PFB version 003.001, used on OS/2) which define - some `subrs' elements more than once. Problem reported by Peter - Weilbacher . - -2008-10-15 Graham Asher - - * src/sfnt/ttpost.c (tt_post_default_names): Add `const'. - -2008-10-15 David Turner - - * src/truetype/ttgxvar.c (TT_Set_MM_Blend): Disambiguate for - meddlesome compilers' warning against `for ( ...; ...; ...) ;'. - -2008-10-14 Werner Lemberg - - * src/cff/cffobjs.c (cff_face_init): Remove compiler warning. - Suggested by Bram Tassyns in Savannah patch #6651. - -2008-10-12 Graham Asher - - * src/sfnt/sfobjs.c (sfnt_load_face): Fix computation of - `underline_position'. - -2008-10-12 Werner Lemberg - - * docs/CHANGES: Updated. - -2008-10-09 suzuki toshiya - - Fix Savannah bug #24468. - - According to include/freetype/internal/ftobjs.h, the appropriate - type to interchange single character codepoint is FT_UInt32. It - should be distinguished from FT_UInt which can be 16bit integer. - - * src/sfnt/ttcmap.c (tt_cmap4_char_map_linear): Change the type - of the second argument `pcharcode' from FT_UInt* to FT_UInt32*. - (tt_cmap4_char_map_binary): Ditto. - (tt_cmap14_get_nondef_chars): Change the type of return value - from FT_UInt* to FT_UInt32*. - -2008-10-08 John Tytgat - - Fix Savannah bug #24485. - - * src/type1/t1load.c (parse_charstrings): Assure that we always have - a .notdef glyph. - -2008-10-05 suzuki toshiya - - * src/base/ftmac.c: Include FT_TRUETYPE_TAGS_H for multi build. - * builds/mac/ftmac.c: Ditto. - -2008-10-05 suzuki toshiya - - * include/freetype/tttags.h (TTAG_TYP1, TTAG_typ1): Fix definitions. - * src/base/ftobjs.c: Include FT_TRUETYPE_TAGS_H. - -2008-10-05 suzuki toshiya - - * src/sfnt/sfobjs.c (sfnt_open_font): Allow `typ1' version tag in - the beginning of sfnt container. - * src/sfnt/ttload.c (check_table_dir): Return - `SFNT_Err_Table_Missing' when sfnt table directory structure is - correct but essential tables for TrueType fonts (`head', `bhed' or - `SING') are missing. Other errors are returned by - SFNT_Err_Unknown_File_Format. - - * src/base/ftobjs.c (FT_Open_Face): When TrueType driver returns - `FT_Err_Table_Missing', try `open_face_PS_from_sfnt_stream'. It is - enabled only when old mac font support is configured. - -2008-10-04 suzuki toshiya - - * include/freetype/tttags.h (TTAG_CID, TTAG_FOND, TTAG_LWFN, - TTAG_POST, TTAG_sfnt, TTAG_TYP1, TTAG_typ1): New tags to simplify - the repeated calculations of these values in ftobjs.c and ftmac.c. - * src/base/ftobjs.c: Replace all FT_MAKE_TAG by new tags. - * src/base/ftmac.c: Ditto. - * builds/mac/ftmac.c: Ditto. - -2008-10-04 suzuki toshiya - - * src/base/ftobjs.c (ft_lookup_PS_in_sfnt_stream): Remove wrong - initialization of *is_sfnt_cid. - -2008-10-04 Werner Lemberg - - * src/base/ftobjs.c (open_face_PS_from_sfnt_stream): Remove compiler - warnings. - -2008-10-04 suzuki toshiya - - * src/base/ftobjs.c (ft_lookup_PS_in_sfnt): Replaced by... - (ft_lookup_PS_in_sfnt_stream): This. - (open_face_PS_from_sfnt_stream): New function. It checks whether - the stream is sfnt-wrapped Type1 PS font or sfnt-wrapped CID-keyed - font, then try to open a face for given face_index. - (Mac_Read_sfnt_Resource): Replace the combination of - `ft_lookup_PS_in_sfnt' and `open_face_from_buffer' by - `open_face_PS_from_sfnt_stream'. - * src/base/ftmac.c (FT_New_Face_From_SFNT): Ditto. - * builds/mac/ftmac.c (FT_New_Face_From_SFNT): Ditto. - * src/base/ftbase.h: Remove `ft_lookup_PS_in_sfnt' and add - `open_face_PS_from_sfnt_stream'. - -2008-10-03 suzuki toshiya - - * src/base/ftobjs.c (ft_lookup_PS_in_sfnt): Set *is_sfnt_cid to - FALSE if neither `CID ' nor `TYP1' is found in the sfnt container. - -2008-10-03 suzuki toshiya - - * include/freetype/config/ftconfig.h: Define FT_MACINTOSH when SC or - MrC compiler of MPW is used. These compilers do not define the - macro __APPLE__ by themselves. - * builds/unix/ftconfig.in: Ditto. - * builds/vms/ftconfig.h: Ditto. - * src/base/ftbase.c: Use FT_MACINTOSH instead of __APPLE__, to - include ftmac.c if FreeType 2 is built by MPW. - * src/base/ftobjs.c: Use FT_MACINTOSH instead of __APPLE__, to - enable shared functions for ftmac.c if FreeType 2 is built by MPW. - - * builds/mac/ftmac.c: Include ftbase.h. - (memory_stream_close): Removed. - (new_memory_stream): Ditto. - (open_face_from_buffer): Removed. Use the implementation in - ftobjs.c. - (ft_lookup_PS_in_sfnt): Ditto. - - * builds/mac/FreeType.m68k_far.make.txt: Build ftmac.c as an - included part of ftbase.c, to share the functions in ftobjs.c. The - rule compiling ftmac.c separately is removed and the rule copying - ftbase.c from src/base/ftbase.c to builds/mac/ftbase.c is added. - * builds/mac/FreeType.m68k_cfm.make.txt: Ditto. - * builds/mac/FreeType.ppc_classic.make.txt: Ditto. - * builds/mac/FreeType.ppc_carbon.make.txt: Ditto. - -2008-10-02 Bram Tassyns - - * src/cff/cffgload.c (cff_slot_load): Map CID 0 to GID 0. This - fixes Savannah bug #24430. - -2008-10-02 Werner Lemberg - - * builds/freetype.mk (BASE_H): Rename to... - (INTERNAL_H): This. - (FREETYPE_H): Updated. - * src/base/rules.mk: (BASE_OBJ_S, OBJ_DIR/%.$O): Add BASE_H. - * src/bdf/rules.mk (BDF_DRV_H): Add bdferror.h. - * src/cache/rules.mk (CACHE_DRV_H): Add ftccache.h and ftcsbits.h. - * src/pcf/rules.mk (PCF_DRV_H): Add pcfread.h. - * src/raster/rules.mk (RASTER_DRV_H): Add ftmisc.h. - * src/type42/rules.mk (T42_DRV_H): Add t42types.h. - -2008-10-02 suzuki toshiya - - * src/base/ftbase.h: New file to declare the private utility - functions shared by the sources of base modules. Currently, - `ft_lookup_PS_in_sfnt' and `open_face_from_buffer' are declared to - share between ftobjs.c and ftmac.c. - - * src/base/rule.mk: Add ftbase.h. - - * src/base/ftobjs.c: Include ftbase.h. - (memory_stream_close): Build on any platform when old MacOS font - support is enabled. - (new_memory_stream): Ditto. - (open_face_from_buffer): Build on any platform when old MacOS font - support is enabled. The counting of the face in a font file is - slightly different between Carbon-dependent parser and Carbon-free - parser. They are merged with the platform-specific conditional. - (ft_lookup_PS_in_sfnt): Ditto. - - * src/base/ftmac.c: Include ftbase.h. - (memory_stream_close): Removed. - (new_memory_stream): Ditto. - (open_face_from_buffer): Removed. Use the implementation in - ftobjs.c. - (ft_lookup_PS_in_sfnt): Ditto. - -2008-10-02 Werner Lemberg - - * src/sfnt/sfobjs.c (sfnt_load_face): `psnames_error' is only needed - if TT_CONFIG_OPTION_POSTSCRIPT_NAMES is defined. - -2008-10-01 Werner Lemberg - - * src/truetype/ttobjs.c (tt_face_done), src/cff/cffobjs.c - (cff_face_done), src/pfr/pfrobjs.c (pfr_face_done), - src/pcf/pcfdrivr.c (PCF_Face_Done), src/cid/cidobjs.c - (cid_face_done), src/bdf/bdfdrivr. (BDF_Face_Done), - src/sfnt/sfobjs.c (sfnt_face_done): Protect against face == 0. - Reported by Graham Asher. - -2008-09-30 suzuki toshiya - - * src/base/rules.mk: Add conditional source to BASE_SRC, for `make - multi' on Mac OS X. If the macro $(ftmac_c) is defined, - $(BASE_DIR)/$(ftmac_c) is added to BASE_SRC. In a normal build, the - lack of ftmac.c in BASE_SRC is not serious because ftbase.c includes - ftmac.c. - * builds/unix/unix-def.in: Add a macro definition of $(ftmac_c). - * builds/unix/configure.raw: Add procedure to set up appropriate - value of $(ftmac_c) with the consideration of the availability of - Carbon framework. - -2008-09-30 suzuki toshiya - - * src/base/Jamfile: Add target for multi build by jam on Mac OS X. - * src/base/ftobjs.c (FT_New_Face): Fix the condition to include this - function for MPW building. It is synchronized the condition to - include ftmac.c source into ftbase.c. - -2008-09-22 Werner Lemberg - - * src/cff/cffgload.c (CFF_Operator, cff_argument_counts, - cff_decoder_parse_charstrings): Handle (invalid) - `callothersubr' and `pop' instructions. - -2008-09-22 John Tytgat - - Fix Savannah bug #24307. - - * include/freetype/internal/t1types.h (CID_FaceRec), - src/type42/t42types.h (T42_FaceRec): Comment out `afm_data'. - -2008-09-21 Werner Lemberg - - * src/smooth/ftgrays.c (gray_raster_render): Don't dereference - `target_map' if FT_RASTER_FLAG_DIRECT is set. Problem reported by - Stephan T. Lavavej . - -2008-09-21 suzuki toshiya - - * src/otvalid/Jamfile: Add missing target `otvmath' for multi build - by jam. - * src/sfnt/Jamfile: Add missing target `ttmtx' for multi build by - jam. - -2008-09-20 Werner Lemberg - - * src/smooth/ftgrays.c (gray_find_cell): Fix threshold. The values - passed to this function are already `normalized'. Problem reported - by Stephan T. Lavavej . - - * docs/CHANGES: Document it. - -2008-09-20 Werner Lemberg - - * src/base/ftoutln.c: Include FT_INTERNAL_DEBUG_H. - (FT_Outline_Decompose): Decorate with tracing messages. - - * src/smooth/ftgrays.c [DEBUG_GRAYS]: Replace with - FT_DEBUG_LEVEL_TRACE. - [_STANDALONE_ && FT_DEBUG_LEVEL_TRACE]: Include stdio.h and - stdarg.h. - - (FT_TRACE) [_STANDALONE_]: Remove. - (FT_Message) [_STANDALONE_ && FT_DEBUG_LEVEL_TRACE]: New function. - (FT_TRACE5, FT_TRACE7) [_STANDALONE_]: New macros. - (FT_ERROR) [_STANDALONE_]: Updated. - - (gray_hline) [FT_DEBUG_LEVEL_TRACE]: Fix condition. - Use FT_TRACE7. - (gray_dump_cells): Make it `static void'. - (gray_convert_glyph): Use FT_TRACE7. - - (FT_Outline_Decompose) [_STANDALONE_]: Synchronize with version in - ftoutln.c. - - * src/base/ftadvanc.c (FT_Get_Advance, FT_Get_Advances): Use - FT_ERROR_BASE. - - * docs/formats.txt: Updated. - -2008-09-19 suzuki toshiya - - * src/base/ftmac.c: Import sfnt-wrapped Type1 and sfnt-wrapped - CID-keyed font support. - * builds/mac/ftmac.c: Ditto. - -2008-09-19 suzuki toshiya - - * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Fix double free bug in - sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font support code. - `open_face_from_buffer' frees the passed buffer if it cannot open a - face from the buffer, so the caller must not free it. - -2008-09-19 suzuki toshiya - - * src/base/ftobjs.c (Mac_Read_sfnt_Resource): Add initial support - for sfnt-wrapped Type1 and sfnt-wrapped CID-keyed font. - (ft_lookup_PS_in_sfnt): New function to look up `TYP1' or `CID ' - table in sfnt table directory. It is used before loading TrueType - font driver. - - * docs/CHANGES: Add note about the current status of sfnt-wrapped - Type1 and sfnt-wrapped CID-keyed font support. - -2008-09-18 Werner Lemberg - - * src/base/ftsystem.c (FT_Done_Memory): Use ft_sfree directly for - orthogonality (ft_free and ft_sfree could belong to different memory - pools). This fixes Savannah bug #24297. - -2008-09-18 suzuki toshiya - - * src/cff/cffobjs.c (cff_face_init): Use TTAG_OTTO defined - in ttags.h instead of numerical value 0x4F54544FL. - -2008-09-16 Werner Lemberg - - * src/cff/cffgload.h, src/cff/cffgload.c - (cff_decoder_set_width_only): Eliminate function call. - -2008-09-15 George Williams - - Fix Savannah bug #24179, reported by Bram Tassyns. - - * src/type1/t1load.c (mm_axis_unmap, T1_Get_MM_Var): Fix computation - of default values. - -2008-09-15 Werner Lemberg - - * src/tools/glnames.py (main): Surround `ft_get_adobe_glyph_index' - and `ft_adobe_glyph_list' with FT_CONFIG_OPTION_ADOBE_GLYPH_LIST to - prevent unconditional definition. This fixes Savannah bug #24241. - - * src/psnames/pstables.h: Regenerated. - -2008-09-13 Werner Lemberg - - * autogen.sh, builds/unix/configure.raw, - include/freetype/config/ftconfig.h, builds/unix/ftconfig.in: Minor - beautifying. - - * include/freetype/ftadvanc.h, include/freetype/ftgasp.h, - include/freetype/ftlcdfil.h: Protect against FreeType 1. - Some other minor fixes. - - * devel/ftoption.h: Synchronize with - include/freetype/config/ftoption.h. - -2008-09-11 Werner Lemberg - - * src/base/ftbase.c: Include ftadvanc.c. - -2008-09-11 suzuki toshiya - - * builds/unix/ftconfig.in: Duplicate the cpp computation of - FT_SIZEOF_{INT|LONG} from include/freetype/config/ftconfig.h. - (FT_USE_AUTOCONF_SIZEOF_TYPES): New macro. If defined, the cpp - computation is disabled and the statically configured sizes are - used. This fixes Savannah bug #21250. - - * builds/unix/configure.raw: Add the checks to compare the cpp - computation results of the bit length of int and long versus the - sizes detected by running `configure'. If the results are - different, FT_USE_AUTOCONF_SIZEOF_TYPES is defined to prioritize the - results. - New option --{enable|disable}-biarch-config is added to define or - undefine FT_USE_AUTOCONF_SIZEOF_TYPES manually. - -2008-09-05 suzuki toshiya - - * builds/unix/configure.raw: Clear FT2_EXTRA_LIBS when Carbon or - ApplicationService framework is missing. Although this value is not - used in building of FreeType2, it is written in `freetype2.pc' and - `freetype-config'. - -2008-09-01 david turner - - * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Accept a negative cmap - index to mean `use default cached FT_Face's charmap'. This fixes - Savannah bug #22625. - * include/freetype/ftcache.h: Document it. - - - Make FT_MulFix an inlined function. This is done to speed up - FreeType a little (on x86 3% when loading+hinting, 10% when - rendering, ARM savings are more important though). Disable this by - undefining FT_CONFIG_OPTION_INLINE_MULFIX. - - Use of assembler code can now be controlled with - FT_CONFIG_OPTION_NO_ASSEMBLER. - - * include/freetype/config/ftconfig.h, builds/unix/ftconfig.in - [!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MulFix_arm): New assembler - implementation. - [!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MulFix_i386): Assembler - implementation taken from `ftcalc.c'. - [!FT_CONFIG_OPTION_NO_ASSEMBLER] (FT_MULFIX_ASSEMBLER): New macro - which is defined to the platform-specific assembler implementation - of FT_MulFix. - [FT_CONFIG_OPTION_INLINE_MULFIX && FT_MULFIX_ASSEMBLER] - (FT_MULFIX_INLINED): New macro. - - * include/freetype/config/ftoption.h (FT_CONFIG_OPTION_NO_ASSEMBLER, - FT_CONFIG_OPTION_INLINE_MULFIX): New macros. - - * include/freetype/freetype.h: Updated to handle FT_MULFIX_INLINED. - - * src/base/ftcalc.c: Updated to use FT_MULFIX_ASSEMBLER and - FT_MULFIX_INLINED. - - - Add a new header named FT_ADVANCES_H declaring some new APIs to - extract the advances of one or more glyphs without necessarily - loading their outlines. Also provide `fast loaders' for the - TrueType, Type1, and CFF font drivers (more to come later). - - * src/base/ftadvanc.c, include/freetype/ftadvanc.h: New files. - - * include/freetype/config/ftheader.h (FT_ADVANCES_H): New macro. - * include/freetype/freetype.h (FT_LOAD_ADVANCE_ONLY): New macro. - - * include/freetype/internal/ftdriver.h (FT_Face_GetAdvancesFunc): - `flags' and `advances' are now of type `FT_UInt' and `FT_Fixed', - respectively. - - * src/base/Jamfile (_sources), src/base/rules.mk (BASE_SRC): Add - ftadvanc.c. - - * src/cff/cffdrivr.c (cff_get_advances): New function. - (cff_driver_class): Register it. - - * src/cff/cffgload.c (cff_decoder_set_width_only): New function. - (cff_decoder_parse_charstrings): Handle `width_only'. - (cff_slot_load): Handle FT_LOAD_ADVANCE_ONLY. - - * src/cff/cffgload.h (cff_decoder): New element `width_only'. - (cff_decoder_set_width_only): New declaration. - - * src/truetype/ttdriver.c (tt_get_advances): New function. - (tt_driver_class): Register it. - - * src/truetype/ttgload.c (Get_HMetrics, Get_VMetrics): Renamed to... - (TT_Get_HMetrics, TT_Get_VMetrics): This. - Update callers. - * src/truetype/ttgload.h: Declare them. - - * src/type1/t1gload.h, src/type1/t1gload.c (T1_Get_Advances): New - function. - * src/type1/t1driver.c (t1_driver_class): Register T1_Get_Advances. - - - Add checks for minimum version of the `autotools' stuff. - - * autogen.sh: Implement it. - (get_major_version, get_minor_version, get_patch_version, - compare_to_minimum_version, check_tool_version): New auxiliary - functions. - - * README.CVS: Document it. - -2008-08-29 suzuki toshiya - - * src/sfnt/sfobjs.c (sfnt_open_font): Use TTAG_OTTO defined in - ttags.h instead of FT_MAKE_TAG( 'O', 'T', 'T', 'O' ). - -2008-08-28 Werner Lemberg - - * src/type1/t1load.c (parse_encoding): Protect against infinite - loop. This fixes Savannah bug #24150 (where a patch has been posted - too). - -2008-08-23 Werner Lemberg - - * src/type/t1afm.c (compare_kern_pairs), src/pxaux/afmparse.c - (afm_compare_kern_pairs): Fix comparison. This fixes Savannah bug - #24119. - -2008-08-19 suzuki toshiya - - * src/base/ftobjs.c (FT_Stream_New): Initialize *astream always, - even if passed library or arguments are invalid. This fixes a bug - that an uninitialized stream is freed when an invalid library handle - is passed. Originally proposed by Mike Fabian, 2008/08/18 on - freetype-devel. - (FT_Open_Face): Ditto (stream). - (load_face_in_embedded_rfork): Ditto (stream2). - -2008-08-18 suzuki toshiya - - * src/base/ftmac.c: Add a fallback to guess the availability of the - `ResourceIndex' type. It is used when built without configure - (e.g., a build with Jam). - * builds/mac/ftmac.c: Ditto. - * builds/unix/configure.raw: Set HAVE_TYPE_RESOURCE_INDEX to 1 or 0 - explicitly, even if `ResourceIndex' is unavailable. - -2008-08-18 suzuki toshiya - - * builds/unix/configure.raw: In checking of Mac OS X features, - all-in-one header file `Carbon.h' is replaced by the minimum - header file `CoreServices.h', similar to current src/base/ftmac.c. - -2008-08-18 suzuki toshiya - - * src/sfnt/ttcmap.c (tt_cmap2_validate): Skip the validation of - sub-header when its code_count is 0. Many Japanese Dynalab fonts - include such an empty sub-header (code_count == 0, first_code == 0 - delta == 0, but offset != 0) as the second sub-header in SJIS cmap. - -2008-08-04 Werner Lemberg - - * src/type1/t1tokens.h: Handle `ForceBold' keyword. This fixes - Savannah bug #23995. - - * src/cid/cidload.c (parse_expansion_factor): New callback function. - (cid_field_records): Use it for `ExpansionFactor'. - * src/cod/cidtoken.h: Handle `ForceBold' keyword. - Don't handle `ExpansionFactor'. - -2008-08-04 Bram Tassyns - - * src/cff/cffparse.c (cff_parse_fixed_scaled): Fix thinko which - resulted in incorrect scaling. This fixes Savannah bug #23973. - -2008-08-04 Werner Lemberg - - Be more tolerant w.r.t. invalid entries in SFNT table directory. - - * src/sfnt/ttload.c (check_table_dir): Ignore invalid entries and - adjust table count. - Add more trace messages. - (tt_face_load_font_dir): Updated. - -2008-07-30 Werner Lemberg - - * src/cff/cffgload.c (cff_decoder_parse_charstrings): No longer - assume that the first argument on the stack is the bottom-most - element. Two reasons: - - o According to people from Adobe it is missing in the Type 2 - specification that pushing of additional, superfluous arguments - on the stack is prohibited. - - o Acroread in general handles fonts differently, namely by popping - the number of arguments needed for a particular operand (as a PS - interpreter would do). In case of buggy fonts this causes a - different interpretation which of the elements on the stack are - superfluous and which not. - - Since there are CFF subfonts (embedded in PDFs) which rely on - Acroread's behaviour, FreeType now does the same. - -2008-07-27 Werner Lemberg - - Add extra mappings for `Tcommaaccent' and `tcommaaccent'. This - fixes Savannah bug #23940. - - * src/psnames/psmodule.c (WGL_EXTRA_LIST_SIZE): Rename to... - (EXTRA_GLYPH_LIST_SIZE): This. - Increase by 2. - (ft_wgl_extra_unicodes): Rename to... - (ft_extra_glyph_unicodes): This. - Add two code values. - (ft_wgl_extra_glyph_names): Rename to... - (ft_extra_glyph_names): This. - Add two glyphs. - (ft_wgl_extra_glyph_name_offsets): Rename to... - (ft_extra_glyph_name_offsets): This. - Add two offsets. - - (ps_check_wgl_name, ps_check_wgl_unicode): Rename to... - (ps_check_extra_glyph_name, ps_check_extra_glyph_unicode): This. - Updated. - (ps_unicodes_init): Updated. - -2008-07-26 Werner Lemberg - - * src/cff/cffgload.c (cff_decoder_prepare, - cff_decoder_parse_charstrings): Improve debug output. - -2008-07-22 Martin McBride - - * src/sfnt/ttcmap.c (tt_cmap4_validate, tt_cmap4_char_map_linear, - tt_cmap4_char_map_binary): Handle fonts which treat the last segment - specially. According to the specification, such fonts would be - invalid but acroread accepts them. - -2008-07-16 Jon Foster - - * src/pfr/pfrdrivr.c (pfr_get_advance): Fix off-by-one error. - - * src/base/ftcalc.c (FT_MulFix): Fix portability issue. - - * src/sfnt/ttpost.c (MAC_NAME) [!FT_CONFIG_OPTION_POSTSCRIPT_NAMES]: - Fix compiler warning. - -2008-07-16 Werner Lemberg - - Handle CID-keyed fonts wrapped in an SFNT (with cmaps) correctly. - - * src/cff/cffload.c (cff_font_load): Pass `pure_cff'. - Invert sids table only if `pure_cff' is set. - * src/cff/cffload.h: Udpated. - - * src/cff/cffobjs.c (cff_face_init): Updated. - Set FT_FACE_FLAG_CID_KEYED only if pure_cff is set. - - * docs/CHANGES: Updated. - -2008-07-09 Werner Lemberg - - * src/truetype/ttpload.c (tt_face_load_loca): Handle buggy fonts - where num_locations < num_glyphs. Problem reported by Ding Li. - -2008-07-05 Werner Lemberg - - Since FreeType uses `$(value ...)', we now need GNU make 3.80 or - newer. This fixes Savannah bug #23648. - - * configure: zsh doesn't like ${1+"$@"}. - Update needed GNU make version. - * builds/toplevel.mk: Check for `$(eval ...)'. - * docs/INSTALL.GNU, docs/INSTALL.CROSS, docs/INSTALL.UNIX: Document - it. - -2008-07-04 Werner Lemberg - - * src/raster/ftraster.c (Draw_Sweep): If span is smaller than one - pixel, only check for dropouts if neither start nor end point lies - on a pixel center. This fixes Savannah bug #23762. - -2008-06-29 Werner Lemberg - - * Version 2.3.7 released. - ========================= - - - Tag sources with `VER-2-3-7'. - - * docs/CHANGES, docs/VERSION.DLL: Update documentation and bump - version number to 2.3.7. - - * README, Jamfile (RefDoc), builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, - builds/win32/visualce/index.html, - builds/win32/visualce/freetype.dsp, - builds/win32/visualce/freetype.vcproj: s/2.3.6/2.3.7/, s/236/237/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 7. - - * builds/unix/configure.raw (version_info): Set to 9:18:3. - - * docs/release: Updated. - -2008-06-28 Werner Lemberg - - * src/ftglyph.c (FT_Matrix_Multiply, FT_Matrix_Invert): Move to... - * src/ftcalc.c: Here. This fixes Savannah bug #23729. - -2008-06-27 Werner Lemberg - - * src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop, - Horizontal_Gray_Sweep_Drop): Test for intersections which - degenerate to a single point can be ignored; this has been confirmed - by Greg Hitchcock from Microsoft. (This was commented out code.) - -2008-06-26 Werner Lemberg - - Improve navigation in API reference. - - * src/tools/docmaker/tohtml.py (html_header_3): Renamed to... - (html_header_6): This. - (html_header_3, html_header_3i, html_header_4, html_header_5, - html_header_5t): New strings. - (toc_footer_start, toc_footer_end): New strings. - (HtmlFormatter::html_header): Updated. - (HtmlFormatter::html_index_header, HtmlFormatter::html_toc_header): - New strings. - (HtmlFormatter::index_enter): Use `html_index_header'. - (HtmlFormatter::index_exit): Print `html_footer'. - (HtmlFormatter::toc_enter): Use `html_toc_header'. - (HtmlFormatter::toc_exit): Print proper footer. - - Convert ~ to non-breakable space. - - * src/tools/docmaker/tohtml.py (make_html_para): Implement it. - Update header files accordingly. - -2008-06-24 suzuki toshiya - - * builds/unix/configure.raw: Check type `ResourceIndex' explicitly - and define HAVE_TYPE_RESOURCE_INDEX if it is defined. Mac OS X 10.5 - bundles 10.4u SDK with MAC_OS_X_VERSION_10_5 macro but without - ResourceIndex type definition. The macro does not inform the type - availability. - * src/base/ftmac.c: More parentheses are inserted to clarify the - conditionals to disable legacy APIs in `10.5 and later' cases. If - HAVE_TYPE_RESOURCE_INDEX is not defined, ResourceIndex is defined. - -2008-06-24 Werner Lemberg - - * src/truetype/ttinterp.c (Ins_SCANTYPE): Don't check rendering - mode. - - * src/raster/ftraster.c (Render_Glyph, Render_Gray_Glyph, - Draw_Sweep): No-dropout mode is value 2, not value 0. - (Draw_Sweep): Really skip dropout handling for no-dropout mode. - -2008-06-24 Werner Lemberg - - * src/psaux/psobjs.c (t1_builder_close_contour): Don't add contour - if it consists of one point only. Based on a patch from Savannah - bug #23683 (from John Tytgat). - -2008-06-22 Werner Lemberg - - * src/truetype/ttgload.c (TT_Load_Glyph): Protect bytecode stuff - with IS_HINTED. - - * docs/CHANGES: Updated. - -2008-06-22 suzuki toshiya - - * builds/unix/configure.raw: If CFLAGS has `-isysroot XXX' option - but LDFLAGS does not, import it to LDFLAGS. The option is used to - specify non-default SDK on Mac OS X (e.g., universal binary SDK for - Mac OS X 10.4 on PowerPC platform). Although Apple TechNote 2137 - recommends to add the option only to CFLAGS, LDFLAGS should include - it because libfreetype.la is built with -no-undefined. This fixes a - bug reported by Ryan Schmidt in MacPorts, - http://trac.macports.org/ticket/15331. - -2008-06-21 Werner Lemberg - - Enable access to the various dropout rules of the B&W rasterizer. - Pass dropout rules from the TT bytecode interpreter to the - rasterizer. - - * include/freetype/ftimage.h (FT_OUTLINE_SMART_DROPOUTS, - FT_OUTLINE_EXCLUDE_STUBS): New flags for FT_Outline. - - * src/raster/ftraster.c (Vertical_Sweep_Drop, Horizontal_Sweep_Drop, - Horizontal_Gray_Sweep_Drop): Use same mode numbers as given in the - OpenType specification. - Fix mode 4 computation. - (Render_Glyph, Render_Gray_Glyph): Handle new outline flags. - - * src/truetype/ttgload.c (TT_Load_Glyph) Convert scan conversion - mode to FT_OUTLINE_XXX flags. - - * src/truetype/ttinterp.c (Ins_SCANCTRL): Enable ppem check. - -2008-06-19 Werner Lemberg - - * src/cff/cffobjs.c (cff_face_init): Compute final - `dict->units_per_em' value before assigning it to - `cffface->units_per_EM'. Otherwise, CFFs without subfonts are - scaled incorrectly if the font matrix is non-standard. This fixes - Savannah bug #23630. - - * docs/CHANGES: Updated. - -2008-06-19 Werner Lemberg - - * src/type/t1objs.c (T1_Face_Init): Slightly improve algorithm fix - from 2008-06-19. - -2008-06-18 Werner Lemberg - - * src/type/t1objs.c (T1_Face_Init): Fix change from 2008-03-21. - Reported by Peter Weilbacher . - - * docs/CHANGES: Updated. - -2008-06-15 George Williams - - * src/otvalid/otvgpos.c (otv_MarkBasePos_validate): Set - `valid->extra2' to 1. This is undocumented in the OpenType 1.5 - specification. - -2008-06-15 Werner Lemberg - - * src/base/ftcalc.c (FT_MulFix) : Protect registers correctly - from clobbering. Patch from Savannah bug report #23556. - - * docs/CHANGES: Document it. - -2008-06-10 Werner Lemberg - - * autogen.sh: Add option `--install' to libtoolize. - -2008-06-10 Werner Lemberg - - * Version 2.3.6 released. - ========================= - - - Tag sources with `VER-2-3-6'. - - * docs/CHANGES, docs/VERSION.DLL: Update documentation and bump - version number to 2.3.6. - - * README, Jamfile (RefDoc), builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, - builds/win32/visualce/index.html, - builds/win32/visualce/freetype.dsp, - builds/win32/visualce/freetype.vcproj: s/2.3.5/2.3.6/, s/235/236/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 6. - - * builds/unix/configure.raw (version_info): Set to 9:17:3. - - - * include/freetype/internal/psaux.h (T1_BuilderRec): Remove `scale_x' - and `scale_y'. - * src/cff/cffgload.h (CFF_Builder): Remove `scale_x' and `scale_y'. - - - * src/cff/cffparse.c: Include FT_INTERNAL_DEBUG_H. - * src/cff/cffobjs.h: Include FT_INTERNAL_POSTSCRIPT_HINTS_H. - -2008-06-10 Werner Lemberg - - * src/base/ftobjs.c (open_face): Check `clazz->init_face' and - `clazz->done_face'. - -2008-06-09 VaDiM - - Support debugging on WinCE. From Savannah patch #6536; this fixes - bug #23497. - - * builds/win32/ftdebug.c (OutputDebugStringEx): New function/macro - as a replacement for OutputDebugStringA (which WinCE doesn't have). - Update all callers. - (ft_debug_init) [_WIN32_CE]: WinCE apparently doesn't have - environment variables. - -2008-06-09 Werner Lemberg - - * README.CVS: Updated. - - * builds/unix/configure.raw, builds/unix/freetype-config.in: Updated - for newer versions of autoconf and friends. - -2008-06-08 Werner Lemberg - - * src/type1/t1parse.h (T1_ParserRec): Make `base_len' and - `private_len' unsigned. - - * src/type1/t1parse.c (read_pfb_tag): Make `asize' unsigned and read - it as such. - (T1_New_Parser, T1_Get_Private_Dict): Make `size' unsigned. - - - * src/base/ftstream.c (FT_Stream_Skip): Reject negative values. - - - * src/type1/t1load.c (parse_blend_design_positions): Check `n_axis' - for sane value. - Fix typo. - - - * src/psaux/psobjs.c (ps_table_add): Check `idx' correctly. - - - * src/truetype/ttinterp (Ins_SHC): Use BOUNDS() to check - `last_point'. - - - * src/sfnt/ttload.c (tt_face_load_max_profile): Limit - `maxTwilightPoints'. - -2008-06-06 Werner Lemberg - - * src/truetype/ttinterp.c (Ins_IP): Handle case `org_dist == 0' - correctly. This fixes glyphs `t' and `h' of Arial Narrow at 12ppem. - -2008-06-03 Werner Lemberg - - * include/freetype/ftcache.h (FTC_FaceID): Change type back to - FT_Pointer. Reported by Ian Britten . - -2008-06-02 Werner Lemberg - - Emit header info for defined FreeType objects in reference. - - * src/tools/docmaker/content.py (re_header_macro): New regexp. - (ContentProcessor::__init__): Initialize new dictionary `headers'. - (DocBlock::__init__): Collect macro header definitions. - - * src/tools/docmaker/tohtml.py (header_location_header, - header_location_footer): New strings. - (HtmlFormatter::__init__): Pass `headers' dictionary. - (HtmlFormatter::print_html_field): Don't emit paragraph tags. - (HtmlFormatter::print_html_field_list): Emit empty paragraph. - (HtmlFormatter::block_enter): Emit header info. - -2008-06-01 Werner Lemberg - - * include/freetype/config/ftheader.h (FT_UNPATENTED_HINTING_H, - FT_INCREMENTAL_H): Added. - -2008-05-28 Werner Lemberg - - * src/tools/docmaker/sources.py (SourceBlock::__init__): While - looking for markup tags, return immediately as soon a single one is - found. - -2008-05-28 Werner Lemberg - - * src/truetype/ttinterp.c (Ins_MD): The MD instruction also uses - original, unscaled input values. Confirmed by Greg Hitchcock from - Microsoft. - -2008-05-27 Werner Lemberg - - * src/tools/docmaker/tohtml.py (block_footer_start, - block_footer_middle): Beautify output. - -2008-05-25 Werner Lemberg - - * src/raster/ftraster.c (fc_black_render): Return 0 when we are - trying to render into a zero-width/height bitmap, not an error code. - - * src/truetype/ttgload.c (load_truetype_glyph): Move initialization - of the graphics state for subglyphs to... - (TT_Hint_Glyph): This function. - Hinting instructions for a composite glyph apparently refer to the - just hinted subglyphs, not the unhinted, unscaled outline. This - seems to fix Savannah bugs #20973 and (at least partially) #23310. - -2008-05-20 suzuki toshiya - - * src/base/ftmac.c (FT_New_Face_From_Suitcase): Check if valid - `aface' is returned by FT_New_Face_From_FOND(). The patch was - proposed by an anonymous reporter of Savannah bug #23204. - -2008-05-18 Werner Lemberg - - * src/pshinter/pshalgo.c (ps_hints_apply): Reset scale values after - correction for pixel boundary. Without this patch, the effect can - be cumulative under certain circumstances, making glyphs taller and - taller after each call. This fixes Savannah bug #19976. - -2008-05-18 Werner Lemberg - - * src/base/ftdebug.c (FT_Message, FT_Panic): Send output to stderr. - This fixes Savannah bug #23280. - - * docs/CHANGES: Updated. - -2008-05-18 David Turner - - * src/psnames/psmodule.c (ft_wgl_extra_unicodes, - ft_wgl_extra_glyph_names, ft_wgl_extra_glyph_name_offsets, - ps_check_wgl_name, ps_check_wgl_unicode): Use `static' to make - declarations non-global. - - * src/type1/t1load.c: Add missing comment. - -2008-05-17 Sam Hocevar - - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Handle zero-contour - glyphs correctly. Patch from Savannah bug #23277. - -2008-05-16 Werner Lemberg - - * docs/CHANGES: Updated. - -2008-05-16 Sergey Tolstov - - Improve support for WGL4 encoded fonts. - - * src/psnames/psmodule.c (WGL_EXTRA_LIST_SIZE): New macro. - (ft_wgl_extra_unicodes, ft_wgl_extra_glyph_names, - ft_wgl_extra_glyph_name_offsets): New arrays. - (ps_check_wgl_name, ps_check_wgl_unicode): New functions. - (ps_unicodes_init): Use them to add additional Unicode mappings. - -2008-05-15 Werner Lemberg - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings) - : `closepath' without a path is a no-op, not an error - (cf. the PS reference manual). - - Reported by Martin McBride. - -2008-05-15 Werner Lemberg - - * builds/toplevel.mk (CONFIG_GUESS, CONFIG_SUB): Updated. - -2008-05-15 Werner Lemberg - - * src/type1/t1load.c (parse_subrs): Accept fonts with a subrs array - which contains a single but empty entry. This is technically - invalid (since it must end with `return'), but... - - Reported by Martin McBride. - -2008-05-14 Werner Lemberg - - Finish fix of scaling bug of CID-keyed CFF subfonts. - - * include/freetype/internal/ftcalc.h, src/base/ftcalc.c - (FT_Matrix_Multiply_Scaled, FT_Vector_Transform_Scaled): New - functions. - - * src/cff/cffobjs.h (CFF_Internal): New struct. It is used to - provide global hinting data for both the top-font and all subfonts - (with proper scaling). - - * src/cff/cffobjs.c (cff_make_private_dict): New function, using - code from `cff_size_init'. - (cff_size_init, cff_size_done, cff_size_select, cff_size_request): - Use CFF_Internal and handle subfonts. - (cff_face_init): Handle top-dict and subfont matrices correctly; - apply some heuristic in case of unlikely matrix concatenation - results. This has been discussed with people from Adobe (thanks - goes mainly to David Lemon) who confirm that the CFF specs are fuzzy - and not correct. - - * src/cff/cffgload.h (cff_decoder_prepare): Add `size' argument. - - * src/cff/cffgload.c (cff_builder_init): Updated. - (cff_decoder_prepare): Handle hints globals for subfonts. - Update all callers. - (cff_slot_load): Handling scaling of subfonts properly. - - * src/cff/cffparse.c (cff_parse_fixed_dynamic): New function. - (cff_parse_font_matrix): Use it. - - * src/cff/cfftypes.h (CFF_FontDictRec): Make `units_per_em' - FT_ULong. - - * docs/CHANGES: Document it. - -2008-05-13 Werner Lemberg - - * src/winfonts/winfnt.c (fnt_face_get_dll_font, FNT_Face_Init): - Handle case `face_index < 0'. - * docs/CHANGES: Document it. - -2008-05-04 Werner Lemberg - - First steps to fix the scaling bug of CID-keyed CFF subfonts, - reported by Ding Li on 2008/03/28 on freetype-devel. - - * src/base/cff/cffparse.c (power_tens): New array. - (cff_parse_real): Rewritten to introduce a fourth parameter which - returns the `scaling' of the real number so that we have no - precision loss. This is not used yet. - Update all callers. - (cff_parse_fixed_thousand): Replace with... - (cff_parse_fixed_scaled): This function. Update all callers. - -2008-05-03 Werner Lemberg - - * src/base/ftobjs.c (FT_Load_Glyph): Call the auto-hinter without - transformation since it recursively calls FT_Load_Glyph. This fixes - Savannah bug #23143. - -2008-04-26 Werner Lemberg - - * include/freetype/internal/psaux.h (T1_BuilderRec): Mark `scale_x' - and `scale_y' as obsolete since they aren't used. - * src/psaux/psobjs.c (t1_builder_init): Updated. - - * src/cff/cffgload.h (CFF_Builder): Mark `scale_x' and `scale_y' as - obsolete since they aren't used. - * src/cff/cffgload.c (cff_builder_init): Updated. - -2008-04-14 Werner Lemberg - - * src/pcf/pcfdrivr.c (PCF_Face_Init): Protect call to - `FT_Stream_OpenLZW' with `FT_CONFIG_OPTION_USE_LZ'. From Savannah - bug #22909. - -2008-04-13 Werner Lemberg - - * src/psaux/psconv.c (PS_Conv_ToFixed): Increase precision if - integer part is zero. - -2008-04-01 Werner Lemberg - - Fix compilation with g++ 4.1 (with both `single' and `multi' - targets). - - * src/base/ftobjs.c (FT_Open_Face): Don't define a variable in block - which is crossed by a `goto'. - - * src/otvalid/otvalid.h (otv_MATH_validate): Add prototype. - -2008-03-31 Werner Lemberg - - Fix support for subsetted CID-keyed CFFs. - - * include/freetype/freetype.h (FT_FACE_FLAG_CID_KEYED, - FT_IS_CID_KEYED): New macros. - - * src/cff/cffobjs.c (cff_face_init): Set number of glyphs to the - maximum CID value in CID-keyed CFFs. - Handle FT_FACE_FLAG_CID_KEYED flag. - - * docs/CHANGES: Document it. - - - Fix CFF font matrix calculation and improve precision. - - * src/cff/cffparse.c (cff_parse_real): Increase precision if integer - part is zero. - (cff_parse_font_matrix): Simplify computation of `units_per_em'; - this prevents overflow also. - - - Support FT_Get_CID_Registry_Ordering_Supplement for PS CID fonts. - - * src/cid/cidriver.c: Include FT_SERVICE_CID_H. - (cid_get_ros): New function. - (cid_service_cid_info): New service structure. - (cid_services): Register it. - -2008-03-23 Werner Lemberg - - Adjustments for Visual C++ 8.0, as reported by Rainer Deyke. - - * builds/compiler/visualc.mk (CFLAGS): Remove /W5. - (ANSIFLAGS): Add _CRT_SECURE_NO_DEPRECATE. - -2008-03-21 Laurence Darby - - * src/type1/t1objs.c (T1_Face_Init): Use `/Weight'. Patch from - Savannah bug #22675. - -2008-03-13 Derek Clegg - - * src/truetype/ttgxvar.c (TT_Get_MM_Var): Fix named style loop. - Patch from Savannah bug #22541. - -2008-03-03 Masatoshi Kimura - - * src/sfnt/ttcmap.c (tt_cmap14_char_map_nondef_binary, - tt_cmap14_find_variant): Return correct value. - (tt_cmap14_variant_chars): Fix check for `di'. - -2008-02-29 Wermer Lemberg - - * docs/CHANGES: Updated. - -2008-02-29 Wolf - - Add build support for symbian platform. From Savannah bug #22440. - - * builds/symbian/*: New files. - -2008-02-21 suzuki toshiya - - * src/base/ftmac.c (parse_fond): Fix a bug of PostScript font name - synthesis. For any face of a specified FOND, always the name for - the first face was used. Except of a FOND that refers multiple - Type1 font files, wrong synthesized font names are not used at all, - so this is an invisible bug. A few limit checks are added too. - - * builds/mac/ftmac.c: Ditto. - -2008-02-21 suzuki toshiya - - * builds/unix/configure.raw: Split compiler option to link Carbon - frameworks to one option for CoreServices framework and another - option for ApplicationServices framework. The split options can be - managed by GNU libtool to avoid unrequired duplication when FreeType - is linked with other applications. Suggested by Daniel Macks, - Savannah bug #22366. - -2008-02-18 Victor Stinner - - * src/truetype/ttinterp.c (Ins_IUP): Check number of points. Fix - from Savannah bug #22356. - -2008-02-17 Jonathan Blow - - * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): - Check for valid callback pointers. - -2008-02-15 suzuki toshiya - - * src/base/ftmac.c (FT_New_Face_From_SFNT): Check the sfnt resource - handle by its value instead of ResError(), fix provided by Deron - Kazmaier. According to the Resource Manager Reference, - GetResource(), Get1Resource(), GetNamedResource(), - Get1NamedResource() and RGetResource() set noErr but return NULL - handle when they can not find the requested resource. These - functions never return undefined values, so it is sufficient to - check if the handle is not NULL. - - * builds/mac/ftmac.c (FT_New_Face_From_SFNT): Ditto. - -2008-02-14 suzuki toshiya - - * src/base/ftbase.c: is replaced by "ftmac.c" as other - inclusion styles. Now it always includes src/base/ftmac.c; - builds/mac/ftmac.c is never included in any configuration. - - * builds/unix/configure.raw: Print warning if configure is executed - with options to specify Carbon functionalities explicitly. - - * docs/INSTALL.MAC: Note that legacy builds/mac/ftmac.c is not - included automatically and manual replacement is required. - -2008-02-11 Werner Lemberg - - * builds/modules.mk (CLOSE_MODULE, REMOVE_MODULE), builds/detect.mk - (dos_setup), builds/freetype.mk (clean_project_dos, - distclean_project_dos): Don't use \ but $(SEP). Reported by Duncan - Murdoch. - -2008-01-18 Sylvain Pasche - - * src/base/ftlcdfil.c (_ft_lcd_filter_legacy): Updated comment to - mention intra-pixel algorithm. - - * include/freetype/freetype.h (FT_Render_Mode): Mention that - FT_Library_SetLcdFilter can be used to reduce fringes. - -2008-01-16 Werner Lemberg - - * src/raster/ftraster.c (ft_black_render): Check `outline' before - using it. Reported by Allan Yang. - -2008-01-12 Werner Lemberg - - * src/raster/ftraster.c (FT_CONFIG_OPTION_5_GRAY_LEVELS): Remove. - -2008-01-12 Allan Yang, Jian Hua - SH - - * src/raster/ftraster.c (ft_black_init) - [FT_RASTER_OPTION_ANTI_ALIASING]: Fix compilation. - -2008-01-10 Werner Lemberg - - * src/truetype/ttgload.c (load_truetype_glyph): Handle the case - where the number of contours in a simple glyph is zero (and which - does contain an entry in the `glyf' table). This fixes Savannah bug - #21990. - -2008-01-04 suzuki toshiya - - Formatting suggested by Sean McBride. - - * builds/mac/ftmac.c: Formatting (tab expanded). - * src/autofit/afindic.c: Ditto. - * src/base/ftcid.c: Ditto. - * src/base/ftmac.c: Ditto. - -2007-12-30 Werner Lemberg - - * src/smooth/ftgrays.c (gray_raster_render): Check `outline' - correctly. - -2007-12-21 suzuki toshiya - - Improvement of POSIX resource-fork accessor to load unsorted - references in a resource. In HelveLTMM (resource-fork PostScript - Type1 font bundled with Mac OS X since 10.3.x), the appearance order - of PFB chunks is not sorted; sorting the chunks by reference IDs is - required. - - * include/freetype/internal/ftrfork.h (FT_RFork_Ref): New structure - type to store a pair of reference ID and offset to the chunk. - - * src/base/ftrfork.c (ft_raccess_sort_ref_by_id): New function to - sort FT_RFork_Ref by their reference IDs. - - (FT_Raccess_Get_DataOffsets): Returns an array of offsets that is - sorted by reference ID. - -2007-12-14 Werner Lemberg - - * src/cff/cffparse.c (cff_parse_real): Don't apply `power_ten' - division too early; otherwise the most significant digit(s) of the - final result are lost as the value is truncated to an integer. This - fixes Savannah bug #21794 (where the patch has been posted too). - -2007-12-06 Fix <4d876b82@gmail.com> - - Pass options from one configure script to another as-is (not - expanded). This is needed for options like - --includedir='${prefix}/include'. - - * builds/unix/detect.mk, configure: Prevent argument expansion in - call to the (real) `configure' script. - -2007-12-06 Werner Lemberg - - * src/truetype/ttgload.c (load_truetype_glyph): Fix compilation if - TT_USE_BYTECODE_INTERPRETER isn't defined. - -2007-12-06 Werner Lemberg - - There exist CFFs which contain opcodes for the Type 1 operators - `hsbw' and `closepath' which are both invalid in Type 2 charstrings. - However, it doesn't harm to support them. - - * src/cff/cffgload.c (CFF_Operator): Add `cff_op_hsbw' and - `cff_op_closepath.' - (cff_argument_counts): Ditto. - - (cff_decoder_parse_charstrings): Handle Type 1 opcodes 9 (closepath) - and 13 (hsbw) which are invalid in Type 2 charstrings. - -2007-12-06 suzuki toshiya - - * src/base/ftrfork.c (raccess_guess_darwin_newvfs): New function to - support new pathname syntax `..namedfork/rsrc' to access a resource - fork on Mac OS X. The legacy syntax `/rsrc' does not work on - case-sensitive HFS+. - (raccess_guess_darwin_hfsplus): Fix a bug in the calculation of - buffer size to store a pathname. - * include/freetype/internal/ftrfork.h: Increment the number of - resource fork guessing rule. - -2007-12-06 suzuki toshiya - - * builds/unix/configure.raw: Improve the compile tests to search - Carbon functions. - * builds/mac/ftmac.c: Import fixes for Carbon incompatibilities - proposed by Sean McBride from src/base/ftmac.c (see 2007-11-16). - -2007-12-06 suzuki toshiya - - The documents and comments for Mac OS X are improved by Sean - McBride. - - * src/base/ftmac.c: Fix a comment. - * include/freetype/ftmac.h: Ditto. - * docs/INSTALL.MAC: Improve English and add comment on lowest - system version specified by MACOSX_DEPLOYMENT_TARGET. - -2007-12-04 Werner Lemberg - - * src/cff/cffload.c (cff_subfont_load): Don't use logical OR to - concatenate error codes. - * src/sfnt/ttsbit.c (Load_SBit_Range): Ditto. - -2007-12-04 Graham Asher - - * src/truetype/ttobjs.c (tt_face_init): Don't use logical OR to - concatenate error codes. - -2007-12-04 Sean McBride - - * src/pfr/pfrgload.c (pfr_glyph_load_compound): Remove compiler - warning. - -2007-11-20 suzuki toshiya - - Fix MacOS legacy font support by Masatake Yamato on Mac OS X. It is - not working since 2.3.5. In FT_Open_New(), if FT_New_Stream() - cannot mmap() the specified file and cannot seek to head of the - specified file, it returns NULL stream and FT_Open_New() returns the - error immediately. On MacOS, most legacy MacOS fonts fall into such - a scenario because their data forks are zero-sized and cannot be - sought. To proceed to guessing of resource fork fonts, the - functions for legacy MacOS font must properly handle the NULL stream - returned by FT_New_Stream(). - - * src/base/ftobjs.c (IsMacBinary): Return error - FT_Err_Invalid_Stream_Operation immediately when NULL stream is - passed. - (FT_Open_Face): Even when FT_New_Stream() returns an error, proceed - to fallback. Originally, legacy MacOS font is tested in the cases - of FT_Err_Invalid_Stream_Operation (occurs when data fork is empty) - or FT_Err_Unknown_File_Format (occurs when AppleSingle header or - .dfont header is combined). Now the case of - FT_Err_Cannot_Open_Stream is included. - - * src/base/ftrfork.c (FT_Raccess_Guess): When passed stream is NULL, - skip FT_Stream_Seek(), which seeks to the head of stream, and - proceed to unit testing of raccess_guess_XXX(). FT_Stream_Seek() - for a NULL stream causes a Bus error on Mac OS X. - (raccess_guess_apple_double): Return FT_Err_Cannot_Open_Stream - immediately if passed stream is NULL. - (raccess_guess_apple_single): Ditto. - -2007-11-16 suzuki toshiya - - Fix for Carbon incompatibilities since Mac OS X 10.5, - proposed by Sean McBride. - - * doc/INSTALL.MAC: Comment on MACOSX_DEPLOYMENT_TARGET. - - * include/freetype/ftmac.h: Deprecate FT_New_Face_From_FOND and - FT_GetFilePath_From_Mac_ATS_Name. Since Mac OS X 10.5, calling - Carbon functions from a forked process is classified as unsafe - by Apple. All Carbon-dependent functions should be deprecated. - - * src/base/ftmac.c: Use essential header files - and - instead of - all-in-one header file . - - Include and replace HFS_MAXPATHLEN by Apple - genuine macro PATH_MAX. - - Add fallback macro for kATSOptionFlagsUnRestrictedScope which - is not found in Mac OS X 10.0. - - Multi-character constants ('POST', 'sfnt' etc) are replaced by - 64bit constants calculated by FT_MAKE_TAG() macro. - - For the index in the segment of resource fork, new portable - type ResourceIndex is introduced for better compatibility. - This type is since Mac OS X 10.5, so it is defined as short - when built on older platforms. - - (FT_ATSFontGetFileReference): If build target is only the systems - 10.5 and newer, it calls Apple genuine ATSFontGetFileReference(). - - (FT_GetFile_From_Mac_ATS_Name): Return an error if system is 10.5 - and newer or 64bit platform, because legacy type FSSpec type is - removed completely. - - (FT_New_Face_From_FSSpec): Ditto. - -2007-11-01 Werner Lemberg - - * src/sfnt/sfobjs.c (sfnt_done_face): Check `sfnt' everywhere. This - fixes Savannah bug #21485. - -2007-10-29 Daniel Svoboda - - * src/winfonts/winfnt.c (FNT_Face_Init): Check first that the driver - can handle the font at all, then check `face_index'. Otherwise, the - driver might return the wrong error code. This fixes Savannah bug - #21468. - -2007-10-21 Werner Lemberg - - * src/sfnt/sfobjs.c (sfnt_load_face): Support bit 9 and prepare - support for bit 8 of the `fsSelection' field in the `OS/2' table. - MS is already using this; hopefully, this becomes part of OpenType - 1.5. - Prepare also support for `name' IDs 21 (WWS_FAMILY) and 22 - (WWS_SUBFAMILY). - -2007-10-20 Werner Lemberg - - * src/tools/docmaker/tohtml.py (html_header_2): Fix typo. - Add `td.left' element to CSS. - (toc_section_enter): Use it. - -2007-10-18 David Turner - - * include/freetype/freetype.h, src/base/ftobjs.c: Rename API - functions related to cmap type 14 support to the - `FT_Object_ActionName' scheme: - - FT_Get_Char_Variant_index -> FT_Face_GetCharVariantIndex - FT_Get_Char_Variant_IsDefault -> FT_Face_GetCharVariantIsDefault - FT_Get_Variant_Selectors -> FT_Face_GetVariantSelectors - FT_Get_Variants_Of_Char -> FT_Face_GetVariantsOfChar - FT_Get_Chars_Of_Variant -> FT_Face_GetCharsOfVariant - - Update documentation accordingly. - - * src/sfnt/ttcmap.c: Stronger cmap 14 validation. - Make the code a little more consistent with FreeType coding - conventions and modify the cmap14 functions that returned a newly - allocated array to use a persistent vector from the TT_CMap14 object - instead. - - (TT_CMap14Rec): Provide array and auxiliary data for result. - (tt_cmap14_done, tt_cmap14_ensure): New functions. - - (tt_cmap14_init, tt_cmap14_validate, tt_cmap14_char_map_def_binary, - tt_cmap14_char_map_nondef_binary, tt_cmap14_find_variant, - tt_cmap14_char_var_index, tt_cmap14_variants, - tt_cmap14_char_variants, tt_cmap14_def_char_count, - tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars, - tt_cmap14_variant_chars, tt_cmap14_class_rec): Updated and improved. - -2007-10-15 George Williams - - Add support for cmap type 14. - - * devel/ftoption.h, include/freetype/config/ftoption.h - (TT_CONFIG_CMAP_FORMAT_14): New macro. - - * include/freetype/internal/ftobjs.h (FT_CMap_CharVarIndexFunc, - FT_CMap_CharVarIsDefaultFunc, FT_CMap_VariantListFunc, - FT_CMap_CharVariantListFunc, FT_CMap_VariantCharListFunc): New - support function prototypes. - (FT_CMap_ClassRec): Add them. - Update all users. - - * include/freetype/ttnameid.h (TT_APPLE_ID_VARIANT_SELECTOR): New - macro. - - * include/freetype/freetype.h (FT_Get_Char_Variant_Index, - FT_Get_Char_Variant_IsDefault, FT_Get_Variant_Selectors, - FT_Get_Variants_Of_Char, FT_Get_Chars_Of_Variant): New API - functions. - - * src/base/ftobjs.c (find_variant_selector_charmap): New auxiliary - function. - (FT_Set_Charmap): Disallow cmaps of type 14. - (FT_Get_Char_Variant_Index, FT_Get_Char_Variant_IsDefault, - FT_Get_Variant_Selectors, FT_Get_Variants_Of_Char, - FT_Get_Chars_Of_Variant): New API functions. - - * src/sfnt/ttcmap.c (TT_PEEK_UINT24, TT_NEXT_UINT24): New macros. - - (TT_CMap14Rec, tt_cmap14_init, tt_cmap14_validate, - tt_cmap14_char_index, tt_cmap14_char_next, tt_cmap14_get_info, - tt_cmap14_char_map_def_binary, tt_cmap14_char_map_nondef_binary, - tt_cmap14_find_variant, tt_cmap14_char_var_index, - tt_cmap14_char_var_isdefault, tt_cmap14_variants, - tt_cmap14_char_variants, tt_cmap14_def_char_count, - tt_cmap14_get_def_chars, tt_cmap14_get_nondef_chars, - tt_cmap14_variant_chars, tt_cmap14_class_rec): New functions and - structures for cmap 14 support. - (tt_cmap_classes): Register tt_cmap14_class_rec. - (tt_face_build_cmaps): One more error message. - - * docs/CHANGES: Mention cmap 14 support. - -2007-10-01 Werner Lemberg - - * src/base/ftobjs.c (find_unicode_charmap): If search for a UCS-4 - charmap fails, do the loop again while searching a UCS-2 charmap. - This favours MS charmaps over Apple ones. - -2007-08-29 suzuki toshiya - - * src/base/ftmac.c: Introduction of abstract `short' data types, - ResFileRefNum and ResID. These types were introduced for Copland, - then backported to MPW. The variables exchanged with FileManager - QuickDraw frameworks are redefined by these data types. Patch was - proposed by Sean McBride. - * builds/mac/ftmac.c: Ditto. - -2007-08-18 Werner Lemberg - - * src/otvalid/otvcmmn.c (otv_x_y_ux_sy): Skip context glyphs. Found - by Imran Yousaf. Fixes Savannah bug #20773. - - (otv_Lookup_validate): Correct handling of LookupType. Found by - Imran Yousaf. Fixes Savannah bug #20782. - -2007-08-17 George Williams - - * src/otvalid/otvgsub.c (otv_SingleSubst_validate): Fix handling of - SingleSubstFormat1. - -2007-08-11 suzuki toshiya - - * builds/unix/configure.raw: Fix a bug which sets CC_BUILD by - ${build-gcc} (unchecked) instead of by ${build}-gcc (checked). - Found by Ryan Hill. - -2007-08-11 George Williams - - * src/otvalid/otvcommn.c, src/otvalid/otvcommn.h - (otv_Coverage_validate): Add fourth argument to pass an expected - count value. Update all users. - Check glyph IDs. - (otv_ClassDef_validate): Check `StartGlyph'. - - * src/otvalid/otvgsub.c (otv_SingleSubst_validate): More glyph ID - checks. - - * src/otvalid/otvmath.c (otv_MathConstants_validate): There are only - 56 constants. - (otv_GlyphAssembly_validate, otv_MathGlyphConstruction_validate): - Check glyph IDs. - -2007-08-08 Werner Lemberg - - * src/otvalid/otvbase.c, src/otvalid/otvcommn.c, - src/otvalid/otvgdef.c, src/otvalid/otvgpos.c, src/otvalid/otvgsub.c, - src/otvalid/otvjstf.c: s/FT_INVALID_DATA/FT_INVALID_FORMAT/ where - appropriate. Reported by George. - - * include/freetype/internal/fttrace.h: Define `trace_otvmath'. - - * src/otvalid/rules.mk (OTV_DRV_SRC): Add otvmath.c. - - * docs/CHANGES: Updated. - -2007-08-08 George Williams - - Add `MATH' validating support to otvalid module. - - * include/freetype/tttags.h (TTAG_MATH): New macro. - * include/freetype/ftotval.h (FT_VALIDATE_MATH): New macro. - (FT_VALIDATE_OT): Updated. - - * src/otvalid/otmath.c: New file. - - * src/otvalid/otvalid.c: Include otvmath.c. - * src/otvalid/otvmod.c (otv_validate): Handle `MATH' table. - -2007-08-04 Werner Lemberg - - * builds/unix/configure.raw: Add call to AC_LIBTOOL_WIN32_DLL. - Fixes Savannah bug #20686. - -2007-08-03 Werner Lemberg - - * src/psnames/psmodule.c: Fix usage of - FT_CONFIG_OPTION_POSTSCRIPT_NAMES macro. Reported by Graham Asher. - -2007-07-31 suzuki toshiya - - * src/base/ftmac.c (open_face_from_buffer): The argument - `driver_name' is typed as `const char*' to match with the - callers in FT_New_Face_From_LWFN and FT_New_Face_From_SFNT. - This is same with open_face_from_buffer in src/base/ftobjs.c. - Found and fixed by Sean McBride. - -2007-07-28 Werner Lemberg - - * src/raster/ftraster.c (count_table): Make it conditional. - * src/base/ftobjs.c (FT_New_Library): Check FT_RENDER_POOL_SIZE with - a preprocessor statement. - -2007-07-27 Werner Lemberg - - * src/base/ftoutln.c (FT_Outline_Translate): Check `outline' before - first usage. From Savannah patch #6115. - -2007-07-16 Werner Lemberg - - * docs/CHANGES: Updated. - -2007-07-16 Derek Clegg - - Add new service for getting the ROS from a CID font. - - * include/freetype/config/ftheader.h (FT_CID_H): New macro. - * include/freetype/ftcid.h: New file. - - * include/freetype/internal/ftserv.h (FT_SERVIVE_CID_H): New macro. - * include/freetype/internal/services/svcid.h: New file. - - * src/base/ftcid.c: New file. - - * src/cff/cffdrivr.c: Include FT_SERVICE_CID_H. - (cff_get_ros): New function. - (cff_service_cid_info): New service structure. - (cff_services): Register it. - - * src/cff/cffload.c (cff_font_done): Free registry and ordering. - - * src/cff/cfftypes.h (CFF_FontRec): Add `registry' and `ordering'. - - * modules.cfg (BASE_EXTENSIONS): Add ftcid.c. - -2007-07-11 Derek Clegg - - Add support for postscript name service to CFF driver. - - * src/cff/cffdrivr.c: Include FT_SERVICE_POSTSCRIPT_NAME_H. - (cff_get_ps_name): New function. - (cff_service_ps_name): New service structure. - (cff_services): Register it. - -2007-07-07 Werner Lemberg - - * src/base/ftglyph.c (FT_Glyph_Copy): Fix initialization of - `target'. Reported by Sean McBride. - -2007-07-06 Werner Lemberg - - * src/pfr/pfrcmap.c: Include pfrerror.h. - - * src/autofit/afindic.c: Add some external declarations to pacify - `make multi' compilation. - - * src/cid/cidgload.c (cid_load_glyph): Pacify compiler. - - * src/cff/cffdrivr.c (cff_ps_get_font_info), src/cff/cffobjs.c - (cff_strcpy), include/freetype/internal/ftmemory.h (FT_MEM_STRDUP), - src/autofit/aflatin.c (af_latin_hints_compute_edges), - src/autofit/afcjk.c (af_cjk_hints_compute_edges), src/sfnt/ttmtx.c - (tt_face_get_metrics), src/base/ftobjs.c (open_face) - [FT_CONFIG_OPTION_INCREMENTAL]: Fix compilation with C++ compiler. - - * docs/release: Mention test compilation targets. - -2007-07-04 Werner Lemberg - - * docs/PROBLEMS: Mention that some PS based fonts can't be - handled correctly by FreeType. - - * src/truetype/ttgload.c (load_truetype_glyph): Always allow a - recursion depth of 1. This was the maximum value in TrueType 1.0, - and some older fonts don't set this field correctly. - - * src/gxvalid/gxvmort1.c - (gxv_mort_subtable_type1_substTable_validate): Fix tracing message. - -2007-07-03 Werner Lemberg - - * src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize - `round' to pacify compiler. - -2007-07-02 Werner Lemberg - - - * Version 2.3.5 released. - ========================= - - - Tag sources with `VER-2-3-5'. - - * docs/CHANGES, docs/VERSION.DLL: Update documentation and bump - version number to 2.3.5. - - * README, Jamfile (RefDoc), builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, - builds/win32/visualce/index.html, - builds/win32/visualce/freetype.dsp, - builds/win32/visualce/freetype.vcproj: s/2.3.4/2.3.5/, s/234/235/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 5. - - * builds/unix/configure.raw (version_info): Set to 9:16:3. - -2007-07-01 David Turner - - * include/freetype/freetype.h, src/base/ftpatent.c - (FT_Face_SetUnpatentedHinting): New function to dynamically change - the setting after a face is created. - - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Fix a small bug - that created distortions in the bytecode interpreter results. - -2007-06-30 David Turner - - * src/truetype/ttinterp.c (Ins_IUP): Add missing variable - initialization. - - * src/autofit/aflatin.c (af_latin_metric_init_blues): Get rid of an - infinite loop in the case of degenerate fonts. - -2007-06-26 Rahul Bhalerao - - Add autofit module for Indic scripts. This currently just reuses - the CJK-specific functions. - - * include/freetype/config/ftoption.h (AF_CONFIG_OPTION_INDIC): New - macro. - * devel/ftoption.h: Synchronize with - include/freetype/config/ftoption.h. - - * src/autofit/afindic.c, src/autofit/afindic.h: New files. - - * src/autofit/afglobal.c, src/autofit/aftypes.h, - src/autofit/autofit.c: Updated. - - * src/autofit/Jamfile (_sources), * src/autofit/rules.mk - (AUTOF_DRV_SRC): Updated. - -2007-06-23 David Turner - - * src/truetype/ttgload.c (TT_Load_Simple): Fix change from - 2007-06-16 that prevented the TrueType module from loading most - glyphs. - -2007-06-20 Werner Lemberg - - * src/cff/cffgload.c (cff_slot_load): Fix logic of 2007-05-28 - change. - -2007-06-19 Werner Lemberg - - * src/type1/t1load.c (parse_encoding): Handle one more error. - -2007-06-19 Dmitry Timoshkov - - * src/winfonts/winfnt.c (fnt_face_get_dll_font): Return error - FNT_Err_Invalid_File_Format if file format was recognized but - the file doesn't contain any FNT(NE) or RT_FONT(PE) resources. - Add verbose debug logs to make it easier to debug failing load - attempts. - (FNT_Face_Init): A single FNT font can't contain more than 1 face, - so return an error if requested face index is > 0. - Do not do further attempt to load fonts if a previous attempt has - failed but returned error FNT_Err_Invalid_File_Format, i.e., the - file format has been recognized but no fonts found in the file. - -2007-07-19 suzuki toshiya - - * src/base/ftmac.c: Apply patches proposed by Sean McBride. - (FT_GetFile_From_Mac_Name): Insert FT_UNUSED macros to fix - the compiler warnings against unused arguments. - (FT_ATSFontGetFileReference): Ditto. - (FT_GetFile_From_Mac_ATS_Name): Ditto. - (FT_New_Face_From_FSSpec): Ditto. - (lookup_lwfn_by_fond): Fix wrong comment. - Replace `const StringPtr' by more appropriate type - `ConstStr255Param'. - FSRefMakePathPath always returns UTF8 POSIX pathname in - Mach-O, thus HFS pathname support is dropped. - (count_faces): Remove HLock and HUnlock which is not - required on Mac OS X anymore. - (FT_New_Face_From_SFNT): Ditto. - (FT_New_Face_From_FOND): Ditto. - * builds/mac/ftmac.c: Synchronize to src/base/ftmac.c, - except of HFS pathname support and HLock/HUnlock. - They are required on classic CFM environment. - -2007-06-18 Werner Lemberg - - * src/psaux/psobjs.c (ps_parser_skip_PS_token): Remove incorrect - assertion. - (ps_parser_to_bytes): Fix error message. - - * src/type42/t42objs.c (T42_Open_Face): Handle one more error. - * src/type42/t42parse.c (t42_parse_sfnts): s/alloc/allocated/. - Don't allow mixed binary and hex strings. - Handle string_size == 0 and string_buf == 0. - (t42_parse_encoding): Handle one more error. - -2007-06-18 Werner Lemberg - - * src/psaux/psobjs.c (ps_tofixedarray, ps_tocoordarray): Fix exit - logic. - (ps_parser_load_field) : Skip delimiters - correctly. - (ps_parser_load_field_table): Use `fields->array_max' instead of - T1_MAX_TABLE_ELEMENTS to limit the number of arguments. - - * src/cff/cffgload.c (cff_decoder_prepare): Fix change from - 2007-06-06. - -2007-06-17 Werner Lemberg - - * src/tools/ftrandom.c (font_size): New global variable. - (TestFace): Use it. - (main): Handle new option `--size' to set `font_size'. - (Usage): Updated. - - * src/winfonts/winfnt.c (fnt_face_get_dll_font): Exit in case of - invalid font. - (FNT_Load_Glyph): Protect against invalid bitmap width. - -2007-06-16 David Turner - - * src/smooth/ftgrays.c (gray_find_cell, gray_set_cell, gray_hline): - Prevent integer overflows when rendering very large outlines. - - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check the - well-formedness of the contours array when loading a glyph. - - * src/truetype/ttinterp.c (TT_Load_Context): Initialize `zp0', `zp1', - and `zp2'. - (Ins_IP): Check argument ranges to reject bogus operations properly. - (IUP_WorkerRec): Add `max_points' member. - (_iup_worker_interpolate): Check argument ranges. - (Ins_IUP): Ignore empty outlines. - -2007-06-16 Dmitry Timoshkov - - * src/winfonts/winfnt.h: Add necessary structures for PE resource - parsing. - (WinPE32_HeaderRec): New structure. - (WinPE32_SectionRec): New structure. - (WinPE_RsrcDirRec): New structure. - (WinPE_RsrcDirEntryRec): New structure. - (WinPE_RsrcDataEntryRec): New structure. - (FNT_FontRec): Remove unused `size_shift' field. - - * src/winfonts/winfnt.c (fnt_face_get_dll_font): Add support for - loading bitmap .fon files in PE format. - -2007-06-15 Dmitry Timoshkov - - * builds/win32/ftdebug.c: Unify debug level handling with other - platforms. - -2007-06-14 Dmitry Timoshkov - - * builds/win32/ftdebug.c (FT_Message): Send debug output to the - console as well as to the debugger. - -2007-06-14 Werner Lemberg - - * src/autofit/aflatin.c (af_latin_uniranges): Expand structure to - cover all ranges which could possibly be handled by the aflatin - module (since the default fallback for unknown ranges is now the - afcjk module). It might be necessary to fine-tune this further by - splitting off modules for Greek, Cyrillic, or other blocks. - -2007-06-11 David Turner - - * src/autofit/aflatin.c (af_latin_hints_link_segments): Fix - incorrect segment linking computation. This was the root cause of - Savannah bug #19565. - - - * src/autofit/* [FT_OPTION_AUTOFIT2]: Some very experimental changes - to improve the Latin auto-hinter. Note that the new code is - disabled by default since it is not stabilized yet. - - * src/autofit/aflatin2.c, src/autofit/aflatin2.h: New files - (disabled currently). - - * src/autofit/afhints.c: Remove dead code. - (af_axis_hints_new_edge): Add argument to handle segment directions. - (af_edge_flags_to_string): New function. - (af_glyph_hints_dump_segments, af_glyph_hints_dump_edges): Handle - option flags. - (af_glyph_hints_reload): Add argument to handle inflections. - Simplify. - (af_direction_compute): Fine tuning. - (af_glyph_hints_align_edge_points): Fix logic. - (af_glyph_hints_align_strong_points): Do linear search for small - edge counts. - (af_glyph_hints_align_weak_points): Skip any touched neighbors. - (af_iup_shift): Handle zero `delta'. - - * src/autofit/afhints.h: Updated. - (AF_SORT_SEGMENTS): New macro (disabled). - (AF_AxisHintsRec) [AF_SORT_SEGMENTS]: New member `mid_segments'. - - * src/autofit/afglobal.c (af_face_globals_get_metrics): Add - argument to pass option flags for handling scripts. - * src/autofit/afglobal.h: Updated. - - * src/autofit/afcjk.c: Updated. - * src/autofit/aflatin.c: Updated. - (af_latin_metrics_scale_dim): Don't reduce scale by 2%. - - (af_latin_hints_compute_segments) [AF_HINT_METRICS]: Remove dead code. - (af_latin_hints_compute_edges) [AF_HINT_METRICS]: Remove dead code. - Don't set `edge->dir' - (af_latin_hint_edges): Add more logging. - - * src/autofit/afloader.c: Updated. - -2007-06-11 Werner Lemberg - - * docs/CHANGES: Document FT_Face_CheckTrueTypePatents. - -2007-06-10 David Turner - - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Slight speed-up to - the TrueType glyph loader. - - * include/freetype/config/ftoption.h: Clarify documentation - regarding unpatented hinting. - - - Add new `FT_Face_CheckTrueTypePatents' API. - - * include/freetype/freetype.h (FT_Face_CheckTrueTypePatents): New - declaration. - - * include/freetype/internal/services/svttglyf.h, - src/base/ftpatent.c: New files. - - * include/freetype/internal/ftserv.h (FT_SERVICE_TRUETYPE_GLYF_H): - New macro. - - * src/truetype/ttdriver.c: Include FT_SERVICE_TRUETYPE_GLYF_H and - `ttpload.h'. - (tt_service_truetype_glyf): New service structure. - (tt_services): Register it. - - * modules.cfg (BASE_EXTENSIONS), src/base/Jamfile (_sources): Add - `ftpatent.c'. - -2007-06-08 Werner Lemberg - - * src/sfnt/sfobjs.c (sfnt_load_face): Undo change from 2007-04-28. - Fonts without a cmap must be handled correctly by FreeType (anything - else would be a bug). - - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings) - [FT_DEBUG_LEVEL_TRACE]: Improve tracing message. - -2007-06-07 Werner Lemberg - - * src/sfnt/ttsbit0.c (tt_sbit_decoder_init, - tt_sbit_decoder_load_image): Protect against integer overflows. - - - * src/pfr/pfrgload.c (pfr_glyph_load_simple): More bounding checks - for `x_control' and `y_control'. - -2007-06-06 Werner Lemberg - - * src/base/ftoutln.c (FT_Outline_Decompose): Check `last'. - - - * src/pfr/pfrcmap.c (pfr_cmap_init): Convert assertion into normal - FreeType error. - - - * src/winfonts/winfnt.c (fnt_face_get_dll_font): Do a rough check of - `font_count'. - - - * src/type1/t1load.c (parse_font_matrix): Check `temp_scale'. - - - * src/cff/cffgload.c (cff_decoder_prepare): Change return type to - `FT_Error'. - Check `fd_index'. - (cff_slot_load): Updated. - * src/cff/cffgload.h: Updated. - -2007-06-05 Werner Lemberg - - * src/pfr/pfrgload.c (pfr_glyph_done): Comment out unused code. - (pfr_glyph_load_simple): Convert assertion into normal FreeType - error. - Check `idx'. - (pfr_glyph_load_compound, pfr_glyph_curve_to, pfr_glyph_line_to): - Convert assertion into normal FreeType error. - - * src/pfr/pfrtypes.h (PFR_GlyphRec): Comment out unused code. - - - * src/winfonts/winfnt.c (FNT_Face_Init): Check `family_size'. - - - * src/psaux/psobjs.c (ps_tocoordarray, ps_tofixedarray): Return -1 - in case of parsing error. - (ps_parser_load_field): Updated. - - * src/type1/t1load.c (parse_font_matrix): Updated. - -2007-06-04 Werner Lemberg - - * src/cid/cidgload.c (cid_load_glyph): Check `fd_select'. - - * src/tools/ftrandom/Makefile: Depend on `libfreetype.a'. - -2007-06-03 Werner Lemberg - - * src/tools/ftrandom/*: Add the `ftrandom' test program written by - George Williams (with some modifications). - -2007-06-03 Werner Lemberg - - * src/base/ftobjs.c (destroy_charmaps), src/type1/t1objs.c - (T1_Face_Done), src/winfonts/winfnt.c (FNT_Face_Done): Check for - face == NULL. Suggested by Graham Asher. - -2007-06-03 Ismail Dönmez - - * src/base/ftobjs.c (FT_Request_Metrics): Fix compiler warning. - -2007-06-02 Werner Lemberg - - * include/freetype/fterrdef.h (FT_Err_Corrupted_Font_Header, - FT_Err_Corrupted_Font_Glyphs): New error codes for BDF files. - - * src/bdf/bdflib.c (bdf_load_font): Use them. - - * src/bdf/bdflib.c (_bdf_parse_start): Check `FONT' better. - -2007-06-01 Werner Lemberg - - * src/base/ftobjs.c (FT_Request_Metrics), src/cache/ftccmap.c - (FTC_CMapCache_Lookup): Remove unused code. - -2007-06-01 Sean McBride - - * src/truetype/ttinterp.c (Null_Vector, NULL_Vector): Removed, - unused. - -2007-06-01 Werner Lemberg - - * src/cid/cidparse.c (cid_parser_new): Don't continue second search - pass for `StartData' if an error has occurred. - Exit properly if no `StartData' has been seen at all. - - * builds/unix/ftsystem.c (FT_Stream_Open): Don't use ULONG_MAX but - LONG_MAX to avoid compiler warning. Suggested by Sean McBride. - -2007-05-30 Werner Lemberg - - * src/type1/t1load.c (parse_subrs, parse_charstrings): Protect - against too small binary data strings. - - * src/bdf/bdflib.c (_bdf_parse_glyphs): Check `STARTCHAR' better. - -2007-05-28 David Turner - - * src/cff/cffgload.c (cff_slot_load): Do not apply the identity - transformation. This significantly reduces the loading time of CFF - glyphs. - - * docs/CHANGES: Updated. - - * src/autofit/afglobal.c (AF_SCRIPT_LIST_DEFAULT): Change default - hinting script to CJK, since it works well with more scripts than - latin. Thanks to Rahul Bhalerao for pointing - this out! - -2007-05-25 Werner Lemberg - - * docs/CHANGES: Updated. - -2007-05-24 Werner Lemberg - - * src/truetype/ttobjs.h (tt_size_ready_bytecode): Move declaration - into TT_USE_BYTECODE_INTERPRETER preprocessor block. - -2007-05-24 Graham Asher - - * src/truetype/ttobjs.c (tt_size_ready_bytecode) - [!TT_USE_BYTECODE_INTERPRETER]: Removed. Unused. - -2007-05-22 David Turner - - * src/truetype/ttgload.c (load_truetype_glyph): Fix last change to - avoid crashes in case the bytecode interpreter is not used. - - - Avoid heap blowup with very large .Z font files. This fixes - Savannah bug #19910. - - * src/lzw/ftzopen.h (FT_LzwStateRec): Remove `in_cursor', - `in_limit', `pad', `pad_bits', and `in_buff' members. - Add `buf_tab', `buf_offset', `buf_size', `buf_clear', and - `buf_total' members. - - * src/lzw/ftzopen.c (ft_lzwstate_get_code): Rewritten. It now takes - only one argument. - (ft_lzwstate_refill, ft_lzwstate_reset, ft_lzwstate_io): Updated. - -2007-05-20 Ismail Dönmez - - * src/pshinter/pshrec.c (ps_mask_table_set_bits): Add `const'. - (ps_dimension_set_mask_bits): Remove `const'. - -2007-05-19 Werner Lemberg - - * src/sfnt/ttmtx.c (tt_face_get_metrics) - [!FT_CONFIG_OPTION_OLD_INTERNALS]: Another type-punning fix. - -2007-05-19 Derek Clegg - - Savannah patch #5929. - - * include/freetype/tttables.h, src/base/ftobjcs.c - (FT_Get_CMap_Format): New function. - - * include/freetype/internal/services/svttcmap.c (TT_CMapInfo): Add - `format' member. - * src/sfnt/ttcmap.c (tt_cmap{0,2,4,6,8,10,12}_get_info): Set - cmap_info->format. - -2007-05-19 Werner Lemberg - - * src/truetype/ttgload.c (load_truetype_glyph): Save graphics state - before handling subglyphs so that it can be reinitialized each time. - This fixes Savannah bug #19859. - -2007-05-16 Werner Lemberg - - * src/cache/ftccache.c (ftc_node_mru_link, ftc_node_mru_unlink), - src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP), src/cache/ftcglyph.h - (FTC_GCACHE_LOOKUP_CMP), src/pshinter/pshmod.c (ps_hinter_init), - src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_load_hhea, - tt_face_get_metrics): Fix type-punning issues. - -2007-05-15 David Turner - - * include/freetype/config/ftstdlib.h, - include/freetype/internal/ftobjs.h: As suggested by Graham Asher, - ensure that ft_isalnum, ft_isdigit, etc., use hard-coded values - instead on relying on the locale-dependent functions provided by - . - -2007-05-15 Graham Asher - - * src/autofit/afcjk.c (af_cjk_hints_compute_edges): Remove unused - variable. - * src/autofit/afloader.c (af_loader_load_g): Ditto. - - * src/base/ftobjs.c (ft_validator_error): Use `ft_jmp_buf'. - (open_face_from_buffer): Initialize `stream'. - (FT_Request_Metrics): Remove unused variable. - Remove redundant `break' statements. - (FT_Get_Track_Kerning): Remove unused variable. - - * src/psaux/afmparse.c (afm_parse_track_kern, afm_parse_kern_pairs, - afm_parse_kern_data): Remove redundant - `break' statements. - (afm_parser_parse): Ditto. - Don't use uninitialized variables. - - * src/psnames/psmodule.c (VARIANT_BIT): Define as unsigned long. - Use `|' operator instead of `^' to set it. - Update all users. - - * src/sfnt/ttcmap.c (tt_face_build_cmaps): Use `ft_jmp_buf'. - * src/sfnt/ttkern.c (tt_face_load_kern): Remove unused variable. - - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Remove redundant - comparison. - (TT_Process_Simple_Glyph): Use FT_UInt for `n_points' and `i'. - (TT_Load_Glyph): Remove unused variable. - -2007-05-13 Derek Clegg - - * src/base/ftobjs.c (FT_New_Library): Only allocate rendering pool - if FT_RENDER_POOL_SIZE is > 0. From Savannah patch #5928. - -2007-05-11 David Turner - - * src/cache/ftbasic.c, include/freetype/ftcache.h - (FTC_ImageCache_LookupScaler, FTC_SBit_Cache_LookupScaler): Two new - functions that allow us to look up glyphs using an FTC_Scaler object - to specify the size, making it possible to use fractional pixel - sizes. - - * src/truetype/ttobjs.c (tt_size_ready_bytecode): Set - `size->cvt_ready'. Reported by Boris Letocha. - -2007-05-09 Graham Asher - - * src/truetype/ttinterp.c (Ins_IP), src/autofit/aflatin.c - (af_latin_metrics_scale_dim): Fix compiler warnings. - -2007-05-06 Werner Lemberg - - * builds/win32/visualce/freetype.sln: Removed, as requested by - Vincent. - -2007-05-04 Vincent RICHOMME - - * builds/win32/visualce/*: Add Visual C++ project files for Pocket - PC targets. - - * docs/CHANGES: Document them. - -2007-05-04 - - * builds/unix/ftsystem.c (FT_Stream_Open): Handle return value 0 of - mmap (which might happen on some RTOS). From Savannah patch #5909. - -2007-05-03 Werner Lemberg - - * src/base/ftobjs.c (FT_Set_Char_Size): Simplify code. - * include/freetype/freetype.h (FT_Set_Char_Size): Update - documentation. - -2007-04-28 Victor Stinner - - * src/sfnt/sfobjs.c (sfnt_load_face): Check error code after loading - `cmap'. - -2007-04-27 Werner Lemberg - - * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check for negative - number of points in contours. Problem reported by Victor Stinner - . - (TT_Process_Simple_Glyph): Synchronize variable types. - -2007-04-26 Werner Lemberg - - * src/base/ftglyph.c (FT_Glyph_Copy): Always set second argument to - zero in case of error. This fixes Savannah bug #19689. - -2007-04-25 Boris Letocha - - * src/truetype/ttobjs.c: Fix a typo that created a speed regression - in the TrueType bytecode loader. - -2007-04-10 Martin Horak - - * src/sfnt/sfobjs.c (sfnt_load_face) [FT_CONFIG_OPTION_INCREMENTAL]: - Ignore `hhea' table. This fixes Savannah bug #19261. - -2007-04-09 Werner Lemberg - - - * Version 2.3.4 released. - ========================= - - - Tag sources with `VER-2-3-4'. - - * docs/CHANGES, docs/VERSION.DLL: Update documentation and bump - version number to 2.3.4. - - * README, Jamfile (RefDoc), builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj: s/2.3.3/2.3.4/, s/233/234/. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 4. - - * builds/unix/configure.raw (version_info): Set to 9:15:3. - -2007-04-09 Martin Horak - - * src/truetype/ttgload.c (load_truetype_glyph): Save and restore - memory stream to avoid a crash with the incremental memory - interface (Savannah bug #19260). - -2007-04-06 David Turner - - * src/base/ftbimap.c (ft_bitmap_assure_buffer): Fix buffer-overwrite bug - (Savannah bug #19536). - -2007-04-04 Werner Lemberg - - - * Version 2.3.3 released. - ========================= - - - Tag sources with `VER-2-3-3'. - - * docs/CHANGES: Mention CVE-2007-1351. - -2007-04-03 David Turner - - * src/base/ftobjs.c (FT_Set_Char_Size): As suggested by James Cloos, - if one of the resolution values is 0, treat it as if it were the - same as the other value. - -2007-04-02 David Turner - - Add special code to detect `extra-light' fonts and do not snap their - stem widths too much to avoid bizarre hinting effects. - - * src/autofit/aflatin.h (AF_LatinAxisRec): Add `standard_width' and - `extra_light' members. - - * src/autofit/aflatin.c (af_latin_metrics_init_widths): Initialize - them. - (af_latin_metrics_scale_dim): Set `extra_light'. - (af_latin_compute_stem_width): Use `extra_light'. - -2007-03-28 David Turner - - * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Fix zero-ing of the - padding. - -2007-03-28 Werner Lemberg - - * src/bdf/bdflib.c (setsbit, sbitset): Handle values >= 128 - gracefully. - (_bdf_set_default_spacing): Increase `name' buffer size to 256 and - issue an error for longer names. This fixes CVE-2007-1351. - (_bdf_parse_glyphs): Limit allowed number of glyphs in font to the - number of code points in Unicode. - - * builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, README: s/2.3.2/2.3.3/, - s/232/233/. - - * docs/CHANGES: Mention ftdiff. - -2007-03-26 David Turner - - * src/truetype/ttinterp.c [FIX_BYTECODE]: Remove it and - corresponding code. - (Ins_MD): Last regression fix. - - * src/autofit/aflatin.c (af_latin_metrics_init_blues): Fix blues - computations in order to ignore single-point contours. These are - never rasterized and correspond in certain fonts to mark-attach - points that are very far from the glyph's real outline, ruining the - computation. - - * src/autofit/afloader.c (af_loader_load_g): In the case of - monospaced fonts, always set `rsb_delta' and `lsb_delta' to 0. - Otherwise code that uses them will most certainly ruin the fixed - advance property. - - * docs/CHANGES, docs/VERSION.DLL, README, Jamfile (RefDoc): Update - documentation and bump version number to 2.3.3. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 3. - - * builds/unix/configure.raw (version_info): Set to 9:14:3. - -2007-03-26 suzuki toshiya - - * builds/unix/ftconfig.in: Disable Carbon framework dependency on - 64bit ABI on Mac OS X 10.4.x (ppc & i386). Found by Sean McBride. - * builds/vms/ftconfig.h: Ditto. - * include/freetype/config/ftconfig.h: Ditto. - -2007-03-22 suzuki toshiya - - * builds/unix/ftsystem.c (FT_Stream_Open): Temporary fix to prevent - 32bit unsigned long overflow by 64bit filesize on LP64 platform, as - proposed by Sean McBride: - http://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html - -2007-03-22 suzuki toshiya - - * builds/unix/ftconfig.in: Suppress SGI compiler's warning against - setjmp, proposed by Sean McBride: - http://lists.gnu.org/archive/html/freetype-devel/2007-03/msg00032.html - -2007-03-19 suzuki toshiya - - * builds/unix/configure.raw: Dequote `OS_INLINE' in comment of - conftest.c, to avoid unexpected shell evaluation. Possibly it is a - bug or undocumented behaviour of autoconf. - -2007-03-18 David Turner - - * src/truetype/ttinterp.c (Ins_MDRP): Another bytecode regression - fix; testing still needed. - - * src/truetype/ttinterp.c (Ins_MD): Another bytecode regression fix. - -2007-03-17 David Turner - - * src/truetype/ttinterp.c (Ins_IP): Fix wrong handling of the - (undocumented) twilight zone special case. - -2007-03-09 Werner Lemberg - - - * Version 2.3.2 released. - ========================= - - - Tag sources with `VER-2-3-2'. - - * builds/win32/visualc/index.html, - builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, README: s/2.3.1/2.3.2/, - s/231/232/. - -2007-03-08 David Turner - - * docs/CHANGES, docs/VERSION.DLL: Updated for upcoming release. - - * builds/unix/configure.raw (version_info): Set to 9:13:3. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 2. - - * README, Jamfile (RefDoc): s/2.3.1/2.3.2/. - - * src/base/ftutil.c (ft_mem_strcpyn): Fix a bug that prevented the - function to work properly, over-writing user-provided buffers in - some cases. Reported by James Cloos . - - -2007-03-05 Werner Lemberg - - * include/freetype/config/ftstdlib.h (ft_strstr): New wrapper - macro for `strstr'. - - * src/truetype/ttobjs.c (tt_face_init): Use ft_strstr for scanning - `trick_names', as suggested by Ivan Nincic. - -2007-03-05 David Turner - - * src/base/ftinit.c (FT_Init_FreeType): Fix a small memory leak in - case FT_Init_FreeType fails for some reason. Problem reported by - Maximilian Schwerin . - - * src/truetype/ttobs.c (tt_size_init_bytecode): Clear the `x_ppem' - and `y_ppem' fields of the `TT_Size.metrics' structure, not those of - `TT_Size.root.metrics'. Problem reported by Daniel Glöckner - . - - * src/type1/t1afm.c (T1_Read_PFM): Read kerning values as 16-bit - signed values, not unsigned ones. Problem reported by Johannes - Walther . - -2007-02-21 David Turner - - * src/pshinter/pshalgo.c (psh_hint_align): Fix a bug in the hinting - of small and ghost stems in the Postscript interpreter. - -2007-02-20 suzuki toshiya - - * src/base/ftmac.c (FT_GetFileRef_From_Mac_ATS_Name): Fix memory - leak, patch by "Jjgod Jiang" . - * builds/mac/ftmac.c (FT_GetFileRef_From_Mac_ATS_Name): Ditto. - -2007-02-16 Werner Lemberg - - * src/truetype/ttinterp.c (Ins_MD): Remove unused variable. - * src/autofit/aflatin.c (af_latin_hints_link_segments): Ditto. - -2007-02-14 David Turner - - It seems that the following changes fix most of the known - interpreter problems with my fonts, but more testing is needed, - though. - - * src/truetype/ttinterp.c (FIX_BYTECODE): Activate. - (TT_MulFix14): Rewrite. - (Ins_MD, Ins_MDRP, Ins_IP) [FIX_BYTECODE]: Improved and updated. - (Ins_MIRP): Ditto. - -2007-02-12 Werner Lemberg - - * src/truetype/ttinterp.c (Project_x, Project_y): Remove compiler - warnings. - - * src/pcf/pcfread.c (pcf_interpret_style), src/bdf/bdfdrivr.c - (bdf_interpret_style): Ditto. - -2007-02-12 David Turner - - Simplify projection and dual-projection code interface. - - * src/truetype/ttinterp.h (TT_Project_Func): Use `FT_Pos', not - FT_Vector' as argument type. - * src/truetype/ttinterp.c (CUR_Func_project, CUR_Func_dualproj): - Updated. - (CUR_fast_project, CUR_fast_dualproj): New macros. - (Project, Dual_Project, Project_x, Project_y): Updated. - (Ins_GC, Ins_SCFS, Ins_MDAP, Ins_MIAP, Ins_IP): Use new `fast' - macros. - - - * src/autofit/afloader.c (af_loader_load_g): Improve spacing - adjustments for the non-light auto-hinted modes. Gets rid of - `inter-letter spacing is too wide' problems. - - * src/autofit/aflatin.c (af_latin_hints_link_segments, - af_latin_hints_compute_edges): Slight optimization of the segment - linker and better handling of serif segments to get rid of broken - `9' in Arial at 9pt (96dpi). - - - Introduce new string functions and the corresponding macros to get - rid of various uses of strcpy and other `evil' functions, as well as - to simplify a few things. - - * include/freetype/internal/ftmemory.h (ft_mem_strdup, ft_mem_dup, - ft_mem_strcpyn): New declarations. - (FT_MEM_STRDUP, FT_STRDUP, FT_MEM_DUP, FT_DUP, FT_STRCPYN): New - macros. - * src/base/ftutil.c (ft_mem_dup, ft_mem_strdup, ft_mem_strcpyn): New - functions. - - * src/bfd/bfddrivr.c (bdf_interpret_style, BDF_Face_Init), - src/bdf/bdflib.c (_bdf_add_property), src/pcf/pcfread.c - (pcf_get_properties, pcf_interpret_style, pcf_load_font), - src/cff/cffdrivr.c (cff_get_glyph_name), src/cff/cffload.c - (cff_index_get_sid_string), src/cff/cffobjs.c (cff_strcpy), - src/sfnt/sfdriver.c (sfnt_get_glyph_name), src/type1/t1driver.c - (t1_get_glyph_name), src/type42/t42drivr.c (t42_get_glyph_name, - t42_get_name_index): Use new functions and simplify code. - - * builds/mac/ftmac.c (FT_FSPathMakeSpec): Don't use FT_MIN. - -2007-02-11 Werner Lemberg - - * src/autofit/afloader.c (af_loader_load_g): Don't change width for - non-spacing glyphs. - -2007-02-07 Tom Parker - - * src/cff/cffdrivr.c (cff_get_name_index): Protect against NULL - pointer. - -2007-02-05 suzuki toshiya - - * include/freetype/ftmac.h (FT_DEPRECATED_ATTRIBUTE): - Introduce __attribute((deprecated))__ to warn functions - which use non-ANSI data types in its interfaces. - (FT_GetFile_From_Mac_Name): Deprecated, using FSSpec. - (FT_GetFile_From_Mac_ATS_Name): Deprecated, using FSSpec. - (FT_New_Face_From_FSSpec): Deprecated, using FSSpec. - (FT_New_Face_From_FSRef): Deprecated, using FSRef. - - * src/base/ftmac.c: Predefine FT_DEPRECATED_ATTRIBUTE as void - to avoid warning in building FreeType. - * builds/mac/ftmac.c: Ditto. - -2007-02-05 suzuki toshiya - - * src/base/ftbase.c: Fix to use builds/mac/ftmac.c, if configured - `--with-fsspec' etc. Replace #include "ftmac.c" with - #include . - -2007-02-05 suzuki toshiya - - * include/freetype/ftmac.h (FT_GetFilePath_From_Mac_ATS_Name): - Introduced as replacement of FT_GetFile_From_Mac_ATS_Name. - * src/base/ftmac.c (FT_GetFilePath_From_Mac_ATS_Name): Ditto. - (FT_GetFile_From_Mac_ATS_Name): Rewritten as wrapper of - FT_GetFilePath_From_Mac_ATS_Name. - * builds/mac/ftmac.c: Ditto. - -2007-02-05 suzuki toshiya - - * include/freetype/ftmac.h: Fixed wrong comment: FSSpec of - FT_GetFile_From_Mac_Name, FT_GetFile_From_Mac_ATS_Name are - for passing to FT_New_Face_From_FSSpec. - -2007-02-05 suzuki toshiya - - * builds/unix/configure.raw: Check whether Mac OS X system headers - can be built under ANSI C mode. - - * src/base/ftmac.c (OS_INLINE): Redefine OS_INLINE by a version - compatible to ANSI C in case system headers are ANSI C incompatible. - * builds/mac/ftmac.c (OS_INLINE): Ditto. - -2007-02-01 Werner Lemberg - - * include/freetype/ttnameid.h (TT_MS_LANGID_DZONGHKA_BHUTAN): - Explain why applications shouldn't use it. Found by Alexei. - -2007-02-01 Alexei Podtelezhnikov - - * builds/unix/freetype2.m4 (AC_CHECK_FT2): Fix spelling of warning - message. - - * src/gxvalid/gxvmort1.c - (gxv_mort_subtable_type1_substTable_validate): Fix debugging - message. - -2007-01-31 Werner Lemberg - - - * Version 2.3.1 released. - ========================= - - - Tag sources with `VER-2-3-1-FINAL'. - - * builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj: s/230/231/. - * builds/win32/visualc/index.html: s/221/231/. - - * vms_make.com: Add `ftgasp'. - -2007-01-30 David Turner - - Tag sources with VER-2-3-1 to prepare release. - - * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. - - * docs/VERSION.DLL, docs/release, README, Jamfile (RefDoc): - s/2.3.0/2.3.1/. - - * builds/unix/configure.raw (version_info): Set to 9:12:3. - - - * src/autofit/aftypes.h (AF_USE_WARPER), src/autofit/afloader.c - (af_loader_load_g): Disable the warper (i.e., the light hinting - improvements) to make a 2.3.1 bugfix release before introducing a - new feature. This should give us more time to tune and improve the - warper for the next release. - - * docs/CHANGES: Update accordingly. - -2007-01-25 David Turner - - For light auto-hinting, improve glyph advance widths and resurrect - normal/full hinting to its normal quality. - - * src/autofit/afhints.h (AF_GlyphHintsRec): New members `xmin_delta' - and `xmax_delta'. - * src/autofit/afhints.c (af_glyph_hints_reload): Reset `xmin_delta' - and `xmax_delta'. - - * src/autofit/afloader.c (af_loader_load_g) : Replace - preprocessor conditional with if-clause, handling both light and - normal mode. - - * src/autofit/afwarp.c (AF_WarpScore): Fine-tune again. - (af_warper_compute): Handle `xmin_delta' and `xmax_delta'. - -2007-01-25 Werner Lemberg - - * docs/release: Updated -- Savannah uses a new uploading scheme. - -2007-01-25 David Turner - - * src/cff/cffload.c (cff_index_get_pointers): Improve previous fix. - - * src/cff/cffgload.c (cff_decoder_parse_charstrings) - : Fix sanity check for empty - functions. - - * docs/CHANGES: Document light auto-hinting improvement. - -2007-01-25 Werner Lemberg - - * src/cff/cffload.c (cff_index_get_pointers): Handle last entry - correctly in a sanity check. Since this function is only used to - load local and global functions, any charstring that called the last - local/global function would fail otherwise. This fixes Savannah bug - #18867. - - * docs/CHANGES: Document it. - -2007-01-23 David Turner - - * src/truetype/ttobjs.c (tt_size_ready_bytecode): Fix typo that - prevented compilation when disabling both the unpatented and the - bytecode interpreter in the TrueType font driver. - - - Fix and enable the warper to improve `light' hinting mode. This is - not necessarily a final version, but it seems to work well. - - * src/autofit/aflatin.c (af_latin_hints_init) [AF_USE_WARPER]: - Disable code. - (af_latin_hints_apply) [AF_USE_WARPER]: Handle FT_RENDER_MODE_LIGHT. - * src/autofit/aftypes.h: Activate AF_USE_WARPER. - - * src/autofit/afwarp.c (AF_WarpScore): Tune table. - (af_warper_compute_line_best): Fix array size of `scores'. - (af_warper_compute): Better handling of border cases. - * src/autofit/afwarp.h (AF_WarperRec): Remove unused members `X1' - and `X2'. - -2007-01-21 Werner Lemberg - - * ChangeLog: Split off older entries into... - * ChangeLog.22: This new file. - -2007-01-21 Werner Lemberg - - * docs/CHANGES: Document SHZ fix. - -2007-01-21 George Williams - - * src/truetype/ttinterp.c (Ins_SHZ): SHZ doesn't move phantom - points. - -2007-01-21 Werner Lemberg - - * src/sfnt/ttmtx.c (tt_face_get_metrics) - [!FT_CONFIG_OPTION_OLD_INTERNALS]: Fix limit check. - -2007-01-17 Werner Lemberg - - - * Version 2.3.0 released. - ========================= - - - Tag sources with `VER-2-3-0-FINAL'. - -2007-01-17 Werner Lemberg - - * docs/release: Updated. - -2007-01-16 David Turner - - * src/autofit/aflatin.c (af_latin_hints_compute_segments), - src/cff/cffdriver.c (cff_ps_get_font_info), src/truetype/ttobjs.c - (tt_face_init), src/truetype/ttinterp.c (Ins_SHC): Fix compiler - warnings. - -2007-01-15 Detlef Würkner - - * builds/amiga/makefile, builds/amiga/makefile.os4, - builds/amiga/smakefile: Add `ftgasp.c' and `ftlcdfil.c'. - - * builds/amiga/include/freetype/config/ftconfig.h: Synchronize. - -2007-01-14 Detlef Würkner - - Fix various compiler warnings. - - * src/truetype/ttdriver.c (tt_size_select), src/cff/cffobjs.h, - src/cff/cffobjs.c (cff_size_request), src/type42/t42objs.h: - s/index/strike_index/. - * src/base/ftobjs.c (FT_Match_Size): s/index/size_index/. - - * src/gxvalid/gxvmorx5.c - (gxv_morx_subtable_type5_InsertList_validate): s/index/table_index/. - - * src/truetype/ttinterp.c (Compute_Point_Displacement), - src/pcf/pcfread.c (pcf_seek_to_table_type): Avoid possibly - uninitialized variables. - -2007-01-13 suzuki toshiya - - * docs/CHANGES, docs/INSTALL.MAC: Improvements. - -2007-01-13 Werner Lemberg - - * src/type1/t1afm.c (T1_Read_Metrics): MS Windows allows PFM - versions up to 0x3FF without complaining. - -2007-01-13 Derek Clegg - - Add FT_Get_PS_Font_Info interface to CFF driver. - - * src/cff/cfftypes.h: Include FT_TYPE1_TABLES_H. - (CFF_FontRec): Add `font_info' field. - - * src/cff/cffload.c: Include FT_TYPE1_TABLES_H. - (cff_font_done): Free font->font_info if necessary. - - * src/cff/cffdrvr.c (cff_ps_get_font_info): New function. - (cff_service_ps_info): Register cff_ps_get_font_info. - -2007-01-13 Werner Lemberg - - * src/base/ftoutln.c (FT_Outline_Get_Orientation): Fix compilation - with C++ compiler. - - * src/autofit/afhints.c (af_glyph_hints_dump_segments, - af_glyph_hints_dump_edges): Ditto. - - * src/base/rules.mk (BASE_SRC): Remove ftgasp.c (it's already in - `modules.cfg'). - - * src/sfnt/ttsbit0.h: Remove. - - * src/sfnt/rules.mk (SFNT_DRV_SRC): Don't include ttsbit0.c. - -2007-01-12 David Turner - - * src/base/ftbitmap.c (ft_bitmap_assure_buffer): Fix memory stomping - bug in the bitmap emboldener if the pitch of the source bitmap is - much larger than its width. - - * src/truetype/ttinterp.c (Update_Max): Fix aliasing-related - compilation warning. - -2007-01-12 Werner Lemberg - - * builds/unix/install-sh, builds/unix/mkinstalldirs: Updated from - `automake' CVS module from sources.redhat.com. - -2007-01-11 Werner Lemberg - - * src/type1/t1load.c (is_space): Removed. - (parse_encoding, parse_charstrings): Use IS_PS_DELIM. - (parse_charstrings): Use IS_PS_TOKEN. - - - * autogen.sh: Avoid bash specific syntax. - -2007-01-11 David Turner - - * docs/CHANGES: Small update. - - * builds/unix/configure.raw (version_info): Set to 9:11:3. - - * src/base/ftobjs.c (IsMacResource): Fix a small bug that caused a - crash with some Mac OS X .dfont files. Submitted by Masatake - Yamato. - - * autogen.sh: Small fix to get it working on Mac OS X properly: - The issue is that GNU libtool is called `glibtool' on this platform, - and we must call `glibtoolize', since `libtoolize' doesn't exist. - -2007-01-10 David Turner - - * all-sources: Tag all sources with VER-2-3-0-RC1 and - VER-2-3-0. - - * Jamfile (RefDoc), README, builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj, docs/VERSION.DLL: Update - version number to 2.3.0. - - * include/freetype/freetype.h (FREETYPE_MINOR): Set to 3. - (FREETYPE_PATCH): Set to 0. - - * include/freetype/ftchapters.h, include/freetype/ftgasp.h, - include/freetype/ftlcdfil.h: Update reference documentation with - GASP support and LCD filtering sections. - - * src/pshinter/pshalgo.c (psh_glyph_compute_inflections): Fix a typo - which created an endless loop with some malformed font files. - -2007-01-10 Derek Clegg - - * src/type1/t1load.c (T1_Get_MM_Var): Always return fixed point - values. - -2007-01-08 David Turner - - * docs/CHANGES: Updated. - - * include/freetype/ftgasp.h, src/base/ftgasp.c: New files which add - a new API `FT_Get_Gasp' to return entries of the `gasp' table - corresponding to a given character pixel size. - - * src/sfnt/ttload.c (tt_face_load_gasp): Add version check for the - `gasp' table, in order to avoid potential problems with later - versions. - - * include/freetype/config/ftheader.h (FT_GASP_H): New macro for - . - - * src/base/rules.mk (BASE_SRC), src/base/Jamfile (_sources), - modules.cfg (BASE_EXTENSIONS), builds/win32/visualc/freetype.dsp, - builds/win32/visualc/freetype.vcproj: Add src/base/ftgasp.c to the - default build. - -2007-01-07 Werner Lemberg - - * src/cid/cidparse.c (cid_parser_new): Improve error message for - Type 11 fonts. - Scan for `/sfnts' token. - -2007-01-07 Werner Lemberg - - * src/cid/cidparse.c (cid_parser_new): Reject Type 11 fonts. - -2007-01-06 Werner Lemberg - - * src/cff/cffload.c (cff_index_init): Remove unused variable. - (cff_index_read_offset): s/perror/errorp/ to avoid global shadowing. - -2007-01-04 David Turner - - * src/pfr/pfrobjs.c (pfr_face_init): Detect non-scalable fonts - correctly. This fixes Savannah bug #17876. - - - Do not allocate interpreter-specific tables in memory if we are not - going to load glyphs with the bytecode interpreter anyway. - - * src/truetype/ttgload.c (tt_loader_init): Load execution context - only if glyph is hinted. - Updated. - * src/truetype/ttobjs.h (TT_SizeRec): Add members `bytecode_ready' - and `cvs_ready'. - Add `tt_size_ready_bytecode' declaration. - * src/truetype/ttobjs.c (tt_size_done_bytecode, - tt_size_init_bytecode, tt_size_ready_bytecode): New functions. - (tt_size_init): Move most code into `tt_size_init_bytecode'. - (tt_size_done): Move most code into `tt_size_done_bytecode'. - (tt_size_reset): Move some code to `tt_size_ready_bytecode'. - - - Don't extract the metrics table from the SFNT font file. Instead, - reparse it on each glyph load. The runtime difference is not - noticeable, and it can save a lot of heap memory when memory-mapped - files are not used. - - * include/freetype/internal/tttypes.h (TT_FaceRec): Add members - `horz_metrics_offset' and `vert_metrics_ofset'. - * src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_get_metrics): - Updated. - - - * src/sfnt/ttcmap.c (tt_cmap4_validate): Slight optimization. - - - Do not load the CFF index offsets into memory, since this wastes a - *lot* of heap memory with large Asian CFF fonts. There is no - significant performance loss. - - * src/cff/cffload.h: Add `cff_charset_cid_to_gindex' declaration. - * src/cff/cfftypes.h (CFF_IndexRec): Add fields `start' and - `data_size'. - (CFF_CharsetRec): Add field `num_glyphs'. - - * src/cff/cffload.c (cff_index_read_offset, cff_index_load_offsets, - cff_charset_cid_to_gindex): New functions. - (cff_new_index): Renamed to... - (cff_index_init): This. Update all callers. - Updated -- some code has been moved to `cff_index_load_offsets'. - (cff_done_index): Renamed to... - (cff_index_done): This. Update all callers. - (cff_index_get_pointers, cff_index_access_element): Updated to use - stream offsets. - (cff_charset_compute_cids): Set `num_glyphs' field. - (cff_encoding_load): Updated. - - * src/cff/cffgload.c (cff_slot_load): Updated. - -2007-01-04 David Turner - - * docs/INSTALL.UNIX: Simplify some parts, add reference to - autogen.sh and pointer to README.CVS. - - * README.CVS: Add common problem description and solution - when running autogen.sh. - - * docs/INSTALL: Add reference to MacOS X. - - * docs/MAKEPP, docs/INSTALL.MAC: New documentation files. - - * docs/TODO: Remove obsolete items. - - * src/raster/ftraster.c: (TRaster_Instance): Replace it with... - (TWorker): This. - Remove `count_table' and `memory'. - Make `grays' a pointer. - (TRaster): New structure. - (count_table): New static array. - (RAS_ARGS, RAS_ARG, RAS_VARS, RAS_VAR, FT_UNUSED_RASTER, cur_ras, - Vertical_Gray_Sweep_Step, ft_black_new, ft_black_done, - ft_black_set_mode, ft_black_render): Updated. - (ft_black_init): Don't initialize `count_table'. - (ft_black_reset): Use the render pool. This saves about 6KB of - heap space for each FT_Library instance. - - * src/smooth/ftgrays.c (TRaster): Replaced with... - (TWorker): This. - Remove `memory'. - (TRaster): New structure. - - (RAS_ARG_, RAS_ARG, RAS_VAR_, RAS_VAR, ras, gray_render_line, - gray_move_to, gray_line_to, gray_conic_to, gray_cubic_to, - gray_render_span, gray_raster_render): Updated. - (gray_raster_reset): Use the render pool. This saves about 6KB of - heap space for each FT_Library instance. - - * src/sfnt/sfobjs.c, src/sfnt/ttkern.c, src/sfnt/ttkern.h, - src/sfnt/ttmtx.c, src/sfnt/ttsbit.c, src/sfnt/ttsbit.h, - src/truetype/ttpload.c, include/freetype/config/ftoption.h: Remove - FT_OPTIMIZE_MEMORY macro (and code for !FT_OPTIMIZE_MEMORY) since - the optimization is no longer experimental. - - * src/pshinter/pshalgo.c (psh_glyph_interpolate_normal_points): - Remove a typo that results in no hinting and a memory leak with some - large Asian CFF fonts. - - * src/base/ftobjs.c (FT_Done_Library): Remove a subtle memory leak - which happens when FT_Done_Library is called with still opened - CFF_Faces in it. We need to close all faces before destroying the - modules, or else some bad things (memory leaks) may happen. - -2007-01-02 Werner Lemberg - - * src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt0_pairs_validate): - Remove compiler warning. - -2007-01-02 David Turner - - * src/sfnt/sfobjs.c: Add documentation comment. - -2006-12-31 Masatake YAMATO - - * src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt0_pairs_validate): New - function. - Check uniqueness of the gid pairs. - (gxv_kern_subtable_fmt0_validate): Move some code to - `gxv_kern_subtable_fmt0_pairs_validate'. - -2006-12-22 David Turner - - * src/autofit/aflatin.c, src/truetype/ttgload.c: Remove compiler - warnings. - - * builds/win32/visualc/freetype.vcproj: Add _CRT_SECURE_NO_DEPRECATE - to avoid deprecation warnings with Visual C++ 8. - -2006-12-16 Anders Kaseorg - - * src/base/ftlcdfil.c (FT_Library_SetLcdFilter) - [FT_FORCE_LIGHT_LCD_FILTER]: Fix typo. - -2006-12-15 suzuki toshiya - - * include/freetype/internal/services/svotval.h: Add `volatile' to - sync with the modification by Jens Claudius on 2006-08-22; cf. - http://cvs.savannah.gnu.org/viewcvs/freetype/freetype2/src/otvalid/otvmod.c?r1=1.4&r2=1.5 - -2006-12-15 suzuki toshiya - - * src/base/ftmac.c: Specialized for Mac OS X only. - * builds/unix/ftconfig.in: Fixed for ppc64 missing Carbon framework. - * builds/unix/configure.raw: Ditto. When explicit switches for - FSSpec/FSRef/QuickDraw/ATS availability are given to configure, - builds/mac/ftmac.c is used instead of default src/base/ftmac.c. - -2006-12-15 suzuki toshiya - - * builds/mac/ftmac.c: Copied src/base/ftmac.c for legacy system. - * builds/mac/FreeType.m68k_cfm.make.txt: Fix to use builds/mac/ftmac.c - instead of src/base/ftmac.c - * builds/mac/FreeType.ppc_carbon.make.txt: Ditto. - * builds/mac/FreeType.ppc_classic.make.txt: Ditto. - * builds/mac/FreeType.m68k_far.make.txt: Ditto, and exclude gxvalid.c - that cannot be built at present. - -2006-12-15 suzuki toshiya - - * src/base/ftobjs.c: Improvement of resource fork handler for - POSIX, cf. - http://lists.gnu.org/archive/html/freetype-devel/2006-10/msg00025.html - (Mac_Read_sfnt_Resource): Count only `sfnt' resource of suitcase font - format or .dfont, to simulate the face index number counted by ftmac.c. - (IsMacResource): Return the number of scalable faces correctly. - -2006-12-10 Werner Lemberg - - * builds/toplevel.mk (version): Protect against `distclean' target. - -2006-12-09 Werner Lemberg - - * builds/*/*def.mk, builds/*/detect.mk (CAT): Define to either `cat' - or `type'. - - * builds/freetype.mk (version): Extracted from freetype.h, using - GNU make's built-in string functions. - (refdoc): Use $(version) instead of static version number. - -2006-12-08 Werner Lemberg - - * builds/toplevel.mk (dist): Extract version number from freetype.h. - -2006-12-08 Vladimir Volovich - - * src/tools/apinames.c (State): Remove final comma in structure -- - xlc v5 under AIX 4.3 doesn't like this. - -2006-12-07 David Turner - - * src/autofit/afloader.c (af_loader_load_g): Small adjustment - to the spacing of auto-fitted glyphs. This only impacts rare - cases (e.g., Arial Bold at rather small character sizes). - -2006-12-03 Werner Lemberg - - * src/sfnt/rules.mk (SFNT_DRV_SRC): Add ttsbit0.c. - -2006-12-01 Werner Lemberg - - * src/sfnt/sfobjs.c (tt_face_get_name): All Unicode strings are - encoded in UTF-16BE. Patch from Rajeev Pahuja . - (tt_name_entry_ascii_from_ucs4): Removed. - - - * include/freetype/ftxf86.h: Fix and extend comment so that it - appears in the documentation. - - * include/freetype/ftchapters.h: Add `font_format' section. - - - * src/tools/docmaker/tohtml.py (HtmlFormatter::index_exit): Add link - to TOC in index page. - -2006-11-28 David Turner - - * src/smooth/ftgrays.c (gray_raster_render): Return 0 when we are - trying to render into a zero-width/height bitmap, not an error code. - - * src/truetype/ttobjs.c (tt_face_init): Fix typo in previous patch. - - * src/smooth/ftgrays.c: Remove hard-coded error values; use FreeType - ones instead. - - * src/autofit/afhints.c (af_glyph_hints_dump_segments): Remove unused - variable. - -2006-11-26 Pierre Hanser - - * src/truetype/ttobjs.c (tt_face_init): Protect against NULL pointer. - -2006-11-25 David Turner - - * src/autofit/afhints.c (af_glyph_hints_dump_points, - af_glyph_hints_dump_segments, af_glyph_hints_dumpedges) [!AF_DEBUG]: - Add stubs to link the `ftgrid' test program when debugging is - disabled in the auto-hinter. - -2006-11-23 David Turner - - * src/autofit/afhints.c, src/autofit/afhints.h, src/autofit/aflatin.c, - src/autofit/aftypes.h: Miscellaneous auto-hinter improvements. - - * src/autofit/afhints.c (af_glyph_hints_dump_segments) [AF_DEBUG]: - Emit more sensible information. - - * src/autofit/afhints.h (AF_SegmentRec): Add `height' member. - - * src/autofit/aflatin.c (af_latin_metrics_scale_dim): Improve - rounding of blue values. - (af_latin_hints_compute_segments): Hint segment heights. - (af_latin_hints_link_segments): Reduce `len_score' value. - (af_latin_hints_compute_edges): Increase `segment_length_threshold' - value and use `height' member for comparisons. - (af_latin_hint_edges): Extend logging message. - Improve handling of remaining edges. - -2006-11-22 Werner Lemberg - - Fix Savannah bug #15553. - - * src/truetype/ttgload.c (tt_loader_init): Re-execute the CVT - program after a change from mono to grayscaling (and vice versa). - Use correct constant for comparison to get `exec->grayscale'. - -2006-11-18 Werner Lemberg - - Because FT_Load_Glyph expects CID values for CID-keyed fonts, the - test for a valid glyph index must be deferred to the font drivers. - This patch fixes Savannah bug #18301. - - * src/base/ftobjs.c (FT_Load_Glyph): Don't check `glyph_index'. - * src/bdf/bdfdrivr.c (BDF_Glyph_Load), src/cff/cffgload.c - (cff_slot_load), src/cid/cidgload.c (cid_slot_load_glyph), - src/pcf/pcfdrivr.c (PCF_Glyph_Load), src/pfr/pfrobjs.c - (pfr_slot_load), src/truetype/ttdriver.c (Load_Glyph), - src/type1/t1gload.c (T1_Load_Glyph), src/winfonts/winfnt.c - (FNT_Load_Glyph): Check validity of `glyph_index'. - -2006-11-13 David Turner - - * src/truetype/ttinterp.c (FIX_BYTECODE): Undefine. The interpreter - `enhancements' are still too buggy for general use. - - * src/base/ftlcdfil.c: Add support for FT_FORCE_LIGHT_LCD_FILTER and - FT_FORCE_LEGACY_LCD_FILTER at compile time. Define these macros - when building the library to change the default LCD filter to be - used. This is only useful for experimentation. - - * include/freetype/ftlcdfil.h: Update documentation. - -2006-11-10 David Turner - - * src/smooth/ftsmooth.c: API change for the LCD - filter. The FT_LcdFilter value is an enumeration describing which - filter to apply, with new values FT_LCD_FILTER_LIGHT and - FT_LCD_FILTER_LEGACY (the latter implements the LibXft original - algorithm which produces strong color fringes for everything - except very-well hinted text). - - * include/freetype/ftlcdfil.h (FT_Library_SetLcdFilter): Change - second parameter to an enum type. - - * src/base/ftlcdfil.c (USE_LEGACY): Define. - (_ft_lcd_filter): Rename to... - (_ft_lcd_filter_fir): This. - Update parameters. - (_ft_lcd_filter_legacy) [USE_LEGACY]: New filter function. - (FT_Library_Set_LcdFilter): Update parameters. - Handle new filter modes. - - * include/internal/ftobjs.h: Include FT_LCD_FILTER_H. - (FT_Bitmap_LcdFilterFunc): Change third argument to `FT_Library'. - (FT_LibraryRec) [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Add filtering - callback and update other fields. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic) - [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: Update. - Other minor improvements. - - * src/autofit/aflatin.c: Various tiny improvements that drastically - improve the handling of serif fonts and of LCD/LCD_V hinting modes. - (af_latin_hints_compute_edges): Fix typo. - (af_latin_compute_stem_width): Take better care of diagonal stems. - -2006-11-09 David Turner - - * src/pshinter/pshalgo.c (psh_glyph_compute_inflections): Fix - typo which created a variable-used-before-initialized bug. - -2006-11-07 Zhe Su - - * src/base/ftsynth.c (FT_GlyphSlot_Embolden): Handle vertical layout - also. - -2006-11-03 Werner Lemberg - - * src/base/ftcalc.c: Don't use `long long' but `FT_Int64'. - -2006-11-02 David Turner - - Add a few tweaks to better handle serif fonts. - Add more debugging messages. - - * src/autofit/aflatin.c (af_latin_hints_compute_edges): Ignore - segments that are less than 1.5 pixels high. This gets rid of - *many* corner cases with serifs. - (af_latin_align_linked_edge): Add logging message. - (af_latin_hint_edges): Use AF_HINTS_DO_BLUES. - Add logging messages. - Handle AF_EDGE_FLAG flag specially. - - * src/autofit/afmodule.c [AF_DEBUG]: Add _af_debug, - _af_debug_disable_blue_hints, and _af_debug_hints variables. - - * src/autofit/aftypes.h (AF_LOG) [AF_DEBUG]: Use _af_debug. - Update external declarations. - (af_corner_orientation, af_corner_is_flat): Replaced by... - - * include/freetype/internal/ftcalc.h (ft_corner_orientation, - ft_corner_is_flat): These declarations. - - * src/autofit/afangles.c (af_corner_orientation, af_corner_is_flat): - Comment out. Replaced by... - - * src/base/ftcalc.h (ft_corner_orientation, ft_corner_is_flat): - These functions. Update all callers. - (FT_Add64) [!FT_LONG64]: Simplify. - - * src/autofit/afhints.c: Include FT_INTERNAL_CALC_H. - (af_direction_compute): Add a missing FT_ABS call. This bug caused - production of garbage by missing lots of segments. - - * src/autofit/afhints.h (AF_HINTS_DO_BLUES): New macro. - - * src/autofit/afloader.c (af_loader_init, af_loader_done) - [AF_DEBUG]: Set _af_debug_hints. - - - * src/pshinter/pshalgo.c: Include FT_INTERNAL_CALC_H. - (psh_corner_is_flat, psh_corner_orientation): Use ft_corner_is_flat - and ft_corner_orientation. - - - * src/gzip/inftrees.c (huft_build): Remove compiler warning. - -2006-10-24 Werner Lemberg - - * src/cff/cffload.c (cff_encoding_load): Remove unused variable. - - * src/base/ftobjs.c (FT_Select_Charmap): Disallow FT_ENCODING_NONE - as argument. - -2006-10-23 Zhe Su - - * src/base/ftoutln.c (FT_Outline_Get_Orientation): Re-implement to - better deal with broken Asian fonts with strange glyphs, having - self-intersections and other peculiarities. The used algorithm is - based on the nonzero winding rule. - -2006-10-23 David Turner - - Speed up the CFF font loader. With some large CFF fonts, - FT_Open_Face is now more than three times faster. - - * src/cff/cffload.c (cff_get_offset): Removed. - (cff_new_index): Inline functionality of `cff_get_offset'. - (cff_charset_compute_cids, cff_charset_free_cids): New functions. - (cff_charset_done): Call `cff_charset_free_cids'. - (cff_charset_load): Call `cff_charset_compute_cids'. - (cff_encoding_load) : Ditto, to replace inefficient loop. - - * src/sfnt/ttmtx.c (tt_face_load_hmtx): Replace calls to FT_GET_XXX - with FT_NEXT_XXX. - - - Speed up the Postscript hinter, with more than 100% speed increase - on my machine. - - * src/pshinter/pshalgo.c (psh_corner_is_flat, - psh_corner_orientation): New functions. - (psh_glyph_compute_inflections): Merge loops for efficiency. - Use `psh_corner_orientation'. - (psh_glyph_init): Use `psh_corner_is_flat'. - (psh_hint_table_find_strong_point): Renamed to... - (psh_hint_table_find_strong_points): This. - Rewrite, adding argument to handle all points at once. - Update all callers. - (PSH_MAX_STRONG_INTERNAL): New macro. - (psh_glyph_interpolate_normal_points): Rewrite for efficiency. - -2006-10-15 suzuki toshiya - - * src/base/ftmac.c (FT_New_Face_From_FOND): Initialize variable - `error' with FT_Err_Ok. - -2006-10-14 suzuki toshiya - - * docs/INSTALL.CROSS: New document file for cross-building. - - * builds/unix/configure.raw: Preliminary cross-building support. - Find native C compiler and pass it by CC_BUILD, and - find suffix for native executable and pass it by EXEEXT_BUILD. - Also suffix for target executable is passed by EXEEXT. - - * builds/unix/unix-cc.in (CCraw_build, E_BUILD): New variables to - build `apinames' which runs on building system. They are set by - CC_BUILD and EXEEXT_BUILD. - - * builds/exports.mk (APINAMES_EXE): Change the extension for - apinames from the suffix for target (E) to that for building host - (E_BUILD). - -2006-10-12 Werner Lemberg - - * docs/INSTALL.UNX, docs/UPGRADE.UNX: Renamed to... - * docs/INSTALL.UNIX, docs/UPGRADE.UNIX: This. Update all documents - which reference those files. - -2006-10-12 suzuki toshiya - - * builds/unix/configure.raw (FT2_EXTRA_LIBS): New variable. It is - embedded in freetype2.pc and freetype-config. Use it to record - Carbon dependency of MacOSX. - - * builds/unix/freetype2.in: Embed FT2_EXTRA_LIBS. - - * builds/unix/freetype-config.in: Ditto. - -2006-10-11 Werner Lemberg - - * devel/ftoption.h (FT_CONFIG_OPTION_SUBPIXEL_RENDERING): Define for - development. - -2006-10-03 Jens Claudius - - * include/freetype/config/ftstdlib.h: Cast away volatileness from - argument to ft_setjmp. - - * include/freetype/internal/ftvalid.h: Add comment that - ft_validator_run must not be used. - -2006-10-01 Werner Lemberg - - * src/base/ftbase.c: Undo change from 2006-09-30. - - * src/base/rules.mk (BASE_SRC): Remove `ftlcdfil.c'. - -2006-09-30 David Turner - - * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): - s/unpatented_hinting/ignore_unpatented_hinter/. - Update all callers. - - * src/base/ftobjs.c (FT_Load_Glyph): Refine the algorithm whether - auto-hinting shall be used or not. - - * src/truetype/ttobjs.c (tt_face_init): Ditto. - -2006-09-30 Werner Lemberg - - * src/base/rules.mk (BASE_SRC): Remove `ftapi.c' (which is no longer - in use). - - * src/base/ftbase.c: Include `ftlcdfil.c'. - -2006-09-29 Werner Lemberg - - * src/sfnt/ttcmap.c (tt_cmap4_char_map_binary): Fix algorithm for - overlapping segments. Bug reported by Stefan Koch. - -2006-09-28 David Turner - - Fix a bug in the automatic unpatented hinting support which prevents - normal bytecode hinting to work properly. - - * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): - s/force_autohint/unpatented_hinting/. Update all callers. - - * src/base/ftobjs.c (FT_Load_Glyph): Updated code. - - * src/autofit/aftypes.h (AF_DEBUG): Undefine to get rid of traces. - -2006-09-27 David Turner - - * include/freetype/freetype.h (FT_FREETYPE_PATCH): Set to 2. - - - Add a new API to support color filtering of subpixel glyph bitmaps. - In a default build, the function `FT_Library_SetLcdFilter' returns - `FT_Err_Unimplemented_Feature'; you need to #define - FT_CONFIG_OPTION_SUBPIXEL_RENDERING in ftoption.h to compile the - real implementation. - - * include/freetype/ftlcdfil.h, src/base/ftlcdfil.c: New files. - - * include/freetype/internal/ftobjs.h (FT_Bitmap_LcdFilterFunc): New - typedef. - (FT_LibraryRec) [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: New members - `lcd_filter_weights' and `lcd_filter'. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): Remove arguments - `hmul' and `vmul'. - - Handle subpixel rendering. - Simplify function. - (ft_smooth_render_lcd): Use `FT_RENDER_MODE_LCD'. - (ft_smooth_render_lcd_v): Use `FT_RENDER_MODE_LCD_V'. - - * include/freetype/config/ftheader.h (FT_LCD_FILTER_H): New macro, - pointing to . - - * src/base/Jamfile (_sources), src/base/rules.mk (BASE_SRC), - vms_make.com: Add `ftlcdfil.c' to the list of compiled source files. - - * modules.cfg (BASE_EXTENSIONS): Add ftlcdfil.c. - -2006-09-26 David Bustin - - * src/pfr/pfrobjs.c (pfr_face_get_kerning): Skip adjustment bytes - correctly. Reported as Savannah bug #17843. - -2006-09-26 David Turner - - * src/autofit/afhints.h (AF_HINTS_DO_HORIZONTAL, - AF_HINTS_DO_VERTICAL, AF_HINTS_DO_ADVANCE): New macros to disable - horizontal and vertical hinting for the purpose of debugging the - auto-fitter. - - * src/autofit/afmodule.c (_af_debug_disable_horz_hints, - _af_debug_disable_vert_hints) [AF_DEBUG]: New global variables. - - * src/autofit/aftypes.h [AF_DEBUG]: Declare above variables. - - * include/freetype/config/ftoption.h, devel/ftoption.h - (FT_CONFIG_OPTION_SUBPIXEL_RENDERING): New macro to control whether - we want to compile LCD-optimized rendering code (à la ClearType) or - not. The macro *must* be disabled in default builds of the library - for patent reasons. - - * src/smooth/ftsmooth.c (ft_smooth_render_generic): Disable - LCD-specific rendering when FT_CONFIG_OPTION_SUBPIXEL_RENDERING - isn't defined at compile time. This only changes the content of the - rendered glyph to match the one of normal gray-level rendering, - hence clients should not need to be modified. - - * docs/CHANGES: Updated. - -2006-09-18 Garrick Meeker - - * src/base/ftmac.c (FT_New_Face_From_FOND): Fall back to SFNT if - LWFN fails and both are available. - -2006-09-11 David Turner - - * src/sfnt/sfobjs.c (tt_face_get_name): Support some fonts which - report their English names through an Apple Roman - (platform,encoding) pair, with language_id != English. - - If the font uses another name entry with language_id == English, it - will be selected correctly, though. - - * src/truetype/ttobjs.c (tt_face_init): Add unpatented hinting - selection for `mingli.ttf'. - -2006-09-05 Werner Lemberg - - * src/truetype/ttpload.c (tt_face_load_hdmx): Handle `record_size' - values which have the upper two bytes set to 0xFF instead of 0x00 - (as it happens in at least two CJKV fonts, `HAN NOM A.ttf' and - `HAN NOM B.ttf'). - - * src/smooth/ftgrays.c [GRAYS_USE_GAMMA]: Really remove all code. - -2006-09-05 David Turner - - Minor source cleanups and optimizations. - - * src/smooth/ftgrays.c (GRAYS_COMPACT): Removed. - (TRaster): Remove `count_ex' and `count_ey'. - (gray_find_cell): Remove 2nd and 3rd argument. - (gray_alloc_cell): Merged with `gray_find_cell'. - (gray_record_cell): Simplify. - (gray_set_cell): Rewrite. - (gray_start_cell): Apply offsets to `ras.ex' and `ras.ey'. - (gray_render_span): Don't use FT_MEM_SET for small values. - (gray_dump_cells) [DEBUG_GRAYS]: New function. - (gray_sweep): Avoid buffer overwrites when to drawing the end of a - bitmap scanline. - (gray_convert_glyph): Fix speed-up. - -2006-09-04 David Turner - - * src/smooth/ftgrays.c (gray_convert_glyphs): Make it work with - 64bit processors. - -2006-09-03 Werner Lemberg - - * devel/ftoption.h: Synchronize with - include/freetype/config/ftoption.h. - - * src/smooth/ftgrays.c (gray_record_cell): Remove shadowing - variable declaration. - (gray_convert_glyph): Fix compiler warnings. - -2006-09-01 David Turner - - * src/truetype/ttobjs.c (tt_face_init): Update the TrueType loader - to recognize a few fonts that require the automatic unpatented - loader. - - * src/smooth/ftgrays.c: Optmize the performance of the anti-aliased - rasterizer. The speed improvement is between 15% and 25%, depending - on the font data. - - (GRAYS_USE_GAMMA, GRAYS_COMPACT): Removed, and all associated code. - (TCell): Redefine. - (TRaster): New members `buffer', `buffer_size', `ycells', `ycount'. - (gray_init_cells): Updated. - (gray_find_cell, gray_alloc_cell): New functions. - (gray_record_cell): Rewritten to use `gray_find_cell' and - `gray_alloc_cell'. - (PACK, LESS_THAN, SWAP_CELLS, DEBUG_SORT, QUICK_SORT, SHELL_SORT, - QSORT_THRESHOLD): - Removed. - (gray_shell_sort, gray_quick_sort, gray_check_sort, - gray_dump_cells): Removed. - (gray_sweep): Rewritten. - (gray_convert_glyph): Rewrite code which used one of the sorting - functions. - (gray_raster_render): Updated. - -2006-08-29 Dr. Werner Fink - - * configure: Make it possible to handle configure options which - have strings containing spaces. - -2006-08-27 David Turner - - * include/freetype/config/ftoption.h (TT_USE_BYTECODE_INTERPRETER): - New macro, defined if either TT_CONFIG_OPTION_BYTECODE_INTERPRETER - or TT_CONFIG_OPTION_UNPATENTED_HINTING is defined. - - * include/freetype/internal/ftcalc.h, src/base/ftcalc.c, - src/truetype/truetype.c, src/truetype/ttdriver.c, - src/truetype/ttgload.c, src/truetype/ttgload.h, - src/truetype/ttinterp.c, src/truetype/ttobjs.c, - src/truetype/ttobjs.h, src/truetype/ttpload.c, src/type42/t42drivr.c: - s/TT_CONFIG_OPTION_BYTECODE_INTERPRETER/TT_USE_BYTECODE_INTERPRETER/. - - * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): New - member `force_autohint'. - - * src/base/ftobjs.c (FT_Load_Glyph): Use `force_autohint'. - - * src/truetype/ttobjs.c (tt_face_init): Prepare code for testing - against a list of font names which need the bytecode interpreter. - -2006-08-27 Jens Claudius - - Fix miscellaneous compiler warnings. - - * include/freetype/internal/ftobjs.h: Close comment with `*/' to - avoid `/* in comment' compiler warning. - - * src/base/ftdbgmem.c (ft_mem_table_get_source): Turn cast - `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)' since on - 64-bit platforms void* is larger than FT_UInt32. - - * src/base/ftobjs.c (t_validator_error): Cast away - volatileness of argument to ft_longjmp. Spotted by Werner - `Putzfrau' Lemberg. - - * src/bdf/bdflib.c (bdf_load_font): Initialize local - variable `lineno'. - - * src/gxvalid/gxvmod.c (classic_kern_validate): Mark local variable - `error' as volatile. - -2006-08-27 Werner Lemberg - - * builds/unix/ftconfig.in: Synchronize with main ftconfig.h. - Reported by Jens. - -2006-08-22 Jens Claudius - - Fix for previous commit, which caused many compiler warnings/errors - about addresses of volatile objects passed as function arguments as - non-volatile pointers. - - * include/freetype/internal/ftvalid.h: Make FT_Validator typedef a - pointer to a volatile object. - - * src/gxvalid/gxvmod.c (gxv_load_table): Make function argument - `table' a pointer to a volatile object. - - * src/otvalid/otvmod.c (otv_load_table): Make function argument - `table' a pointer to a volatile object. - -2006-08-18 Jens Claudius - - * src/gxvalid/gxvmod.c (GXV_TABLE_DECL): Mark local variable `_sfnt' - as volatile since it must keep its value across a call to ft_setjmp. - (gxv_validate): Same for local variables `memory' and `valid'. - (classic_kern_validate): Same for local variables `memory', - `ckern', and `valid'. - - * src/otvalid/otvmod.c (otv_validate): Same for function parameter - `face' and local variables `base', `gdef', `gpos', `gsub', `jstf', - and 'valid'. - - * src/sfnt/ttcmap.c (tt_face_build_cmaps): Same for local variable - `cmap'. - -2006-08-16 David Turner - - * src/cid/cidgload.c (cid_slot_load_glyph): Remove compiler - warnings. - - * src/base/ftobjs.c (ft_validator_run): Disable function; it is - buggy by design. Always return -1. - - - Improvements to native TrueType hinting. This is a first try, - controlled by the FIX_BYTECODE macro in src/truetype/ttinterp.c. - - * include/freetype/internal/ftgloadr.h (FT_GlyphLoadRec): Add member - `extra_points2'. - - * include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add member - `orus'. - - * src/base/ftgloadr.c (FT_GlyphLoader_Reset, - FT_GlyphLoader_Adjust_Points, FT_GlyphLoader_CreateExtra, - FT_GlyphLoader_CheckPoints, FT_GlyphLoader_CopyPoints): Updated to - handle `extra_points2'. - - * src/truetype/ttgload.c (tt_prepare_zone): Handle `orus'. - Remove compiler warning. - (cur_to_arg): Remove macro. - (TT_Hint_Glyph): Updated. - (TT_Process_Simple_Glyph): Handle `orus'. - - * src/truetype/ttinterp.c (FIX_BYTECODE): New macro. - (Ins_MD, Ins_MDRP, Ins_IP) [FIX_BYTECODE]: Handle `orus'. - (LOC_Ins_IUP): Renamed to... - (IUP_WorkerRec): This. - Add `orus' member. - (Shift): Renamed to... - (_iup_worker_shift): This. - Updated. - (Interp): Renamed to... - (_iup_worker_interpolate): This. - Updated to handle `orus'. - (Ins_IUP): Updated. - - * src/truetype/ttobjs.c (tt_glyphzone_done, tt_glyphzone_new): - Handle `orus'. - -2006-08-15 suzuki toshiya - - * modules.cfg (BASE_EXTENSIONS): Compile in ftgxval.c by default to - build ftvalid in ft2demos. This has been inadvertedly changed - 2006-08-13. - -2006-08-15 suzuki toshiya - - `ft_validator_run' wrapping `setjmp' can cause a crash, as found by - Jens: - http://lists.gnu.org/archive/html/freetype-devel/2006-08/msg00004.htm. - - * src/otvalid/otvmod.c: Replace `ft_validator_run' by `ft_setjmp'. - It reverts the change introduced on 2005-08-20. - - * src/gxvalid/gxvmod.c: Ditto. - -2006-08-13 Jens Claudius - - * finclude/freetype/internal/psaux.h: (T1_TokenType): Add - T1_TOKEN_TYPE_KEY. - (T1_FieldRec): Add `dict'. - (T1_FIELD_DICT_FONTDICT, T1_FIELD_DICT_PRIVATE): New macros. - (T1_NEW_XXX, T1_FIELD_XXX): Update to take the dictionary where a PS - keyword is expected as an additional argument. - - * src/cid/cidload.c: (cid_field_records): Adjust invocations of - T1_FIELD_XXX. - - * src/cid/cidtoken.h: Adjust invocations of T1_FIELD_XXX. - - * src/psaux/psobjs.c: Add macro FT_COMPONENT for tracing. - (ps_parser_to_token): Report a PostScript key as T1_TOKEN_TYPE_KEY, - not T1_TOKEN_TYPE_ANY. - (ps_parser_load_field): Make sure a token that should be a string or - name is really a string or name. - Avoid memory leak if a keyword has been already encountered and its - value is overwritten. - * src/type1/t1load.c: (t1_keywords): Adjust invocations of - T1_FIELD_XXX. - (parse_dict): Ignore keywords that occur in the wrong dictionary - (e.g., in `Private' instead of `FontDict'). - - * src/type1/t1tokens.h: Adjust invocations of T1_FIELD_XXX. - - * src/type42/t42parse.c: (t42_keywords): Adjust invocations of - T1_FIELD_XXX. - -2006-07-18 Jens Claudius - - Move creation of field `buildchar' of T1_DecoderRec out of - `t1_decoder_init' and let the caller of `t1_decoder_init' take care - of it. - - Call the finisher for T1_Decoder in `cid_face_compute_max_advance' - and `T1_Compute_Max_Advance'. - - * include/freetype/internal/psaux.h (T1_DecoderRec): Remove field - `face', add `len_buildchar'. - - * include/freetype/internal/t1types.h (T1_FaceRec): Add field - `buildchar'. - - * src/cid/cidgload.c (cid_face_compute_max_advance): Call finisher - for T1_Decoder. - (cid_slot_load_glyph): Do not ignore failure when initializing the - T1_Decoder. - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Updated. - (t1_decoder_init): Remove initialization of fields `buildchar' and - `len_buildchar'. - (t1_decoder_done): Remove deallocation of field `buildchar'. - - * freetype/src/type1/t1gload.c (T1_Compute_Max_Advance): Initialize - T1_Decoder's `buildchar' and `len_buildchar'; call finisher for - T1_Decoder. - (T1_Load_Glyph): Initialize T1_Decoder's `buildchar' and - `len_buildchar'; make sure to call finisher for T1_Decoder even in - case of error. - - * src/type1/t1load.c (T1_Open_Face): Allocate new field `buildchar' - of T1_FaceRec. - - * src/type1/t1objs.c (T1_Face_Done): Free new field `buildchar' of - T1_FaceRec. - -2006-07-14 Jens Claudius - - * include/freetype/internal/psaux.h: New macros IS_PS_NEWLINE, - IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT, - and IS_PS_BASE85 (from src/psaux/psconv.h). - (T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER, - T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND. - (T1_DecoderRec): New fields `buildchar' and `face'. - (IS_PS_TOKEN): New macro. - - * include/freetype/internal/t1types.h (T1_FaceRec): New fields - `ndv_idx', `cdv_idx', and `len_buildchar'. - - * include/freetype/t1tables.h (PS_BlendRec): New fields - `default_design_vector' and `num_default_design_vector'. - - * src/psaux/psconv.h: Move macros IS_PS_NEWLINE, IS_PS_SPACE, - IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT, and - IS_PS_BASE85 to include/freetype/internal/psaux.h. - - * src/psaux/psobjs.c (ps_parser_to_token_array): Allow `token' - argument to be NULL if we want only to count the number of tokens. - (ps_tocoordarray): Allow `coords' argument to be NULL if we just - want to skip the array. - (ps_tofixedarray): Allow `values' argument to be NULL if we just - want to skip the array. - - * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add support - for (partially commented out) othersubrs 19-25, 27, and 28. - (t1_decoder_init): Initialize new fields `face' and `buildchar'. - (t1_decoder_done): Release new field `buildchar'. - - * src/type1/t1load.c (parse_buildchar, parse_private): New - functions. - (t1_keywords): Register them. - (t1_allocate_blend): Updated. - (t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER, - T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND. - (parse_dict): Remove `keyword_flags' argument. - Use new macro IS_PS_TOKEN. - Changed function so that later PostScript definitions override - earlier ones. - (t1_init_loader): Initialize new field `keywords_encountered'. - (T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and - `len_buildchar'. - Remove `keywords_flags'. - - * src/type1/t1load.h (T1_LoaderRect): New field - `keywords_encountered'. - (T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros. - - * src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]: New - entries for parsing /NDV, /CDV, and /DesignVector. - -2006-07-07 Werner Lemberg - - Add many checks to protect against malformed PCF files. - - * src/pcf/pcfdrivr.c (PCF_Face_Done): Protect against NULL pointers. - (PCF_Face_Init): Add calls to PCF_Face_Done in case of errors. - - * src/pcf/pcfread.c (pcf_read_TOC): Protect against malformed table - data and check that tables don't overlap (using a simple - bubblesort). - (PCF_METRIC_SIZE, PCF_COMPRESSED_METRIC_SIZE, PCF_PROPERTY_SIZE): - New macros which give the size of data structures in the data - stream. - (pcf_get_properties): Use rough estimates to get array size limits. - Assign `face->nprops' and `face->properties' earlier so that a call - to PCF_Face_Done can do the clean-up in case of error. - Protect against invalid string offsets. - (pcf_get_metrics): Clean up code. - Adjust tracing message levels. - Use rough estimate to get array size limit. - (pcf_get_bitmaps): Clean up code. - Adjust tracing message levels. - Use rough estimates to get offset limits. - (pcf_get_encodings): Adjust tracing message level. - (pcf_get_accel): Clean up code. - -2006-06-26 Werner Lemberg - - * src/bdf/bdfdrivr.c (BDF_Face_Init): Handle fonts correctly which - don't have a POINT_SIZE property. This fixes Savannah bug #16914. - -2006-06-26 Jens Claudius - - * src/psaux/t1decode.c (T1_Operator, t1_args_count): Add opcode 15. - (t1_decoder_parse_charstrings): Operator with - opcode 15 pops its two arguments. - Handle the case where the pops of an othersubr may be part of a - subroutine. - Handle unknown othersubrs gracefully: count their operands and let - the following pop operators push the operands as the results onto - the Type1 stack. - Improve handling of setcurrentpoint opcode. - -2006-06-25 Jens Claudius - - The Type 1 parser now skips over top-level procedures as required - for a `Simplified Parser'. This makes the parser more robust as it - doesn't poke around in PostScript code. Additionally, it makes the - FontDirectory hackery in src/type1/t1load.c unnecessary. - - * src/psaux/psobjs.c (IS_OCTAL_DIGIT): New macro. - (skip_literal_string): Add FT_Error as return value. - Handle escapes better. - (skip_string): Add FT_Error as return value. - Don't set `parser->error' but return error code directly. - (skip_procedure): New function. - (ps_parser_skip_PS_token): Handle procedures. - Update code. - (ps_parser_to_token): Update code. - (ps_parser_load_field_table): Handle bbox entries also. - - * src/type1/t1load.c (parse_dict): Remove FontDirectory hackery. - Add commented-out code for synthetic fonts. - -2006-06-24 Eugeniy Meshcheryakov - - Fix two hinting bugs as reported in - http://lists.gnu.org/archive/html/freetype-devel/2006-06/msg00057.html. - - * include/freetype/internal/tttypes.h (TT_GlyphZoneRec): Add - `first_point' member. - - * src/truetype/ttgload.c (tt_prepare_zone): Initialize - `first_point'. - (TT_Process_Composite_Glyph): Always untouch points. - - * src/truetype/ttinterp.c (Ins_SHC): Fix computation of - `first_point' and `last_point' in case of composite glyphs. - (Ins_IUP): Fix computation of `end_point'. - -2006-06-22 suzuki toshiya - - Insert EndianS16_BtoN and EndianS32_BtoN as workaround for Intel - Mac. The original patch was written by David Sachitano and Lawrence - Coopet, and modified by Sean McBride for MPW compatibility. Only - required data are converted; unused data are left in big endian. - - * src/base/ftmac.c: Include for byteorder macros for non - Mac OS X platforms. - (OS_INLINE): Undefine before definition. - (count_faces_sfnt): Insert EndianS16_BtoN to parse the header of - FontAssociation table in FOND resource. - (count_faces_scalable): Insert EndianS16_BtoN to parse the header - and fontSize at each entry of FontAssociation table in FOND - resource. - (parse_fond): Insert EndianS16_BtoN and EndianS32_BtoN to parse - ffStylOff of FamilyRecord header of FOND resource, the header, - fontSize, fontID at each entry of FontAssociation table, and - StyleMapping table. - (count_faces): Call `HUnlock' after all FOND utilization. - -2006-06-08 suzuki toshiya - - Public API of TrueTypeGX, OpenType, and classic kern table validator - should return `FT_Err_Unimplemented_Feature' if validation service - is unavailable (disabled in `modules.cfg'). It is originally - suggested by David Turner, cf. - http://lists.gnu.org/archive/html/freetype-devel/2005-11/msg00078.html - - * src/base/ftgxval.c (FT_TrueTypeGX_Validate): Return - FT_Err_Unimplemented_Feature if TrueTypeGX validation service is - unavailable. - (FT_ClassicKern_Validate): Return FT_Err_Unimplemented_Feature if - classic kern table validation service is unavailable. - - * src/base/ftotval.c (FT_OpenType_Validate): Return - FT_Err_Unimplemented_Feature if OpenType validation service is - unavailable. - -2006-06-08 Werner Lemberg - - * src/bdf/bdflib.c (bdf_load_font): Fix memory leaks in case of - errors. - -2006-06-07 David Turner - - * src/type1/t1afm.c (KERN_INDEX): Make it more robust. - (T1_Read_Metrics): Fix memory leak which happened when the metrics - file doesn't have kerning pairs. This fixes Savannah bug #16768. - -2006-06-06 David Turner - - Fix memory leak described in Savannah bug #16759. - - We change `ps_unicodes_init' so that it also takes a - `free_glyph_name' callback to release the glyph names returned by - `get_glyph_name' - - * include/freetype/internal/services/svpscmap.h (PS_Glyph_NameFunc): - Renamed to ... - (PS_GetGlyphNameFunc): This. - (PS_FreeGlyphNameFunc): New typedef. - (PS_Unicodes_InitFunc): Add variable for PS_FreeGlyphNameFunc. - - * src/cff/cffcmap.c (cff_sid_to_glyph_name): Use `TT_Face' for first - argument. - (cff_sid_free_glyph_name): New function. - (cff_cmap_unicode_init): Updated. - - * src/psaux/t1cmap.c (t1_cmap_unicode_init): Updated. - - * src/psnames/psmodule.c (ps_unicodes_init): Add variable for - PS_FreeGlyphNameFunc and use it. - - -2006-06-04 David Turner - - * src/base/ftutil.c (ft_mem_qrealloc): Fix the function to accept - `item_size == 0' as well -- though this sounds weird, it can - theoretically happen. This fixes Savannah bug #16669. - - * src/pfr/pfrobjs.c (pfr_face_init): Fix the computation - of `face->num_glyphs' which missed the last glyph, due to - the offset-by-1 computation, since the PFR format doesn't - guarantee that glyph index 0 corresponds to the `missing - glyph. This fixes Savannah bug #16668. - -2006-05-25 Werner Lemberg - - * builds/unix/unix-cc.in (LINK_LIBRARY): Don't comment out - `-no-undefined'. Reported by Christian Biesinger. - -2006-05-19 Brian Weed - - * builds/win32/visualc/freetype.dsp: Release libraries no longer - have debug information, and debug libraries use `C7 compatible' - debug info. - -2006-05-19 suzuki toshiya - - Apply patch by Derek Clegg to fix two memory leaks in the MacOS - resource fork handler. This fixes Savannah bug #16631. - - * src/base/ftobjs.c (load_face_in_embedded_rfork): Replace - `FT_Stream_Close' by `FT_Stream_Free' to fix memory leak. - - * src/base/ftrfrk.c (raccess_guess_linux_double_from_file_name): - Replace `FT_Stream_Close' by `FT_Stream_Free' to fix memory leak. - -2006-05-19 suzuki toshiya - - * build/unix/configure.raw: Add a fallback to disable Carbon - dependency, if configured with no options on Mac OS X. - -2006-05-19 suzuki toshiya - - * src/base/ftmac.c (open_face_from_buffer): Deallocate stream when - its content cannot be parsed as supported font. This fixes - the second part of Savannah bug #16590. - -2006-05-18 Werner Lemberg - - * src/truetype/ttgload.c (TT_Load_Composite_Glyph) - [FT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Make it compilable again. - -2006-05-17 David Turner - - This is a major patch used to drastically improve the performance of - loading glyphs. This both speeds up loading the glyph vectors - themselves and the auto-fitter module. - - We now use inline assembler code with GCC to implement `FT_MulFix', - which is probably the most important function related to the - engine's performance. - - The resulting speed-up is about 25%. - - - * include/freetype/internal/tttypes.h (TT_LoaderRec): Add fields - `cursor' and `limit'. - - * src/autofit/afangles.c (af_corner_is_flat, af_corner_orientation): - New functions. - (AF_ATAN_BITS, af_arctan, af_angle_atan): Comment out. - [TEST]: Remove. - - * src/autofit/afcjk.c (AF_Script_UniRangeRec): Comment out test - code. - - * src/autofit/afhints.c (af_axis_hints_new_segment): Don't call - `FT_ZERO' - (af_direction_compute, af_glyph_hints_compute_inflections): Rewritten. - (af_glyph_hints_reload: Rewrite recognition of weak points. - - * src/autofit/aflatin.c (af_latin_hints_compute_segments): Move - constant values out of the loops. - - * src/autofit/aftypes.h: Updated. - - * src/base/ftcalc.c (FT_MulFix): Use inline assembler code. - - * src/base/ftoutln.c (FT_Outline_Get_Orientation): Use vector - product to get orientation. - - * src/gzip/ftgzip.c (ft_get_uncompressed_size): New function. - (FT_Stream_OpenGzip): Use it to handle small files directly in - memory. - - * src/psaux/psconv.c (PS_Conv_ASCIIHexDecode, PS_ConvEexecDecode): - Improve performance. - - * src/truetype/ttgload.c (TT_Access_Glyph_Frame): Set `cursor' and - `limit'. - - (TT_Load_Glyph_Header, TT_Load_Simple_Glyph, - TT_Load_Composite_Glyph): Updated. Add threshold to protect against - exceedingly large values of number of contours. Speed up by - reducing the number of loops. - - * src/type1/t1gload.c (T1_Load_Glyph): Don't apply unit matrix. - - - * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Change the threshold - used to detect rogue clients from 4 to 16. This is to prevent some - segmentation faults with fonts like `KozMinProVI-Regular.otf' which - comes from the Japanese Adobe Reader Asian Font pack. - -2007-05-17 Werner Lemberg - - * src/cff/cffload.c (cff_font_done): Deallocate subfont array. This - fixes the first part of Savannah bug #16590. - -2006-05-16 Werner Lemberg - - * docs/PROBLEMS: Updated icl issues. - ----------------------------------------------------------------------------- - -Copyright 2006, 2007, 2008, 2009, 2010 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. - - -Local Variables: -version-control: never -coding: utf-8 -End: Index: configure =================================================================== --- configure (revision 58178) +++ configure (working copy) @@ -92,19 +92,19 @@ cp $abs_ft2_dir/modules.cfg $abs_curr_dir fi echo "Generating \`Makefile'" - echo "TOP_DIR := $abs_ft2_dir" > Makefile - echo "OBJ_DIR := $abs_curr_dir" >> Makefile - echo "OBJ_BUILD := \$(OBJ_DIR)" >> Makefile - echo "DOC_DIR := \$(OBJ_DIR)/reference" >> Makefile - echo "FT_LIBTOOL_DIR := \$(OBJ_DIR)" >> Makefile - echo "ifndef FT2DEMOS" >> Makefile - echo " include \$(TOP_DIR)/Makefile" >> Makefile - echo "else" >> Makefile - echo " TOP_DIR_2 := \$(TOP_DIR)/../ft2demos" >> Makefile - echo " PROJECT := freetype" >> Makefile - echo " CONFIG_MK := \$(OBJ_DIR)/config.mk" >> Makefile - echo " include \$(TOP_DIR_2)/Makefile" >> Makefile - echo "endif" >> Makefile + echo "TOP_DIR := $abs_ft2_dir" > Makefile + echo "OBJ_DIR := $abs_curr_dir" >> Makefile + echo "OBJ_BUILD := \$(OBJ_DIR)" >> Makefile + echo "DOC_DIR := \$(OBJ_DIR)/reference" >> Makefile + echo "FT_LIBTOOL_DIR := \$(OBJ_DIR)" >> Makefile + echo "ifndef FT2DEMOS" >> Makefile + echo " include \$(TOP_DIR)/Makefile" >> Makefile + echo "else" >> Makefile + echo " TOP_DIR_2 := \$(TOP_DIR)/../ft2demos" >> Makefile + echo " PROJECT := freetype" >> Makefile + echo " CONFIG_MK := \$(OBJ_DIR)/config.mk" >> Makefile + echo " include \$(TOP_DIR_2)/Makefile" >> Makefile + echo "endif" >> Makefile fi # call make Index: devel/ftoption.h =================================================================== --- devel/ftoption.h (revision 58178) +++ devel/ftoption.h (working copy) @@ -4,8 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -190,6 +189,33 @@ /*************************************************************************/ /* */ + /* Bzip2-compressed file support. */ + /* */ + /* FreeType now handles font files that have been compressed with the */ + /* `bzip2' program. This is mostly used to parse many of the PCF */ + /* files that come with XFree86. The implementation uses `libbz2' to */ + /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */ + /* Contrary to gzip, bzip2 currently is not included and need to use */ + /* the system available bzip2 implementation. */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +#define FT_CONFIG_OPTION_USE_BZIP2 + + + /*************************************************************************/ + /* */ + /* 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 */ + /* file stream support, in the cases where file stream support is not */ + /* necessary such as memory loading of font files. */ + /* */ +/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ + + + /*************************************************************************/ + /* */ /* DLL export compilation */ /* */ /* When compiling FreeType as a DLL, some systems/compilers need a */ @@ -365,6 +391,39 @@ /*************************************************************************/ /* */ + /* Autofitter debugging */ + /* */ + /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */ + /* control the autofitter behaviour for debugging purposes with global */ + /* boolean variables (consequently, you should *never* enable this */ + /* while compiling in `release' mode): */ + /* */ + /* _af_debug_disable_horz_hints */ + /* _af_debug_disable_vert_hints */ + /* _af_debug_disable_blue_hints */ + /* */ + /* Additionally, the following functions provide dumps of various */ + /* internal autofit structures to stdout (using `printf'): */ + /* */ + /* af_glyph_hints_dump_points */ + /* af_glyph_hints_dump_segments */ + /* af_glyph_hints_dump_edges */ + /* */ + /* As an argument, they use another global variable: */ + /* */ + /* _af_debug_hints */ + /* */ + /* Please have a look at the `ftgrid' demo program to see how those */ + /* variables and macros should be used. */ + /* */ + /* Do not #undef these macros here since the build system might define */ + /* them for certain configurations only. */ + /* */ +#define FT_DEBUG_AUTOFIT + + + /*************************************************************************/ + /* */ /* Memory Debugging */ /* */ /* FreeType now comes with an integrated memory debugger that is */ @@ -501,6 +560,28 @@ /*************************************************************************/ /* */ + /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */ + /* EXPERIMENTAL subpixel hinting support into the TrueType driver. This */ + /* replaces the native TrueType hinting mechanism when anything but */ + /* FT_RENDER_MODE_MONO is requested. */ + /* */ + /* Enabling this causes the TrueType driver to ignore instructions under */ + /* certain conditions. This is done in accordance with the guide here, */ + /* with some minor differences: */ + /* */ + /* http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* */ + /* By undefining this, you only compile the code necessary to hint */ + /* TrueType glyphs with native TT hinting. */ + /* */ + /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ + /* defined. */ + /* */ +#define TT_CONFIG_OPTION_SUBPIXEL_HINTING + + + /*************************************************************************/ + /* */ /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ /* of the TrueType bytecode interpreter is used that doesn't implement */ /* any of the patented opcodes and algorithms. The patents related to */ @@ -575,7 +656,7 @@ /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ - /* http://partners.adobe.com/asn/developer/opentype/glyf.html */ + /* http://www.microsoft.com/typography/otspec/glyf.htm */ /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED @@ -610,7 +691,7 @@ /*************************************************************************/ /* */ - /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ + /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */ /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ /* required. */ /* */ @@ -676,6 +757,19 @@ /* */ #define AF_CONFIG_OPTION_INDIC + /*************************************************************************/ + /* */ + /* Compile autofit module with warp hinting. The idea of the warping */ + /* code is to slightly scale and shift a glyph within a single dimension */ + /* so that as much of its segments are aligned (more or less) on the */ + /* grid. To find out the optimal scaling and shifting value, various */ + /* parameter combinations are tried and scored. */ + /* */ + /* This experimental option is only active if the render mode is */ + /* FT_RENDER_MODE_LIGHT. */ + /* */ +#define AF_CONFIG_OPTION_USE_WARPER + /* */ @@ -689,7 +783,7 @@ * is recommended to disable the macro since it reduces the library's code * size and activates a few memory-saving optimizations as well. */ -/* #define FT_CONFIG_OPTION_OLD_INTERNALS xxx */ +#define FT_CONFIG_OPTION_OLD_INTERNALS /* Index: include/freetype/config/ftconfig.h =================================================================== --- include/freetype/config/ftconfig.h (revision 58178) +++ include/freetype/config/ftconfig.h (working copy) @@ -4,7 +4,7 @@ /* */ /* ANSI-specific configuration file (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2004, 2006-2008, 2010-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -95,10 +95,6 @@ #endif - /* Preferred alignment of data */ -#define FT_ALIGNMENT 8 - - /* FT_UNUSED is a macro used to indicate that a given parameter is not */ /* used -- this is only used to get rid of unpleasant compiler warnings */ #ifndef FT_UNUSED @@ -124,15 +120,17 @@ /* This is the only necessary change, so it is defined here instead */ /* providing a new configuration file. */ /* */ -#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \ - ( defined( __MWERKS__ ) && defined( macintosh ) ) +#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) ) /* no Carbon frameworks for 64bit 10.4.x */ + /* AvailabilityMacros.h is available since Mac OS X 10.2, */ + /* so guess the system version by maximum errno before inclusion */ +#include +#ifdef ECANCELED /* defined since 10.2 */ #include "AvailabilityMacros.h" +#endif #if defined( __LP64__ ) && \ ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) -#define DARWIN_NO_CARBON 1 -#else -#define FT_MACINTOSH 1 +#undef FT_MACINTOSH #endif #elif defined( __SC__ ) || defined( __MRC__ ) @@ -348,16 +346,17 @@ register FT_Int32 t, t2; - asm __volatile__ ( - "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ - "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ - "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ - "adds %1, %1, %0\n\t" /* %1 += %0 */ - "adc %2, %2, #0\n\t" /* %2 += carry */ - "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ - "orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ + __asm__ __volatile__ ( + "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ + "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ + "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ + "adds %1, %1, %0\n\t" /* %1 += %0 */ + "adc %2, %2, #0\n\t" /* %2 += carry */ + "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; } @@ -395,6 +394,43 @@ #endif /* __GNUC__ */ + +#ifdef _MSC_VER /* Visual C++ */ + +#ifdef _M_IX86 + +#define FT_MULFIX_ASSEMBLER FT_MulFix_i386 + + /* documentation is in freetype.h */ + + static __inline FT_Int32 + FT_MulFix_i386( FT_Int32 a, + FT_Int32 b ) + { + register FT_Int32 result; + + __asm + { + mov eax, a + mov edx, b + imul edx + mov ecx, edx + sar ecx, 31 + add ecx, 8000h + add eax, ecx + adc edx, 0 + shr eax, 16 + shl edx, 16 + add eax, edx + mov result, eax + } + return result; + } + +#endif /* _M_IX86 */ + +#endif /* _MSC_VER */ + #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ Index: include/freetype/config/ftheader.h =================================================================== --- include/freetype/config/ftheader.h (revision 58178) +++ include/freetype/config/ftheader.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Build macros of the FreeType 2 library. */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2008, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -318,6 +318,19 @@ /************************************************************************* * * @macro: + * FT_AUTOHINTER_H + * + * @description: + * A macro used in #include statements to name the file containing + * structures and macros related to the auto-hinting module. + * + */ +#define FT_AUTOHINTER_H + + + /************************************************************************* + * + * @macro: * FT_TYPE1_TABLES_H * * @description: @@ -427,6 +440,19 @@ /************************************************************************* * * @macro: + * FT_BZIP2_H + * + * @description: + * A macro used in #include statements to name the file containing the + * definitions of an API which supports bzip2-compressed files. + * + */ +#define FT_BZIP2_H + + + /************************************************************************* + * + * @macro: * FT_WINFONTS_H * * @description: Index: include/freetype/config/ftoption.h =================================================================== --- include/freetype/config/ftoption.h (revision 58178) +++ include/freetype/config/ftoption.h (working copy) @@ -4,8 +4,7 @@ /* */ /* User-selectable configuration macros (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -190,6 +189,33 @@ /*************************************************************************/ /* */ + /* Bzip2-compressed file support. */ + /* */ + /* FreeType now handles font files that have been compressed with the */ + /* `bzip2' program. This is mostly used to parse many of the PCF */ + /* files that come with XFree86. The implementation uses `libbz2' to */ + /* partially uncompress the file on the fly (see src/bzip2/ftbzip2.c). */ + /* Contrary to gzip, bzip2 currently is not included and need to use */ + /* the system available bzip2 implementation. */ + /* */ + /* Define this macro if you want to enable this `feature'. */ + /* */ +/* #define FT_CONFIG_OPTION_USE_BZIP2 */ + + + /*************************************************************************/ + /* */ + /* 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 */ + /* file stream support, in the cases where file stream support is not */ + /* necessary such as memory loading of font files. */ + /* */ +/* #define FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ + + + /*************************************************************************/ + /* */ /* DLL export compilation */ /* */ /* When compiling FreeType as a DLL, some systems/compilers need a */ @@ -365,6 +391,39 @@ /*************************************************************************/ /* */ + /* Autofitter debugging */ + /* */ + /* If FT_DEBUG_AUTOFIT is defined, FreeType provides some means to */ + /* control the autofitter behaviour for debugging purposes with global */ + /* boolean variables (consequently, you should *never* enable this */ + /* while compiling in `release' mode): */ + /* */ + /* _af_debug_disable_horz_hints */ + /* _af_debug_disable_vert_hints */ + /* _af_debug_disable_blue_hints */ + /* */ + /* Additionally, the following functions provide dumps of various */ + /* internal autofit structures to stdout (using `printf'): */ + /* */ + /* af_glyph_hints_dump_points */ + /* af_glyph_hints_dump_segments */ + /* af_glyph_hints_dump_edges */ + /* */ + /* As an argument, they use another global variable: */ + /* */ + /* _af_debug_hints */ + /* */ + /* Please have a look at the `ftgrid' demo program to see how those */ + /* variables and macros should be used. */ + /* */ + /* Do not #undef these macros here since the build system might define */ + /* them for certain configurations only. */ + /* */ +/* #define FT_DEBUG_AUTOFIT */ + + + /*************************************************************************/ + /* */ /* Memory Debugging */ /* */ /* FreeType now comes with an integrated memory debugger that is */ @@ -501,6 +560,28 @@ /*************************************************************************/ /* */ + /* Define TT_CONFIG_OPTION_SUBPIXEL_HINTING if you want to compile */ + /* EXPERIMENTAL subpixel hinting support into the TrueType driver. This */ + /* replaces the native TrueType hinting mechanism when anything but */ + /* FT_RENDER_MODE_MONO is requested. */ + /* */ + /* Enabling this causes the TrueType driver to ignore instructions under */ + /* certain conditions. This is done in accordance with the guide here, */ + /* with some minor differences: */ + /* */ + /* http://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ + /* */ + /* By undefining this, you only compile the code necessary to hint */ + /* TrueType glyphs with native TT hinting. */ + /* */ + /* This option requires TT_CONFIG_OPTION_BYTECODE_INTERPRETER to be */ + /* defined. */ + /* */ +/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + + /*************************************************************************/ + /* */ /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */ /* of the TrueType bytecode interpreter is used that doesn't implement */ /* any of the patented opcodes and algorithms. The patents related to */ @@ -575,7 +656,7 @@ /* composite flags array which can be used to disambiguate, but old */ /* fonts will not have them. */ /* */ - /* http://partners.adobe.com/asn/developer/opentype/glyf.html */ + /* http://www.microsoft.com/typography/otspec/glyf.htm */ /* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */ /* */ #undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED @@ -610,7 +691,7 @@ /*************************************************************************/ /* */ - /* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ + /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */ /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ /* required. */ /* */ @@ -676,6 +757,19 @@ /* */ #define AF_CONFIG_OPTION_INDIC + /*************************************************************************/ + /* */ + /* Compile autofit module with warp hinting. The idea of the warping */ + /* code is to slightly scale and shift a glyph within a single dimension */ + /* so that as much of its segments are aligned (more or less) on the */ + /* grid. To find out the optimal scaling and shifting value, various */ + /* parameter combinations are tried and scored. */ + /* */ + /* This experimental option is only active if the render mode is */ + /* FT_RENDER_MODE_LIGHT. */ + /* */ +/* #define AF_CONFIG_OPTION_USE_WARPER */ + /* */ Index: include/freetype/config/ftstdlib.h =================================================================== --- include/freetype/config/ftstdlib.h (revision 58178) +++ include/freetype/config/ftstdlib.h (working copy) @@ -5,7 +5,7 @@ /* ANSI-specific library and header configuration file (specification */ /* only). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */ +/* Copyright 2002-2007, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -59,11 +59,12 @@ #include -#define FT_CHAR_BIT CHAR_BIT -#define FT_INT_MAX INT_MAX -#define FT_INT_MIN INT_MIN -#define FT_UINT_MAX UINT_MAX -#define FT_ULONG_MAX ULONG_MAX +#define FT_CHAR_BIT CHAR_BIT +#define FT_USHORT_MAX USHRT_MAX +#define FT_INT_MAX INT_MAX +#define FT_INT_MIN INT_MIN +#define FT_UINT_MAX UINT_MAX +#define FT_ULONG_MAX ULONG_MAX /**********************************************************************/ @@ -158,7 +159,7 @@ /* on certain platforms */ #define ft_longjmp longjmp -#define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) ) /* same thing here */ +#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) /* same thing here */ /* the following is only used for debugging purposes, i.e., if */ Index: include/freetype/freetype.h =================================================================== --- include/freetype/freetype.h (revision 58178) +++ include/freetype/freetype.h (working copy) @@ -4,8 +4,7 @@ /* */ /* FreeType high-level API and common types (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +16,10 @@ /***************************************************************************/ +#ifndef __FREETYPE_H__ +#define __FREETYPE_H__ + + #ifndef FT_FREETYPE_H #error "`ft2build.h' hasn't been included yet!" #error "Please always use macros to include FreeType header files." @@ -26,10 +29,6 @@ #endif -#ifndef __FREETYPE_H__ -#define __FREETYPE_H__ - - #include #include FT_CONFIG_CONFIG_H #include FT_ERRORS_H @@ -227,15 +226,21 @@ /* Left side bearing for vertical layout. */ /* */ /* vertBearingY :: */ - /* Top side bearing for vertical layout. */ + /* Top side bearing for vertical layout. Larger positive values */ + /* mean further below the vertical glyph origin. */ /* */ /* vertAdvance :: */ - /* Advance height for vertical layout. */ + /* Advance height for vertical layout. Positive values mean the */ + /* glyph has a positive advance downward. */ /* */ /* */ /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ /* dimensions of the hinted glyph (in case hinting is applicable). */ /* */ + /* Stroking a glyph with an outside border does not increase */ + /* `horiAdvance' or `vertAdvance'; you have to manually adjust these */ + /* values to account for the added width and height. */ + /* */ typedef struct FT_Glyph_Metrics_ { FT_Pos width; @@ -843,8 +848,8 @@ /* expressed in font units (see */ /* `units_per_EM'). The box is large enough */ /* to contain any glyph from the font. Thus, */ - /* `bbox.yMax' can be seen as the `maximal */ - /* ascender', and `bbox.yMin' as the `minimal */ + /* `bbox.yMax' can be seen as the `maximum */ + /* ascender', and `bbox.yMin' as the `minimum */ /* descender'. Only relevant for scalable */ /* formats. */ /* */ @@ -876,13 +881,13 @@ /* positive. Only relevant for scalable */ /* formats. */ /* */ - /* max_advance_width :: The maximal advance width, in font units, */ + /* 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 */ /* faster. Only relevant for scalable */ /* formats. */ /* */ - /* max_advance_height :: The maximal advance height, in font units, */ + /* max_advance_height :: The maximum advance height, in font units, */ /* for all glyphs in this face. This is only */ /* relevant for vertical layouts, and is set */ /* to `height' for fonts that do not provide */ @@ -957,8 +962,8 @@ FT_ListRec sizes_list; - FT_Generic autohint; - void* extensions; + FT_Generic autohint; /* face-specific auto-hinter data */ + void* extensions; /* unused */ FT_Face_Internal internal; @@ -1058,12 +1063,12 @@ /* */ /* It is not possible to autohint such fonts using */ /* @FT_LOAD_FORCE_AUTOHINT; it will also ignore */ - /* @FT_LOAD_NO_HINTING. You have to set both FT_LOAD_NO_HINTING */ + /* @FT_LOAD_NO_HINTING. You have to set both @FT_LOAD_NO_HINTING */ /* and @FT_LOAD_NO_AUTOHINT to really disable hinting; however, you */ /* probably never want this except for demonstration purposes. */ /* */ - /* Currently, there are six TrueType fonts in the list of tricky */ - /* fonts; they are hard-coded in file `ttobjs.c'. */ + /* Currently, there are about a dozen TrueType fonts in the list of */ + /* tricky fonts; they are hard-coded in file `ttobjs.c'. */ /* */ #define FT_FACE_FLAG_SCALABLE ( 1L << 0 ) #define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 ) @@ -1104,8 +1109,8 @@ * FT_HAS_VERTICAL( face ) * * @description: - * A macro that returns true whenever a face object contains vertical - * metrics. + * A macro that returns true whenever a face object contains real + * vertical metrics (and not only synthesized ones). * */ #define FT_HAS_VERTICAL( face ) \ @@ -1337,7 +1342,7 @@ /* height :: The height in 26.6 fractional pixels. See */ /* @FT_FaceRec for the details. */ /* */ - /* max_advance :: The maximal advance width in 26.6 fractional */ + /* max_advance :: The maximum advance width in 26.6 fractional */ /* pixels. See @FT_FaceRec for the details. */ /* */ /* */ @@ -1667,6 +1672,9 @@ /* use @FT_New_Library instead, followed by a call to */ /* @FT_Add_Default_Modules (or a series of calls to @FT_Add_Module). */ /* */ + /* For multi-threading applications each thread should have its own */ + /* FT_Library object. */ + /* */ FT_EXPORT( FT_Error ) FT_Init_FreeType( FT_Library *alibrary ); @@ -1952,6 +1960,10 @@ /* Each new face object created with this function also owns a */ /* default @FT_Size object, accessible as `face->size'. */ /* */ + /* One @FT_Library instance can have multiple face objects, this is, */ + /* @FT_Open_Face and its siblings can be called multiple times using */ + /* the same `library' argument. */ + /* */ /* See the discussion of reference counters in the description of */ /* @FT_Reference_Face. */ /* */ @@ -2106,8 +2118,8 @@ /* used to determine both scaling values. */ /* */ /* FT_SIZE_REQUEST_TYPE_REAL_DIM :: */ - /* The real dimension. The sum of the the `Ascender' and (minus */ - /* of) the `Descender' fields of @FT_FaceRec are used to determine */ + /* The real dimension. The sum of the the `ascender' and (minus */ + /* of) the `descender' fields of @FT_FaceRec are used to determine */ /* both scaling values. */ /* */ /* FT_SIZE_REQUEST_TYPE_BBOX :: */ @@ -2219,6 +2231,12 @@ /* particular bitmap strike. Use @FT_Select_Size instead in that */ /* case. */ /* */ + /* The relation between the requested size and the resulting glyph */ + /* size is dependent entirely on how the size is defined in the */ + /* source face. The font designer chooses the final size of each */ + /* glyph relative to this size. For more information refer to */ + /* `http://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html' */ + /* */ FT_EXPORT( FT_Error ) FT_Request_Size( FT_Face face, FT_Size_Request req ); @@ -2288,6 +2306,11 @@ /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* You should not rely on the resulting glyphs matching, or being */ + /* constrained, to this pixel size. Refer to @FT_Request_Size to */ + /* understand how requested sizes relate to actual sizes. */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Pixel_Sizes( FT_Face face, FT_UInt pixel_width, @@ -2401,14 +2424,20 @@ * behaviour to more specific and useful cases. * * FT_LOAD_NO_SCALE :: - * Don't scale the outline glyph loaded, but keep it in font units. + * Don't scale the loaded outline glyph but keep it in font units. * * This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and * unsets @FT_LOAD_RENDER. * + * 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. + * This can be solved by loading the font without FT_LOAD_NO_SCALE and + * setting the character size to `font->units_per_EM'. + * * FT_LOAD_NO_HINTING :: - * Disable hinting. This generally generates `blurrier' bitmap glyph - * when the glyph is rendered in any of the anti-aliased modes. See + * Disable hinting. This generally generates `blurrier' bitmap glyphs + * when the glyph are rendered in any of the anti-aliased modes. See * also the note below. * * This flag is implied by @FT_LOAD_NO_SCALE. @@ -2427,9 +2456,15 @@ * @FT_LOAD_NO_SCALE always sets this flag. * * FT_LOAD_VERTICAL_LAYOUT :: - * Load the glyph for vertical text layout. _Don't_ use it as it is - * problematic currently. + * Load the glyph for vertical text layout. In particular, the + * `advance' value in the @FT_GlyphSlotRec structure is set to the + * `vertAdvance' value of the `metrics' field. * + * In case @FT_HAS_VERTICAL doesn't return true, you shouldn't use + * this flag currently. Reason is that in this case vertical metrics + * get synthesized, and those values are not always consistent across + * various font formats. + * * FT_LOAD_FORCE_AUTOHINT :: * Indicates that the auto-hinter is preferred over the font's native * hinter. See also the note below. @@ -2444,15 +2479,14 @@ * during glyph loading. This is mostly used to detect broken glyphs * in fonts. By default, FreeType tries to handle broken fonts also. * + * In particular, errors from the TrueType bytecode engine are not + * passed to the application if this flag is not set; this might + * result in partially hinted or distorted glyphs in case a glyph's + * bytecode is buggy. + * * FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH :: - * Indicates that the font driver should ignore the global advance - * width defined in the font. By default, that value is used as the - * advance width for all glyphs when the face has - * @FT_FACE_FLAG_FIXED_WIDTH set. + * Ignored. Deprecated. * - * This flag exists for historical reasons (to support buggy CJK - * fonts). - * * FT_LOAD_NO_RECURSE :: * This flag is only used internally. It merely indicates that the * font driver should not load composite glyphs recursively. Instead, @@ -2500,28 +2534,35 @@ * Besides deciding which hinter to use, you can also decide which * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. * + * Note that the auto-hinter needs a valid Unicode cmap (either a native + * one or synthesized by FreeType) for producing correct results. If a + * font provides an incorrect mapping (for example, assigning the + * character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a + * mathematical integral sign), the auto-hinter might produce useless + * results. + * */ #define FT_LOAD_DEFAULT 0x0 -#define FT_LOAD_NO_SCALE 0x1 -#define FT_LOAD_NO_HINTING 0x2 -#define FT_LOAD_RENDER 0x4 -#define FT_LOAD_NO_BITMAP 0x8 -#define FT_LOAD_VERTICAL_LAYOUT 0x10 -#define FT_LOAD_FORCE_AUTOHINT 0x20 -#define FT_LOAD_CROP_BITMAP 0x40 -#define FT_LOAD_PEDANTIC 0x80 -#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 0x200 -#define FT_LOAD_NO_RECURSE 0x400 -#define FT_LOAD_IGNORE_TRANSFORM 0x800 -#define FT_LOAD_MONOCHROME 0x1000 -#define FT_LOAD_LINEAR_DESIGN 0x2000 -#define FT_LOAD_NO_AUTOHINT 0x8000U +#define FT_LOAD_NO_SCALE ( 1L << 0 ) +#define FT_LOAD_NO_HINTING ( 1L << 1 ) +#define FT_LOAD_RENDER ( 1L << 2 ) +#define FT_LOAD_NO_BITMAP ( 1L << 3 ) +#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 ) +#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 ) +#define FT_LOAD_CROP_BITMAP ( 1L << 6 ) +#define FT_LOAD_PEDANTIC ( 1L << 7 ) +#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 ) +#define FT_LOAD_NO_RECURSE ( 1L << 10 ) +#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 ) +#define FT_LOAD_MONOCHROME ( 1L << 12 ) +#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 ) +#define FT_LOAD_NO_AUTOHINT ( 1L << 15 ) /* */ /* used internally only by certain font drivers! */ -#define FT_LOAD_ADVANCE_ONLY 0x100 -#define FT_LOAD_SBITS_ONLY 0x4000 +#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 ) +#define FT_LOAD_SBITS_ONLY ( 1L << 14 ) /************************************************************************** @@ -2573,7 +2614,8 @@ * * If @FT_LOAD_RENDER is also set, the glyph is rendered in the * corresponding mode (i.e., the mode which matches the used algorithm - * best) unless @FT_LOAD_MONOCHROME is set. + * best). An exeption is FT_LOAD_TARGET_MONO since it implies + * @FT_LOAD_MONOCHROME. * * You can use a hinting algorithm that doesn't correspond to the same * rendering mode. As an example, it is possible to use the `light' @@ -2874,14 +2916,26 @@ /* */ /* point_size :: The point size in 16.16 fractional points. */ /* */ - /* degree :: The degree of tightness. */ + /* degree :: The degree of tightness. Increasingly negative */ + /* values represent tighter track kerning, while */ + /* increasingly positive values represent looser track */ + /* kerning. Value zero means no track kerning. */ /* */ /* */ - /* akerning :: The kerning in 16.16 fractional points. */ + /* akerning :: The kerning in 16.16 fractional points, to be */ + /* uniformly applied between all glyphs. */ /* */ /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* Currently, only the Type~1 font driver supports track kerning, */ + /* using data from AFM files (if attached with @FT_Attach_File or */ + /* @FT_Attach_Stream). */ + /* */ + /* Only very few AFM files come with track kerning data; please refer */ + /* to the Adobe's AFM specification for more details. */ + /* */ FT_EXPORT( FT_Error ) FT_Get_Track_Kerning( FT_Face face, FT_Fixed point_size, @@ -2903,7 +2957,7 @@ /* */ /* glyph_index :: The glyph index. */ /* */ - /* buffer_max :: The maximal number of bytes available in the */ + /* buffer_max :: The maximum number of bytes available in the */ /* buffer. */ /* */ /* */ @@ -2921,6 +2975,10 @@ /* The glyph name is truncated to fit within the buffer if it is too */ /* long. The returned string is always zero-terminated. */ /* */ + /* Be aware that FreeType reorders glyph indices internally so that */ + /* glyph index~0 always corresponds to the `missing glyph' (called */ + /* `.notdef'). */ + /* */ /* This function is not compiled within the library if the config */ /* macro `FT_CONFIG_OPTION_NO_GLYPH_NAMES' is defined in */ /* `include/freetype/config/ftoptions.h'. */ @@ -3058,9 +3116,15 @@ /* */ /* If you use FreeType to manipulate the contents of font files */ /* directly, be aware that the glyph index returned by this function */ - /* doesn't always correspond to the internal indices used within */ - /* the file. This is done to ensure that value~0 always corresponds */ - /* to the `missing glyph'. */ + /* doesn't always correspond to the internal indices used within the */ + /* file. This is done to ensure that value~0 always corresponds to */ + /* the `missing glyph'. If the first glyph is not named `.notdef', */ + /* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */ + /* the glyph ID~0 position, and whatever was there will be moved to */ + /* the position `.notdef' had. For Type~1 fonts, if there is no */ + /* `.notdef' glyph at all, then one will be created at index~0 and */ + /* whatever was there will be moved to the last index -- Type~42 */ + /* fonts are considered invalid under this condition. */ /* */ FT_EXPORT( FT_UInt ) FT_Get_Char_Index( FT_Face face, @@ -3331,6 +3395,9 @@ /* in the @PS_FontInfoRec structure which is only guaranteed to */ /* return the correct results for Type~1 fonts. */ /* */ + /* */ + /* 2.3.8 */ + /* */ FT_EXPORT( FT_UShort ) FT_Get_FSType_Flags( FT_Face face ); @@ -3357,10 +3424,14 @@ /* code range for CJK characters. */ /* */ /* An IVS is registered and unique; for further details please refer */ - /* to Unicode Technical Report #37, the Ideographic Variation */ - /* Database. To date (October 2007), the character with the most */ - /* variants is U+908A, having 8~such IVS. */ + /* to Unicode Technical Standard #37, the Ideographic Variation */ + /* Database: */ /* */ + /* http://www.unicode.org/reports/tr37/ */ + /* */ + /* To date (November 2012), the character with the most variants is */ + /* U+9089, having 31 such IVS. */ + /* */ /* Adobe and MS decided to support IVS with a new cmap subtable */ /* (format~14). It is an odd subtable because it is not a mapping of */ /* input code points to glyphs, but contains lists of all variants */ @@ -3588,7 +3659,7 @@ /* */ /* */ /* A very simple function used to perform the computation `(a*b)/c' */ - /* with maximal accuracy (it uses a 64-bit intermediate integer */ + /* with maximum accuracy (it uses a 64-bit intermediate integer */ /* whenever necessary). */ /* */ /* This function isn't necessarily as fast as some processor specific */ @@ -3623,7 +3694,7 @@ /* */ /* */ /* A very simple function used to perform the computation */ - /* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */ + /* `(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. */ /* */ /* */ @@ -3668,7 +3739,7 @@ /* */ /* */ /* A very simple function used to perform the computation */ - /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */ + /* `(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. */ /* */ /* */ @@ -3808,7 +3879,7 @@ */ #define FREETYPE_MAJOR 2 #define FREETYPE_MINOR 4 -#define FREETYPE_PATCH 4 +#define FREETYPE_PATCH 11 /*************************************************************************/ Index: include/freetype/ftautoh.h =================================================================== --- include/freetype/ftautoh.h (revision 0) +++ include/freetype/ftautoh.h (working copy) @@ -0,0 +1,349 @@ +/***************************************************************************/ +/* */ +/* ftautoh.h */ +/* */ +/* FreeType API for controlling the auto-hinter (specification only). */ +/* */ +/* Copyright 2012 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 __FTAUTOH_H__ +#define __FTAUTOH_H__ + +#include +#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: + * auto_hinter + * + * @title: + * The auto-hinter + * + * @abstract: + * Controlling the auto-hinting module. + * + * @description: + * While FreeType's auto-hinter 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. + * + * Note that the auto-hinter's module name is `autofitter' for + * historical reasons. + * + */ + + + /************************************************************************** + * + * @property: + * glyph-to-script-map + * + * @description: + * 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. + * + * 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. + * + * The mapping between glyph indices and scripts (in the auto-hinter + * sense, see the @FT_AUTOHINTER_SCRIPT_XXX values) is stored as an + * array with `num_glyphs' elements, as found in the font's @FT_Face + * 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. + * + * The following example code demonstrates how to access it (omitting + * the error handling). + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_GlyphToScriptMap prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * + * prop.face = face; + * + * FT_Property_Get( library, "autofitter", + * "glyph-to-script-map", &prop ); + * + * // adjust `prop.map' as needed right here + * + * FT_Load_Glyph( face, ..., FT_LOAD_FORCE_AUTOHINT ); + * } + * + */ + + + /************************************************************************** + * + * @enum: + * FT_AUTOHINTER_SCRIPT_XXX + * + * @description: + * 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. + * + * @values: + * FT_AUTOHINTER_SCRIPT_NONE :: + * Don't auto-hint this glyph. + * + * FT_AUTOHINTER_SCRIPT_LATIN :: + * Apply the latin auto-hinter. For the auto-hinter, `latin' is a + * very broad term, including Cyrillic and Greek also since characters + * from those scripts share the same design constraints. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0020 - U+007F // Basic Latin (no control characters) + * U+00A0 - U+00FF // Latin-1 Supplement (no control characters) + * U+0100 - U+017F // Latin Extended-A + * U+0180 - U+024F // Latin Extended-B + * U+0250 - U+02AF // IPA Extensions + * U+02B0 - U+02FF // Spacing Modifier Letters + * U+0300 - U+036F // Combining Diacritical Marks + * U+0370 - U+03FF // Greek and Coptic + * U+0400 - U+04FF // Cyrillic + * U+0500 - U+052F // Cyrillic Supplement + * U+1D00 - U+1D7F // Phonetic Extensions + * U+1D80 - U+1DBF // Phonetic Extensions Supplement + * U+1DC0 - U+1DFF // Combining Diacritical Marks Supplement + * U+1E00 - U+1EFF // Latin Extended Additional + * U+1F00 - U+1FFF // Greek Extended + * U+2000 - U+206F // General Punctuation + * U+2070 - U+209F // Superscripts and Subscripts + * U+20A0 - U+20CF // Currency Symbols + * U+2150 - U+218F // Number Forms + * U+2460 - U+24FF // Enclosed Alphanumerics + * U+2C60 - U+2C7F // Latin Extended-C + * U+2DE0 - U+2DFF // Cyrillic Extended-A + * U+2E00 - U+2E7F // Supplemental Punctuation + * U+A640 - U+A69F // Cyrillic Extended-B + * U+A720 - U+A7FF // Latin Extended-D + * U+FB00 - U+FB06 // Alphab. Present. Forms (Latin Ligatures) + * U+1D400 - U+1D7FF // Mathematical Alphanumeric Symbols + * U+1F100 - U+1F1FF // Enclosed Alphanumeric Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_CJK :: + * Apply the CJK auto-hinter, covering Chinese, Japanese, Korean, old + * Vietnamese, and some other scripts. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+1100 - U+11FF // Hangul Jamo + * U+2E80 - U+2EFF // CJK Radicals Supplement + * U+2F00 - U+2FDF // Kangxi Radicals + * U+2FF0 - U+2FFF // Ideographic Description Characters + * U+3000 - U+303F // CJK Symbols and Punctuation + * U+3040 - U+309F // Hiragana + * U+30A0 - U+30FF // Katakana + * U+3100 - U+312F // Bopomofo + * U+3130 - U+318F // Hangul Compatibility Jamo + * U+3190 - U+319F // Kanbun + * U+31A0 - U+31BF // Bopomofo Extended + * U+31C0 - U+31EF // CJK Strokes + * U+31F0 - U+31FF // Katakana Phonetic Extensions + * U+3200 - U+32FF // Enclosed CJK Letters and Months + * U+3300 - U+33FF // CJK Compatibility + * U+3400 - U+4DBF // CJK Unified Ideographs Extension A + * U+4DC0 - U+4DFF // Yijing Hexagram Symbols + * U+4E00 - U+9FFF // CJK Unified Ideographs + * U+A960 - U+A97F // Hangul Jamo Extended-A + * U+AC00 - U+D7AF // Hangul Syllables + * U+D7B0 - U+D7FF // Hangul Jamo Extended-B + * U+F900 - U+FAFF // CJK Compatibility Ideographs + * U+FE10 - U+FE1F // Vertical forms + * U+FE30 - U+FE4F // CJK Compatibility Forms + * U+FF00 - U+FFEF // Halfwidth and Fullwidth Forms + * U+1B000 - U+1B0FF // Kana Supplement + * U+1D300 - U+1D35F // Tai Xuan Hing Symbols + * U+1F200 - U+1F2FF // Enclosed Ideographic Supplement + * U+20000 - U+2A6DF // CJK Unified Ideographs Extension B + * U+2A700 - U+2B73F // CJK Unified Ideographs Extension C + * U+2B740 - U+2B81F // CJK Unified Ideographs Extension D + * U+2F800 - U+2FA1F // CJK Compatibility Ideographs Supplement + * } + * + * FT_AUTOHINTER_SCRIPT_INDIC :: + * Apply the indic auto-hinter, covering all major scripts from the + * Indian sub-continent and some other related scripts like Thai, Lao, + * or Tibetan. + * + * By default, characters from the following Unicode ranges are + * assigned to this submodule. + * + * { + * U+0900 - U+0DFF // Indic Range + * U+0F00 - U+0FFF // Tibetan + * U+1900 - U+194F // Limbu + * U+1B80 - U+1BBF // Sundanese + * U+1C80 - U+1CDF // Meetei Mayak + * U+A800 - U+A82F // Syloti Nagri + * U+11800 - U+118DF // Sharada + * } + * + * Note that currently Indic support is rudimentary only, missing blue + * zone support. + * + */ +#define FT_AUTOHINTER_SCRIPT_NONE 0 +#define FT_AUTOHINTER_SCRIPT_LATIN 1 +#define FT_AUTOHINTER_SCRIPT_CJK 2 +#define FT_AUTOHINTER_SCRIPT_INDIC 3 + + + /************************************************************************** + * + * @struct: + * FT_Prop_GlyphToScriptMap + * + * @description: + * The data exchange structure for the @glyph-to-script-map property. + * + */ + typedef struct FT_Prop_GlyphToScriptMap_ + { + FT_Face face; + FT_Byte* map; + + } FT_Prop_GlyphToScriptMap; + + + /************************************************************************** + * + * @property: + * fallback-script + * + * @description: + * 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 + * @FT_AUTOHINTER_SCRIPT_CJK. Using the `fallback-script' property, + * this fallback value can be changed. + * + * { + * FT_Library library; + * FT_UInt fallback_script = FT_AUTOHINTER_SCRIPT_NONE; + * + * + * FT_Init_FreeType( &library ); + * + * FT_Property_Set( library, "autofitter", + * "fallback-script", &fallback_script ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * It's important to use the right timing for changing this value: The + * creation of the glyph-to-script map which eventually uses the + * fallback script value gets triggered either by setting or reading a + * face-specific property like @glyph-to-script-map, or by auto-hinting + * any glyph from that face. In particular, if you have already created + * an @FT_Face structure but not loaded any glyph (using the + * auto-hinter), a change of the fallback glyph will affect this face. + * + */ + + + /************************************************************************** + * + * @property: + * increase-x-height + * + * @description: + * For ppem values in the range 6~<= ppem <= `increase-x-height', round + * up the font's x~height much more often than normally. If the value + * is set to~0, which is the default, this feature is switched off. Use + * this property to improve the legibility of small font sizes if + * necessary. + * + * { + * FT_Library library; + * FT_Face face; + * FT_Prop_IncreaseXHeight prop; + * + * + * FT_Init_FreeType( &library ); + * FT_New_Face( library, "foo.ttf", 0, &face ); + * FT_Set_Char_Size( face, 10 * 64, 0, 72, 0 ); + * + * prop.face = face; + * prop.limit = 14; + * + * FT_Property_Set( library, "autofitter", + * "increase-x-height", &prop ); + * } + * + * @note: + * This property can be used with @FT_Property_Get also. + * + * Set this value right after calling @FT_Set_Char_Size, but before + * loading any glyph (using the auto-hinter). + * + */ + + + /************************************************************************** + * + * @struct: + * FT_Prop_IncreaseXHeight + * + * @description: + * The data exchange structure for the @increase-x-height property. + * + */ + typedef struct FT_Prop_IncreaseXHeight_ + { + FT_Face face; + FT_UInt limit; + + } FT_Prop_IncreaseXHeight; + + + /* */ + +FT_END_HEADER + +#endif /* __FTAUTOH_H__ */ + + +/* END */ Index: include/freetype/ftbbox.h =================================================================== --- include/freetype/ftbbox.h (revision 58178) +++ include/freetype/ftbbox.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType exact bbox computation (specification). */ /* */ -/* Copyright 1996-2001, 2003, 2007 by */ +/* Copyright 1996-2001, 2003, 2007, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -73,6 +73,14 @@ /* */ /* FreeType error code. 0~means success. */ /* */ + /* */ + /* If the font is tricky and the glyph has been loaded with */ + /* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */ + /* reasonable values for the BBox it is necessary to load the glyph */ + /* at a large ppem value (so that the hinting instructions can */ + /* properly shift and scale the subglyphs), then extracting the BBox */ + /* which can be eventually converted back to font units. */ + /* */ FT_EXPORT( FT_Error ) FT_Outline_Get_BBox( FT_Outline* outline, FT_BBox *abbox ); Index: include/freetype/ftbzip2.h =================================================================== --- include/freetype/ftbzip2.h (revision 0) +++ include/freetype/ftbzip2.h (working copy) @@ -0,0 +1,102 @@ +/***************************************************************************/ +/* */ +/* ftbzip2.h */ +/* */ +/* Bzip2-compressed stream support. */ +/* */ +/* Copyright 2010 by */ +/* Joel Klinghed. */ +/* */ +/* 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 __FTBZIP2_H__ +#define __FTBZIP2_H__ + +#include +#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 + + /*************************************************************************/ + /* */ + /*
*/ + /* bzip2 */ + /* */ + /* */ + /* BZIP2 Streams */ + /* */ + /* <Abstract> */ + /* Using bzip2-compressed font files. */ + /* */ + /* <Description> */ + /* This section contains the declaration of Bzip2-specific functions. */ + /* */ + /*************************************************************************/ + + + /************************************************************************ + * + * @function: + * FT_Stream_OpenBzip2 + * + * @description: + * Open a new stream to parse bzip2-compressed font files. This is + * mainly used to support the compressed `*.pcf.bz2' fonts that come + * with XFree86. + * + * @input: + * stream :: + * The target embedding stream. + * + * source :: + * The source stream. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * The source stream must be opened _before_ calling this function. + * + * Calling the internal function `FT_Stream_Close' on the new stream will + * *not* call `FT_Stream_Close' on the source stream. None of the stream + * objects will be released to the heap. + * + * The stream implementation is very basic and resets the decompression + * process each time seeking backwards is needed within the stream. + * + * In certain builds of the library, bzip2 compression recognition is + * automatically handled when calling @FT_New_Face or @FT_Open_Face. + * This means that if no font driver is capable of handling the raw + * compressed file, the library will try to open a bzip2 compressed stream + * from it and re-open the face with it. + * + * This function may return `FT_Err_Unimplemented_Feature' if your build + * of FreeType was not compiled with bzip2 support. + */ + FT_EXPORT( FT_Error ) + FT_Stream_OpenBzip2( FT_Stream stream, + FT_Stream source ); + + /* */ + + +FT_END_HEADER + +#endif /* __FTBZIP2_H__ */ + + +/* END */ Index: include/freetype/ftchapters.h =================================================================== --- include/freetype/ftchapters.h (revision 58178) +++ include/freetype/ftchapters.h (working copy) @@ -67,6 +67,20 @@ /***************************************************************************/ /* */ /* <Chapter> */ +/* auto_hinter */ +/* */ +/* <Title> */ +/* The Auto-Hinter */ +/* */ +/* <Sections> */ +/* auto_hinter */ +/* */ +/***************************************************************************/ + + +/***************************************************************************/ +/* */ +/* <Chapter> */ /* cache_subsystem */ /* */ /* <Title> */ @@ -98,6 +112,7 @@ /* module_management */ /* gzip */ /* lzw */ +/* bzip2 */ /* lcd_filtering */ /* */ /***************************************************************************/ Index: include/freetype/fterrdef.h =================================================================== --- include/freetype/fterrdef.h (revision 58178) +++ include/freetype/fterrdef.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType error codes (specification). */ /* */ -/* Copyright 2002, 2004, 2006, 2007, 2010 by */ +/* Copyright 2002, 2004, 2006, 2007, 2010-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -54,6 +54,10 @@ "broken offset within table" ) FT_ERRORDEF_( Array_Too_Large, 0x0A, \ "array allocation size too large" ) + FT_ERRORDEF_( Missing_Module, 0x0B, \ + "missing module" ) + FT_ERRORDEF_( Missing_Property, 0x0C, \ + "missing property" ) /* glyph/character errors */ @@ -214,7 +218,6 @@ FT_ERRORDEF_( No_Unicode_Glyph_Name, 0xA3, \ "no Unicode glyph name found" ) - /* BDF errors */ FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \ Index: include/freetype/fterrors.h =================================================================== --- include/freetype/fterrors.h (revision 58178) +++ include/freetype/fterrors.h (working copy) @@ -192,12 +192,13 @@ #undef FT_NOERRORDEF_ #undef FT_NEED_EXTERN_C -#undef FT_ERR_CONCAT #undef FT_ERR_BASE /* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */ #ifndef FT_KEEP_ERR_PREFIX #undef FT_ERR_PREFIX +#else +#undef FT_KEEP_ERR_PREFIX #endif #endif /* __FTERRORS_H__ */ Index: include/freetype/ftgasp.h =================================================================== --- include/freetype/ftgasp.h (revision 58178) +++ include/freetype/ftgasp.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Access of TrueType's `gasp' table (specification). */ /* */ -/* Copyright 2007, 2008 by */ +/* Copyright 2007, 2008, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -63,18 +63,26 @@ * * FT_GASP_DO_GRIDFIT :: * Grid-fitting and hinting should be performed at the specified ppem. - * This *really* means TrueType bytecode interpretation. + * This *really* means TrueType bytecode interpretation. If this bit + * is not set, no hinting gets applied. * * FT_GASP_DO_GRAY :: * Anti-aliased rendering should be performed at the specified ppem. + * If not set, do monochrome rendering. * * FT_GASP_SYMMETRIC_SMOOTHING :: - * Smoothing along multiple axes must be used with ClearType. + * If set, smoothing along multiple axes must be used with ClearType. * * FT_GASP_SYMMETRIC_GRIDFIT :: * Grid-fitting must be used with ClearType's symmetric smoothing. * * @note: + * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be + * used for standard font rasterization only. Independently of that, + * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to + * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and + * `FT_GASP_DO_GRAY' are consequently ignored). + * * `ClearType' is Microsoft's implementation of LCD rendering, partly * protected by patents. * Index: include/freetype/ftglyph.h =================================================================== --- include/freetype/ftglyph.h (revision 58178) +++ include/freetype/ftglyph.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009 by */ +/* Copyright 1996-2003, 2006, 2008, 2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -384,6 +384,13 @@ /* units in 26.6 pixel format. The value @FT_GLYPH_BBOX_SUBPIXELS */ /* is another name for this constant. */ /* */ + /* If the font is tricky and the glyph has been loaded with */ + /* @FT_LOAD_NO_SCALE, the resulting CBox is meaningless. To get */ + /* reasonable values for the CBox it is necessary to load the glyph */ + /* at a large ppem value (so that the hinting instructions can */ + /* properly shift and scale the subglyphs), then extracting the CBox */ + /* which can be eventually converted back to font units. */ + /* */ /* Note that the maximum coordinates are exclusive, which means that */ /* one can compute the width and height of the glyph image (be it in */ /* integer or 26.6 pixels) as: */ Index: include/freetype/ftmodapi.h =================================================================== --- include/freetype/ftmodapi.h (revision 58178) +++ include/freetype/ftmodapi.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType modules public interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009, 2010 by */ +/* Copyright 1996-2003, 2006, 2008-2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -42,12 +42,39 @@ /* Module Management */ /* */ /* <Abstract> */ - /* How to add, upgrade, and remove modules from FreeType. */ + /* How to add, upgrade, remove, and control modules from FreeType. */ /* */ /* <Description> */ /* The definitions below are used to manage modules within FreeType. */ /* Modules can be added, upgraded, and removed at runtime. */ + /* Additionally, some module properties can be controlled also. */ /* */ + /* Here is a list of possible values of the `module_name' field in */ + /* the @FT_Module_Class structure. */ + /* */ + /* { */ + /* autofitter */ + /* bdf */ + /* cff */ + /* gxvalid */ + /* otvalid */ + /* pcf */ + /* pfr */ + /* psaux */ + /* pshinter */ + /* psnames */ + /* raster1, raster5 */ + /* sfnt */ + /* smooth, smooth-lcd, smooth-lcdv */ + /* truetype */ + /* type1 */ + /* type42 */ + /* t1cid */ + /* winfonts */ + /* } */ + /* */ + /* Note that the FreeType Cache sub-system is not a FreeType module. */ + /* */ /*************************************************************************/ @@ -118,7 +145,7 @@ /* A function used to query a given module for a specific interface. */ /* */ /* <Input> */ - /* module :: The module to finalize. */ + /* module :: The module to be searched. */ /* */ /* name :: The name of the interface in the module. */ /* */ @@ -249,6 +276,130 @@ FT_Module module ); + /********************************************************************** + * + * @function: + * FT_Property_Set + * + * @description: + * Set a property for a given module. + * + * @input: + * library :: + * A handle to the library the module is part of. + * + * module_name :: + * The module name. + * + * property_name :: + * The property name. Properties are described in the `Synopsis' + * subsection of the module's documentation. + * + * Note that only a few modules have properties. + * + * value :: + * A generic pointer to a variable or structure which gives the new + * value of the property. The exact definition of `value' is + * dependent on the property; see the `Synopsis' subsection of the + * module's documentation. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `module_name' isn't a valid module name, or `property_name' + * doesn't specify a valid property, or if `value' doesn't represent a + * valid value for the given property, an error is returned. + * + * The following example sets property `bar' (a simple integer) in + * module `foo' to value~1. + * + * { + * FT_UInt bar; + * + * + * bar = 1; + * FT_Property_Set( library, "foo", "bar", &bar ); + * } + * + * It is not possible to set properties of the FreeType Cache + * sub-system with FT_Property_Set; use @FTC_Property_Set instead. + * + * @since: + * 2.4.11 + * + */ + FT_Error + FT_Property_Set( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + const void* value ); + + + /********************************************************************** + * + * @function: + * FT_Property_Get + * + * @description: + * Get a module's property value. + * + * @input: + * library :: + * A handle to the library the module is part of. + * + * module_name :: + * The module name. + * + * property_name :: + * The property name. Properties are described in the `Synopsis' + * subsection of the module's documentation. + * + * @inout: + * value :: + * A generic pointer to a variable or structure which gives the + * value of the property. The exact definition of `value' is + * dependent on the property; see the `Synopsis' subsection of the + * module's documentation. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * If `module_name' isn't a valid module name, or `property_name' + * doesn't specify a valid property, or if `value' doesn't represent a + * valid value for the given property, an error is returned. + * + * The following example gets property `baz' (a range) in module `foo'. + * + * { + * typedef range_ + * { + * FT_Int32 min; + * FT_Int32 max; + * + * } range; + * + * range baz; + * + * + * FT_Property_Get( library, "foo", "baz", &baz ); + * } + * + * It is not possible to retrieve properties of the FreeType Cache + * sub-system with FT_Property_Get; use @FTC_Property_Get instead. + * + * @since: + * 2.4.11 + * + */ + FT_Error + FT_Property_Get( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + void* value ); + + /*************************************************************************/ /* */ /* <Function> */ @@ -430,13 +581,13 @@ * scale glyph components with bytecode instructions. It produces * bad output for most other fonts. * - * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: + * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: * The library implements a bytecode interpreter that covers * the full instruction set of the TrueType virtual machine (this * was governed by patents until May 2010, hence the name). * * @since: - * 2.2 + * 2.2 * */ typedef enum FT_TrueTypeEngineType_ Index: include/freetype/ftmoderr.h =================================================================== --- include/freetype/ftmoderr.h (revision 58178) +++ include/freetype/ftmoderr.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType module error offsets (specification). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2005 by */ +/* Copyright 2001, 2002, 2003, 2004, 2005, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -105,24 +105,25 @@ FT_MODERRDEF( Base, 0x000, "base module" ) FT_MODERRDEF( Autofit, 0x100, "autofitter module" ) FT_MODERRDEF( BDF, 0x200, "BDF module" ) - FT_MODERRDEF( Cache, 0x300, "cache module" ) - FT_MODERRDEF( CFF, 0x400, "CFF module" ) - FT_MODERRDEF( CID, 0x500, "CID module" ) - FT_MODERRDEF( Gzip, 0x600, "Gzip module" ) - FT_MODERRDEF( LZW, 0x700, "LZW module" ) - FT_MODERRDEF( OTvalid, 0x800, "OpenType validation module" ) - FT_MODERRDEF( PCF, 0x900, "PCF module" ) - FT_MODERRDEF( PFR, 0xA00, "PFR module" ) - FT_MODERRDEF( PSaux, 0xB00, "PS auxiliary module" ) - FT_MODERRDEF( PShinter, 0xC00, "PS hinter module" ) - FT_MODERRDEF( PSnames, 0xD00, "PS names module" ) - FT_MODERRDEF( Raster, 0xE00, "raster module" ) - FT_MODERRDEF( SFNT, 0xF00, "SFNT module" ) - FT_MODERRDEF( Smooth, 0x1000, "smooth raster module" ) - FT_MODERRDEF( TrueType, 0x1100, "TrueType module" ) - FT_MODERRDEF( Type1, 0x1200, "Type 1 module" ) - FT_MODERRDEF( Type42, 0x1300, "Type 42 module" ) - FT_MODERRDEF( Winfonts, 0x1400, "Windows FON/FNT module" ) + FT_MODERRDEF( Bzip2, 0x300, "Bzip2 module" ) + FT_MODERRDEF( Cache, 0x400, "cache module" ) + FT_MODERRDEF( CFF, 0x500, "CFF module" ) + FT_MODERRDEF( CID, 0x600, "CID module" ) + FT_MODERRDEF( Gzip, 0x700, "Gzip module" ) + FT_MODERRDEF( LZW, 0x800, "LZW module" ) + FT_MODERRDEF( OTvalid, 0x900, "OpenType validation module" ) + FT_MODERRDEF( PCF, 0xA00, "PCF module" ) + FT_MODERRDEF( PFR, 0xB00, "PFR module" ) + FT_MODERRDEF( PSaux, 0xC00, "PS auxiliary module" ) + FT_MODERRDEF( PShinter, 0xD00, "PS hinter module" ) + FT_MODERRDEF( PSnames, 0xE00, "PS names module" ) + FT_MODERRDEF( Raster, 0xF00, "raster module" ) + FT_MODERRDEF( SFNT, 0x1000, "SFNT module" ) + FT_MODERRDEF( Smooth, 0x1100, "smooth raster module" ) + FT_MODERRDEF( TrueType, 0x1200, "TrueType module" ) + FT_MODERRDEF( Type1, 0x1300, "Type 1 module" ) + FT_MODERRDEF( Type42, 0x1400, "Type 42 module" ) + FT_MODERRDEF( Winfonts, 0x1500, "Windows FON/FNT module" ) #ifdef FT_MODERR_END_LIST Index: include/freetype/ftoutln.h =================================================================== --- include/freetype/ftoutln.h (revision 58178) +++ include/freetype/ftoutln.h (working copy) @@ -5,7 +5,7 @@ /* Support for the FT_Outline type used to store glyph shapes of */ /* most scalable font formats (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 1996-2003, 2005-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -59,6 +59,7 @@ /* FT_Outline_Translate */ /* FT_Outline_Transform */ /* FT_Outline_Embolden */ + /* FT_Outline_EmboldenXY */ /* FT_Outline_Reverse */ /* FT_Outline_Check */ /* */ @@ -124,9 +125,9 @@ /* outline will *not* necessarily be *freed*, when */ /* destroying the library, by @FT_Done_FreeType. */ /* */ - /* numPoints :: The maximal number of points within the outline. */ + /* numPoints :: The maximum number of points within the outline. */ /* */ - /* numContours :: The maximal number of contours within the outline. */ + /* numContours :: The maximum number of contours within the outline. */ /* */ /* <Output> */ /* anoutline :: A handle to the new outline. */ @@ -227,6 +228,9 @@ /* <Output> */ /* acbox :: The outline's control box. */ /* */ + /* <Note> */ + /* See @FT_Glyph_Get_CBox for a discussion of tricky fonts. */ + /* */ FT_EXPORT( void ) FT_Outline_Get_CBox( const FT_Outline* outline, FT_BBox *acbox ); @@ -332,7 +336,7 @@ /* handled incorrectly. */ /* */ /* If you need `better' metrics values you should call */ - /* @FT_Outline_Get_CBox ot @FT_Outline_Get_BBox. */ + /* @FT_Outline_Get_CBox or @FT_Outline_Get_BBox. */ /* */ /* Example call: */ /* */ @@ -350,6 +354,23 @@ /*************************************************************************/ /* */ /* <Function> */ + /* FT_Outline_EmboldenXY */ + /* */ + /* <Description> */ + /* Embolden an outline. The new outline will be `xstrength' pixels */ + /* wider and `ystrength' pixels higher. Otherwise, it is similar to */ + /* @FT_Outline_Embolden, which uses the same strength in both */ + /* directions. */ + /* */ + FT_EXPORT( FT_Error ) + FT_Outline_EmboldenXY( FT_Outline* outline, + FT_Pos xstrength, + FT_Pos ystrength ); + + + /*************************************************************************/ + /* */ + /* <Function> */ /* FT_Outline_Reverse */ /* */ /* <Description> */ Index: include/freetype/ftrender.h =================================================================== --- include/freetype/ftrender.h (revision 58178) +++ include/freetype/ftrender.h (working copy) @@ -212,6 +212,14 @@ /* */ /* This doesn't change the current renderer for other formats. */ /* */ + /* Currently, only the B/W renderer, if compiled with */ + /* FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels */ + /* anti-aliasing mode; this option must be set directly in */ + /* `ftraster.c' and is undefined by default) accepts a single tag */ + /* `pal5' to set its gray palette as a character string with */ + /* 5~elements. Consequently, the third and fourth argument are zero */ + /* normally. */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Renderer( FT_Library library, FT_Renderer renderer, Index: include/freetype/ftstroke.h =================================================================== --- include/freetype/ftstroke.h (revision 58178) +++ include/freetype/ftstroke.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (specification). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ +/* Copyright 2002-2006, 2008, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -75,20 +75,44 @@ * to join two lines smoothly. * * FT_STROKER_LINEJOIN_BEVEL :: - * Used to render beveled line joins; i.e., the two joining lines - * are extended until they intersect. + * Used to render beveled line joins. The outer corner of + * the joined lines is filled by enclosing the triangular + * region of the corner with a straight line between the + * outer corners of each stroke. * + * FT_STROKER_LINEJOIN_MITER_FIXED :: + * Used to render mitered line joins, with fixed bevels if the + * miter limit is exceeded. The outer edges of the strokes + * for the two segments are extended until they meet at an + * angle. If the segments meet at too sharp an angle (such + * that the miter would extend from the intersection of the + * segments a distance greater than the product of the miter + * limit value and the border radius), then a bevel join (see + * above) is used instead. This prevents long spikes being + * created. FT_STROKER_LINEJOIN_MITER_FIXED generates a miter + * line join as used in PostScript and PDF. + * + * FT_STROKER_LINEJOIN_MITER_VARIABLE :: * FT_STROKER_LINEJOIN_MITER :: - * Same as beveled rendering, except that an additional line - * break is added if the angle between the two joining lines - * is too closed (this is useful to avoid unpleasant spikes - * in beveled rendering). + * Used to render mitered line joins, with variable bevels if + * the miter limit is exceeded. The intersection of the + * strokes is clipped at a line perpendicular to the bisector + * of the angle between the strokes, at the distance from the + * intersection of the segments equal to the product of the + * miter limit value and the border radius. This prevents + * long spikes being created. + * FT_STROKER_LINEJOIN_MITER_VARIABLE generates a mitered line + * join as used in XPS. FT_STROKER_LINEJOIN_MITER is an alias + * for FT_STROKER_LINEJOIN_MITER_VARIABLE, retained for + * backwards compatibility. */ typedef enum FT_Stroker_LineJoin_ { - FT_STROKER_LINEJOIN_ROUND = 0, - FT_STROKER_LINEJOIN_BEVEL, - FT_STROKER_LINEJOIN_MITER + FT_STROKER_LINEJOIN_ROUND = 0, + FT_STROKER_LINEJOIN_BEVEL = 1, + FT_STROKER_LINEJOIN_MITER_VARIABLE = 2, + FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE, + FT_STROKER_LINEJOIN_MITER_FIXED = 3 } FT_Stroker_LineJoin; @@ -245,7 +269,8 @@ * The line join style. * * miter_limit :: - * The miter limit for the FT_STROKER_LINEJOIN_MITER style, + * 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. * * @note: @@ -657,6 +682,11 @@ * * @note: * The source glyph is untouched in case of error. + * + * Adding stroke may yield a significantly wider and taller glyph + * depending on how large of a radius was used to stroke the glyph. You + * may need to manually adjust horizontal and vertical advance amounts + * to account for this added size. */ FT_EXPORT( FT_Error ) FT_Glyph_Stroke( FT_Glyph *pglyph, @@ -694,6 +724,11 @@ * * @note: * The source glyph is untouched in case of error. + * + * Adding stroke may yield a significantly wider and taller glyph + * depending on how large of a radius was used to stroke the glyph. You + * may need to manually adjust horizontal and vertical advance amounts + * to account for this added size. */ FT_EXPORT( FT_Error ) FT_Glyph_StrokeBorder( FT_Glyph *pglyph, Index: include/freetype/ftsynth.h =================================================================== --- include/freetype/ftsynth.h (revision 58178) +++ include/freetype/ftsynth.h (working copy) @@ -5,7 +5,7 @@ /* FreeType synthesizing code for emboldening and slanting */ /* (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2006, 2008 by */ +/* Copyright 2000-2001, 2003, 2006, 2008, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -61,8 +61,9 @@ /* taste). This function is actually a convenience function, providing */ /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ /* */ - /* For emboldened outlines the metrics are estimates only; if you need */ - /* precise values you should call @FT_Outline_Get_CBox. */ + /* For emboldened outlines the height, width, and advance metrics are */ + /* increased by the strength of the emboldening. You can also call */ + /* @FT_Outline_Get_CBox to get precise values. */ FT_EXPORT( void ) FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); Index: include/freetype/fttypes.h =================================================================== --- include/freetype/fttypes.h (revision 58178) +++ include/freetype/fttypes.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType simple types definitions (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 by */ +/* Copyright 1996-2002, 2004, 2006-2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -434,7 +434,7 @@ /* variety of FreeType core objects. For example, a text layout API */ /* might want to associate a glyph cache to a given size object. */ /* */ - /* Most FreeType object contains a `generic' field, of type */ + /* Some FreeType object contains a `generic' field, of type */ /* FT_Generic, which usage is left to client applications and font */ /* servers. */ /* */ Index: include/freetype/internal/autohint.h =================================================================== --- include/freetype/internal/autohint.h (revision 58178) +++ include/freetype/internal/autohint.h (working copy) @@ -4,7 +4,7 @@ /* */ /* High-level `autohint' module-specific interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2007 by */ +/* Copyright 1996-2002, 2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -86,20 +86,20 @@ /* FT_AutoHinter_GlobalGetFunc */ /* */ /* <Description> */ - /* Retrieves the global hints computed for a given face object the */ + /* Retrieve the global hints computed for a given face object. The */ /* resulting data is dissociated from the face and will survive a */ /* call to FT_Done_Face(). It must be discarded through the API */ /* FT_AutoHinter_GlobalDoneFunc(). */ /* */ /* <Input> */ - /* hinter :: A handle to the source auto-hinter. */ + /* hinter :: A handle to the source auto-hinter. */ /* */ - /* face :: A handle to the source face object. */ + /* face :: A handle to the source face object. */ /* */ /* <Output> */ - /* global_hints :: A typeless pointer to the global hints. */ + /* global_hints :: A typeless pointer to the global hints. */ /* */ - /* global_len :: The size in bytes of the global hints. */ + /* global_len :: The size in bytes of the global hints. */ /* */ typedef void (*FT_AutoHinter_GlobalGetFunc)( FT_AutoHinter hinter, @@ -114,7 +114,7 @@ /* FT_AutoHinter_GlobalDoneFunc */ /* */ /* <Description> */ - /* Discards the global hints retrieved through */ + /* Discard the global hints retrieved through */ /* FT_AutoHinter_GlobalGetFunc(). This is the only way these hints */ /* are freed from memory. */ /* */ @@ -168,8 +168,8 @@ /* This function is capable of loading composite glyphs by hinting */ /* each sub-glyph independently (which improves quality). */ /* */ - /* It will call the font driver with FT_Load_Glyph(), with */ - /* FT_LOAD_NO_SCALE set. */ + /* It will call the font driver with @FT_Load_Glyph, with */ + /* @FT_LOAD_NO_SCALE set. */ /* */ typedef FT_Error (*FT_AutoHinter_GlyphLoadFunc)( FT_AutoHinter hinter, @@ -182,46 +182,59 @@ /*************************************************************************/ /* */ /* <Struct> */ - /* FT_AutoHinter_ServiceRec */ + /* FT_AutoHinter_InterfaceRec */ /* */ /* <Description> */ /* The auto-hinter module's interface. */ /* */ - typedef struct FT_AutoHinter_ServiceRec_ + typedef struct FT_AutoHinter_InterfaceRec_ { FT_AutoHinter_GlobalResetFunc reset_face; FT_AutoHinter_GlobalGetFunc get_global_hints; FT_AutoHinter_GlobalDoneFunc done_global_hints; FT_AutoHinter_GlyphLoadFunc load_glyph; - } FT_AutoHinter_ServiceRec, *FT_AutoHinter_Service; + } FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \ - done_global_hints_, load_glyph_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_AutoHinter_ServiceRec class_ = \ - { \ - reset_face_, get_global_hints_, done_global_hints_, load_glyph_ \ +#define FT_DEFINE_AUTOHINTER_INTERFACE( \ + class_, \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_AutoHinter_InterfaceRec class_ = \ + { \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_AUTOHINTER_SERVICE(class_, reset_face_, get_global_hints_, \ - done_global_hints_, load_glyph_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_AutoHinter_ServiceRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->reset_face = reset_face_; \ - clazz->get_global_hints = get_global_hints_; \ - clazz->done_global_hints = done_global_hints_; \ - clazz->load_glyph = load_glyph_; \ - } +#define FT_DEFINE_AUTOHINTER_INTERFACE( \ + class_, \ + reset_face_, \ + get_global_hints_, \ + done_global_hints_, \ + load_glyph_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_AutoHinter_InterfaceRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->reset_face = reset_face_; \ + clazz->get_global_hints = get_global_hints_; \ + clazz->done_global_hints = done_global_hints_; \ + clazz->load_glyph = load_glyph_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ FT_END_HEADER Index: include/freetype/internal/ftcalc.h =================================================================== --- include/freetype/internal/ftcalc.h (revision 58178) +++ include/freetype/internal/ftcalc.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ +/* Copyright 1996-2006, 2008, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -78,8 +78,6 @@ /*************************************************************************/ -#ifdef TT_USE_BYTECODE_INTERPRETER - /*************************************************************************/ /* */ /* <Function> */ @@ -87,7 +85,7 @@ /* */ /* <Description> */ /* A very simple function used to perform the computation `(a*b)/c' */ - /* (without rounding) with maximal accuracy (it uses a 64-bit */ + /* (without rounding) with maximum accuracy (it uses a 64-bit */ /* intermediate integer whenever necessary). */ /* */ /* This function isn't necessarily as fast as some processor specific */ @@ -108,9 +106,7 @@ FT_Long b, FT_Long c ); -#endif /* TT_USE_BYTECODE_INTERPRETER */ - /* * A variant of FT_Matrix_Multiply which scales its result afterwards. * The idea is that both `a' and `b' are scaled by factors of 10 so that Index: include/freetype/internal/ftdriver.h =================================================================== --- include/freetype/internal/ftdriver.h (revision 58178) +++ include/freetype/internal/ftdriver.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType font driver interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2008 by */ +/* Copyright 1996-2003, 2006, 2008, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -162,10 +162,9 @@ /* starting at `first'. The `vertical' flag must */ /* be set to get vertical advance heights. The */ /* `advances' buffer is caller-allocated. */ - /* Currently not implemented. The idea of this */ - /* function is to be able to perform */ - /* device-independent text layout without loading */ - /* a single glyph image. */ + /* The idea of this function is to be able to */ + /* perform device-independent text layout without */ + /* loading a single glyph image. */ /* */ /* request_size :: A handle to a function used to request the new */ /* character size. Can be set to 0 if the */ @@ -182,37 +181,37 @@ /* */ typedef struct FT_Driver_ClassRec_ { - FT_Module_Class root; + FT_Module_Class root; - FT_Long face_object_size; - FT_Long size_object_size; - FT_Long slot_object_size; + FT_Long face_object_size; + FT_Long size_object_size; + FT_Long slot_object_size; - FT_Face_InitFunc init_face; - FT_Face_DoneFunc done_face; + FT_Face_InitFunc init_face; + FT_Face_DoneFunc done_face; - FT_Size_InitFunc init_size; - FT_Size_DoneFunc done_size; + FT_Size_InitFunc init_size; + FT_Size_DoneFunc done_size; - FT_Slot_InitFunc init_slot; - FT_Slot_DoneFunc done_slot; + 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; + FT_Size_ResetPointsFunc set_char_sizes; + FT_Size_ResetPixelsFunc set_pixel_sizes; #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ - FT_Slot_LoadFunc load_glyph; + FT_Slot_LoadFunc load_glyph; - FT_Face_GetKerningFunc get_kerning; - FT_Face_AttachFunc attach_file; - FT_Face_GetAdvancesFunc get_advances; + FT_Face_GetKerningFunc get_kerning; + FT_Face_AttachFunc attach_file; + FT_Face_GetAdvancesFunc get_advances; /* since version 2.2 */ - FT_Size_RequestFunc request_size; - FT_Size_SelectFunc select_size; + FT_Size_RequestFunc request_size; + FT_Size_SelectFunc select_size; } FT_Driver_ClassRec, *FT_Driver_Class; @@ -240,14 +239,15 @@ #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + /*************************************************************************/ /* */ /* <Macro> */ /* FT_DECLARE_DRIVER */ /* */ /* <Description> */ - /* Used to create a forward declaration of a */ - /* FT_Driver_ClassRec stract instance. */ + /* Used to create a forward declaration of an FT_Driver_ClassRec */ + /* struct instance. */ /* */ /* <Macro> */ /* FT_DEFINE_DRIVER */ @@ -255,161 +255,220 @@ /* <Description> */ /* Used to initialize an instance of FT_Driver_ClassRec struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ - /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' function has to be */ + /* called with a pointer where the allocated structure is returned. */ + /* And when it is no longer needed a `destroy' function needs to be */ + /* called to release that allocation. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* `fcinit.c' (ft_create_default_module_classes) already contains a */ + /* mechanism to call these functions for the default modules */ + /* described in `ftmodule.h'. */ + /* */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by driver definition calling `FT_DEFINE_DRIVER' in following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ + /* allocated in the global scope (or the scope where the macro is */ + /* used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ - a_, b_, +#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) \ + a_, b_, #else - #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) +#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) /* empty */ #endif -#define FT_DECLARE_DRIVER(class_) \ - FT_CALLBACK_TABLE \ - const FT_Driver_ClassRec class_; +#define FT_DECLARE_DRIVER( class_ ) \ + 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_, \ + 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_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#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_; +#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_) +#define FT_DEFINE_DRIVERS_OLD_INTERNALS( a_, b_ ) /* empty */ #endif -#define FT_DECLARE_DRIVER(class_) FT_DECLARE_MODULE(class_) +#define FT_DECLARE_DRIVER( class_ ) FT_DECLARE_MODULE( 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_ ) \ - void class_##_pic_free( FT_Library library ); \ - FT_Error class_##_pic_init( FT_Library library ); \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ - class_##_pic_free( library ); \ - if ( dclazz ) \ - FT_FREE( dclazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Driver_Class clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_,interface_, \ - init_,done_,get_interface_) \ - \ - clazz->face_object_size = face_object_size_; \ - clazz->size_object_size = size_object_size_; \ - clazz->slot_object_size = slot_object_size_; \ - \ - clazz->init_face = init_face_; \ - clazz->done_face = done_face_; \ - \ - clazz->init_size = init_size_; \ - clazz->done_size = done_size_; \ - \ - 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_; \ - clazz->attach_file = attach_file_; \ - clazz->get_advances = get_advances_; \ - \ - clazz->request_size = request_size_; \ - clazz->select_size = select_size_; \ - \ - *output_class = (FT_Module_Class*)clazz; \ - return FT_Err_Ok; \ - } +#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_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( dclazz ) \ + FT_FREE( dclazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Driver_Class clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + \ + clazz->face_object_size = face_object_size_; \ + clazz->size_object_size = size_object_size_; \ + clazz->slot_object_size = slot_object_size_; \ + \ + clazz->init_face = init_face_; \ + clazz->done_face = done_face_; \ + \ + clazz->init_size = init_size_; \ + clazz->done_size = done_size_; \ + \ + 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_; \ + clazz->attach_file = attach_file_; \ + clazz->get_advances = get_advances_; \ + \ + clazz->request_size = request_size_; \ + clazz->select_size = select_size_; \ + \ + *output_class = (FT_Module_Class*)clazz; \ + \ + return FT_Err_Ok; \ + } #endif /* FT_CONFIG_OPTION_PIC */ Index: include/freetype/internal/ftobjs.h =================================================================== --- include/freetype/internal/ftobjs.h (revision 58178) +++ include/freetype/internal/ftobjs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType private base classes (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by */ +/* Copyright 1996-2006, 2008, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -206,46 +206,79 @@ } FT_CMap_ClassRec; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_CMAP_CLASS(class_) \ - FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; +#define FT_DECLARE_CMAP_CLASS( class_ ) \ + FT_CALLBACK_TABLE const FT_CMap_ClassRec class_; -#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_, variantchar_list_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_CMap_ClassRec class_ = \ - { \ - size_, init_, done_, char_index_, char_next_, char_var_index_, \ - char_var_default_, variant_list_, charvariant_list_, variantchar_list_ \ +#define FT_DEFINE_CMAP_CLASS( \ + class_, \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_CMap_ClassRec class_ = \ + { \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ \ }; + #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_CMAP_CLASS(class_) \ - void FT_Init_Class_##class_( FT_Library library, FT_CMap_ClassRec* clazz); +#define FT_DECLARE_CMAP_CLASS( class_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_CMap_ClassRec* clazz ); -#define FT_DEFINE_CMAP_CLASS(class_, size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_, variantchar_list_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_CMap_ClassRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->size = size_; \ - clazz->init = init_; \ - clazz->done = done_; \ - clazz->char_index = char_index_; \ - clazz->char_next = char_next_; \ - clazz->char_var_index = char_var_index_; \ - clazz->char_var_default = char_var_default_; \ - clazz->variant_list = variant_list_; \ - clazz->charvariant_list = charvariant_list_; \ - clazz->variantchar_list = variantchar_list_; \ - } +#define FT_DEFINE_CMAP_CLASS( \ + class_, \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_CMap_ClassRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->size = size_; \ + clazz->init = init_; \ + clazz->done = done_; \ + clazz->char_index = char_index_; \ + clazz->char_next = char_next_; \ + clazz->char_var_index = char_var_index_; \ + clazz->char_var_default = char_var_default_; \ + clazz->variant_list = variant_list_; \ + clazz->charvariant_list = charvariant_list_; \ + clazz->variantchar_list = variantchar_list_; \ + } + #endif /* FT_CONFIG_OPTION_PIC */ + /* create a new charmap and add it to charmap->face */ FT_BASE( FT_Error ) FT_CMap_New( FT_CMap_Class clazz, @@ -270,13 +303,13 @@ /* */ /* <Fields> */ /* max_points :: */ - /* The maximal number of points used to store the vectorial outline */ + /* The maximum number of points used to store the vectorial outline */ /* of any glyph in this face. If this value cannot be known in */ /* advance, or if the face isn't scalable, this should be set to 0. */ /* Only relevant for scalable formats. */ /* */ /* max_contours :: */ - /* The maximal number of contours used to store the vectorial */ + /* The maximum number of contours used to store the vectorial */ /* outline of any glyph in this face. If this value cannot be */ /* known in advance, or if the face isn't scalable, this should be */ /* set to 0. Only relevant for scalable formats. */ @@ -411,6 +444,7 @@ /*************************************************************************/ /*************************************************************************/ + /*************************************************************************/ /**** ****/ /**** ****/ /**** M O D U L E S ****/ @@ -436,19 +470,16 @@ /* */ /* memory :: A handle to the memory manager. */ /* */ - /* generic :: A generic structure for user-level extensibility (?). */ - /* */ typedef struct FT_ModuleRec_ { FT_Module_Class* clazz; FT_Library library; FT_Memory memory; - FT_Generic generic; } FT_ModuleRec; - /* typecast an object to a FT_Module */ + /* typecast an object to an FT_Module */ #define FT_MODULE( x ) ((FT_Module)( x )) #define FT_MODULE_CLASS( x ) FT_MODULE( x )->clazz #define FT_MODULE_LIBRARY( x ) FT_MODULE( x )->library @@ -506,7 +537,7 @@ ft_module_get_service( FT_Module module, const char* service_id ); - /* */ + /* */ /*************************************************************************/ @@ -514,7 +545,7 @@ /*************************************************************************/ /**** ****/ /**** ****/ - /**** FACE, SIZE & GLYPH SLOT OBJECTS ****/ + /**** F A C E, S I Z E & G L Y P H S L O T O B J E C T S ****/ /**** ****/ /**** ****/ /*************************************************************************/ @@ -711,10 +742,6 @@ /* faces_list :: The list of faces currently opened by this */ /* driver. */ /* */ - /* extensions :: A typeless pointer to the driver's extensions */ - /* registry, if they are supported through the */ - /* configuration macro FT_CONFIG_OPTION_EXTENSIONS. */ - /* */ /* glyph_loader :: The glyph loader for all faces managed by this */ /* driver. This object isn't defined for unscalable */ /* formats. */ @@ -723,10 +750,7 @@ { FT_ModuleRec root; FT_Driver_Class clazz; - FT_ListRec faces_list; - void* extensions; - FT_GlyphLoader glyph_loader; } FT_DriverRec; @@ -776,9 +800,6 @@ /* memory :: The library's memory object. Manages memory */ /* allocation. */ /* */ - /* generic :: Client data variable. Used to extend the */ - /* Library class by higher levels and clients. */ - /* */ /* version_major :: The major version number of the library. */ /* */ /* version_minor :: The minor version number of the library. */ @@ -838,8 +859,6 @@ { FT_Memory memory; /* library's memory manager */ - FT_Generic generic; - FT_Int version_major; FT_Int version_minor; FT_Int version_patch; @@ -941,12 +960,13 @@ FT_EXPORT_VAR( FT_Raster_Funcs ) ft_default_raster; #endif + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ /**** ****/ /**** ****/ - /**** PIC-Support Macros for ftimage.h ****/ + /**** P I C S U P P O R T ****/ /**** ****/ /**** ****/ /*************************************************************************/ @@ -954,6 +974,9 @@ /*************************************************************************/ + /* PIC support macros for ftimage.h */ + + /*************************************************************************/ /* */ /* <Macro> */ @@ -962,38 +985,57 @@ /* <Description> */ /* Used to initialize an instance of FT_Outline_Funcs struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated structure to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ - cubic_to_, shift_, delta_) \ - static const FT_Outline_Funcs class_ = \ - { \ - move_to_, line_to_, conic_to_, cubic_to_, shift_, delta_ \ +#define FT_DEFINE_OUTLINE_FUNCS( \ + class_, \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ ) \ + static const FT_Outline_Funcs class_ = \ + { \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_OUTLINE_FUNCS(class_, move_to_, line_to_, conic_to_, \ - cubic_to_, shift_, delta_) \ - static FT_Error \ - Init_Class_##class_( FT_Outline_Funcs* clazz ) \ - { \ - clazz->move_to = move_to_; \ - clazz->line_to = line_to_; \ - clazz->conic_to = conic_to_; \ - clazz->cubic_to = cubic_to_; \ - clazz->shift = shift_; \ - clazz->delta = delta_; \ - return FT_Err_Ok; \ - } +#define FT_DEFINE_OUTLINE_FUNCS( \ + class_, \ + move_to_, \ + line_to_, \ + conic_to_, \ + cubic_to_, \ + shift_, \ + delta_ ) \ + static FT_Error \ + Init_Class_ ## class_( FT_Outline_Funcs* clazz ) \ + { \ + clazz->move_to = move_to_; \ + clazz->line_to = line_to_; \ + clazz->conic_to = conic_to_; \ + clazz->cubic_to = cubic_to_; \ + clazz->shift = shift_; \ + clazz->delta = delta_; \ + \ + return FT_Err_Ok; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ + /*************************************************************************/ /* */ /* <Macro> */ @@ -1002,51 +1044,56 @@ /* <Description> */ /* Used to initialize an instance of FT_Raster_Funcs struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated structure to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ - raster_reset_, raster_set_mode_, \ - raster_render_, raster_done_) \ - const FT_Raster_Funcs class_ = \ - { \ - glyph_format_, raster_new_, raster_reset_, \ - raster_set_mode_, raster_render_, raster_done_ \ +#define FT_DEFINE_RASTER_FUNCS( \ + class_, \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ ) \ + const FT_Raster_Funcs class_ = \ + { \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_RASTER_FUNCS(class_, glyph_format_, raster_new_, \ - raster_reset_, raster_set_mode_, raster_render_, raster_done_) \ - void \ - FT_Init_Class_##class_( FT_Raster_Funcs* clazz ) \ - { \ - clazz->glyph_format = glyph_format_; \ - clazz->raster_new = raster_new_; \ - clazz->raster_reset = raster_reset_; \ - clazz->raster_set_mode = raster_set_mode_; \ - clazz->raster_render = raster_render_; \ - clazz->raster_done = raster_done_; \ - } +#define FT_DEFINE_RASTER_FUNCS( \ + class_, \ + glyph_format_, \ + raster_new_, \ + raster_reset_, \ + raster_set_mode_, \ + raster_render_, \ + raster_done_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Raster_Funcs* clazz ) \ + { \ + clazz->glyph_format = glyph_format_; \ + clazz->raster_new = raster_new_; \ + clazz->raster_reset = raster_reset_; \ + clazz->raster_set_mode = raster_set_mode_; \ + clazz->raster_render = raster_render_; \ + clazz->raster_done = raster_done_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** PIC-Support Macros for ftrender.h ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ + /* PIC support macros for ftrender.h */ /*************************************************************************/ @@ -1057,40 +1104,64 @@ /* <Description> */ /* Used to initialize an instance of FT_Glyph_Class struct. */ /* When FT_CONFIG_OPTION_PIC is defined an init funtion will need to */ - /* called with a pre-allocated stracture to be filled. */ + /* be called with a pre-allocated stcture to be filled. */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ /* is used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ - transform_, bbox_, prepare_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Glyph_Class class_ = \ - { \ - size_, format_, init_, done_, copy_, transform_, bbox_, prepare_ \ +#define FT_DEFINE_GLYPH( \ + class_, \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Glyph_Class class_ = \ + { \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_GLYPH(class_, size_, format_, init_, done_, copy_, \ - transform_, bbox_, prepare_) \ - void \ - FT_Init_Class_##class_( FT_Glyph_Class* clazz ) \ - { \ - clazz->glyph_size = size_; \ - clazz->glyph_format = format_; \ - clazz->glyph_init = init_; \ - clazz->glyph_done = done_; \ - clazz->glyph_copy = copy_; \ - clazz->glyph_transform = transform_; \ - clazz->glyph_bbox = bbox_; \ - clazz->glyph_prepare = prepare_; \ - } +#define FT_DEFINE_GLYPH( \ + class_, \ + size_, \ + format_, \ + init_, \ + done_, \ + copy_, \ + transform_, \ + bbox_, \ + prepare_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Glyph_Class* clazz ) \ + { \ + clazz->glyph_size = size_; \ + clazz->glyph_format = format_; \ + clazz->glyph_init = init_; \ + clazz->glyph_done = done_; \ + clazz->glyph_copy = copy_; \ + clazz->glyph_transform = transform_; \ + clazz->glyph_bbox = bbox_; \ + clazz->glyph_prepare = prepare_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ + /*************************************************************************/ /* */ /* <Macro> */ @@ -1098,7 +1169,7 @@ /* */ /* <Description> */ /* Used to create a forward declaration of a */ - /* FT_Renderer_Class stract instance. */ + /* FT_Renderer_Class struct instance. */ /* */ /* <Macro> */ /* FT_DEFINE_RENDERER */ @@ -1106,20 +1177,23 @@ /* <Description> */ /* Used to initialize an instance of FT_Renderer_Class struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion will need */ + /* to be called with a pointer where the allocated structure is */ + /* returned. And when it is no longer needed a `destroy' function */ + /* needs to be called to release that allocation. */ + /* `fcinit.c' (ft_create_default_module_classes) already contains */ /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* described in `ftmodule.h'. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by the renderer definition calling `FT_DEFINE_RENDERER' in the */ + /* following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ @@ -1127,103 +1201,132 @@ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_RENDERER(class_) \ - FT_EXPORT_VAR( const FT_Renderer_Class ) class_; +#define FT_DECLARE_RENDERER( class_ ) \ + FT_EXPORT_VAR( const FT_Renderer_Class ) class_; -#define FT_DEFINE_RENDERER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - glyph_format_, render_glyph_, transform_glyph_, \ - get_glyph_cbox_, set_mode_, raster_class_ ) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Renderer_Class class_ = \ - { \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \ - interface_,init_,done_,get_interface_) \ - glyph_format_, \ - \ - render_glyph_, \ - transform_glyph_, \ - get_glyph_cbox_, \ - set_mode_, \ - \ - raster_class_ \ +#define FT_DEFINE_RENDERER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + glyph_format_, \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + raster_class_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Renderer_Class class_ = \ + { \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + glyph_format_, \ + \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + \ + raster_class_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_RENDERER(class_) FT_DECLARE_MODULE(class_) +#define FT_DECLARE_RENDERER( class_ ) FT_DECLARE_MODULE( class_ ) -#define FT_DEFINE_RENDERER(class_, \ - flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_, \ - glyph_format_, render_glyph_, transform_glyph_, \ - get_glyph_cbox_, set_mode_, raster_class_ ) \ - void class_##_pic_free( FT_Library library ); \ - FT_Error class_##_pic_init( FT_Library library ); \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ - FT_Memory memory = library->memory; \ - class_##_pic_free( library ); \ - if ( rclazz ) \ - FT_FREE( rclazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Renderer_Class* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - FT_DEFINE_ROOT_MODULE(flags_,size_,name_,version_,requires_, \ - interface_,init_,done_,get_interface_) \ - \ - clazz->glyph_format = glyph_format_; \ - \ - clazz->render_glyph = render_glyph_; \ - clazz->transform_glyph = transform_glyph_; \ - clazz->get_glyph_cbox = get_glyph_cbox_; \ - clazz->set_mode = set_mode_; \ - \ - clazz->raster_class = raster_class_; \ - \ - *output_class = (FT_Module_Class*)clazz; \ - return FT_Err_Ok; \ - } +#define FT_DEFINE_RENDERER( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_, \ + glyph_format_, \ + render_glyph_, \ + transform_glyph_, \ + get_glyph_cbox_, \ + set_mode_, \ + raster_class_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Renderer_Class* rclazz = (FT_Renderer_Class*)clazz; \ + FT_Memory memory = library->memory; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( rclazz ) \ + FT_FREE( rclazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Renderer_Class* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + FT_DEFINE_ROOT_MODULE( flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + \ + clazz->glyph_format = glyph_format_; \ + \ + clazz->render_glyph = render_glyph_; \ + clazz->transform_glyph = transform_glyph_; \ + clazz->get_glyph_cbox = get_glyph_cbox_; \ + clazz->set_mode = set_mode_; \ + \ + clazz->raster_class = raster_class_; \ + \ + *output_class = (FT_Module_Class*)clazz; \ + \ + return FT_Err_Ok; \ + } +#endif /* FT_CONFIG_OPTION_PIC */ -#endif /* FT_CONFIG_OPTION_PIC */ + /* PIC support macros for ftmodapi.h **/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - /**** ****/ - /**** ****/ - /**** PIC-Support Macros for ftmodapi.h ****/ - /**** ****/ - /**** ****/ - /*************************************************************************/ - /*************************************************************************/ - /*************************************************************************/ - #ifdef FT_CONFIG_OPTION_PIC /*************************************************************************/ @@ -1262,6 +1365,7 @@ #endif + /*************************************************************************/ /* */ /* <Macro> */ @@ -1269,28 +1373,31 @@ /* */ /* <Description> */ /* Used to create a forward declaration of a */ - /* FT_Module_Class stract instance. */ + /* FT_Module_Class struct instance. */ /* */ /* <Macro> */ /* FT_DEFINE_MODULE */ /* */ /* <Description> */ - /* Used to initialize an instance of FT_Module_Class struct. */ + /* Used to initialize an instance of an FT_Module_Class struct. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated stracture is returned.*/ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ - /* fcinit.c (ft_create_default_module_classes) already contains */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' funtion needs to */ + /* be called with a pointer where the allocated structure is */ + /* returned. And when it is no longer needed a `destroy' function */ + /* needs to be called to release that allocation. */ + /* `fcinit.c' (ft_create_default_module_classes) already contains */ /* a mechanism to call these functions for the default modules */ - /* described in ftmodule.h */ + /* described in `ftmodule.h'. */ /* */ - /* Notice that the created Create and Destroy functions call */ - /* pic_init and pic_free function to allow you to manually allocate */ - /* and initialize any additional global data, like module specific */ + /* Notice that the created `create' and `destroy' functions call */ + /* `pic_init' and `pic_free' to allow you to manually allocate and */ + /* initialize any additional global data, like a module specific */ /* interface, and put them in the global pic container defined in */ - /* ftpic.h. if you don't need them just implement the functions as */ - /* empty to resolve the link error. */ + /* `ftpic.h'. If you don't need them just implement the functions as */ + /* empty to resolve the link error. Also the `pic_init' and */ + /* `pic_free' functions should be declared in `pic.h', to be referred */ + /* by the module definition calling `FT_DEFINE_MODULE' in the */ + /* following. */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ /* allocated in the global scope (or the scope where the macro */ @@ -1300,122 +1407,160 @@ /* FT_DEFINE_ROOT_MODULE */ /* */ /* <Description> */ - /* Used to initialize an instance of FT_Module_Class struct inside */ - /* another stract that contains it or in a function that initializes */ - /* that containing stract */ + /* Used to initialize an instance of an FT_Module_Class struct inside */ + /* another struct that contains it or in a function that initializes */ + /* that containing struct. */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DECLARE_MODULE(class_) \ - FT_CALLBACK_TABLE \ - const FT_Module_Class class_; \ +#define FT_DECLARE_MODULE( class_ ) \ + FT_CALLBACK_TABLE \ + const FT_Module_Class class_; -#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - { \ - flags_, \ - size_, \ - \ - name_, \ - version_, \ - requires_, \ - \ - interface_, \ - \ - init_, \ - done_, \ - get_interface_, \ +#define FT_DEFINE_ROOT_MODULE( \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + { \ + flags_, \ + size_, \ + \ + name_, \ + version_, \ + requires_, \ + \ + interface_, \ + \ + init_, \ + done_, \ + get_interface_, \ }, -#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - FT_CALLBACK_TABLE_DEF \ - const FT_Module_Class class_ = \ - { \ - flags_, \ - size_, \ - \ - name_, \ - version_, \ - requires_, \ - \ - interface_, \ - \ - init_, \ - done_, \ - get_interface_, \ +#define FT_DEFINE_MODULE( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + FT_CALLBACK_TABLE_DEF \ + const FT_Module_Class class_ = \ + { \ + flags_, \ + size_, \ + \ + name_, \ + version_, \ + requires_, \ + \ + interface_, \ + \ + init_, \ + done_, \ + get_interface_, \ }; #else /* FT_CONFIG_OPTION_PIC */ -#define FT_DECLARE_MODULE(class_) \ - FT_Error FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ); \ - void FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ); +#define FT_DECLARE_MODULE( class_ ) \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ); \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ); -#define FT_DEFINE_ROOT_MODULE(flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - clazz->root.module_flags = flags_; \ - clazz->root.module_size = size_; \ - clazz->root.module_name = name_; \ - clazz->root.module_version = version_; \ - clazz->root.module_requires = requires_; \ - \ - clazz->root.module_interface = interface_; \ - \ - clazz->root.module_init = init_; \ - clazz->root.module_done = done_; \ - clazz->root.get_interface = get_interface_; +#define FT_DEFINE_ROOT_MODULE( \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + clazz->root.module_flags = flags_; \ + clazz->root.module_size = size_; \ + clazz->root.module_name = name_; \ + clazz->root.module_version = version_; \ + clazz->root.module_requires = requires_; \ + \ + clazz->root.module_interface = interface_; \ + \ + clazz->root.module_init = init_; \ + clazz->root.module_done = done_; \ + clazz->root.get_interface = get_interface_; -#define FT_DEFINE_MODULE(class_, flags_, size_, name_, version_, requires_, \ - interface_, init_, done_, get_interface_) \ - void class_##_pic_free( FT_Library library ); \ - FT_Error class_##_pic_init( FT_Library library ); \ - \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_Module_Class* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - class_##_pic_free( library ); \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_Module_Class** output_class ) \ - { \ - FT_Memory memory = library->memory; \ - FT_Module_Class* clazz; \ - FT_Error error; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz) ) ) \ - return error; \ - error = class_##_pic_init( library ); \ - if(error) \ - { \ - FT_FREE( clazz ); \ - return error; \ - } \ - \ - clazz->module_flags = flags_; \ - clazz->module_size = size_; \ - clazz->module_name = name_; \ - clazz->module_version = version_; \ - clazz->module_requires = requires_; \ - \ - clazz->module_interface = interface_; \ - \ - clazz->module_init = init_; \ - clazz->module_done = done_; \ - clazz->get_interface = get_interface_; \ - \ - *output_class = clazz; \ - return FT_Err_Ok; \ - } +#define FT_DEFINE_MODULE( \ + class_, \ + flags_, \ + size_, \ + name_, \ + version_, \ + requires_, \ + interface_, \ + init_, \ + done_, \ + get_interface_ ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_Module_Class* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + class_ ## _pic_free( library ); \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_Module_Class** output_class ) \ + { \ + FT_Memory memory = library->memory; \ + FT_Module_Class* clazz = NULL; \ + FT_Error error; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) ) ) \ + return error; \ + error = class_ ## _pic_init( library ); \ + if ( error ) \ + { \ + FT_FREE( clazz ); \ + return error; \ + } \ + \ + clazz->module_flags = flags_; \ + clazz->module_size = size_; \ + clazz->module_name = name_; \ + clazz->module_version = version_; \ + clazz->module_requires = requires_; \ + \ + clazz->module_interface = interface_; \ + \ + clazz->module_init = init_; \ + clazz->module_done = done_; \ + clazz->get_interface = get_interface_; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } #endif /* FT_CONFIG_OPTION_PIC */ Index: include/freetype/internal/ftpic.h =================================================================== --- include/freetype/internal/ftpic.h (revision 58178) +++ include/freetype/internal/ftpic.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services (declaration). */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,34 +26,38 @@ #ifndef __FTPIC_H__ #define __FTPIC_H__ - + FT_BEGIN_HEADER #ifdef FT_CONFIG_OPTION_PIC - typedef struct FT_PIC_Container_ + typedef struct FT_PIC_Container_ { /* pic containers for base */ - void* base; + void* base; + /* pic containers for modules */ - void* autofit; - void* cff; - void* pshinter; - void* psnames; - void* raster; - void* sfnt; - void* smooth; - void* truetype; + void* autofit; + void* cff; + void* pshinter; + void* psnames; + void* raster; + void* sfnt; + void* smooth; + void* truetype; + } FT_PIC_Container; - /* Initialize the various function tables, structs, etc. stored in the container. */ + + /* Initialize the various function tables, structs, etc. */ + /* stored in the container. */ FT_BASE( FT_Error ) - ft_pic_container_init( FT_Library library ); + ft_pic_container_init( FT_Library library ); /* Destroy the contents of the container. */ FT_BASE( void ) - ft_pic_container_destroy( FT_Library library ); + ft_pic_container_destroy( FT_Library library ); #endif /* FT_CONFIG_OPTION_PIC */ Index: include/freetype/internal/ftrfork.h =================================================================== --- include/freetype/internal/ftrfork.h (revision 58178) +++ include/freetype/internal/ftrfork.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Embedded resource forks accessor (specification). */ /* */ -/* Copyright 2004, 2006, 2007 by */ +/* Copyright 2004, 2006, 2007, 2012 by */ /* Masatake YAMATO and Redhat K.K. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -48,7 +48,69 @@ } FT_RFork_Ref; +#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK + typedef FT_Error + (*ft_raccess_guess_func)( FT_Library library, + FT_Stream stream, + char *base_file_name, + char **result_file_name, + FT_Long *result_offset ); + typedef enum FT_RFork_Rule_ { + FT_RFork_Rule_invalid = -2, + FT_RFork_Rule_uknown, /* -1 */ + FT_RFork_Rule_apple_double, + FT_RFork_Rule_apple_single, + FT_RFork_Rule_darwin_ufs_export, + FT_RFork_Rule_darwin_newvfs, + FT_RFork_Rule_darwin_hfsplus, + FT_RFork_Rule_vfat, + FT_RFork_Rule_linux_cap, + FT_RFork_Rule_linux_double, + FT_RFork_Rule_linux_netatalk + } FT_RFork_Rule; + + /* For fast translation between rule index and rule type, + * the macros FT_RFORK_xxx should be kept consistent with + * the raccess_guess_funcs table + */ + typedef struct ft_raccess_guess_rec_ { + ft_raccess_guess_func func; + FT_RFork_Rule type; + } ft_raccess_guess_rec; + +#ifndef FT_CONFIG_OPTION_PIC + + /* this array is a storage in non-PIC mode, so ; is needed in END */ +#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ + const type name[] = { +#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ + { raccess_guess_ ## func_suffix, \ + FT_RFork_Rule_ ## type_suffix }, +#define CONST_FT_RFORK_RULE_ARRAY_END }; + +#else /* FT_CONFIG_OPTION_PIC */ + + /* this array is a function in PIC mode, so no ; is needed in END */ +#define CONST_FT_RFORK_RULE_ARRAY_BEGIN( name, type ) \ + void \ + FT_Init_ ## name( type* storage ) \ + { \ + type* local = storage; \ + \ + \ + int i = 0; +#define CONST_FT_RFORK_RULE_ARRAY_ENTRY( func_suffix, type_suffix ) \ + local[i].func = raccess_guess_ ## func_suffix; \ + local[i].type = FT_RFork_Rule_ ## type_suffix; \ + i++; +#define CONST_FT_RFORK_RULE_ARRAY_END } + +#endif /* FT_CONFIG_OPTION_PIC */ + +#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ + + /*************************************************************************/ /* */ /* <Function> */ Index: include/freetype/internal/ftserv.h =================================================================== --- include/freetype/internal/ftserv.h (revision 58178) +++ include/freetype/internal/ftserv.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType services (specification only). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 2003-2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -92,6 +92,7 @@ #endif /* !C++ */ + /* * @macro: * FT_FACE_FIND_GLOBAL_SERVICE @@ -163,299 +164,372 @@ typedef const FT_ServiceDescRec* FT_ServiceDesc; + /*************************************************************************/ /* */ /* <Macro> */ - /* FT_DEFINE_SERVICEDESCREC1 .. FT_DEFINE_SERVICEDESCREC6 */ + /* FT_DEFINE_SERVICEDESCREC1 */ + /* FT_DEFINE_SERVICEDESCREC2 */ + /* FT_DEFINE_SERVICEDESCREC3 */ + /* FT_DEFINE_SERVICEDESCREC4 */ + /* FT_DEFINE_SERVICEDESCREC5 */ + /* FT_DEFINE_SERVICEDESCREC6 */ /* */ /* <Description> */ - /* Used to initialize an array of FT_ServiceDescRec structs. */ + /* Used to initialize an array of FT_ServiceDescRec structures. */ /* */ - /* When FT_CONFIG_OPTION_PIC is defined a Create funtion will need */ - /* to called with a pointer where the allocated array is returned. */ - /* And when it is no longer needed a Destroy function needs */ - /* to be called to release that allocation. */ + /* When FT_CONFIG_OPTION_PIC is defined a `create' function needs to */ + /* be called with a pointer to return an allocated array. As soon as */ + /* it is no longer needed, a `destroy' function needs to be called to */ + /* release that allocation. */ /* */ - /* These functions should be manyally called from the pic_init and */ - /* pic_free functions of your module (see FT_DEFINE_MODULE) */ + /* These functions should be manually called from the `pic_init' and */ + /* `pic_free' functions of your module (see FT_DEFINE_MODULE). */ /* */ /* When FT_CONFIG_OPTION_PIC is not defined the array will be */ - /* allocated in the global scope (or the scope where the macro */ - /* is used). */ + /* allocated in the global scope (or the scope where the macro is */ + /* used). */ /* */ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1) \ - static const FT_ServiceDescRec class_[] = \ - { \ - {serv_id_1, serv_data_1}, \ - {NULL, NULL} \ +#define FT_DEFINE_SERVICEDESCREC1( class_, \ + serv_id_1, serv_data_1 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { NULL, NULL } \ }; -#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2) \ - static const FT_ServiceDescRec class_[] = \ - { \ - {serv_id_1, serv_data_1}, \ - {serv_id_2, serv_data_2}, \ - {NULL, NULL} \ + +#define FT_DEFINE_SERVICEDESCREC2( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { NULL, NULL } \ }; -#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, serv_id_3, serv_data_3) \ - static const FT_ServiceDescRec class_[] = \ - { \ - {serv_id_1, serv_data_1}, \ - {serv_id_2, serv_data_2}, \ - {serv_id_3, serv_data_3}, \ - {NULL, NULL} \ + +#define FT_DEFINE_SERVICEDESCREC3( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { NULL, NULL } \ }; -#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4) \ - static const FT_ServiceDescRec class_[] = \ - { \ - {serv_id_1, serv_data_1}, \ - {serv_id_2, serv_data_2}, \ - {serv_id_3, serv_data_3}, \ - {serv_id_4, serv_data_4}, \ - {NULL, NULL} \ + +#define FT_DEFINE_SERVICEDESCREC4( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { serv_id_4, serv_data_4 }, \ + { NULL, NULL } \ }; -#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, serv_id_5, serv_data_5) \ - static const FT_ServiceDescRec class_[] = \ - { \ - {serv_id_1, serv_data_1}, \ - {serv_id_2, serv_data_2}, \ - {serv_id_3, serv_data_3}, \ - {serv_id_4, serv_data_4}, \ - {serv_id_5, serv_data_5}, \ - {NULL, NULL} \ + +#define FT_DEFINE_SERVICEDESCREC5( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { serv_id_4, serv_data_4 }, \ + { serv_id_5, serv_data_5 }, \ + { NULL, NULL } \ }; -#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, serv_id_5, serv_data_5, \ - serv_id_6, serv_data_6) \ - static const FT_ServiceDescRec class_[] = \ - { \ - {serv_id_1, serv_data_1}, \ - {serv_id_2, serv_data_2}, \ - {serv_id_3, serv_data_3}, \ - {serv_id_4, serv_data_4}, \ - {serv_id_5, serv_data_5}, \ - {serv_id_6, serv_data_6}, \ - {NULL, NULL} \ + +#define FT_DEFINE_SERVICEDESCREC6( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6 ) \ + static const FT_ServiceDescRec class_[] = \ + { \ + { serv_id_1, serv_data_1 }, \ + { serv_id_2, serv_data_2 }, \ + { serv_id_3, serv_data_3 }, \ + { serv_id_4, serv_data_4 }, \ + { serv_id_5, serv_data_5 }, \ + { serv_id_6, serv_data_6 }, \ + { NULL, NULL } \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICEDESCREC1(class_, serv_id_1, serv_data_1) \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ - { \ - FT_ServiceDescRec* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz)*2 ) ) \ - return error; \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = NULL; \ - clazz[1].serv_data = NULL; \ - *output_class = clazz; \ - return FT_Err_Ok; \ - } +#define FT_DEFINE_SERVICEDESCREC1( class_, \ + serv_id_1, serv_data_1 ) \ + 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 ) * 2 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = NULL; \ + clazz[1].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } -#define FT_DEFINE_SERVICEDESCREC2(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2) \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ - { \ - FT_ServiceDescRec* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz)*3 ) ) \ - return error; \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = NULL; \ - clazz[2].serv_data = NULL; \ - *output_class = clazz; \ - return FT_Err_Ok; \ - } +#define FT_DEFINE_SERVICEDESCREC2( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class ) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 3 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = NULL; \ + clazz[2].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } -#define FT_DEFINE_SERVICEDESCREC3(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, serv_id_3, serv_data_3) \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ - { \ - FT_ServiceDescRec* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz)*4 ) ) \ - return error; \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = NULL; \ - clazz[3].serv_data = NULL; \ - *output_class = clazz; \ - return FT_Err_Ok; \ - } +#define FT_DEFINE_SERVICEDESCREC3( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class ) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 4 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = serv_id_3; \ + clazz[2].serv_data = serv_data_3; \ + clazz[3].serv_id = NULL; \ + clazz[3].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } -#define FT_DEFINE_SERVICEDESCREC4(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4) \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ - { \ - FT_ServiceDescRec* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz)*5 ) ) \ - return error; \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = serv_id_4; \ - clazz[3].serv_data = serv_data_4; \ - clazz[4].serv_id = NULL; \ - clazz[4].serv_data = NULL; \ - *output_class = clazz; \ - return FT_Err_Ok; \ - } +#define FT_DEFINE_SERVICEDESCREC4( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class ) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 5 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = serv_id_3; \ + clazz[2].serv_data = serv_data_3; \ + clazz[3].serv_id = serv_id_4; \ + clazz[3].serv_data = serv_data_4; \ + clazz[4].serv_id = NULL; \ + clazz[4].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } -#define FT_DEFINE_SERVICEDESCREC5(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, serv_id_3, serv_data_3, serv_id_4, \ - serv_data_4, serv_id_5, serv_data_5) \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ - { \ - FT_ServiceDescRec* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz)*6 ) ) \ - return error; \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = serv_id_4; \ - clazz[3].serv_data = serv_data_4; \ - clazz[4].serv_id = serv_id_5; \ - clazz[4].serv_data = serv_data_5; \ - clazz[5].serv_id = NULL; \ - clazz[5].serv_data = NULL; \ - *output_class = clazz; \ - return FT_Err_Ok; \ - } +#define FT_DEFINE_SERVICEDESCREC5( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class ) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 6 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = serv_id_3; \ + clazz[2].serv_data = serv_data_3; \ + clazz[3].serv_id = serv_id_4; \ + clazz[3].serv_data = serv_data_4; \ + clazz[4].serv_id = serv_id_5; \ + clazz[4].serv_data = serv_data_5; \ + clazz[5].serv_id = NULL; \ + clazz[5].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } -#define FT_DEFINE_SERVICEDESCREC6(class_, serv_id_1, serv_data_1, \ - serv_id_2, serv_data_2, serv_id_3, serv_data_3, \ - serv_id_4, serv_data_4, serv_id_5, serv_data_5, \ - serv_id_6, serv_data_6) \ - void \ - FT_Destroy_Class_##class_( FT_Library library, \ - FT_ServiceDescRec* clazz ) \ - { \ - FT_Memory memory = library->memory; \ - if ( clazz ) \ - FT_FREE( clazz ); \ - } \ - \ - FT_Error \ - FT_Create_Class_##class_( FT_Library library, \ - FT_ServiceDescRec** output_class) \ - { \ - FT_ServiceDescRec* clazz; \ - FT_Error error; \ - FT_Memory memory = library->memory; \ - \ - if ( FT_ALLOC( clazz, sizeof(*clazz)*7 ) ) \ - return error; \ - clazz[0].serv_id = serv_id_1; \ - clazz[0].serv_data = serv_data_1; \ - clazz[1].serv_id = serv_id_2; \ - clazz[1].serv_data = serv_data_2; \ - clazz[2].serv_id = serv_id_3; \ - clazz[2].serv_data = serv_data_3; \ - clazz[3].serv_id = serv_id_4; \ - clazz[3].serv_data = serv_data_4; \ - clazz[4].serv_id = serv_id_5; \ - clazz[4].serv_data = serv_data_5; \ - clazz[5].serv_id = serv_id_6; \ - clazz[5].serv_data = serv_data_6; \ - clazz[6].serv_id = NULL; \ - clazz[6].serv_data = NULL; \ - *output_class = clazz; \ - return FT_Err_Ok; \ - } -#endif /* FT_CONFIG_OPTION_PIC */ +#define FT_DEFINE_SERVICEDESCREC6( class_, \ + serv_id_1, serv_data_1, \ + serv_id_2, serv_data_2, \ + serv_id_3, serv_data_3, \ + serv_id_4, serv_data_4, \ + serv_id_5, serv_data_5, \ + serv_id_6, serv_data_6 ) \ + void \ + FT_Destroy_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec* clazz ) \ + { \ + FT_Memory memory = library->memory; \ + \ + \ + if ( clazz ) \ + FT_FREE( clazz ); \ + } \ + \ + FT_Error \ + FT_Create_Class_ ## class_( FT_Library library, \ + FT_ServiceDescRec** output_class) \ + { \ + FT_ServiceDescRec* clazz = NULL; \ + FT_Error error; \ + FT_Memory memory = library->memory; \ + \ + \ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 7 ) ) \ + return error; \ + \ + clazz[0].serv_id = serv_id_1; \ + clazz[0].serv_data = serv_data_1; \ + clazz[1].serv_id = serv_id_2; \ + clazz[1].serv_data = serv_data_2; \ + clazz[2].serv_id = serv_id_3; \ + clazz[2].serv_data = serv_data_3; \ + clazz[3].serv_id = serv_id_4; \ + clazz[3].serv_data = serv_data_4; \ + clazz[4].serv_id = serv_id_5; \ + clazz[4].serv_data = serv_data_5; \ + clazz[5].serv_id = serv_id_6; \ + clazz[5].serv_data = serv_data_6; \ + clazz[6].serv_id = NULL; \ + clazz[6].serv_data = NULL; \ + \ + *output_class = clazz; \ + \ + return FT_Err_Ok; \ + } +#endif /* FT_CONFIG_OPTION_PIC */ + + /* * Parse a list of FT_ServiceDescRec descriptors and look for * a specific service by ID. Note that the last element in the @@ -505,7 +579,7 @@ /* * A magic number used within the services cache. */ -#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)-2) /* magic number */ +#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)~1) /* magic number */ /* @@ -603,6 +677,7 @@ #define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h> #define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h> #define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h> +#define FT_SERVICE_PROPERTIES_H <freetype/internal/services/svprop.h> #define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h> #define FT_SERVICE_TRUETYPE_ENGINE_H <freetype/internal/services/svtteng.h> #define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h> Index: include/freetype/internal/ftstream.h =================================================================== --- include/freetype/internal/ftstream.h (revision 58178) +++ include/freetype/internal/ftstream.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Stream handling (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005, 2006 by */ +/* Copyright 1996-2002, 2004-2006, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -292,18 +292,18 @@ #define FT_GET_CHAR() FT_GET_MACRO( FT_Stream_GetChar, FT_Char ) #define FT_GET_BYTE() FT_GET_MACRO( FT_Stream_GetChar, FT_Byte ) -#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_Short ) -#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetShort, FT_UShort ) -#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_Long ) -#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetOffset, FT_ULong ) -#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetLong, FT_Long ) -#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) -#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetLong, FT_ULong ) +#define FT_GET_SHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_Short ) +#define FT_GET_USHORT() FT_GET_MACRO( FT_Stream_GetUShort, FT_UShort ) +#define FT_GET_OFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_Long ) +#define FT_GET_UOFF3() FT_GET_MACRO( FT_Stream_GetUOffset, FT_ULong ) +#define FT_GET_LONG() FT_GET_MACRO( FT_Stream_GetULong, FT_Long ) +#define FT_GET_ULONG() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong ) +#define FT_GET_TAG4() FT_GET_MACRO( FT_Stream_GetULong, FT_ULong ) -#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_Short ) -#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetShortLE, FT_UShort ) -#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_Long ) -#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetLongLE, FT_ULong ) +#define FT_GET_SHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_Short ) +#define FT_GET_USHORT_LE() FT_GET_MACRO( FT_Stream_GetUShortLE, FT_UShort ) +#define FT_GET_LONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_Long ) +#define FT_GET_ULONG_LE() FT_GET_MACRO( FT_Stream_GetULongLE, FT_ULong ) #endif #define FT_READ_MACRO( func, type, var ) \ @@ -312,17 +312,17 @@ #define FT_READ_BYTE( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Byte, var ) #define FT_READ_CHAR( var ) FT_READ_MACRO( FT_Stream_ReadChar, FT_Char, var ) -#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_Short, var ) -#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadShort, FT_UShort, var ) -#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_Long, var ) -#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadOffset, FT_ULong, var ) -#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_Long, var ) -#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadLong, FT_ULong, var ) +#define FT_READ_SHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_Short, var ) +#define FT_READ_USHORT( var ) FT_READ_MACRO( FT_Stream_ReadUShort, FT_UShort, var ) +#define FT_READ_OFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_Long, var ) +#define FT_READ_UOFF3( var ) FT_READ_MACRO( FT_Stream_ReadUOffset, FT_ULong, var ) +#define FT_READ_LONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_Long, var ) +#define FT_READ_ULONG( var ) FT_READ_MACRO( FT_Stream_ReadULong, FT_ULong, var ) -#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_Short, var ) -#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadShortLE, FT_UShort, var ) -#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_Long, var ) -#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadLongLE, FT_ULong, var ) +#define FT_READ_SHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_Short, var ) +#define FT_READ_USHORT_LE( var ) FT_READ_MACRO( FT_Stream_ReadUShortLE, FT_UShort, var ) +#define FT_READ_LONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_Long, var ) +#define FT_READ_ULONG_LE( var ) FT_READ_MACRO( FT_Stream_ReadULongLE, FT_ULong, var ) #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM @@ -431,25 +431,25 @@ FT_BASE( FT_Char ) FT_Stream_GetChar( FT_Stream stream ); - /* read a 16-bit big-endian integer from an entered frame */ - FT_BASE( FT_Short ) - FT_Stream_GetShort( FT_Stream stream ); + /* read a 16-bit big-endian unsigned integer from an entered frame */ + FT_BASE( FT_UShort ) + FT_Stream_GetUShort( FT_Stream stream ); - /* read a 24-bit big-endian integer from an entered frame */ - FT_BASE( FT_Long ) - FT_Stream_GetOffset( FT_Stream stream ); + /* read a 24-bit big-endian unsigned integer from an entered frame */ + FT_BASE( FT_ULong ) + FT_Stream_GetUOffset( FT_Stream stream ); - /* read a 32-bit big-endian integer from an entered frame */ - FT_BASE( FT_Long ) - FT_Stream_GetLong( FT_Stream stream ); + /* read a 32-bit big-endian unsigned integer from an entered frame */ + FT_BASE( FT_ULong ) + FT_Stream_GetULong( FT_Stream stream ); - /* read a 16-bit little-endian integer from an entered frame */ - FT_BASE( FT_Short ) - FT_Stream_GetShortLE( FT_Stream stream ); + /* read a 16-bit little-endian unsigned integer from an entered frame */ + FT_BASE( FT_UShort ) + FT_Stream_GetUShortLE( FT_Stream stream ); - /* read a 32-bit little-endian integer from an entered frame */ - FT_BASE( FT_Long ) - FT_Stream_GetLongLE( FT_Stream stream ); + /* read a 32-bit little-endian unsigned integer from an entered frame */ + FT_BASE( FT_ULong ) + FT_Stream_GetULongLE( FT_Stream stream ); /* read a byte from a stream */ @@ -457,31 +457,31 @@ FT_Stream_ReadChar( FT_Stream stream, FT_Error* error ); - /* read a 16-bit big-endian integer from a stream */ - FT_BASE( FT_Short ) - FT_Stream_ReadShort( FT_Stream stream, - FT_Error* error ); - - /* read a 24-bit big-endian integer from a stream */ - FT_BASE( FT_Long ) - FT_Stream_ReadOffset( FT_Stream stream, + /* read a 16-bit big-endian unsigned integer from a stream */ + FT_BASE( FT_UShort ) + FT_Stream_ReadUShort( FT_Stream stream, FT_Error* error ); + /* read a 24-bit big-endian unsigned integer from a stream */ + FT_BASE( FT_ULong ) + FT_Stream_ReadUOffset( FT_Stream stream, + FT_Error* error ); + /* read a 32-bit big-endian integer from a stream */ - FT_BASE( FT_Long ) - FT_Stream_ReadLong( FT_Stream stream, - FT_Error* error ); + FT_BASE( FT_ULong ) + FT_Stream_ReadULong( FT_Stream stream, + FT_Error* error ); - /* read a 16-bit little-endian integer from a stream */ - FT_BASE( FT_Short ) - FT_Stream_ReadShortLE( FT_Stream stream, + /* read a 16-bit little-endian unsigned integer from a stream */ + FT_BASE( FT_UShort ) + FT_Stream_ReadUShortLE( FT_Stream stream, + FT_Error* error ); + + /* read a 32-bit little-endian unsigned integer from a stream */ + FT_BASE( FT_ULong ) + FT_Stream_ReadULongLE( FT_Stream stream, FT_Error* error ); - /* read a 32-bit little-endian integer from a stream */ - FT_BASE( FT_Long ) - FT_Stream_ReadLongLE( FT_Stream stream, - FT_Error* error ); - /* Read a structure from a stream. The structure must be described */ /* by an array of FT_Frame_Field records. */ FT_BASE( FT_Error ) Index: include/freetype/internal/fttrace.h =================================================================== --- include/freetype/internal/fttrace.h (revision 58178) +++ include/freetype/internal/fttrace.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Tracing handling (specification only). */ /* */ -/* Copyright 2002, 2004, 2005, 2006, 2007 by */ +/* Copyright 2002, 2004-2007, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -73,6 +73,7 @@ /* PostScript helper module `psaux' */ FT_TRACE_DEF( t1decode ) FT_TRACE_DEF( psobjs ) +FT_TRACE_DEF( psconv ) /* PostScript hinting module `pshinter' */ FT_TRACE_DEF( pshrec ) @@ -135,5 +136,12 @@ FT_TRACE_DEF( gxvprop ) FT_TRACE_DEF( gxvlcar ) + /* autofit components */ +FT_TRACE_DEF( afmodule ) +FT_TRACE_DEF( afhints ) +FT_TRACE_DEF( afcjk ) +FT_TRACE_DEF( aflatin ) +FT_TRACE_DEF( aflatin2 ) +FT_TRACE_DEF( afwarp ) /* END */ Index: include/freetype/internal/psaux.h =================================================================== --- include/freetype/internal/psaux.h (revision 58178) +++ include/freetype/internal/psaux.h (working copy) @@ -5,7 +5,7 @@ /* Auxiliary functions and data structures related to PostScript fonts */ /* (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -225,7 +225,7 @@ T1_Field_ParseFunc reader; FT_UInt offset; /* offset of field in object */ FT_Byte size; /* size of field in bytes */ - FT_UInt array_max; /* maximal number of elements for */ + FT_UInt array_max; /* maximum number of elements for */ /* array */ FT_UInt count_offset; /* offset of element count for */ /* arrays; must not be zero if in */ @@ -531,7 +531,7 @@ /* */ /* max_points :: maximum points in builder outline */ /* */ - /* max_contours :: Maximal number of contours in builder outline. */ + /* max_contours :: Maximum number of contours in builder outline. */ /* */ /* pos_x :: The horizontal translation (if composite glyph). */ /* */ Index: include/freetype/internal/pshints.h =================================================================== --- include/freetype/internal/pshints.h (revision 58178) +++ include/freetype/internal/pshints.h (working copy) @@ -6,7 +6,7 @@ /* recorders (specification only). These are used to support native */ /* T1/T2 hints in the `type1', `cid', and `cff' font drivers. */ /* */ -/* Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2009 by */ +/* Copyright 2001-2003, 2005-2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -679,30 +679,40 @@ typedef PSHinter_Interface* PSHinter_Service; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \ - get_t1_funcs_, get_t2_funcs_) \ - static const PSHinter_Interface class_ = \ - { \ - get_globals_funcs_, get_t1_funcs_, get_t2_funcs_ \ +#define FT_DEFINE_PSHINTER_INTERFACE( \ + class_, \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ ) \ + static const PSHinter_Interface class_ = \ + { \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_PSHINTER_INTERFACE(class_, get_globals_funcs_, \ - get_t1_funcs_, get_t2_funcs_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - PSHinter_Interface* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->get_globals_funcs = get_globals_funcs_; \ - clazz->get_t1_funcs = get_t1_funcs_; \ - clazz->get_t2_funcs = get_t2_funcs_; \ - } +#define FT_DEFINE_PSHINTER_INTERFACE( \ + class_, \ + get_globals_funcs_, \ + get_t1_funcs_, \ + get_t2_funcs_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + PSHinter_Interface* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->get_globals_funcs = get_globals_funcs_; \ + clazz->get_t1_funcs = get_t1_funcs_; \ + clazz->get_t2_funcs = get_t2_funcs_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ FT_END_HEADER Index: include/freetype/internal/services/svbdf.h =================================================================== --- include/freetype/internal/services/svbdf.h (revision 58178) +++ include/freetype/internal/services/svbdf.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType BDF services (specification). */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -45,25 +45,30 @@ FT_BDF_GetPropertyFunc get_property; }; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \ - static const FT_Service_BDFRec class_ = \ +#define FT_DEFINE_SERVICE_BDFRec( class_, \ + get_charset_id_, \ + get_property_ ) \ + static const FT_Service_BDFRec class_ = \ { \ get_charset_id_, get_property_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_BDFRec(class_, get_charset_id_, get_property_) \ +#define FT_DEFINE_SERVICE_BDFRec( class_, \ + get_charset_id_, \ + get_property_ ) \ void \ - FT_Init_Class_##class_( FT_Service_BDFRec* clazz ) \ + FT_Init_Class_ ## class_( FT_Service_BDFRec* clazz ) \ { \ clazz->get_charset_id = get_charset_id_; \ - clazz->get_property = get_property_; \ - } + clazz->get_property = get_property_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svcid.h =================================================================== --- include/freetype/internal/services/svcid.h (revision 58178) +++ include/freetype/internal/services/svcid.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType CID font services (specification). */ /* */ -/* Copyright 2007, 2009 by Derek Clegg, Michael Toftdal. */ +/* Copyright 2007, 2009, 2012 by Derek Clegg, Michael Toftdal. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -46,30 +46,36 @@ FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index; }; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_, \ - get_is_cid_, get_cid_from_glyph_index_ ) \ - static const FT_Service_CIDRec class_ = \ - { \ - get_ros_, get_is_cid_, get_cid_from_glyph_index_ \ +#define FT_DEFINE_SERVICE_CIDREC( class_, \ + get_ros_, \ + get_is_cid_, \ + get_cid_from_glyph_index_ ) \ + static const FT_Service_CIDRec class_ = \ + { \ + get_ros_, get_is_cid_, get_cid_from_glyph_index_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_CIDREC(class_, get_ros_, \ - get_is_cid_, get_cid_from_glyph_index_ ) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_Service_CIDRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->get_ros = get_ros_; \ - clazz->get_is_cid = get_is_cid_; \ - clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \ - } +#define FT_DEFINE_SERVICE_CIDREC( class_, \ + get_ros_, \ + get_is_cid_, \ + get_cid_from_glyph_index_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_Service_CIDRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->get_ros = get_ros_; \ + clazz->get_is_cid = get_is_cid_; \ + clazz->get_cid_from_glyph_index = get_cid_from_glyph_index_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svgldict.h =================================================================== --- include/freetype/internal/services/svgldict.h (revision 58178) +++ include/freetype/internal/services/svgldict.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph dictionary services (specification). */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -51,27 +51,33 @@ FT_GlyphDict_NameIndexFunc name_index; /* optional */ }; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \ - static const FT_Service_GlyphDictRec class_ = \ +#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ + get_name_, \ + name_index_) \ + static const FT_Service_GlyphDictRec class_ = \ { \ get_name_, name_index_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_GLYPHDICTREC(class_, get_name_, name_index_) \ +#define FT_DEFINE_SERVICE_GLYPHDICTREC( class_, \ + get_name_, \ + name_index_) \ void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_Service_GlyphDictRec* clazz) \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_Service_GlyphDictRec* clazz ) \ { \ - FT_UNUSED(library); \ - clazz->get_name = get_name_; \ + FT_UNUSED( library ); \ + \ + clazz->get_name = get_name_; \ clazz->name_index = name_index_; \ - } + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svmm.h =================================================================== --- include/freetype/internal/services/svmm.h (revision 58178) +++ include/freetype/internal/services/svmm.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType Multiple Masters and GX var services (specification). */ /* */ -/* Copyright 2003, 2004 by */ +/* Copyright 2003, 2004, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -68,30 +68,39 @@ FT_Set_Var_Design_Func set_var_design; }; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_, \ - set_mm_blend_, get_mm_var_, set_var_design_) \ - static const FT_Service_MultiMastersRec class_ = \ - { \ - get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_ \ +#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_var_, \ + set_var_design_ ) \ + static const FT_Service_MultiMastersRec class_ = \ + { \ + get_mm_, set_mm_design_, set_mm_blend_, get_mm_var_, set_var_design_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_MULTIMASTERSREC(class_, get_mm_, set_mm_design_, \ - set_mm_blend_, get_mm_var_, set_var_design_) \ - void \ - FT_Init_Class_##class_( FT_Service_MultiMastersRec* clazz ) \ - { \ - clazz->get_mm = get_mm_; \ - clazz->set_mm_design = set_mm_design_; \ - clazz->set_mm_blend = set_mm_blend_; \ - clazz->get_mm_var = get_mm_var_; \ - clazz->set_var_design = set_var_design_; \ - } +#define FT_DEFINE_SERVICE_MULTIMASTERSREC( class_, \ + get_mm_, \ + set_mm_design_, \ + set_mm_blend_, \ + get_mm_var_, \ + set_var_design_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Service_MultiMastersRec* clazz ) \ + { \ + clazz->get_mm = get_mm_; \ + clazz->set_mm_design = set_mm_design_; \ + clazz->set_mm_blend = set_mm_blend_; \ + clazz->get_mm_var = get_mm_var_; \ + clazz->set_var_design = set_var_design_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svpostnm.h =================================================================== --- include/freetype/internal/services/svpostnm.h (revision 58178) +++ include/freetype/internal/services/svpostnm.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript name services (specification). */ /* */ -/* Copyright 2003, 2007 by */ +/* Copyright 2003, 2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -46,26 +46,28 @@ FT_PsName_GetFunc get_ps_font_name; }; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \ - static const FT_Service_PsFontNameRec class_ = \ - { \ - get_ps_font_name_ \ +#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \ + static const FT_Service_PsFontNameRec class_ = \ + { \ + get_ps_font_name_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_PSFONTNAMEREC(class_, get_ps_font_name_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_Service_PsFontNameRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->get_ps_font_name = get_ps_font_name_; \ - } +#define FT_DEFINE_SERVICE_PSFONTNAMEREC( class_, get_ps_font_name_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_Service_PsFontNameRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->get_ps_font_name = get_ps_font_name_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svprop.h =================================================================== --- include/freetype/internal/services/svprop.h (revision 0) +++ include/freetype/internal/services/svprop.h (working copy) @@ -0,0 +1,81 @@ +/***************************************************************************/ +/* */ +/* svprop.h */ +/* */ +/* The FreeType property service (specification). */ +/* */ +/* Copyright 2012 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 __SVPROP_H__ +#define __SVPROP_H__ + + +FT_BEGIN_HEADER + + +#define FT_SERVICE_ID_PROPERTIES "properties" + + + typedef FT_Error + (*FT_Properties_SetFunc)( FT_Module module, + const char* property_name, + const void* value ); + + typedef FT_Error + (*FT_Properties_GetFunc)( FT_Module module, + const char* property_name, + void* value ); + + + FT_DEFINE_SERVICE( Properties ) + { + FT_Properties_SetFunc set_property; + FT_Properties_GetFunc get_property; + }; + + +#ifndef FT_CONFIG_OPTION_PIC + +#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \ + set_property_, \ + get_property_ ) \ + static const FT_Service_PropertiesRec class_ = \ + { \ + set_property_, \ + get_property_ \ + }; + +#else /* FT_CONFIG_OPTION_PIC */ + +#define FT_DEFINE_SERVICE_PROPERTIESREC( class_, \ + set_property_, \ + get_property_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Service_PropertiesRec* clazz ) \ + { \ + clazz->set_property = set_property_; \ + clazz->get_property = get_property_; \ + } + +#endif /* FT_CONFIG_OPTION_PIC */ + + /* */ + + +FT_END_HEADER + + +#endif /* __SVPROP_H__ */ + + +/* END */ Index: include/freetype/internal/services/svpscmap.h =================================================================== --- include/freetype/internal/services/svpscmap.h (revision 58178) +++ include/freetype/internal/services/svpscmap.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript charmap service (specification). */ /* */ -/* Copyright 2003, 2006 by */ +/* Copyright 2003, 2006, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -120,37 +120,50 @@ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_PSCMAPSREC(class_, unicode_value_, unicodes_init_, \ - unicodes_char_index_, unicodes_char_next_, macintosh_name_, \ - adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_) \ - static const FT_Service_PsCMapsRec class_ = \ - { \ - unicode_value_, unicodes_init_, \ - unicodes_char_index_, unicodes_char_next_, macintosh_name_, \ - adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \ +#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \ + unicode_value_, \ + unicodes_init_, \ + unicodes_char_index_, \ + unicodes_char_next_, \ + macintosh_name_, \ + adobe_std_strings_, \ + adobe_std_encoding_, \ + adobe_expert_encoding_ ) \ + static const FT_Service_PsCMapsRec class_ = \ + { \ + unicode_value_, unicodes_init_, \ + unicodes_char_index_, unicodes_char_next_, macintosh_name_, \ + adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_PSCMAPSREC(class_, unicode_value_, unicodes_init_, \ - unicodes_char_index_, unicodes_char_next_, macintosh_name_, \ - adobe_std_strings_, adobe_std_encoding_, adobe_expert_encoding_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_Service_PsCMapsRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->unicode_value = unicode_value_; \ - clazz->unicodes_init = unicodes_init_; \ - clazz->unicodes_char_index = unicodes_char_index_; \ - clazz->unicodes_char_next = unicodes_char_next_; \ - clazz->macintosh_name = macintosh_name_; \ - clazz->adobe_std_strings = adobe_std_strings_; \ - clazz->adobe_std_encoding = adobe_std_encoding_; \ - clazz->adobe_expert_encoding = adobe_expert_encoding_; \ - } +#define FT_DEFINE_SERVICE_PSCMAPSREC( class_, \ + unicode_value_, \ + unicodes_init_, \ + unicodes_char_index_, \ + unicodes_char_next_, \ + macintosh_name_, \ + adobe_std_strings_, \ + adobe_std_encoding_, \ + adobe_expert_encoding_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_Service_PsCMapsRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->unicode_value = unicode_value_; \ + clazz->unicodes_init = unicodes_init_; \ + clazz->unicodes_char_index = unicodes_char_index_; \ + clazz->unicodes_char_next = unicodes_char_next_; \ + clazz->macintosh_name = macintosh_name_; \ + clazz->adobe_std_strings = adobe_std_strings_; \ + clazz->adobe_std_encoding = adobe_std_encoding_; \ + clazz->adobe_expert_encoding = adobe_expert_encoding_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svpsinfo.h =================================================================== --- include/freetype/internal/services/svpsinfo.h (revision 58178) +++ include/freetype/internal/services/svpsinfo.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType PostScript info service (specification). */ /* */ -/* Copyright 2003, 2004, 2009 by */ +/* Copyright 2003, 2004, 2009, 2011, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,47 +38,66 @@ PS_FontExtraRec* afont_extra ); typedef FT_Int - (*PS_HasGlyphNamesFunc)( FT_Face face ); + (*PS_HasGlyphNamesFunc)( FT_Face face ); typedef FT_Error (*PS_GetFontPrivateFunc)( FT_Face face, PS_PrivateRec* afont_private ); + typedef FT_Long + (*PS_GetFontValueFunc)( FT_Face face, + PS_Dict_Keys key, + FT_UInt idx, + void *value, + FT_Long value_len ); + FT_DEFINE_SERVICE( PsInfo ) { PS_GetFontInfoFunc ps_get_font_info; PS_GetFontExtraFunc ps_get_font_extra; PS_HasGlyphNamesFunc ps_has_glyph_names; PS_GetFontPrivateFunc ps_get_font_private; + PS_GetFontValueFunc ps_get_font_value; }; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_, \ - ps_get_font_extra_, has_glyph_names_, get_font_private_) \ - static const FT_Service_PsInfoRec class_ = \ +#define FT_DEFINE_SERVICE_PSINFOREC( class_, \ + get_font_info_, \ + ps_get_font_extra_, \ + has_glyph_names_, \ + get_font_private_, \ + get_font_value_ ) \ + static const FT_Service_PsInfoRec class_ = \ { \ get_font_info_, ps_get_font_extra_, has_glyph_names_, \ - get_font_private_ \ + get_font_private_, get_font_value_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_PSINFOREC(class_, get_font_info_, \ - ps_get_font_extra_, has_glyph_names_, get_font_private_) \ +#define FT_DEFINE_SERVICE_PSINFOREC( class_, \ + get_font_info_, \ + ps_get_font_extra_, \ + has_glyph_names_, \ + get_font_private_, \ + get_font_value_ ) \ void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_Service_PsInfoRec* clazz) \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_Service_PsInfoRec* clazz ) \ { \ - FT_UNUSED(library); \ - clazz->ps_get_font_info = get_font_info_; \ - clazz->ps_get_font_extra = ps_get_font_extra_; \ - clazz->ps_has_glyph_names = has_glyph_names_; \ + FT_UNUSED( library ); \ + \ + clazz->ps_get_font_info = get_font_info_; \ + clazz->ps_get_font_extra = ps_get_font_extra_; \ + clazz->ps_has_glyph_names = has_glyph_names_; \ clazz->ps_get_font_private = get_font_private_; \ - } + clazz->ps_get_font_value = get_font_value_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svsfnt.h =================================================================== --- include/freetype/internal/services/svsfnt.h (revision 58178) +++ include/freetype/internal/services/svsfnt.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType SFNT table loading service (specification). */ /* */ -/* Copyright 2003, 2004 by */ +/* Copyright 2003, 2004, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -69,26 +69,27 @@ FT_SFNT_TableInfoFunc table_info; }; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \ - static const FT_Service_SFNT_TableRec class_ = \ - { \ - load_, get_, info_ \ +#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \ + static const FT_Service_SFNT_TableRec class_ = \ + { \ + load_, get_, info_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_SFNT_TABLEREC(class_, load_, get_, info_) \ - void \ - FT_Init_Class_##class_( FT_Service_SFNT_TableRec* clazz ) \ - { \ - clazz->load_table = load_; \ - clazz->get_table = get_; \ - clazz->table_info = info_; \ - } +#define FT_DEFINE_SERVICE_SFNT_TABLEREC( class_, load_, get_, info_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Service_SFNT_TableRec* clazz ) \ + { \ + clazz->load_table = load_; \ + clazz->get_table = get_; \ + clazz->table_info = info_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svttcmap.h =================================================================== --- include/freetype/internal/services/svttcmap.h (revision 58178) +++ include/freetype/internal/services/svttcmap.h (working copy) @@ -7,7 +7,7 @@ /* Copyright 2003 by */ /* Masatake YAMATO, Redhat K.K. */ /* */ -/* Copyright 2003, 2008 by */ +/* Copyright 2003, 2008, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -31,7 +31,7 @@ FT_BEGIN_HEADER -#define FT_SERVICE_ID_TT_CMAP "tt-cmaps" +#define FT_SERVICE_ID_TT_CMAP "tt-cmaps" /*************************************************************************/ @@ -58,8 +58,8 @@ /* */ typedef struct TT_CMapInfo_ { - FT_ULong language; - FT_Long format; + FT_ULong language; + FT_Long format; } TT_CMapInfo; @@ -76,24 +76,25 @@ #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \ - static const FT_Service_TTCMapsRec class_ = \ - { \ - get_cmap_info_ \ +#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \ + static const FT_Service_TTCMapsRec class_ = \ + { \ + get_cmap_info_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_TTCMAPSREC(class_, get_cmap_info_) \ - void \ - FT_Init_Class_##class_( FT_Library library, \ - FT_Service_TTCMapsRec* clazz) \ - { \ - FT_UNUSED(library); \ - clazz->get_cmap_info = get_cmap_info_; \ - } +#define FT_DEFINE_SERVICE_TTCMAPSREC( class_, get_cmap_info_ ) \ + void \ + FT_Init_Class_ ## class_( FT_Library library, \ + FT_Service_TTCMapsRec* clazz ) \ + { \ + FT_UNUSED( library ); \ + \ + clazz->get_cmap_info = get_cmap_info_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/services/svttglyf.h =================================================================== --- include/freetype/internal/services/svttglyf.h (revision 58178) +++ include/freetype/internal/services/svttglyf.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType TrueType glyph service. */ /* */ -/* Copyright 2007 by David Turner. */ +/* Copyright 2007, 2009, 2012 by David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -24,7 +24,7 @@ FT_BEGIN_HEADER -#define FT_SERVICE_ID_TT_GLYF "tt-glyf" +#define FT_SERVICE_ID_TT_GLYF "tt-glyf" typedef FT_ULong @@ -37,24 +37,25 @@ TT_Glyf_GetLocationFunc get_location; }; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ ) \ - static const FT_Service_TTGlyfRec class_ = \ +#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \ + static const FT_Service_TTGlyfRec class_ = \ { \ get_location_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_SERVICE_TTGLYFREC(class_, get_location_ ) \ +#define FT_DEFINE_SERVICE_TTGLYFREC( class_, get_location_ ) \ void \ - FT_Init_Class_##class_( FT_Service_TTGlyfRec* clazz ) \ + FT_Init_Class_ ## class_( FT_Service_TTGlyfRec* clazz ) \ { \ clazz->get_location = get_location_; \ - } + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: include/freetype/internal/sfnt.h =================================================================== --- include/freetype/internal/sfnt.h (revision 58178) +++ include/freetype/internal/sfnt.h (working copy) @@ -4,7 +4,7 @@ /* */ /* High-level `sfnt' driver interface (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */ +/* Copyright 1996-2006, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -756,139 +756,216 @@ #ifndef FT_CONFIG_OPTION_PIC #ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) \ - a, +#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a ) \ + a, #else - #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a) +#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_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_ ) \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ #ifdef FT_CONFIG_OPTION_OLD_INTERNALS -#define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) \ - clazz->a = a_; +#define FT_DEFINE_DRIVERS_OLD_INTERNAL( a, a_ ) \ + clazz->a = a_; #else - #define FT_DEFINE_DRIVERS_OLD_INTERNAL(a, a_) +#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_INTERNAL( a, a_ ) \ + clazz->a = a_; -#endif /* FT_CONFIG_OPTION_PIC */ +#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_ ) \ + } +#endif /* FT_CONFIG_OPTION_PIC */ + FT_END_HEADER #endif /* __SFNT_H__ */ Index: include/freetype/internal/t1types.h =================================================================== --- include/freetype/internal/t1types.h (revision 58178) +++ include/freetype/internal/t1types.h (working copy) @@ -5,7 +5,7 @@ /* Basic Type1/Type2 type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -78,17 +78,6 @@ } T1_EncodingRec, *T1_Encoding; - typedef enum T1_EncodingType_ - { - T1_ENCODING_TYPE_NONE = 0, - T1_ENCODING_TYPE_ARRAY, - T1_ENCODING_TYPE_STANDARD, - T1_ENCODING_TYPE_ISOLATIN1, - T1_ENCODING_TYPE_EXPERT - - } T1_EncodingType; - - /* used to hold extra data of PS_FontInfoRec that * cannot be stored in the publicly defined structure. * Index: include/freetype/internal/tttypes.h =================================================================== --- include/freetype/internal/tttypes.h (revision 58178) +++ include/freetype/internal/tttypes.h (working copy) @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2002, 2004-2008, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1401,7 +1401,7 @@ FT_Byte* vert_metrics; FT_ULong vert_metrics_size; - FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */ + FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */ FT_Byte* glyph_locations; FT_Byte* hdmx_table; @@ -1443,7 +1443,7 @@ /* <Fields> */ /* memory :: A handle to the memory manager. */ /* */ - /* max_points :: The maximal size in points of the zone. */ + /* max_points :: The maximum size in points of the zone. */ /* */ /* max_contours :: Max size in links contours of the zone. */ /* */ Index: include/freetype/t1tables.h =================================================================== --- include/freetype/t1tables.h (revision 58178) +++ include/freetype/t1tables.h (working copy) @@ -5,7 +5,7 @@ /* Basic Type 1/Type 2 tables definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -493,9 +493,167 @@ FT_Get_PS_Font_Private( FT_Face face, PS_Private afont_private ); + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* T1_EncodingType */ + /* */ + /* <Description> */ + /* An enumeration describing the `Encoding' entry in a Type 1 */ + /* dictionary. */ + /* */ + typedef enum T1_EncodingType_ + { + T1_ENCODING_TYPE_NONE = 0, + T1_ENCODING_TYPE_ARRAY, + T1_ENCODING_TYPE_STANDARD, + T1_ENCODING_TYPE_ISOLATIN1, + T1_ENCODING_TYPE_EXPERT + + } T1_EncodingType; + + + /*************************************************************************/ + /* */ + /* <Enum> */ + /* PS_Dict_Keys */ + /* */ + /* <Description> */ + /* An enumeration used in calls to @FT_Get_PS_Font_Value to identify */ + /* the Type~1 dictionary entry to retrieve. */ + /* */ + typedef enum PS_Dict_Keys_ + { + /* conventionally in the font dictionary */ + PS_DICT_FONT_TYPE, /* FT_Byte */ + PS_DICT_FONT_MATRIX, /* FT_Fixed */ + PS_DICT_FONT_BBOX, /* FT_Fixed */ + PS_DICT_PAINT_TYPE, /* FT_Byte */ + PS_DICT_FONT_NAME, /* FT_String* */ + PS_DICT_UNIQUE_ID, /* FT_Int */ + PS_DICT_NUM_CHAR_STRINGS, /* FT_Int */ + PS_DICT_CHAR_STRING_KEY, /* FT_String* */ + PS_DICT_CHAR_STRING, /* FT_String* */ + PS_DICT_ENCODING_TYPE, /* T1_EncodingType */ + PS_DICT_ENCODING_ENTRY, /* FT_String* */ + + /* conventionally in the font Private dictionary */ + PS_DICT_NUM_SUBRS, /* FT_Int */ + PS_DICT_SUBR, /* FT_String* */ + PS_DICT_STD_HW, /* FT_UShort */ + PS_DICT_STD_VW, /* FT_UShort */ + PS_DICT_NUM_BLUE_VALUES, /* FT_Byte */ + PS_DICT_BLUE_VALUE, /* FT_Short */ + PS_DICT_BLUE_FUZZ, /* FT_Int */ + PS_DICT_NUM_OTHER_BLUES, /* FT_Byte */ + PS_DICT_OTHER_BLUE, /* FT_Short */ + PS_DICT_NUM_FAMILY_BLUES, /* FT_Byte */ + PS_DICT_FAMILY_BLUE, /* FT_Short */ + PS_DICT_NUM_FAMILY_OTHER_BLUES, /* FT_Byte */ + PS_DICT_FAMILY_OTHER_BLUE, /* FT_Short */ + PS_DICT_BLUE_SCALE, /* FT_Fixed */ + PS_DICT_BLUE_SHIFT, /* FT_Int */ + PS_DICT_NUM_STEM_SNAP_H, /* FT_Byte */ + PS_DICT_STEM_SNAP_H, /* FT_Short */ + PS_DICT_NUM_STEM_SNAP_V, /* FT_Byte */ + PS_DICT_STEM_SNAP_V, /* FT_Short */ + PS_DICT_FORCE_BOLD, /* FT_Bool */ + PS_DICT_RND_STEM_UP, /* FT_Bool */ + PS_DICT_MIN_FEATURE, /* FT_Short */ + PS_DICT_LEN_IV, /* FT_Int */ + PS_DICT_PASSWORD, /* FT_Long */ + PS_DICT_LANGUAGE_GROUP, /* FT_Long */ + + /* conventionally in the font FontInfo dictionary */ + PS_DICT_VERSION, /* FT_String* */ + PS_DICT_NOTICE, /* FT_String* */ + PS_DICT_FULL_NAME, /* FT_String* */ + PS_DICT_FAMILY_NAME, /* FT_String* */ + PS_DICT_WEIGHT, /* FT_String* */ + PS_DICT_IS_FIXED_PITCH, /* FT_Bool */ + PS_DICT_UNDERLINE_POSITION, /* FT_Short */ + PS_DICT_UNDERLINE_THICKNESS, /* FT_UShort */ + PS_DICT_FS_TYPE, /* FT_UShort */ + PS_DICT_ITALIC_ANGLE, /* FT_Long */ + + PS_DICT_MAX = PS_DICT_ITALIC_ANGLE + + } PS_Dict_Keys; + + + /************************************************************************ + * + * @function: + * FT_Get_PS_Font_Value + * + * @description: + * Retrieve the value for the supplied key from a PostScript font. + * + * @input: + * face :: + * PostScript face handle. + * + * key :: + * An enumeration value representing the dictionary key to retrieve. + * + * idx :: + * For array values, this specifies the index to be returned. + * + * value :: + * A pointer to memory into which to write the value. + * + * valen_len :: + * The size, in bytes, of the memory supplied for the value. + * + * @output: + * value :: + * The value matching the above key, if it exists. + * + * @return: + * The amount of memory (in bytes) required to hold the requested + * value (if it exists, -1 otherwise). + * + * @note: + * The values returned are not pointers into the internal structures of + * the face, but are `fresh' copies, so that the memory containing them + * belongs to the calling application. This also enforces the + * `read-only' nature of these values, i.e., this function cannot be + * used to manipulate the face. + * + * `value' is a void pointer because the values returned can be of + * various types. + * + * If either `value' is NULL or `value_len' is too small, just the + * required memory size for the requested entry is returned. + * + * The `idx' parameter is used, not only to retrieve elements of, for + * example, the FontMatrix or FontBBox, but also to retrieve name keys + * from the CharStrings dictionary, and the charstrings themselves. It + * is ignored for atomic values. + * + * PS_DICT_BLUE_SCALE returns a value that is scaled up by 1000. To + * get the value as in the font stream, you need to divide by + * 65536000.0 (to remove the FT_Fixed scale, and the x1000 scale). + * + * IMPORTANT: Only key/value pairs read by the FreeType interpreter can + * be retrieved. So, for example, PostScript procedures such as NP, + * ND, and RD are not available. Arbitrary keys are, obviously, not be + * available either. + * + * If the font's format is not PostScript-based, this function returns + * the `FT_Err_Invalid_Argument' error code. + * + */ + FT_EXPORT( FT_Long ) + FT_Get_PS_Font_Value( FT_Face face, + PS_Dict_Keys key, + FT_UInt idx, + void *value, + FT_Long value_len ); + /* */ - FT_END_HEADER #endif /* __T1TABLES_H__ */ Index: include/freetype/ttnameid.h =================================================================== --- include/freetype/ttnameid.h (revision 58178) +++ include/freetype/ttnameid.h (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueType name ID definitions (specification only). */ /* */ -/* Copyright 1996-2002, 2003, 2004, 2006, 2007, 2008 by */ +/* Copyright 1996-2004, 2006-2008, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -316,11 +316,12 @@ /* */ /* Possible values of the language identifier field in the name records */ /* of the TTF `name' table if the `platform' identifier code is */ - /* TT_PLATFORM_MACINTOSH. */ + /* TT_PLATFORM_MACINTOSH. These values are also used as return values */ + /* for function @FT_Get_CMap_Language_ID. */ /* */ /* The canonical source for the Apple assigned Language ID's is at */ /* */ - /* http://fonts.apple.com/TTRefMan/RM06/Chap6name.html */ + /* https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html */ /* */ #define TT_MAC_LANGID_ENGLISH 0 #define TT_MAC_LANGID_FRENCH 1 @@ -461,21 +462,10 @@ /* of the TTF `name' table if the `platform' identifier code is */ /* TT_PLATFORM_MICROSOFT. */ /* */ - /* The canonical source for the MS assigned LCID's (seems to) be at */ + /* The canonical source for the MS assigned LCIDs is */ /* */ /* http://www.microsoft.com/globaldev/reference/lcid-all.mspx */ /* */ - /* It used to be at various places, among them */ - /* */ - /* http://www.microsoft.com/typography/OTSPEC/lcid-cp.txt */ - /* http://www.microsoft.com/globaldev/reference/loclanghome.asp */ - /* http://support.microsoft.com/support/kb/articles/Q224/8/04.ASP */ - /* http://msdn.microsoft.com/library/en-us/passport25/ */ - /* NET_Passport_VBScript_Documentation/Single_Sign_In/ */ - /* Advanced_Single_Sign_In/Localization_and_LCIDs.asp */ - /* */ - /* Hopefully, it seems now that the Globaldev site prevails... */ - /* (updated by Antoine, 2004-02-17) */ #define TT_MS_LANGID_ARABIC_GENERAL 0x0001 #define TT_MS_LANGID_ARABIC_SAUDI_ARABIA 0x0401 Index: include/freetype/tttables.h =================================================================== --- include/freetype/tttables.h (revision 58178) +++ include/freetype/tttables.h (working copy) @@ -5,7 +5,7 @@ /* Basic SFNT/TrueType tables definitions and interface */ /* (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010 by */ +/* Copyright 1996-2005, 2008-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -600,6 +600,16 @@ /* by the sfnt, truetype, and opentype drivers. See @FT_Sfnt_Tag for */ /* a list. */ /* */ + /* Here an example how to access the `vhea' table: */ + /* */ + /* { */ + /* TT_VertHeader* vert_header; */ + /* */ + /* */ + /* vert_header = */ + /* (TT_VertHeader*)FT_Get_Sfnt_Table( face, ft_sfnt_vhea ); */ + /* } */ + /* */ FT_EXPORT( void* ) FT_Get_Sfnt_Table( FT_Face face, FT_Sfnt_Tag tag ); @@ -687,18 +697,23 @@ * The index of an SFNT table. The function returns * FT_Err_Table_Missing for an invalid value. * - * @output: + * @inout: * tag :: - * The name tag of the SFNT table. + * The name tag of the SFNT table. If the value is NULL, `table_index' + * is ignored, and `length' returns the number of SFNT tables in the + * font. * + * @output: * length :: - * The length of the SFNT table. + * The length of the SFNT table (or the number of SFNT tables, depending + * on `tag'). * * @return: * FreeType error code. 0~means success. * * @note: - * SFNT tables with length zero are treated as missing. + * While parsing fonts, FreeType handles SFNT tables with length zero as + * missing. * */ FT_EXPORT( FT_Error ) @@ -725,6 +740,9 @@ /* The language ID of `charmap'. If `charmap' doesn't belong to a */ /* TrueType/sfnt face, just return~0 as the default value. */ /* */ + /* For a format~14 cmap (to access Unicode IVS), the return value is */ + /* 0xFFFFFFFF. */ + /* */ FT_EXPORT( FT_ULong ) FT_Get_CMap_Language_ID( FT_CharMap charmap ); Index: Jamfile =================================================================== --- Jamfile (revision 58178) +++ Jamfile (working copy) @@ -1,6 +1,6 @@ # FreeType 2 top Jamfile. # -# Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by +# Copyright 2001-2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -76,9 +76,10 @@ cache # cache sub-system cff # CFF/CEF font driver cid # PostScript CID-keyed font driver - gzip # support for gzip-compressed files - lzw # support for LZW-compressed files pcf # PCF font driver + bzip2 # support for bzip2-compressed PCF font + gzip # support for gzip-compressed PCF font + lzw # support for LZW-compressed PCF font pfr # PFR/TrueDoc font driver psaux # common PostScript routines module pshinter # PostScript hinter module @@ -194,7 +195,7 @@ actions RefDoc { - python $(FT2_SRC)/tools/docmaker/docmaker.py --prefix=ft2 --title=FreeType-2.4.4 --output=$(DOC_DIR) $(FT2_INCLUDE)/freetype/*.h $(FT2_INCLUDE)/freetype/config/*.h + 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 } RefDoc refdoc ; Index: modules.cfg =================================================================== --- modules.cfg (revision 58178) +++ modules.cfg (working copy) @@ -1,6 +1,6 @@ # modules.cfg # -# Copyright 2005, 2006, 2007, 2009 by +# Copyright 2005-2007, 2009-2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -54,7 +54,7 @@ # PostScript Type 42 font driver. # -# This driver needs the `truetype' module. +# This driver needs the `truetype' and `psaux' modules. FONT_MODULES += type42 # Windows FONT/FNT font driver. See optional extension ftwinfnt.c below @@ -122,6 +122,11 @@ # See include/freetype/ftlzw.h for the API. AUX_MODULES += lzw +# Support for streams compressed with bzip2 (files with suffix .bz2). +# +# See include/freetype/ftbzip2.h for the API. +AUX_MODULES += bzip2 + # OpenType table validation. Needs ftotval.c below. # # AUX_MODULES += otvalid Index: README =================================================================== --- README (revision 58178) +++ README (working copy) @@ -1,22 +1,15 @@ - Special notes to Unix users - =========================== + FreeType 2.4.11 + =============== - Please read the file `docs/UPGRADE.UNIX'. It contains important - information regarding the installation of FreeType on Unix systems, - especially GNU based operating systems like GNU/Linux. - - FreeType 2's library is called `libfreetype', FreeType 1's library - is called `libttf'. They are *not* compatible! - - - FreeType 2.4.4 - ============== - 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'). + The FreeType 2 API reference is located in `docs/reference'; use the file `ft2-doc.html' as the top entry point. Additional documentation is available as a separate package from our sites. Go @@ -26,9 +19,9 @@ and download one of the following files. - freetype-doc-2.4.4.tar.bz2 - freetype-doc-2.4.4.tar.gz - ftdoc244.zip + freetype-doc-2.4.11.tar.bz2 + freetype-doc-2.4.11.tar.gz + ftdoc2411.zip Bugs @@ -51,7 +44,7 @@ ---------------------------------------------------------------------- -Copyright 2006, 2007, 2008, 2009, 2010 by +Copyright 2006-2012 by David Turner, Robert Wilhelm, and Werner Lemberg. This file is part of the FreeType project, and may only be used, Index: src/autofit/afangles.c =================================================================== --- src/autofit/afangles.c (revision 58178) +++ src/autofit/afangles.c (working copy) @@ -5,7 +5,7 @@ /* Routines used to compute vector angles with limited accuracy */ /* and very high speed. It also contains sorting routines (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006 by */ +/* Copyright 2003-2006, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -77,7 +77,7 @@ return 1 - 2 * ( delta < 0 ); } -#endif +#endif /* 0 */ /* @@ -255,7 +255,7 @@ { for ( j = i; j > 0; j-- ) { - if ( table[j] > table[j - 1] ) + if ( table[j] >= table[j - 1] ) break; swap = table[j]; @@ -267,18 +267,26 @@ FT_LOCAL_DEF( void ) - af_sort_widths( FT_UInt count, - AF_Width table ) + af_sort_and_quantize_widths( FT_UInt* count, + AF_Width table, + FT_Pos threshold ) { FT_UInt i, j; + FT_UInt cur_idx; + FT_Pos cur_val; + FT_Pos sum; AF_WidthRec swap; - for ( i = 1; i < count; i++ ) + if ( *count == 1 ) + return; + + /* sort */ + for ( i = 1; i < *count; i++ ) { for ( j = i; j > 0; j-- ) { - if ( table[j].org > table[j - 1].org ) + if ( table[j].org >= table[j - 1].org ) break; swap = table[j]; @@ -286,6 +294,51 @@ table[j - 1] = swap; } } + + cur_idx = 0; + cur_val = table[cur_idx].org; + + /* compute and use mean values for clusters not larger than */ + /* `threshold'; this is very primitive and might not yield */ + /* the best result, but normally, using reference character */ + /* `o', `*count' is 2, so the code below is fully sufficient */ + for ( i = 1; i < *count; i++ ) + { + if ( table[i].org - cur_val > threshold || + i == *count - 1 ) + { + sum = 0; + + /* fix loop for end of array */ + if ( table[i].org - cur_val <= threshold && + i == *count - 1 ) + i++; + + for ( j = cur_idx; j < i; j++ ) + { + sum += table[j].org; + table[j].org = 0; + } + table[cur_idx].org = sum / j; + + if ( i < *count - 1 ) + { + cur_idx = i + 1; + cur_val = table[cur_idx].org; + } + } + } + + cur_idx = 1; + + /* compress array to remove zero values */ + for ( i = 1; i < *count; i++ ) + { + if ( table[i].org ) + table[cur_idx++] = table[i]; + } + + *count = cur_idx; } Index: src/autofit/afcjk.c =================================================================== --- src/autofit/afcjk.c (revision 58178) +++ src/autofit/afcjk.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK script (body). */ /* */ -/* Copyright 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2006-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,47 +22,546 @@ * */ +#include <ft2build.h> +#include FT_ADVANCES_H +#include FT_INTERNAL_DEBUG_H + #include "aftypes.h" #include "aflatin.h" #ifdef AF_CONFIG_OPTION_CJK +#undef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT + #include "afcjk.h" #include "aferrors.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_afcjk + + /*************************************************************************/ + /*************************************************************************/ /***** *****/ /***** C J K G L O B A L M E T R I C S *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ + + /* Basically the Latin version with AF_CJKMetrics */ + /* to replace AF_LatinMetrics. */ + + FT_LOCAL_DEF( void ) + af_cjk_metrics_init_widths( AF_CJKMetrics metrics, + FT_Face face ) + { + /* scan the array of segments in each direction */ + AF_GlyphHintsRec hints[1]; + + + af_glyph_hints_init( hints, face->memory ); + + metrics->axis[AF_DIMENSION_HORZ].width_count = 0; + metrics->axis[AF_DIMENSION_VERT].width_count = 0; + + { + FT_Error error; + FT_UInt glyph_index; + int dim; + AF_CJKMetricsRec dummy[1]; + AF_Scaler scaler = &dummy->root.scaler; + + + glyph_index = FT_Get_Char_Index( face, + metrics->root.clazz->standard_char ); + if ( glyph_index == 0 ) + goto Exit; + + error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); + if ( error || face->glyph->outline.n_points <= 0 ) + goto Exit; + + FT_ZERO( dummy ); + + dummy->units_per_em = metrics->units_per_em; + + scaler->x_scale = 0x10000L; + scaler->y_scale = 0x10000L; + scaler->x_delta = 0; + scaler->y_delta = 0; + + scaler->face = face; + scaler->render_mode = FT_RENDER_MODE_NORMAL; + scaler->flags = 0; + + af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy ); + + error = af_glyph_hints_reload( hints, &face->glyph->outline ); + if ( error ) + goto Exit; + + for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) + { + AF_CJKAxis axis = &metrics->axis[dim]; + AF_AxisHints axhints = &hints->axis[dim]; + AF_Segment seg, limit, link; + FT_UInt num_widths = 0; + + + error = af_latin_hints_compute_segments( hints, (AF_Dimension)dim ); + if ( error ) + goto Exit; + + af_latin_hints_link_segments( hints, (AF_Dimension)dim ); + + seg = axhints->segments; + limit = seg + axhints->num_segments; + + for ( ; seg < limit; seg++ ) + { + link = seg->link; + + /* we only consider stem segments there! */ + if ( link && link->link == seg && link > seg ) + { + FT_Pos dist; + + + dist = seg->pos - link->pos; + if ( dist < 0 ) + dist = -dist; + + if ( num_widths < AF_CJK_MAX_WIDTHS ) + axis->widths[num_widths++].org = dist; + } + } + + /* this also replaces multiple almost identical stem widths */ + /* with a single one (the value 100 is heuristic) */ + af_sort_and_quantize_widths( &num_widths, axis->widths, + dummy->units_per_em / 100 ); + axis->width_count = num_widths; + } + + Exit: + for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) + { + AF_CJKAxis axis = &metrics->axis[dim]; + FT_Pos stdw; + + + stdw = ( axis->width_count > 0 ) ? axis->widths[0].org + : AF_LATIN_CONSTANT( metrics, 50 ); + + /* let's try 20% of the smallest width */ + axis->edge_distance_threshold = stdw / 5; + axis->standard_width = stdw; + axis->extra_light = 0; + } + } + + af_glyph_hints_done( hints ); + } + + +#define AF_CJK_MAX_TEST_CHARACTERS 32 + + + /* Each blue zone has two types of fill and unfill, this is, */ + /* filling the entire glyph square or not. */ + + enum + { + AF_CJK_BLUE_TYPE_FILL, + AF_CJK_BLUE_TYPE_UNFILL, + AF_CJK_BLUE_TYPE_MAX + }; + + + /* Put some common and representative Han Ideographs characters here. */ + static const FT_ULong af_cjk_hani_blue_chars[AF_CJK_BLUE_MAX] + [AF_CJK_BLUE_TYPE_MAX] + [AF_CJK_MAX_TEST_CHARACTERS] = + { + { + { + 0x4ED6, 0x4EEC, 0x4F60, 0x4F86, 0x5011, 0x5230, 0x548C, 0x5730, + 0x5BF9, 0x5C0D, 0x5C31, 0x5E2D, 0x6211, 0x65F6, 0x6642, 0x6703, + 0x6765, 0x70BA, 0x80FD, 0x8230, 0x8AAA, 0x8BF4, 0x8FD9, 0x9019, + 0x9F4A /* top fill */ + }, + { + 0x519B, 0x540C, 0x5DF2, 0x613F, 0x65E2, 0x661F, 0x662F, 0x666F, + 0x6C11, 0x7167, 0x73B0, 0x73FE, 0x7406, 0x7528, 0x7F6E, 0x8981, + 0x8ECD, 0x90A3, 0x914D, 0x91CC, 0x958B, 0x96F7, 0x9732, 0x9762, + 0x987E /* top unfill */ + } + }, + { + { + 0x4E2A, 0x4E3A, 0x4EBA, 0x4ED6, 0x4EE5, 0x4EEC, 0x4F60, 0x4F86, + 0x500B, 0x5011, 0x5230, 0x548C, 0x5927, 0x5BF9, 0x5C0D, 0x5C31, + 0x6211, 0x65F6, 0x6642, 0x6709, 0x6765, 0x70BA, 0x8981, 0x8AAA, + 0x8BF4 /* bottom fill */ + }, + { + 0x4E3B, 0x4E9B, 0x56E0, 0x5B83, 0x60F3, 0x610F, 0x7406, 0x751F, + 0x7576, 0x770B, 0x7740, 0x7F6E, 0x8005, 0x81EA, 0x8457, 0x88E1, + 0x8FC7, 0x8FD8, 0x8FDB, 0x9032, 0x904E, 0x9053, 0x9084, 0x91CC, + 0x9762 /* bottom unfill */ + } + }, +#ifndef AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT + { {0x0000}, {0x0000} }, + { {0x0000}, {0x0000} } +#else + { + { + 0x4E9B, 0x4EEC, 0x4F60, 0x4F86, 0x5011, 0x5230, 0x548C, 0x5730, + 0x5979, 0x5C06, 0x5C07, 0x5C31, 0x5E74, 0x5F97, 0x60C5, 0x6700, + 0x6837, 0x6A23, 0x7406, 0x80FD, 0x8AAA, 0x8BF4, 0x8FD9, 0x9019, + 0x901A /* left fill */ + }, + { + 0x5373, 0x5417, 0x5427, 0x542C, 0x5462, 0x54C1, 0x54CD, 0x55CE, + 0x5E08, 0x5E2B, 0x6536, 0x65AD, 0x65B7, 0x660E, 0x773C, 0x9593, + 0x95F4, 0x9645, 0x9648, 0x9650, 0x9664, 0x9673, 0x968F, 0x969B, + 0x96A8 /* left unfill */ + } + }, + { + { + 0x4E8B, 0x524D, 0x5B78, 0x5C06, 0x5C07, 0x60C5, 0x60F3, 0x6216, + 0x653F, 0x65AF, 0x65B0, 0x6837, 0x6A23, 0x6C11, 0x6C92, 0x6CA1, + 0x7136, 0x7279, 0x73B0, 0x73FE, 0x7403, 0x7B2C, 0x7D93, 0x8C01, + 0x8D77 /* right fill */ + }, + { + 0x4F8B, 0x5225, 0x522B, 0x5236, 0x52A8, 0x52D5, 0x5417, 0x55CE, + 0x589E, 0x6307, 0x660E, 0x671D, 0x671F, 0x6784, 0x7269, 0x786E, + 0x79CD, 0x8ABF, 0x8C03, 0x8CBB, 0x8D39, 0x90A3, 0x90FD, 0x9593, + 0x95F4 /* right unfill */ + } + } +#endif /* AF_CONFIG_OPTION_CJK_BLUE_HANI_VERT */ + }; + + + /* Calculate blue zones for all the CJK_BLUE_XXX's. */ + + static void + af_cjk_metrics_init_blues( AF_CJKMetrics metrics, + FT_Face face, + const FT_ULong blue_chars + [AF_CJK_BLUE_MAX] + [AF_CJK_BLUE_TYPE_MAX] + [AF_CJK_MAX_TEST_CHARACTERS] ) + { + FT_Pos fills[AF_CJK_MAX_TEST_CHARACTERS]; + FT_Pos flats[AF_CJK_MAX_TEST_CHARACTERS]; + + FT_Int num_fills; + FT_Int num_flats; + + FT_Int bb; + AF_CJKBlue blue; + FT_Error error; + AF_CJKAxis axis; + FT_GlyphSlot glyph = face->glyph; + +#ifdef FT_DEBUG_LEVEL_TRACE + FT_String* cjk_blue_name[AF_CJK_BLUE_MAX] = { + (FT_String*)"top", + (FT_String*)"bottom", + (FT_String*)"left", + (FT_String*)"right" + }; + FT_String* cjk_blue_type_name[AF_CJK_BLUE_TYPE_MAX] = { + (FT_String*)"filled", + (FT_String*)"unfilled" + }; +#endif + + + /* We compute the blues simply by loading each character from the */ + /* `blue_chars[blues]' string, then computing its extreme points */ + /* (depending blue zone type etc.). */ + + FT_TRACE5(( "cjk blue zones computation\n" )); + FT_TRACE5(( "------------------------------------------------\n" )); + + for ( bb = 0; bb < AF_CJK_BLUE_MAX; bb++ ) + { + FT_Int fill_type; + FT_Pos* blue_ref; + FT_Pos* blue_shoot; + + + num_fills = 0; + num_flats = 0; + + for ( fill_type = 0; fill_type < AF_CJK_BLUE_TYPE_MAX; fill_type++ ) + { + const FT_ULong* p = blue_chars[bb][fill_type]; + const FT_ULong* limit = p + AF_CJK_MAX_TEST_CHARACTERS; + FT_Bool fill = FT_BOOL( + fill_type == AF_CJK_BLUE_TYPE_FILL ); + + + FT_TRACE5(( "cjk blue %s/%s\n", cjk_blue_name[bb], + cjk_blue_type_name[fill_type] )); + + + for ( ; p < limit && *p; p++ ) + { + FT_UInt glyph_index; + FT_Pos best_pos; /* same as points.y */ + FT_Int best_point; + FT_Vector* points; + + + FT_TRACE5(( " U+%lX...", *p )); + + /* load the character in the face -- skip unknown or empty ones */ + glyph_index = FT_Get_Char_Index( face, *p ); + if ( glyph_index == 0 ) + { + FT_TRACE5(( "unavailable\n" )); + continue; + } + + error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); + if ( error || glyph->outline.n_points <= 0 ) + { + FT_TRACE5(( "no outline\n" )); + continue; + } + + /* now compute min or max point indices and coordinates */ + points = glyph->outline.points; + best_point = -1; + best_pos = 0; /* make compiler happy */ + + { + FT_Int nn; + FT_Int first = 0; + FT_Int last = -1; + + + for ( nn = 0; + nn < glyph->outline.n_contours; + first = last + 1, nn++ ) + { + FT_Int pp; + + + last = glyph->outline.contours[nn]; + + /* Avoid single-point contours since they are never */ + /* rasterized. In some fonts, they correspond to mark */ + /* attachment points which are way outside of the glyph's */ + /* real outline. */ + if ( last <= first ) + continue; + + switch ( bb ) + { + case AF_CJK_BLUE_TOP: + for ( pp = first; pp <= last; pp++ ) + if ( best_point < 0 || points[pp].y > best_pos ) + { + best_point = pp; + best_pos = points[pp].y; + } + break; + + case AF_CJK_BLUE_BOTTOM: + for ( pp = first; pp <= last; pp++ ) + if ( best_point < 0 || points[pp].y < best_pos ) + { + best_point = pp; + best_pos = points[pp].y; + } + break; + + case AF_CJK_BLUE_LEFT: + for ( pp = first; pp <= last; pp++ ) + if ( best_point < 0 || points[pp].x < best_pos ) + { + best_point = pp; + best_pos = points[pp].x; + } + break; + + case AF_CJK_BLUE_RIGHT: + for ( pp = first; pp <= last; pp++ ) + if ( best_point < 0 || points[pp].x > best_pos ) + { + best_point = pp; + best_pos = points[pp].x; + } + break; + + default: + ; + } + } + FT_TRACE5(( "best_pos=%5ld\n", best_pos )); + } + + if ( fill ) + fills[num_fills++] = best_pos; + else + flats[num_flats++] = best_pos; + } + } + + if ( num_flats == 0 && num_fills == 0 ) + { + /* + * we couldn't find a single glyph to compute this blue zone, + * we will simply ignore it then + */ + FT_TRACE5(( "empty\n" )); + continue; + } + + /* we have computed the contents of the `fill' and `flats' tables, */ + /* now determine the reference position of the blue -- */ + /* we simply take the median value after a simple sort */ + af_sort_pos( num_flats, flats ); + af_sort_pos( num_fills, fills ); + + if ( AF_CJK_BLUE_TOP == bb || AF_CJK_BLUE_BOTTOM == bb ) + axis = &metrics->axis[AF_DIMENSION_VERT]; + else + axis = &metrics->axis[AF_DIMENSION_HORZ]; + + blue = & axis->blues[axis->blue_count]; + blue_ref = & blue->ref.org; + blue_shoot = & blue->shoot.org; + + axis->blue_count++; + if ( num_flats == 0 ) + { + *blue_ref = fills[num_fills / 2]; + *blue_shoot = fills[num_fills / 2]; + } + else if ( num_fills == 0 ) + { + *blue_ref = flats[num_flats / 2]; + *blue_shoot = flats[num_flats / 2]; + } + else + { + *blue_ref = fills[num_fills / 2]; + *blue_shoot = flats[num_flats / 2]; + } + + /* make sure blue_ref >= blue_shoot for top/right or */ + /* vice versa for bottom/left */ + if ( *blue_shoot != *blue_ref ) + { + FT_Pos ref = *blue_ref; + FT_Pos shoot = *blue_shoot; + FT_Bool under_ref = FT_BOOL( shoot < ref ); + + + if ( (AF_CJK_BLUE_TOP == bb || AF_CJK_BLUE_RIGHT == bb) ^ under_ref ) + *blue_shoot = *blue_ref = ( shoot + ref ) / 2; + } + + blue->flags = 0; + if ( AF_CJK_BLUE_TOP == bb ) + blue->flags |= AF_CJK_BLUE_IS_TOP; + else if ( AF_CJK_BLUE_RIGHT == bb ) + blue->flags |= AF_CJK_BLUE_IS_RIGHT; + + FT_TRACE5(( "-- cjk %s bluezone ref = %ld shoot = %ld\n", + cjk_blue_name[bb], *blue_ref, *blue_shoot )); + } + + return; + } + + + /* Basically the Latin version with type AF_CJKMetrics for metrics. */ + FT_LOCAL_DEF( void ) + af_cjk_metrics_check_digits( AF_CJKMetrics metrics, + FT_Face face ) + { + FT_UInt i; + FT_Bool started = 0, same_width = 1; + FT_Fixed advance, old_advance = 0; + + + /* check whether all ASCII digits have the same advance width; */ + /* digit `0' is 0x30 in all supported charmaps */ + for ( i = 0x30; i <= 0x39; i++ ) + { + FT_UInt glyph_index; + + + glyph_index = FT_Get_Char_Index( face, i ); + if ( glyph_index == 0 ) + continue; + + if ( FT_Get_Advance( face, glyph_index, + FT_LOAD_NO_SCALE | + FT_LOAD_NO_HINTING | + FT_LOAD_IGNORE_TRANSFORM, + &advance ) ) + continue; + + if ( started ) + { + if ( advance != old_advance ) + { + same_width = 0; + break; + } + } + else + { + old_advance = advance; + started = 1; + } + } + + metrics->root.digits_have_same_width = same_width; + } + + FT_LOCAL_DEF( FT_Error ) - af_cjk_metrics_init( AF_LatinMetrics metrics, - FT_Face face ) + af_cjk_metrics_init( AF_CJKMetrics metrics, + FT_Face face ) { FT_CharMap oldmap = face->charmap; metrics->units_per_em = face->units_per_EM; - /* TODO are there blues? */ - if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) ) face->charmap = NULL; else { - /* latin's version would suffice */ - af_latin_metrics_init_widths( metrics, face, 0x7530 ); - af_latin_metrics_check_digits( metrics, face ); + af_cjk_metrics_init_widths( metrics, face ); + af_cjk_metrics_init_blues( metrics, face, af_cjk_hani_blue_chars ); + af_cjk_metrics_check_digits( metrics, face ); } FT_Set_Charmap( face, oldmap ); @@ -72,31 +571,100 @@ static void - af_cjk_metrics_scale_dim( AF_LatinMetrics metrics, - AF_Scaler scaler, - AF_Dimension dim ) + af_cjk_metrics_scale_dim( AF_CJKMetrics metrics, + AF_Scaler scaler, + AF_Dimension dim ) { - AF_LatinAxis axis; + FT_Fixed scale; + FT_Pos delta; + AF_CJKAxis axis; + FT_UInt nn; axis = &metrics->axis[dim]; if ( dim == AF_DIMENSION_HORZ ) { - axis->scale = scaler->x_scale; - axis->delta = scaler->x_delta; + scale = scaler->x_scale; + delta = scaler->x_delta; } else { - axis->scale = scaler->y_scale; - axis->delta = scaler->y_delta; + scale = scaler->y_scale; + delta = scaler->y_delta; } + + if ( axis->org_scale == scale && axis->org_delta == delta ) + return; + + axis->org_scale = scale; + axis->org_delta = delta; + + axis->scale = scale; + axis->delta = delta; + + /* scale the blue zones */ + for ( nn = 0; nn < axis->blue_count; nn++ ) + { + AF_CJKBlue blue = &axis->blues[nn]; + FT_Pos dist; + + + blue->ref.cur = FT_MulFix( blue->ref.org, scale ) + delta; + blue->ref.fit = blue->ref.cur; + blue->shoot.cur = FT_MulFix( blue->shoot.org, scale ) + delta; + blue->shoot.fit = blue->shoot.cur; + blue->flags &= ~AF_CJK_BLUE_ACTIVE; + + /* a blue zone is only active if it is less than 3/4 pixels tall */ + dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale ); + if ( dist <= 48 && dist >= -48 ) + { + FT_Pos delta1, delta2; + + + blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); + + /* shoot is under shoot for cjk */ + delta1 = FT_DivFix( blue->ref.fit, scale ) - blue->shoot.org; + delta2 = delta1; + if ( delta1 < 0 ) + delta2 = -delta2; + + delta2 = FT_MulFix( delta2, scale ); + + FT_TRACE5(( "delta: %d", delta1 )); + if ( delta2 < 32 ) + delta2 = 0; +#if 0 + else if ( delta2 < 64 ) + delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 ); +#endif + else + delta2 = FT_PIX_ROUND( delta2 ); + FT_TRACE5(( "/%d\n", delta2 )); + + if ( delta1 < 0 ) + delta2 = -delta2; + + blue->shoot.fit = blue->ref.fit - delta2; + + FT_TRACE5(( ">> active cjk blue zone %c%d[%ld/%ld]: " + "ref: cur=%.2f fit=%.2f shoot: cur=%.2f fit=%.2f\n", + ( dim == AF_DIMENSION_HORZ ) ? 'H' : 'V', + nn, blue->ref.org, blue->shoot.org, + blue->ref.cur / 64.0, blue->ref.fit / 64.0, + blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 )); + + blue->flags |= AF_CJK_BLUE_ACTIVE; + } + } } FT_LOCAL_DEF( void ) - af_cjk_metrics_scale( AF_LatinMetrics metrics, - AF_Scaler scaler ) + af_cjk_metrics_scale( AF_CJKMetrics metrics, + AF_Scaler scaler ) { metrics->root.scaler = *scaler; @@ -329,7 +897,7 @@ AF_AxisHints axis = &hints->axis[dim]; FT_Error error = AF_Err_Ok; FT_Memory memory = hints->memory; - AF_LatinAxis laxis = &((AF_LatinMetrics)hints->metrics)->axis[dim]; + AF_CJKAxis laxis = &((AF_CJKMetrics)hints->metrics)->axis[dim]; AF_Segment segments = axis->segments; AF_Segment segment_limit = segments + axis->num_segments; @@ -601,9 +1169,96 @@ } + FT_LOCAL_DEF( void ) + af_cjk_hints_compute_blue_edges( AF_GlyphHints hints, + AF_CJKMetrics metrics, + AF_Dimension dim ) + { + AF_AxisHints axis = &hints->axis[dim]; + AF_Edge edge = axis->edges; + AF_Edge edge_limit = edge + axis->num_edges; + AF_CJKAxis cjk = &metrics->axis[dim]; + FT_Fixed scale = cjk->scale; + FT_Pos best_dist0; /* initial threshold */ + + + /* compute the initial threshold as a fraction of the EM size */ + best_dist0 = FT_MulFix( metrics->units_per_em / 40, scale ); + + if ( best_dist0 > 64 / 2 ) /* maximum 1/2 pixel */ + best_dist0 = 64 / 2; + + /* compute which blue zones are active, i.e. have their scaled */ + /* size < 3/4 pixels */ + + /* If the distant between an edge and a blue zone is shorter than */ + /* best_dist0, set the blue zone for the edge. Then search for */ + /* the blue zone with the smallest best_dist to the edge. */ + + for ( ; edge < edge_limit; edge++ ) + { + FT_UInt bb; + AF_Width best_blue = NULL; + FT_Pos best_dist = best_dist0; + + + for ( bb = 0; bb < cjk->blue_count; bb++ ) + { + AF_CJKBlue blue = cjk->blues + bb; + FT_Bool is_top_right_blue, is_major_dir; + + + /* skip inactive blue zones (i.e., those that are too small) */ + if ( !( blue->flags & AF_CJK_BLUE_ACTIVE ) ) + continue; + + /* if it is a top zone, check for right edges -- if it is a bottom */ + /* zone, check for left edges */ + /* */ + /* of course, that's for TrueType */ + is_top_right_blue = + FT_BOOL( ( ( blue->flags & AF_CJK_BLUE_IS_TOP ) != 0 ) || + ( ( blue->flags & AF_CJK_BLUE_IS_RIGHT ) != 0 ) ); + is_major_dir = FT_BOOL( edge->dir == axis->major_dir ); + + /* if it is a top zone, the edge must be against the major */ + /* direction; if it is a bottom zone, it must be in the major */ + /* direction */ + if ( is_top_right_blue ^ is_major_dir ) + { + FT_Pos dist; + AF_Width compare; + + + /* Compare the edge to the closest blue zone type */ + if ( FT_ABS( edge->fpos - blue->ref.org ) > + FT_ABS( edge->fpos - blue->shoot.org ) ) + compare = &blue->shoot; + else + compare = &blue->ref; + + dist = edge->fpos - compare->org; + if ( dist < 0 ) + dist = -dist; + + dist = FT_MulFix( dist, scale ); + if ( dist < best_dist ) + { + best_dist = dist; + best_blue = compare; + } + } + } + + if ( best_blue ) + edge->blue_edge = best_blue; + } + } + + FT_LOCAL_DEF( FT_Error ) - af_cjk_hints_init( AF_GlyphHints hints, - AF_LatinMetrics metrics ) + af_cjk_hints_init( AF_GlyphHints hints, + AF_CJKMetrics metrics ) { FT_Render_Mode mode; FT_UInt32 scaler_flags, other_flags; @@ -623,7 +1278,7 @@ /* compute flags depending on render mode, etc. */ mode = metrics->root.scaler.render_mode; -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; #endif @@ -728,11 +1383,11 @@ AF_Edge_Flags base_flags, AF_Edge_Flags stem_flags ) { - AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics; - AF_LatinAxis axis = & metrics->axis[dim]; - FT_Pos dist = width; - FT_Int sign = 0; - FT_Int vertical = ( dim == AF_DIMENSION_VERT ); + AF_CJKMetrics metrics = (AF_CJKMetrics) hints->metrics; + AF_CJKAxis axis = & metrics->axis[dim]; + FT_Pos dist = width; + FT_Int sign = 0; + FT_Bool vertical = FT_BOOL( dim == AF_DIMENSION_VERT ); FT_UNUSED( base_flags ); FT_UNUSED( stem_flags ); @@ -958,7 +1613,7 @@ goto Exit; } - offset = cur_len % 64; + offset = cur_len & 63; if ( offset < 32 ) { @@ -1025,8 +1680,62 @@ AF_Edge anchor = 0; FT_Pos delta = 0; FT_Int skipped = 0; + FT_Bool has_last_stem = FALSE; + FT_Pos last_stem_pos = 0; + /* we begin by aligning all stems relative to the blue zone */ + FT_TRACE5(( "==== cjk hinting %s edges =====\n", + dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); + + if ( AF_HINTS_DO_BLUES( hints ) ) + { + for ( edge = edges; edge < edge_limit; edge++ ) + { + AF_Width blue; + AF_Edge edge1, edge2; + + + if ( edge->flags & AF_EDGE_DONE ) + continue; + + blue = edge->blue_edge; + edge1 = NULL; + edge2 = edge->link; + + if ( blue ) + { + edge1 = edge; + } + else if ( edge2 && edge2->blue_edge ) + { + blue = edge2->blue_edge; + edge1 = edge2; + edge2 = edge; + } + + if ( !edge1 ) + continue; + + FT_TRACE5(( "CJKBLUE: edge %d @%d (opos=%.2f) snapped to (%.2f), " + "was (%.2f)\n", + edge1-edges, edge1->fpos, edge1->opos / 64.0, blue->fit / 64.0, + edge1->pos / 64.0 )); + + edge1->pos = blue->fit; + edge1->flags |= AF_EDGE_DONE; + + if ( edge2 && !edge2->blue_edge ) + { + af_cjk_align_linked_edge( hints, dim, edge1, edge2 ); + edge2->flags |= AF_EDGE_DONE; + } + + if ( !anchor ) + anchor = edge; + } + } + /* now we align all stem edges. */ for ( edge = edges; edge < edge_limit; edge++ ) { @@ -1044,12 +1753,43 @@ continue; } + /* Some CJK characters have so many stems that + * the hinter is likely to merge two adjacent ones. + * To solve this problem, if either edge of a stem + * is too close to the previous one, we avoid + * aligning the two edges, but rather interpolate + * their locations at the end of this function in + * order to preserve the space between the stems. + */ + if ( has_last_stem && + ( edge->pos < last_stem_pos + 64 || + edge2->pos < last_stem_pos + 64 ) ) + { + skipped++; + continue; + } + /* now align the stem */ + /* this should not happen, but it's better to be safe */ + if ( edge2->blue_edge ) + { + FT_TRACE5(( "ASSERTION FAILED for edge %d\n", edge2-edges )); + af_cjk_align_linked_edge( hints, dim, edge2, edge ); + edge->flags |= AF_EDGE_DONE; + continue; + } + if ( edge2 < edge ) { af_cjk_align_linked_edge( hints, dim, edge2, edge ); edge->flags |= AF_EDGE_DONE; + /* We rarely reaches here it seems; + * usually the two edges belonging + * to one stem are marked as DONE together + */ + has_last_stem = TRUE; + last_stem_pos = edge->pos; continue; } @@ -1142,6 +1882,8 @@ anchor = edge; edge->flags |= AF_EDGE_DONE; edge2->flags |= AF_EDGE_DONE; + has_last_stem = TRUE; + last_stem_pos = edge2->pos; } /* make sure that lowercase m's maintain their symmetry */ @@ -1361,9 +2103,9 @@ FT_LOCAL_DEF( FT_Error ) - af_cjk_hints_apply( AF_GlyphHints hints, - FT_Outline* outline, - AF_LatinMetrics metrics ) + af_cjk_hints_apply( AF_GlyphHints hints, + FT_Outline* outline, + AF_CJKMetrics metrics ) { FT_Error error; int dim; @@ -1381,6 +2123,8 @@ error = af_cjk_hints_detect_features( hints, AF_DIMENSION_HORZ ); if ( error ) goto Exit; + + af_cjk_hints_compute_blue_edges( hints, metrics, AF_DIMENSION_HORZ ); } if ( AF_HINTS_DO_VERTICAL( hints ) ) @@ -1388,6 +2132,8 @@ error = af_cjk_hints_detect_features( hints, AF_DIMENSION_VERT ); if ( error ) goto Exit; + + af_cjk_hints_compute_blue_edges( hints, metrics, AF_DIMENSION_VERT ); } /* grid-fit the outline */ @@ -1397,7 +2143,7 @@ ( dim == AF_DIMENSION_VERT && AF_HINTS_DO_VERTICAL( hints ) ) ) { -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( dim == AF_DIMENSION_HORZ && metrics->root.scaler.render_mode == FT_RENDER_MODE_NORMAL ) { @@ -1406,11 +2152,13 @@ FT_Pos delta; - af_warper_compute( &warper, hints, dim, &scale, &delta ); - af_glyph_hints_scale_dim( hints, dim, scale, delta ); + af_warper_compute( &warper, hints, (AF_Dimension)dim, + &scale, &delta ); + af_glyph_hints_scale_dim( hints, (AF_Dimension)dim, + scale, delta ); continue; } -#endif /* AF_USE_WARPER */ +#endif /* AF_CONFIG_OPTION_USE_WARPER */ af_cjk_hint_edges( hints, (AF_Dimension)dim ); af_cjk_align_edge_points( hints, (AF_Dimension)dim ); @@ -1441,18 +2189,20 @@ /*************************************************************************/ + /* this corresponds to Unicode 6.0 */ + static const AF_Script_UniRangeRec af_cjk_uniranges[] = { -#if 0 - AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ), /* why this? */ -#endif + AF_UNIRANGE_REC( 0x1100UL, 0x11FFUL ), /* Hangul Jamo */ AF_UNIRANGE_REC( 0x2E80UL, 0x2EFFUL ), /* CJK Radicals Supplement */ AF_UNIRANGE_REC( 0x2F00UL, 0x2FDFUL ), /* Kangxi Radicals */ + AF_UNIRANGE_REC( 0x2FF0UL, 0x2FFFUL ), /* Ideographic Description Characters */ AF_UNIRANGE_REC( 0x3000UL, 0x303FUL ), /* CJK Symbols and Punctuation */ AF_UNIRANGE_REC( 0x3040UL, 0x309FUL ), /* Hiragana */ AF_UNIRANGE_REC( 0x30A0UL, 0x30FFUL ), /* Katakana */ AF_UNIRANGE_REC( 0x3100UL, 0x312FUL ), /* Bopomofo */ AF_UNIRANGE_REC( 0x3130UL, 0x318FUL ), /* Hangul Compatibility Jamo */ + AF_UNIRANGE_REC( 0x3190UL, 0x319FUL ), /* Kanbun */ AF_UNIRANGE_REC( 0x31A0UL, 0x31BFUL ), /* Bopomofo Extended */ AF_UNIRANGE_REC( 0x31C0UL, 0x31EFUL ), /* CJK Strokes */ AF_UNIRANGE_REC( 0x31F0UL, 0x31FFUL ), /* Katakana Phonetic Extensions */ @@ -1461,20 +2211,30 @@ AF_UNIRANGE_REC( 0x3400UL, 0x4DBFUL ), /* CJK Unified Ideographs Extension A */ AF_UNIRANGE_REC( 0x4DC0UL, 0x4DFFUL ), /* Yijing Hexagram Symbols */ AF_UNIRANGE_REC( 0x4E00UL, 0x9FFFUL ), /* CJK Unified Ideographs */ + AF_UNIRANGE_REC( 0xA960UL, 0xA97FUL ), /* Hangul Jamo Extended-A */ + AF_UNIRANGE_REC( 0xAC00UL, 0xD7AFUL ), /* Hangul Syllables */ + AF_UNIRANGE_REC( 0xD7B0UL, 0xD7FFUL ), /* Hangul Jamo Extended-B */ AF_UNIRANGE_REC( 0xF900UL, 0xFAFFUL ), /* CJK Compatibility Ideographs */ + AF_UNIRANGE_REC( 0xFE10UL, 0xFE1FUL ), /* Vertical forms */ AF_UNIRANGE_REC( 0xFE30UL, 0xFE4FUL ), /* CJK Compatibility Forms */ AF_UNIRANGE_REC( 0xFF00UL, 0xFFEFUL ), /* Halfwidth and Fullwidth Forms */ + AF_UNIRANGE_REC( 0x1B000UL, 0x1B0FFUL ), /* Kana Supplement */ + AF_UNIRANGE_REC( 0x1D300UL, 0x1D35FUL ), /* Tai Xuan Hing Symbols */ + AF_UNIRANGE_REC( 0x1F200UL, 0x1F2FFUL ), /* Enclosed Ideographic Supplement */ AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ), /* CJK Unified Ideographs Extension B */ + AF_UNIRANGE_REC( 0x2A700UL, 0x2B73FUL ), /* CJK Unified Ideographs Extension C */ + AF_UNIRANGE_REC( 0x2B740UL, 0x2B81FUL ), /* CJK Unified Ideographs Extension D */ AF_UNIRANGE_REC( 0x2F800UL, 0x2FA1FUL ), /* CJK Compatibility Ideographs Supplement */ AF_UNIRANGE_REC( 0UL, 0UL ) }; - AF_DEFINE_SCRIPT_CLASS(af_cjk_script_class, + AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class, AF_SCRIPT_CJK, af_cjk_uniranges, + 0x7530, /* 田 */ - sizeof( AF_LatinMetricsRec ), + sizeof ( AF_CJKMetricsRec ), (AF_Script_InitMetricsFunc) af_cjk_metrics_init, (AF_Script_ScaleMetricsFunc)af_cjk_metrics_scale, @@ -1492,11 +2252,12 @@ }; - AF_DEFINE_SCRIPT_CLASS(af_cjk_script_class, + AF_DEFINE_SCRIPT_CLASS( af_cjk_script_class, AF_SCRIPT_CJK, af_cjk_uniranges, + 0, - sizeof( AF_LatinMetricsRec ), + sizeof ( AF_CJKMetricsRec ), (AF_Script_InitMetricsFunc) NULL, (AF_Script_ScaleMetricsFunc)NULL, Index: src/autofit/afcjk.h =================================================================== --- src/autofit/afcjk.h (revision 58178) +++ src/autofit/afcjk.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for CJK script (specification). */ /* */ -/* Copyright 2006, 2007 by */ +/* Copyright 2006, 2007, 2011, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,6 +20,7 @@ #define __AFCJK_H__ #include "afhints.h" +#include "aflatin.h" FT_BEGIN_HEADER @@ -27,26 +28,110 @@ /* the CJK-specific script class */ - AF_DECLARE_SCRIPT_CLASS(af_cjk_script_class) + AF_DECLARE_SCRIPT_CLASS( af_cjk_script_class ) + /* CJK (global) metrics management */ + /* + * CJK glyphs tend to fill the square. So we have both vertical and + * horizontal blue zones. But some glyphs have flat bounding strokes that + * leave some space between neighbour glyphs. + */ + enum + { + AF_CJK_BLUE_TOP, + AF_CJK_BLUE_BOTTOM, + AF_CJK_BLUE_LEFT, + AF_CJK_BLUE_RIGHT, + + AF_CJK_BLUE_MAX + }; + + +#define AF_CJK_MAX_WIDTHS 16 +#define AF_CJK_MAX_BLUES AF_CJK_BLUE_MAX + + + enum + { + AF_CJK_BLUE_ACTIVE = 1 << 0, + AF_CJK_BLUE_IS_TOP = 1 << 1, + AF_CJK_BLUE_IS_RIGHT = 1 << 2, + AF_CJK_BLUE_ADJUSTMENT = 1 << 3, /* used for scale adjustment */ + /* optimization */ + AF_CJK_BLUE_FLAG_MAX + }; + + + typedef struct AF_CJKBlueRec_ + { + AF_WidthRec ref; + AF_WidthRec shoot; /* undershoot */ + FT_UInt flags; + + } AF_CJKBlueRec, *AF_CJKBlue; + + + typedef struct AF_CJKAxisRec_ + { + FT_Fixed scale; + FT_Pos delta; + + FT_UInt width_count; + AF_WidthRec widths[AF_CJK_MAX_WIDTHS]; + FT_Pos edge_distance_threshold; + FT_Pos standard_width; + FT_Bool extra_light; + + /* used for horizontal metrics too for CJK */ + FT_Bool control_overshoot; + FT_UInt blue_count; + AF_CJKBlueRec blues[AF_CJK_BLUE_MAX]; + + FT_Fixed org_scale; + FT_Pos org_delta; + + } AF_CJKAxisRec, *AF_CJKAxis; + + + typedef struct AF_CJKMetricsRec_ + { + AF_ScriptMetricsRec root; + FT_UInt units_per_em; + AF_CJKAxisRec axis[AF_DIMENSION_MAX]; + + } AF_CJKMetricsRec, *AF_CJKMetrics; + + +#ifdef AF_CONFIG_OPTION_CJK FT_LOCAL( FT_Error ) - af_cjk_metrics_init( AF_LatinMetrics metrics, - FT_Face face ); + af_cjk_metrics_init( AF_CJKMetrics metrics, + FT_Face face ); FT_LOCAL( void ) - af_cjk_metrics_scale( AF_LatinMetrics metrics, - AF_Scaler scaler ); + af_cjk_metrics_scale( AF_CJKMetrics metrics, + AF_Scaler scaler ); FT_LOCAL( FT_Error ) - af_cjk_hints_init( AF_GlyphHints hints, - AF_LatinMetrics metrics ); + af_cjk_hints_init( AF_GlyphHints hints, + AF_CJKMetrics metrics ); FT_LOCAL( FT_Error ) - af_cjk_hints_apply( AF_GlyphHints hints, - FT_Outline* outline, - AF_LatinMetrics metrics ); + af_cjk_hints_apply( AF_GlyphHints hints, + FT_Outline* outline, + AF_CJKMetrics metrics ); + /* shared; called from afindic.c */ + FT_LOCAL( void ) + af_cjk_metrics_check_digits( AF_CJKMetrics metrics, + FT_Face face ); + + FT_LOCAL( void ) + af_cjk_metrics_init_widths( AF_CJKMetrics metrics, + FT_Face face ); +#endif /* AF_CONFIG_OPTION_CJK */ + + /* */ FT_END_HEADER Index: src/autofit/afdummy.c =================================================================== --- src/autofit/afdummy.c (revision 58178) +++ src/autofit/afdummy.c (working copy) @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (body). */ /* */ -/* Copyright 2003, 2004, 2005 by */ +/* Copyright 2003-2005, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,6 +19,7 @@ #include "afdummy.h" #include "afhints.h" +#include "aferrors.h" static FT_Error @@ -27,7 +28,7 @@ { af_glyph_hints_rescale( hints, metrics ); - return 0; + return AF_Err_Ok; } @@ -38,15 +39,16 @@ FT_UNUSED( hints ); FT_UNUSED( outline ); - return 0; + return AF_Err_Ok; } - AF_DEFINE_SCRIPT_CLASS(af_dummy_script_class, - AF_SCRIPT_NONE, + AF_DEFINE_SCRIPT_CLASS( af_dummy_script_class, + AF_SCRIPT_DUMMY, NULL, + 0, - sizeof( AF_ScriptMetricsRec ), + sizeof ( AF_ScriptMetricsRec ), (AF_Script_InitMetricsFunc) NULL, (AF_Script_ScaleMetricsFunc)NULL, Index: src/autofit/afdummy.h =================================================================== --- src/autofit/afdummy.h (revision 58178) +++ src/autofit/afdummy.h (working copy) @@ -5,7 +5,7 @@ /* Auto-fitter dummy routines to be used if no hinting should be */ /* performed (specification). */ /* */ -/* Copyright 2003, 2004, 2005 by */ +/* Copyright 2003-2005, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,7 +29,7 @@ * be performed. This is the default for non-latin glyphs! */ - AF_DECLARE_SCRIPT_CLASS(af_dummy_script_class) + AF_DECLARE_SCRIPT_CLASS( af_dummy_script_class ) /* */ Index: src/autofit/aferrors.h =================================================================== --- src/autofit/aferrors.h (revision 58178) +++ src/autofit/aferrors.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Autofitter error codes (specification only). */ /* */ -/* Copyright 2005 by */ +/* Copyright 2005, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX AF_Err_ #define FT_ERR_BASE FT_Mod_Err_Autofit Index: src/autofit/afglobal.c =================================================================== --- src/autofit/afglobal.c (revision 58178) +++ src/autofit/afglobal.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter routines to compute global hinting values (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2003-2012 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 @@ #ifndef FT_CONFIG_OPTION_PIC -/* when updating this table, don't forget to update - AF_SCRIPT_CLASSES_COUNT and autofit_module_class_pic_init */ + /* when updating this table, don't forget to update */ + /* AF_SCRIPT_CLASSES_COUNT and autofit_module_class_pic_init */ /* populate this list when you add new scripts */ static AF_ScriptClass const af_script_classes[] = @@ -43,36 +43,13 @@ #endif &af_latin_script_class, &af_cjk_script_class, - &af_indic_script_class, + &af_indic_script_class, NULL /* do not remove */ }; -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* !FT_CONFIG_OPTION_PIC */ - /* index of default script in `af_script_classes' */ -#define AF_SCRIPT_LIST_DEFAULT 2 - /* a bit mask indicating an uncovered glyph */ -#define AF_SCRIPT_LIST_NONE 0x7F - /* if this flag is set, we have an ASCII digit */ -#define AF_DIGIT 0x80 - - /* - * Note that glyph_scripts[] is used to map each glyph into - * an index into the `af_script_classes' array. - * - */ - typedef struct AF_FaceGlobalsRec_ - { - FT_Face face; - FT_Long glyph_count; /* same as face->num_glyphs */ - FT_Byte* glyph_scripts; - - AF_ScriptMetrics metrics[AF_SCRIPT_MAX]; - - } AF_FaceGlobalsRec; - - /* Compute the script index of each glyph within a given face. */ static FT_Error @@ -82,19 +59,20 @@ FT_Face face = globals->face; FT_CharMap old_charmap = face->charmap; FT_Byte* gscripts = globals->glyph_scripts; - FT_UInt ss, i; + FT_UInt ss; + FT_UInt i; - /* the value 255 means `uncovered glyph' */ + /* the value AF_SCRIPT_NONE means `uncovered glyph' */ FT_MEM_SET( globals->glyph_scripts, - AF_SCRIPT_LIST_NONE, + AF_SCRIPT_NONE, globals->glyph_count ); error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); if ( error ) { /* - * Ignore this error; we simply use the default script. + * Ignore this error; we simply use the fallback script. * XXX: Shouldn't we rather disable hinting? */ error = AF_Err_Ok; @@ -112,7 +90,7 @@ continue; /* - * Scan all unicode points in the range and set the corresponding + * Scan all Unicode points in the range and set the corresponding * glyph script index. */ for ( range = clazz->script_uni_ranges; range->first != 0; range++ ) @@ -125,10 +103,8 @@ if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count && - gscripts[gindex] == AF_SCRIPT_LIST_NONE ) - { + gscripts[gindex] == AF_SCRIPT_NONE ) gscripts[gindex] = (FT_Byte)ss; - } for (;;) { @@ -138,10 +114,8 @@ break; if ( gindex < (FT_ULong)globals->glyph_count && - gscripts[gindex] == AF_SCRIPT_LIST_NONE ) - { + gscripts[gindex] == AF_SCRIPT_NONE ) gscripts[gindex] = (FT_Byte)ss; - } } } } @@ -158,19 +132,20 @@ Exit: /* - * By default, all uncovered glyphs are set to the latin script. + * By default, all uncovered glyphs are set to the fallback script. * XXX: Shouldn't we disable hinting or do something similar? */ + if ( globals->module->fallback_script != AF_SCRIPT_NONE ) { FT_Long nn; for ( nn = 0; nn < globals->glyph_count; nn++ ) { - if ( ( gscripts[nn] & ~AF_DIGIT ) == AF_SCRIPT_LIST_NONE ) + if ( ( gscripts[nn] & ~AF_DIGIT ) == AF_SCRIPT_NONE ) { - gscripts[nn] &= ~AF_SCRIPT_LIST_NONE; - gscripts[nn] |= AF_SCRIPT_LIST_DEFAULT; + gscripts[nn] &= ~AF_SCRIPT_NONE; + gscripts[nn] |= globals->module->fallback_script; } } } @@ -182,7 +157,8 @@ FT_LOCAL_DEF( FT_Error ) af_face_globals_new( FT_Face face, - AF_FaceGlobals *aglobals ) + AF_FaceGlobals *aglobals, + AF_Module module ) { FT_Error error; FT_Memory memory; @@ -191,21 +167,25 @@ memory = face->memory; - if ( !FT_ALLOC( globals, sizeof ( *globals ) + - face->num_glyphs * sizeof ( FT_Byte ) ) ) + if ( FT_ALLOC( globals, sizeof ( *globals ) + + face->num_glyphs * sizeof ( FT_Byte ) ) ) + goto Exit; + + globals->face = face; + globals->glyph_count = face->num_glyphs; + globals->glyph_scripts = (FT_Byte*)( globals + 1 ); + globals->module = module; + + error = af_face_globals_compute_script_coverage( globals ); + if ( error ) { - globals->face = face; - globals->glyph_count = face->num_glyphs; - globals->glyph_scripts = (FT_Byte*)( globals + 1 ); - - error = af_face_globals_compute_script_coverage( globals ); - if ( error ) - { - af_face_globals_free( globals ); - globals = NULL; - } + af_face_globals_free( globals ); + globals = NULL; } + globals->increase_x_height = AF_PROP_INCREASE_X_HEIGHT_MAX; + + Exit: *aglobals = globals; return error; } @@ -268,7 +248,7 @@ gidx = script; if ( gidx == 0 || gidx + 1 >= script_max ) - gidx = globals->glyph_scripts[gindex] & AF_SCRIPT_LIST_NONE; + gidx = globals->glyph_scripts[gindex] & AF_SCRIPT_NONE; clazz = AF_SCRIPT_CLASSES_GET[gidx]; if ( script == 0 ) @@ -277,14 +257,15 @@ metrics = globals->metrics[clazz->script]; if ( metrics == NULL ) { - /* create the global metrics object when needed */ + /* create the global metrics object if necessary */ FT_Memory memory = globals->face->memory; if ( FT_ALLOC( metrics, clazz->script_metrics_size ) ) goto Exit; - metrics->clazz = clazz; + metrics->clazz = clazz; + metrics->globals = globals; if ( clazz->script_metrics_init ) { Index: src/autofit/afglobal.h =================================================================== --- src/autofit/afglobal.h (revision 58178) +++ src/autofit/afglobal.h (working copy) @@ -5,7 +5,7 @@ /* Auto-fitter routines to compute global hinting values */ /* (specification). */ /* */ -/* Copyright 2003, 2004, 2005, 2007, 2009 by */ +/* Copyright 2003-2005, 2007, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,16 +17,34 @@ /***************************************************************************/ -#ifndef __AF_GLOBAL_H__ -#define __AF_GLOBAL_H__ +#ifndef __AFGLOBAL_H__ +#define __AFGLOBAL_H__ #include "aftypes.h" +#include "afmodule.h" FT_BEGIN_HEADER + /* + * Default values and flags for both autofitter globals (found in + * AF_ModuleRec) and face globals (in AF_FaceGlobalsRec). + */ + + /* index of fallback script in `af_script_classes' */ +#define AF_SCRIPT_FALLBACK 2 + /* a bit mask indicating an uncovered glyph */ +#define AF_SCRIPT_NONE 0x7F + /* if this flag is set, we have an ASCII digit */ +#define AF_DIGIT 0x80 + + /* `increase-x-height' property */ +#define AF_PROP_INCREASE_X_HEIGHT_MIN 6 +#define AF_PROP_INCREASE_X_HEIGHT_MAX 0 + + /************************************************************************/ /************************************************************************/ /***** *****/ @@ -37,15 +55,35 @@ /* + * Note that glyph_scripts[] is used to map each glyph into + * an index into the `af_script_classes' array. + * + */ + typedef struct AF_FaceGlobalsRec_ + { + FT_Face face; + FT_Long glyph_count; /* same as face->num_glyphs */ + FT_Byte* glyph_scripts; + + /* per-face auto-hinter properties */ + FT_UInt increase_x_height; + + AF_ScriptMetrics metrics[AF_SCRIPT_MAX]; + + AF_Module module; /* to access global properties */ + + } AF_FaceGlobalsRec; + + + /* * model the global hints data for a given face, decomposed into * script-specific items */ - typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; - FT_LOCAL( FT_Error ) af_face_globals_new( FT_Face face, - AF_FaceGlobals *aglobals ); + AF_FaceGlobals *aglobals, + AF_Module module ); FT_LOCAL( FT_Error ) af_face_globals_get_metrics( AF_FaceGlobals globals, @@ -65,7 +103,7 @@ FT_END_HEADER -#endif /* __AF_GLOBALS_H__ */ +#endif /* __AFGLOBAL_H__ */ /* END */ Index: src/autofit/afhints.c =================================================================== --- src/autofit/afhints.c (revision 58178) +++ src/autofit/afhints.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 2003-2007, 2009-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,8 +19,21 @@ #include "afhints.h" #include "aferrors.h" #include FT_INTERNAL_CALC_H +#include FT_INTERNAL_DEBUG_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_afhints + + + /* Get new segment for given axis. */ + FT_LOCAL_DEF( FT_Error ) af_axis_hints_new_segment( AF_AxisHints axis, FT_Memory memory, @@ -61,12 +74,14 @@ } + /* Get new edge for given axis, direction, and position. */ + FT_LOCAL( FT_Error ) af_axis_hints_new_edge( AF_AxisHints axis, FT_Int fpos, AF_Direction dir, FT_Memory memory, - AF_Edge *aedge ) + AF_Edge *anedge ) { FT_Error error = AF_Err_Ok; AF_Edge edge = NULL; @@ -120,12 +135,12 @@ edge->dir = (FT_Char)dir; Exit: - *aedge = edge; + *anedge = edge; return error; } -#ifdef AF_DEBUG +#ifdef FT_DEBUG_AUTOFIT #include FT_CONFIG_STANDARD_LIBRARY_H @@ -160,6 +175,9 @@ #define AF_INDEX_NUM( ptr, base ) ( (ptr) ? ( (ptr) - (base) ) : -1 ) +#ifdef __cplusplus + extern "C" { +#endif void af_glyph_hints_dump_points( AF_GlyphHints hints ) { @@ -168,30 +186,31 @@ AF_Point point; - printf( "Table of points:\n" ); - printf( " [ index | xorg | yorg | xscale | yscale " - "| xfit | yfit | flags ]\n" ); + FT_TRACE7(( "Table of points:\n" + " [ index | xorg | yorg | xscale | yscale" + " | xfit | yfit | flags ]\n" )); for ( point = points; point < limit; point++ ) - { - printf( " [ %5d | %5d | %5d | %-5.2f | %-5.2f " - "| %-5.2f | %-5.2f | %c%c%c%c%c%c ]\n", - point - points, - point->fx, - point->fy, - point->ox/64.0, - point->oy/64.0, - point->x/64.0, - point->y/64.0, - ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' ', - ( point->flags & AF_FLAG_INFLECTION ) ? 'i' : ' ', - ( point->flags & AF_FLAG_EXTREMA_X ) ? '<' : ' ', - ( point->flags & AF_FLAG_EXTREMA_Y ) ? 'v' : ' ', - ( point->flags & AF_FLAG_ROUND_X ) ? '(' : ' ', - ( point->flags & AF_FLAG_ROUND_Y ) ? 'u' : ' '); - } - printf( "\n" ); + FT_TRACE7(( " [ %5d | %5d | %5d | %6.2f | %6.2f" + " | %5.2f | %5.2f | %c%c%c%c%c%c ]\n", + point - points, + point->fx, + point->fy, + point->ox / 64.0, + point->oy / 64.0, + point->x / 64.0, + point->y / 64.0, + ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) ? 'w' : ' ', + ( point->flags & AF_FLAG_INFLECTION ) ? 'i' : ' ', + ( point->flags & AF_FLAG_EXTREMA_X ) ? '<' : ' ', + ( point->flags & AF_FLAG_EXTREMA_Y ) ? 'v' : ' ', + ( point->flags & AF_FLAG_ROUND_X ) ? '(' : ' ', + ( point->flags & AF_FLAG_ROUND_Y ) ? 'u' : ' ')); + FT_TRACE7(( "\n" )); } +#ifdef __cplusplus + } +#endif static const char* @@ -216,13 +235,17 @@ if ( pos == 0 ) return "normal"; - temp[pos] = 0; + temp[pos] = '\0'; return temp; } - /* A function to dump the array of linked segments. */ + /* Dump the array of linked segments. */ + +#ifdef __cplusplus + extern "C" { +#endif void af_glyph_hints_dump_segments( AF_GlyphHints hints ) { @@ -232,34 +255,116 @@ for ( dimension = 1; dimension >= 0; dimension-- ) { AF_AxisHints axis = &hints->axis[dimension]; + AF_Point points = hints->points; + AF_Edge edges = axis->edges; AF_Segment segments = axis->segments; AF_Segment limit = segments + axis->num_segments; AF_Segment seg; - printf ( "Table of %s segments:\n", - dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" ); - printf ( " [ index | pos | dir | link | serif |" - " height | extra | flags ]\n" ); + FT_TRACE7(( "Table of %s segments:\n", + dimension == AF_DIMENSION_HORZ ? "vertical" + : "horizontal" )); + if (axis->num_segments) + FT_TRACE7(( " [ index | pos | dir | from" + " | to | link | serif | edge" + " | height | extra | flags ]\n" )); + else + FT_TRACE7(( " (none)\n" )); for ( seg = segments; seg < limit; seg++ ) - { - printf ( " [ %5d | %5.2g | %5s | %4d | %5d | %5d | %5d | %s ]\n", - seg - segments, - dimension == AF_DIMENSION_HORZ ? (int)seg->first->ox / 64.0 - : (int)seg->first->oy / 64.0, - af_dir_str( (AF_Direction)seg->dir ), - AF_INDEX_NUM( seg->link, segments ), - AF_INDEX_NUM( seg->serif, segments ), - seg->height, - seg->height - ( seg->max_coord - seg->min_coord ), - af_edge_flags_to_string( seg->flags ) ); - } - printf( "\n" ); + FT_TRACE7(( " [ %5d | %5.2g | %5s | %4d" + " | %4d | %4d | %5d | %4d" + " | %6d | %5d | %11s ]\n", + seg - segments, + dimension == AF_DIMENSION_HORZ + ? (int)seg->first->ox / 64.0 + : (int)seg->first->oy / 64.0, + af_dir_str( (AF_Direction)seg->dir ), + AF_INDEX_NUM( seg->first, points ), + AF_INDEX_NUM( seg->last, points ), + AF_INDEX_NUM( seg->link, segments ), + AF_INDEX_NUM( seg->serif, segments ), + AF_INDEX_NUM( seg->edge, edges ), + seg->height, + seg->height - ( seg->max_coord - seg->min_coord ), + af_edge_flags_to_string( (AF_Edge_Flags)seg->flags ) )); + FT_TRACE7(( "\n" )); } } +#ifdef __cplusplus + } +#endif + /* Fetch number of segments. */ + +#ifdef __cplusplus + extern "C" { +#endif + FT_Error + af_glyph_hints_get_num_segments( AF_GlyphHints hints, + FT_Int dimension, + FT_Int* num_segments ) + { + AF_Dimension dim; + AF_AxisHints axis; + + + dim = ( dimension == 0 ) ? AF_DIMENSION_HORZ : AF_DIMENSION_VERT; + + axis = &hints->axis[dim]; + *num_segments = axis->num_segments; + + return AF_Err_Ok; + } +#ifdef __cplusplus + } +#endif + + + /* Fetch offset of segments into user supplied offset array. */ + +#ifdef __cplusplus + extern "C" { +#endif + FT_Error + af_glyph_hints_get_segment_offset( AF_GlyphHints hints, + FT_Int dimension, + FT_Int idx, + FT_Pos* offset ) + { + AF_Dimension dim; + AF_AxisHints axis; + AF_Segment seg; + + + if ( !offset ) + return AF_Err_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; + + seg = &axis->segments[idx]; + *offset = (dim == AF_DIMENSION_HORZ) ? seg->first->ox + : seg->first->oy; + + return AF_Err_Ok; + } +#ifdef __cplusplus + } +#endif + + + /* Dump the array of linked edges. */ + +#ifdef __cplusplus + extern "C" { +#endif void af_glyph_hints_dump_edges( AF_GlyphHints hints ) { @@ -276,36 +381,45 @@ /* * note: AF_DIMENSION_HORZ corresponds to _vertical_ edges - * since they have constant a X coordinate. + * since they have a constant X coordinate. */ - printf ( "Table of %s edges:\n", - dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" ); - printf ( " [ index | pos | dir | link |" - " serif | blue | opos | pos | flags ]\n" ); + FT_TRACE7(( "Table of %s edges:\n", + dimension == AF_DIMENSION_HORZ ? "vertical" + : "horizontal" )); + if ( axis->num_edges ) + FT_TRACE7(( " [ index | pos | dir | link" + " | serif | blue | opos | pos | flags ]\n" )); + else + FT_TRACE7(( " (none)\n" )); for ( edge = edges; edge < limit; edge++ ) - { - printf ( " [ %5d | %5.2g | %5s | %4d |" - " %5d | %c | %5.2f | %5.2f | %s ]\n", - edge - edges, - (int)edge->opos / 64.0, - af_dir_str( (AF_Direction)edge->dir ), - AF_INDEX_NUM( edge->link, edges ), - AF_INDEX_NUM( edge->serif, edges ), - edge->blue_edge ? 'y' : 'n', - edge->opos / 64.0, - edge->pos / 64.0, - af_edge_flags_to_string( edge->flags ) ); - } - printf( "\n" ); + FT_TRACE7(( " [ %5d | %5.2g | %5s | %4d" + " | %5d | %c | %5.2f | %5.2f | %11s ]\n", + edge - edges, + (int)edge->opos / 64.0, + af_dir_str( (AF_Direction)edge->dir ), + AF_INDEX_NUM( edge->link, edges ), + AF_INDEX_NUM( edge->serif, edges ), + edge->blue_edge ? 'y' : 'n', + edge->opos / 64.0, + edge->pos / 64.0, + af_edge_flags_to_string( (AF_Edge_Flags)edge->flags ) )); + FT_TRACE7(( "\n" )); } } +#ifdef __cplusplus + } +#endif -#else /* !AF_DEBUG */ +#else /* !FT_DEBUG_AUTOFIT */ /* these empty stubs are only used to link the `ftgrid' test program */ - /* when debugging is disabled */ + /* if debugging is disabled */ +#ifdef __cplusplus + extern "C" { +#endif + void af_glyph_hints_dump_points( AF_GlyphHints hints ) { @@ -320,16 +434,49 @@ } + FT_Error + af_glyph_hints_get_num_segments( AF_GlyphHints hints, + FT_Int dimension, + FT_Int* num_segments ) + { + FT_UNUSED( hints ); + FT_UNUSED( dimension ); + FT_UNUSED( num_segments ); + + return 0; + } + + + FT_Error + af_glyph_hints_get_segment_offset( AF_GlyphHints hints, + FT_Int dimension, + FT_Int idx, + FT_Pos* offset ) + { + FT_UNUSED( hints ); + FT_UNUSED( dimension ); + FT_UNUSED( idx ); + FT_UNUSED( offset ); + + return 0; + } + + void af_glyph_hints_dump_edges( AF_GlyphHints hints ) { FT_UNUSED( hints ); } -#endif /* !AF_DEBUG */ +#ifdef __cplusplus + } +#endif +#endif /* !FT_DEBUG_AUTOFIT */ - /* compute the direction value of a given vector */ + + /* Compute the direction value of a given vector. */ + FT_LOCAL_DEF( AF_Direction ) af_direction_compute( FT_Pos dx, FT_Pos dy ) @@ -369,6 +516,8 @@ } } + /* return no direction if arm lengths differ too much */ + /* (value 14 is heuristic, corresponding to approx. 4.1 degrees) */ ss *= 14; if ( FT_ABS( ll ) <= FT_ABS( ss ) ) dir = AF_DIR_NONE; @@ -389,43 +538,45 @@ FT_LOCAL_DEF( void ) af_glyph_hints_done( AF_GlyphHints hints ) { - if ( hints && hints->memory ) - { - FT_Memory memory = hints->memory; - int dim; + FT_Memory memory = hints->memory; + int dim; - /* - * note that we don't need to free the segment and edge - * buffers, since they are really within the hints->points array - */ - for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) - { - AF_AxisHints axis = &hints->axis[dim]; + if ( !( hints && hints->memory ) ) + return; + /* + * note that we don't need to free the segment and edge + * buffers since they are really within the hints->points array + */ + for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) + { + AF_AxisHints axis = &hints->axis[dim]; - axis->num_segments = 0; - axis->max_segments = 0; - FT_FREE( axis->segments ); - axis->num_edges = 0; - axis->max_edges = 0; - FT_FREE( axis->edges ); - } + axis->num_segments = 0; + axis->max_segments = 0; + FT_FREE( axis->segments ); - FT_FREE( hints->contours ); - hints->max_contours = 0; - hints->num_contours = 0; + axis->num_edges = 0; + axis->max_edges = 0; + FT_FREE( axis->edges ); + } - FT_FREE( hints->points ); - hints->num_points = 0; - hints->max_points = 0; + FT_FREE( hints->contours ); + hints->max_contours = 0; + hints->num_contours = 0; - hints->memory = NULL; - } + FT_FREE( hints->points ); + hints->num_points = 0; + hints->max_points = 0; + + hints->memory = NULL; } + /* Reset metrics. */ + FT_LOCAL_DEF( void ) af_glyph_hints_rescale( AF_GlyphHints hints, AF_ScriptMetrics metrics ) @@ -435,6 +586,9 @@ } + /* Recompute all AF_Point in AF_GlyphHints from the definitions */ + /* in a source outline. */ + FT_LOCAL_DEF( FT_Error ) af_glyph_hints_reload( AF_GlyphHints hints, FT_Outline* outline ) @@ -457,12 +611,12 @@ hints->axis[1].num_segments = 0; hints->axis[1].num_edges = 0; - /* first of all, reallocate the contours array when necessary */ + /* first of all, reallocate the contours array if necessary */ new_max = (FT_UInt)outline->n_contours; old_max = hints->max_contours; if ( new_max > old_max ) { - new_max = ( new_max + 3 ) & ~3; + new_max = ( new_max + 3 ) & ~3; /* round up to a multiple of 4 */ if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) ) goto Exit; @@ -479,7 +633,7 @@ old_max = hints->max_points; if ( new_max > old_max ) { - new_max = ( new_max + 2 + 7 ) & ~7; + new_max = ( new_max + 2 + 7 ) & ~7; /* round up to a multiple of 8 */ if ( FT_RENEW_ARRAY( hints->points, old_max, new_max ) ) goto Exit; @@ -545,7 +699,7 @@ point->flags = AF_FLAG_CUBIC; break; default: - point->flags = 0; + point->flags = AF_FLAG_NONE; } point->prev = prev; @@ -563,7 +717,7 @@ } } - /* set-up the contours array */ + /* set up the contours array */ { AF_Point* contour = hints->contours; AF_Point* contour_limit = contour + hints->num_contours; @@ -611,7 +765,9 @@ in_dir = af_direction_compute( out_x, out_y ); point->out_dir = (FT_Char)in_dir; - if ( point->flags & ( AF_FLAG_CONIC | AF_FLAG_CUBIC ) ) + /* check for weak points */ + + if ( point->flags & AF_FLAG_CONTROL ) { Is_Weak_Point: point->flags |= AF_FLAG_WEAK_INTERPOLATION; @@ -639,6 +795,8 @@ } + /* Store the hinted outline in an FT_Outline structure. */ + FT_LOCAL_DEF( void ) af_glyph_hints_save( AF_GlyphHints hints, FT_Outline* outline ) @@ -671,6 +829,9 @@ ****************************************************************/ + /* Align all points of an edge to the same coordinate value, */ + /* either horizontally or vertically. */ + FT_LOCAL_DEF( void ) af_glyph_hints_align_edge_points( AF_GlyphHints hints, AF_Dimension dim ) @@ -704,7 +865,6 @@ break; point = point->next; - } } } @@ -744,8 +904,8 @@ ****************************************************************/ - /* hint the strong points -- this is equivalent to the TrueType `IP' */ - /* hinting instruction */ + /* Hint the strong points -- this is equivalent to the TrueType `IP' */ + /* hinting instruction. */ FT_LOCAL_DEF( void ) af_glyph_hints_align_strong_points( AF_GlyphHints hints, @@ -827,11 +987,12 @@ max = edge_limit - edges; #if 1 - /* for small edge counts, a linear search is better */ + /* for a small number of edges, a linear search is better */ if ( max <= 8 ) { FT_PtrDist nn; + for ( nn = 0; nn < max; nn++ ) if ( edges[nn].fpos >= u ) break; @@ -863,6 +1024,7 @@ } } + /* point is not on an edge */ { AF_Edge before = edges + min - 1; AF_Edge after = edges + min + 0; @@ -898,6 +1060,10 @@ ****************************************************************/ + /* Shift the original coordinates of all points between `p1' and */ + /* `p2' to get hinted coordinates, using the same difference as */ + /* given by `ref'. */ + static void af_iup_shift( AF_Point p1, AF_Point p2, @@ -906,6 +1072,7 @@ AF_Point p; FT_Pos delta = ref->u - ref->v; + if ( delta == 0 ) return; @@ -917,6 +1084,13 @@ } + /* Interpolate the original coordinates of all points between `p1' and */ + /* `p2' to get hinted coordinates, using `ref1' and `ref2' as the */ + /* reference points. The `u' and `v' members are the current and */ + /* original coordinate values, respectively. */ + /* */ + /* Details can be found in the TrueType bytecode specification. */ + static void af_iup_interp( AF_Point p1, AF_Point p2, @@ -985,6 +1159,9 @@ } + /* Hint the weak points -- this is equivalent to the TrueType `IUP' */ + /* hinting instruction. */ + FT_LOCAL_DEF( void ) af_glyph_hints_align_weak_points( AF_GlyphHints hints, AF_Dimension dim ) @@ -1050,17 +1227,18 @@ for (;;) { - FT_ASSERT( point <= end_point && + FT_ASSERT( point <= end_point && ( point->flags & touch_flag ) != 0 ); - /* skip any touched neighbhours */ - while ( point < end_point && ( point[1].flags & touch_flag ) != 0 ) + /* skip any touched neighbours */ + while ( point < end_point && + ( point[1].flags & touch_flag ) != 0 ) point++; last_touched = point; /* find the next touched point, if any */ - point ++; + point++; for (;;) { if ( point > end_point ) @@ -1080,9 +1258,8 @@ EndContour: /* special case: only one point was touched */ if ( last_touched == first_touched ) - { af_iup_shift( first_point, end_point, first_touched ); - } + else /* interpolate the last part */ { if ( last_touched < end_point ) @@ -1112,8 +1289,10 @@ } -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER + /* Apply (small) warp scale and warp delta for given dimension. */ + FT_LOCAL_DEF( void ) af_glyph_hints_scale_dim( AF_GlyphHints hints, AF_Dimension dim, @@ -1137,6 +1316,6 @@ } } -#endif /* AF_USE_WARPER */ +#endif /* AF_CONFIG_OPTION_USE_WARPER */ /* END */ Index: src/autofit/afhints.h =================================================================== --- src/autofit/afhints.h (revision 58178) +++ src/autofit/afhints.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines (specification). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* Copyright 2003-2008, 2010-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -25,10 +25,10 @@ FT_BEGIN_HEADER - /* - * The definition of outline glyph hints. These are shared by all - * script analysis routines (until now). - */ + /* + * The definition of outline glyph hints. These are shared by all + * script analysis routines (until now). + */ typedef enum AF_Dimension_ { @@ -55,6 +55,151 @@ } AF_Direction; + /* + * The following explanations are mostly taken from the article + * + * Real-Time Grid Fitting of Typographic Outlines + * + * by David Turner and Werner Lemberg + * + * http://www.tug.org/TUGboat/Articles/tb24-3/lemberg.pdf + * + * + * Segments + * + * `af_{cjk,latin,...}_hints_compute_segments' are the functions to + * find segments in an outline. A segment is a series of consecutive + * points that are approximately aligned along a coordinate axis. The + * analysis to do so is specific to a script. + * + * A segment must have at least two points, except in the case of + * `fake' segments that are generated to hint metrics appropriately, + * and which consist of a single point. + * + * + * Edges + * + * As soon as segments are defined, the auto-hinter groups them into + * edges. An edge corresponds to a single position on the main + * dimension that collects one or more segments (allowing for a small + * threshold). + * + * The auto-hinter first tries to grid fit edges, then to align + * segments on the edges unless it detects that they form a serif. + * + * `af_{cjk,latin,...}_hints_compute_edges' are the functions to find + * edges; they are specific to a script. + * + * + * A H + * | | + * | | + * | | + * | | + * C | | F + * +------<-----+ +-----<------+ + * | B G | + * | | + * | | + * +--------------->------------------+ + * D E + * + * + * Stems + * + * Segments need to be `linked' to other ones in order to detect stems. + * A stem is made of two segments that face each other in opposite + * directions and that are sufficiently close to each other. Using + * vocabulary from the TrueType specification, stem segments form a + * `black distance'. + * + * In the above ASCII drawing, the horizontal segments are BC, DE, and + * FG; the vertical segments are AB, CD, EF, and GH. + * + * Each segment has at most one `best' candidate to form a black + * distance, or no candidate at all. Notice that two distinct segments + * can have the same candidate, which frequently means a serif. + * + * A stem is recognized by the following condition: + * + * best segment_1 = segment_2 && best segment_2 = segment_1 + * + * The best candidate is stored in field `link' in structure + * `AF_Segment'. + * + * Stems are detected by `af_{cjk,latin,...}_hint_edges'. + * + * In the above ASCII drawing, the best candidate for both AB and CD is + * GH, while the best candidate for GH is AB. Similarly, the best + * candidate for EF and GH is AB, while the best candidate for AB is + * GH. + * + * + * Serifs + * + * On the opposite, a serif has + * + * best segment_1 = segment_2 && best segment_2 != segment_1 + * + * where segment_1 corresponds to the serif segment (CD and EF in the + * above ASCII drawing). + * + * The best candidate is stored in field `serif' in structure + * `AF_Segment' (and `link' is set to NULL). + * + * Serifs are detected by `af_{cjk,latin,...}_hint_edges'. + * + * + * Touched points + * + * A point is called `touched' if it has been processed somehow by the + * auto-hinter. It basically means that it shouldn't be moved again + * (or moved only under certain constraints to preserve the already + * applied processing). + * + * + * Flat and round segments + * + * Segments are `round' or `flat', depending on the series of points + * that define them. A segment is round if the next and previous point + * of an extremum (which can be either a single point or sequence of + * points) are both conic or cubic control points. Otherwise, a + * segment with an extremum is flat. + * + * + * Strong Points + * + * Experience has shown that points which are not part of an edge need + * to be interpolated linearly between their two closest edges, even if + * these are not part of the contour of those particular points. + * Typical candidates for this are + * + * - angle points (i.e., points where the `in' and `out' direction + * differ greatly) + * + * - inflection points (i.e., where the `in' and `out' angles are the + * same, but the curvature changes sign) + * + * `af_glyph_hints_align_strong_points' is the function which takes + * care of such situations; it is equivalent to the TrueType `IP' + * hinting instruction. + * + * + * Weak Points + * + * Other points in the outline must be interpolated using the + * coordinates of their previous and next unfitted contour neighbours. + * These are called `weak points' and are touched by the function + * `af_glyph_hints_align_weak_points', equivalent to the TrueType `IUP' + * hinting instruction. Typical candidates are control points and + * points on the contour without a major direction. + * + * The major effect is to reduce possible distortion caused by + * alignment of edges and strong points, thus weak points are processed + * after strong points. + */ + + /* point hint flags */ typedef enum AF_Flags_ { @@ -109,7 +254,7 @@ FT_Char out_dir; /* direction of outwards vector */ FT_Pos ox, oy; /* original, scaled position */ - FT_Short fx, fy; /* original, unscaled position (font units) */ + FT_Short fx, fy; /* original, unscaled position (in font units) */ FT_Pos x, y; /* current position */ FT_Pos u, v; /* current (x,y) or (y,x) depending on context */ @@ -137,50 +282,48 @@ FT_Pos score; /* used during stem matching */ FT_Pos len; /* used during stem matching */ - AF_Point first; /* first point in edge segment */ - AF_Point last; /* last point in edge segment */ - AF_Point* contour; /* ptr to first point of segment's contour */ + AF_Point first; /* first point in edge segment */ + AF_Point last; /* last point in edge segment */ } AF_SegmentRec; typedef struct AF_EdgeRec_ { - FT_Short fpos; /* original, unscaled position (font units) */ - FT_Pos opos; /* original, scaled position */ - FT_Pos pos; /* current position */ + FT_Short fpos; /* original, unscaled position (in font units) */ + FT_Pos opos; /* original, scaled position */ + FT_Pos pos; /* current position */ FT_Byte flags; /* edge flags */ FT_Char dir; /* edge direction */ FT_Fixed scale; /* used to speed up interpolation between edges */ - AF_Width blue_edge; /* non-NULL if this is a blue edge */ - AF_Edge link; - AF_Edge serif; - FT_Short num_linked; + AF_Width blue_edge; /* non-NULL if this is a blue edge */ + AF_Edge link; /* link edge */ + AF_Edge serif; /* primary edge for serifs */ + FT_Short num_linked; /* number of linked edges */ + FT_Int score; /* used during stem matching */ - FT_Int score; + AF_Segment first; /* first segment in edge */ + AF_Segment last; /* last segment in edge */ - AF_Segment first; - AF_Segment last; - } AF_EdgeRec; typedef struct AF_AxisHintsRec_ { - FT_Int num_segments; - FT_Int max_segments; - AF_Segment segments; + FT_Int num_segments; /* number of used segments */ + FT_Int max_segments; /* number of allocated segments */ + AF_Segment segments; /* segments array */ #ifdef AF_SORT_SEGMENTS FT_Int mid_segments; #endif - FT_Int num_edges; - FT_Int max_edges; - AF_Edge edges; + FT_Int num_edges; /* number of used edges */ + FT_Int max_edges; /* number of allocated edges */ + AF_Edge edges; /* edges array */ - AF_Direction major_dir; + AF_Direction major_dir; /* either vertical or horizontal */ } AF_AxisHintsRec, *AF_AxisHints; @@ -195,16 +338,14 @@ FT_Fixed y_scale; FT_Pos y_delta; - FT_Pos edge_distance_threshold; + FT_Int max_points; /* number of allocated points */ + FT_Int num_points; /* number of used points */ + AF_Point points; /* points array */ - FT_Int max_points; - FT_Int num_points; - AF_Point points; + FT_Int max_contours; /* number of allocated contours */ + FT_Int num_contours; /* number of used contours */ + AF_Point* contours; /* contours array */ - FT_Int max_contours; - FT_Int num_contours; - AF_Point* contours; - AF_AxisHintsRec axis[AF_DIMENSION_MAX]; FT_UInt32 scaler_flags; /* copy of scaler flags */ @@ -214,7 +355,7 @@ FT_Pos xmin_delta; /* used for warping */ FT_Pos xmax_delta; - + } AF_GlyphHintsRec; @@ -222,7 +363,7 @@ #define AF_HINTS_TEST_OTHER( h, f ) ( (h)->other_flags & (f) ) -#ifdef AF_DEBUG +#ifdef FT_DEBUG_AUTOFIT #define AF_HINTS_DO_HORIZONTAL( h ) \ ( !_af_debug_disable_horz_hints && \ @@ -237,7 +378,7 @@ #define AF_HINTS_DO_BLUES( h ) ( !_af_debug_disable_blue_hints ) -#else /* !AF_DEBUG */ +#else /* !FT_DEBUG_AUTOFIT */ #define AF_HINTS_DO_HORIZONTAL( h ) \ !AF_HINTS_TEST_SCALER( h, AF_SCALER_FLAG_NO_HORIZONTAL ) @@ -250,7 +391,7 @@ #define AF_HINTS_DO_BLUES( h ) 1 -#endif /* !AF_DEBUG */ +#endif /* !FT_DEBUG_AUTOFIT */ FT_LOCAL( AF_Direction ) @@ -274,12 +415,6 @@ af_glyph_hints_init( AF_GlyphHints hints, FT_Memory memory ); - - - /* - * recompute all AF_Point in a AF_GlyphHints from the definitions - * in a source outline - */ FT_LOCAL( void ) af_glyph_hints_rescale( AF_GlyphHints hints, AF_ScriptMetrics metrics ); @@ -304,7 +439,7 @@ af_glyph_hints_align_weak_points( AF_GlyphHints hints, AF_Dimension dim ); -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER FT_LOCAL( void ) af_glyph_hints_scale_dim( AF_GlyphHints hints, AF_Dimension dim, Index: src/autofit/afindic.c =================================================================== --- src/autofit/afindic.c (revision 58178) +++ src/autofit/afindic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic scripts (body). */ /* */ -/* Copyright 2007 by */ +/* Copyright 2007, 2011, 2012 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, */ @@ -27,23 +27,42 @@ #include "afcjk.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif static FT_Error - af_indic_metrics_init( AF_LatinMetrics metrics, - FT_Face face ) + af_indic_metrics_init( AF_CJKMetrics metrics, + FT_Face face ) { - /* use CJK routines */ - return af_cjk_metrics_init( metrics, face ); + /* skip blue zone init in CJK routines */ + FT_CharMap oldmap = face->charmap; + + + metrics->units_per_em = face->units_per_EM; + + if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) ) + face->charmap = NULL; + else + { + af_cjk_metrics_init_widths( metrics, face ); +#if 0 + /* either need indic specific blue_chars[] or just skip blue zones */ + af_cjk_metrics_init_blues( metrics, face, af_cjk_blue_chars ); +#endif + af_cjk_metrics_check_digits( metrics, face ); + } + + FT_Set_Charmap( face, oldmap ); + + return AF_Err_Ok; } static void - af_indic_metrics_scale( AF_LatinMetrics metrics, - AF_Scaler scaler ) + af_indic_metrics_scale( AF_CJKMetrics metrics, + AF_Scaler scaler ) { /* use CJK routines */ af_cjk_metrics_scale( metrics, scaler ); @@ -51,8 +70,8 @@ static FT_Error - af_indic_hints_init( AF_GlyphHints hints, - AF_LatinMetrics metrics ) + af_indic_hints_init( AF_GlyphHints hints, + AF_CJKMetrics metrics ) { /* use CJK routines */ return af_cjk_hints_init( hints, metrics ); @@ -60,9 +79,9 @@ static FT_Error - af_indic_hints_apply( AF_GlyphHints hints, - FT_Outline* outline, - AF_LatinMetrics metrics) + af_indic_hints_apply( AF_GlyphHints hints, + FT_Outline* outline, + AF_CJKMetrics metrics ) { /* use CJK routines */ return af_cjk_hints_apply( hints, outline, metrics ); @@ -84,15 +103,22 @@ AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ), /* why this? */ #endif AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL), /* Indic Range */ + AF_UNIRANGE_REC( 0x0F00UL, 0x0FFFUL), /* Tibetan */ + AF_UNIRANGE_REC( 0x1900UL, 0x194FUL), /* Limbu */ + AF_UNIRANGE_REC( 0x1B80UL, 0x1BBFUL), /* Sundanese */ + AF_UNIRANGE_REC( 0x1C80UL, 0x1CDFUL), /* Meetei Mayak */ + AF_UNIRANGE_REC( 0xA800UL, 0xA82FUL), /* Syloti Nagri */ + AF_UNIRANGE_REC( 0x11800UL, 0x118DFUL), /* Sharada */ AF_UNIRANGE_REC( 0UL, 0UL) }; - AF_DEFINE_SCRIPT_CLASS(af_indic_script_class, + AF_DEFINE_SCRIPT_CLASS( af_indic_script_class, AF_SCRIPT_INDIC, af_indic_uniranges, + 'o', /* XXX */ - sizeof( AF_LatinMetricsRec ), + sizeof ( AF_CJKMetricsRec ), (AF_Script_InitMetricsFunc) af_indic_metrics_init, (AF_Script_ScaleMetricsFunc)af_indic_metrics_scale, @@ -110,11 +136,12 @@ }; - AF_DEFINE_SCRIPT_CLASS(af_indic_script_class, + AF_DEFINE_SCRIPT_CLASS( af_indic_script_class, AF_SCRIPT_INDIC, af_indic_uniranges, + 0, - sizeof( AF_LatinMetricsRec ), + sizeof ( AF_CJKMetricsRec ), (AF_Script_InitMetricsFunc) NULL, (AF_Script_ScaleMetricsFunc)NULL, Index: src/autofit/afindic.h =================================================================== --- src/autofit/afindic.h (revision 58178) +++ src/autofit/afindic.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for Indic scripts (specification). */ /* */ -/* Copyright 2007 by */ +/* Copyright 2007, 2012 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, */ @@ -27,7 +27,7 @@ /* the Indic-specific script class */ - AF_DECLARE_SCRIPT_CLASS(af_indic_script_class) + AF_DECLARE_SCRIPT_CLASS( af_indic_script_class ) /* */ Index: src/autofit/aflatin.c =================================================================== --- src/autofit/aflatin.c (revision 58178) +++ src/autofit/aflatin.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2003-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,50 +18,72 @@ #include <ft2build.h> #include FT_ADVANCES_H +#include FT_INTERNAL_DEBUG_H +#include "afglobal.h" #include "aflatin.h" #include "aferrors.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_aflatin + + /*************************************************************************/ + /*************************************************************************/ /***** *****/ /***** L A T I N G L O B A L M E T R I C S *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ + + /* Find segments and links, compute all stem widths, and initialize */ + /* standard width and height for the glyph with given charcode. */ + FT_LOCAL_DEF( void ) af_latin_metrics_init_widths( AF_LatinMetrics metrics, - FT_Face face, - FT_ULong charcode ) + FT_Face face ) { /* scan the array of segments in each direction */ AF_GlyphHintsRec hints[1]; + FT_TRACE5(( "standard widths computation\n" + "===========================\n\n" )); + af_glyph_hints_init( hints, face->memory ); metrics->axis[AF_DIMENSION_HORZ].width_count = 0; metrics->axis[AF_DIMENSION_VERT].width_count = 0; { - FT_Error error; - FT_UInt glyph_index; - int dim; - AF_LatinMetricsRec dummy[1]; - AF_Scaler scaler = &dummy->root.scaler; + FT_Error error; + FT_UInt glyph_index; + int dim; + AF_LatinMetricsRec dummy[1]; + AF_Scaler scaler = &dummy->root.scaler; - glyph_index = FT_Get_Char_Index( face, charcode ); + glyph_index = FT_Get_Char_Index( face, + metrics->root.clazz->standard_char ); if ( glyph_index == 0 ) goto Exit; + FT_TRACE5(( "standard character: 0x%X (glyph index %d)\n", + metrics->root.clazz->standard_char, glyph_index )); + error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); if ( error || face->glyph->outline.n_points <= 0 ) goto Exit; @@ -69,8 +91,12 @@ FT_ZERO( dummy ); dummy->units_per_em = metrics->units_per_em; - scaler->x_scale = scaler->y_scale = 0x10000L; - scaler->x_delta = scaler->y_delta = 0; + + scaler->x_scale = 0x10000L; + scaler->y_scale = 0x10000L; + scaler->x_delta = 0; + scaler->y_delta = 0; + scaler->face = face; scaler->render_mode = FT_RENDER_MODE_NORMAL; scaler->flags = 0; @@ -115,11 +141,14 @@ dist = -dist; if ( num_widths < AF_LATIN_MAX_WIDTHS ) - axis->widths[ num_widths++ ].org = dist; + axis->widths[num_widths++].org = dist; } } - af_sort_widths( num_widths, axis->widths ); + /* this also replaces multiple almost identical stem widths */ + /* with a single one (the value 100 is heuristic) */ + af_sort_and_quantize_widths( &num_widths, axis->widths, + dummy->units_per_em / 100 ); axis->width_count = num_widths; } @@ -138,9 +167,28 @@ axis->edge_distance_threshold = stdw / 5; axis->standard_width = stdw; axis->extra_light = 0; + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt i; + + + FT_TRACE5(( "%s widths:\n", + dim == AF_DIMENSION_VERT ? "horizontal" + : "vertical" )); + + FT_TRACE5(( " %d (standard)", axis->standard_width )); + for ( i = 1; i < axis->width_count; i++ ) + FT_TRACE5(( " %d", axis->widths[i].org )); + + FT_TRACE5(( "\n" )); + } +#endif } } + FT_TRACE5(( "\n" )); + af_glyph_hints_done( hints ); } @@ -161,6 +209,9 @@ }; + /* Find all blue zones. Flat segments give the reference points, */ + /* round segments the overshoot positions. */ + static void af_latin_metrics_init_blues( AF_LatinMetrics metrics, FT_Face face ) @@ -173,15 +224,15 @@ AF_LatinBlue blue; FT_Error error; AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT]; - FT_GlyphSlot glyph = face->glyph; + FT_Outline outline; /* we compute the blues simply by loading each character from the */ - /* 'af_latin_blue_chars[blues]' string, then compute its top-most or */ + /* `af_latin_blue_chars[blues]' string, then finding its top-most or */ /* bottom-most points (depending on `AF_IS_TOP_BLUE') */ - AF_LOG(( "blue zones computation\n" )); - AF_LOG(( "------------------------------------------------\n" )); + FT_TRACE5(( "blue zones computation\n" + "======================\n\n" )); for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ ) { @@ -191,7 +242,7 @@ FT_Pos* blue_shoot; - AF_LOG(( "blue %3d: ", bb )); + FT_TRACE5(( "blue zone %d:\n", bb )); num_flats = 0; num_rounds = 0; @@ -199,29 +250,28 @@ for ( ; p < limit && *p; p++ ) { FT_UInt glyph_index; - FT_Pos best_y; /* same as points.y */ - FT_Int best_point, best_first, best_last; + FT_Pos best_y; /* same as points.y */ + FT_Int best_point, best_contour_first, best_contour_last; FT_Vector* points; FT_Bool round = 0; - AF_LOG(( "'%c'", *p )); - /* load the character in the face -- skip unknown or empty ones */ glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p ); if ( glyph_index == 0 ) continue; - error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); - if ( error || glyph->outline.n_points <= 0 ) + error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); + outline = face->glyph->outline; + if ( error || outline.n_points <= 0 ) continue; /* now compute min or max point indices and coordinates */ - points = glyph->outline.points; - best_point = -1; - best_y = 0; /* make compiler happy */ - best_first = 0; /* ditto */ - best_last = 0; /* ditto */ + points = outline.points; + best_point = -1; + best_y = 0; /* make compiler happy */ + best_contour_first = 0; /* ditto */ + best_contour_last = 0; /* ditto */ { FT_Int nn; @@ -229,19 +279,19 @@ FT_Int last = -1; - for ( nn = 0; nn < glyph->outline.n_contours; first = last+1, nn++ ) + for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ ) { FT_Int old_best_point = best_point; FT_Int pp; - last = glyph->outline.contours[nn]; + last = outline.contours[nn]; /* Avoid single-point contours since they are never rasterized. */ /* In some fonts, they correspond to mark attachment points */ /* which are way outside of the glyph's real outline. */ if ( last <= first ) - continue; + continue; if ( AF_LATIN_IS_TOP_BLUE( bb ) ) { @@ -264,11 +314,11 @@ if ( best_point != old_best_point ) { - best_first = first; - best_last = last; + best_contour_first = first; + best_contour_last = last; } } - AF_LOG(( "%5d", best_y )); + FT_TRACE5(( " %c %ld", *p, best_y )); } /* now check whether the point belongs to a straight or round */ @@ -276,47 +326,86 @@ /* lies, then inspect its previous and next points */ if ( best_point >= 0 ) { + FT_Pos best_x = points[best_point].x; FT_Int prev, next; + FT_Int best_on_point_first, best_on_point_last; FT_Pos dist; - /* now look for the previous and next points that are not on the */ - /* same Y coordinate. Threshold the `closeness'... */ + if ( FT_CURVE_TAG( outline.tags[best_point] ) == FT_CURVE_TAG_ON ) + { + best_on_point_first = best_point; + best_on_point_last = best_point; + } + else + { + best_on_point_first = -1; + best_on_point_last = -1; + } + + /* look for the previous and next points that are not on the */ + /* same Y coordinate, then threshold the `closeness'... */ prev = best_point; next = prev; do { - if ( prev > best_first ) + if ( prev > best_contour_first ) prev--; else - prev = best_last; + prev = best_contour_last; - dist = points[prev].y - best_y; - if ( dist < -5 || dist > 5 ) - break; + dist = FT_ABS( points[prev].y - best_y ); + /* accept a small distance or a small angle (both values are */ + /* heuristic; value 20 corresponds to approx. 2.9 degrees) */ + if ( dist > 5 ) + if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist ) + break; + if ( FT_CURVE_TAG( outline.tags[prev] ) == FT_CURVE_TAG_ON ) + { + best_on_point_first = prev; + if ( best_on_point_last < 0 ) + best_on_point_last = prev; + } + } while ( prev != best_point ); do { - if ( next < best_last ) + if ( next < best_contour_last ) next++; else - next = best_first; + next = best_contour_first; - dist = points[next].y - best_y; - if ( dist < -5 || dist > 5 ) - break; + dist = FT_ABS( points[next].y - best_y ); + if ( dist > 5 ) + if ( FT_ABS( points[next].x - best_x ) <= 20 * dist ) + break; + if ( FT_CURVE_TAG( outline.tags[next] ) == FT_CURVE_TAG_ON ) + { + best_on_point_last = next; + if ( best_on_point_first < 0 ) + best_on_point_first = next; + } + } while ( next != best_point ); - /* now, set the `round' flag depending on the segment's kind */ - round = FT_BOOL( - FT_CURVE_TAG( glyph->outline.tags[prev] ) != FT_CURVE_TAG_ON || - FT_CURVE_TAG( glyph->outline.tags[next] ) != FT_CURVE_TAG_ON ); + /* now set the `round' flag depending on the segment's kind */ + /* (value 8 is heuristic) */ + if ( best_on_point_first >= 0 && + best_on_point_last >= 0 && + (FT_UInt)( FT_ABS( points[best_on_point_last].x - + points[best_on_point_first].x ) ) > + metrics->units_per_em / 8 ) + round = 0; + else + round = FT_BOOL( + FT_CURVE_TAG( outline.tags[prev] ) != FT_CURVE_TAG_ON || + FT_CURVE_TAG( outline.tags[next] ) != FT_CURVE_TAG_ON ); - AF_LOG(( "%c ", round ? 'r' : 'f' )); + FT_TRACE5(( " (%s)\n", round ? "round" : "flat" )); } if ( round ) @@ -325,15 +414,13 @@ flats[num_flats++] = best_y; } - AF_LOG(( "\n" )); - if ( num_flats == 0 && num_rounds == 0 ) { /* * we couldn't find a single glyph to compute this blue zone, * we will simply ignore it then */ - AF_LOG(( "empty\n" )); + FT_TRACE5(( " empty\n" )); continue; } @@ -343,9 +430,9 @@ af_sort_pos( num_rounds, rounds ); af_sort_pos( num_flats, flats ); - blue = & axis->blues[axis->blue_count]; - blue_ref = & blue->ref.org; - blue_shoot = & blue->shoot.org; + blue = &axis->blues[axis->blue_count]; + blue_ref = &blue->ref.org; + blue_shoot = &blue->shoot.org; axis->blue_count++; @@ -376,7 +463,13 @@ if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref ) - *blue_shoot = *blue_ref = ( shoot + ref ) / 2; + { + *blue_ref = + *blue_shoot = ( shoot + ref ) / 2; + + FT_TRACE5(( " [overshoot smaller than reference," + " taking mean value]\n" )); + } } blue->flags = 0; @@ -391,13 +484,19 @@ if ( bb == AF_LATIN_BLUE_SMALL_TOP ) blue->flags |= AF_LATIN_BLUE_ADJUSTMENT; - AF_LOG(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot )); + FT_TRACE5(( " -> reference = %ld\n" + " overshoot = %ld\n", + *blue_ref, *blue_shoot )); } + FT_TRACE5(( "\n" )); + return; } + /* Check whether all ASCII digits have the same advance width. */ + FT_LOCAL_DEF( void ) af_latin_metrics_check_digits( AF_LatinMetrics metrics, FT_Face face ) @@ -407,8 +506,7 @@ FT_Fixed advance, old_advance = 0; - /* check whether all ASCII digits have the same advance width; */ - /* digit `0' is 0x30 in all supported charmaps */ + /* digit `0' is 0x30 in all supported charmaps */ for ( i = 0x30; i <= 0x39; i++ ) { FT_UInt glyph_index; @@ -444,38 +542,20 @@ } + /* Initialize global metrics. */ + FT_LOCAL_DEF( FT_Error ) af_latin_metrics_init( AF_LatinMetrics metrics, FT_Face face ) { - FT_Error error = AF_Err_Ok; FT_CharMap oldmap = face->charmap; - FT_UInt ee; - static const FT_Encoding latin_encodings[] = - { - FT_ENCODING_UNICODE, - FT_ENCODING_APPLE_ROMAN, - FT_ENCODING_ADOBE_STANDARD, - FT_ENCODING_ADOBE_LATIN_1, - FT_ENCODING_NONE /* end of list */ - }; - metrics->units_per_em = face->units_per_EM; - /* do we have a latin charmap in there? */ - for ( ee = 0; latin_encodings[ee] != FT_ENCODING_NONE; ee++ ) + if ( !FT_Select_Charmap( face, FT_ENCODING_UNICODE ) ) { - error = FT_Select_Charmap( face, latin_encodings[ee] ); - if ( !error ) - break; - } - - if ( !error ) - { - /* For now, compute the standard width and height from the `o'. */ - af_latin_metrics_init_widths( metrics, face, 'o' ); + af_latin_metrics_init_widths( metrics, face ); af_latin_metrics_init_blues( metrics, face ); af_latin_metrics_check_digits( metrics, face ); } @@ -485,6 +565,9 @@ } + /* Adjust scaling value, then scale and shift widths */ + /* and blue zones (if applicable) for given dimension. */ + static void af_latin_metrics_scale_dim( AF_LatinMetrics metrics, AF_Scaler scaler, @@ -535,10 +618,27 @@ if ( blue ) { - FT_Pos scaled = FT_MulFix( blue->shoot.org, scaler->y_scale ); - FT_Pos fitted = ( scaled + 40 ) & ~63; + FT_Pos scaled; + FT_Pos threshold; + FT_Pos fitted; + FT_UInt limit; + FT_UInt ppem; + scaled = FT_MulFix( blue->shoot.org, scaler->y_scale ); + ppem = metrics->root.scaler.face->size->metrics.x_ppem; + limit = metrics->root.globals->increase_x_height; + threshold = 40; + + /* if the `increase-x-height' property is active, */ + /* we round up much more often */ + if ( limit && + ppem <= limit && + ppem >= AF_PROP_INCREASE_X_HEIGHT_MIN ) + threshold = 52; + + fitted = ( scaled + threshold ) & ~63; + if ( scaled != fitted ) { #if 0 @@ -550,9 +650,7 @@ else #endif if ( dim == AF_DIMENSION_VERT ) - { scale = FT_MulDiv( scale, fitted, scaled ); - } } } } @@ -571,7 +669,7 @@ metrics->root.scaler.y_delta = delta; } - /* scale the standard widths */ + /* scale the widths */ for ( nn = 0; nn < axis->width_count; nn++ ) { AF_Width width = axis->widths + nn; @@ -582,7 +680,7 @@ } /* an extra-light axis corresponds to a standard width that is */ - /* smaller than 0.75 pixels */ + /* smaller than 5/8 pixels */ axis->extra_light = (FT_Bool)( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); @@ -605,9 +703,17 @@ dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale ); if ( dist <= 48 && dist >= -48 ) { - FT_Pos delta1, delta2; +#if 0 + FT_Pos delta1; +#endif + FT_Pos delta2; + /* use discrete values for blue zone widths */ + +#if 0 + + /* generic, original code */ delta1 = blue->shoot.org - blue->ref.org; delta2 = delta1; if ( delta1 < 0 ) @@ -628,6 +734,28 @@ blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); blue->shoot.fit = blue->ref.fit + delta2; +#else + + /* simplified version due to abs(dist) <= 48 */ + delta2 = dist; + if ( dist < 0 ) + delta2 = -delta2; + + if ( delta2 < 32 ) + delta2 = 0; + else if ( delta < 48 ) + delta2 = 32; + else + delta2 = 64; + + if ( dist < 0 ) + delta2 = -delta2; + + blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); + blue->shoot.fit = blue->ref.fit - delta2; + +#endif + blue->flags |= AF_LATIN_BLUE_ACTIVE; } } @@ -635,12 +763,15 @@ } + /* Scale global values in both directions. */ + FT_LOCAL_DEF( void ) af_latin_metrics_scale( AF_LatinMetrics metrics, AF_Scaler scaler ) { metrics->root.scaler.render_mode = scaler->render_mode; metrics->root.scaler.face = scaler->face; + metrics->root.scaler.flags = scaler->flags; af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT ); @@ -655,18 +786,21 @@ /*************************************************************************/ /*************************************************************************/ + + /* Walk over all contours and compute its segments. */ + FT_LOCAL_DEF( FT_Error ) af_latin_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ) { - AF_AxisHints axis = &hints->axis[dim]; - FT_Memory memory = hints->memory; - FT_Error error = AF_Err_Ok; - AF_Segment segment = NULL; - AF_SegmentRec seg0; - AF_Point* contour = hints->contours; - AF_Point* contour_limit = contour + hints->num_contours; - AF_Direction major_dir, segment_dir; + AF_AxisHints axis = &hints->axis[dim]; + FT_Memory memory = hints->memory; + FT_Error error = AF_Err_Ok; + AF_Segment segment = NULL; + AF_SegmentRec seg0; + AF_Point* contour = hints->contours; + AF_Point* contour_limit = contour + hints->num_contours; + AF_Direction major_dir, segment_dir; FT_ZERO( &seg0 ); @@ -762,7 +896,7 @@ /* a segment is round if either its first or last point */ /* is a control point */ if ( ( segment->first->flags | point->flags ) & - AF_FLAG_CONTROL ) + AF_FLAG_CONTROL ) segment->flags |= AF_EDGE_ROUND; /* compute segment size */ @@ -781,7 +915,7 @@ on_edge = 0; segment = NULL; - /* fallthrough */ + /* fall through */ } } @@ -808,7 +942,6 @@ min_pos = max_pos = point->u; segment->first = point; segment->last = point; - segment->contour = contour; on_edge = 1; } @@ -818,8 +951,8 @@ } /* contours */ - /* now slightly increase the height of segments when this makes */ - /* sense -- this is used to better detect and ignore serifs */ + /* now slightly increase the height of segments if this makes */ + /* sense -- this is used to better detect and ignore serifs */ { AF_Segment segments = axis->segments; AF_Segment segments_end = segments + axis->num_segments; @@ -874,6 +1007,8 @@ } + /* Link segments to form stems and serifs. */ + FT_LOCAL_DEF( void ) af_latin_hints_link_segments( AF_GlyphHints hints, AF_Dimension dim ) @@ -899,51 +1034,56 @@ if ( seg1->dir != axis->major_dir || seg1->first == seg1->last ) continue; + /* search for stems having opposite directions, */ + /* with seg1 to the `left' of seg2 */ for ( seg2 = segments; seg2 < segment_limit; seg2++ ) - if ( seg1->dir + seg2->dir == 0 && seg2->pos > seg1->pos ) + { + FT_Pos pos1 = seg1->pos; + FT_Pos pos2 = seg2->pos; + + + if ( seg1->dir + seg2->dir == 0 && pos2 > pos1 ) { - FT_Pos pos1 = seg1->pos; - FT_Pos pos2 = seg2->pos; + /* compute distance between the two segments */ FT_Pos dist = pos2 - pos1; + FT_Pos min = seg1->min_coord; + FT_Pos max = seg1->max_coord; + FT_Pos len, score; - if ( dist < 0 ) - dist = -dist; + if ( min < seg2->min_coord ) + min = seg2->min_coord; + if ( max > seg2->max_coord ) + max = seg2->max_coord; + + /* compute maximum coordinate difference of the two segments */ + len = max - min; + if ( len >= len_threshold ) { - FT_Pos min = seg1->min_coord; - FT_Pos max = seg1->max_coord; - FT_Pos len, score; + /* small coordinate differences cause a higher score, and */ + /* segments with a greater distance cause a higher score also */ + score = dist + len_score / len; + /* and we search for the smallest score */ + /* of the sum of the two values */ + if ( score < seg1->score ) + { + seg1->score = score; + seg1->link = seg2; + } - if ( min < seg2->min_coord ) - min = seg2->min_coord; - - if ( max > seg2->max_coord ) - max = seg2->max_coord; - - len = max - min; - if ( len >= len_threshold ) + if ( score < seg2->score ) { - score = dist + len_score / len; - - if ( score < seg1->score ) - { - seg1->score = score; - seg1->link = seg2; - } - - if ( score < seg2->score ) - { - seg2->score = score; - seg2->link = seg1; - } + seg2->score = score; + seg2->link = seg1; } } } + } } - /* now, compute the `serif' segments */ + /* now compute the `serif' segments, cf. explanations in `afhints.h' */ for ( seg1 = segments; seg1 < segment_limit; seg1++ ) { seg2 = seg1->link; @@ -960,6 +1100,8 @@ } + /* Link segments to edges, using feature analysis for selection. */ + FT_LOCAL_DEF( FT_Error ) af_latin_hints_compute_edges( AF_GlyphHints hints, AF_Dimension dim ) @@ -973,7 +1115,9 @@ AF_Segment segment_limit = segments + axis->num_segments; AF_Segment seg; +#if 0 AF_Direction up_dir; +#endif FT_Fixed scale; FT_Pos edge_distance_threshold; FT_Pos segment_length_threshold; @@ -984,11 +1128,13 @@ scale = ( dim == AF_DIMENSION_HORZ ) ? hints->x_scale : hints->y_scale; +#if 0 up_dir = ( dim == AF_DIMENSION_HORZ ) ? AF_DIR_UP : AF_DIR_RIGHT; +#endif /* - * We ignore all segments that are less than 1 pixels in length, + * We ignore all segments that are less than 1 pixel in length * to avoid many problems with serif fonts. We compute the * corresponding threshold in font units. */ @@ -999,20 +1145,21 @@ /*********************************************************************/ /* */ - /* We will begin by generating a sorted table of edges for the */ - /* current direction. To do so, we simply scan each segment and try */ - /* to find an edge in our table that corresponds to its position. */ + /* We begin by generating a sorted table of edges for the current */ + /* direction. To do so, we simply scan each segment and try to find */ + /* an edge in our table that corresponds to its position. */ /* */ /* If no edge is found, we create and insert a new edge in the */ /* sorted table. Otherwise, we simply add the segment to the edge's */ - /* list which will be processed in the second step to compute the */ + /* list which gets processed in the second step to compute the */ /* edge's properties. */ /* */ - /* Note that the edges table is sorted along the segment/edge */ + /* Note that the table of edges is sorted along the segment/edge */ /* position. */ /* */ /*********************************************************************/ + /* assure that edge distance threshold is at most 0.25px */ edge_distance_threshold = FT_MulFix( laxis->edge_distance_threshold, scale ); if ( edge_distance_threshold > 64 / 4 ) @@ -1023,7 +1170,7 @@ for ( seg = segments; seg < segment_limit; seg++ ) { - AF_Edge found = 0; + AF_Edge found = NULL; FT_Int ee; @@ -1072,9 +1219,10 @@ edge->first = seg; edge->last = seg; + edge->dir = seg->dir; edge->fpos = seg->pos; - edge->dir = seg->dir; - edge->opos = edge->pos = FT_MulFix( seg->pos, scale ); + edge->opos = FT_MulFix( seg->pos, scale ); + edge->pos = edge->opos; seg->edge_next = seg; } else @@ -1088,17 +1236,17 @@ } - /*********************************************************************/ - /* */ - /* Good, we will now compute each edge's properties according to */ - /* segments found on its position. Basically, these are: */ - /* */ - /* - edge's main direction */ - /* - stem edge, serif edge or both (which defaults to stem then) */ - /* - rounded edge, straight or both (which defaults to straight) */ - /* - link for edge */ - /* */ - /*********************************************************************/ + /******************************************************************/ + /* */ + /* Good, we now compute each edge's properties according to the */ + /* segments found on its position. Basically, these are */ + /* */ + /* - the edge's main direction */ + /* - stem edge, serif edge or both (which defaults to stem then) */ + /* - rounded edge, straight or both (which defaults to straight) */ + /* - link for edge */ + /* */ + /******************************************************************/ /* first of all, set the `edge' field in each segment -- this is */ /* required in order to compute edge links */ @@ -1126,13 +1274,15 @@ } while ( seg != edge->first ); } - /* now, compute each edge properties */ + /* now compute each edge properties */ for ( edge = edges; edge < edge_limit; edge++ ) { FT_Int is_round = 0; /* does it contain round segments? */ FT_Int is_straight = 0; /* does it contain straight segments? */ +#if 0 FT_Pos ups = 0; /* number of upwards segments */ FT_Pos downs = 0; /* number of downwards segments */ +#endif seg = edge->first; @@ -1148,11 +1298,13 @@ else is_straight++; +#if 0 /* check for segment direction */ if ( seg->dir == up_dir ) - ups += seg->max_coord-seg->min_coord; + ups += seg->max_coord - seg->min_coord; else - downs += seg->max_coord-seg->min_coord; + downs += seg->max_coord - seg->min_coord; +#endif /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ @@ -1228,7 +1380,7 @@ edge->dir = 0; /* both up and down! */ #endif - /* gets rid of serifs if link is set */ + /* get rid of serifs if link is set */ /* XXX: This gets rid of many unpleasant artefacts! */ /* Example: the `c' in cour.pfa at size 13 */ @@ -1242,6 +1394,8 @@ } + /* Detect segments and edges for given dimension. */ + FT_LOCAL_DEF( FT_Error ) af_latin_hints_detect_features( AF_GlyphHints hints, AF_Dimension dim ) @@ -1256,18 +1410,21 @@ error = af_latin_hints_compute_edges( hints, dim ); } + return error; } + /* Compute all edges which lie within blue zones. */ + FT_LOCAL_DEF( void ) af_latin_hints_compute_blue_edges( AF_GlyphHints hints, AF_LatinMetrics metrics ) { - AF_AxisHints axis = &hints->axis[ AF_DIMENSION_VERT ]; + AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT]; AF_Edge edge = axis->edges; AF_Edge edge_limit = edge + axis->num_edges; - AF_LatinAxis latin = &metrics->axis[ AF_DIMENSION_VERT ]; + AF_LatinAxis latin = &metrics->axis[AF_DIMENSION_VERT]; FT_Fixed scale = latin->scale; @@ -1277,24 +1434,26 @@ /* for each horizontal edge search the blue zone which is closest */ for ( ; edge < edge_limit; edge++ ) { - FT_Int bb; + FT_UInt bb; AF_Width best_blue = NULL; FT_Pos best_dist; /* initial threshold */ /* compute the initial threshold as a fraction of the EM size */ + /* (the value 40 is heuristic) */ best_dist = FT_MulFix( metrics->units_per_em / 40, scale ); + /* assure a minimum distance of 0.5px */ if ( best_dist > 64 / 2 ) best_dist = 64 / 2; - for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ ) + for ( bb = 0; bb < latin->blue_count; bb++ ) { AF_LatinBlue blue = latin->blues + bb; FT_Bool is_top_blue, is_major_dir; - /* skip inactive blue zones (i.e., those that are too small) */ + /* skip inactive blue zones (i.e., those that are too large) */ if ( !( blue->flags & AF_LATIN_BLUE_ACTIVE ) ) continue; @@ -1322,12 +1481,13 @@ if ( dist < best_dist ) { best_dist = dist; - best_blue = & blue->ref; + best_blue = &blue->ref; } - /* now, compare it to the overshoot position if the edge is */ - /* rounded, and if the edge is over the reference position of a */ - /* top zone, or under the reference position of a bottom zone */ + /* now compare it to the overshoot position and check whether */ + /* the edge is rounded, and whether the edge is over the */ + /* reference position of a top zone, or under the reference */ + /* position of a bottom zone */ if ( edge->flags & AF_EDGE_ROUND && dist != 0 ) { FT_Bool is_under_ref = FT_BOOL( edge->fpos < blue->ref.org ); @@ -1335,7 +1495,6 @@ if ( is_top_blue ^ is_under_ref ) { - blue = latin->blues + bb; dist = edge->fpos - blue->shoot.org; if ( dist < 0 ) dist = -dist; @@ -1344,7 +1503,7 @@ if ( dist < best_dist ) { best_dist = dist; - best_blue = & blue->shoot; + best_blue = &blue->shoot; } } } @@ -1357,6 +1516,8 @@ } + /* Initalize hinting engine. */ + static FT_Error af_latin_hints_init( AF_GlyphHints hints, AF_LatinMetrics metrics ) @@ -1370,7 +1531,7 @@ /* * correct x_scale and y_scale if needed, since they may have - * been modified `af_latin_metrics_scale_dim' above + * been modified by `af_latin_metrics_scale_dim' above */ hints->x_scale = metrics->axis[AF_DIMENSION_HORZ].scale; hints->x_delta = metrics->axis[AF_DIMENSION_HORZ].delta; @@ -1380,11 +1541,9 @@ /* compute flags depending on render mode, etc. */ mode = metrics->root.scaler.render_mode; -#if 0 /* #ifdef AF_USE_WARPER */ +#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) - { metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; - } #endif scaler_flags = hints->scaler_flags; @@ -1417,14 +1576,14 @@ * 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; hints->other_flags = other_flags; - return 0; + return AF_Err_Ok; } @@ -1436,8 +1595,8 @@ /*************************************************************************/ /*************************************************************************/ - /* snap a given width in scaled coordinates to one of the */ - /* current standard widths */ + /* Snap a given width in scaled coordinates to one of the */ + /* current standard widths. */ static FT_Pos af_latin_snap_width( AF_Width widths, @@ -1484,7 +1643,9 @@ } - /* compute the snapped width of a given stem */ + /* Compute the snapped width of a given stem, ignoring very thin ones. */ + /* There is a lot of voodoo in this function; changing the hard-coded */ + /* parameters influence the whole hinting process. */ static FT_Pos af_latin_compute_stem_width( AF_GlyphHints hints, @@ -1501,7 +1662,7 @@ if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || - axis->extra_light ) + axis->extra_light ) return width; if ( dist < 0 ) @@ -1516,11 +1677,12 @@ /* smooth hinting process: very lightly quantize the stem width */ /* leave the widths of serifs alone */ - - if ( ( stem_flags & AF_EDGE_SERIF ) && vertical && ( dist < 3 * 64 ) ) + if ( ( stem_flags & AF_EDGE_SERIF ) && + vertical && + ( dist < 3 * 64 ) ) goto Done_Width; - else if ( ( base_flags & AF_EDGE_ROUND ) ) + else if ( base_flags & AF_EDGE_ROUND ) { if ( dist < 80 ) dist = 64; @@ -1572,6 +1734,7 @@ else { /* strong hinting process: snap the stem width to integer pixels */ + FT_Pos org_dist = dist; @@ -1646,7 +1809,7 @@ } - /* align one stem edge relative to the previous stem edge */ + /* Align one stem edge relative to the previous stem edge. */ static void af_latin_align_linked_edge( AF_GlyphHints hints, @@ -1664,13 +1827,16 @@ stem_edge->pos = base_edge->pos + fitted_width; - AF_LOG(( "LINK: edge %d (opos=%.2f) linked to (%.2f), " - "dist was %.2f, now %.2f\n", - stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0, - stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); + FT_TRACE5(( " LINK: edge %d (opos=%.2f) linked to %.2f," + " dist was %.2f, now %.2f\n", + stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0, + stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); } + /* Shift the coordinates of the `serif' edge by the same amount */ + /* as the corresponding `base' edge has been moved already. */ + static void af_latin_align_serif_edge( AF_GlyphHints hints, AF_Edge base, @@ -1678,7 +1844,7 @@ { FT_UNUSED( hints ); - serif->pos = base->pos + (serif->opos - base->opos); + serif->pos = base->pos + ( serif->opos - base->opos ); } @@ -1693,6 +1859,8 @@ /*************************************************************************/ + /* The main grid-fitting routine. */ + FT_LOCAL_DEF( void ) af_latin_hint_edges( AF_GlyphHints hints, AF_Dimension dim ) @@ -1702,10 +1870,17 @@ AF_Edge edge_limit = edges + axis->num_edges; FT_PtrDist n_edges; AF_Edge edge; - AF_Edge anchor = 0; + AF_Edge anchor = NULL; FT_Int has_serifs = 0; +#ifdef FT_DEBUG_LEVEL_TRACE + FT_UInt num_actions = 0; +#endif + + FT_TRACE5(( "%s edge hinting\n", + dim == AF_DIMENSION_VERT ? "horizontal" : "vertical" )); + /* we begin by aligning all stems relative to the blue zone */ /* if needed -- that's only for horizontal edges */ @@ -1714,7 +1889,7 @@ for ( edge = edges; edge < edge_limit; edge++ ) { AF_Width blue; - AF_Edge edge1, edge2; + AF_Edge edge1, edge2; /* these edges form the stem to check */ if ( edge->flags & AF_EDGE_DONE ) @@ -1725,9 +1900,9 @@ edge2 = edge->link; if ( blue ) - { edge1 = edge; - } + + /* flip edges if the other stem is aligned to a blue zone */ else if ( edge2 && edge2->blue_edge ) { blue = edge2->blue_edge; @@ -1738,11 +1913,21 @@ if ( !edge1 ) continue; - AF_LOG(( "BLUE: edge %d (opos=%.2f) snapped to (%.2f), " - "was (%.2f)\n", - edge1-edges, edge1->opos / 64.0, blue->fit / 64.0, - edge1->pos / 64.0 )); +#ifdef FT_DEBUG_LEVEL_TRACE + 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, + edge1->pos / 64.0, edge - edges )); + else + FT_TRACE5(( " BLUE: edge %d (opos=%.2f) snapped to %.2f," + " was %.2f\n", + edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0, + edge1->pos / 64.0 )); + num_actions++; +#endif + edge1->pos = blue->fit; edge1->flags |= AF_EDGE_DONE; @@ -1750,6 +1935,10 @@ { af_latin_align_linked_edge( hints, dim, edge1, edge2 ); edge2->flags |= AF_EDGE_DONE; + +#ifdef FT_DEBUG_LEVEL_TRACE + num_actions++; +#endif } if ( !anchor ) @@ -1757,8 +1946,8 @@ } } - /* now we will align all stem edges, trying to maintain the */ - /* relative order of stems in the glyph */ + /* now we align all other stem edges, trying to maintain the */ + /* relative order of stems in the glyph */ for ( edge = edges; edge < edge_limit; edge++ ) { AF_Edge edge2; @@ -1780,15 +1969,21 @@ /* this should not happen, but it's better to be safe */ if ( edge2->blue_edge ) { - AF_LOG(( "ASSERTION FAILED for edge %d\n", edge2-edges )); + FT_TRACE5(( " ASSERTION FAILED for edge %d\n", edge2-edges )); af_latin_align_linked_edge( hints, dim, edge2, edge ); edge->flags |= AF_EDGE_DONE; + +#ifdef FT_DEBUG_LEVEL_TRACE + num_actions++; +#endif continue; } if ( !anchor ) { + /* if we reach this if clause, no stem has been aligned yet */ + FT_Pos org_len, org_center, cur_len; FT_Pos cur_pos1, error1, error2, u_off, d_off; @@ -1798,10 +1993,19 @@ hints, dim, org_len, (AF_Edge_Flags)edge->flags, (AF_Edge_Flags)edge2->flags ); + + /* some voodoo to specially round edges for small stem widths; */ + /* the idea is to align the center of a stem, then shifting */ + /* the stem edges to suitable positions */ if ( cur_len <= 64 ) - u_off = d_off = 32; + { + /* width <= 1px */ + u_off = 32; + d_off = 32; + } else { + /* 1px < width < 1.5px */ u_off = 38; d_off = 26; } @@ -1809,7 +2013,6 @@ if ( cur_len < 96 ) { org_center = edge->opos + ( org_len >> 1 ); - cur_pos1 = FT_PIX_ROUND( org_center ); error1 = org_center - ( cur_pos1 - u_off ); @@ -1831,16 +2034,20 @@ else edge->pos = FT_PIX_ROUND( edge->opos ); - AF_LOG(( "ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f) " - "snapped to (%.2f) (%.2f)\n", - edge-edges, edge->opos / 64.0, - edge2-edges, edge2->opos / 64.0, - edge->pos / 64.0, edge2->pos / 64.0 )); - anchor = edge; - + anchor = edge; edge->flags |= AF_EDGE_DONE; + FT_TRACE5(( " ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)" + " snapped to %.2f and %.2f\n", + edge - edges, edge->opos / 64.0, + edge2 - edges, edge2->opos / 64.0, + edge->pos / 64.0, edge2->pos / 64.0 )); + af_latin_align_linked_edge( hints, dim, edge, edge2 ); + +#ifdef FT_DEBUG_LEVEL_TRACE + num_actions += 2; +#endif } else { @@ -1853,12 +2060,18 @@ org_center = org_pos + ( org_len >> 1 ); cur_len = af_latin_compute_stem_width( - hints, dim, org_len, - (AF_Edge_Flags)edge->flags, - (AF_Edge_Flags)edge2->flags ); + hints, dim, org_len, + (AF_Edge_Flags)edge->flags, + (AF_Edge_Flags)edge2->flags ); if ( edge2->flags & AF_EDGE_DONE ) + { + FT_TRACE5(( " ADJUST: edge %d (pos=%.2f) moved to %.2f\n", + edge - edges, edge->pos / 64.0, + ( edge2->pos - cur_len ) / 64.0 )); + edge->pos = edge2->pos - cur_len; + } else if ( cur_len < 96 ) { @@ -1868,7 +2081,10 @@ cur_pos1 = FT_PIX_ROUND( org_center ); if (cur_len <= 64 ) - u_off = d_off = 32; + { + u_off = 32; + d_off = 32; + } else { u_off = 38; @@ -1891,12 +2107,13 @@ edge->pos = cur_pos1 - cur_len / 2; edge2->pos = cur_pos1 + cur_len / 2; - AF_LOG(( "STEM: %d (opos=%.2f) to %d (opos=%.2f) " - "snapped to (%.2f) and (%.2f)\n", - edge-edges, edge->opos / 64.0, - edge2-edges, edge2->opos / 64.0, - edge->pos / 64.0, edge2->pos / 64.0 )); + FT_TRACE5(( " STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)" + " snapped to %.2f and %.2f\n", + edge - edges, edge->opos / 64.0, + edge2 - edges, edge2->opos / 64.0, + edge->pos / 64.0, edge2->pos / 64.0 )); } + else { org_pos = anchor->pos + ( edge->opos - anchor->opos ); @@ -1908,33 +2125,42 @@ (AF_Edge_Flags)edge->flags, (AF_Edge_Flags)edge2->flags ); - cur_pos1 = FT_PIX_ROUND( org_pos ); - delta1 = cur_pos1 + ( cur_len >> 1 ) - org_center; + cur_pos1 = FT_PIX_ROUND( org_pos ); + delta1 = cur_pos1 + ( cur_len >> 1 ) - org_center; if ( delta1 < 0 ) delta1 = -delta1; - cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len; - delta2 = cur_pos2 + ( cur_len >> 1 ) - org_center; + cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len; + delta2 = cur_pos2 + ( cur_len >> 1 ) - org_center; if ( delta2 < 0 ) delta2 = -delta2; edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2; edge2->pos = edge->pos + cur_len; - AF_LOG(( "STEM: %d (opos=%.2f) to %d (opos=%.2f) " - "snapped to (%.2f) and (%.2f)\n", - edge-edges, edge->opos / 64.0, - edge2-edges, edge2->opos / 64.0, - edge->pos / 64.0, edge2->pos / 64.0 )); + FT_TRACE5(( " STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)" + " snapped to %.2f and %.2f\n", + edge - edges, edge->opos / 64.0, + edge2 - edges, edge2->opos / 64.0, + edge->pos / 64.0, edge2->pos / 64.0 )); } +#ifdef FT_DEBUG_LEVEL_TRACE + num_actions++; +#endif + edge->flags |= AF_EDGE_DONE; edge2->flags |= AF_EDGE_DONE; if ( edge > edges && edge->pos < edge[-1].pos ) { - AF_LOG(( "BOUND: %d (pos=%.2f) to (%.2f)\n", - edge-edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n", + edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); + + num_actions++; +#endif + edge->pos = edge[-1].pos; } } @@ -2028,18 +2254,19 @@ if ( delta < 64 + 16 ) { af_latin_align_serif_edge( hints, edge->serif, edge ); - AF_LOG(( "SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f) " - "aligned to (%.2f)\n", - edge-edges, edge->opos / 64.0, - edge->serif - edges, edge->serif->opos / 64.0, - edge->pos / 64.0 )); + FT_TRACE5(( " SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)" + " aligned to %.2f\n", + edge - edges, edge->opos / 64.0, + edge->serif - edges, edge->serif->opos / 64.0, + edge->pos / 64.0 )); } else if ( !anchor ) { - AF_LOG(( "SERIF_ANCHOR: edge %d (opos=%.2f) snapped to (%.2f)\n", - edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); edge->pos = FT_PIX_ROUND( edge->opos ); anchor = edge; + FT_TRACE5(( " SERIF_ANCHOR: edge %d (opos=%.2f)" + " snapped to %.2f\n", + edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); } else { @@ -2064,35 +2291,65 @@ FT_MulDiv( edge->opos - before->opos, after->pos - before->pos, after->opos - before->opos ); - AF_LOG(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f) " - "from %d (opos=%.2f)\n", - edge-edges, edge->opos / 64.0, - edge->pos / 64.0, before - edges, - before->opos / 64.0 )); + + FT_TRACE5(( " SERIF_LINK1: edge %d (opos=%.2f) snapped to %.2f" + " from %d (opos=%.2f)\n", + edge - edges, edge->opos / 64.0, + edge->pos / 64.0, + before - edges, before->opos / 64.0 )); } else { edge->pos = anchor->pos + ( ( edge->opos - anchor->opos + 16 ) & ~31 ); - AF_LOG(( "SERIF_LINK2: edge %d (opos=%.2f) snapped to (%.2f)\n", - edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); + FT_TRACE5(( " SERIF_LINK2: edge %d (opos=%.2f)" + " snapped to %.2f\n", + edge - edges, edge->opos / 64.0, edge->pos / 64.0 )); } } +#ifdef FT_DEBUG_LEVEL_TRACE + num_actions++; +#endif edge->flags |= AF_EDGE_DONE; if ( edge > edges && edge->pos < edge[-1].pos ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n", + edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); + + num_actions++; +#endif edge->pos = edge[-1].pos; + } if ( edge + 1 < edge_limit && edge[1].flags & AF_EDGE_DONE && edge->pos > edge[1].pos ) + { +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE5(( " BOUND: edge %d (pos=%.2f) moved to %.2f\n", + edge - edges, edge->pos / 64.0, edge[1].pos / 64.0 )); + + num_actions++; +#endif + edge->pos = edge[1].pos; + } } } + +#ifdef FT_DEBUG_LEVEL_TRACE + if ( !num_actions ) + FT_TRACE5(( " (none)\n" )); + FT_TRACE5(( "\n" )); +#endif } + /* Apply the complete hinting algorithm to a latin glyph. */ + static FT_Error af_latin_hints_apply( AF_GlyphHints hints, FT_Outline* outline, @@ -2107,9 +2364,9 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || - AF_HINTS_DO_HORIZONTAL( hints ) ) + AF_HINTS_DO_HORIZONTAL( hints ) ) #else if ( AF_HINTS_DO_HORIZONTAL( hints ) ) #endif @@ -2131,17 +2388,19 @@ /* grid-fit the outline */ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { -#ifdef AF_USE_WARPER - if ( ( dim == AF_DIMENSION_HORZ && - metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) ) +#ifdef AF_CONFIG_OPTION_USE_WARPER + if ( dim == AF_DIMENSION_HORZ && + metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) { AF_WarperRec warper; FT_Fixed scale; FT_Pos delta; - af_warper_compute( &warper, hints, dim, &scale, &delta ); - af_glyph_hints_scale_dim( hints, dim, scale, delta ); + af_warper_compute( &warper, hints, (AF_Dimension)dim, + &scale, &delta ); + af_glyph_hints_scale_dim( hints, (AF_Dimension)dim, + scale, delta ); continue; } #endif @@ -2198,19 +2457,22 @@ AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */ + AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */ AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */ AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */ + AF_UNIRANGE_REC( 0x1F100UL, 0x1F1FFUL ), /* Enclosed Alphanumeric Supplement */ AF_UNIRANGE_REC( 0UL, 0UL ) }; - AF_DEFINE_SCRIPT_CLASS(af_latin_script_class, + AF_DEFINE_SCRIPT_CLASS( af_latin_script_class, AF_SCRIPT_LATIN, af_latin_uniranges, + 'o', - sizeof( AF_LatinMetricsRec ), + sizeof ( AF_LatinMetricsRec ), (AF_Script_InitMetricsFunc) af_latin_metrics_init, (AF_Script_ScaleMetricsFunc)af_latin_metrics_scale, Index: src/autofit/aflatin.h =================================================================== --- src/autofit/aflatin.h (revision 58178) +++ src/autofit/aflatin.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (specification). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2009 by */ +/* Copyright 2003-2007, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,11 +27,11 @@ /* the latin-specific script class */ - AF_DECLARE_SCRIPT_CLASS(af_latin_script_class) + AF_DECLARE_SCRIPT_CLASS( af_latin_script_class ) -/* constants are given with units_per_em == 2048 in mind */ -#define AF_LATIN_CONSTANT( metrics, c ) \ + /* constants are given with units_per_em == 2048 in mind */ +#define AF_LATIN_CONSTANT( metrics, c ) \ ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 ) @@ -76,10 +76,10 @@ enum { - AF_LATIN_BLUE_ACTIVE = 1 << 0, - AF_LATIN_BLUE_TOP = 1 << 1, - AF_LATIN_BLUE_ADJUSTMENT = 1 << 2, /* used for scale adjustment */ - /* optimization */ + AF_LATIN_BLUE_ACTIVE = 1 << 0, /* set if zone height is <= 3/4px */ + AF_LATIN_BLUE_TOP = 1 << 1, /* result of AF_LATIN_IS_TOP_BLUE */ + AF_LATIN_BLUE_ADJUSTMENT = 1 << 2, /* used for scale adjustment */ + /* optimization */ AF_LATIN_BLUE_FLAG_MAX }; @@ -98,14 +98,13 @@ FT_Fixed scale; FT_Pos delta; - FT_UInt width_count; - AF_WidthRec widths[AF_LATIN_MAX_WIDTHS]; - FT_Pos edge_distance_threshold; - FT_Pos standard_width; - FT_Bool extra_light; + FT_UInt width_count; /* number of used widths */ + AF_WidthRec widths[AF_LATIN_MAX_WIDTHS]; /* widths array */ + FT_Pos edge_distance_threshold; /* used for creating edges */ + FT_Pos standard_width; /* the default stem thickness */ + FT_Bool extra_light; /* is standard width very light? */ /* ignored for horizontal metrics */ - FT_Bool control_overshoot; FT_UInt blue_count; AF_LatinBlueRec blues[AF_LATIN_BLUE_MAX]; @@ -134,8 +133,7 @@ FT_LOCAL( void ) af_latin_metrics_init_widths( AF_LatinMetrics metrics, - FT_Face face, - FT_ULong charcode ); + FT_Face face ); FT_LOCAL( void ) af_latin_metrics_check_digits( AF_LatinMetrics metrics, @@ -175,25 +173,17 @@ /* - * This shouldn't normally be exported. However, other scripts might - * like to use this function as-is. + * The next functions shouldn't normally be exported. However, other + * scripts might like to use these functions as-is. */ FT_LOCAL( FT_Error ) af_latin_hints_compute_segments( AF_GlyphHints hints, AF_Dimension dim ); - /* - * This shouldn't normally be exported. However, other scripts might - * want to use this function as-is. - */ FT_LOCAL( void ) af_latin_hints_link_segments( AF_GlyphHints hints, AF_Dimension dim ); - /* - * This shouldn't normally be exported. However, other scripts might - * want to use this function as-is. - */ FT_LOCAL( FT_Error ) af_latin_hints_compute_edges( AF_GlyphHints hints, AF_Dimension dim ); Index: src/autofit/aflatin2.c =================================================================== --- src/autofit/aflatin2.c (revision 58178) +++ src/autofit/aflatin2.c (working copy) @@ -1,10 +1,10 @@ /***************************************************************************/ /* */ -/* aflatin.c */ +/* aflatin2.c */ /* */ /* Auto-fitter hinting routines for latin script (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2003-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,18 +18,30 @@ #include FT_ADVANCES_H +#include "afglobal.h" #include "aflatin.h" #include "aflatin2.h" #include "aferrors.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.h" #endif + + /*************************************************************************/ + /* */ + /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ + /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ + /* messages during execution. */ + /* */ +#undef FT_COMPONENT +#define FT_COMPONENT trace_aflatin2 + + FT_LOCAL_DEF( FT_Error ) af_latin2_hints_compute_segments( AF_GlyphHints hints, - AF_Dimension dim ); + AF_Dimension dim ); FT_LOCAL_DEF( void ) af_latin2_hints_link_segments( AF_GlyphHints hints, @@ -45,8 +57,7 @@ FT_LOCAL_DEF( void ) af_latin2_metrics_init_widths( AF_LatinMetrics metrics, - FT_Face face, - FT_ULong charcode ) + FT_Face face ) { /* scan the array of segments in each direction */ AF_GlyphHintsRec hints[1]; @@ -65,7 +76,8 @@ AF_Scaler scaler = &dummy->root.scaler; - glyph_index = FT_Get_Char_Index( face, charcode ); + glyph_index = FT_Get_Char_Index( face, + metrics->root.clazz->standard_char ); if ( glyph_index == 0 ) goto Exit; @@ -122,7 +134,7 @@ dist = -dist; if ( num_widths < AF_LATIN_MAX_WIDTHS ) - axis->widths[ num_widths++ ].org = dist; + axis->widths[num_widths++].org = dist; } } @@ -156,7 +168,8 @@ #define AF_LATIN_MAX_TEST_CHARACTERS 12 - static const char af_latin2_blue_chars[AF_LATIN_MAX_BLUES][AF_LATIN_MAX_TEST_CHARACTERS+1] = + static const char af_latin2_blue_chars[AF_LATIN_MAX_BLUES] + [AF_LATIN_MAX_TEST_CHARACTERS+1] = { "THEZOCQS", "HEZLOCUS", @@ -169,7 +182,7 @@ static void af_latin2_metrics_init_blues( AF_LatinMetrics metrics, - FT_Face face ) + FT_Face face ) { FT_Pos flats [AF_LATIN_MAX_TEST_CHARACTERS]; FT_Pos rounds[AF_LATIN_MAX_TEST_CHARACTERS]; @@ -182,12 +195,12 @@ FT_GlyphSlot glyph = face->glyph; - /* we compute the blues simply by loading each character from the */ + /* we compute the blues simply by loading each character from the */ /* 'af_latin2_blue_chars[blues]' string, then compute its top-most or */ - /* bottom-most points (depending on `AF_IS_TOP_BLUE') */ + /* bottom-most points (depending on `AF_IS_TOP_BLUE') */ - AF_LOG(( "blue zones computation\n" )); - AF_LOG(( "------------------------------------------------\n" )); + FT_TRACE5(( "blue zones computation\n" + "======================\n\n" )); for ( bb = 0; bb < AF_LATIN_BLUE_MAX; bb++ ) { @@ -197,7 +210,7 @@ FT_Pos* blue_shoot; - AF_LOG(( "blue %3d: ", bb )); + FT_TRACE5(( "blue zone %d:\n", bb )); num_flats = 0; num_rounds = 0; @@ -210,8 +223,6 @@ FT_Bool round; - AF_LOG(( "'%c'", *p )); - /* load the character in the face -- skip unknown or empty ones */ glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p ); if ( glyph_index == 0 ) @@ -273,13 +284,14 @@ best_last = last; } } - AF_LOG(( "%5d", best_y )); + FT_TRACE5(( " %c %d", *p, best_y )); } /* now check whether the point belongs to a straight or round */ /* segment; we first need to find in which contour the extremum */ /* lies, then inspect its previous and next points */ { + FT_Pos best_x = points[best_point].x; FT_Int start, end, prev, next; FT_Pos dist; @@ -290,13 +302,16 @@ do { - prev = start-1; + prev = start - 1; if ( prev < best_first ) prev = best_last; - dist = points[prev].y - best_y; - if ( dist < -5 || dist > 5 ) - break; + dist = FT_ABS( points[prev].y - best_y ); + /* accept a small distance or a small angle (both values are */ + /* heuristic; value 20 corresponds to approx. 2.9 degrees) */ + if ( dist > 5 ) + if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist ) + break; start = prev; @@ -304,13 +319,14 @@ do { - next = end+1; + next = end + 1; if ( next > best_last ) next = best_first; - dist = points[next].y - best_y; - if ( dist < -5 || dist > 5 ) - break; + dist = FT_ABS( points[next].y - best_y ); + if ( dist > 5 ) + if ( FT_ABS( points[next].x - best_x ) <= 20 * dist ) + break; end = next; @@ -321,7 +337,7 @@ FT_CURVE_TAG( glyph->outline.tags[start] ) != FT_CURVE_TAG_ON || FT_CURVE_TAG( glyph->outline.tags[ end ] ) != FT_CURVE_TAG_ON ); - AF_LOG(( "%c ", round ? 'r' : 'f' )); + FT_TRACE5(( " (%s)\n", round ? "round" : "flat" )); } if ( round ) @@ -330,15 +346,13 @@ flats[num_flats++] = best_y; } - AF_LOG(( "\n" )); - if ( num_flats == 0 && num_rounds == 0 ) { /* * we couldn't find a single glyph to compute this blue zone, * we will simply ignore it then */ - AF_LOG(( "empty\n" )); + FT_TRACE5(( " empty\n" )); continue; } @@ -381,7 +395,13 @@ if ( AF_LATIN_IS_TOP_BLUE( bb ) ^ over_ref ) - *blue_shoot = *blue_ref = ( shoot + ref ) / 2; + { + *blue_ref = + *blue_shoot = ( shoot + ref ) / 2; + + FT_TRACE5(( " [overshoot smaller than reference," + " taking mean value]\n" )); + } } blue->flags = 0; @@ -396,7 +416,9 @@ if ( bb == AF_LATIN_BLUE_SMALL_TOP ) blue->flags |= AF_LATIN_BLUE_ADJUSTMENT; - AF_LOG(( "-- ref = %ld, shoot = %ld\n", *blue_ref, *blue_shoot )); + FT_TRACE5(( " -> reference = %ld\n" + " overshoot = %ld\n", + *blue_ref, *blue_shoot )); } return; @@ -451,7 +473,7 @@ FT_LOCAL_DEF( FT_Error ) af_latin2_metrics_init( AF_LatinMetrics metrics, - FT_Face face ) + FT_Face face ) { FT_Error error = AF_Err_Ok; FT_CharMap oldmap = face->charmap; @@ -479,8 +501,7 @@ if ( !error ) { - /* For now, compute the standard width and height from the `o'. */ - af_latin2_metrics_init_widths( metrics, face, 'o' ); + af_latin2_metrics_init_widths( metrics, face ); af_latin2_metrics_init_blues( metrics, face ); af_latin2_metrics_check_digits( metrics, face ); } @@ -492,8 +513,8 @@ static void af_latin2_metrics_scale_dim( AF_LatinMetrics metrics, - AF_Scaler scaler, - AF_Dimension dim ) + AF_Scaler scaler, + AF_Dimension dim ) { FT_Fixed scale; FT_Pos delta; @@ -541,14 +562,35 @@ if ( blue ) { - FT_Pos scaled = FT_MulFix( blue->shoot.org, scaler->y_scale ); - FT_Pos fitted = ( scaled + 40 ) & ~63; + FT_Pos scaled; + FT_Pos threshold; + FT_Pos fitted; + FT_UInt limit; + FT_UInt ppem; + + scaled = FT_MulFix( blue->shoot.org, scaler->y_scale ); + ppem = metrics->root.scaler.face->size->metrics.x_ppem; + limit = metrics->root.globals->increase_x_height; + threshold = 40; + + /* if the `increase-x-height' property is active, */ + /* we round up much more often */ + if ( limit && + ppem <= limit && + ppem >= AF_PROP_INCREASE_X_HEIGHT_MIN ) + threshold = 52; + + fitted = ( scaled + threshold ) & ~63; + #if 1 if ( scaled != fitted ) { scale = FT_MulDiv( scale, fitted, scaled ); - AF_LOG(( "== scaled x-top = %.2g fitted = %.2g, scaling = %.4g\n", scaled/64.0, fitted/64.0, (fitted*1.0)/scaled )); + FT_TRACE5(( "== scaled x-top = %.2g" + " fitted = %.2g, scaling = %.4g\n", + scaled / 64.0, fitted / 64.0, + ( fitted * 1.0 ) / scaled )); } #endif } @@ -579,7 +621,7 @@ } /* an extra-light axis corresponds to a standard width that is */ - /* smaller than 0.75 pixels */ + /* smaller than 5/8 pixels */ axis->extra_light = (FT_Bool)( FT_MulFix( axis->standard_width, scale ) < 32 + 8 ); @@ -624,9 +666,11 @@ blue->ref.fit = FT_PIX_ROUND( blue->ref.cur ); blue->shoot.fit = blue->ref.fit + delta2; - AF_LOG(( ">> activating blue zone %d: ref.cur=%.2g ref.fit=%.2g shoot.cur=%.2g shoot.fit=%.2g\n", - nn, blue->ref.cur/64.0, blue->ref.fit/64.0, - blue->shoot.cur/64.0, blue->shoot.fit/64.0 )); + FT_TRACE5(( ">> activating blue zone %d:" + " ref.cur=%.2g ref.fit=%.2g" + " shoot.cur=%.2g shoot.fit=%.2g\n", + nn, blue->ref.cur / 64.0, blue->ref.fit / 64.0, + blue->shoot.cur / 64.0, blue->shoot.fit / 64.0 )); blue->flags |= AF_LATIN_BLUE_ACTIVE; } @@ -637,10 +681,11 @@ FT_LOCAL_DEF( void ) af_latin2_metrics_scale( AF_LatinMetrics metrics, - AF_Scaler scaler ) + AF_Scaler scaler ) { metrics->root.scaler.render_mode = scaler->render_mode; metrics->root.scaler.face = scaler->face; + metrics->root.scaler.flags = scaler->flags; af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT ); @@ -659,7 +704,7 @@ FT_LOCAL_DEF( FT_Error ) af_latin2_hints_compute_segments( AF_GlyphHints hints, - AF_Dimension dim ) + AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; FT_Memory memory = hints->memory; @@ -779,7 +824,6 @@ segment->dir = first->out_dir; segment->first = first; segment->last = point; - segment->contour = contour; segment->pos = (FT_Short)(( min_u + max_u ) >> 1); segment->min_coord = (FT_Short) min_v; segment->max_coord = (FT_Short) max_v; @@ -917,7 +961,7 @@ FT_LOCAL_DEF( void ) af_latin2_hints_link_segments( AF_GlyphHints hints, - AF_Dimension dim ) + AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; AF_Segment segments = axis->segments; @@ -1017,7 +1061,7 @@ FT_LOCAL_DEF( FT_Error ) af_latin2_hints_compute_edges( AF_GlyphHints hints, - AF_Dimension dim ) + AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; FT_Error error = AF_Err_Ok; @@ -1137,7 +1181,8 @@ /* insert a new edge in the list and */ /* sort according to the position */ - error = af_axis_hints_new_edge( axis, seg->pos, seg->dir, memory, &edge ); + error = af_axis_hints_new_edge( axis, seg->pos, seg->dir, + memory, &edge ); if ( error ) goto Exit; @@ -1205,8 +1250,10 @@ { FT_Int is_round = 0; /* does it contain round segments? */ FT_Int is_straight = 0; /* does it contain straight segments? */ +#if 0 FT_Pos ups = 0; /* number of upwards segments */ FT_Pos downs = 0; /* number of downwards segments */ +#endif seg = edge->first; @@ -1222,11 +1269,13 @@ else is_straight++; +#if 0 /* check for segment direction */ if ( seg->dir == up_dir ) ups += seg->max_coord-seg->min_coord; else downs += seg->max_coord-seg->min_coord; +#endif /* check for links -- if seg->serif is set, then seg->link must */ /* be ignored */ @@ -1318,7 +1367,7 @@ FT_LOCAL_DEF( FT_Error ) af_latin2_hints_detect_features( AF_GlyphHints hints, - AF_Dimension dim ) + AF_Dimension dim ) { FT_Error error; @@ -1336,12 +1385,12 @@ FT_LOCAL_DEF( void ) af_latin2_hints_compute_blue_edges( AF_GlyphHints hints, - AF_LatinMetrics metrics ) + AF_LatinMetrics metrics ) { - AF_AxisHints axis = &hints->axis[ AF_DIMENSION_VERT ]; + AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT]; AF_Edge edge = axis->edges; AF_Edge edge_limit = edge + axis->num_edges; - AF_LatinAxis latin = &metrics->axis[ AF_DIMENSION_VERT ]; + AF_LatinAxis latin = &metrics->axis[AF_DIMENSION_VERT]; FT_Fixed scale = latin->scale; FT_Pos best_dist0; /* initial threshold */ @@ -1442,7 +1491,7 @@ static FT_Error af_latin2_hints_init( AF_GlyphHints hints, - AF_LatinMetrics metrics ) + AF_LatinMetrics metrics ) { FT_Render_Mode mode; FT_UInt32 scaler_flags, other_flags; @@ -1463,7 +1512,7 @@ /* compute flags depending on render mode, etc. */ mode = metrics->root.scaler.render_mode; -#if 0 /* #ifdef AF_USE_WARPER */ +#if 0 /* #ifdef AF_CONFIG_OPTION_USE_WARPER */ if ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ) { metrics->root.scaler.render_mode = mode = FT_RENDER_MODE_NORMAL; @@ -1524,8 +1573,8 @@ static FT_Pos af_latin2_snap_width( AF_Width widths, - FT_Int count, - FT_Pos width ) + FT_Int count, + FT_Pos width ) { int n; FT_Pos best = 64 + 32 + 2; @@ -1571,10 +1620,10 @@ static FT_Pos af_latin2_compute_stem_width( AF_GlyphHints hints, - AF_Dimension dim, - FT_Pos width, - AF_Edge_Flags base_flags, - AF_Edge_Flags stem_flags ) + AF_Dimension dim, + FT_Pos width, + AF_Edge_Flags base_flags, + AF_Edge_Flags stem_flags ) { AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics; AF_LatinAxis axis = & metrics->axis[dim]; @@ -1739,9 +1788,9 @@ static void af_latin2_align_linked_edge( AF_GlyphHints hints, - AF_Dimension dim, - AF_Edge base_edge, - AF_Edge stem_edge ) + AF_Dimension dim, + AF_Edge base_edge, + AF_Edge stem_edge ) { FT_Pos dist = stem_edge->opos - base_edge->opos; @@ -1753,17 +1802,17 @@ stem_edge->pos = base_edge->pos + fitted_width; - AF_LOG(( "LINK: edge %d (opos=%.2f) linked to (%.2f), " - "dist was %.2f, now %.2f\n", - stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0, - stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); + FT_TRACE5(( "LINK: edge %d (opos=%.2f) linked to (%.2f), " + "dist was %.2f, now %.2f\n", + stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0, + stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); } static void af_latin2_align_serif_edge( AF_GlyphHints hints, - AF_Edge base, - AF_Edge serif ) + AF_Edge base, + AF_Edge serif ) { FT_UNUSED( hints ); @@ -1784,7 +1833,7 @@ FT_LOCAL_DEF( void ) af_latin2_hint_edges( AF_GlyphHints hints, - AF_Dimension dim ) + AF_Dimension dim ) { AF_AxisHints axis = &hints->axis[dim]; AF_Edge edges = axis->edges; @@ -1796,7 +1845,8 @@ - AF_LOG(( "==== hinting %s edges =====\n", dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); + FT_TRACE5(( "==== hinting %s edges =====\n", + dim == AF_DIMENSION_HORZ ? "vertical" : "horizontal" )); /* we begin by aligning all stems relative to the blue zone */ /* if needed -- that's only for horizontal edges */ @@ -1830,10 +1880,10 @@ if ( !edge1 ) continue; - AF_LOG(( "BLUE: edge %d (opos=%.2f) snapped to (%.2f), " - "was (%.2f)\n", - edge1-edges, edge1->opos / 64.0, blue->fit / 64.0, - edge1->pos / 64.0 )); + FT_TRACE5(( "BLUE: edge %d (opos=%.2f) snapped to (%.2f), " + "was (%.2f)\n", + edge1-edges, edge1->opos / 64.0, blue->fit / 64.0, + edge1->pos / 64.0 )); edge1->pos = blue->fit; edge1->flags |= AF_EDGE_DONE; @@ -1878,7 +1928,7 @@ /* this should not happen, but it's better to be safe */ if ( edge2->blue_edge ) { - AF_LOG(( "ASSERTION FAILED for edge %d\n", edge2-edges )); + FT_TRACE5(( "ASSERTION FAILED for edge %d\n", edge2-edges )); af_latin2_align_linked_edge( hints, dim, edge2, edge ); edge->flags |= AF_EDGE_DONE; @@ -1929,11 +1979,11 @@ else edge->pos = FT_PIX_ROUND( edge->opos ); - AF_LOG(( "ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f) " - "snapped to (%.2f) (%.2f)\n", - edge-edges, edge->opos / 64.0, - edge2-edges, edge2->opos / 64.0, - edge->pos / 64.0, edge2->pos / 64.0 )); + FT_TRACE5(( "ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)" + " snapped to (%.2f) (%.2f)\n", + edge-edges, edge->opos / 64.0, + edge2-edges, edge2->opos / 64.0, + edge->pos / 64.0, edge2->pos / 64.0 )); anchor = edge; edge->flags |= AF_EDGE_DONE; @@ -1945,7 +1995,7 @@ anchor_drift = ( (anchor->pos - anchor->opos) + (edge2->pos - edge2->opos)) >> 1; - AF_LOG(( "DRIFT: %.2f\n", anchor_drift/64.0 )); + FT_TRACE5(( "DRIFT: %.2f\n", anchor_drift/64.0 )); } else { @@ -1965,12 +2015,13 @@ org_left = org_pos + ((org_len - cur_len) >> 1); org_right = org_pos + ((org_len + cur_len) >> 1); - AF_LOG(( "ALIGN: left=%.2f right=%.2f ", org_left/64.0, org_right/64.0 )); + FT_TRACE5(( "ALIGN: left=%.2f right=%.2f ", + org_left / 64.0, org_right / 64.0 )); cur_center = org_center; if ( edge2->flags & AF_EDGE_DONE ) { - AF_LOG(( "\n" )); + FT_TRACE5(( "\n" )); edge->pos = edge2->pos - cur_len; } else @@ -1985,14 +2036,14 @@ /* note: don't even try to fit tiny stems */ if ( cur_len < 32 ) { - AF_LOG(( "tiny stem\n" )); + FT_TRACE5(( "tiny stem\n" )); goto AlignStem; } /* if the span is within a single pixel, don't touch it */ if ( FT_PIX_FLOOR(org_left) == FT_PIX_CEIL(org_right) ) { - AF_LOG(( "single pixel stem\n" )); + FT_TRACE5(( "single pixel stem\n" )); goto AlignStem; } @@ -2015,14 +2066,14 @@ delta = FT_ABS(fit - org); displacements[count] = fit - org; scores[count++] = delta; - AF_LOG(( "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); displacements[count] = fit - org; scores[count++] = delta; - AF_LOG(( "dispB=%.2f (%d) ", (fit - org)/64.0, delta )); + FT_TRACE5(( "dispB=%.2f (%d) ", (fit - org) / 64.0, delta )); } } @@ -2032,7 +2083,7 @@ delta = FT_ABS(fit - org); displacements[count] = fit - org; scores[count++] = delta; - AF_LOG(( "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; @@ -2040,7 +2091,7 @@ delta = FT_ABS(fit - org); displacements[count] = fit - org; scores[count++] = delta; - AF_LOG(( "dispD=%.2f (%d) ", (fit - org)/64.0, delta )); + FT_TRACE5(( "dispD=%.2f (%d) ", (fit - org) / 64.0, delta )); /* now find the best displacement */ { @@ -2059,27 +2110,28 @@ cur_center = org_center + best_disp; } - AF_LOG(( "\n" )); + FT_TRACE5(( "\n" )); } AlignStem: edge->pos = cur_center - (cur_len >> 1); edge2->pos = edge->pos + cur_len; - AF_LOG(( "STEM1: %d (opos=%.2f) to %d (opos=%.2f) " - "snapped to (%.2f) and (%.2f), org_len = %.2f cur_len=%.2f\n", - edge-edges, edge->opos / 64.0, - edge2-edges, edge2->opos / 64.0, - edge->pos / 64.0, edge2->pos / 64.0, - org_len / 64.0, cur_len / 64.0 )); + FT_TRACE5(( "STEM1: %d (opos=%.2f) to %d (opos=%.2f)" + " snapped to (%.2f) and (%.2f)," + " org_len=%.2f cur_len=%.2f\n", + edge-edges, edge->opos / 64.0, + edge2-edges, edge2->opos / 64.0, + edge->pos / 64.0, edge2->pos / 64.0, + org_len / 64.0, cur_len / 64.0 )); edge->flags |= AF_EDGE_DONE; edge2->flags |= AF_EDGE_DONE; if ( edge > edges && edge->pos < edge[-1].pos ) { - AF_LOG(( "BOUND: %d (pos=%.2f) to (%.2f)\n", - edge-edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); + FT_TRACE5(( "BOUND: %d (pos=%.2f) to (%.2f)\n", + edge-edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); edge->pos = edge[-1].pos; } } @@ -2179,16 +2231,17 @@ if ( delta < 64 + 16 ) { af_latin2_align_serif_edge( hints, edge->serif, edge ); - AF_LOG(( "SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f) " - "aligned to (%.2f)\n", - edge-edges, edge->opos / 64.0, - edge->serif - edges, edge->serif->opos / 64.0, - edge->pos / 64.0 )); + FT_TRACE5(( "SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)" + " aligned to (%.2f)\n", + edge-edges, edge->opos / 64.0, + edge->serif - edges, edge->serif->opos / 64.0, + edge->pos / 64.0 )); } else if ( !anchor ) { - AF_LOG(( "SERIF_ANCHOR: edge %d (opos=%.2f) snapped to (%.2f)\n", - edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); + FT_TRACE5(( "SERIF_ANCHOR: edge %d (opos=%.2f)" + " snapped to (%.2f)\n", + edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); edge->pos = FT_PIX_ROUND( edge->opos ); anchor = edge; } @@ -2215,15 +2268,19 @@ FT_MulDiv( edge->opos - before->opos, after->pos - before->pos, after->opos - before->opos ); - AF_LOG(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f) from %d (opos=%.2f)\n", - edge-edges, edge->opos / 64.0, edge->pos / 64.0, before - edges, before->opos / 64.0 )); + FT_TRACE5(( "SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f)" + " from %d (opos=%.2f)\n", + edge-edges, edge->opos / 64.0, edge->pos / 64.0, + before - edges, before->opos / 64.0 )); } else { - edge->pos = anchor->pos + (( edge->opos - anchor->opos + 16) & ~31); + edge->pos = anchor->pos + + ( ( edge->opos - anchor->opos + 16 ) & ~31 ); - AF_LOG(( "SERIF_LINK2: edge %d (opos=%.2f) snapped to (%.2f)\n", - edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); + FT_TRACE5(( "SERIF_LINK2: edge %d (opos=%.2f)" + " snapped to (%.2f)\n", + edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); } } @@ -2243,8 +2300,8 @@ static FT_Error af_latin2_hints_apply( AF_GlyphHints hints, - FT_Outline* outline, - AF_LatinMetrics metrics ) + FT_Outline* outline, + AF_LatinMetrics metrics ) { FT_Error error; int dim; @@ -2255,7 +2312,7 @@ goto Exit; /* analyze glyph outline */ -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || AF_HINTS_DO_HORIZONTAL( hints ) ) #else @@ -2279,7 +2336,7 @@ /* grid-fit the outline */ for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) { -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER if ( ( dim == AF_DIMENSION_HORZ && metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT ) ) { @@ -2321,17 +2378,18 @@ static const AF_Script_UniRangeRec af_latin2_uniranges[] = { - AF_UNIRANGE_REC( 32UL, 127UL ), /* XXX: TODO: Add new Unicode ranges here! */ + AF_UNIRANGE_REC( 32UL, 127UL ), /* TODO: Add new Unicode ranges here! */ AF_UNIRANGE_REC( 160UL, 255UL ), AF_UNIRANGE_REC( 0UL, 0UL ) }; - AF_DEFINE_SCRIPT_CLASS(af_latin2_script_class, + AF_DEFINE_SCRIPT_CLASS( af_latin2_script_class, AF_SCRIPT_LATIN2, af_latin2_uniranges, + 'o', - sizeof( AF_LatinMetricsRec ), + sizeof ( AF_LatinMetricsRec ), (AF_Script_InitMetricsFunc) af_latin2_metrics_init, (AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale, Index: src/autofit/aflatin2.h =================================================================== --- src/autofit/aflatin2.h (revision 58178) +++ src/autofit/aflatin2.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter hinting routines for latin script (specification). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 2003-2007, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,7 +27,7 @@ /* the latin-specific script class */ - AF_DECLARE_SCRIPT_CLASS(af_latin2_script_class) + AF_DECLARE_SCRIPT_CLASS( af_latin2_script_class ) /* */ Index: src/autofit/afloader.c =================================================================== --- src/autofit/afloader.c (revision 58178) +++ src/autofit/afloader.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 2003-2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,31 +16,40 @@ /***************************************************************************/ +#include "afglobal.h" #include "afloader.h" #include "afhints.h" -#include "afglobal.h" #include "aferrors.h" +#include "afmodule.h" + /* Initialize glyph loader. */ + FT_LOCAL_DEF( FT_Error ) - af_loader_init( AF_Loader loader, - FT_Memory memory ) + af_loader_init( AF_Module module ) { + AF_Loader loader = module->loader; + FT_Memory memory = module->root.library->memory; + + FT_ZERO( loader ); af_glyph_hints_init( &loader->hints, memory ); -#ifdef AF_DEBUG +#ifdef FT_DEBUG_AUTOFIT _af_debug_hints = &loader->hints; #endif return FT_GlyphLoader_New( memory, &loader->gloader ); } + /* Reset glyph loader and compute globals if necessary. */ + FT_LOCAL_DEF( FT_Error ) - af_loader_reset( AF_Loader loader, + af_loader_reset( AF_Module module, FT_Face face ) { - FT_Error error = AF_Err_Ok; + FT_Error error = AF_Err_Ok; + AF_Loader loader = module->loader; loader->face = face; @@ -50,7 +59,7 @@ if ( loader->globals == NULL ) { - error = af_face_globals_new( face, &loader->globals ); + error = af_face_globals_new( face, &loader->globals, module ); if ( !error ) { face->autohint.data = @@ -64,15 +73,20 @@ } + /* Finalize glyph loader. */ + FT_LOCAL_DEF( void ) - af_loader_done( AF_Loader loader ) + af_loader_done( AF_Module module ) { + AF_Loader loader = module->loader; + + af_glyph_hints_done( &loader->hints ); loader->face = NULL; loader->globals = NULL; -#ifdef AF_DEBUG +#ifdef FT_DEBUG_AUTOFIT _af_debug_hints = NULL; #endif FT_GlyphLoader_Done( loader->gloader ); @@ -80,6 +94,10 @@ } + /* Load a single glyph component. This routine calls itself */ + /* recursively, if necessary, and does the main work of */ + /* `af_loader_load_glyph.' */ + static FT_Error af_loader_load_g( AF_Loader loader, AF_Scaler scaler, @@ -94,9 +112,11 @@ AF_GlyphHints hints = &loader->hints; FT_GlyphSlot slot = face->glyph; FT_Slot_Internal internal = slot->internal; + FT_Int32 flags; - error = FT_Load_Glyph( face, glyph_index, load_flags ); + flags = load_flags | FT_LOAD_LINEAR_DESIGN; + error = FT_Load_Glyph( face, glyph_index, flags ); if ( error ) goto Exit; @@ -114,10 +134,6 @@ FT_Vector_Transform( &loader->trans_delta, &inverse ); } - /* set linear metrics */ - slot->linearHoriAdvance = slot->metrics.horiAdvance; - slot->linearVertAdvance = slot->metrics.vertAdvance; - switch ( slot->format ) { case FT_GLYPH_FORMAT_OUTLINE: @@ -127,8 +143,8 @@ loader->trans_delta.x, loader->trans_delta.y ); - /* copy the outline points in the loader's current */ - /* extra points which is used to keep original glyph coordinates */ + /* copy the outline points in the loader's current */ + /* extra points which are used to keep original glyph coordinates */ error = FT_GLYPHLOADER_CHECK_POINTS( gloader, slot->outline.n_points + 4, slot->outline.n_contours ); @@ -169,8 +185,8 @@ &gloader->current.outline, metrics ); - /* we now need to hint the metrics according to the change in */ - /* width/positioning that occurred during the hinting process */ + /* we now need to adjust the metrics according to the change in */ + /* width/positioning that occurred during the hinting process */ if ( scaler->render_mode != FT_RENDER_MODE_LIGHT ) { FT_Pos old_rsb, old_lsb, new_lsb; @@ -265,7 +281,7 @@ gloader->current.num_subglyphs = num_subglyphs; num_base_subgs = gloader->base.num_subglyphs; - /* now, read each subglyph independently */ + /* now read each subglyph independently */ for ( nn = 0; nn < num_subglyphs; nn++ ) { FT_Vector pp1, pp2; @@ -305,7 +321,7 @@ num_points = gloader->base.outline.n_points; num_new_points = num_points - num_base_points; - /* now perform the transform required for this subglyph */ + /* now perform the transformation required for this subglyph */ if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE | FT_SUBGLYPH_FLAG_XY_SCALE | @@ -339,8 +355,8 @@ l += num_base_points; - /* for now, only use the current point coordinates; */ - /* we may consider another approach in the near future */ + /* for now, only use the current point coordinates; */ + /* we eventually may consider another approach */ p1 = gloader->base.outline.points + start_point + k; p2 = gloader->base.outline.points + start_point + l; @@ -423,9 +439,10 @@ slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, x_scale ); #else - if ( FT_IS_FIXED_WIDTH( slot->face ) || - ( af_face_globals_is_digit( loader->globals, glyph_index ) && - metrics->digits_have_same_width ) ) + if ( scaler->render_mode != FT_RENDER_MODE_LIGHT && + ( FT_IS_FIXED_WIDTH( slot->face ) || + ( af_face_globals_is_digit( loader->globals, glyph_index ) && + metrics->digits_have_same_width ) ) ) { slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, metrics->scaler.x_scale ); @@ -444,7 +461,7 @@ #endif slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance, - metrics->scaler.y_scale ); + metrics->scaler.y_scale ); slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance ); slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance ); @@ -455,27 +472,32 @@ if ( error ) goto Exit; - slot->outline = internal->loader->base.outline; + /* reassign all outline fields except flags to protect them */ + slot->outline.n_contours = internal->loader->base.outline.n_contours; + slot->outline.n_points = internal->loader->base.outline.n_points; + slot->outline.points = internal->loader->base.outline.points; + slot->outline.tags = internal->loader->base.outline.tags; + slot->outline.contours = internal->loader->base.outline.contours; + slot->format = FT_GLYPH_FORMAT_OUTLINE; } -#ifdef DEBUG_HINTER - af_debug_hinter = hinter; -#endif - Exit: return error; } + /* Load a glyph. */ + FT_LOCAL_DEF( FT_Error ) - af_loader_load_glyph( AF_Loader loader, + af_loader_load_glyph( AF_Module module, FT_Face face, FT_UInt gindex, - FT_UInt32 load_flags ) + FT_Int32 load_flags ) { FT_Error error; - FT_Size size = face->size; + FT_Size size = face->size; + AF_Loader loader = module->loader; AF_ScalerRec scaler; @@ -493,7 +515,7 @@ scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags ); scaler.flags = 0; /* XXX: fix this */ - error = af_loader_reset( loader, face ); + error = af_loader_reset( module, face ); if ( !error ) { AF_ScriptMetrics metrics; Index: src/autofit/afloader.h =================================================================== --- src/autofit/afloader.h (revision 58178) +++ src/autofit/afloader.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter glyph loading routines (specification). */ /* */ -/* Copyright 2003, 2004, 2005 by */ +/* Copyright 2003-2005, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,8 +16,8 @@ /***************************************************************************/ -#ifndef __AF_LOADER_H__ -#define __AF_LOADER_H__ +#ifndef __AFLOADER_H__ +#define __AFLOADER_H__ #include "afhints.h" #include "afglobal.h" @@ -25,11 +25,24 @@ FT_BEGIN_HEADER - typedef struct AF_LoaderRec_ + typedef struct AF_ModuleRec_* AF_Module; + + /* + * The autofitter module's (global) data structure to communicate with + * actual fonts. If necessary, `local' data like the current face, the + * current face's auto-hint data, or the current glyph's parameters + * relevant to auto-hinting are `swapped in'. Cf. functions like + * `af_loader_reset' and `af_loader_load_g'. + */ + + typedef struct AF_LoaderRec_ { - FT_Face face; /* current face */ - AF_FaceGlobals globals; /* current face globals */ - FT_GlyphLoader gloader; /* glyph loader */ + /* current face data */ + FT_Face face; + AF_FaceGlobals globals; + + /* current glyph data */ + FT_GlyphLoader gloader; AF_GlyphHintsRec hints; AF_ScriptMetrics metrics; FT_Bool transformed; @@ -43,31 +56,30 @@ FT_LOCAL( FT_Error ) - af_loader_init( AF_Loader loader, - FT_Memory memory ); + af_loader_init( AF_Module module ); FT_LOCAL( FT_Error ) - af_loader_reset( AF_Loader loader, + af_loader_reset( AF_Module module, FT_Face face ); FT_LOCAL( void ) - af_loader_done( AF_Loader loader ); + af_loader_done( AF_Module module ); FT_LOCAL( FT_Error ) - af_loader_load_glyph( AF_Loader loader, + af_loader_load_glyph( AF_Module module, FT_Face face, FT_UInt gindex, - FT_UInt32 load_flags ); + FT_Int32 load_flags ); /* */ FT_END_HEADER -#endif /* __AF_LOADER_H__ */ +#endif /* __AFLOADER_H__ */ /* END */ Index: src/autofit/afmodule.c =================================================================== --- src/autofit/afmodule.c (revision 58178) +++ src/autofit/afmodule.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module implementation (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006 by */ +/* Copyright 2003-2006, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,12 +16,13 @@ /***************************************************************************/ +#include "afglobal.h" #include "afmodule.h" #include "afloader.h" +#include "aferrors.h" #include "afpic.h" -#ifdef AF_DEBUG - int _af_debug; +#ifdef FT_DEBUG_AUTOFIT int _af_debug_disable_horz_hints; int _af_debug_disable_vert_hints; int _af_debug_disable_blue_hints; @@ -29,66 +30,229 @@ #endif #include FT_INTERNAL_OBJECTS_H +#include FT_INTERNAL_DEBUG_H +#include FT_AUTOHINTER_H +#include FT_SERVICE_PROPERTIES_H - typedef struct FT_AutofitterRec_ + /*************************************************************************/ + /* */ + /* 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_afmodule + + + FT_Error + af_property_get_face_globals( FT_Face face, + AF_FaceGlobals* aglobals, + AF_Module module ) { - FT_ModuleRec root; - AF_LoaderRec loader[1]; + FT_Error error = AF_Err_Ok; + AF_FaceGlobals globals; - } FT_AutofitterRec, *FT_Autofitter; + if ( !face ) + return AF_Err_Invalid_Argument; + globals = (AF_FaceGlobals)face->autohint.data; + if ( !globals ) + { + /* trigger computation of the global script data */ + /* in case it hasn't been done yet */ + error = af_face_globals_new( face, &globals, module ); + if ( !error ) + { + face->autohint.data = + (FT_Pointer)globals; + face->autohint.finalizer = + (FT_Generic_Finalizer)af_face_globals_free; + } + } + + if ( !error ) + *aglobals = globals; + + return error; + } + + + FT_Error + af_property_set( FT_Module ft_module, + const char* property_name, + const void* value ) + { + FT_Error error = AF_Err_Ok; + AF_Module module = (AF_Module)ft_module; + + + if ( !ft_strcmp( property_name, "fallback-script" ) ) + { + FT_UInt* fallback_script = (FT_UInt*)value; + + + module->fallback_script = *fallback_script; + + return error; + } + else if ( !ft_strcmp( property_name, "increase-x-height" ) ) + { + FT_Prop_IncreaseXHeight* prop = (FT_Prop_IncreaseXHeight*)value; + AF_FaceGlobals globals; + + + error = af_property_get_face_globals( prop->face, &globals, module ); + if ( !error ) + globals->increase_x_height = prop->limit; + + return error; + } + + FT_TRACE0(( "af_property_get: missing property `%s'\n", + property_name )); + return AF_Err_Missing_Property; + } + + + FT_Error + af_property_get( FT_Module ft_module, + const char* property_name, + void* value ) + { + FT_Error error = AF_Err_Ok; + AF_Module module = (AF_Module)ft_module; + FT_UInt fallback_script = module->fallback_script; + + + if ( !ft_strcmp( property_name, "glyph-to-script-map" ) ) + { + FT_Prop_GlyphToScriptMap* prop = (FT_Prop_GlyphToScriptMap*)value; + AF_FaceGlobals globals; + + + error = af_property_get_face_globals( prop->face, &globals, module ); + if ( !error ) + prop->map = globals->glyph_scripts; + + return error; + } + else if ( !ft_strcmp( property_name, "fallback-script" ) ) + { + FT_UInt* val = (FT_UInt*)value; + + + *val = fallback_script; + + return error; + } + else if ( !ft_strcmp( property_name, "increase-x-height" ) ) + { + FT_Prop_IncreaseXHeight* prop = (FT_Prop_IncreaseXHeight*)value; + AF_FaceGlobals globals; + + + error = af_property_get_face_globals( prop->face, &globals, module ); + if ( !error ) + prop->limit = globals->increase_x_height; + + return error; + } + + + FT_TRACE0(( "af_property_get: missing property `%s'\n", + property_name )); + return AF_Err_Missing_Property; + } + + + FT_DEFINE_SERVICE_PROPERTIESREC( + af_service_properties, + (FT_Properties_SetFunc)af_property_set, + (FT_Properties_GetFunc)af_property_get ) + + + FT_DEFINE_SERVICEDESCREC1( + af_services, + FT_SERVICE_ID_PROPERTIES, &AF_SERVICE_PROPERTIES_GET ) + + + FT_CALLBACK_DEF( FT_Module_Interface ) + af_get_interface( FT_Module module, + const char* module_interface ) + { + /* AF_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + FT_Library library; + + + if ( !module ) + return NULL; + library = module->library; + if ( !library ) + return NULL; +#else + FT_UNUSED( module ); +#endif + + return ft_service_list_lookup( AF_SERVICES_GET, module_interface ); + } + + FT_CALLBACK_DEF( FT_Error ) - af_autofitter_init( FT_Autofitter module ) + af_autofitter_init( AF_Module module ) { - return af_loader_init( module->loader, module->root.library->memory ); + module->fallback_script = AF_SCRIPT_FALLBACK; + + return af_loader_init( module ); } FT_CALLBACK_DEF( void ) - af_autofitter_done( FT_Autofitter module ) + af_autofitter_done( AF_Module module ) { - af_loader_done( module->loader ); + af_loader_done( module ); } FT_CALLBACK_DEF( FT_Error ) - af_autofitter_load_glyph( FT_Autofitter module, - FT_GlyphSlot slot, - FT_Size size, - FT_UInt glyph_index, - FT_Int32 load_flags ) + af_autofitter_load_glyph( AF_Module module, + FT_GlyphSlot slot, + FT_Size size, + FT_UInt glyph_index, + FT_Int32 load_flags ) { FT_UNUSED( size ); - return af_loader_load_glyph( module->loader, slot->face, + return af_loader_load_glyph( module, slot->face, glyph_index, load_flags ); } - FT_DEFINE_AUTOHINTER_SERVICE(af_autofitter_service, - NULL, - NULL, - NULL, - (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph - ) + FT_DEFINE_AUTOHINTER_INTERFACE( + af_autofitter_interface, + NULL, /* reset_face */ + NULL, /* get_global_hints */ + NULL, /* done_global_hints */ + (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph ) /* load_glyph */ - FT_DEFINE_MODULE(autofit_module_class, + FT_DEFINE_MODULE( + autofit_module_class, + FT_MODULE_HINTER, - sizeof ( FT_AutofitterRec ), + sizeof ( AF_ModuleRec ), "autofitter", 0x10000L, /* version 1.0 of the autofitter */ 0x20000L, /* requires FreeType 2.0 or above */ - (const void*)&AF_AF_AUTOFITTER_SERVICE_GET, + (const void*)&AF_INTERFACE_GET, (FT_Module_Constructor)af_autofitter_init, (FT_Module_Destructor) af_autofitter_done, - (FT_Module_Requester) NULL - ) + (FT_Module_Requester) af_get_interface ) /* END */ Index: src/autofit/afmodule.h =================================================================== --- src/autofit/afmodule.h (revision 58178) +++ src/autofit/afmodule.h (working copy) @@ -23,9 +23,30 @@ #include FT_INTERNAL_OBJECTS_H #include FT_MODULE_H +#include "afloader.h" + FT_BEGIN_HEADER + + /* + * This is the `extended' FT_Module structure which holds the + * autofitter's global data. Right before hinting a glyph, the data + * specific to the glyph's face (blue zones, stem widths, etc.) are + * loaded into `loader' (see function `af_loader_reset'). + */ + + typedef struct AF_ModuleRec_ + { + FT_ModuleRec root; + + FT_UInt fallback_script; + + AF_LoaderRec loader[1]; + + } AF_ModuleRec; + + FT_DECLARE_MODULE(autofit_module_class) Index: src/autofit/afpic.c =================================================================== --- src/autofit/afpic.c (revision 58178) +++ src/autofit/afpic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009-2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,27 +20,56 @@ #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #include "afpic.h" +#include "aferrors.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from afmodule.c */ - void FT_Init_Class_af_autofitter_service( FT_Library, FT_AutoHinter_ServiceRec*); + FT_Error + FT_Create_Class_af_services( FT_Library library, + FT_ServiceDescRec** output_class ); + void + FT_Destroy_Class_af_services( FT_Library library, + FT_ServiceDescRec* clazz ); + + void + FT_Init_Class_af_service_properties( FT_Service_PropertiesRec* clazz ); + + void FT_Init_Class_af_autofitter_interface( + FT_Library library, + FT_AutoHinter_InterfaceRec* clazz ); + + /* forward declaration of PIC init functions from script classes */ #include "aflatin.h" +#ifdef FT_OPTION_AUTOFIT2 #include "aflatin2.h" +#endif #include "afcjk.h" #include "afdummy.h" #include "afindic.h" + void - autofit_module_class_pic_free( FT_Library library ) + autofit_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->autofit ) { - FT_FREE( pic_container->autofit ); + AFModulePIC* container = (AFModulePIC*)pic_container->autofit; + + + if ( container->af_services ) + FT_Destroy_Class_af_services( library, + container->af_services ); + container->af_services = NULL; + + FT_FREE( container ); pic_container->autofit = NULL; } } @@ -52,7 +81,7 @@ FT_PIC_Container* pic_container = &library->pic_container; FT_UInt ss; FT_Error error = AF_Err_Ok; - AFModulePIC* container; + AFModulePIC* container = NULL; FT_Memory memory = library->memory; @@ -62,32 +91,46 @@ FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->autofit = 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_af_services( library, + &container->af_services ); + if ( error ) + goto Exit; + + FT_Init_Class_af_service_properties( &container->af_service_properties ); + for ( ss = 0 ; ss < AF_SCRIPT_CLASSES_REC_COUNT ; ss++ ) { - container->af_script_classes[ss] = &container->af_script_classes_rec[ss]; + container->af_script_classes[ss] = + &container->af_script_classes_rec[ss]; } - container->af_script_classes[AF_SCRIPT_CLASSES_COUNT-1] = NULL; - + container->af_script_classes[AF_SCRIPT_CLASSES_COUNT - 1] = NULL; + /* add call to initialization function when you add new scripts */ ss = 0; - FT_Init_Class_af_dummy_script_class(&container->af_script_classes_rec[ss++]); + FT_Init_Class_af_dummy_script_class( + &container->af_script_classes_rec[ss++] ); #ifdef FT_OPTION_AUTOFIT2 - FT_Init_Class_af_latin2_script_class(&container->af_script_classes_rec[ss++]); + FT_Init_Class_af_latin2_script_class( + &container->af_script_classes_rec[ss++] ); #endif - FT_Init_Class_af_latin_script_class(&container->af_script_classes_rec[ss++]); - FT_Init_Class_af_cjk_script_class(&container->af_script_classes_rec[ss++]); - FT_Init_Class_af_indic_script_class(&container->af_script_classes_rec[ss++]); + FT_Init_Class_af_latin_script_class( + &container->af_script_classes_rec[ss++] ); + FT_Init_Class_af_cjk_script_class( + &container->af_script_classes_rec[ss++] ); + FT_Init_Class_af_indic_script_class( + &container->af_script_classes_rec[ss++] ); - FT_Init_Class_af_autofitter_service(library, &container->af_autofitter_service); + FT_Init_Class_af_autofitter_interface( + library, &container->af_autofitter_interface ); -/*Exit:*/ - if(error) - autofit_module_class_pic_free(library); + Exit: + if ( error ) + autofit_module_class_pic_free( library ); return error; } - #endif /* FT_CONFIG_OPTION_PIC */ Index: src/autofit/afpic.h =================================================================== --- src/autofit/afpic.h (revision 58178) +++ src/autofit/afpic.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for autofit module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2011-2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,39 +19,71 @@ #ifndef __AFPIC_H__ #define __AFPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H + #ifndef FT_CONFIG_OPTION_PIC -#define AF_SCRIPT_CLASSES_GET af_script_classes -#define AF_AF_AUTOFITTER_SERVICE_GET af_autofitter_service +#define AF_SERVICES_GET af_services +#define AF_SERVICE_PROPERTIES_GET af_service_properties +#define AF_SCRIPT_CLASSES_GET af_script_classes +#define AF_INTERFACE_GET af_autofitter_interface + #else /* FT_CONFIG_OPTION_PIC */ + /* some include files required for members of AFModulePIC */ +#include FT_SERVICE_PROPERTIES_H + #include "aftypes.h" -/* increase these when you add new scripts, and update autofit_module_class_pic_init */ + /* increase these when you add new scripts, */ + /* and update autofit_module_class_pic_init */ #ifdef FT_OPTION_AUTOFIT2 - #define AF_SCRIPT_CLASSES_COUNT 6 +#define AF_SCRIPT_CLASSES_COUNT 6 #else - #define AF_SCRIPT_CLASSES_COUNT 5 +#define AF_SCRIPT_CLASSES_COUNT 5 #endif -#define AF_SCRIPT_CLASSES_REC_COUNT (AF_SCRIPT_CLASSES_COUNT-1) - typedef struct AFModulePIC_ +#define AF_SCRIPT_CLASSES_REC_COUNT ( AF_SCRIPT_CLASSES_COUNT - 1 ) + + + typedef struct AFModulePIC_ { - AF_ScriptClass af_script_classes[AF_SCRIPT_CLASSES_COUNT]; - AF_ScriptClassRec af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT]; - FT_AutoHinter_ServiceRec af_autofitter_service; + FT_ServiceDescRec* af_services; + FT_Service_PropertiesRec af_service_properties; + + AF_ScriptClass af_script_classes[AF_SCRIPT_CLASSES_COUNT]; + AF_ScriptClassRec af_script_classes_rec[AF_SCRIPT_CLASSES_REC_COUNT]; + FT_AutoHinter_InterfaceRec af_autofitter_interface; + } AFModulePIC; -#define GET_PIC(lib) ((AFModulePIC*)((lib)->pic_container.autofit)) -#define AF_SCRIPT_CLASSES_GET (GET_PIC(FT_FACE_LIBRARY(globals->face))->af_script_classes) -#define AF_AF_AUTOFITTER_SERVICE_GET (GET_PIC(library)->af_autofitter_service) +#define GET_PIC( lib ) \ + ( (AFModulePIC*)((lib)->pic_container.autofit) ) + +#define AF_SERVICES_GET \ + ( GET_PIC( library )->af_services ) +#define AF_SERVICE_PROPERTIES_GET \ + ( GET_PIC( library)->af_service_properties ) + +#define AF_SCRIPT_CLASSES_GET \ + ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_script_classes ) +#define AF_INTERFACE_GET \ + ( GET_PIC( library )->af_autofitter_interface ) + + + /* see afpic.c for the implementation */ + void + autofit_module_class_pic_free( FT_Library library ); + + FT_Error + autofit_module_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: src/autofit/aftypes.h =================================================================== --- src/autofit/aftypes.h (revision 58178) +++ src/autofit/aftypes.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter types (specification only). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 2003-2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -53,28 +53,18 @@ /*************************************************************************/ /*************************************************************************/ -#define xxAF_USE_WARPER /* only define to use warp hinting */ -#define xxAF_DEBUG +#ifdef FT_DEBUG_AUTOFIT -#ifdef AF_DEBUG - #include FT_CONFIG_STANDARD_LIBRARY_H -#define AF_LOG( x ) do { if ( _af_debug ) printf x; } while ( 0 ) - -extern int _af_debug; extern int _af_debug_disable_horz_hints; extern int _af_debug_disable_vert_hints; extern int _af_debug_disable_blue_hints; extern void* _af_debug_hints; -#else /* !AF_DEBUG */ +#endif /* FT_DEBUG_AUTOFIT */ -#define AF_LOG( x ) do { } while ( 0 ) /* nothing */ -#endif /* !AF_DEBUG */ - - /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -97,8 +87,9 @@ FT_Pos* table ); FT_LOCAL( void ) - af_sort_widths( FT_UInt count, - AF_Width widths ); + af_sort_and_quantize_widths( FT_UInt* count, + AF_Width widths, + FT_Pos threshold ); /*************************************************************************/ @@ -159,37 +150,12 @@ FT_END_STMNT - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** O U T L I N E S *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - /* opaque handle to glyph-specific hints -- see `afhints.h' for more * details */ typedef struct AF_GlyphHintsRec_* AF_GlyphHints; - /* This structure is used to model an input glyph outline to - * the auto-hinter. The latter will set the `hints' field - * depending on the glyph's script. - */ - typedef struct AF_OutlineRec_ - { - FT_Face face; - FT_Outline outline; - FT_UInt outline_resolution; - FT_Int advance; - FT_UInt metrics_resolution; - - AF_GlyphHints hints; - - } AF_OutlineRec; - - /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -241,7 +207,7 @@ /*************************************************************************/ /* - * The list of know scripts. Each different script corresponds to the + * The list of known scripts. Each different script corresponds to the * following information: * * - A set of Unicode ranges to test whether the face supports the @@ -263,12 +229,12 @@ typedef enum AF_Script_ { - AF_SCRIPT_NONE = 0, + AF_SCRIPT_DUMMY = 0, AF_SCRIPT_LATIN = 1, AF_SCRIPT_CJK = 2, - AF_SCRIPT_INDIC = 3, + AF_SCRIPT_INDIC = 3, #ifdef FT_OPTION_AUTOFIT2 - AF_SCRIPT_LATIN2, + AF_SCRIPT_LATIN2 = 4, #endif /* add new scripts here. Don't forget to update the list in */ @@ -280,6 +246,7 @@ typedef struct AF_ScriptClassRec_ const* AF_ScriptClass; + typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; typedef struct AF_ScriptMetricsRec_ { @@ -287,6 +254,8 @@ AF_ScalerRec scaler; FT_Bool digits_have_same_width; + AF_FaceGlobals globals; /* to access properties */ + } AF_ScriptMetricsRec, *AF_ScriptMetrics; @@ -329,8 +298,9 @@ typedef struct AF_ScriptClassRec_ { - AF_Script script; - AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ + AF_Script script; + AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ + FT_UInt32 standard_char; /* for default width and height */ FT_Offset script_metrics_size; AF_Script_InitMetricsFunc script_metrics_init; @@ -342,57 +312,62 @@ } AF_ScriptClassRec; -/* Declare and define vtables for classes */ + + /* Declare and define vtables for classes */ #ifndef FT_CONFIG_OPTION_PIC -#define AF_DECLARE_SCRIPT_CLASS(script_class) \ - FT_CALLBACK_TABLE const AF_ScriptClassRec \ +#define AF_DECLARE_SCRIPT_CLASS( script_class ) \ + FT_CALLBACK_TABLE const AF_ScriptClassRec \ script_class; -#define AF_DEFINE_SCRIPT_CLASS(script_class, script_, ranges, m_size, \ - m_init, m_scale, m_done, h_init, h_apply) \ - FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec \ - script_class = \ - { \ - script_, \ - ranges, \ - \ - m_size, \ - \ - m_init, \ - m_scale, \ - m_done, \ - \ - h_init, \ - h_apply \ +#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char, \ + m_size, \ + m_init, m_scale, m_done, h_init, h_apply ) \ + FT_CALLBACK_TABLE_DEF const AF_ScriptClassRec script_class = \ + { \ + script_, \ + ranges, \ + def_char, \ + \ + m_size, \ + \ + m_init, \ + m_scale, \ + m_done, \ + \ + h_init, \ + h_apply \ }; -#else +#else /* FT_CONFIG_OPTION_PIC */ -#define AF_DECLARE_SCRIPT_CLASS(script_class) \ - FT_LOCAL(void) \ - FT_Init_Class_##script_class(AF_ScriptClassRec* ac); +#define AF_DECLARE_SCRIPT_CLASS( script_class ) \ + FT_LOCAL( void ) \ + FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ); -#define AF_DEFINE_SCRIPT_CLASS(script_class, script_, ranges, m_size, \ - m_init, m_scale, m_done, h_init, h_apply) \ - FT_LOCAL_DEF(void) \ - FT_Init_Class_##script_class(AF_ScriptClassRec* ac) \ - { \ - ac->script = script_; \ - ac->script_uni_ranges = ranges; \ - \ - ac->script_metrics_size = m_size; \ - \ - ac->script_metrics_init = m_init; \ - ac->script_metrics_scale = m_scale; \ - ac->script_metrics_done = m_done; \ - \ - ac->script_hints_init = h_init; \ - ac->script_hints_apply = h_apply; \ +#define AF_DEFINE_SCRIPT_CLASS( script_class, script_, ranges, def_char, \ + m_size, \ + m_init, m_scale, m_done, h_init, h_apply ) \ + FT_LOCAL_DEF( void ) \ + FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ + { \ + ac->script = script_; \ + ac->script_uni_ranges = ranges; \ + ac->default_char = def_char; \ + \ + ac->script_metrics_size = m_size; \ + \ + ac->script_metrics_init = m_init; \ + ac->script_metrics_scale = m_scale; \ + ac->script_metrics_done = m_done; \ + \ + ac->script_hints_init = h_init; \ + ac->script_hints_apply = h_apply; \ } -#endif +#endif /* FT_CONFIG_OPTION_PIC */ + /* */ FT_END_HEADER Index: src/autofit/afwarp.c =================================================================== --- src/autofit/afwarp.c (revision 58178) +++ src/autofit/afwarp.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter warping algorithm (body). */ /* */ -/* Copyright 2006, 2007 by */ +/* Copyright 2006, 2007, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,10 +16,30 @@ /***************************************************************************/ + /* + * The idea of the warping code is to slightly scale and shift a glyph + * within a single dimension so that as much of its segments are aligned + * (more or less) on the grid. To find out the optimal scaling and + * shifting value, various parameter combinations are tried and scored. + */ + #include "afwarp.h" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER + /*************************************************************************/ + /* */ + /* 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_afwarp + + + /* The weights cover the range 0/64 - 63/64 of a pixel. Obviously, */ + /* values around a half pixel (which means exactly between two grid */ + /* lines) gets the worst weight. */ #if 1 static const AF_WarpScore af_warper_weights[64] = @@ -43,6 +63,11 @@ #endif + /* Score segments for a given `scale' and `delta' in the range */ + /* `xx1' to `xx2', and store the best result in `warper'. If */ + /* the new best score is equal to the old one, prefer the */ + /* value with a smaller distortion (around `base_distort'). */ + static void af_warper_compute_line_best( AF_Warper warper, FT_Fixed scale, @@ -82,12 +107,12 @@ if ( idx_min < 0 || idx_min > idx_max || idx_max > 64 ) { - AF_LOG(( "invalid indices:\n" - " min=%d max=%d, xx1=%ld xx2=%ld,\n" - " x1min=%ld x1max=%ld, x2min=%ld x2max=%ld\n", - idx_min, idx_max, xx1, xx2, - warper->x1min, warper->x1max, - warper->x2min, warper->x2max )); + FT_TRACE5(( "invalid indices:\n" + " min=%d max=%d, xx1=%ld xx2=%ld,\n" + " x1min=%ld x1max=%ld, x2min=%ld x2max=%ld\n", + idx_min, idx_max, xx1, xx2, + warper->x1min, warper->x1max, + warper->x2min, warper->x2max )); return; } } @@ -100,6 +125,7 @@ FT_Int idx; + /* score the length of the segments for the given range */ for ( idx = idx_min; idx <= idx_max; idx++, y++ ) scores[idx] += af_warper_weights[y & 63] * len; } @@ -115,9 +141,9 @@ AF_WarpScore distort = base_distort + ( idx - idx0 ); - if ( score > warper->best_score || + if ( score > warper->best_score || ( score == warper->best_score && - distort < warper->best_distort ) ) + distort < warper->best_distort ) ) { warper->best_score = score; warper->best_distort = distort; @@ -129,6 +155,9 @@ } + /* Compute optimal scaling and delta values for a given glyph and */ + /* dimension. */ + FT_LOCAL_DEF( void ) af_warper_compute( AF_Warper warper, AF_GlyphHints hints, @@ -215,6 +244,7 @@ warper->t1 = AF_WARPER_FLOOR( warper->x1 ); warper->t2 = AF_WARPER_CEIL( warper->x2 ); + /* examine a half pixel wide range around the maximum coordinates */ warper->x1min = warper->x1 & ~31; warper->x1max = warper->x1min + 32; warper->x2min = warper->x2 & ~31; @@ -234,10 +264,12 @@ warper->x2min = warper->x2; } + /* examine (at most) a pixel wide range around the natural width */ warper->wmin = warper->x2min - warper->x1max; warper->wmax = warper->x2max - warper->x1min; #if 1 + /* some heuristics to reduce the number of widths to be examined */ { int margin = 16; @@ -273,6 +305,8 @@ FT_Pos xx1, xx2; + /* compute min and max positions for given width, */ + /* assuring that they stay within the coordinate ranges */ xx1 = warper->x1; xx2 = warper->x2; if ( w >= warper->w0 ) @@ -304,6 +338,7 @@ else base_distort += xx2 - warper->x2; + /* give base distortion a greater weight while scoring */ base_distort *= 10; new_scale = org_scale + FT_DivFix( w - warper->w0, X2 - X1 ); @@ -317,8 +352,8 @@ { FT_Fixed best_scale = warper->best_scale; FT_Pos best_delta = warper->best_delta; - + hints->xmin_delta = FT_MulFix( X1, best_scale - org_scale ) + best_delta; hints->xmax_delta = FT_MulFix( X2, best_scale - org_scale ) @@ -329,10 +364,11 @@ } } -#else /* !AF_USE_WARPER */ +#else /* !AF_CONFIG_OPTION_USE_WARPER */ -char af_warper_dummy = 0; /* make compiler happy */ + /* ANSI C doesn't like empty source files */ + typedef int _af_warp_dummy; -#endif /* !AF_USE_WARPER */ +#endif /* !AF_CONFIG_OPTION_USE_WARPER */ /* END */ Index: src/autofit/autofit.c =================================================================== --- src/autofit/autofit.c (revision 58178) +++ src/autofit/autofit.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Auto-fitter module (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007 by */ +/* Copyright 2003-2007, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -34,7 +34,7 @@ #include "afloader.c" #include "afmodule.c" -#ifdef AF_USE_WARPER +#ifdef AF_CONFIG_OPTION_USE_WARPER #include "afwarp.c" #endif Index: src/autofit/rules.mk =================================================================== --- src/autofit/rules.mk (revision 58178) +++ src/autofit/rules.mk (working copy) @@ -3,7 +3,7 @@ # -# Copyright 2003, 2004, 2005, 2006, 2007 by +# Copyright 2003, 2004, 2005, 2006, 2007, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -34,13 +34,14 @@ $(AUTOF_DIR)/aflatin.c \ $(AUTOF_DIR)/afloader.c \ $(AUTOF_DIR)/afmodule.c \ + $(AUTOF_DIR)/afpic.c \ $(AUTOF_DIR)/afwarp.c # AUTOF driver headers # AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ - $(AUTOF_DIR)/aftypes.h \ - $(AUTOF_DIR)/aferrors.h + $(AUTOF_DIR)/aferrors.h \ + $(AUTOF_DIR)/aftypes.h # AUTOF driver object(s) Index: src/base/basepic.c =================================================================== --- src/base/basepic.c (revision 58178) +++ src/base/basepic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for base. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,24 +21,42 @@ #include FT_INTERNAL_OBJECTS_H #include "basepic.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ftglyph.c */ - void FT_Init_Class_ft_outline_glyph_class(FT_Glyph_Class*); - void FT_Init_Class_ft_bitmap_glyph_class(FT_Glyph_Class*); + void + FT_Init_Class_ft_outline_glyph_class( FT_Glyph_Class* clazz ); + void + FT_Init_Class_ft_bitmap_glyph_class( FT_Glyph_Class* clazz ); + +#ifdef FT_CONFIG_OPTION_MAC_FONTS + /* forward declaration of PIC init function from ftrfork.c */ + /* (not modularized) */ + void + FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec* record ); +#endif + /* forward declaration of PIC init functions from ftinit.c */ - FT_Error ft_create_default_module_classes(FT_Library); - void ft_destroy_default_module_classes(FT_Library); + FT_Error + ft_create_default_module_classes( FT_Library library ); void - ft_base_pic_free( FT_Library library ) + ft_destroy_default_module_classes( FT_Library library ); + + + void + ft_base_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->base ) { - /* Destroy default module classes (in case FT_Add_Default_Modules was used) */ + /* destroy default module classes */ + /* (in case FT_Add_Default_Modules was used) */ ft_destroy_default_module_classes( library ); FT_FREE( pic_container->base ); @@ -48,17 +66,18 @@ FT_Error - ft_base_pic_init( FT_Library library ) + ft_base_pic_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; - BasePIC* container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Error error = FT_Err_Ok; + BasePIC* container = NULL; + FT_Memory memory = library->memory; + /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->base = container; /* initialize default modules list and pointers */ @@ -66,13 +85,20 @@ if ( error ) goto Exit; - /* initialize pointer table - this is how the module usually expects this data */ - FT_Init_Class_ft_outline_glyph_class(&container->ft_outline_glyph_class); - FT_Init_Class_ft_bitmap_glyph_class(&container->ft_bitmap_glyph_class); + /* initialize pointer table - */ + /* this is how the module usually expects this data */ + FT_Init_Class_ft_outline_glyph_class( + &container->ft_outline_glyph_class ); + FT_Init_Class_ft_bitmap_glyph_class( + &container->ft_bitmap_glyph_class ); +#ifdef FT_CONFIG_OPTION_MAC_FONTS + FT_Init_Table_raccess_guess_table( + (ft_raccess_guess_rec*)&container->ft_raccess_guess_table ); +#endif Exit: - if(error) - ft_base_pic_free(library); + if( error ) + ft_base_pic_free( library ); return error; } Index: src/base/basepic.h =================================================================== --- src/base/basepic.h (revision 58178) +++ src/base/basepic.h (working copy) @@ -19,7 +19,7 @@ #ifndef __BASEPIC_H__ #define __BASEPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H @@ -28,28 +28,43 @@ #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 +#endif #else /* FT_CONFIG_OPTION_PIC */ #include FT_GLYPH_H +#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#include FT_INTERNAL_RFORK_H +#endif + + typedef struct BasePIC_ { 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]; +#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) +#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#define FT_RACCESS_GUESS_TABLE_GET (GET_PIC(library)->ft_raccess_guess_table) +#endif + /* see basepic.c for the implementation. */ void - ft_base_pic_free( FT_Library library ); + ft_base_pic_free( FT_Library library ); FT_Error - ft_base_pic_init( FT_Library library ); + ft_base_pic_init( FT_Library library ); #endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: src/base/ftadvanc.c =================================================================== --- src/base/ftadvanc.c (revision 58178) +++ src/base/ftadvanc.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Quick computation of advance widths (body). */ /* */ -/* Copyright 2008, 2009 by */ +/* Copyright 2008, 2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -129,7 +129,7 @@ { error = func( face, start, count, flags, padvances ); if ( !error ) - goto Exit; + return _ft_face_scale_advances( face, padvances, count, flags ); if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) return error; @@ -147,16 +147,13 @@ if ( error ) break; + /* scale from 26.6 to 16.16 */ padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) - ? face->glyph->advance.y - : face->glyph->advance.x; + ? face->glyph->advance.y << 10 + : face->glyph->advance.x << 10; } - if ( error ) - return error; - - Exit: - return _ft_face_scale_advances( face, padvances, count, flags ); + return error; } Index: src/base/ftbase.c =================================================================== --- src/base/ftbase.c (revision 58178) +++ src/base/ftbase.c (working copy) @@ -34,7 +34,7 @@ #include "fttrigon.c" #include "ftutil.c" -#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON ) +#ifdef FT_MACINTOSH #include "ftmac.c" #endif Index: src/base/ftbase.h =================================================================== --- src/base/ftbase.h (revision 58178) +++ src/base/ftbase.h (working copy) @@ -49,15 +49,16 @@ FT_Face *aface ); -#ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK +#if defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \ + !defined( FT_MACINTOSH ) /* Mac OS X/Darwin kernel often changes recommended method to access */ /* the resource fork and older methods makes the kernel issue the */ /* warning of deprecated method. To calm it down, the methods based */ /* on Darwin VFS should be grouped and skip the rest methods after */ /* the case the resource is opened but found to lack a font in it. */ FT_LOCAL( FT_Bool ) - raccess_rule_by_darwin_vfs( FT_UInt rule_index ); -#endif /* FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK */ + ft_raccess_rule_by_darwin_vfs( FT_Library library, FT_UInt rule_index ); +#endif FT_END_HEADER Index: src/base/ftbitmap.c =================================================================== --- src/base/ftbitmap.c (revision 58178) +++ src/base/ftbitmap.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType utility functions for bitmaps (body). */ /* */ -/* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 2004-2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -105,7 +105,7 @@ int new_pitch; FT_UInt bpp; FT_Int i, width, height; - unsigned char* buffer; + unsigned char* buffer = NULL; width = bitmap->width; @@ -231,7 +231,7 @@ if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) || ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) ) return FT_Err_Invalid_Argument; - + xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6; ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6; @@ -417,6 +417,10 @@ target->pitch = source->width + pad; + if ( target->pitch > 0 && + (FT_ULong)target->rows > FT_ULONG_MAX / target->pitch ) + return FT_Err_Invalid_Argument; + if ( target->rows * target->pitch > old_size && FT_QREALLOC( target->buffer, old_size, target->rows * target->pitch ) ) @@ -451,15 +455,15 @@ { FT_Int val = ss[0]; /* avoid a byte->int cast on each line */ - tt[0] = (FT_Byte)( ( val & 0x80 ) ? 0xff : 0); - tt[1] = (FT_Byte)( ( val & 0x40 ) ? 0xff : 0); - tt[2] = (FT_Byte)( ( val & 0x20 ) ? 0xff : 0); - tt[3] = (FT_Byte)( ( val & 0x10 ) ? 0xff : 0); - tt[4] = (FT_Byte)( ( val & 0x08 ) ? 0xff : 0); - tt[5] = (FT_Byte)( ( val & 0x04 ) ? 0xff : 0); - tt[6] = (FT_Byte)( ( val & 0x02 ) ? 0xff : 0); - tt[7] = (FT_Byte)( ( val & 0x01 ) ? 0xff : 0); + tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 ); + tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 ); + tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 ); + tt[3] = (FT_Byte)( ( val & 0x10 ) >> 4 ); + tt[4] = (FT_Byte)( ( val & 0x08 ) >> 3 ); + tt[5] = (FT_Byte)( ( val & 0x04 ) >> 2 ); + tt[6] = (FT_Byte)( ( val & 0x02 ) >> 1 ); + tt[7] = (FT_Byte)( val & 0x01 ); tt += 8; ss += 1; @@ -474,7 +478,7 @@ for ( ; j > 0; j-- ) { - tt[0] = (FT_Byte)( ( val & 0x80 ) ? 0xff : 0); + tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7); val <<= 1; tt += 1; } Index: src/base/ftcalc.c =================================================================== --- src/base/ftcalc.c (revision 58178) +++ src/base/ftcalc.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Arithmetic computations (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ +/* Copyright 1996-2006, 2008, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -307,7 +307,7 @@ q <<= 1; r |= lo >> 31; - if ( r >= (FT_UInt32)y ) + if ( r >= y ) { r -= y; q |= 1; @@ -373,7 +373,7 @@ if ( a <= 46340L && b <= 46340L && c <= 176095L && c > 0 ) a = ( a * b + ( c >> 1 ) ) / c; - else if ( c > 0 ) + else if ( (FT_Int32)c > 0 ) { FT_Int64 temp, temp2; @@ -412,7 +412,7 @@ if ( a <= 46340L && b <= 46340L && c > 0 ) a = a * b / c; - else if ( c > 0 ) + else if ( (FT_Int32)c > 0 ) { FT_Int64 temp; @@ -464,7 +464,7 @@ * Unfortunately, it doesn't work (at least not portably). * * It makes the assumption that right-shift on a negative signed value - * fills the leftmost bits by copying the sign bit. This is wrong. + * fills the leftmost bits by copying the sign bit. This is wrong. * According to K&R 2nd ed, section `A7.8 Shift Operators' on page 206, * the result of right-shift of a negative signed value is * implementation-defined. At least one implementation fills the @@ -544,7 +544,7 @@ s = (FT_Int32)a; a = FT_ABS( a ); s ^= (FT_Int32)b; b = FT_ABS( b ); - if ( b == 0 ) + if ( (FT_UInt32)b == 0 ) { /* check for division by 0 */ q = (FT_UInt32)0x7FFFFFFFL; @@ -552,15 +552,16 @@ else if ( ( a >> 16 ) == 0 ) { /* compute result directly */ - q = (FT_UInt32)( (a << 16) + (b >> 1) ) / (FT_UInt32)b; + q = (FT_UInt32)( ( a << 16 ) + ( b >> 1 ) ) / (FT_UInt32)b; } else { /* we need more bits; we have to do it by hand */ 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 ); Index: src/base/ftgloadr.c =================================================================== --- src/base/ftgloadr.c (revision 58178) +++ src/base/ftgloadr.c (working copy) @@ -318,7 +318,7 @@ } - /* add current glyph to the base image - and prepare for another */ + /* add current glyph to the base image -- and prepare for another */ FT_BASE_DEF( void ) FT_GlyphLoader_Add( FT_GlyphLoader loader ) { Index: src/base/ftglyph.c =================================================================== --- src/base/ftglyph.c (revision 58178) +++ src/base/ftglyph.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType convenience functions to handle glyphs (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010 by */ +/* Copyright 1996-2005, 2007, 2008, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -254,7 +254,7 @@ } - FT_DEFINE_GLYPH( ft_outline_glyph_class, + FT_DEFINE_GLYPH( ft_outline_glyph_class, sizeof ( FT_OutlineGlyphRec ), FT_GLYPH_FORMAT_OUTLINE, @@ -510,47 +510,47 @@ FT_GlyphSlotRec dummy; FT_GlyphSlot_InternalRec dummy_internal; FT_Error error = FT_Err_Ok; - FT_Glyph glyph; + FT_Glyph b, glyph; FT_BitmapGlyph bitmap = NULL; - const FT_Glyph_Class* clazz; -#ifdef FT_CONFIG_OPTION_PIC - FT_Library library = FT_GLYPH( glyph )->library; -#endif + /* FT_BITMAP_GLYPH_CLASS_GET derefers `library' in PIC mode */ + FT_Library library; /* check argument */ if ( !the_glyph ) goto Bad; - - /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */ - /* then calling FT_Render_Glyph_Internal() */ - glyph = *the_glyph; if ( !glyph ) goto Bad; - clazz = glyph->clazz; + clazz = glyph->clazz; + library = glyph->library; + if ( !library || !clazz ) + goto Bad; /* when called with a bitmap glyph, do nothing and return successfully */ if ( clazz == FT_BITMAP_GLYPH_CLASS_GET ) goto Exit; - if ( !clazz || !clazz->glyph_prepare ) + if ( !clazz->glyph_prepare ) goto Bad; + /* we render the glyph into a glyph bitmap using a `dummy' glyph slot */ + /* then calling FT_Render_Glyph_Internal() */ + FT_MEM_ZERO( &dummy, sizeof ( dummy ) ); FT_MEM_ZERO( &dummy_internal, sizeof ( dummy_internal ) ); dummy.internal = &dummy_internal; - dummy.library = glyph->library; + dummy.library = library; dummy.format = clazz->glyph_format; /* create result bitmap glyph */ - error = ft_new_glyph( glyph->library, FT_BITMAP_GLYPH_CLASS_GET, - (FT_Glyph*)(void*)&bitmap ); + error = ft_new_glyph( library, FT_BITMAP_GLYPH_CLASS_GET, &b ); if ( error ) goto Exit; + bitmap = (FT_BitmapGlyph)b; #if 1 /* if `origin' is set, translate the glyph image */ Index: src/base/ftinit.c =================================================================== --- src/base/ftinit.c (revision 58178) +++ src/base/ftinit.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType initialization layer (body). */ /* */ -/* Copyright 1996-2001, 2002, 2005, 2007, 2009 by */ +/* Copyright 1996-2002, 2005, 2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -54,8 +54,10 @@ #undef FT_COMPONENT #define FT_COMPONENT trace_init + #ifndef FT_CONFIG_OPTION_PIC + #undef FT_USE_MODULE #ifdef __cplusplus #define FT_USE_MODULE( type, x ) extern "C" const type x; @@ -63,10 +65,8 @@ #define FT_USE_MODULE( type, x ) extern const type x; #endif - #include FT_CONFIG_MODULES_H - #undef FT_USE_MODULE #define FT_USE_MODULE( type, x ) (const FT_Module_Class*)&(x), @@ -77,8 +77,10 @@ 0 }; + #else /* FT_CONFIG_OPTION_PIC */ + #ifdef __cplusplus #define FT_EXTERNC extern "C" #else @@ -87,16 +89,19 @@ /* declare the module's class creation/destruction functions */ #undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - FT_EXTERNC FT_Error FT_Create_Class_##x( FT_Library library, FT_Module_Class** output_class ); \ - FT_EXTERNC void FT_Destroy_Class_##x( FT_Library library, FT_Module_Class* clazz ); +#define FT_USE_MODULE( type, x ) \ + FT_EXTERNC FT_Error \ + FT_Create_Class_ ## x( FT_Library library, \ + FT_Module_Class* *output_class ); \ + FT_EXTERNC void \ + FT_Destroy_Class_ ## x( FT_Library library, \ + FT_Module_Class* clazz ); #include FT_CONFIG_MODULES_H - /* count all module classes */ #undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) MODULE_CLASS_##x, +#define FT_USE_MODULE( type, x ) MODULE_CLASS_ ## x, enum { @@ -104,26 +109,31 @@ FT_NUM_MODULE_CLASSES }; - /* destroy all module classes */ + /* destroy all module classes */ #undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - if ( classes[i] ) { FT_Destroy_Class_##x(library, classes[i]); } \ - i++; \ +#define FT_USE_MODULE( type, x ) \ + if ( classes[i] ) \ + { \ + FT_Destroy_Class_ ## x( library, classes[i] ); \ + } \ + i++; + FT_BASE_DEF( void ) ft_destroy_default_module_classes( FT_Library library ) { - FT_Module_Class** classes; - FT_Memory memory; - FT_UInt i; - BasePIC* pic_container = (BasePIC*)library->pic_container.base; + FT_Module_Class* *classes; + FT_Memory memory; + FT_UInt i; + BasePIC* pic_container = (BasePIC*)library->pic_container.base; + if ( !pic_container->default_module_classes ) return; - memory = library->memory; + memory = library->memory; classes = pic_container->default_module_classes; - i = 0; + i = 0; #include FT_CONFIG_MODULES_H @@ -131,30 +141,37 @@ pic_container->default_module_classes = 0; } + /* initialize all module classes and the pointer table */ #undef FT_USE_MODULE -#define FT_USE_MODULE( type, x ) \ - error = FT_Create_Class_##x(library, &clazz); \ - if (error) goto Exit; \ +#define FT_USE_MODULE( type, x ) \ + error = FT_Create_Class_ ## x( library, &clazz ); \ + if ( error ) \ + goto Exit; \ classes[i++] = clazz; + FT_BASE_DEF( FT_Error ) ft_create_default_module_classes( FT_Library library ) { - FT_Error error; - FT_Memory memory; - FT_Module_Class** classes; - FT_Module_Class* clazz; - FT_UInt i; - BasePIC* pic_container = (BasePIC*)library->pic_container.base; + FT_Error error; + FT_Memory memory; + FT_Module_Class* *classes = NULL; + FT_Module_Class* clazz; + FT_UInt i; + BasePIC* pic_container = (BasePIC*)library->pic_container.base; - memory = library->memory; + + memory = library->memory; + pic_container->default_module_classes = 0; - if ( FT_ALLOC(classes, sizeof(FT_Module_Class*) * (FT_NUM_MODULE_CLASSES + 1) ) ) + if ( FT_ALLOC( classes, sizeof ( FT_Module_Class* ) * + ( FT_NUM_MODULE_CLASSES + 1 ) ) ) return error; + /* initialize all pointers to 0, especially the last one */ - for (i = 0; i < FT_NUM_MODULE_CLASSES; i++) + for ( i = 0; i < FT_NUM_MODULE_CLASSES; i++ ) classes[i] = 0; classes[FT_NUM_MODULE_CLASSES] = 0; @@ -162,16 +179,19 @@ #include FT_CONFIG_MODULES_H -Exit: - if (error) ft_destroy_default_module_classes( library ); - else pic_container->default_module_classes = classes; + Exit: + if ( error ) + ft_destroy_default_module_classes( library ); + else + pic_container->default_module_classes = classes; - return error; + return error; } #endif /* FT_CONFIG_OPTION_PIC */ + /* documentation is in ftmodapi.h */ FT_EXPORT_DEF( void ) @@ -181,9 +201,18 @@ const FT_Module_Class* const* cur; + /* FT_DEFAULT_MODULES_GET dereferences `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + if ( !library ) + return; +#endif + + /* GCC 4.6 warns the type difference: + * FT_Module_Class** != const FT_Module_Class* const* + */ + cur = (const FT_Module_Class* const*)FT_DEFAULT_MODULES_GET; + /* test for valid `library' delayed to FT_Add_Module() */ - - cur = FT_DEFAULT_MODULES_GET; while ( *cur ) { error = FT_Add_Module( library, *cur ); Index: src/base/ftmac.c =================================================================== --- src/base/ftmac.c (revision 58178) +++ src/base/ftmac.c (working copy) @@ -119,6 +119,8 @@ #endif +#ifdef FT_MACINTOSH + /* This function is deprecated because FSSpec is deprecated in Mac OS X */ FT_EXPORT_DEF( FT_Error ) FT_GetFile_From_Mac_Name( const char* fontName, @@ -144,7 +146,7 @@ { #if defined( MAC_OS_X_VERSION_10_5 ) && \ ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) - + OSStatus err; err = ATSFontGetFileReference( ats_font_id, ats_font_ref ); @@ -1053,5 +1055,7 @@ #endif } +#endif /* FT_MACINTOSH */ + /* END */ Index: src/base/ftobjs.c =================================================================== --- src/base/ftobjs.c (revision 58178) +++ src/base/ftobjs.c (working copy) @@ -4,8 +4,7 @@ /* */ /* The FreeType private base classes (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +29,7 @@ #include FT_TRUETYPE_TAGS_H #include FT_TRUETYPE_IDS_H +#include FT_SERVICE_PROPERTIES_H #include FT_SERVICE_SFNT_H #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_GLYPH_DICT_H @@ -131,7 +131,7 @@ { FT_Error error; FT_Memory memory; - FT_Stream stream; + FT_Stream stream = NULL; *astream = 0; @@ -156,6 +156,9 @@ (const FT_Byte*)args->memory_base, args->memory_size ); } + +#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT + else if ( args->flags & FT_OPEN_PATHNAME ) { /* create a normal system stream */ @@ -171,6 +174,9 @@ FT_FREE( stream ); stream = args->stream; } + +#endif + else error = FT_Err_Invalid_Argument; @@ -375,7 +381,7 @@ FT_Driver driver; FT_Driver_Class clazz; FT_Memory memory; - FT_GlyphSlot slot; + FT_GlyphSlot slot = NULL; if ( !face || !face->driver ) @@ -440,6 +446,10 @@ else prev->next = cur->next; + /* finalize client-specific data */ + if ( slot->generic.finalizer ) + slot->generic.finalizer( slot ); + ft_glyphslot_done( slot ); FT_FREE( slot ); break; @@ -561,6 +571,7 @@ FT_Library library; FT_Bool autohint = FALSE; FT_Module hinter; + TT_Face ttface = (TT_Face)face; if ( !face || !face->size || !face->glyph ) @@ -601,7 +612,8 @@ * - Then, auto-hint if FT_LOAD_FORCE_AUTOHINT is set or if we don't * have a native font hinter. * - * - Otherwise, auto-hint for LIGHT hinting mode. + * - Otherwise, auto-hint for LIGHT hinting mode or if there isn't + * any hinting bytecode in the TrueType/OpenType font. * * - Exception: The font is `tricky' and requires the native hinter to * load properly. @@ -613,7 +625,8 @@ FT_DRIVER_IS_SCALABLE( driver ) && FT_DRIVER_USES_OUTLINES( driver ) && !FT_IS_TRICKY( face ) && - ( ( face->internal->transform_matrix.yx == 0 && + ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) || + ( face->internal->transform_matrix.yx == 0 && face->internal->transform_matrix.xx != 0 ) || ( face->internal->transform_matrix.xx == 0 && face->internal->transform_matrix.yx != 0 ) ) ) @@ -626,15 +639,20 @@ FT_Render_Mode mode = FT_LOAD_TARGET_MODE( load_flags ); - if ( mode == FT_RENDER_MODE_LIGHT || - face->internal->ignore_unpatented_hinter ) + /* the check for `num_locations' assures that we actually */ + /* test for instructions in a TTF and not in a CFF-based OTF */ + if ( mode == FT_RENDER_MODE_LIGHT || + face->internal->ignore_unpatented_hinter || + ( FT_IS_SFNT( face ) && + ttface->num_locations && + ttface->max_profile.maxSizeOfInstructions == 0 ) ) autohint = TRUE; } } if ( autohint ) { - FT_AutoHinter_Service hinting; + FT_AutoHinter_Interface hinting; /* try to load embedded bitmaps first if available */ @@ -663,7 +681,7 @@ internal->transform_flags = 0; /* load auto-hinted outline */ - hinting = (FT_AutoHinter_Service)hinter->clazz->module_interface; + hinting = (FT_AutoHinter_Interface)hinter->clazz->module_interface; error = hinting->load_glyph( (FT_AutoHinter)hinter, slot, face->size, @@ -744,11 +762,11 @@ else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) { /* apply `standard' transformation if no renderer is available */ - if ( &internal->transform_matrix ) + if ( internal->transform_flags & 1 ) FT_Outline_Transform( &slot->outline, &internal->transform_matrix ); - if ( &internal->transform_delta ) + if ( internal->transform_flags & 2 ) FT_Outline_Translate( &slot->outline, internal->transform_delta.x, internal->transform_delta.y ); @@ -1174,7 +1192,7 @@ /* there's a Mac-specific extended implementation of FT_New_Face() */ /* in src/base/ftmac.c */ -#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) +#ifndef FT_MACINTOSH /* documentation is in freetype.h */ @@ -1198,7 +1216,7 @@ return FT_Open_Face( library, &args, face_index, aface ); } -#endif /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */ +#endif /* documentation is in freetype.h */ @@ -1283,7 +1301,7 @@ { FT_Error error; FT_Memory memory; - FT_Stream stream; + FT_Stream stream = NULL; if ( !library ) @@ -1458,7 +1476,7 @@ FT_ULong offset, length; FT_Long pos; FT_Bool is_sfnt_cid; - FT_Byte* sfnt_ps; + FT_Byte* sfnt_ps = NULL; FT_UNUSED( num_params ); FT_UNUSED( params ); @@ -1507,7 +1525,7 @@ } -#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) +#ifndef FT_MACINTOSH /* The resource header says we've got resource_cnt `POST' (type1) */ /* resources in this file. They all need to be coalesced into */ @@ -1525,7 +1543,7 @@ { FT_Error error = FT_Err_Cannot_Open_Resource; FT_Memory memory = library->memory; - FT_Byte* pfb_data; + FT_Byte* pfb_data = NULL; int i, type, flags; FT_Long len; FT_Long pfb_len, pfb_pos, pfb_lenpos; @@ -1667,7 +1685,7 @@ FT_Face *aface ) { FT_Memory memory = library->memory; - FT_Byte* sfnt_data; + FT_Byte* sfnt_data = NULL; FT_Error error; FT_Long flag_offset; FT_Long rlen; @@ -1862,14 +1880,14 @@ for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) { - is_darwin_vfs = raccess_rule_by_darwin_vfs( i ); + is_darwin_vfs = ft_raccess_rule_by_darwin_vfs( library, i ); if ( is_darwin_vfs && vfs_rfork_has_no_font ) { FT_TRACE3(( "Skip rule %d: darwin vfs resource fork" " is already checked and" " no font is found\n", i )); continue; - } + } if ( errors[i] ) { @@ -2038,11 +2056,12 @@ } else { + error = FT_Err_Missing_Module; + /* check each font driver for an appropriate format */ cur = library->modules; limit = cur + library->num_modules; - for ( ; cur < limit; cur++ ) { /* not all modules are font drivers, so check... */ @@ -2092,30 +2111,30 @@ } } - Fail3: - /* 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 ) - goto Fail2; + Fail3: + /* 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 ) + goto Fail2; #if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS ) - error = load_mac_face( library, stream, face_index, aface, args ); - if ( !error ) - { - /* We don't want to go to Success here. We've already done that. */ - /* On the other hand, if we succeeded we still need to close this */ - /* stream (we opened a different stream which extracted the */ - /* interesting information out of this stream here. That stream */ - /* will still be open and the face will point to it). */ - FT_Stream_Free( stream, external_stream ); - return error; - } + error = load_mac_face( library, stream, face_index, aface, args ); + if ( !error ) + { + /* We don't want to go to Success here. We've already done that. */ + /* On the other hand, if we succeeded we still need to close this */ + /* stream (we opened a different stream which extracted the */ + /* interesting information out of this stream here. That stream */ + /* will still be open and the face will point to it). */ + FT_Stream_Free( stream, external_stream ); + return error; + } - if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format ) - goto Fail2; + if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format ) + goto Fail2; #endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */ /* no driver is able to handle this format */ @@ -2601,6 +2620,18 @@ metrics->height = bsize->height << 6; metrics->max_advance = bsize->x_ppem; } + + FT_TRACE5(( "FT_Select_Metrics:\n" )); + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } @@ -2709,6 +2740,18 @@ metrics->x_scale = 1L << 16; metrics->y_scale = 1L << 16; } + + FT_TRACE5(( "FT_Request_Metrics:\n" )); + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); } @@ -2730,8 +2773,34 @@ clazz = face->driver->clazz; if ( clazz->select_size ) - return clazz->select_size( face->size, (FT_ULong)strike_index ); + { + FT_Error error; + + error = clazz->select_size( face->size, (FT_ULong)strike_index ); + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Size_Metrics* metrics = &face->size->metrics; + + + FT_TRACE5(( "FT_Select_Size (font driver's `select_size'):\n" )); + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + } +#endif + + return error; + } + FT_Select_Metrics( face, (FT_ULong)strike_index ); return FT_Err_Ok; @@ -2758,8 +2827,34 @@ clazz = face->driver->clazz; if ( clazz->request_size ) - return clazz->request_size( face->size, req ); + { + FT_Error error; + + error = clazz->request_size( face->size, req ); + +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_Size_Metrics* metrics = &face->size->metrics; + + + FT_TRACE5(( "FT_Request_Size (font driver's `request_size'):\n" )); + FT_TRACE5(( " x scale: %d (%f)\n", + metrics->x_scale, metrics->x_scale / 65536.0 )); + FT_TRACE5(( " y scale: %d (%f)\n", + metrics->y_scale, metrics->y_scale / 65536.0 )); + FT_TRACE5(( " ascender: %f\n", metrics->ascender / 64.0 )); + FT_TRACE5(( " descender: %f\n", metrics->descender / 64.0 )); + FT_TRACE5(( " height: %f\n", metrics->height / 64.0 )); + FT_TRACE5(( " max advance: %f\n", metrics->max_advance / 64.0 )); + FT_TRACE5(( " x ppem: %d\n", metrics->x_ppem )); + FT_TRACE5(( " y ppem: %d\n", metrics->y_ppem )); + } +#endif + + return error; + } + /* * The reason that a driver doesn't have `request_size' defined is * either that the scaling here suffices or that the supported formats @@ -3148,7 +3243,7 @@ FT_Error error = FT_Err_Ok; FT_Face face; FT_Memory memory; - FT_CMap cmap; + FT_CMap cmap = NULL; if ( clazz == NULL || charmap == NULL || charmap->face == NULL ) @@ -3887,6 +3982,7 @@ error = set_mode( renderer, parameters->tag, parameters->data ); if ( error ) break; + parameters++; } } @@ -3995,10 +4091,10 @@ /* all child faces. */ /* */ /* <InOut> */ - /* module :: A handle to the target driver object. */ + /* module :: A handle to the target driver object. */ /* */ /* <Note> */ - /* The driver _must_ be LOCKED! */ + /* The driver _must_ be LOCKED! */ /* */ static void Destroy_Module( FT_Module module ) @@ -4008,10 +4104,6 @@ FT_Library library = module->library; - /* finalize client-data - before anything else */ - if ( module->generic.finalizer ) - module->generic.finalizer( module ); - if ( library && library->auto_hinter == module ) library->auto_hinter = 0; @@ -4150,7 +4242,7 @@ FT_Renderer renderer = FT_RENDERER( module ); - if ( renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE && + if ( renderer->clazz->glyph_format == FT_GLYPH_FORMAT_OUTLINE && renderer->raster ) renderer->clazz->raster_class->raster_done( renderer->raster ); } @@ -4211,23 +4303,23 @@ { FT_Pointer result = NULL; + if ( module ) { FT_ASSERT( module->clazz && module->clazz->get_interface ); - /* first, look for the service in the module - */ + /* first, look for the service in the module */ if ( module->clazz->get_interface ) result = module->clazz->get_interface( module, service_id ); if ( result == NULL ) { - /* we didn't find it, look in all other modules then - */ + /* we didn't find it, look in all other modules then */ FT_Library library = module->library; FT_Module* cur = library->modules; FT_Module* limit = cur + library->num_modules; + for ( ; cur < limit; cur++ ) { if ( cur[0] != module ) @@ -4291,6 +4383,118 @@ } + FT_Error + ft_property_do( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + void* value, + FT_Bool set ) + { + FT_Module* cur; + FT_Module* limit; + FT_Module_Interface interface; + + FT_Service_Properties service; + +#ifdef FT_DEBUG_LEVEL_ERROR + const FT_String* set_name = "FT_Property_Set"; + const FT_String* get_name = "FT_Property_Get"; + const FT_String* func_name = set ? set_name : get_name; +#endif + + FT_Bool missing_func; + + + if ( !library ) + return FT_Err_Invalid_Library_Handle; + + if ( !module_name || !property_name || !value ) + return FT_Err_Invalid_Argument; + + cur = library->modules; + limit = cur + library->num_modules; + + /* search module */ + for ( ; cur < limit; cur++ ) + if ( !ft_strcmp( cur[0]->clazz->module_name, module_name ) ) + break; + + if ( cur == limit ) + { + FT_ERROR(( "%s: can't find module `%s'\n", + func_name, module_name )); + return FT_Err_Missing_Module; + } + + /* check whether we have a service interface */ + if ( !cur[0]->clazz->get_interface ) + { + FT_ERROR(( "%s: module `%s' doesn't support properties\n", + func_name, module_name )); + return FT_Err_Unimplemented_Feature; + } + + /* search property service */ + interface = cur[0]->clazz->get_interface( cur[0], + FT_SERVICE_ID_PROPERTIES ); + if ( !interface ) + { + FT_ERROR(( "%s: module `%s' doesn't support properties\n", + func_name, module_name )); + return FT_Err_Unimplemented_Feature; + } + + service = (FT_Service_Properties)interface; + + if ( set ) + missing_func = !service->set_property; + else + missing_func = !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 set ? service->set_property( cur[0], property_name, value ) + : service->get_property( cur[0], property_name, value ); + } + + + /* documentation is in ftmodapi.h */ + + FT_Error + FT_Property_Set( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + const void* value ) + { + return ft_property_do( library, + module_name, + property_name, + (void*)value, + TRUE ); + } + + + /* documentation is in ftmodapi.h */ + + FT_Error + FT_Property_Get( FT_Library library, + const FT_String* module_name, + const FT_String* property_name, + void* value ) + { + return ft_property_do( library, + module_name, + property_name, + value, + FALSE ); + } + + /*************************************************************************/ /*************************************************************************/ /*************************************************************************/ @@ -4421,10 +4625,6 @@ memory = library->memory; - /* Discard client-data */ - if ( library->generic.finalizer ) - library->generic.finalizer( library ); - /* * Close all faces in the library. If we don't do this, we can have * some subtle memory leaks. Index: src/base/ftoutln.c =================================================================== --- src/base/ftoutln.c (revision 58178) +++ src/base/ftoutln.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType outline management (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2008, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -771,7 +771,7 @@ return 1; } - return ( n % 2 ); + return n & 1; } @@ -882,9 +882,19 @@ FT_Outline_Embolden( FT_Outline* outline, FT_Pos strength ) { + return FT_Outline_EmboldenXY( outline, strength, strength ); + } + + + /* documentation is in ftoutln.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Outline_EmboldenXY( FT_Outline* outline, + FT_Pos xstrength, + FT_Pos ystrength ) + { FT_Vector* points; FT_Vector v_prev, v_first, v_next, v_cur; - FT_Angle rotate, angle_in, angle_out; FT_Int c, n, first; FT_Int orientation; @@ -892,8 +902,9 @@ if ( !outline ) return FT_Err_Invalid_Argument; - strength /= 2; - if ( strength == 0 ) + xstrength /= 2; + ystrength /= 2; + if ( xstrength == 0 && ystrength == 0 ) return FT_Err_Ok; orientation = FT_Outline_Get_Orientation( outline ); @@ -905,62 +916,78 @@ return FT_Err_Ok; } - if ( orientation == FT_ORIENTATION_TRUETYPE ) - rotate = -FT_ANGLE_PI2; - else - rotate = FT_ANGLE_PI2; - points = outline->points; first = 0; for ( c = 0; c < outline->n_contours; c++ ) { - int last = outline->contours[c]; + FT_Vector in, out, shift; + FT_Fixed l_in, l_out, l, q, d; + int last = outline->contours[c]; v_first = points[first]; v_prev = points[last]; v_cur = v_first; + /* compute the incoming vector and its length */ + in.x = v_cur.x - v_prev.x; + in.y = v_cur.y - v_prev.y; + l_in = FT_Vector_Length( &in ); + for ( n = first; n <= last; n++ ) { - FT_Vector in, out; - FT_Angle angle_diff; - FT_Pos d; - FT_Fixed scale; - - if ( n < last ) v_next = points[n + 1]; else v_next = v_first; - /* compute the in and out vectors */ - in.x = v_cur.x - v_prev.x; - in.y = v_cur.y - v_prev.y; - + /* compute the outgoing vector and its length */ out.x = v_next.x - v_cur.x; out.y = v_next.y - v_cur.y; + l_out = FT_Vector_Length( &out ); - angle_in = FT_Atan2( in.x, in.y ); - angle_out = FT_Atan2( out.x, out.y ); - angle_diff = FT_Angle_Diff( angle_in, angle_out ); - scale = FT_Cos( angle_diff / 2 ); + d = l_in * l_out + in.x * out.x + in.y * out.y; - if ( scale < 0x4000L && scale > -0x4000L ) - in.x = in.y = 0; - else + /* shift only if turn is less then ~160 degrees */ + if ( 16 * d > l_in * l_out ) { - d = FT_DivFix( strength, scale ); + /* 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; - FT_Vector_From_Polar( &in, d, angle_in + angle_diff / 2 - rotate ); + 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; + if ( orientation == FT_ORIENTATION_TRUETYPE ) + q = -q; + + if ( FT_MulDiv( xstrength, q, l ) < d ) + shift.x = FT_MulDiv( shift.x, xstrength, d ); + else + shift.x = FT_MulDiv( shift.x, l, q ); + + + if ( FT_MulDiv( ystrength, q, l ) < d ) + shift.y = FT_MulDiv( shift.y, ystrength, d ); + else + shift.y = FT_MulDiv( shift.y, l, q ); } + else + shift.x = shift.y = 0; - outline->points[n].x = v_cur.x + strength + in.x; - outline->points[n].y = v_cur.y + strength + in.y; + outline->points[n].x = v_cur.x + xstrength + shift.x; + outline->points[n].y = v_cur.y + ystrength + shift.y; - v_prev = v_cur; - v_cur = v_next; + in = out; + l_in = l_out; + v_cur = v_next; } first = last + 1; @@ -975,25 +1002,12 @@ FT_EXPORT_DEF( FT_Orientation ) FT_Outline_Get_Orientation( FT_Outline* outline ) { - FT_Pos xmin = 32768L; - FT_Pos xmin_ymin = 32768L; - FT_Pos xmin_ymax = -32768L; - FT_Vector* xmin_first = NULL; - FT_Vector* xmin_last = NULL; + FT_Vector* points; + FT_Vector v_prev, v_cur; + FT_Int c, n, first; + FT_Pos area = 0; - short* contour; - FT_Vector* first; - FT_Vector* last; - FT_Vector* prev; - FT_Vector* point; - - int i; - FT_Pos ray_y[3]; - FT_Orientation result[3] = - { FT_ORIENTATION_NONE, FT_ORIENTATION_NONE, FT_ORIENTATION_NONE }; - - if ( !outline || outline->n_points <= 0 ) return FT_ORIENTATION_TRUETYPE; @@ -1002,127 +1016,32 @@ /* cubic or quadratic curves, this test deals with the polygon */ /* only which is spanned up by the control points. */ - first = outline->points; - for ( contour = outline->contours; - contour < outline->contours + outline->n_contours; - contour++, first = last + 1 ) + points = outline->points; + + first = 0; + for ( c = 0; c < outline->n_contours; c++ ) { - FT_Pos contour_xmin = 32768L; - FT_Pos contour_xmax = -32768L; - FT_Pos contour_ymin = 32768L; - FT_Pos contour_ymax = -32768L; + FT_Int last = outline->contours[c]; - last = outline->points + *contour; + v_prev = points[last]; - /* skip degenerate contours */ - if ( last < first + 2 ) - continue; - - for ( point = first; point <= last; ++point ) + for ( n = first; n <= last; n++ ) { - if ( point->x < contour_xmin ) - contour_xmin = point->x; - - if ( point->x > contour_xmax ) - contour_xmax = point->x; - - if ( point->y < contour_ymin ) - contour_ymin = point->y; - - if ( point->y > contour_ymax ) - contour_ymax = point->y; + v_cur = points[n]; + area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x ); + v_prev = v_cur; } - if ( contour_xmin < xmin && - contour_xmin != contour_xmax && - contour_ymin != contour_ymax ) - { - xmin = contour_xmin; - xmin_ymin = contour_ymin; - xmin_ymax = contour_ymax; - xmin_first = first; - xmin_last = last; - } + first = last + 1; } - if ( xmin == 32768L ) + if ( area > 0 ) + return FT_ORIENTATION_POSTSCRIPT; + else if ( area < 0 ) return FT_ORIENTATION_TRUETYPE; - - ray_y[0] = ( xmin_ymin * 3 + xmin_ymax ) >> 2; - ray_y[1] = ( xmin_ymin + xmin_ymax ) >> 1; - ray_y[2] = ( xmin_ymin + xmin_ymax * 3 ) >> 2; - - for ( i = 0; i < 3; i++ ) - { - FT_Pos left_x; - FT_Pos right_x; - FT_Vector* left1; - FT_Vector* left2; - FT_Vector* right1; - FT_Vector* right2; - - - RedoRay: - left_x = 32768L; - right_x = -32768L; - - left1 = left2 = right1 = right2 = NULL; - - prev = xmin_last; - for ( point = xmin_first; point <= xmin_last; prev = point, ++point ) - { - FT_Pos tmp_x; - - - if ( point->y == ray_y[i] || prev->y == ray_y[i] ) - { - ray_y[i]++; - goto RedoRay; - } - - if ( ( point->y < ray_y[i] && prev->y < ray_y[i] ) || - ( point->y > ray_y[i] && prev->y > ray_y[i] ) ) - continue; - - tmp_x = FT_MulDiv( point->x - prev->x, - ray_y[i] - prev->y, - point->y - prev->y ) + prev->x; - - if ( tmp_x < left_x ) - { - left_x = tmp_x; - left1 = prev; - left2 = point; - } - - if ( tmp_x > right_x ) - { - right_x = tmp_x; - right1 = prev; - right2 = point; - } - } - - if ( left1 && right1 ) - { - if ( left1->y < left2->y && right1->y > right2->y ) - result[i] = FT_ORIENTATION_TRUETYPE; - else if ( left1->y > left2->y && right1->y < right2->y ) - result[i] = FT_ORIENTATION_POSTSCRIPT; - else - result[i] = FT_ORIENTATION_NONE; - } - } - - if ( result[0] != FT_ORIENTATION_NONE && - ( result[0] == result[1] || result[0] == result[2] ) ) - return result[0]; - - if ( result[1] != FT_ORIENTATION_NONE && result[1] == result[2] ) - return result[1]; - - return FT_ORIENTATION_TRUETYPE; + else + return FT_ORIENTATION_NONE; } Index: src/base/ftpatent.c =================================================================== --- src/base/ftpatent.c (revision 58178) +++ src/base/ftpatent.c (working copy) @@ -269,7 +269,7 @@ #if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \ - !defined( TT_CONFIG_OPTION_BYTECODE_INTEPRETER ) + !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER ) if ( face && FT_IS_SFNT( face ) ) { result = !face->internal->ignore_unpatented_hinter; Index: src/base/ftpic.c =================================================================== --- src/base/ftpic.c (revision 58178) +++ src/base/ftpic.c (working copy) @@ -26,15 +26,15 @@ /* documentation is in ftpic.h */ FT_BASE_DEF( FT_Error ) - ft_pic_container_init( FT_Library library ) + ft_pic_container_init( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Error error = FT_Err_Ok; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Error error = FT_Err_Ok; - FT_MEM_SET( pic_container, 0, sizeof(*pic_container) ); + FT_MEM_SET( pic_container, 0, sizeof ( *pic_container ) ); error = ft_base_pic_init( library ); - if(error) + if ( error ) return error; return FT_Err_Ok; @@ -43,7 +43,7 @@ /* Destroy the contents of the container. */ FT_BASE_DEF( void ) - ft_pic_container_destroy( FT_Library library ) + ft_pic_container_destroy( FT_Library library ) { ft_base_pic_free( library ); } Index: src/base/ftrfork.c =================================================================== --- src/base/ftrfork.c (revision 58178) +++ src/base/ftrfork.c (working copy) @@ -28,8 +28,8 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_RFORK_H +#include "basepic.h" - #undef FT_COMPONENT #define FT_COMPONENT trace_raccess @@ -159,8 +159,8 @@ FT_Long tag_internal, rpos; FT_Memory memory = library->memory; FT_Long temp; - FT_Long *offsets_internal; - FT_RFork_Ref *ref; + FT_Long *offsets_internal = NULL; + FT_RFork_Ref *ref = NULL; error = FT_Stream_Seek( stream, map_offset ); @@ -253,14 +253,6 @@ /*************************************************************************/ /*************************************************************************/ - typedef FT_Error - (*raccess_guess_func)( FT_Library library, - FT_Stream stream, - char *base_file_name, - char **result_file_name, - FT_Long *result_offset ); - - static FT_Error raccess_guess_apple_double( FT_Library library, FT_Stream stream, @@ -325,6 +317,20 @@ FT_Long *result_offset ); + CONST_FT_RFORK_RULE_ARRAY_BEGIN(ft_raccess_guess_table, + ft_raccess_guess_rec) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_double, apple_double) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(apple_single, apple_single) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_ufs_export, darwin_ufs_export) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_newvfs, darwin_newvfs) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(darwin_hfsplus, darwin_hfsplus) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(vfat, vfat) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_cap, linux_cap) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_double, linux_double) + CONST_FT_RFORK_RULE_ARRAY_ENTRY(linux_netatalk, linux_netatalk) + CONST_FT_RFORK_RULE_ARRAY_END + + /*************************************************************************/ /**** ****/ /**** Helper functions ****/ @@ -348,43 +354,6 @@ const char *original_name, const char *insertion ); - - typedef enum FT_RFork_Rule_ { - FT_RFork_Rule_invalid = -2, - FT_RFork_Rule_uknown, /* -1 */ - FT_RFork_Rule_apple_double, - FT_RFork_Rule_apple_single, - FT_RFork_Rule_darwin_ufs_export, - FT_RFork_Rule_darwin_newvfs, - FT_RFork_Rule_darwin_hfsplus, - FT_RFork_Rule_vfat, - FT_RFork_Rule_linux_cap, - FT_RFork_Rule_linux_double, - FT_RFork_Rule_linux_netatalk - } FT_RFork_Rule; - - /* For fast translation between rule index and rule type, - * the macros FT_RFORK_xxx should be kept consistent with - * the raccess_guess_funcs table - */ - typedef struct raccess_guess_rec_ { - raccess_guess_func func; - FT_RFork_Rule type; - } raccess_guess_rec; - - static raccess_guess_rec raccess_guess_table[FT_RACCESS_N_RULES] = - { - { raccess_guess_apple_double, FT_RFork_Rule_apple_double, }, - { raccess_guess_apple_single, FT_RFork_Rule_apple_single, }, - { raccess_guess_darwin_ufs_export, FT_RFork_Rule_darwin_ufs_export, }, - { raccess_guess_darwin_newvfs, FT_RFork_Rule_darwin_newvfs, }, - { raccess_guess_darwin_hfsplus, FT_RFork_Rule_darwin_hfsplus, }, - { raccess_guess_vfat, FT_RFork_Rule_vfat, }, - { raccess_guess_linux_cap, FT_RFork_Rule_linux_cap, }, - { raccess_guess_linux_double, FT_RFork_Rule_linux_double, }, - { raccess_guess_linux_netatalk, FT_RFork_Rule_linux_netatalk, }, - }; - FT_BASE_DEF( void ) FT_Raccess_Guess( FT_Library library, FT_Stream stream, @@ -393,7 +362,7 @@ FT_Long *offsets, FT_Error *errors ) { - FT_Long i; + FT_Int i; for ( i = 0; i < FT_RACCESS_N_RULES; i++ ) @@ -407,7 +376,7 @@ if ( errors[i] ) continue ; - errors[i] = (raccess_guess_table[i].func)( library, + errors[i] = (FT_RACCESS_GUESS_TABLE_GET[i].func)( library, stream, base_name, &(new_names[i]), &(offsets[i]) ); @@ -417,20 +386,28 @@ } +#ifndef FT_MACINTOSH static FT_RFork_Rule - raccess_get_rule_type_from_rule_index( FT_UInt rule_index ) + raccess_get_rule_type_from_rule_index( FT_Library library, + FT_UInt rule_index ) { + FT_UNUSED( library ); + if ( rule_index >= FT_RACCESS_N_RULES ) return FT_RFork_Rule_invalid; - return raccess_guess_table[rule_index].type; + return FT_RACCESS_GUESS_TABLE_GET[rule_index].type; } + /* + * For this function, refer ftbase.h. + */ FT_LOCAL_DEF( FT_Bool ) - raccess_rule_by_darwin_vfs( FT_UInt rule_index ) + ft_raccess_rule_by_darwin_vfs( FT_Library library, + FT_UInt rule_index ) { - switch( raccess_get_rule_type_from_rule_index( rule_index ) ) + switch( raccess_get_rule_type_from_rule_index( library, rule_index ) ) { case FT_RFork_Rule_darwin_newvfs: case FT_RFork_Rule_darwin_hfsplus: @@ -440,6 +417,7 @@ return FALSE; } } +#endif static FT_Error @@ -527,7 +505,7 @@ Only meaningful on systems with hfs+ drivers (or Macs). */ FT_Error error; - char* newpath; + char* newpath = NULL; FT_Memory memory; FT_Long base_file_len = ft_strlen( base_file_name ); @@ -563,7 +541,7 @@ Only meaningful on systems with Mac OS X (> 10.1). */ FT_Error error; - char* newpath; + char* newpath = NULL; FT_Memory memory; FT_Long base_file_len = ft_strlen( base_file_name ); @@ -849,7 +827,7 @@ FT_Long *offsets, FT_Error *errors ) { - int i; + FT_Int i; FT_UNUSED( library ); FT_UNUSED( stream ); Index: src/base/ftstream.c =================================================================== --- src/base/ftstream.c (revision 58178) +++ src/base/ftstream.c (working copy) @@ -4,7 +4,7 @@ /* */ /* I/O stream support (body). */ /* */ -/* Copyright 2000-2001, 2002, 2004, 2005, 2006, 2008, 2009, 2010 by */ +/* Copyright 2000-2002, 2004-2006, 2008-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -354,8 +354,8 @@ } - FT_BASE_DEF( FT_Short ) - FT_Stream_GetShort( FT_Stream stream ) + FT_BASE_DEF( FT_UShort ) + FT_Stream_GetUShort( FT_Stream stream ) { FT_Byte* p; FT_Short result; @@ -366,15 +366,15 @@ result = 0; p = stream->cursor; if ( p + 1 < stream->limit ) - result = FT_NEXT_SHORT( p ); + result = FT_NEXT_USHORT( p ); stream->cursor = p; return result; } - FT_BASE_DEF( FT_Short ) - FT_Stream_GetShortLE( FT_Stream stream ) + FT_BASE_DEF( FT_UShort ) + FT_Stream_GetUShortLE( FT_Stream stream ) { FT_Byte* p; FT_Short result; @@ -385,15 +385,15 @@ result = 0; p = stream->cursor; if ( p + 1 < stream->limit ) - result = FT_NEXT_SHORT_LE( p ); + result = FT_NEXT_USHORT_LE( p ); stream->cursor = p; return result; } - FT_BASE_DEF( FT_Long ) - FT_Stream_GetOffset( FT_Stream stream ) + FT_BASE_DEF( FT_ULong ) + FT_Stream_GetUOffset( FT_Stream stream ) { FT_Byte* p; FT_Long result; @@ -404,14 +404,14 @@ result = 0; p = stream->cursor; if ( p + 2 < stream->limit ) - result = FT_NEXT_OFF3( p ); + result = FT_NEXT_UOFF3( p ); stream->cursor = p; return result; } - FT_BASE_DEF( FT_Long ) - FT_Stream_GetLong( FT_Stream stream ) + FT_BASE_DEF( FT_ULong ) + FT_Stream_GetULong( FT_Stream stream ) { FT_Byte* p; FT_Long result; @@ -422,14 +422,14 @@ result = 0; p = stream->cursor; if ( p + 3 < stream->limit ) - result = FT_NEXT_LONG( p ); + result = FT_NEXT_ULONG( p ); stream->cursor = p; return result; } - FT_BASE_DEF( FT_Long ) - FT_Stream_GetLongLE( FT_Stream stream ) + FT_BASE_DEF( FT_ULong ) + FT_Stream_GetULongLE( FT_Stream stream ) { FT_Byte* p; FT_Long result; @@ -440,7 +440,7 @@ result = 0; p = stream->cursor; if ( p + 3 < stream->limit ) - result = FT_NEXT_LONG_LE( p ); + result = FT_NEXT_ULONG_LE( p ); stream->cursor = p; return result; } @@ -483,8 +483,8 @@ } - FT_BASE_DEF( FT_Short ) - FT_Stream_ReadShort( FT_Stream stream, + FT_BASE_DEF( FT_UShort ) + FT_Stream_ReadUShort( FT_Stream stream, FT_Error* error ) { FT_Byte reads[2]; @@ -511,7 +511,7 @@ } if ( p ) - result = FT_NEXT_SHORT( p ); + result = FT_NEXT_USHORT( p ); } else goto Fail; @@ -522,7 +522,7 @@ Fail: *error = FT_Err_Invalid_Stream_Operation; - FT_ERROR(( "FT_Stream_ReadShort:" + FT_ERROR(( "FT_Stream_ReadUShort:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -530,8 +530,8 @@ } - FT_BASE_DEF( FT_Short ) - FT_Stream_ReadShortLE( FT_Stream stream, + FT_BASE_DEF( FT_UShort ) + FT_Stream_ReadUShortLE( FT_Stream stream, FT_Error* error ) { FT_Byte reads[2]; @@ -558,7 +558,7 @@ } if ( p ) - result = FT_NEXT_SHORT_LE( p ); + result = FT_NEXT_USHORT_LE( p ); } else goto Fail; @@ -569,7 +569,7 @@ Fail: *error = FT_Err_Invalid_Stream_Operation; - FT_ERROR(( "FT_Stream_ReadShortLE:" + FT_ERROR(( "FT_Stream_ReadUShortLE:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -577,8 +577,8 @@ } - FT_BASE_DEF( FT_Long ) - FT_Stream_ReadOffset( FT_Stream stream, + FT_BASE_DEF( FT_ULong ) + FT_Stream_ReadUOffset( FT_Stream stream, FT_Error* error ) { FT_Byte reads[3]; @@ -605,7 +605,7 @@ } if ( p ) - result = FT_NEXT_OFF3( p ); + result = FT_NEXT_UOFF3( p ); } else goto Fail; @@ -616,7 +616,7 @@ Fail: *error = FT_Err_Invalid_Stream_Operation; - FT_ERROR(( "FT_Stream_ReadOffset:" + FT_ERROR(( "FT_Stream_ReadUOffset:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -624,8 +624,8 @@ } - FT_BASE_DEF( FT_Long ) - FT_Stream_ReadLong( FT_Stream stream, + FT_BASE_DEF( FT_ULong ) + FT_Stream_ReadULong( FT_Stream stream, FT_Error* error ) { FT_Byte reads[4]; @@ -652,7 +652,7 @@ } if ( p ) - result = FT_NEXT_LONG( p ); + result = FT_NEXT_ULONG( p ); } else goto Fail; @@ -663,7 +663,7 @@ Fail: *error = FT_Err_Invalid_Stream_Operation; - FT_ERROR(( "FT_Stream_ReadLong:" + FT_ERROR(( "FT_Stream_ReadULong:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); @@ -671,8 +671,8 @@ } - FT_BASE_DEF( FT_Long ) - FT_Stream_ReadLongLE( FT_Stream stream, + FT_BASE_DEF( FT_ULong ) + FT_Stream_ReadULongLE( FT_Stream stream, FT_Error* error ) { FT_Byte reads[4]; @@ -699,7 +699,7 @@ } if ( p ) - result = FT_NEXT_LONG_LE( p ); + result = FT_NEXT_ULONG_LE( p ); } else goto Fail; @@ -710,7 +710,7 @@ Fail: *error = FT_Err_Invalid_Stream_Operation; - FT_ERROR(( "FT_Stream_ReadLongLE:" + FT_ERROR(( "FT_Stream_ReadULongLE:" " invalid i/o; pos = 0x%lx, size = 0x%lx\n", stream->pos, stream->size )); Index: src/base/ftstroke.c =================================================================== --- src/base/ftstroke.c (revision 58178) +++ src/base/ftstroke.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType path stroker (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */ +/* Copyright 2002-2006, 2008-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -34,7 +34,7 @@ return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_RIGHT - : FT_STROKER_BORDER_LEFT ; + : FT_STROKER_BORDER_LEFT; } @@ -47,20 +47,21 @@ return o == FT_ORIENTATION_TRUETYPE ? FT_STROKER_BORDER_LEFT - : FT_STROKER_BORDER_RIGHT ; + : FT_STROKER_BORDER_RIGHT; } - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** BEZIER COMPUTATIONS *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** BEZIER COMPUTATIONS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ #define FT_SMALL_CONIC_THRESHOLD ( FT_ANGLE_PI / 6 ) -#define FT_SMALL_CUBIC_THRESHOLD ( FT_ANGLE_PI / 6 ) +#define FT_SMALL_CUBIC_THRESHOLD ( FT_ANGLE_PI / 8 ) + #define FT_EPSILON 2 #define FT_IS_SMALL( x ) ( (x) > -FT_EPSILON && (x) < FT_EPSILON ) @@ -69,7 +70,7 @@ static FT_Pos ft_pos_abs( FT_Pos x ) { - return x >= 0 ? x : -x ; + return x >= 0 ? x : -x; } @@ -114,19 +115,29 @@ if ( close1 ) { if ( close2 ) - *angle_in = *angle_out = 0; + { + /* basically a point; */ + /* do nothing to retain original direction */ + } else - *angle_in = *angle_out = FT_Atan2( d2.x, d2.y ); + { + *angle_in = + *angle_out = FT_Atan2( d2.x, d2.y ); + } } - else if ( close2 ) + else /* !close1 */ { - *angle_in = *angle_out = FT_Atan2( d1.x, d1.y ); + if ( close2 ) + { + *angle_in = + *angle_out = FT_Atan2( d1.x, d1.y ); + } + else + { + *angle_in = FT_Atan2( d1.x, d1.y ); + *angle_out = FT_Atan2( d2.x, d2.y ); + } } - else - { - *angle_in = FT_Atan2( d1.x, d1.y ); - *angle_out = FT_Atan2( d2.x, d2.y ); - } theta = ft_pos_abs( FT_Angle_Diff( *angle_in, *angle_out ) ); @@ -162,6 +173,17 @@ } + /* Return the average of `angle1' and `angle2'. */ + /* This gives correct result even if `angle1' and `angle2' */ + /* have opposite signs. */ + static FT_Angle + ft_angle_mean( FT_Angle angle1, + FT_Angle angle2 ) + { + return angle1 + FT_Angle_Diff( angle1, angle2 ) / 2; + } + + static FT_Bool ft_cubic_is_small_enough( FT_Vector* base, FT_Angle *angle_in, @@ -184,35 +206,71 @@ close2 = FT_IS_SMALL( d2.x ) && FT_IS_SMALL( d2.y ); close3 = FT_IS_SMALL( d3.x ) && FT_IS_SMALL( d3.y ); - if ( close1 || close3 ) + if ( close1 ) { if ( close2 ) { - /* basically a point */ - *angle_in = *angle_out = *angle_mid = 0; + if ( close3 ) + { + /* basically a point; */ + /* do nothing to retain original direction */ + } + else /* !close3 */ + { + *angle_in = + *angle_mid = + *angle_out = FT_Atan2( d3.x, d3.y ); + } } - else if ( close1 ) + else /* !close2 */ { - *angle_in = *angle_mid = FT_Atan2( d2.x, d2.y ); - *angle_out = FT_Atan2( d3.x, d3.y ); + if ( close3 ) + { + *angle_in = + *angle_mid = + *angle_out = FT_Atan2( d2.x, d2.y ); + } + else /* !close3 */ + { + *angle_in = + *angle_mid = FT_Atan2( d2.x, d2.y ); + *angle_out = FT_Atan2( d3.x, d3.y ); + } } - else /* close2 */ + } + else /* !close1 */ + { + if ( close2 ) { - *angle_in = FT_Atan2( d1.x, d1.y ); - *angle_mid = *angle_out = FT_Atan2( d2.x, d2.y ); + if ( close3 ) + { + *angle_in = + *angle_mid = + *angle_out = FT_Atan2( d1.x, d1.y ); + } + else /* !close3 */ + { + *angle_in = FT_Atan2( d1.x, d1.y ); + *angle_out = FT_Atan2( d3.x, d3.y ); + *angle_mid = ft_angle_mean( *angle_in, *angle_out ); + } } + else /* !close2 */ + { + if ( close3 ) + { + *angle_in = FT_Atan2( d1.x, d1.y ); + *angle_mid = + *angle_out = FT_Atan2( d2.x, d2.y ); + } + else /* !close3 */ + { + *angle_in = FT_Atan2( d1.x, d1.y ); + *angle_mid = FT_Atan2( d2.x, d2.y ); + *angle_out = FT_Atan2( d3.x, d3.y ); + } + } } - else if ( close2 ) - { - *angle_in = *angle_mid = FT_Atan2( d1.x, d1.y ); - *angle_out = FT_Atan2( d3.x, d3.y ); - } - else - { - *angle_in = FT_Atan2( d1.x, d1.y ); - *angle_mid = FT_Atan2( d2.x, d2.y ); - *angle_out = FT_Atan2( d3.x, d3.y ); - } theta1 = ft_pos_abs( FT_Angle_Diff( *angle_in, *angle_mid ) ); theta2 = ft_pos_abs( FT_Angle_Diff( *angle_mid, *angle_out ) ); @@ -222,13 +280,13 @@ } - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** STROKE BORDERS *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** STROKE BORDERS *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ typedef enum FT_StrokeTags_ { @@ -239,7 +297,7 @@ } FT_StrokeTags; -#define FT_STROKE_TAG_BEGIN_END (FT_STROKE_TAG_BEGIN|FT_STROKE_TAG_END) +#define FT_STROKE_TAG_BEGIN_END ( FT_STROKE_TAG_BEGIN | FT_STROKE_TAG_END ) typedef struct FT_StrokeBorderRec_ { @@ -247,7 +305,7 @@ FT_UInt max_points; FT_Vector* points; FT_Byte* tags; - FT_Bool movable; + FT_Bool movable; /* TRUE for ends of lineto borders */ FT_Int start; /* index of current sub-path start point */ FT_Memory memory; FT_Bool valid; @@ -368,6 +426,12 @@ } else { + /* don't add zero-length lineto */ + if ( border->num_points > 0 && + FT_IS_SMALL( border->points[border->num_points - 1].x - to->x ) && + FT_IS_SMALL( border->points[border->num_points - 1].y - to->y ) ) + return error; + /* add one point */ error = ft_stroke_border_grow( border, 1 ); if ( !error ) @@ -403,6 +467,7 @@ FT_Vector* vec = border->points + border->num_points; FT_Byte* tag = border->tags + border->num_points; + vec[0] = *control; vec[1] = *to; @@ -411,7 +476,9 @@ border->num_points += 2; } + border->movable = FALSE; + return error; } @@ -444,7 +511,9 @@ border->num_points += 3; } + border->movable = FALSE; + return error; } @@ -530,7 +599,7 @@ if ( border->start >= 0 ) ft_stroke_border_close( border, FALSE ); - border->start = border->num_points; + border->start = border->num_points; border->movable = FALSE; return ft_stroke_border_lineto( border, to, FALSE ); @@ -673,38 +742,41 @@ } } - outline->n_points = (short)( outline->n_points + border->num_points ); + outline->n_points = (short)( outline->n_points + border->num_points ); FT_ASSERT( FT_Outline_Check( outline ) == 0 ); } - /***************************************************************************/ - /***************************************************************************/ - /***** *****/ - /***** STROKER *****/ - /***** *****/ - /***************************************************************************/ - /***************************************************************************/ + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** STROKER *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ #define FT_SIDE_TO_ROTATE( s ) ( FT_ANGLE_PI2 - (s) * FT_ANGLE_PI ) typedef struct FT_StrokerRec_ { - FT_Angle angle_in; - FT_Angle angle_out; - FT_Vector center; - FT_Bool first_point; - FT_Bool subpath_open; - FT_Angle subpath_angle; - FT_Vector subpath_start; + FT_Angle angle_in; /* direction into curr join */ + FT_Angle angle_out; /* direction out of join */ + FT_Vector center; /* current position */ + FT_Fixed line_length; /* length of last lineto */ + FT_Bool first_point; /* is this the start? */ + FT_Bool subpath_open; /* is the subpath open? */ + FT_Angle subpath_angle; /* subpath start direction */ + FT_Vector subpath_start; /* subpath start position */ + FT_Fixed subpath_line_length; /* subpath start lineto len */ + FT_Bool handle_wide_strokes; /* use wide strokes logic? */ FT_Stroker_LineCap line_cap; FT_Stroker_LineJoin line_join; + FT_Stroker_LineJoin line_join_saved; FT_Fixed miter_limit; FT_Fixed radius; - FT_Bool valid; FT_StrokeBorderRec borders[2]; FT_Library library; @@ -717,9 +789,9 @@ FT_Stroker_New( FT_Library library, FT_Stroker *astroker ) { - FT_Error error; + FT_Error error; /* assigned in FT_NEW */ FT_Memory memory; - FT_Stroker stroker; + FT_Stroker stroker = NULL; if ( !library ) @@ -734,7 +806,9 @@ ft_stroke_border_init( &stroker->borders[0], memory ); ft_stroke_border_init( &stroker->borders[1], memory ); } + *astroker = stroker; + return error; } @@ -753,6 +827,14 @@ stroker->line_join = line_join; stroker->miter_limit = miter_limit; + /* ensure miter limit has sensible value */ + if ( stroker->miter_limit < 0x10000 ) + stroker->miter_limit = 0x10000; + + /* save line join style: */ + /* line join style can be temporarily changed when stroking curves */ + stroker->line_join_saved = line_join; + FT_Stroker_Rewind( stroker ); } @@ -789,7 +871,7 @@ } - /* creates a circular arc at a corner or cap */ + /* create a circular arc at a corner or cap */ static FT_Error ft_stroker_arcto( FT_Stroker stroker, FT_Int side ) @@ -816,7 +898,7 @@ } - /* adds a cap at the end of an opened path */ + /* add a cap at the end of an opened path */ static FT_Error ft_stroker_cap( FT_Stroker stroker, FT_Angle angle, @@ -830,6 +912,7 @@ /* add a round cap */ stroker->angle_in = angle; stroker->angle_out = angle + FT_ANGLE_PI; + error = ft_stroker_arcto( stroker, side ); } else if ( stroker->line_cap == FT_STROKER_LINECAP_SQUARE ) @@ -882,7 +965,7 @@ delta.x += stroker->center.x; delta.y += stroker->center.y; - error = ft_stroke_border_lineto( border, &delta, FALSE ); + error = ft_stroke_border_lineto( border, &delta, FALSE ); } Exit: @@ -893,40 +976,52 @@ /* process an inside corner, i.e. compute intersection */ static FT_Error ft_stroker_inside( FT_Stroker stroker, - FT_Int side) + FT_Int side, + FT_Fixed line_length ) { FT_StrokeBorder border = stroker->borders + side; FT_Angle phi, theta, rotate; - FT_Fixed length, thcos, sigma; + FT_Fixed length, thcos; FT_Vector delta; FT_Error error = FT_Err_Ok; + FT_Bool intersect; /* use intersection of lines? */ rotate = FT_SIDE_TO_ROTATE( side ); - /* compute median angle */ - theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ); - if ( theta == FT_ANGLE_PI ) - theta = rotate; + theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2; + + /* Only intersect borders if between two lineto's and both */ + /* lines are long enough (line_length is zero for curves). */ + if ( !border->movable || line_length == 0 ) + intersect = FALSE; else - theta = theta / 2; + { + /* compute minimum required length of lines */ + FT_Fixed min_length = ft_pos_abs( FT_MulFix( stroker->radius, + FT_Tan( theta ) ) ); - phi = stroker->angle_in + theta; - thcos = FT_Cos( theta ); - sigma = FT_MulFix( stroker->miter_limit, thcos ); + intersect = FT_BOOL( stroker->line_length >= min_length && + line_length >= min_length ); + } - /* TODO: find better criterion to switch off the optimization */ - if ( sigma < 0x10000L ) + if ( !intersect ) { FT_Vector_From_Polar( &delta, stroker->radius, stroker->angle_out + rotate ); delta.x += stroker->center.x; delta.y += stroker->center.y; + border->movable = FALSE; } else { + /* compute median angle */ + phi = stroker->angle_in + theta; + + thcos = FT_Cos( theta ); + length = FT_DivFix( stroker->radius, thcos ); FT_Vector_From_Polar( &delta, length, phi + rotate ); @@ -943,7 +1038,8 @@ /* process an outside corner, i.e. compute bevel/miter/round */ static FT_Error ft_stroker_outside( FT_Stroker stroker, - FT_Int side ) + FT_Int side, + FT_Fixed line_length ) { FT_StrokeBorder border = stroker->borders + side; FT_Error error; @@ -954,79 +1050,118 @@ error = ft_stroker_arcto( stroker, side ); else { - /* this is a mitered or beveled corner */ - FT_Fixed sigma, radius = stroker->radius; - FT_Angle theta, phi; - FT_Fixed thcos; - FT_Bool miter; + /* this is a mitered (pointed) or beveled (truncated) corner */ + FT_Fixed sigma = 0, radius = stroker->radius; + FT_Angle theta = 0, phi = 0; + FT_Fixed thcos = 0; + FT_Bool bevel, fixed_bevel; rotate = FT_SIDE_TO_ROTATE( side ); - miter = FT_BOOL( stroker->line_join == FT_STROKER_LINEJOIN_MITER ); - theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ); - if ( theta == FT_ANGLE_PI ) + bevel = + FT_BOOL( stroker->line_join == FT_STROKER_LINEJOIN_BEVEL ); + + fixed_bevel = + FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_MITER_VARIABLE ); + + if ( !bevel ) { - theta = rotate; - phi = stroker->angle_in; + theta = FT_Angle_Diff( stroker->angle_in, stroker->angle_out ); + + if ( theta == FT_ANGLE_PI ) + { + theta = rotate; + phi = stroker->angle_in; + } + else + { + theta /= 2; + phi = stroker->angle_in + theta + rotate; + } + + thcos = FT_Cos( theta ); + sigma = FT_MulFix( stroker->miter_limit, thcos ); + + /* is miter limit exceeded? */ + if ( sigma < 0x10000L ) + { + /* don't create variable bevels for very small deviations; */ + /* FT_Sin(x) = 0 for x <= 57 */ + if ( fixed_bevel || ft_pos_abs( theta ) > 57 ) + bevel = TRUE; + } } - else + + if ( bevel ) /* this is a bevel (broken angle) */ { - theta = theta / 2; - phi = stroker->angle_in + theta + rotate; - } + if ( fixed_bevel ) + { + /* the outer corners are simply joined together */ + FT_Vector delta; - thcos = FT_Cos( theta ); - sigma = FT_MulFix( stroker->miter_limit, thcos ); - /* FT_Sin(x) = 0 for x <= 57 */ - if ( sigma >= 0x10000L || ft_pos_abs( theta ) <= 57 ) - miter = FALSE; + /* add bevel */ + FT_Vector_From_Polar( &delta, + radius, + stroker->angle_out + rotate ); + delta.x += stroker->center.x; + delta.y += stroker->center.y; - if ( miter ) /* this is a miter (broken angle) */ - { - FT_Vector middle, delta; - FT_Fixed length; + border->movable = FALSE; + error = ft_stroke_border_lineto( border, &delta, FALSE ); + } + else /* variable bevel */ + { + /* the miter is truncated */ + FT_Vector middle, delta; + FT_Fixed length; - /* compute middle point */ - FT_Vector_From_Polar( &middle, - FT_MulFix( radius, stroker->miter_limit ), - phi ); - middle.x += stroker->center.x; - middle.y += stroker->center.y; + /* compute middle point */ + FT_Vector_From_Polar( &middle, + FT_MulFix( radius, stroker->miter_limit ), + phi ); + middle.x += stroker->center.x; + middle.y += stroker->center.y; - /* compute first angle point */ - length = FT_MulFix( radius, - FT_DivFix( 0x10000L - sigma, - ft_pos_abs( FT_Sin( theta ) ) ) ); + /* compute first angle point */ + length = FT_MulDiv( radius, 0x10000L - sigma, + ft_pos_abs( FT_Sin( theta ) ) ); - FT_Vector_From_Polar( &delta, length, phi + rotate ); - delta.x += middle.x; - delta.y += middle.y; + FT_Vector_From_Polar( &delta, length, phi + rotate ); + delta.x += middle.x; + delta.y += middle.y; - error = ft_stroke_border_lineto( border, &delta, FALSE ); - if ( error ) - goto Exit; + error = ft_stroke_border_lineto( border, &delta, FALSE ); + if ( error ) + goto Exit; - /* compute second angle point */ - FT_Vector_From_Polar( &delta, length, phi - rotate ); - delta.x += middle.x; - delta.y += middle.y; + /* compute second angle point */ + FT_Vector_From_Polar( &delta, length, phi - rotate ); + delta.x += middle.x; + delta.y += middle.y; - error = ft_stroke_border_lineto( border, &delta, FALSE ); - if ( error ) - goto Exit; + error = ft_stroke_border_lineto( border, &delta, FALSE ); + if ( error ) + goto Exit; - /* finally, add a movable end point */ - FT_Vector_From_Polar( &delta, radius, stroker->angle_out + rotate ); - delta.x += stroker->center.x; - delta.y += stroker->center.y; + /* finally, add an end point; only needed if not lineto */ + /* (line_length is zero for curves) */ + if ( line_length == 0 ) + { + FT_Vector_From_Polar( &delta, + radius, + stroker->angle_out + rotate ); - error = ft_stroke_border_lineto( border, &delta, TRUE ); + delta.x += stroker->center.x; + delta.y += stroker->center.y; + + error = ft_stroke_border_lineto( border, &delta, FALSE ); + } + } } - - else /* this is a bevel (intersection) */ + else /* this is a miter (intersection) */ { FT_Fixed length; FT_Vector delta; @@ -1042,13 +1177,18 @@ if ( error ) goto Exit; - /* now add end point */ - FT_Vector_From_Polar( &delta, stroker->radius, - stroker->angle_out + rotate ); - delta.x += stroker->center.x; - delta.y += stroker->center.y; + /* now add an end point; only needed if not lineto */ + /* (line_length is zero for curves) */ + if ( line_length == 0 ) + { + FT_Vector_From_Polar( &delta, + stroker->radius, + stroker->angle_out + rotate ); + delta.x += stroker->center.x; + delta.y += stroker->center.y; - error = ft_stroke_border_lineto( border, &delta, TRUE ); + error = ft_stroke_border_lineto( border, &delta, FALSE ); + } } } @@ -1058,7 +1198,8 @@ static FT_Error - ft_stroker_process_corner( FT_Stroker stroker ) + ft_stroker_process_corner( FT_Stroker stroker, + FT_Fixed line_length ) { FT_Error error = FT_Err_Ok; FT_Angle turn; @@ -1079,12 +1220,12 @@ inside_side = 1; /* process the inside side */ - error = ft_stroker_inside( stroker, inside_side ); + error = ft_stroker_inside( stroker, inside_side, line_length ); if ( error ) goto Exit; /* process the outside side */ - error = ft_stroker_outside( stroker, 1 - inside_side ); + error = ft_stroker_outside( stroker, 1 - inside_side, line_length ); Exit: return error; @@ -1095,7 +1236,8 @@ /* start of the subpath */ static FT_Error ft_stroker_subpath_start( FT_Stroker stroker, - FT_Angle start_angle ) + FT_Angle start_angle, + FT_Fixed line_length ) { FT_Vector delta; FT_Vector point; @@ -1120,9 +1262,11 @@ border++; error = ft_stroke_border_moveto( border, &point ); - /* save angle for last cap */ - stroker->subpath_angle = start_angle; - stroker->first_point = FALSE; + /* save angle, position, and line length for last join */ + /* (line_length is zero for curves) */ + stroker->subpath_angle = start_angle; + stroker->first_point = FALSE; + stroker->subpath_line_length = line_length; Exit: return error; @@ -1140,10 +1284,19 @@ FT_Vector delta; FT_Angle angle; FT_Int side; + FT_Fixed line_length; + delta.x = to->x - stroker->center.x; delta.y = to->y - stroker->center.y; + /* a zero-length lineto is a no-op; avoid creating a spurious corner */ + if ( delta.x == 0 && delta.y == 0 ) + goto Exit; + + /* compute length of line */ + line_length = FT_Vector_Length( &delta ); + angle = FT_Atan2( delta.x, delta.y ); FT_Vector_From_Polar( &delta, stroker->radius, angle + FT_ANGLE_PI2 ); @@ -1153,7 +1306,7 @@ /* This is the first segment of a subpath. We need to */ /* add a point to each border at their respective starting */ /* point locations. */ - error = ft_stroker_subpath_start( stroker, angle ); + error = ft_stroker_subpath_start( stroker, angle, line_length ); if ( error ) goto Exit; } @@ -1161,13 +1314,12 @@ { /* process the current corner */ stroker->angle_out = angle; - error = ft_stroker_process_corner( stroker ); + error = ft_stroker_process_corner( stroker, line_length ); if ( error ) goto Exit; } /* now add a line segment to both the `inside' and `outside' paths */ - for ( border = stroker->borders, side = 1; side >= 0; side--, border++ ) { FT_Vector point; @@ -1176,6 +1328,7 @@ point.x = to->x + delta.x; point.y = to->y + delta.y; + /* the ends of lineto borders are movable */ error = ft_stroke_border_lineto( border, &point, TRUE ); if ( error ) goto Exit; @@ -1184,8 +1337,9 @@ delta.y = -delta.y; } - stroker->angle_in = angle; - stroker->center = *to; + stroker->angle_in = angle; + stroker->center = *to; + stroker->line_length = line_length; Exit: return error; @@ -1203,10 +1357,20 @@ FT_Vector bez_stack[34]; FT_Vector* arc; FT_Vector* limit = bez_stack + 30; - FT_Angle start_angle; FT_Bool first_arc = TRUE; + /* if all control points are coincident, this is a no-op; */ + /* avoid creating a spurious corner */ + if ( FT_IS_SMALL( stroker->center.x - control->x ) && + FT_IS_SMALL( stroker->center.y - control->y ) && + FT_IS_SMALL( control->x - to->x ) && + FT_IS_SMALL( control->y - to->y ) ) + { + stroker->center = *to; + goto Exit; + } + arc = bez_stack; arc[0] = *to; arc[1] = *control; @@ -1217,11 +1381,15 @@ FT_Angle angle_in, angle_out; - angle_in = angle_out = 0; /* remove compiler warnings */ + /* initialize with current direction */ + angle_in = angle_out = stroker->angle_in; if ( arc < limit && !ft_conic_is_small_enough( arc, &angle_in, &angle_out ) ) { + if ( stroker->first_point ) + stroker->angle_in = angle_in; + ft_conic_split( arc ); arc += 2; continue; @@ -1231,32 +1399,54 @@ { first_arc = FALSE; - start_angle = angle_in; - /* process corner if necessary */ if ( stroker->first_point ) - error = ft_stroker_subpath_start( stroker, start_angle ); + error = ft_stroker_subpath_start( stroker, angle_in, 0 ); else { - stroker->angle_out = start_angle; - error = ft_stroker_process_corner( stroker ); + stroker->angle_out = angle_in; + error = ft_stroker_process_corner( stroker, 0 ); } } + else if ( ft_pos_abs( FT_Angle_Diff( stroker->angle_in, angle_in ) ) > + FT_SMALL_CONIC_THRESHOLD / 4 ) + { + /* if the deviation from one arc to the next is too great, */ + /* add a round corner */ + stroker->center = arc[2]; + stroker->angle_out = angle_in; + stroker->line_join = FT_STROKER_LINEJOIN_ROUND; + error = ft_stroker_process_corner( stroker, 0 ); + + /* reinstate line join style */ + stroker->line_join = stroker->line_join_saved; + } + + if ( error ) + goto Exit; + /* the arc's angle is small enough; we can add it directly to each */ /* border */ { - FT_Vector ctrl, end; - FT_Angle theta, phi, rotate; - FT_Fixed length; - FT_Int side; + FT_Vector ctrl, end; + FT_Angle theta, phi, rotate, alpha0 = 0; + FT_Fixed length; + FT_StrokeBorder border; + FT_Int side; theta = FT_Angle_Diff( angle_in, angle_out ) / 2; phi = angle_in + theta; length = FT_DivFix( stroker->radius, FT_Cos( theta ) ); - for ( side = 0; side <= 1; side++ ) + /* compute direction of original arc */ + if ( stroker->handle_wide_strokes ) + alpha0 = FT_Atan2( arc[0].x - arc[2].x, arc[0].y - arc[2].y ); + + for ( border = stroker->borders, side = 0; + side <= 1; + side++, border++ ) { rotate = FT_SIDE_TO_ROTATE( side ); @@ -1270,8 +1460,70 @@ end.x += arc[0].x; end.y += arc[0].y; - error = ft_stroke_border_conicto( stroker->borders + side, - &ctrl, &end ); + if ( stroker->handle_wide_strokes ) + { + FT_Vector start; + FT_Angle alpha1; + + + /* determine whether the border radius is greater than the */ + /* radius of curvature of the original arc */ + start = border->points[border->num_points - 1]; + + alpha1 = FT_Atan2( end.x - start.x, end.y - start.y ); + + /* is the direction of the border arc opposite to */ + /* that of the original arc? */ + if ( ft_pos_abs( FT_Angle_Diff( alpha0, alpha1 ) ) > + FT_ANGLE_PI / 2 ) + { + FT_Angle beta, gamma; + FT_Vector bvec, delta; + FT_Fixed blen, sinA, sinB, alen; + + + /* use the sine rule to find the intersection point */ + beta = FT_Atan2( arc[2].x - start.x, arc[2].y - start.y ); + gamma = FT_Atan2( arc[0].x - end.x, arc[0].y - end.y ); + + bvec.x = end.x - start.x; + bvec.y = end.y - start.y; + + blen = FT_Vector_Length( &bvec ); + + sinA = ft_pos_abs( FT_Sin( alpha1 - gamma ) ); + sinB = ft_pos_abs( FT_Sin( beta - gamma ) ); + + alen = FT_MulDiv( blen, sinA, sinB ); + + FT_Vector_From_Polar( &delta, alen, beta ); + delta.x += start.x; + delta.y += start.y; + + /* circumnavigate the negative sector backwards */ + border->movable = FALSE; + error = ft_stroke_border_lineto( border, &delta, FALSE ); + if ( error ) + goto Exit; + error = ft_stroke_border_lineto( border, &end, FALSE ); + if ( error ) + goto Exit; + error = ft_stroke_border_conicto( border, &ctrl, &start ); + if ( error ) + goto Exit; + /* and then move to the endpoint */ + error = ft_stroke_border_lineto( border, &end, FALSE ); + if ( error ) + goto Exit; + + continue; + } + + /* else fall through */ + } + + /* simply add an arc */ + error = ft_stroke_border_conicto( border, &ctrl, &end ); if ( error ) goto Exit; } @@ -1279,8 +1531,7 @@ arc -= 2; - if ( arc < bez_stack ) - stroker->angle_in = angle_out; + stroker->angle_in = angle_out; } stroker->center = *to; @@ -1302,10 +1553,22 @@ FT_Vector bez_stack[37]; FT_Vector* arc; FT_Vector* limit = bez_stack + 32; - FT_Angle start_angle; FT_Bool first_arc = TRUE; + /* if all control points are coincident, this is a no-op; */ + /* avoid creating a spurious corner */ + if ( FT_IS_SMALL( stroker->center.x - control1->x ) && + FT_IS_SMALL( stroker->center.y - control1->y ) && + FT_IS_SMALL( control1->x - control2->x ) && + FT_IS_SMALL( control1->y - control2->y ) && + FT_IS_SMALL( control2->x - to->x ) && + FT_IS_SMALL( control2->y - to->y ) ) + { + stroker->center = *to; + goto Exit; + } + arc = bez_stack; arc[0] = *to; arc[1] = *control2; @@ -1317,13 +1580,16 @@ FT_Angle angle_in, angle_mid, angle_out; - /* remove compiler warnings */ - angle_in = angle_out = angle_mid = 0; + /* initialize with current direction */ + angle_in = angle_out = angle_mid = stroker->angle_in; if ( arc < limit && !ft_cubic_is_small_enough( arc, &angle_in, &angle_mid, &angle_out ) ) { + if ( stroker->first_point ) + stroker->angle_in = angle_in; + ft_cubic_split( arc ); arc += 3; continue; @@ -1334,36 +1600,56 @@ first_arc = FALSE; /* process corner if necessary */ - start_angle = angle_in; - if ( stroker->first_point ) - error = ft_stroker_subpath_start( stroker, start_angle ); + error = ft_stroker_subpath_start( stroker, angle_in, 0 ); else { - stroker->angle_out = start_angle; - error = ft_stroker_process_corner( stroker ); + stroker->angle_out = angle_in; + error = ft_stroker_process_corner( stroker, 0 ); } - if ( error ) - goto Exit; } + else if ( ft_pos_abs( FT_Angle_Diff( stroker->angle_in, angle_in ) ) > + FT_SMALL_CUBIC_THRESHOLD / 4 ) + { + /* if the deviation from one arc to the next is too great, */ + /* add a round corner */ + stroker->center = arc[3]; + stroker->angle_out = angle_in; + stroker->line_join = FT_STROKER_LINEJOIN_ROUND; + error = ft_stroker_process_corner( stroker, 0 ); + + /* reinstate line join style */ + stroker->line_join = stroker->line_join_saved; + } + + if ( error ) + goto Exit; + /* the arc's angle is small enough; we can add it directly to each */ /* border */ { - FT_Vector ctrl1, ctrl2, end; - FT_Angle theta1, phi1, theta2, phi2, rotate; - FT_Fixed length1, length2; - FT_Int side; + FT_Vector ctrl1, ctrl2, end; + FT_Angle theta1, phi1, theta2, phi2, rotate, alpha0 = 0; + FT_Fixed length1, length2; + FT_StrokeBorder border; + FT_Int side; - theta1 = ft_pos_abs( angle_mid - angle_in ) / 2; - theta2 = ft_pos_abs( angle_out - angle_mid ) / 2; - phi1 = (angle_mid + angle_in ) / 2; - phi2 = (angle_mid + angle_out ) / 2; + theta1 = FT_Angle_Diff( angle_in, angle_mid ) / 2; + theta2 = FT_Angle_Diff( angle_mid, angle_out ) / 2; + phi1 = ft_angle_mean( angle_in, angle_mid ); + phi2 = ft_angle_mean( angle_mid, angle_out ); length1 = FT_DivFix( stroker->radius, FT_Cos( theta1 ) ); length2 = FT_DivFix( stroker->radius, FT_Cos( theta2 ) ); - for ( side = 0; side <= 1; side++ ) + /* compute direction of original arc */ + if ( stroker->handle_wide_strokes ) + alpha0 = FT_Atan2( arc[0].x - arc[3].x, arc[0].y - arc[3].y ); + + for ( border = stroker->borders, side = 0; + side <= 1; + side++, border++ ) { rotate = FT_SIDE_TO_ROTATE( side ); @@ -1381,16 +1667,81 @@ end.x += arc[0].x; end.y += arc[0].y; - error = ft_stroke_border_cubicto( stroker->borders + side, - &ctrl1, &ctrl2, &end ); + if ( stroker->handle_wide_strokes ) + { + FT_Vector start; + FT_Angle alpha1; + + + /* determine whether the border radius is greater than the */ + /* radius of curvature of the original arc */ + start = border->points[border->num_points - 1]; + + alpha1 = FT_Atan2( end.x - start.x, end.y - start.y ); + + /* is the direction of the border arc opposite to */ + /* that of the original arc? */ + if ( ft_pos_abs( FT_Angle_Diff( alpha0, alpha1 ) ) > + FT_ANGLE_PI / 2 ) + { + FT_Angle beta, gamma; + FT_Vector bvec, delta; + FT_Fixed blen, sinA, sinB, alen; + + + /* use the sine rule to find the intersection point */ + beta = FT_Atan2( arc[3].x - start.x, arc[3].y - start.y ); + gamma = FT_Atan2( arc[0].x - end.x, arc[0].y - end.y ); + + bvec.x = end.x - start.x; + bvec.y = end.y - start.y; + + blen = FT_Vector_Length( &bvec ); + + sinA = ft_pos_abs( FT_Sin( alpha1 - gamma ) ); + sinB = ft_pos_abs( FT_Sin( beta - gamma ) ); + + alen = FT_MulDiv( blen, sinA, sinB ); + + FT_Vector_From_Polar( &delta, alen, beta ); + delta.x += start.x; + delta.y += start.y; + + /* circumnavigate the negative sector backwards */ + border->movable = FALSE; + error = ft_stroke_border_lineto( border, &delta, FALSE ); + if ( error ) + goto Exit; + error = ft_stroke_border_lineto( border, &end, FALSE ); + if ( error ) + goto Exit; + error = ft_stroke_border_cubicto( border, + &ctrl2, + &ctrl1, + &start ); + if ( error ) + goto Exit; + /* and then move to the endpoint */ + error = ft_stroke_border_lineto( border, &end, FALSE ); + if ( error ) + goto Exit; + + continue; + } + + /* else fall through */ + } + + /* simply add an arc */ + error = ft_stroke_border_cubicto( border, &ctrl1, &ctrl2, &end ); if ( error ) goto Exit; } } arc -= 3; - if ( arc < bez_stack ) - stroker->angle_in = angle_out; + + stroker->angle_in = angle_out; } stroker->center = *to; @@ -1415,9 +1766,21 @@ stroker->center = *to; stroker->subpath_open = open; + /* Determine if we need to check whether the border radius is greater */ + /* than the radius of curvature of a curve, to handle this case */ + /* specially. This is only required if bevel joins or butt caps may */ + /* be created, because round & miter joins and round & square caps */ + /* cover the negative sector created with wide strokes. */ + stroker->handle_wide_strokes = + FT_BOOL( stroker->line_join != FT_STROKER_LINEJOIN_ROUND || + ( stroker->subpath_open && + stroker->line_cap == FT_STROKER_LINECAP_BUTT ) ); + /* record the subpath start point for each border */ stroker->subpath_start = *to; + stroker->angle_in = 0; + return FT_Err_Ok; } @@ -1447,6 +1810,7 @@ FT_Vector* src_point = left->points + left->num_points - 1; FT_Byte* src_tag = left->tags + left->num_points - 1; + while ( src_point >= left->points + left->start ) { *dst_point = *src_point; @@ -1456,14 +1820,14 @@ dst_tag[0] &= ~FT_STROKE_TAG_BEGIN_END; else { - FT_Byte ttag = (FT_Byte)( dst_tag[0] & FT_STROKE_TAG_BEGIN_END ); + FT_Byte ttag = + (FT_Byte)( dst_tag[0] & FT_STROKE_TAG_BEGIN_END ); /* switch begin/end tags if necessary */ if ( ttag == FT_STROKE_TAG_BEGIN || ttag == FT_STROKE_TAG_END ) dst_tag[0] ^= FT_STROKE_TAG_BEGIN_END; - } src_point--; @@ -1498,6 +1862,7 @@ { FT_StrokeBorder right = stroker->borders; + /* All right, this is an opened path, we need to add a cap between */ /* right & left, add the reverse of left, then add a final cap */ /* between left & right. */ @@ -1526,13 +1891,14 @@ FT_Angle turn; FT_Int inside_side; + /* close the path if needed */ if ( stroker->center.x != stroker->subpath_start.x || stroker->center.y != stroker->subpath_start.y ) { - error = FT_Stroker_LineTo( stroker, &stroker->subpath_start ); - if ( error ) - goto Exit; + error = FT_Stroker_LineTo( stroker, &stroker->subpath_start ); + if ( error ) + goto Exit; } /* process the corner */ @@ -1550,19 +1916,23 @@ if ( turn < 0 ) inside_side = 1; - error = ft_stroker_inside( stroker, inside_side ); + error = ft_stroker_inside( stroker, + inside_side, + stroker->subpath_line_length ); if ( error ) goto Exit; /* process the outside side */ - error = ft_stroker_outside( stroker, 1 - inside_side ); + error = ft_stroker_outside( stroker, + 1 - inside_side, + stroker->subpath_line_length ); if ( error ) goto Exit; } /* then end our two subpaths */ - ft_stroke_border_close( stroker->borders + 0, TRUE ); - ft_stroke_border_close( stroker->borders + 1, FALSE ); + ft_stroke_border_close( stroker->borders + 0, FALSE ); + ft_stroke_border_close( stroker->borders + 1, TRUE ); } Exit: @@ -1684,9 +2054,9 @@ FT_Error error; - FT_Int n; /* index of contour in outline */ - FT_UInt first; /* index of first point in contour */ - FT_Int tag; /* current point's state */ + FT_Int n; /* index of contour in outline */ + FT_UInt first; /* index of first point in contour */ + FT_Int tag; /* current point's state */ if ( !outline || !stroker ) @@ -1851,9 +2221,13 @@ if ( error ) goto Exit; - error = FT_Stroker_EndSubPath( stroker ); - if ( error ) - goto Exit; + /* don't try to end the path if no segments have been generated */ + if ( !stroker->first_point ) + { + error = FT_Stroker_EndSubPath( stroker ); + if ( error ) + goto Exit; + } first = last + 1; } @@ -1867,9 +2241,10 @@ return FT_Err_Invalid_Outline; } -/* declare an extern to access ft_outline_glyph_class global allocated - in ftglyph.c, and use the FT_OUTLINE_GLYPH_CLASS_GET macro to access - it when FT_CONFIG_OPTION_PIC is defined */ + + /* declare an extern to access `ft_outline_glyph_class' globally */ + /* allocated in `ftglyph.c', and use the FT_OUTLINE_GLYPH_CLASS_GET */ + /* macro to access it when FT_CONFIG_OPTION_PIC is defined */ #ifndef FT_CONFIG_OPTION_PIC extern const FT_Glyph_Class ft_outline_glyph_class; #endif @@ -1883,11 +2258,13 @@ FT_Stroker stroker, FT_Bool destroy ) { - FT_Error error = FT_Err_Invalid_Argument; - FT_Glyph glyph = NULL; - FT_Library library = stroker->library; - FT_UNUSED(library); + FT_Error error = FT_Err_Invalid_Argument; + FT_Glyph glyph = NULL; + FT_Library library = stroker->library; + FT_UNUSED( library ); + + if ( pglyph == NULL ) goto Exit; @@ -1907,7 +2284,7 @@ } { - FT_OutlineGlyph oglyph = (FT_OutlineGlyph) glyph; + FT_OutlineGlyph oglyph = (FT_OutlineGlyph)glyph; FT_Outline* outline = &oglyph->outline; FT_UInt num_points, num_contours; @@ -1957,11 +2334,13 @@ FT_Bool inside, FT_Bool destroy ) { - FT_Error error = FT_Err_Invalid_Argument; - FT_Glyph glyph = NULL; - FT_Library library = stroker->library; - FT_UNUSED(library); + FT_Error error = FT_Err_Invalid_Argument; + FT_Glyph glyph = NULL; + FT_Library library = stroker->library; + FT_UNUSED( library ); + + if ( pglyph == NULL ) goto Exit; @@ -1981,7 +2360,7 @@ } { - FT_OutlineGlyph oglyph = (FT_OutlineGlyph) glyph; + FT_OutlineGlyph oglyph = (FT_OutlineGlyph)glyph; FT_StrokerBorder border; FT_Outline* outline = &oglyph->outline; FT_UInt num_points, num_contours; Index: src/base/ftsynth.c =================================================================== --- src/base/ftsynth.c (revision 58178) +++ src/base/ftsynth.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType synthesizing code for emboldening and slanting (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2010 by */ +/* Copyright 2000-2006, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,6 +33,7 @@ #undef FT_COMPONENT #define FT_COMPONENT trace_synth + /*************************************************************************/ /*************************************************************************/ /**** ****/ @@ -62,7 +63,7 @@ transform.xx = 0x10000L; transform.yx = 0x00000L; - transform.xy = 0x06000L; + transform.xy = 0x0366AL; transform.yy = 0x10000L; FT_Outline_Transform( outline, &transform ); @@ -72,7 +73,7 @@ /*************************************************************************/ /*************************************************************************/ /**** ****/ - /**** EXPERIMENTAL EMBOLDENING/OUTLINING SUPPORT ****/ + /**** EXPERIMENTAL EMBOLDENING SUPPORT ****/ /**** ****/ /*************************************************************************/ /*************************************************************************/ @@ -101,12 +102,7 @@ if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) { /* ignore error */ - (void)FT_Outline_Embolden( &slot->outline, xstr ); - - /* this is more than enough for most glyphs; if you need accurate */ - /* values, you have to call FT_Outline_Get_CBox */ - xstr = xstr * 2; - ystr = xstr; + (void)FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); } else /* slot->format == FT_GLYPH_FORMAT_BITMAP */ { @@ -143,13 +139,10 @@ if ( slot->advance.y ) slot->advance.y += ystr; - slot->metrics.width += xstr; - slot->metrics.height += ystr; - slot->metrics.horiBearingY += ystr; - slot->metrics.horiAdvance += xstr; - slot->metrics.vertBearingX -= xstr / 2; - slot->metrics.vertBearingY += ystr; - slot->metrics.vertAdvance += ystr; + slot->metrics.width += xstr; + slot->metrics.height += ystr; + slot->metrics.horiAdvance += xstr; + slot->metrics.vertAdvance += ystr; /* XXX: 16-bit overflow case must be excluded before here */ if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) Index: src/base/ftsystem.c =================================================================== --- src/base/ftsystem.c (revision 58178) +++ src/base/ftsystem.c (working copy) @@ -4,7 +4,7 @@ /* */ /* ANSI-specific FreeType low-level system interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2006, 2008, 2009, 2010 by */ +/* Copyright 1996-2002, 2006, 2008-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -137,6 +137,7 @@ /* */ /*************************************************************************/ +#ifndef FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT /*************************************************************************/ /* */ @@ -267,6 +268,7 @@ return FT_Err_Ok; } +#endif /* !FT_CONFIG_OPTION_DISABLE_STREAM_SUPPORT */ #ifdef FT_DEBUG_MEMORY Index: src/base/fttrigon.c =================================================================== --- src/base/fttrigon.c (revision 58178) +++ src/base/fttrigon.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType trigonometric functions (body). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2005 by */ +/* Copyright 2001-2005, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,26 +21,31 @@ #include FT_TRIGONOMETRY_H - /* the following is 0.2715717684432231 * 2^30 */ -#define FT_TRIG_COSCALE 0x11616E8EUL +#ifdef FT_LONG64 + typedef FT_INT64 FT_Int64; +#endif + + /* the Cordic shrink factor 0.607252935008887 * 2^32 */ +#define FT_TRIG_SCALE 0x9B74EDA8UL + + /* the following is 0.607252935008887 * 2^30 */ +#define FT_TRIG_COSCALE 0x26DD3B6AUL + /* 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[24] = + ft_trig_arctan_table[23] = { - 4157273L, 2949120L, 1740967L, 919879L, 466945L, 234379L, 117304L, - 58666L, 29335L, 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L, + 2949120L, 1740967L, 919879L, 466945L, 234379L, 117304L, 58666L, + 29335L, 14668L, 7334L, 3667L, 1833L, 917L, 458L, 229L, 115L, 57L, 29L, 14L, 7L, 4L, 2L, 1L }; - /* the Cordic shrink factor, multiplied by 2^32 */ -#define FT_TRIG_SCALE 1166391785UL /* 0x4585BA38UL */ +#ifdef FT_LONG64 -#ifdef FT_CONFIG_HAS_INT64 - /* multiply a given value by the CORDIC shrink factor */ static FT_Fixed ft_trig_downscale( FT_Fixed val ) @@ -58,7 +63,7 @@ return ( s >= 0 ) ? val : -val; } -#else /* !FT_CONFIG_HAS_INT64 */ +#else /* !FT_LONG64 */ /* multiply a given value by the CORDIC shrink factor */ static FT_Fixed @@ -72,10 +77,10 @@ val = ( val >= 0 ) ? val : -val; v1 = (FT_UInt32)val >> 16; - v2 = (FT_UInt32)(val & 0xFFFFL); + v2 = (FT_UInt32)( val & 0xFFFFL ); - k1 = (FT_UInt32)FT_TRIG_SCALE >> 16; /* constant */ - k2 = (FT_UInt32)(FT_TRIG_SCALE & 0xFFFFL); /* constant */ + k1 = (FT_UInt32)FT_TRIG_SCALE >> 16; /* constant */ + k2 = (FT_UInt32)( FT_TRIG_SCALE & 0xFFFFL ); /* constant */ hi = k1 * v1; lo1 = k1 * v2 + k2 * v1; /* can't overflow */ @@ -93,7 +98,7 @@ return ( s >= 0 ) ? val : -val; } -#endif /* !FT_CONFIG_HAS_INT64 */ +#endif /* !FT_LONG64 */ static FT_Int @@ -209,25 +214,9 @@ theta -= FT_ANGLE_PI; } - /* Initial pseudorotation, with left shift */ arctanptr = ft_trig_arctan_table; - if ( theta < 0 ) - { - xtemp = x + ( y << 1 ); - y = y - ( x << 1 ); - x = xtemp; - theta += *arctanptr++; - } - else - { - xtemp = x - ( y << 1 ); - y = y + ( x << 1 ); - x = xtemp; - theta -= *arctanptr++; - } - - /* Subsequent pseudorotations, with right shifts */ + /* Pseudorotations, with right shifts */ i = 0; do { @@ -255,9 +244,9 @@ static void ft_trig_pseudo_polarize( FT_Vector* vec ) { - FT_Fixed theta; - FT_Fixed yi, i; - FT_Fixed x, y; + FT_Angle theta; + FT_Int i; + FT_Fixed x, y, xtemp; const FT_Fixed *arctanptr; @@ -278,41 +267,23 @@ arctanptr = ft_trig_arctan_table; - if ( y < 0 ) - { - /* Rotate positive */ - yi = y + ( x << 1 ); - x = x - ( y << 1 ); - y = yi; - theta -= *arctanptr++; /* Subtract angle */ - } - else - { - /* Rotate negative */ - yi = y - ( x << 1 ); - x = x + ( y << 1 ); - y = yi; - theta += *arctanptr++; /* Add angle */ - } - + /* Pseudorotations, with right shifts */ i = 0; do { - if ( y < 0 ) + if ( y > 0 ) { - /* Rotate positive */ - yi = y + ( x >> i ); - x = x - ( y >> i ); - y = yi; - theta -= *arctanptr++; + xtemp = x + ( y >> i ); + y = y - ( x >> i ); + x = xtemp; + theta += *arctanptr++; } else { - /* Rotate negative */ - yi = y - ( x >> i ); - x = x + ( y >> i ); - y = yi; - theta += *arctanptr++; + xtemp = x - ( y >> i ); + y = y + ( x >> i ); + x = xtemp; + theta -= *arctanptr++; } } while ( ++i < FT_TRIG_MAX_ITERS ); Index: src/base/fttype1.c =================================================================== --- src/base/fttype1.c (revision 58178) +++ src/base/fttype1.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType utility file for PS names support (body). */ /* */ -/* Copyright 2002, 2003, 2004 by */ +/* Copyright 2002-2004, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -91,4 +91,30 @@ } + /* documentation is in t1tables.h */ + + FT_EXPORT_DEF( FT_Long ) + FT_Get_PS_Font_Value( FT_Face face, + PS_Dict_Keys key, + FT_UInt idx, + void *value, + FT_Long value_len ) + { + FT_Int result = 0; + FT_Service_PsInfo service = NULL; + + + if ( face ) + { + FT_FACE_FIND_SERVICE( face, service, POSTSCRIPT_INFO ); + + if ( service && service->ps_get_font_value ) + result = service->ps_get_font_value( face, key, idx, + value, value_len ); + } + + return result; + } + + /* END */ Index: src/bdf/bdf.h =================================================================== --- src/bdf/bdf.h (revision 58178) +++ src/bdf/bdf.h (working copy) @@ -1,6 +1,6 @@ /* * Copyright 2000 Computing Research Labs, New Mexico State University - * Copyright 2001, 2002, 2003, 2004 Francesco Zappa Nardelli + * Copyright 2001-2004, 2011 Francesco Zappa Nardelli * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -226,8 +226,10 @@ void* internal; /* Internal data for the font. */ - unsigned long nmod[2048]; /* Bitmap indicating modified glyphs. */ - unsigned long umod[2048]; /* Bitmap indicating modified */ + /* The size of the next two arrays must be in sync with the */ + /* size of the `have' array in the `bdf_parse_t' structure. */ + unsigned long nmod[34816]; /* Bitmap indicating modified glyphs. */ + unsigned long umod[34816]; /* Bitmap indicating modified */ /* unencoded glyphs. */ unsigned short modified; /* Boolean indicating font modified. */ unsigned short bpp; /* Bits per pixel. */ Index: src/bdf/bdfdrivr.c =================================================================== --- src/bdf/bdfdrivr.c (revision 58178) +++ src/bdf/bdfdrivr.c (working copy) @@ -2,7 +2,7 @@ FreeType font driver for bdf files - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by + Copyright (C) 2001-2008, 2011 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -30,7 +30,7 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_OBJECTS_H #include FT_BDF_H -#include FT_TRUETYPE_IDS_H +#include FT_TRUETYPE_IDS_H #include FT_SERVICE_BDF_H #include FT_SERVICE_XFREE86_NAME_H @@ -332,8 +332,6 @@ FT_FREE( bdfface->available_sizes ); FT_FREE( face->bdffont ); - - FT_TRACE4(( "BDF_Face_Done: done face\n" )); } @@ -356,6 +354,8 @@ FT_UNUSED( face_index ); + FT_TRACE2(( "BDF driver\n" )); + if ( FT_STREAM_SEEK( 0 ) ) goto Exit; @@ -367,7 +367,7 @@ error = bdf_load_font( stream, memory, &options, &font ); if ( error == BDF_Err_Missing_Startfont_Field ) { - FT_TRACE2(( "[not a valid BDF file]\n" )); + FT_TRACE2(( " not a BDF file\n" )); goto Fail; } else if ( error ) @@ -379,10 +379,10 @@ bdf_property_t* prop = NULL; - FT_TRACE4(( "number of glyphs: %d (%d)\n", + FT_TRACE4(( " number of glyphs: allocated %d (used %d)\n", font->glyphs_size, font->glyphs_used )); - FT_TRACE4(( "number of unencoded glyphs: %d (%d)\n", + FT_TRACE4(( " number of unencoded glyphs: allocated %d (used %d)\n", font->unencoded_size, font->unencoded_used )); @@ -482,7 +482,7 @@ for ( n = 0; n < font->glyphs_size; n++ ) { (face->en_table[n]).enc = cur[n].encoding; - FT_TRACE4(( "idx %d, val 0x%lX\n", n, cur[n].encoding )); + FT_TRACE4(( " idx %d, val 0x%lX\n", n, cur[n].encoding )); (face->en_table[n]).glyph = (FT_Short)n; if ( cur[n].encoding == font->default_char ) @@ -490,7 +490,8 @@ if ( n < FT_UINT_MAX ) face->default_glyph = (FT_UInt)n; else - FT_TRACE1(( "idx %d is too large for this system\n", n )); + FT_TRACE1(( "BDF_Face_Init:" + " idx %d is too large for this system\n", n )); } } } @@ -761,8 +762,8 @@ case BDF_INTEGER: if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) ) { - FT_TRACE1(( "bdf_get_bdf_property: " )); - FT_TRACE1(( "too large integer 0x%x is truncated\n" )); + FT_TRACE1(( "bdf_get_bdf_property:" + " too large integer 0x%x is truncated\n" )); } aproperty->type = BDF_PROPERTY_TYPE_INTEGER; aproperty->u.integer = (FT_Int32)prop->value.l; @@ -771,8 +772,8 @@ case BDF_CARDINAL: if ( prop->value.ul > 0xFFFFFFFFUL ) { - FT_TRACE1(( "bdf_get_bdf_property: " )); - FT_TRACE1(( "too large cardinal 0x%x is truncated\n" )); + FT_TRACE1(( "bdf_get_bdf_property:" + " too large cardinal 0x%x is truncated\n" )); } aproperty->type = BDF_PROPERTY_TYPE_CARDINAL; aproperty->u.cardinal = (FT_UInt32)prop->value.ul; @@ -847,9 +848,9 @@ 0, - (FT_Module_Constructor)0, - (FT_Module_Destructor) 0, - (FT_Module_Requester) bdf_driver_requester + 0, /* FT_Module_Constructor */ + 0, /* FT_Module_Destructor */ + bdf_driver_requester }, sizeof ( BDF_FaceRec ), @@ -869,9 +870,9 @@ #endif BDF_Glyph_Load, - 0, /* FT_Face_GetKerningFunc */ - 0, /* FT_Face_AttachFunc */ - 0, /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ + 0, /* FT_Face_GetAdvancesFunc */ BDF_Size_Request, BDF_Size_Select Index: src/bdf/bdfdrivr.h =================================================================== --- src/bdf/bdfdrivr.h (revision 58178) +++ src/bdf/bdfdrivr.h (working copy) @@ -38,7 +38,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif typedef struct BDF_encoding_el_ Index: src/bdf/bdferror.h =================================================================== --- src/bdf/bdferror.h (revision 58178) +++ src/bdf/bdferror.h (working copy) @@ -1,5 +1,5 @@ /* - * Copyright 2001, 2002 Francesco Zappa Nardelli + * Copyright 2001, 2002, 2012 Francesco Zappa Nardelli * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -33,6 +33,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX BDF_Err_ #define FT_ERR_BASE FT_Mod_Err_BDF Index: src/bdf/bdflib.c =================================================================== --- src/bdf/bdflib.c (revision 58178) +++ src/bdf/bdflib.c (working copy) @@ -1,6 +1,6 @@ /* * Copyright 2000 Computing Research Labs, New Mexico State University - * Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 + * Copyright 2001-2012 * Francesco Zappa Nardelli * * Permission is hereby granted, free of charge, to any person obtaining a @@ -169,6 +169,43 @@ sizeof ( _bdf_properties[0] ); + /* Auto correction messages. */ +#define ACMSG1 "FONT_ASCENT property missing. " \ + "Added `FONT_ASCENT %hd'.\n" +#define ACMSG2 "FONT_DESCENT property missing. " \ + "Added `FONT_DESCENT %hd'.\n" +#define ACMSG3 "Font width != actual width. Old: %hd New: %hd.\n" +#define ACMSG4 "Font left bearing != actual left bearing. " \ + "Old: %hd New: %hd.\n" +#define ACMSG5 "Font ascent != actual ascent. Old: %hd New: %hd.\n" +#define ACMSG6 "Font descent != actual descent. Old: %hd New: %hd.\n" +#define ACMSG7 "Font height != actual height. Old: %hd New: %hd.\n" +#define ACMSG8 "Glyph scalable width (SWIDTH) adjustments made.\n" +#define ACMSG9 "SWIDTH field missing at line %ld. Set automatically.\n" +#define ACMSG10 "DWIDTH field missing at line %ld. Set to glyph width.\n" +#define ACMSG11 "SIZE bits per pixel field adjusted to %hd.\n" +#define ACMSG12 "Duplicate encoding %ld (%s) changed to unencoded.\n" +#define ACMSG13 "Glyph %ld extra rows removed.\n" +#define ACMSG14 "Glyph %ld extra columns removed.\n" +#define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n" +#define ACMSG16 "Glyph %ld missing columns padded with zero bits.\n" + + /* Error messages. */ +#define ERRMSG1 "[line %ld] Missing `%s' line.\n" +#define ERRMSG2 "[line %ld] Font header corrupted or missing fields.\n" +#define ERRMSG3 "[line %ld] Font glyphs corrupted or missing fields.\n" +#define ERRMSG4 "[line %ld] BBX too big.\n" +#define ERRMSG5 "[line %ld] `%s' value too big.\n" +#define ERRMSG6 "[line %ld] Input line too long.\n" +#define ERRMSG7 "[line %ld] Font name too long.\n" +#define ERRMSG8 "[line %ld] Invalid `%s' value.\n" +#define ERRMSG9 "[line %ld] Invalid keyword.\n" + + /* Debug messages. */ +#define DBGMSG1 " [%6ld] %s" /* no \n */ +#define DBGMSG2 " (0x%lX)\n" + + /*************************************************************************/ /* */ /* Hash table utilities for the properties. */ @@ -377,7 +414,8 @@ bdf_font_t* font; bdf_options_t* opts; - unsigned long have[2048]; + unsigned long have[34816]; /* must be in sync with `nmod' and `umod' */ + /* arrays from `bdf_font_t' structure */ _bdf_list_t list; FT_Memory memory; @@ -424,7 +462,7 @@ if ( num_items > list->size ) { unsigned long oldsize = list->size; /* same as _bdf_list_t.size */ - unsigned long newsize = oldsize + ( oldsize >> 1 ) + 4; + unsigned long newsize = oldsize + ( oldsize >> 1 ) + 5; unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) ); FT_Memory memory = list->memory; @@ -507,6 +545,10 @@ } + /* The code below ensures that we have at least 4 + 1 `field' */ + /* elements in `list' (which are possibly NULL) so that we */ + /* don't have to check the number of fields in most cases. */ + static FT_Error _bdf_list_split( _bdf_list_t* list, char* separators, @@ -521,6 +563,14 @@ /* Initialize the list. */ list->used = 0; + if ( list->size ) + { + list->field[0] = (char*)empty; + list->field[1] = (char*)empty; + list->field[2] = (char*)empty; + list->field[3] = (char*)empty; + list->field[4] = (char*)empty; + } /* If the line is empty, then simply return. */ if ( linelen == 0 || line[0] == 0 ) @@ -687,6 +737,7 @@ if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */ { + FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno )); error = BDF_Err_Invalid_Argument; goto Exit; } @@ -719,11 +770,11 @@ /* XXX: Use encoding independent value for 0x1a */ if ( buf[start] != '#' && buf[start] != 0x1a && end > start ) { - error = (*cb)( buf + start, end - start, lineno, + error = (*cb)( buf + start, (unsigned long)( end - start ), lineno, (void*)&cb, client_data ); /* Redo if we have encountered CHARS without properties. */ if ( error == -1 ) - error = (*cb)( buf + start, end - start, lineno, + error = (*cb)( buf + start, (unsigned long)( end - start ), lineno, (void*)&cb, client_data ); if ( error ) break; @@ -791,9 +842,6 @@ }; -#define isdigok( m, d ) (m[(d) >> 3] & ( 1 << ( (d) & 7 ) ) ) - - /* Routine to convert an ASCII string into an unsigned long integer. */ static unsigned long _bdf_atoul( char* s, @@ -831,7 +879,7 @@ s += 2; } - for ( v = 0; isdigok( dmap, *s ); s++ ) + for ( v = 0; sbitset( dmap, *s ); s++ ) v = v * base + a2i[(int)*s]; if ( end != 0 ) @@ -886,7 +934,7 @@ s += 2; } - for ( v = 0; isdigok( dmap, *s ); s++ ) + for ( v = 0; sbitset( dmap, *s ); s++ ) v = v * base + a2i[(int)*s]; if ( end != 0 ) @@ -941,7 +989,7 @@ s += 2; } - for ( v = 0; isdigok( dmap, *s ); s++ ) + for ( v = 0; sbitset( dmap, *s ); s++ ) v = (short)( v * base + a2i[(int)*s] ); if ( end != 0 ) @@ -983,7 +1031,7 @@ FT_Error error = BDF_Err_Ok; - /* First check to see if the property has */ + /* First check whether the property has */ /* already been added or not. If it has, then */ /* simply ignore it. */ if ( hash_lookup( name, &(font->proptbl) ) ) @@ -1079,33 +1127,6 @@ #define _BDF_GLYPH_HEIGHT_CHECK 0x80000000UL - /* Auto correction messages. */ -#define ACMSG1 "FONT_ASCENT property missing. " \ - "Added \"FONT_ASCENT %hd\".\n" -#define ACMSG2 "FONT_DESCENT property missing. " \ - "Added \"FONT_DESCENT %hd\".\n" -#define ACMSG3 "Font width != actual width. Old: %hd New: %hd.\n" -#define ACMSG4 "Font left bearing != actual left bearing. " \ - "Old: %hd New: %hd.\n" -#define ACMSG5 "Font ascent != actual ascent. Old: %hd New: %hd.\n" -#define ACMSG6 "Font descent != actual descent. Old: %hd New: %hd.\n" -#define ACMSG7 "Font height != actual height. Old: %hd New: %hd.\n" -#define ACMSG8 "Glyph scalable width (SWIDTH) adjustments made.\n" -#define ACMSG9 "SWIDTH field missing at line %ld. Set automatically.\n" -#define ACMSG10 "DWIDTH field missing at line %ld. Set to glyph width.\n" -#define ACMSG11 "SIZE bits per pixel field adjusted to %hd.\n" -#define ACMSG12 "Duplicate encoding %ld (%s) changed to unencoded.\n" -#define ACMSG13 "Glyph %ld extra rows removed.\n" -#define ACMSG14 "Glyph %ld extra columns removed.\n" -#define ACMSG15 "Incorrect glyph count: %ld indicated but %ld found.\n" - - /* Error messages. */ -#define ERRMSG1 "[line %ld] Missing \"%s\" line.\n" -#define ERRMSG2 "[line %ld] Font header corrupted or missing fields.\n" -#define ERRMSG3 "[line %ld] Font glyphs corrupted or missing fields.\n" -#define ERRMSG4 "[line %ld] BBX too big.\n" - - static FT_Error _bdf_add_comment( bdf_font_t* font, char* comment, @@ -1137,7 +1158,8 @@ /* default specified in the options. */ static FT_Error _bdf_set_default_spacing( bdf_font_t* font, - bdf_options_t* opts ) + bdf_options_t* opts, + unsigned long lineno ) { size_t len; char name[256]; @@ -1162,6 +1184,7 @@ /* Limit ourselves to 256 characters in the font name. */ if ( len >= 256 ) { + FT_ERROR(( "_bdf_set_default_spacing: " ERRMSG7, lineno )); error = BDF_Err_Invalid_Argument; goto Exit; } @@ -1241,7 +1264,8 @@ ep = line + linelen; /* Trim the leading whitespace if it exists. */ - *sp++ = 0; + if ( *sp ) + *sp++ = 0; while ( *sp && ( *sp == ' ' || *sp == '\t' ) ) sp++; @@ -1265,9 +1289,10 @@ static FT_Error - _bdf_add_property( bdf_font_t* font, - char* name, - char* value ) + _bdf_add_property( bdf_font_t* font, + char* name, + char* value, + unsigned long lineno ) { size_t propid; hashnode hn; @@ -1276,7 +1301,7 @@ FT_Error error = BDF_Err_Ok; - /* First, check to see if the property already exists in the font. */ + /* First, check whether the property already exists in the font. */ if ( ( hn = hash_lookup( name, (hashtable *)font->internal ) ) != 0 ) { /* The property already exists in the font, so simply replace */ @@ -1405,6 +1430,7 @@ { if ( !fp->value.atom ) { + FT_ERROR(( "_bdf_add_property: " ERRMSG8, lineno, "SPACING" )); error = BDF_Err_Invalid_File_Format; goto Exit; } @@ -1493,8 +1519,9 @@ /* Limit ourselves to 1,114,112 glyphs in the font (this is the */ /* number of code points available in Unicode). */ - if ( p->cnt >= 1114112UL ) + if ( p->cnt >= 0x110000UL ) { + FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "CHARS" )); error = BDF_Err_Invalid_Argument; goto Exit; } @@ -1530,8 +1557,8 @@ goto Exit; } - /* Check to see whether a glyph is being scanned but should be */ - /* ignored because it is an unencoded glyph. */ + /* Check whether a glyph is being scanned but should be */ + /* ignored because it is an unencoded glyph. */ if ( ( p->flags & _BDF_GLYPH ) && p->glyph_enc == -1 && p->opts->keep_unencoded == 0 ) @@ -1554,6 +1581,7 @@ if ( !s ) { + FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG8, lineno, "STARTCHAR" )); error = BDF_Err_Invalid_File_Format; goto Exit; } @@ -1565,6 +1593,8 @@ p->flags |= _BDF_GLYPH; + FT_TRACE4(( DBGMSG1, lineno, s )); + goto Exit; } @@ -1585,17 +1615,34 @@ p->glyph_enc = _bdf_atol( p->list.field[1], 0, 10 ); - /* Check that the encoding is in the range [0,65536] because */ - /* otherwise p->have (a bitmap with static size) overflows. */ - if ( (size_t)p->glyph_enc >= sizeof ( p->have ) * 8 ) + /* Normalize negative encoding values. The specification only */ + /* allows -1, but we can be more generous here. */ + if ( p->glyph_enc < -1 ) + p->glyph_enc = -1; + + /* Check for alternative encoding format. */ + if ( p->glyph_enc == -1 && p->list.used > 2 ) + p->glyph_enc = _bdf_atol( p->list.field[2], 0, 10 ); + + if ( p->glyph_enc < -1 ) + p->glyph_enc = -1; + + FT_TRACE4(( DBGMSG2, p->glyph_enc )); + + /* Check that the encoding is in the Unicode range because */ + /* otherwise p->have (a bitmap with static size) overflows. */ + if ( p->glyph_enc > 0 && + (size_t)p->glyph_enc >= sizeof ( p->have ) / + sizeof ( unsigned long ) * 32 ) { + FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "ENCODING" )); error = BDF_Err_Invalid_File_Format; goto Exit; } - /* Check to see whether this encoding has already been encountered. */ - /* If it has then change it to unencoded so it gets added if */ - /* indicated. */ + /* Check whether this encoding has already been encountered. */ + /* If it has then change it to unencoded so it gets added if */ + /* indicated. */ if ( p->glyph_enc >= 0 ) { if ( _bdf_glyph_modified( p->have, p->glyph_enc ) ) @@ -1634,8 +1681,8 @@ } else { - /* Unencoded glyph. Check to see whether it should */ - /* be added or not. */ + /* Unencoded glyph. Check whether it should */ + /* be added or not. */ if ( p->opts->keep_unencoded != 0 ) { /* Allocate the next unencoded glyph. */ @@ -1676,7 +1723,7 @@ else glyph = font->glyphs + ( font->glyphs_used - 1 ); - /* Check to see whether a bitmap is being constructed. */ + /* Check whether a bitmap is being constructed. */ if ( p->flags & _BDF_BITMAP ) { /* If there are more rows than are specified in the glyph metrics, */ @@ -1701,19 +1748,32 @@ for ( i = 0; i < nibbles; i++ ) { c = line[i]; + if ( !sbitset( hdigits, c ) ) + break; *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); if ( i + 1 < nibbles && ( i & 1 ) ) *++bp = 0; } + /* If any line has not enough columns, */ + /* indicate they have been padded with zero bits. */ + if ( i < nibbles && + !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) + { + FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG16, glyph->encoding )); + p->flags |= _BDF_GLYPH_WIDTH_CHECK; + font->modified = 1; + } + /* Remove possible garbage at the right. */ mask_index = ( glyph->bbx.width * p->font->bpp ) & 7; if ( glyph->bbx.width ) *bp &= nibble_mask[mask_index]; /* If any line has extra columns, indicate they have been removed. */ - if ( ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) && - !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) + if ( i == nibbles && + sbitset( hdigits, line[nibbles] ) && + !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) { FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); p->flags |= _BDF_GLYPH_WIDTH_CHECK; @@ -1728,12 +1788,7 @@ if ( ft_memcmp( line, "SWIDTH", 6 ) == 0 ) { if ( !( p->flags & _BDF_ENCODING ) ) - { - /* Missing ENCODING field. */ - FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); - error = BDF_Err_Missing_Encoding_Field; - goto Exit; - } + goto Missing_Encoding; error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) @@ -1748,6 +1803,9 @@ /* Expect the DWIDTH (scalable width) field next. */ if ( ft_memcmp( line, "DWIDTH", 6 ) == 0 ) { + if ( !( p->flags & _BDF_ENCODING ) ) + goto Missing_Encoding; + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; @@ -1773,6 +1831,9 @@ /* Expect the BBX field next. */ if ( ft_memcmp( line, "BBX", 3 ) == 0 ) { + if ( !( p->flags & _BDF_ENCODING ) ) + goto Missing_Encoding; + error = _bdf_list_split( &p->list, (char *)" +", line, linelen ); if ( error ) goto Exit; @@ -1850,10 +1911,10 @@ } /* Allocate enough space for the bitmap. */ - glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3; + glyph->bpr = ( glyph->bbx.width * p->font->bpp + 7 ) >> 3; bitmap_size = glyph->bpr * glyph->bbx.height; - if ( bitmap_size > 0xFFFFU ) + if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno )); error = BDF_Err_Bbx_Too_Big; @@ -1871,8 +1932,15 @@ goto Exit; } + FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG9, lineno )); error = BDF_Err_Invalid_File_Format; + goto Exit; + Missing_Encoding: + /* Missing ENCODING field. */ + FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); + error = BDF_Err_Missing_Encoding_Field; + Exit: if ( error && ( p->flags & _BDF_GLYPH ) ) FT_FREE( p->glyph_name ); @@ -1916,7 +1984,8 @@ { p->font->font_ascent = p->font->bbx.ascent; ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); - error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", nbuf ); + error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", + nbuf, lineno ); if ( error ) goto Exit; @@ -1928,7 +1997,8 @@ { p->font->font_descent = p->font->bbx.descent; ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); - error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", nbuf ); + error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", + nbuf, lineno ); if ( error ) goto Exit; @@ -1954,13 +2024,13 @@ value += 7; if ( *value ) *value++ = 0; - error = _bdf_add_property( p->font, name, value ); + error = _bdf_add_property( p->font, name, value, lineno ); if ( error ) goto Exit; } else if ( _bdf_is_atom( line, linelen, &name, &value, p->font ) ) { - error = _bdf_add_property( p->font, name, value ); + error = _bdf_add_property( p->font, name, value, lineno ); if ( error ) goto Exit; } @@ -1974,7 +2044,7 @@ _bdf_list_shift( &p->list, 1 ); value = _bdf_list_join( &p->list, ' ', &vlen ); - error = _bdf_add_property( p->font, name, value ); + error = _bdf_add_property( p->font, name, value, lineno ); if ( error ) goto Exit; } @@ -2040,7 +2110,8 @@ if ( ft_memcmp( line, "STARTFONT", 9 ) != 0 ) { - /* No STARTFONT field is a good indication of a problem. */ + /* we don't emit an error message since this code gets */ + /* explicitly caught one level higher */ error = BDF_Err_Missing_Startfont_Field; goto Exit; } @@ -2102,7 +2173,10 @@ p->cnt = p->font->props_size = _bdf_atoul( p->list.field[1], 0, 10 ); if ( FT_NEW_ARRAY( p->font->props, p->cnt ) ) + { + p->font->props_size = 0; goto Exit; + } p->flags |= _BDF_PROPS; *next = _bdf_parse_properties; @@ -2153,6 +2227,7 @@ if ( !s ) { + FT_ERROR(( "_bdf_parse_start: " ERRMSG8, lineno, "FONT" )); error = BDF_Err_Invalid_File_Format; goto Exit; } @@ -2166,7 +2241,7 @@ /* If the font name is an XLFD name, set the spacing to the one in */ /* the font name. If there is no spacing fall back on the default. */ - error = _bdf_set_default_spacing( p->font, p->opts ); + error = _bdf_set_default_spacing( p->font, p->opts, lineno ); if ( error ) goto Exit; @@ -2247,14 +2322,16 @@ /* for compiling fonts. */ p->font->font_ascent = p->font->bbx.ascent; ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); - error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", nbuf ); + error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", + nbuf, lineno ); if ( error ) goto Exit; FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent )); p->font->font_descent = p->font->bbx.descent; ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); - error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", nbuf ); + error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", + nbuf, lineno ); if ( error ) goto Exit; FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent )); @@ -2268,6 +2345,7 @@ goto Exit; } + FT_ERROR(( "_bdf_parse_start: " ERRMSG9, lineno )); error = BDF_Err_Invalid_File_Format; Exit: @@ -2380,23 +2458,21 @@ if ( p->flags & _BDF_START ) { + /* The ENDFONT field was never reached or did not exist. */ + if ( !( p->flags & _BDF_GLYPHS ) ) { - /* The ENDFONT field was never reached or did not exist. */ - if ( !( p->flags & _BDF_GLYPHS ) ) - { - /* Error happened while parsing header. */ - FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno )); - error = BDF_Err_Corrupted_Font_Header; - goto Exit; - } - else - { - /* Error happened when parsing glyphs. */ - FT_ERROR(( "bdf_load_font: " ERRMSG3, lineno )); - error = BDF_Err_Corrupted_Font_Glyphs; - goto Exit; - } + /* Error happened while parsing header. */ + FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno )); + error = BDF_Err_Corrupted_Font_Header; + goto Exit; } + else + { + /* Error happened when parsing glyphs. */ + FT_ERROR(( "bdf_load_font: " ERRMSG3, lineno )); + error = BDF_Err_Corrupted_Font_Glyphs; + goto Exit; + } } if ( p->font != 0 ) Index: src/bdf/README =================================================================== --- src/bdf/README (revision 58178) +++ src/bdf/README (working copy) @@ -13,7 +13,7 @@ Adobe Specification V 2.2. The specification of the BDF font format is available from Adobe's web site: - http://partners.adobe.com/asn/developer/PDFS/TN/5005.BDF_Spec.pdf + http://partners.adobe.com/public/developer/en/font/5005.BDF_Spec.pdf Many good bitmap fonts in bdf format come with XFree86 (www.XFree86.org). They do not define vertical metrics, because the X Consortium BDF @@ -119,7 +119,7 @@ *** Portions of the driver (that is, bdflib.c and bdf.h): Copyright 2000 Computing Research Labs, New Mexico State University -Copyright 2001-2002 Francesco Zappa Nardelli +Copyright 2001-2002, 2011 Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), Index: src/cache/ftcbasic.c =================================================================== --- src/cache/ftcbasic.c (revision 58178) +++ src/cache/ftcbasic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType basic cache interface (body). */ /* */ -/* Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 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_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include FT_CACHE_H #include "ftcglyph.h" @@ -237,7 +238,8 @@ FT_CALLBACK_DEF( FT_Bool ) ftc_basic_gnode_compare_faceid( FTC_Node ftcgnode, FT_Pointer ftcface_id, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_GNode gnode = (FTC_GNode)ftcgnode; FTC_FaceID face_id = (FTC_FaceID)ftcface_id; @@ -245,6 +247,8 @@ FT_Bool result; + if ( list_changed ) + *list_changed = FALSE; result = FT_BOOL( family->attrs.scaler.face_id == face_id ); if ( result ) { @@ -463,7 +467,7 @@ } - + #ifdef FT_CONFIG_OPTION_OLD_INTERNALS /* yet another backwards-legacy structure */ @@ -604,7 +608,7 @@ const FTC_SFamilyClassRec ftc_basic_sbit_family_class = { { - sizeof( FTC_BasicFamilyRec ), + sizeof ( FTC_BasicFamilyRec ), ftc_basic_family_compare, ftc_basic_family_init, 0, /* FTC_MruNode_ResetFunc */ Index: src/cache/ftccache.c =================================================================== --- src/cache/ftccache.c (revision 58178) +++ src/cache/ftccache.c (working copy) @@ -4,7 +4,8 @@ /* */ /* The FreeType internal cache interface (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, */ +/* 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,7 +33,7 @@ #define FTC_HASH_MIN_LOAD 1 #define FTC_HASH_SUB_LOAD ( FTC_HASH_MAX_LOAD - FTC_HASH_MIN_LOAD ) -/* this one _must_ be a power of 2! */ + /* this one _must_ be a power of 2! */ #define FTC_HASH_INITIAL_SIZE 8 @@ -83,6 +84,25 @@ (FTC_MruNode)node ); } + + /* get a top bucket for specified hash from cache, + * body for FTC_NODE__TOP_FOR_HASH( cache, hash ) + */ + FT_LOCAL_DEF( FTC_Node* ) + ftc_get_top_node_for_hash( FTC_Cache cache, + FT_PtrDist hash ) + { + FTC_Node* pnode; + FT_UInt idx; + + + idx = (FT_UInt)( hash & cache->mask ); + if ( idx < cache->p ) + idx = (FT_UInt)( hash & ( 2 * cache->mask + 1 ) ); + pnode = cache->buckets + idx; + return pnode; + } + #endif /* !FTC_INLINE */ @@ -96,9 +116,9 @@ for (;;) { FTC_Node node, *pnode; - FT_UFast p = cache->p; - FT_UFast mask = cache->mask; - FT_UFast count = mask + p + 1; /* number of buckets */ + FT_UFast p = cache->p; + FT_UFast mask = cache->mask; + FT_UFast count = mask + p + 1; /* number of buckets */ /* do we need to shrink the buckets array? */ @@ -117,7 +137,8 @@ /* if we can't expand the array, leave immediately */ - if ( FT_RENEW_ARRAY( cache->buckets, (mask+1)*2, (mask+1)*4 ) ) + if ( FT_RENEW_ARRAY( cache->buckets, + ( mask + 1 ) * 2, ( mask + 1 ) * 4 ) ) break; } @@ -191,7 +212,9 @@ cache->slack -= FTC_HASH_MAX_LOAD; cache->p = p; } - else /* the hash table is balanced */ + + /* otherwise, the hash table is balanced */ + else break; } } @@ -202,16 +225,9 @@ ftc_node_hash_unlink( FTC_Node node0, FTC_Cache cache ) { - FTC_Node *pnode; - FT_UInt idx; + FTC_Node *pnode = FTC_NODE__TOP_FOR_HASH( cache, node0->hash ); - idx = (FT_UInt)( node0->hash & cache->mask ); - if ( idx < cache->p ) - idx = (FT_UInt)( node0->hash & ( 2 * cache->mask + 1 ) ); - - pnode = cache->buckets + idx; - for (;;) { FTC_Node node = *pnode; @@ -242,16 +258,9 @@ ftc_node_hash_link( FTC_Node node, FTC_Cache cache ) { - FTC_Node *pnode; - FT_UInt idx; + FTC_Node *pnode = FTC_NODE__TOP_FOR_HASH( cache, node->hash ); - idx = (FT_UInt)( node->hash & cache->mask ); - if ( idx < cache->p ) - idx = (FT_UInt)( node->hash & (2 * cache->mask + 1 ) ); - - pnode = cache->buckets + idx; - node->link = *pnode; *pnode = node; @@ -413,8 +422,8 @@ FT_PtrDist hash, FTC_Node node ) { - node->hash = hash; - node->cache_index = (FT_UInt16) cache->index; + node->hash = hash; + node->cache_index = (FT_UInt16)cache->index; node->ref_count = 0; ftc_node_hash_link( node, cache ); @@ -456,7 +465,7 @@ { error = cache->clazz.node_new( &node, query, cache ); } - FTC_CACHE_TRYLOOP_END(); + FTC_CACHE_TRYLOOP_END( NULL ); if ( error ) node = NULL; @@ -481,11 +490,11 @@ FT_Pointer query, FTC_Node *anode ) { - FT_UFast idx; FTC_Node* bucket; FTC_Node* pnode; FTC_Node node; - FT_Error error = FTC_Err_Ok; + FT_Error error = FTC_Err_Ok; + FT_Bool list_changed = FALSE; FTC_Node_CompareFunc compare = cache->clazz.node_compare; @@ -493,24 +502,43 @@ if ( cache == NULL || anode == NULL ) return FTC_Err_Invalid_Argument; - idx = hash & cache->mask; - if ( idx < cache->p ) - idx = hash & ( cache->mask * 2 + 1 ); + /* Go to the `top' node of the list sharing same masked hash */ + bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash ); - bucket = cache->buckets + idx; - pnode = bucket; + /* Lookup a node with exactly same hash and queried properties. */ + /* NOTE: _nodcomp() may change the linked list to reduce memory. */ for (;;) { node = *pnode; if ( node == NULL ) goto NewNode; - if ( node->hash == hash && compare( node, query, cache ) ) + if ( node->hash == hash && + compare( node, query, cache, &list_changed ) ) break; pnode = &node->link; } + if ( list_changed ) + { + /* Update bucket by modified linked list */ + bucket = pnode = FTC_NODE__TOP_FOR_HASH( cache, hash ); + + /* Update pnode by modified linked list */ + while ( *pnode != node ) + { + if ( *pnode == NULL ) + { + FT_ERROR(( "FTC_Cache_Lookup: oops!!! node missing\n" )); + goto NewNode; + } + else + pnode = &((*pnode)->link); + } + } + + /* Reorder the list to move the found node to the `top' */ if ( node != *bucket ) { *pnode = node->link; @@ -527,6 +555,7 @@ ftc_node_mru_up( node, manager ); } *anode = node; + return error; NewNode: @@ -545,7 +574,7 @@ FTC_Node frees = NULL; - count = cache->p + cache->mask; + count = cache->p + cache->mask + 1; for ( i = 0; i < count; i++ ) { FTC_Node* bucket = cache->buckets + i; @@ -555,12 +584,14 @@ for ( ;; ) { FTC_Node node = *pnode; + FT_Bool list_changed = FALSE; if ( node == NULL ) break; - if ( cache->clazz.node_remove_faceid( node, face_id, cache ) ) + if ( cache->clazz.node_remove_faceid( node, face_id, + cache, &list_changed ) ) { *pnode = node->link; node->link = frees; Index: src/cache/ftccache.h =================================================================== --- src/cache/ftccache.h (revision 58178) +++ src/cache/ftccache.h (working copy) @@ -4,7 +4,8 @@ /* */ /* FreeType internal cache interface (specification). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, */ +/* 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -24,7 +25,7 @@ FT_BEGIN_HEADER -#define _FTC_FACE_ID_HASH( i ) \ +#define _FTC_FACE_ID_HASH( i ) \ ((FT_PtrDist)(( (FT_PtrDist)(i) >> 3 ) ^ ( (FT_PtrDist)(i) << 7 ))) /* handle to cache object */ @@ -72,6 +73,19 @@ #define FTC_NODE__NEXT( x ) FTC_NODE( (x)->mru.next ) #define FTC_NODE__PREV( x ) FTC_NODE( (x)->mru.prev ) +#ifdef FTC_INLINE +#define FTC_NODE__TOP_FOR_HASH( cache, hash ) \ + ( ( cache )->buckets + \ + ( ( ( ( hash ) & ( cache )->mask ) < ( cache )->p ) \ + ? ( ( hash ) & ( ( cache )->mask * 2 + 1 ) ) \ + : ( ( hash ) & ( cache )->mask ) ) ) +#else + FT_LOCAL( FTC_Node* ) + ftc_get_top_node_for_hash( FTC_Cache cache, + FT_PtrDist hash ); +#define FTC_NODE__TOP_FOR_HASH( cache, hash ) \ + ftc_get_top_node_for_hash( ( cache ), ( hash ) ) +#endif #ifdef FT_CONFIG_OPTION_OLD_INTERNALS FT_BASE( void ) @@ -102,7 +116,8 @@ typedef FT_Bool (*FTC_Node_CompareFunc)( FTC_Node node, FT_Pointer key, - FTC_Cache cache ); + FTC_Cache cache, + FT_Bool* list_changed ); typedef void @@ -162,7 +177,7 @@ FT_LOCAL( void ) FTC_Cache_Done( FTC_Cache cache ); - /* Call this function to lookup the cache. If no corresponding + /* Call this function to look up the cache. If no corresponding * node is found, a new one is automatically created. This function * is capable of flushing the cache adequately to make room for the * new cache object. @@ -184,7 +199,7 @@ /* Remove all nodes that relate to a given face_id. This is useful * when un-installing fonts. Note that if a cache node relates to - * the face_id, but is locked (i.e., has `ref_count > 0'), the node + * the face_id but is locked (i.e., has `ref_count > 0'), the node * will _not_ be destroyed, but its internal face_id reference will * be modified. * @@ -205,28 +220,49 @@ FTC_Cache _cache = FTC_CACHE(cache); \ FT_PtrDist _hash = (FT_PtrDist)(hash); \ FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \ - FT_UFast _idx; \ + FT_Bool _list_changed = FALSE; \ \ \ error = FTC_Err_Ok; \ node = NULL; \ - _idx = _hash & _cache->mask; \ - if ( _idx < _cache->p ) \ - _idx = _hash & ( _cache->mask*2 + 1 ); \ \ - _bucket = _pnode = _cache->buckets + _idx; \ + /* Go to the `top' node of the list sharing same masked hash */ \ + _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash ); \ + \ + /* Look up a node with identical hash and queried properties. */ \ + /* NOTE: _nodcomp() may change the linked list to reduce memory. */ \ for (;;) \ { \ _node = *_pnode; \ if ( _node == NULL ) \ goto _NewNode; \ \ - if ( _node->hash == _hash && _nodcomp( _node, query, _cache ) ) \ + if ( _node->hash == _hash && \ + _nodcomp( _node, query, _cache, &_list_changed ) ) \ break; \ \ _pnode = &_node->link; \ } \ \ + if ( _list_changed ) \ + { \ + /* Update _bucket by possibly modified linked list */ \ + _bucket = _pnode = FTC_NODE__TOP_FOR_HASH( _cache, _hash ); \ + \ + /* Update _pnode by possibly modified linked list */ \ + while ( *_pnode != _node ) \ + { \ + if ( *_pnode == NULL ) \ + { \ + FT_ERROR(( "FTC_CACHE_LOOKUP_CMP: oops!!! node missing\n" )); \ + goto _NewNode; \ + } \ + else \ + _pnode = &((*_pnode)->link); \ + } \ + } \ + \ + /* Reorder the list to move the found node to the `top' */ \ if ( _node != *_bucket ) \ { \ *_pnode = _node->link; \ @@ -234,6 +270,7 @@ *_bucket = _node; \ } \ \ + /* Update MRU list */ \ { \ FTC_Manager _manager = _cache->manager; \ void* _nl = &_manager->nodes_list; \ @@ -268,7 +305,7 @@ * loop to flush the cache repeatedly in case of memory overflows. * * It is used when creating a new cache node, or within a lookup - * that needs to allocate data (e.g., the sbit cache lookup). + * that needs to allocate data (e.g. the sbit cache lookup). * * Example: * @@ -290,11 +327,14 @@ FT_UInt _try_done; -#define FTC_CACHE_TRYLOOP_END() \ +#define FTC_CACHE_TRYLOOP_END( list_changed ) \ if ( !error || error != FTC_Err_Out_Of_Memory ) \ break; \ \ _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \ + if ( _try_done > 0 && ( list_changed ) ) \ + *(FT_Bool*)( list_changed ) = TRUE; \ + \ if ( _try_done == 0 ) \ break; \ \ Index: src/cache/ftccback.h =================================================================== --- src/cache/ftccback.h (revision 58178) +++ src/cache/ftccback.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Callback functions of the caching sub-system (specification only). */ /* */ -/* Copyright 2004, 2005, 2006 by */ +/* Copyright 2004, 2005, 2006, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -57,13 +57,15 @@ FT_LOCAL( FT_Bool ) ftc_snode_compare( FTC_Node snode, FT_Pointer gquery, - FTC_Cache cache ); + FTC_Cache cache, + FT_Bool* list_changed ); FT_LOCAL( FT_Bool ) ftc_gnode_compare( FTC_Node gnode, FT_Pointer gquery, - FTC_Cache cache ); + FTC_Cache cache, + FT_Bool* list_changed ); FT_LOCAL( FT_Error ) Index: src/cache/ftccmap.c =================================================================== --- src/cache/ftccmap.c (revision 58178) +++ src/cache/ftccmap.c (working copy) @@ -4,8 +4,7 @@ /* */ /* FreeType CharMap cache (body) */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 2000-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,6 +21,7 @@ #include FT_CACHE_H #include "ftcmanag.h" #include FT_INTERNAL_MEMORY_H +#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_DEBUG_H #include "ftccback.h" @@ -120,7 +120,7 @@ /* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */ /* glyph indices haven't been queried through FT_Get_Glyph_Index() yet */ -#define FTC_CMAP_UNKNOWN ( (FT_UInt16)-1 ) +#define FTC_CMAP_UNKNOWN (FT_UInt16)~0 /*************************************************************************/ @@ -190,13 +190,16 @@ FT_CALLBACK_DEF( FT_Bool ) ftc_cmap_node_compare( FTC_Node ftcnode, FT_Pointer ftcquery, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_CMapNode node = (FTC_CMapNode)ftcnode; FTC_CMapQuery query = (FTC_CMapQuery)ftcquery; FT_UNUSED( cache ); + if ( list_changed ) + *list_changed = FALSE; if ( node->face_id == query->face_id && node->cmap_index == query->cmap_index ) { @@ -213,12 +216,16 @@ FT_CALLBACK_DEF( FT_Bool ) ftc_cmap_node_remove_faceid( FTC_Node ftcnode, FT_Pointer ftcface_id, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_CMapNode node = (FTC_CMapNode)ftcnode; FTC_FaceID face_id = (FTC_FaceID)ftcface_id; FT_UNUSED( cache ); + + if ( list_changed ) + *list_changed = FALSE; return FT_BOOL( node->face_id == face_id ); } @@ -312,7 +319,7 @@ /* * If cmap_index is greater than the maximum number of cachable - * charmaps, we assume the request is from a legacy rogue client + * charmaps, we assume the request is from a legacy rogue client * using old internal header. See include/config/ftoption.h. */ if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change ) Index: src/cache/ftcerror.h =================================================================== --- src/cache/ftcerror.h (revision 58178) +++ src/cache/ftcerror.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Caching sub-system error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX FTC_Err_ #define FT_ERR_BASE FT_Mod_Err_Cache Index: src/cache/ftcglyph.c =================================================================== --- src/cache/ftcglyph.c (revision 58178) +++ src/cache/ftcglyph.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType Glyph Image (FT_Glyph) cache (body). */ /* */ -/* Copyright 2000-2001, 2003, 2004, 2006, 2009 by */ +/* Copyright 2000-2001, 2003, 2004, 2006, 2009, 2011 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_OBJECTS_H #include FT_CACHE_H #include "ftcglyph.h" #include FT_ERRORS_H @@ -64,25 +65,34 @@ FT_LOCAL_DEF( FT_Bool ) ftc_gnode_compare( FTC_Node ftcgnode, FT_Pointer ftcgquery, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_GNode gnode = (FTC_GNode)ftcgnode; FTC_GQuery gquery = (FTC_GQuery)ftcgquery; FT_UNUSED( cache ); + if ( list_changed ) + *list_changed = FALSE; return FT_BOOL( gnode->family == gquery->family && gnode->gindex == gquery->gindex ); } +#ifdef FTC_INLINE + FT_LOCAL_DEF( FT_Bool ) FTC_GNode_Compare( FTC_GNode gnode, - FTC_GQuery gquery ) + FTC_GQuery gquery, + FTC_Cache cache, + FT_Bool* list_changed ) { - return ftc_gnode_compare( FTC_NODE( gnode ), gquery, NULL ); + return ftc_gnode_compare( FTC_NODE( gnode ), gquery, + cache, list_changed ); } +#endif /*************************************************************************/ /*************************************************************************/ Index: src/cache/ftcglyph.h =================================================================== --- src/cache/ftcglyph.h (revision 58178) +++ src/cache/ftcglyph.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType abstract glyph cache (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2004, 2006, 2007 by */ +/* Copyright 2000-2001, 2003, 2004, 2006, 2007, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -180,13 +180,19 @@ FT_UInt gindex, /* glyph index for node */ FTC_Family family ); +#ifdef FTC_INLINE + /* returns TRUE iff the query's glyph index correspond to the node; */ /* this assumes that the `family' and `hash' fields of the query are */ /* already correctly set */ FT_LOCAL( FT_Bool ) FTC_GNode_Compare( FTC_GNode gnode, - FTC_GQuery gquery ); + FTC_GQuery gquery, + FTC_Cache cache, + FT_Bool* list_changed ); +#endif + /* call this function to clear a node's family -- this is necessary */ /* to implement the `node_remove_faceid' cache method correctly */ FT_LOCAL( void ) @@ -307,7 +313,7 @@ FT_BEGIN_STMNT \ \ error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex, \ - FTC_GQUERY( query ), node ); \ + FTC_GQUERY( query ), &node ); \ \ FT_END_STMNT Index: src/cache/ftcmanag.c =================================================================== --- src/cache/ftcmanag.c (revision 58178) +++ src/cache/ftcmanag.c (working copy) @@ -28,7 +28,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "cache system does not support PIC yet" -#endif +#endif #undef FT_COMPONENT Index: src/cache/ftcmanag.h =================================================================== --- src/cache/ftcmanag.h (revision 58178) +++ src/cache/ftcmanag.h (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType Cache Manager (specification). */ /* */ -/* Copyright 2000-2001, 2003, 2004, 2006 by */ +/* Copyright 2000-2001, 2003, 2004, 2006, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ Index: src/cache/ftcmru.c =================================================================== --- src/cache/ftcmru.c (revision 58178) +++ src/cache/ftcmru.c (working copy) @@ -161,7 +161,7 @@ *plist = NULL; } else if ( node == first ) - *plist = next; + *plist = next; } @@ -238,7 +238,7 @@ FTC_MruNode *anode ) { FT_Error error; - FTC_MruNode node; + FTC_MruNode node = NULL; FT_Memory memory = list->memory; @@ -264,14 +264,14 @@ list->clazz.node_done( node, list->data ); } else if ( FT_ALLOC( node, list->clazz.node_size ) ) - goto Exit; + goto Exit; error = list->clazz.node_init( node, key, list->data ); if ( error ) goto Fail; - FTC_MruNode_Prepend( &list->nodes, node ); - list->num_nodes++; + FTC_MruNode_Prepend( &list->nodes, node ); + list->num_nodes++; Exit: *anode = node; @@ -316,7 +316,7 @@ if ( list->clazz.node_done ) - list->clazz.node_done( node, list->data ); + list->clazz.node_done( node, list->data ); FT_FREE( node ); } Index: src/cache/ftcsbits.c =================================================================== --- src/cache/ftcsbits.c (revision 58178) +++ src/cache/ftcsbits.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType sbits manager (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by */ +/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -217,6 +217,7 @@ FTC_SFamilyClass clazz = FTC_CACHE__SFAMILY_CLASS( cache ); FT_UInt total; + FT_UInt node_count; total = clazz->family_get_count( family, cache->manager ); @@ -239,6 +240,10 @@ FTC_GNode_Init( FTC_GNODE( snode ), start, family ); snode->count = count; + for ( node_count = 0; node_count < count; node_count++ ) + { + snode->sbits[node_count].width = 255; + } error = ftc_snode_load( snode, cache->manager, @@ -319,7 +324,8 @@ FT_LOCAL_DEF( FT_Bool ) ftc_snode_compare( FTC_Node ftcsnode, FT_Pointer ftcgquery, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { FTC_SNode snode = (FTC_SNode)ftcsnode; FTC_GQuery gquery = (FTC_GQuery)ftcgquery; @@ -328,6 +334,8 @@ FT_Bool result; + if (list_changed) + *list_changed = FALSE; result = FT_BOOL( gnode->family == gquery->family && (FT_UInt)( gindex - gnode->gindex ) < snode->count ); if ( result ) @@ -368,7 +376,7 @@ * */ - if ( sbit->buffer == NULL && sbit->width != 255 ) + if ( sbit->buffer == NULL && sbit->width == 255 ) { FT_ULong size; FT_Error error; @@ -381,7 +389,7 @@ { error = ftc_snode_load( snode, cache->manager, gindex, &size ); } - FTC_CACHE_TRYLOOP_END(); + FTC_CACHE_TRYLOOP_END( list_changed ); ftcsnode->ref_count--; /* unlock the node */ @@ -396,13 +404,18 @@ } +#ifdef FTC_INLINE + FT_LOCAL_DEF( FT_Bool ) FTC_SNode_Compare( FTC_SNode snode, FTC_GQuery gquery, - FTC_Cache cache ) + FTC_Cache cache, + FT_Bool* list_changed ) { - return ftc_snode_compare( FTC_NODE( snode ), gquery, cache ); + return ftc_snode_compare( FTC_NODE( snode ), gquery, + cache, list_changed ); } +#endif /* END */ Index: src/cache/ftcsbits.h =================================================================== --- src/cache/ftcsbits.h (revision 58178) +++ src/cache/ftcsbits.h (working copy) @@ -4,7 +4,7 @@ /* */ /* A small-bitmap cache (specification). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2006 by */ +/* Copyright 2000-2001, 2002, 2003, 2006, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -83,11 +83,16 @@ #endif +#ifdef FTC_INLINE + FT_LOCAL( FT_Bool ) FTC_SNode_Compare( FTC_SNode snode, FTC_GQuery gquery, - FTC_Cache cache ); + FTC_Cache cache, + FT_Bool* list_changed); +#endif + /* */ FT_END_HEADER Index: src/cff/cffdrivr.c =================================================================== --- src/cff/cffdrivr.c (revision 58178) +++ src/cff/cffdrivr.c (working copy) @@ -4,8 +4,7 @@ /* */ /* OpenType font driver implementation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -126,7 +125,7 @@ /*************************************************************************/ /* */ /* <Function> */ - /* Load_Glyph */ + /* cff_glyph_load */ /* */ /* <Description> */ /* A driver method used to load a glyph within a given glyph slot. */ @@ -150,10 +149,10 @@ /* FreeType error code. 0 means success. */ /* */ FT_CALLBACK_DEF( FT_Error ) - Load_Glyph( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ - FT_Size cffsize, /* CFF_Size */ - FT_UInt glyph_index, - FT_Int32 load_flags ) + cff_glyph_load( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ + FT_Size cffsize, /* CFF_Size */ + FT_UInt glyph_index, + FT_Int32 load_flags ) { FT_Error error; CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; @@ -204,7 +203,7 @@ for ( nn = 0; nn < count; nn++ ) { - error = Load_Glyph( slot, face->size, start + nn, flags ); + error = cff_glyph_load( slot, face->size, start + nn, flags ); if ( error ) break; @@ -240,7 +239,7 @@ " cannot get glyph name from CFF & CEF fonts\n" " " " without the `PSNames' module\n" )); - error = CFF_Err_Unknown_File_Format; + error = CFF_Err_Missing_Module; goto Exit; } @@ -328,7 +327,7 @@ if ( cff && cff->font_info == NULL ) { CFF_FontRecDict dict = &cff->top_font.font_dict; - PS_FontInfoRec *font_info; + PS_FontInfoRec *font_info = NULL; FT_Memory memory = face->root.memory; @@ -365,7 +364,8 @@ (PS_GetFontInfoFunc) cff_ps_get_font_info, (PS_GetFontExtraFunc) NULL, (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, - (PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */ + (PS_GetFontPrivateFunc)NULL, /* unsupported with CFF fonts */ + (PS_GetFontValueFunc) NULL /* not implemented */ ) @@ -412,8 +412,8 @@ cmap_info->language = 0; cmap_info->format = 0; - if ( cmap->clazz != &FT_CFF_CMAP_ENCODING_CLASS_REC_GET && - cmap->clazz != &FT_CFF_CMAP_UNICODE_CLASS_REC_GET ) + if ( cmap->clazz != &CFF_CMAP_ENCODING_CLASS_REC_GET && + cmap->clazz != &CFF_CMAP_UNICODE_CLASS_REC_GET ) { FT_Module sfnt = FT_Get_Module( library, "sfnt" ); FT_Service_TTCMaps service = @@ -466,7 +466,7 @@ dict->cid_registry ); *registry = cff->registry; } - + if ( ordering ) { if ( cff->ordering == NULL ) @@ -489,7 +489,7 @@ *supplement = (FT_Int)dict->cid_supplement; } } - + Fail: return error; } @@ -579,19 +579,19 @@ #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES FT_DEFINE_SERVICEDESCREC6(cff_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF, - FT_SERVICE_ID_POSTSCRIPT_INFO, &FT_CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &FT_CFF_SERVICE_GLYPH_DICT_GET, - FT_SERVICE_ID_TT_CMAP, &FT_CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &FT_CFF_SERVICE_CID_INFO_GET + 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 ) #else FT_DEFINE_SERVICEDESCREC5(cff_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF, - FT_SERVICE_ID_POSTSCRIPT_INFO, &FT_CFF_SERVICE_PS_INFO_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &FT_CFF_SERVICE_GET_CMAP_INFO_GET, - FT_SERVICE_ID_CID, &FT_CFF_SERVICE_CID_INFO_GET + 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 ) #endif @@ -599,19 +599,35 @@ cff_get_interface( FT_Module driver, /* CFF_Driver */ const char* module_interface ) { + FT_Library library; FT_Module sfnt; FT_Module_Interface result; - result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface ); + /* CFF_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + if ( !driver ) + return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif + + result = ft_service_list_lookup( CFF_SERVICES_GET, module_interface ); if ( result != NULL ) - return result; + return result; + /* `driver' is not yet evaluated in non-PIC mode */ +#ifndef FT_CONFIG_OPTION_PIC if ( !driver ) return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif /* we pass our request to the `sfnt' module */ - sfnt = FT_Get_Module( driver->library, "sfnt" ); + sfnt = FT_Get_Module( library, "sfnt" ); return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0; } @@ -625,12 +641,13 @@ #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 | FT_MODULE_DRIVER_HAS_HINTER, - sizeof( CFF_DriverRec ), + sizeof ( CFF_DriverRec ), "cff", 0x10000L, 0x20000L, @@ -642,9 +659,9 @@ cff_get_interface, /* now the specific driver fields */ - sizeof( TT_FaceRec ), - sizeof( CFF_SizeRec ), - sizeof( CFF_GlyphSlotRec ), + sizeof ( TT_FaceRec ), + sizeof ( CFF_SizeRec ), + sizeof ( CFF_GlyphSlotRec ), cff_face_init, cff_face_done, @@ -653,14 +670,14 @@ cff_slot_init, cff_slot_done, - ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ + ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - Load_Glyph, + cff_glyph_load, cff_get_kerning, - 0, /* FT_Face_AttachFunc */ - cff_get_advances, /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Face_AttachFunc */ + cff_get_advances, cff_size_request, Index: src/cff/cfferrs.h =================================================================== --- src/cff/cfferrs.h (revision 58178) +++ src/cff/cfferrs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* CFF error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX CFF_Err_ #define FT_ERR_BASE FT_Mod_Err_CFF Index: src/cff/cffgload.c =================================================================== --- src/cff/cffgload.c (revision 58178) +++ src/cff/cffgload.c (working copy) @@ -4,8 +4,7 @@ /* */ /* OpenType Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -1159,8 +1158,8 @@ op = cff_op_flex1; break; default: - /* decrement ip for syntax error message */ - ip--; + FT_TRACE4(( " unknown op (12, %d)\n", v )); + break; } } break; @@ -1213,11 +1212,12 @@ op = cff_op_hvcurveto; break; default: + FT_TRACE4(( " unknown op (%d)\n", v )); break; } if ( op == cff_op_unknown ) - goto Syntax_Error; + continue; /* check arguments */ req_args = cff_argument_counts[op]; @@ -1438,9 +1438,14 @@ FT_TRACE4(( op == cff_op_hlineto ? " hlineto\n" : " vlineto\n" )); - if ( num_args < 1 ) + if ( num_args < 0 ) goto Stack_Underflow; + /* there exist subsetted fonts (found in PDFs) */ + /* which call `hlineto' without arguments */ + if ( num_args == 0 ) + break; + if ( cff_builder_start_point ( builder, x, y ) || check_points( builder, num_args ) ) goto Fail; @@ -1508,11 +1513,9 @@ goto Stack_Underflow; /* if num_args isn't of the form 4n or 4n+1, */ - /* we reduce it to 4n+1 */ + /* we enforce it by clearing the second bit */ - nargs = num_args - num_args % 4; - if ( num_args - nargs > 0 ) - nargs += 1; + nargs = num_args & ~2; if ( cff_builder_start_point( builder, x, y ) ) goto Fail; @@ -1555,11 +1558,9 @@ goto Stack_Underflow; /* if num_args isn't of the form 4n or 4n+1, */ - /* we reduce it to 4n+1 */ + /* we enforce it by clearing the second bit */ - nargs = num_args - num_args % 4; - if ( num_args - nargs > 0 ) - nargs += 1; + nargs = num_args & ~2; if ( cff_builder_start_point( builder, x, y ) ) goto Fail; @@ -1607,11 +1608,9 @@ goto Stack_Underflow; /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ - /* we reduce it to the largest one which fits */ + /* we enforce it by clearing the second bit */ - nargs = num_args - num_args % 4; - if ( num_args - nargs > 0 ) - nargs += 1; + nargs = num_args & ~2; args -= nargs; if ( check_points( builder, ( nargs / 4 ) * 3 ) ) @@ -1958,6 +1957,7 @@ /* Save glyph width so that the subglyphs don't overwrite it. */ FT_Pos glyph_width = decoder->glyph_width; + error = cff_operator_seac( decoder, 0L, args[-4], args[-3], (FT_Int)( args[-2] >> 16 ), @@ -2700,8 +2700,8 @@ FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); - if ( fd_index >= cff->num_subfonts ) - fd_index = cff->num_subfonts - 1; + if ( fd_index >= cff->num_subfonts ) + fd_index = (FT_Byte)( cff->num_subfonts - 1 ); top_upm = cff->top_font.font_dict.units_per_em; sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em; @@ -2956,7 +2956,7 @@ if ( has_vertical_info ) metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2; - else + else { if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) ft_synthesize_vertical_metrics( metrics, Index: src/cff/cffload.c =================================================================== --- src/cff/cffload.c (revision 58178) +++ src/cff/cffload.c (working copy) @@ -4,8 +4,7 @@ /* */ /* OpenType and CFF data/program tables loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -387,7 +386,7 @@ { FT_Error error = CFF_Err_Ok; FT_Memory memory = idx->stream->memory; - FT_Byte** t; + FT_Byte** t = NULL; FT_Byte* new_bytes = NULL; @@ -1337,7 +1336,10 @@ error = cff_index_access_element( idx, font_index, &dict, &dict_len ); if ( !error ) + { + FT_TRACE4(( " top dictionary:\n" )); error = cff_parser_run( &parser, dict, dict + dict_len ); + } cff_index_forget_element( idx, &dict ); @@ -1366,6 +1368,7 @@ FT_FRAME_ENTER( font->font_dict.private_size ) ) goto Exit; + FT_TRACE4(( " private dictionary:\n" )); error = cff_parser_run( &parser, (FT_Byte*)stream->cursor, (FT_Byte*)stream->limit ); @@ -1436,6 +1439,7 @@ FT_ULong base_offset; CFF_FontRecDict dict; CFF_IndexRec string_index; + FT_Int subfont_index; FT_ZERO( font ); @@ -1455,7 +1459,7 @@ font->header_size < 4 || font->absolute_offsize > 4 ) { - FT_TRACE2(( "[not a CFF font header]\n" )); + FT_TRACE2(( " not a CFF font header\n" )); error = CFF_Err_Unknown_File_Format; goto Exit; } @@ -1480,23 +1484,46 @@ font->num_strings = string_index.count; - /* well, we don't really forget the `disabled' fonts... */ - font->num_faces = font->name_index.count; - if ( face_index >= (FT_Int)font->num_faces ) + if ( pure_cff ) { - FT_ERROR(( "cff_font_load: incorrect face index = %d\n", - face_index )); - error = CFF_Err_Invalid_Argument; + /* well, we don't really forget the `disabled' fonts... */ + subfont_index = face_index; + + if ( subfont_index >= (FT_Int)font->name_index.count ) + { + FT_ERROR(( "cff_font_load:" + " invalid subfont index for pure CFF font (%d)\n", + subfont_index )); + error = CFF_Err_Invalid_Argument; + goto Exit; + } + + font->num_faces = font->name_index.count; } + else + { + subfont_index = 0; + if ( font->name_index.count > 1 ) + { + FT_ERROR(( "cff_font_load:" + " invalid CFF font with multiple subfonts\n" + " " + " in SFNT wrapper\n" )); + error = CFF_Err_Invalid_File_Format; + goto Exit; + } + } + /* in case of a font format check, simply exit now */ if ( face_index < 0 ) goto Exit; /* now, parse the top-level font dictionary */ + FT_TRACE4(( "parsing top-level\n" )); error = cff_subfont_load( &font->top_font, &font->font_dict_index, - face_index, + subfont_index, stream, base_offset, library ); @@ -1514,7 +1541,7 @@ if ( dict->cid_registry != 0xFFFFU ) { CFF_IndexRec fd_index; - CFF_SubFont sub; + CFF_SubFont sub = NULL; FT_UInt idx; @@ -1546,6 +1573,7 @@ for ( idx = 0; idx < fd_index.count; idx++ ) { sub = font->subfonts[idx]; + FT_TRACE4(( "parsing subfont %u\n", idx )); error = cff_subfont_load( sub, &fd_index, idx, stream, base_offset, library ); if ( error ) @@ -1571,7 +1599,7 @@ if ( dict->charstrings_offset == 0 ) { FT_ERROR(( "cff_font_load: no charstrings offset\n" )); - error = CFF_Err_Unknown_File_Format; + error = CFF_Err_Invalid_File_Format; goto Exit; } @@ -1610,7 +1638,7 @@ /* get the font name (/CIDFontName for CID-keyed fonts, */ /* /FontName otherwise) */ - font->font_name = cff_index_get_name( font, face_index ); + font->font_name = cff_index_get_name( font, subfont_index ); Exit: cff_index_done( &string_index ); Index: src/cff/cffload.h =================================================================== --- src/cff/cffload.h (revision 58178) +++ src/cff/cffload.h (working copy) @@ -60,7 +60,7 @@ FT_LOCAL( FT_Error ) - cff_font_load( FT_Library library, + cff_font_load( FT_Library library, FT_Stream stream, FT_Int face_index, CFF_Font font, Index: src/cff/cffobjs.c =================================================================== --- src/cff/cffobjs.c (revision 58178) +++ src/cff/cffobjs.c (working copy) @@ -4,8 +4,7 @@ /* */ /* OpenType objects manager (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -162,7 +161,7 @@ { CFF_Face face = (CFF_Face)cffsize->face; CFF_Font font = (CFF_Font)face->extra.data; - CFF_Internal internal; + CFF_Internal internal = NULL; PS_PrivateRec priv; FT_Memory memory = cffsize->face->memory; @@ -404,8 +403,8 @@ FT_Int32 idx = 0; FT_Int32 length = strlen( name ) + 1; FT_Bool continue_search = 1; - + while ( continue_search ) { if ( length >= 7 && name[6] == '+' ) @@ -421,6 +420,7 @@ { for ( idx = 7; idx < length; idx++ ) name[idx - 7] = name[idx]; + length -= 7; } } else @@ -429,6 +429,51 @@ } + /* Remove the style part from the family name (if present). */ + + static void + remove_style( FT_String* family_name, + const FT_String* style_name ) + { + FT_Int32 family_name_length, style_name_length; + + + family_name_length = strlen( family_name ); + style_name_length = strlen( style_name ); + + if ( family_name_length > style_name_length ) + { + FT_Int idx; + + + for ( idx = 1; idx <= style_name_length; ++idx ) + { + if ( family_name[family_name_length - idx] != + style_name[style_name_length - idx] ) + break; + } + + if ( idx > style_name_length ) + { + /* family_name ends with style_name; remove it */ + idx = family_name_length - style_name_length - 1; + + /* also remove special characters */ + /* between real family name and style */ + while ( idx > 0 && + ( family_name[idx] == '-' || + family_name[idx] == ' ' || + family_name[idx] == '_' || + family_name[idx] == '+' ) ) + --idx; + + if ( idx > 0 ) + family_name[idx + 1] = '\0'; + } + } + } + + FT_LOCAL_DEF( FT_Error ) cff_face_init( FT_Stream stream, FT_Face cffface, /* CFF_Face */ @@ -436,26 +481,32 @@ FT_Int num_params, FT_Parameter* params ) { - CFF_Face face = (CFF_Face)cffface; + CFF_Face face = (CFF_Face)cffface; FT_Error error; SFNT_Service sfnt; FT_Service_PsCMaps psnames; PSHinter_Service pshinter; FT_Bool pure_cff = 1; FT_Bool sfnt_format = 0; - FT_Library library = cffface->driver->root.library; + FT_Library library = cffface->driver->root.library; sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) - goto Bad_Format; + { + FT_ERROR(( "cff_face_init: cannot access `sfnt' module\n" )); + error = CFF_Err_Missing_Module; + goto Exit; + } FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); pshinter = (PSHinter_Service)FT_Get_Module_Interface( library, "pshinter" ); + FT_TRACE2(( "CFF driver\n" )); + /* create input stream from resource */ if ( FT_STREAM_SEEK( 0 ) ) goto Exit; @@ -466,22 +517,15 @@ { if ( face->format_tag != TTAG_OTTO ) /* `OTTO'; OpenType/CFF font */ { - FT_TRACE2(( "[not a valid OpenType/CFF font]\n" )); - goto Bad_Format; + FT_TRACE2(( " not an OpenType/CFF font\n" )); + error = CFF_Err_Unknown_File_Format; + goto Exit; } /* if we are performing a simple font format check, exit immediately */ if ( face_index < 0 ) return CFF_Err_Ok; - /* UNDOCUMENTED! A CFF in an SFNT can have only a single font. */ - if ( face_index > 0 ) - { - FT_ERROR(( "cff_face_init: invalid face index\n" )); - error = CFF_Err_Invalid_Argument; - goto Exit; - } - sfnt_format = 1; /* now, the font can be either an OpenType/CFF font, or an SVG CEF */ @@ -492,7 +536,8 @@ pure_cff = 0; /* load font directory */ - error = sfnt->load_face( stream, face, 0, num_params, params ); + error = sfnt->load_face( stream, face, face_index, + num_params, params ); if ( error ) goto Exit; } @@ -502,10 +547,6 @@ error = sfnt->load_cmap( face, stream ); if ( error ) goto Exit; - - /* XXX: we don't load the GPOS table, as OpenType Layout */ - /* support will be added later to a layout library on top of */ - /* FreeType 2 */ } /* now load the CFF part of the file */ @@ -523,7 +564,7 @@ /* now load and parse the CFF table in the file */ { - CFF_Font cff; + CFF_Font cff = NULL; CFF_FontRecDict dict; FT_Memory memory = cffface->memory; FT_Int32 flags; @@ -559,10 +600,29 @@ " cannot open CFF & CEF fonts\n" " " " without the `PSNames' module\n" )); - goto Bad_Format; + error = CFF_Err_Missing_Module; + goto Exit; } - if ( !dict->units_per_em ) +#ifdef FT_DEBUG_LEVEL_TRACE + { + FT_UInt idx; + FT_String* s; + + + FT_TRACE4(( "SIDs\n" )); + + /* dump string index, including default strings for convenience */ + for ( idx = 0; idx < cff->num_strings + 390; idx++ ) + { + s = cff_index_get_sid_string( cff, idx ); + if ( s ) + FT_TRACE4((" %5d %s\n", idx, s )); + } + } +#endif /* FT_DEBUG_LEVEL_TRACE */ + + if ( !dict->has_font_matrix ) dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM; /* Normalize the font matrix so that `matrix->xx' is 1; the */ @@ -607,26 +667,32 @@ FT_Fixed temp; - if ( sub->units_per_em ) + if ( sub->has_font_matrix ) { FT_Long scaling; - if ( top->units_per_em > 1 && sub->units_per_em > 1 ) - scaling = FT_MIN( top->units_per_em, sub->units_per_em ); - else - scaling = 1; + /* if we have a top-level matrix, */ + /* concatenate the subfont matrix */ - FT_Matrix_Multiply_Scaled( &top->font_matrix, - &sub->font_matrix, - scaling ); - FT_Vector_Transform_Scaled( &sub->font_offset, - &top->font_matrix, - scaling ); + if ( top->has_font_matrix ) + { + if ( top->units_per_em > 1 && sub->units_per_em > 1 ) + scaling = FT_MIN( top->units_per_em, sub->units_per_em ); + else + scaling = 1; - sub->units_per_em = FT_MulDiv( sub->units_per_em, - top->units_per_em, - scaling ); + FT_Matrix_Multiply_Scaled( &top->font_matrix, + &sub->font_matrix, + scaling ); + FT_Vector_Transform_Scaled( &sub->font_offset, + &top->font_matrix, + scaling ); + + sub->units_per_em = FT_MulDiv( sub->units_per_em, + top->units_per_em, + scaling ); + } } else { @@ -645,16 +711,6 @@ { *upm = FT_DivFix( *upm, temp ); - /* if *upm is larger than 100*1000 we divide by 1000 -- */ - /* this can happen if e.g. there is no top-font FontMatrix */ - /* and the subfont FontMatrix already contains the complete */ - /* scaling for the subfont (see section 5.11 of the PLRM) */ - - /* 100 is a heuristic value */ - - if ( *upm > 100L * 1000L ) - *upm = ( *upm + 500 ) / 1000; - matrix->xx = FT_DivFix( matrix->xx, temp ); matrix->yx = FT_DivFix( matrix->yx, temp ); matrix->xy = FT_DivFix( matrix->xy, temp ); @@ -713,7 +769,7 @@ char* family_name = NULL; - remove_subset_prefix( cffface->family_name ); + remove_subset_prefix( cffface->family_name ); if ( dict->family_name ) { @@ -758,6 +814,9 @@ /* case, the remaining string in `fullp' will be used as */ /* the style name. */ style_name = cff_strcpy( memory, fullp ); + + /* remove the style part from the family name (if present) */ + remove_style( cffface->family_name, style_name ); } break; } @@ -785,22 +844,22 @@ /* */ /* Compute face flags. */ /* */ - flags = (FT_UInt32)( FT_FACE_FLAG_SCALABLE | /* scalable outlines */ - FT_FACE_FLAG_HORIZONTAL | /* horizontal data */ - FT_FACE_FLAG_HINTER ); /* has native hinter */ + flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */ + FT_FACE_FLAG_HORIZONTAL | /* horizontal data */ + FT_FACE_FLAG_HINTER; /* has native hinter */ if ( sfnt_format ) - flags |= (FT_UInt32)FT_FACE_FLAG_SFNT; + flags |= FT_FACE_FLAG_SFNT; /* fixed width font? */ if ( dict->is_fixed_pitch ) - flags |= (FT_UInt32)FT_FACE_FLAG_FIXED_WIDTH; + flags |= FT_FACE_FLAG_FIXED_WIDTH; /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */ #if 0 /* kerning available? */ if ( face->kern_pairs ) - flags |= (FT_UInt32)FT_FACE_FLAG_KERNING; + flags |= FT_FACE_FLAG_KERNING; #endif cffface->face_flags = flags; @@ -898,7 +957,7 @@ nn = (FT_UInt)cffface->num_charmaps; - error = FT_CMap_New( &FT_CFF_CMAP_UNICODE_CLASS_REC_GET, NULL, + error = FT_CMap_New( &CFF_CMAP_UNICODE_CLASS_REC_GET, NULL, &cmaprec, NULL ); if ( error && FT_Err_No_Unicode_Glyph_Name != error ) goto Exit; @@ -930,19 +989,19 @@ { cmaprec.encoding_id = TT_ADOBE_ID_STANDARD; cmaprec.encoding = FT_ENCODING_ADOBE_STANDARD; - clazz = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET; + clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET; } else if ( encoding->offset == 1 ) { cmaprec.encoding_id = TT_ADOBE_ID_EXPERT; cmaprec.encoding = FT_ENCODING_ADOBE_EXPERT; - clazz = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET; + clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET; } else { cmaprec.encoding_id = TT_ADOBE_ID_CUSTOM; cmaprec.encoding = FT_ENCODING_ADOBE_CUSTOM; - clazz = &FT_CFF_CMAP_ENCODING_CLASS_REC_GET; + clazz = &CFF_CMAP_ENCODING_CLASS_REC_GET; } error = FT_CMap_New( clazz, NULL, &cmaprec, NULL ); @@ -952,10 +1011,6 @@ Exit: return error; - - Bad_Format: - error = CFF_Err_Unknown_File_Format; - goto Exit; } Index: src/cff/cffparse.c =================================================================== --- src/cff/cffparse.c (revision 58178) +++ src/cff/cffparse.c (working copy) @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (body) */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010 by */ +/* Copyright 1996-2004, 2007-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -35,8 +35,6 @@ #define FT_COMPONENT trace_cffparse - - FT_LOCAL_DEF( void ) cff_parser_init( CFF_Parser parser, FT_UInt code, @@ -107,6 +105,7 @@ Bad: val = 0; + FT_TRACE4(( "!!!END OF DATA:!!!" )); goto Exit; } @@ -138,7 +137,7 @@ FT_UInt phase; FT_Long result, number, exponent; - FT_Int sign = 0, exponent_sign = 0; + FT_Int sign = 0, exponent_sign = 0, have_overflow = 0; FT_Long exponent_add, integer_length, fraction_length; @@ -167,7 +166,7 @@ /* Make sure we don't read past the end. */ if ( p >= limit ) - goto Exit; + goto Bad; } /* Get the nibble. */ @@ -204,7 +203,7 @@ /* Make sure we don't read past the end. */ if ( p >= limit ) - goto Exit; + goto Bad; } /* Get the nibble. */ @@ -243,7 +242,7 @@ /* Make sure we don't read past the end. */ if ( p >= limit ) - goto Exit; + goto Bad; } /* Get the nibble. */ @@ -252,17 +251,28 @@ if ( nib >= 10 ) break; - exponent = exponent * 10 + nib; - /* Arbitrarily limit exponent. */ if ( exponent > 1000 ) - goto Exit; + have_overflow = 1; + else + exponent = exponent * 10 + nib; } if ( exponent_sign ) exponent = -exponent; } + if ( !number ) + goto Exit; + + if ( have_overflow ) + { + if ( exponent_sign ) + goto Underflow; + else + goto Overflow; + } + /* We don't check `power_ten' and `exponent_add'. */ exponent += power_ten + exponent_add; @@ -288,15 +298,20 @@ /* Make `scaling' as small as possible. */ new_fraction_length = FT_MIN( exponent, 5 ); - exponent -= new_fraction_length; shift = new_fraction_length - fraction_length; - number *= power_tens[shift]; - if ( number > 0x7FFFL ) + if ( shift > 0 ) { - number /= 10; - exponent += 1; + exponent -= new_fraction_length; + number *= power_tens[shift]; + if ( number > 0x7FFFL ) + { + number /= 10; + exponent += 1; + } } + else + exponent -= fraction_length; } else exponent -= fraction_length; @@ -324,9 +339,10 @@ integer_length += exponent; fraction_length -= exponent; - /* Check for overflow and underflow. */ - if ( FT_ABS( integer_length ) > 5 ) - goto Exit; + if ( integer_length > 5 ) + goto Overflow; + if ( integer_length < -5 ) + goto Underflow; /* Remove non-significant digits. */ if ( integer_length < 0 ) @@ -355,17 +371,32 @@ number *= power_tens[-fraction_length]; if ( number > 0x7FFFL ) - goto Exit; + goto Overflow; result = number << 16; } } + Exit: if ( sign ) result = -result; - Exit: return result; + + Overflow: + result = 0x7FFFFFFFL; + FT_TRACE4(( "!!!OVERFLOW:!!!" )); + goto Exit; + + Underflow: + result = 0; + FT_TRACE4(( "!!!UNDERFLOW:!!!" )); + goto Exit; + + Bad: + result = 0; + FT_TRACE4(( "!!!END OF DATA:!!!" )); + goto Exit; } @@ -380,10 +411,44 @@ /* read a floating point number, either integer or real */ static FT_Fixed + do_fixed( FT_Byte** d, + FT_Long scaling ) + { + if ( **d == 30 ) + return cff_parse_real( d[0], d[1], scaling, NULL ); + else + { + FT_Long val = cff_parse_integer( d[0], d[1] ); + + + if ( scaling ) + val *= power_tens[scaling]; + + if ( val > 0x7FFF ) + { + val = 0x7FFFFFFFL; + goto Overflow; + } + else if ( val < -0x7FFF ) + { + val = -0x7FFFFFFFL; + goto Overflow; + } + + return val << 16; + + Overflow: + FT_TRACE4(( "!!!OVERFLOW:!!!" )); + return val; + } + } + + + /* read a floating point number, either integer or real */ + static FT_Fixed cff_parse_fixed( FT_Byte** d ) { - return **d == 30 ? cff_parse_real( d[0], d[1], 0, NULL ) - : cff_parse_integer( d[0], d[1] ) << 16; + return do_fixed( d, 0 ); } @@ -393,9 +458,7 @@ cff_parse_fixed_scaled( FT_Byte** d, FT_Long scaling ) { - return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL ) - : ( cff_parse_integer( d[0], d[1] ) * - power_tens[scaling] ) << 16; + return do_fixed( d, scaling ); } @@ -462,6 +525,8 @@ error = CFF_Err_Ok; + dict->has_font_matrix = TRUE; + /* We expect a well-formed font matrix, this is, the matrix elements */ /* `xx' and `yy' are of approximately the same magnitude. To avoid */ /* loss of precision, we use the magnitude of element `xx' to scale */ @@ -475,9 +540,15 @@ if ( scaling < 0 || scaling > 9 ) { /* Return default matrix in case of unlikely values. */ + + FT_TRACE1(( "cff_parse_font_matrix:" + " strange scaling value for xx element (%d),\n" + " " + " using default matrix\n", scaling )); + matrix->xx = 0x10000L; matrix->yx = 0; - matrix->yx = 0; + matrix->xy = 0; matrix->yy = 0x10000L; offset->x = 0; offset->y = 0; @@ -493,6 +564,14 @@ offset->y = cff_parse_fixed_scaled( data, scaling ); *upm = power_tens[scaling]; + + FT_TRACE4(( " [%f %f %f %f %f %f]\n", + (double)matrix->xx / *upm / 65536, + (double)matrix->xy / *upm / 65536, + (double)matrix->yx / *upm / 65536, + (double)matrix->yy / *upm / 65536, + (double)offset->x / *upm / 65536, + (double)offset->y / *upm / 65536 )); } Exit: @@ -518,6 +597,12 @@ bbox->xMax = FT_RoundFix( cff_parse_fixed( data++ ) ); bbox->yMax = FT_RoundFix( cff_parse_fixed( data ) ); error = CFF_Err_Ok; + + FT_TRACE4(( " [%d %d %d %d]\n", + bbox->xMin / 65536, + bbox->yMin / 65536, + bbox->xMax / 65536, + bbox->yMax / 65536 )); } return error; @@ -538,6 +623,9 @@ { dict->private_size = cff_parse_num( data++ ); dict->private_offset = cff_parse_num( data ); + FT_TRACE4(( " %lu %lu\n", + dict->private_size, dict->private_offset )); + error = CFF_Err_Ok; } @@ -557,8 +645,8 @@ if ( parser->top >= parser->stack + 3 ) { - dict->cid_registry = (FT_UInt)cff_parse_num ( data++ ); - dict->cid_ordering = (FT_UInt)cff_parse_num ( data++ ); + dict->cid_registry = (FT_UInt)cff_parse_num( data++ ); + dict->cid_ordering = (FT_UInt)cff_parse_num( data++ ); if ( **data == 30 ) FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" )); dict->cid_supplement = cff_parse_num( data ); @@ -566,61 +654,71 @@ FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n", dict->cid_supplement )); error = CFF_Err_Ok; + + FT_TRACE4(( " %d %d %d\n", + dict->cid_registry, + dict->cid_ordering, + dict->cid_supplement )); } return error; } -#define CFF_FIELD_NUM( code, name ) \ - CFF_FIELD( code, name, cff_kind_num ) -#define CFF_FIELD_FIXED( code, name ) \ - CFF_FIELD( code, name, cff_kind_fixed ) -#define CFF_FIELD_FIXED_1000( code, name ) \ - CFF_FIELD( code, name, cff_kind_fixed_thousand ) -#define CFF_FIELD_STRING( code, name ) \ - CFF_FIELD( code, name, cff_kind_string ) -#define CFF_FIELD_BOOL( code, name ) \ - CFF_FIELD( code, name, cff_kind_bool ) -#define CFF_FIELD_DELTA( code, name, max ) \ - CFF_FIELD( code, name, cff_kind_delta ) +#define CFF_FIELD_NUM( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_num ) +#define CFF_FIELD_FIXED( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_fixed ) +#define CFF_FIELD_FIXED_1000( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_fixed_thousand ) +#define CFF_FIELD_STRING( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_string ) +#define CFF_FIELD_BOOL( code, name, id ) \ + CFF_FIELD( code, name, id, cff_kind_bool ) #define CFFCODE_TOPDICT 0x1000 #define CFFCODE_PRIVATE 0x2000 + #ifndef FT_CONFIG_OPTION_PIC -#define CFF_FIELD_CALLBACK( code, name ) \ - { \ - cff_kind_callback, \ - code | CFFCODE, \ - 0, 0, \ - cff_parse_ ## name, \ - 0, 0 \ - }, #undef CFF_FIELD -#define CFF_FIELD( code, name, kind ) \ - { \ - kind, \ - code | CFFCODE, \ - FT_FIELD_OFFSET( name ), \ - FT_FIELD_SIZE( name ), \ - 0, 0, 0 \ +#undef CFF_FIELD_DELTA + + +#ifndef FT_DEBUG_LEVEL_TRACE + + +#define CFF_FIELD_CALLBACK( code, name, id ) \ + { \ + cff_kind_callback, \ + code | CFFCODE, \ + 0, 0, \ + cff_parse_ ## name, \ + 0, 0 \ }, -#undef CFF_FIELD_DELTA -#define CFF_FIELD_DELTA( code, name, max ) \ - { \ - cff_kind_delta, \ - code | CFFCODE, \ - FT_FIELD_OFFSET( name ), \ - FT_FIELD_SIZE_DELTA( name ), \ - 0, \ - max, \ - FT_FIELD_OFFSET( num_ ## name ) \ - }, +#define CFF_FIELD( code, name, id, kind ) \ + { \ + kind, \ + code | CFFCODE, \ + FT_FIELD_OFFSET( name ), \ + FT_FIELD_SIZE( name ), \ + 0, 0, 0 \ + }, +#define CFF_FIELD_DELTA( code, name, max, id ) \ + { \ + cff_kind_delta, \ + code | CFFCODE, \ + FT_FIELD_OFFSET( name ), \ + FT_FIELD_SIZE_DELTA( name ), \ + 0, \ + max, \ + FT_FIELD_OFFSET( num_ ## name ) \ + }, + static const CFF_Field_Handler cff_field_handlers[] = { @@ -630,83 +728,200 @@ }; +#else /* FT_DEBUG_LEVEL_TRACE */ + + + +#define CFF_FIELD_CALLBACK( code, name, id ) \ + { \ + cff_kind_callback, \ + code | CFFCODE, \ + 0, 0, \ + cff_parse_ ## name, \ + 0, 0, \ + id \ + }, + +#define CFF_FIELD( code, name, id, kind ) \ + { \ + kind, \ + code | CFFCODE, \ + FT_FIELD_OFFSET( name ), \ + FT_FIELD_SIZE( name ), \ + 0, 0, 0, \ + id \ + }, + +#define CFF_FIELD_DELTA( code, name, max, id ) \ + { \ + cff_kind_delta, \ + code | CFFCODE, \ + FT_FIELD_OFFSET( name ), \ + FT_FIELD_SIZE_DELTA( name ), \ + 0, \ + max, \ + FT_FIELD_OFFSET( num_ ## name ), \ + id \ + }, + + static const CFF_Field_Handler cff_field_handlers[] = + { + +#include "cfftoken.h" + + { 0, 0, 0, 0, 0, 0, 0, 0 } + }; + + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + #else /* FT_CONFIG_OPTION_PIC */ - void FT_Destroy_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler* clazz) + + void + FT_Destroy_Class_cff_field_handlers( FT_Library library, + CFF_Field_Handler* clazz ) { - FT_Memory memory = library->memory; + FT_Memory memory = library->memory; + + if ( clazz ) FT_FREE( clazz ); } - FT_Error FT_Create_Class_cff_field_handlers(FT_Library library, CFF_Field_Handler** output_class) + + FT_Error + FT_Create_Class_cff_field_handlers( FT_Library library, + CFF_Field_Handler** output_class ) { - CFF_Field_Handler* clazz; - FT_Error error; - FT_Memory memory = library->memory; - int i=0; + CFF_Field_Handler* clazz = NULL; + FT_Error error; + FT_Memory memory = library->memory; + int i = 0; + + #undef CFF_FIELD +#define CFF_FIELD( code, name, id, kind ) i++; #undef CFF_FIELD_DELTA +#define CFF_FIELD_DELTA( code, name, max, id ) i++; #undef CFF_FIELD_CALLBACK -#define CFF_FIELD_CALLBACK( code, name ) i++; -#define CFF_FIELD( code, name, kind ) i++; -#define CFF_FIELD_DELTA( code, name, max ) i++; +#define CFF_FIELD_CALLBACK( code, name, id ) i++; #include "cfftoken.h" - i++;/*{ 0, 0, 0, 0, 0, 0, 0 }*/ - if ( FT_ALLOC( clazz, sizeof(CFF_Field_Handler)*i ) ) + i++; /* { 0, 0, 0, 0, 0, 0, 0 } */ + + if ( FT_ALLOC( clazz, sizeof ( CFF_Field_Handler ) * i ) ) return error; - i=0; -#undef CFF_FIELD -#undef CFF_FIELD_DELTA + i = 0; + + +#ifndef FT_DEBUG_LEVEL_TRACE + + #undef CFF_FIELD_CALLBACK +#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \ + clazz[i].kind = cff_kind_callback; \ + clazz[i].code = code_ | CFFCODE; \ + clazz[i].offset = 0; \ + clazz[i].size = 0; \ + clazz[i].reader = cff_parse_ ## name_; \ + clazz[i].array_max = 0; \ + clazz[i].count_offset = 0; \ + i++; -#define CFF_FIELD_CALLBACK( code_, name_ ) \ - clazz[i].kind = cff_kind_callback; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = 0; \ - clazz[i].size = 0; \ - clazz[i].reader = cff_parse_ ## name_; \ - clazz[i].array_max = 0; \ - clazz[i].count_offset = 0; \ - i++; +#undef CFF_FIELD +#define CFF_FIELD( code_, name_, id_, kind_ ) \ + clazz[i].kind = kind_; \ + clazz[i].code = code_ | CFFCODE; \ + clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ + clazz[i].size = FT_FIELD_SIZE( name_ ); \ + clazz[i].reader = 0; \ + clazz[i].array_max = 0; \ + clazz[i].count_offset = 0; \ + i++; \ +#undef CFF_FIELD_DELTA +#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \ + clazz[i].kind = cff_kind_delta; \ + clazz[i].code = code_ | CFFCODE; \ + clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ + clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \ + clazz[i].reader = 0; \ + clazz[i].array_max = max_; \ + clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \ + i++; + +#include "cfftoken.h" + + clazz[i].kind = 0; + clazz[i].code = 0; + clazz[i].offset = 0; + clazz[i].size = 0; + clazz[i].reader = 0; + clazz[i].array_max = 0; + clazz[i].count_offset = 0; + + +#else /* FT_DEBUG_LEVEL_TRACE */ + + +#undef CFF_FIELD_CALLBACK +#define CFF_FIELD_CALLBACK( code_, name_, id_ ) \ + clazz[i].kind = cff_kind_callback; \ + clazz[i].code = code_ | CFFCODE; \ + clazz[i].offset = 0; \ + clazz[i].size = 0; \ + clazz[i].reader = cff_parse_ ## name_; \ + clazz[i].array_max = 0; \ + clazz[i].count_offset = 0; \ + clazz[i].id = id_; \ + i++; + #undef CFF_FIELD -#define CFF_FIELD( code_, name_, kind_ ) \ - clazz[i].kind = kind_; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ - clazz[i].size = FT_FIELD_SIZE( name_ ); \ - clazz[i].reader = 0; \ - clazz[i].array_max = 0; \ - clazz[i].count_offset = 0; \ - i++; \ +#define CFF_FIELD( code_, name_, id_, kind_ ) \ + clazz[i].kind = kind_; \ + clazz[i].code = code_ | CFFCODE; \ + clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ + clazz[i].size = FT_FIELD_SIZE( name_ ); \ + clazz[i].reader = 0; \ + clazz[i].array_max = 0; \ + clazz[i].count_offset = 0; \ + clazz[i].id = id_; \ + i++; \ #undef CFF_FIELD_DELTA -#define CFF_FIELD_DELTA( code_, name_, max_ ) \ - clazz[i].kind = cff_kind_delta; \ - clazz[i].code = code_ | CFFCODE; \ - clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ - clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \ - clazz[i].reader = 0; \ - clazz[i].array_max = max_; \ - clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \ - i++; +#define CFF_FIELD_DELTA( code_, name_, max_, id_ ) \ + clazz[i].kind = cff_kind_delta; \ + clazz[i].code = code_ | CFFCODE; \ + clazz[i].offset = FT_FIELD_OFFSET( name_ ); \ + clazz[i].size = FT_FIELD_SIZE_DELTA( name_ ); \ + clazz[i].reader = 0; \ + clazz[i].array_max = max_; \ + clazz[i].count_offset = FT_FIELD_OFFSET( num_ ## name_ ); \ + clazz[i].id = id_; \ + i++; #include "cfftoken.h" - clazz[i].kind = 0; - clazz[i].code = 0; - clazz[i].offset = 0; - clazz[i].size = 0; - clazz[i].reader = 0; - clazz[i].array_max = 0; + clazz[i].kind = 0; + clazz[i].code = 0; + clazz[i].offset = 0; + clazz[i].size = 0; + clazz[i].reader = 0; + clazz[i].array_max = 0; clazz[i].count_offset = 0; + clazz[i].id = 0; + +#endif /* FT_DEBUG_LEVEL_TRACE */ + + *output_class = clazz; + return CFF_Err_Ok; } @@ -722,7 +937,7 @@ FT_Byte* p = start; FT_Error error = CFF_Err_Ok; FT_Library library = parser->library; - FT_UNUSED(library); + FT_UNUSED( library ); parser->top = parser->stack; @@ -794,7 +1009,7 @@ } code = code | parser->object_code; - for ( field = FT_CFF_FIELD_HANDLERS_GET; field->kind; field++ ) + for ( field = CFF_FIELD_HANDLERS_GET; field->kind; field++ ) { if ( field->code == (FT_Int)code ) { @@ -803,6 +1018,10 @@ FT_Byte* q = (FT_Byte*)parser->object + field->offset; +#ifdef FT_DEBUG_LEVEL_TRACE + FT_TRACE4(( " %s", field->id )); +#endif + /* check that we have enough arguments -- except for */ /* delta encoded arrays, which can be empty */ if ( field->kind != cff_kind_delta && num_args < 1 ) @@ -841,6 +1060,34 @@ default: /* for 64-bit systems */ *(FT_Long*)q = val; } + +#ifdef FT_DEBUG_LEVEL_TRACE + switch ( field->kind ) + { + case cff_kind_bool: + FT_TRACE4(( " %s\n", val ? "true" : "false" )); + break; + + case cff_kind_string: + FT_TRACE4(( " %ld (SID)\n", val )); + break; + + case cff_kind_num: + FT_TRACE4(( " %ld\n", val )); + break; + + case cff_kind_fixed: + FT_TRACE4(( " %f\n", (double)val / 65536 )); + break; + + case cff_kind_fixed_thousand: + FT_TRACE4(( " %f\n", (double)val / 65536 / 1000 )); + + default: + ; /* never reached */ + } +#endif + break; case cff_kind_delta: @@ -854,6 +1101,8 @@ if ( num_args > field->array_max ) num_args = field->array_max; + FT_TRACE4(( " [" )); + /* store count */ *qcount = (FT_Byte)num_args; @@ -879,9 +1128,13 @@ *(FT_Long*)q = val; } + FT_TRACE4(( " %ld", val )); + q += field->size; num_args--; } + + FT_TRACE4(( "]\n" )); } break; Index: src/cff/cffparse.h =================================================================== --- src/cff/cffparse.h (revision 58178) +++ src/cff/cffparse.h (working copy) @@ -4,7 +4,7 @@ /* */ /* CFF token stream parser (specification) */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2003, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -90,6 +90,10 @@ FT_UInt array_max; FT_UInt count_offset; +#ifdef FT_DEBUG_LEVEL_TRACE + const char* id; +#endif + } CFF_Field_Handler; Index: src/cff/cffpic.c =================================================================== --- src/cff/cffpic.c (revision 58178) +++ src/cff/cffpic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,40 +19,78 @@ #include <ft2build.h> #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H +#include "cffcmap.h" #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, FT_ServiceDescRec**); - void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*); - void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*); - void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*); - void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*); - void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*); + FT_Error + FT_Create_Class_cff_services( + FT_Library library, + FT_ServiceDescRec** output_class ); + void + FT_Destroy_Class_cff_services( + FT_Library library, + FT_ServiceDescRec* clazz ); + + void + FT_Init_Class_cff_service_ps_info( + FT_Library library, + FT_Service_PsInfoRec* clazz ); + + void + FT_Init_Class_cff_service_glyph_dict( + FT_Library library, + FT_Service_GlyphDictRec* clazz ); + + void + FT_Init_Class_cff_service_ps_name( + FT_Library library, + FT_Service_PsFontNameRec* clazz ); + + void + FT_Init_Class_cff_service_get_cmap_info( + FT_Library library, + FT_Service_TTCMapsRec* clazz ); + + void + FT_Init_Class_cff_service_cid_info( + FT_Library library, + FT_Service_CIDRec* clazz ); + /* forward declaration of PIC init functions from cffparse.c */ - FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**); - void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*); + FT_Error + FT_Create_Class_cff_field_handlers( + FT_Library library, + CFF_Field_Handler** output_class ); - /* forward declaration of PIC init functions from cffcmap.c */ - void FT_Init_Class_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*); - void FT_Init_Class_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*); + void + FT_Destroy_Class_cff_field_handlers( + FT_Library library, + CFF_Field_Handler* clazz ); void - cff_driver_class_pic_free( FT_Library library ) + cff_driver_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->cff ) { - CffModulePIC* container = (CffModulePIC*)pic_container->cff; - if(container->cff_services) - FT_Destroy_Class_cff_services(library, container->cff_services); + CffModulePIC* container = ( CffModulePIC* )pic_container->cff; + + + if ( container->cff_services ) + FT_Destroy_Class_cff_services( library, + container->cff_services ); container->cff_services = NULL; - if(container->cff_field_handlers) - FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers); + if ( container->cff_field_handlers ) + FT_Destroy_Class_cff_field_handlers( + library, container->cff_field_handlers ); container->cff_field_handlers = NULL; FT_FREE( container ); pic_container->cff = NULL; @@ -65,7 +103,7 @@ { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = CFF_Err_Ok; - CffModulePIC* container; + CffModulePIC* container = NULL; FT_Memory memory = library->memory; @@ -76,22 +114,31 @@ pic_container->cff = container; /* initialize pointer table - this is how the module usually expects this data */ - error = FT_Create_Class_cff_services(library, &container->cff_services); - if(error) + 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) + error = FT_Create_Class_cff_field_handlers( + library, &container->cff_field_handlers ); + if ( error ) goto Exit; - FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info); - FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict); - FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name); - FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info); - FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info); - FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec); - FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec); + FT_Init_Class_cff_service_ps_info( + library, &container->cff_service_ps_info ); + FT_Init_Class_cff_service_glyph_dict( + library, &container->cff_service_glyph_dict ); + FT_Init_Class_cff_service_ps_name( + library, &container->cff_service_ps_name ); + FT_Init_Class_cff_service_get_cmap_info( + library, &container->cff_service_get_cmap_info ); + FT_Init_Class_cff_service_cid_info( + library, &container->cff_service_cid_info ); + FT_Init_Class_cff_cmap_encoding_class_rec( + library, &container->cff_cmap_encoding_class_rec ); + FT_Init_Class_cff_cmap_unicode_class_rec( + library, &container->cff_cmap_unicode_class_rec ); Exit: - if(error) - cff_driver_class_pic_free(library); + if ( error ) + cff_driver_class_pic_free( library ); return error; } Index: src/cff/cffpic.h =================================================================== --- src/cff/cffpic.h (revision 58178) +++ src/cff/cffpic.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for cff module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,22 +19,24 @@ #ifndef __CFFPIC_H__ #define __CFFPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H + #ifndef FT_CONFIG_OPTION_PIC -#define FT_CFF_SERVICE_PS_INFO_GET cff_service_ps_info -#define FT_CFF_SERVICE_GLYPH_DICT_GET cff_service_glyph_dict -#define FT_CFF_SERVICE_PS_NAME_GET cff_service_ps_name -#define FT_CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info -#define FT_CFF_SERVICE_CID_INFO_GET cff_service_cid_info -#define FT_CFF_SERVICES_GET cff_services -#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec -#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec -#define FT_CFF_FIELD_HANDLERS_GET cff_field_handlers +#define CFF_SERVICE_PS_INFO_GET cff_service_ps_info +#define CFF_SERVICE_GLYPH_DICT_GET cff_service_glyph_dict +#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_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 +#define CFF_FIELD_HANDLERS_GET cff_field_handlers + #else /* FT_CONFIG_OPTION_PIC */ #include FT_SERVICE_GLYPH_DICT_H @@ -44,30 +46,51 @@ #include FT_SERVICE_TT_CMAP_H #include FT_SERVICE_CID_H - typedef struct CffModulePIC_ + + typedef struct CffModulePIC_ { - FT_ServiceDescRec* cff_services; - CFF_Field_Handler* cff_field_handlers; - FT_Service_PsInfoRec cff_service_ps_info; - FT_Service_GlyphDictRec cff_service_glyph_dict; - FT_Service_PsFontNameRec cff_service_ps_name; - FT_Service_TTCMapsRec cff_service_get_cmap_info; - FT_Service_CIDRec cff_service_cid_info; - FT_CMap_ClassRec cff_cmap_encoding_class_rec; - FT_CMap_ClassRec cff_cmap_unicode_class_rec; + FT_ServiceDescRec* cff_services; + CFF_Field_Handler* cff_field_handlers; + FT_Service_PsInfoRec cff_service_ps_info; + FT_Service_GlyphDictRec cff_service_glyph_dict; + FT_Service_PsFontNameRec cff_service_ps_name; + FT_Service_TTCMapsRec cff_service_get_cmap_info; + FT_Service_CIDRec cff_service_cid_info; + 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 FT_CFF_SERVICE_PS_INFO_GET (GET_PIC(library)->cff_service_ps_info) -#define FT_CFF_SERVICE_GLYPH_DICT_GET (GET_PIC(library)->cff_service_glyph_dict) -#define FT_CFF_SERVICE_PS_NAME_GET (GET_PIC(library)->cff_service_ps_name) -#define FT_CFF_SERVICE_GET_CMAP_INFO_GET (GET_PIC(library)->cff_service_get_cmap_info) -#define FT_CFF_SERVICE_CID_INFO_GET (GET_PIC(library)->cff_service_cid_info) -#define FT_CFF_SERVICES_GET (GET_PIC(library)->cff_services) -#define FT_CFF_CMAP_ENCODING_CLASS_REC_GET (GET_PIC(library)->cff_cmap_encoding_class_rec) -#define FT_CFF_CMAP_UNICODE_CLASS_REC_GET (GET_PIC(library)->cff_cmap_unicode_class_rec) -#define FT_CFF_FIELD_HANDLERS_GET (GET_PIC(library)->cff_field_handlers) +#define GET_PIC( lib ) \ + ( (CffModulePIC*)((lib)->pic_container.cff) ) + +#define CFF_SERVICE_PS_INFO_GET \ + ( GET_PIC( library )->cff_service_ps_info ) +#define CFF_SERVICE_GLYPH_DICT_GET \ + ( GET_PIC( library )->cff_service_glyph_dict ) +#define CFF_SERVICE_PS_NAME_GET \ + ( GET_PIC( library )->cff_service_ps_name ) +#define CFF_SERVICE_GET_CMAP_INFO_GET \ + ( GET_PIC( library )->cff_service_get_cmap_info ) +#define CFF_SERVICE_CID_INFO_GET \ + ( GET_PIC( library )->cff_service_cid_info ) +#define CFF_SERVICES_GET \ + ( GET_PIC( library )->cff_services ) +#define CFF_CMAP_ENCODING_CLASS_REC_GET \ + ( GET_PIC( library )->cff_cmap_encoding_class_rec ) +#define CFF_CMAP_UNICODE_CLASS_REC_GET \ + ( GET_PIC( library )->cff_cmap_unicode_class_rec ) +#define CFF_FIELD_HANDLERS_GET \ + ( GET_PIC( library )->cff_field_handlers ) + + /* see cffpic.c for the implementation */ + void + cff_driver_class_pic_free( FT_Library library ); + + FT_Error + cff_driver_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: src/cff/cfftoken.h =================================================================== --- src/cff/cfftoken.h (revision 58178) +++ src/cff/cfftoken.h (working copy) @@ -4,7 +4,7 @@ /* */ /* CFF token definitions (specification only). */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2003, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -22,48 +22,48 @@ #undef CFFCODE #define CFFCODE CFFCODE_TOPDICT - CFF_FIELD_STRING ( 0, version ) - CFF_FIELD_STRING ( 1, notice ) - CFF_FIELD_STRING ( 0x100, copyright ) - CFF_FIELD_STRING ( 2, full_name ) - CFF_FIELD_STRING ( 3, family_name ) - CFF_FIELD_STRING ( 4, weight ) - CFF_FIELD_BOOL ( 0x101, is_fixed_pitch ) - CFF_FIELD_FIXED ( 0x102, italic_angle ) - CFF_FIELD_FIXED ( 0x103, underline_position ) - CFF_FIELD_FIXED ( 0x104, underline_thickness ) - CFF_FIELD_NUM ( 0x105, paint_type ) - CFF_FIELD_NUM ( 0x106, charstring_type ) - CFF_FIELD_CALLBACK( 0x107, font_matrix ) - CFF_FIELD_NUM ( 13, unique_id ) - CFF_FIELD_CALLBACK( 5, font_bbox ) - CFF_FIELD_NUM ( 0x108, stroke_width ) - CFF_FIELD_NUM ( 15, charset_offset ) - CFF_FIELD_NUM ( 16, encoding_offset ) - CFF_FIELD_NUM ( 17, charstrings_offset ) - CFF_FIELD_CALLBACK( 18, private_dict ) - CFF_FIELD_NUM ( 0x114, synthetic_base ) - CFF_FIELD_STRING ( 0x115, embedded_postscript ) + CFF_FIELD_STRING ( 0, version, "Version" ) + CFF_FIELD_STRING ( 1, notice, "Notice" ) + CFF_FIELD_STRING ( 0x100, copyright, "Copyright" ) + CFF_FIELD_STRING ( 2, full_name, "FullName" ) + CFF_FIELD_STRING ( 3, family_name, "FamilyName" ) + CFF_FIELD_STRING ( 4, weight, "Weight" ) + CFF_FIELD_BOOL ( 0x101, is_fixed_pitch, "isFixedPitch" ) + CFF_FIELD_FIXED ( 0x102, italic_angle, "ItalicAngle" ) + CFF_FIELD_FIXED ( 0x103, underline_position, "UnderlinePosition" ) + CFF_FIELD_FIXED ( 0x104, underline_thickness, "UnderlineThickness" ) + CFF_FIELD_NUM ( 0x105, paint_type, "PaintType" ) + CFF_FIELD_NUM ( 0x106, charstring_type, "CharstringType" ) + CFF_FIELD_CALLBACK( 0x107, font_matrix, "FontMatrix" ) + CFF_FIELD_NUM ( 13, unique_id, "UniqueID" ) + CFF_FIELD_CALLBACK( 5, font_bbox, "FontBBox" ) + CFF_FIELD_NUM ( 0x108, stroke_width, "StrokeWidth" ) + CFF_FIELD_NUM ( 15, charset_offset, "charset" ) + CFF_FIELD_NUM ( 16, encoding_offset, "Encoding" ) + CFF_FIELD_NUM ( 17, charstrings_offset, "CharStrings" ) + CFF_FIELD_CALLBACK( 18, private_dict, "Private" ) + CFF_FIELD_NUM ( 0x114, synthetic_base, "SyntheticBase" ) + CFF_FIELD_STRING ( 0x115, embedded_postscript, "PostScript" ) #if 0 - CFF_FIELD_STRING ( 0x116, base_font_name ) - CFF_FIELD_DELTA ( 0x117, base_font_blend, 16 ) - CFF_FIELD_CALLBACK( 0x118, multiple_master ) - CFF_FIELD_CALLBACK( 0x119, blend_axis_types ) + CFF_FIELD_STRING ( 0x116, base_font_name, "BaseFontName" ) + CFF_FIELD_DELTA ( 0x117, base_font_blend, 16, "BaseFontBlend" ) + CFF_FIELD_CALLBACK( 0x118, multiple_master, "MultipleMaster" ) + CFF_FIELD_CALLBACK( 0x119, blend_axis_types, "BlendAxisTypes" ) #endif - CFF_FIELD_CALLBACK( 0x11E, cid_ros ) - CFF_FIELD_NUM ( 0x11F, cid_font_version ) - CFF_FIELD_NUM ( 0x120, cid_font_revision ) - CFF_FIELD_NUM ( 0x121, cid_font_type ) - CFF_FIELD_NUM ( 0x122, cid_count ) - CFF_FIELD_NUM ( 0x123, cid_uid_base ) - CFF_FIELD_NUM ( 0x124, cid_fd_array_offset ) - CFF_FIELD_NUM ( 0x125, cid_fd_select_offset ) - CFF_FIELD_STRING ( 0x126, cid_font_name ) + CFF_FIELD_CALLBACK( 0x11E, cid_ros, "ROS" ) + CFF_FIELD_NUM ( 0x11F, cid_font_version, "CIDFontVersion" ) + CFF_FIELD_NUM ( 0x120, cid_font_revision, "CIDFontRevision" ) + CFF_FIELD_NUM ( 0x121, cid_font_type, "CIDFontType" ) + CFF_FIELD_NUM ( 0x122, cid_count, "CIDCount" ) + CFF_FIELD_NUM ( 0x123, cid_uid_base, "UIDBase" ) + CFF_FIELD_NUM ( 0x124, cid_fd_array_offset, "FDArray" ) + CFF_FIELD_NUM ( 0x125, cid_fd_select_offset, "FDSelect" ) + CFF_FIELD_STRING ( 0x126, cid_font_name, "FontName" ) #if 0 - CFF_FIELD_NUM ( 0x127, chameleon ) + CFF_FIELD_NUM ( 0x127, chameleon, "Chameleon" ) #endif @@ -72,26 +72,26 @@ #undef CFFCODE #define CFFCODE CFFCODE_PRIVATE - CFF_FIELD_DELTA ( 6, blue_values, 14 ) - CFF_FIELD_DELTA ( 7, other_blues, 10 ) - CFF_FIELD_DELTA ( 8, family_blues, 14 ) - CFF_FIELD_DELTA ( 9, family_other_blues, 10 ) - CFF_FIELD_FIXED_1000( 0x109, blue_scale ) - CFF_FIELD_NUM ( 0x10A, blue_shift ) - CFF_FIELD_NUM ( 0x10B, blue_fuzz ) - CFF_FIELD_NUM ( 10, standard_width ) - CFF_FIELD_NUM ( 11, standard_height ) - CFF_FIELD_DELTA ( 0x10C, snap_widths, 13 ) - CFF_FIELD_DELTA ( 0x10D, snap_heights, 13 ) - CFF_FIELD_BOOL ( 0x10E, force_bold ) - CFF_FIELD_FIXED ( 0x10F, force_bold_threshold ) - CFF_FIELD_NUM ( 0x110, lenIV ) - CFF_FIELD_NUM ( 0x111, language_group ) - CFF_FIELD_FIXED ( 0x112, expansion_factor ) - CFF_FIELD_NUM ( 0x113, initial_random_seed ) - CFF_FIELD_NUM ( 19, local_subrs_offset ) - CFF_FIELD_NUM ( 20, default_width ) - CFF_FIELD_NUM ( 21, nominal_width ) + CFF_FIELD_DELTA ( 6, blue_values, 14, "BlueValues" ) + CFF_FIELD_DELTA ( 7, other_blues, 10, "OtherBlues" ) + CFF_FIELD_DELTA ( 8, family_blues, 14, "FamilyBlues" ) + CFF_FIELD_DELTA ( 9, family_other_blues, 10, "FamilyOtherBlues" ) + CFF_FIELD_FIXED_1000( 0x109, blue_scale, "BlueScale" ) + CFF_FIELD_NUM ( 0x10A, blue_shift, "BlueShift" ) + CFF_FIELD_NUM ( 0x10B, blue_fuzz, "BlueFuzz" ) + CFF_FIELD_NUM ( 10, standard_width, "StdHW" ) + CFF_FIELD_NUM ( 11, standard_height, "StdVW" ) + CFF_FIELD_DELTA ( 0x10C, snap_widths, 13, "StemSnapH" ) + CFF_FIELD_DELTA ( 0x10D, snap_heights, 13, "StemSnapV" ) + CFF_FIELD_BOOL ( 0x10E, force_bold, "ForceBold" ) + CFF_FIELD_FIXED ( 0x10F, force_bold_threshold, "ForceBoldThreshold" ) + CFF_FIELD_NUM ( 0x110, lenIV, "lenIV" ) + CFF_FIELD_NUM ( 0x111, language_group, "LanguageGroup" ) + CFF_FIELD_FIXED ( 0x112, expansion_factor, "ExpansionFactor" ) + CFF_FIELD_NUM ( 0x113, initial_random_seed, "initialRandomSeed" ) + CFF_FIELD_NUM ( 19, local_subrs_offset, "Subrs" ) + CFF_FIELD_NUM ( 20, default_width, "defaultWidthX" ) + CFF_FIELD_NUM ( 21, nominal_width, "nominalWidthX" ) /* END */ Index: src/cff/cfftypes.h =================================================================== --- src/cff/cfftypes.h (revision 58178) +++ src/cff/cfftypes.h (working copy) @@ -5,7 +5,7 @@ /* Basic OpenType/CFF type definitions and interface (specification */ /* only). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2003, 2006-2008, 2010-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -117,6 +117,7 @@ FT_Int paint_type; FT_Int charstring_type; FT_Matrix font_matrix; + FT_Bool has_font_matrix; FT_ULong units_per_em; /* temporarily used as scaling value also */ FT_Vector font_offset; FT_ULong unique_id; @@ -212,8 +213,7 @@ } CFF_SubFontRec, *CFF_SubFont; - /* maximum number of sub-fonts in a CID-keyed file */ -#define CFF_MAX_CID_FONTS 32 +#define CFF_MAX_CID_FONTS 256 typedef struct CFF_FontRec_ @@ -269,7 +269,7 @@ /* since version 2.3.6 */ FT_String* registry; FT_String* ordering; - + } CFF_FontRec, *CFF_Font; Index: src/cff/rules.mk =================================================================== --- src/cff/rules.mk (revision 58178) +++ src/cff/rules.mk (working copy) @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003 by +# Copyright 1996-2000, 2001, 2003, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -23,19 +23,20 @@ # CFF driver sources (i.e., C files) # -CFF_DRV_SRC := $(CFF_DIR)/cffobjs.c \ +CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \ + $(CFF_DIR)/cffdrivr.c \ + $(CFF_DIR)/cffgload.c \ $(CFF_DIR)/cffload.c \ - $(CFF_DIR)/cffgload.c \ + $(CFF_DIR)/cffobjs.c \ $(CFF_DIR)/cffparse.c \ - $(CFF_DIR)/cffcmap.c \ - $(CFF_DIR)/cffdrivr.c + $(CFF_DIR)/cffpic.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)/cfferrs.h + $(CFF_DIR)/cfftypes.h # CFF driver object(s) Index: src/cid/ciderrs.h =================================================================== --- src/cid/ciderrs.h (revision 58178) +++ src/cid/ciderrs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* CID error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX CID_Err_ #define FT_ERR_BASE FT_Mod_Err_CID Index: src/cid/cidgload.c =================================================================== --- src/cid/cidgload.c (revision 58178) +++ src/cid/cidgload.c (working copy) @@ -426,7 +426,7 @@ metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; - if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { /* make up vertical ones */ ft_synthesize_vertical_metrics( metrics, Index: src/cid/cidload.c =================================================================== --- src/cid/cidload.c (revision 58178) +++ src/cid/cidload.c (working copy) @@ -4,7 +4,7 @@ /* */ /* CID-keyed Type1 font loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2009 by */ +/* Copyright 1996-2006, 2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -110,7 +110,7 @@ CID_FaceDict dict; - if ( parser->num_dict < 0 ) + if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts ) { FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n", keyword->ident )); @@ -147,8 +147,8 @@ FT_CALLBACK_DEF( FT_Error ) - parse_font_matrix( CID_Face face, - CID_Parser* parser ) + cid_parse_font_matrix( CID_Face face, + CID_Parser* parser ) { FT_Matrix* matrix; FT_Vector* offset; @@ -158,7 +158,7 @@ FT_Fixed temp_scale; - if ( parser->num_dict >= 0 ) + if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) { dict = face->cid.font_dicts + parser->num_dict; matrix = &dict->font_matrix; @@ -168,12 +168,12 @@ temp_scale = FT_ABS( temp[3] ); - /* Set units per EM based on FontMatrix values. We set the value to */ - /* `1000/temp_scale', because temp_scale was already multiplied by */ - /* 1000 (in `t1_tofixed', from psobjs.c). */ - root->units_per_EM = (FT_UShort)( FT_DivFix( 0x10000L, - FT_DivFix( temp_scale, 1000 ) ) ); + /* Set Units per EM based on FontMatrix values. We set the value to */ + /* 1000 / temp_scale, because temp_scale was already multiplied by */ + /* 1000 (in t1_tofixed, from psobjs.c). */ + root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); + /* we need to scale the values by 1.0/temp[3] */ if ( temp_scale != 0x10000L ) { @@ -249,7 +249,7 @@ CID_FaceDict dict; - if ( parser->num_dict >= 0 ) + if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts ) { dict = face->cid.font_dicts + parser->num_dict; @@ -268,7 +268,7 @@ #include "cidtoken.h" T1_FIELD_CALLBACK( "FDArray", parse_fd_array, 0 ) - T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix, 0 ) + T1_FIELD_CALLBACK( "FontMatrix", cid_parse_font_matrix, 0 ) T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 ) { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 } @@ -413,12 +413,25 @@ FT_Byte* p; + /* Check for possible overflow. */ + if ( num_subrs == FT_UINT_MAX ) + { + error = CID_Err_Syntax_Error; + goto Fail; + } + /* reallocate offsets array if needed */ if ( num_subrs + 1 > max_offsets ) { FT_UInt new_max = FT_PAD_CEIL( num_subrs + 1, 4 ); + if ( new_max <= max_offsets ) + { + error = CID_Err_Syntax_Error; + goto Fail; + } + if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) ) goto Fail; @@ -436,6 +449,11 @@ FT_FRAME_EXIT(); + /* offsets must be ordered */ + for ( count = 1; count <= num_subrs; count++ ) + if ( offsets[count - 1] > offsets[count] ) + goto Fail; + /* now, compute the size of subrs charstrings, */ /* allocate, and read them */ data_len = offsets[num_subrs] - offsets[0]; @@ -495,8 +513,8 @@ static void - t1_init_loader( CID_Loader* loader, - CID_Face face ) + cid_init_loader( CID_Loader* loader, + CID_Face face ) { FT_UNUSED( face ); @@ -504,8 +522,8 @@ } - static void - t1_done_loader( CID_Loader* loader ) + static void + cid_done_loader( CID_Loader* loader ) { CID_Parser* parser = &loader->parser; @@ -623,7 +641,7 @@ FT_Error error; - t1_init_loader( &loader, face ); + cid_init_loader( &loader, face ); parser = &loader.parser; error = cid_parser_new( parser, face->root.stream, face->root.memory, @@ -664,7 +682,7 @@ error = cid_read_subrs( face ); Exit: - t1_done_loader( &loader ); + cid_done_loader( &loader ); return error; } Index: src/cid/cidobjs.c =================================================================== --- src/cid/cidobjs.c (revision 58178) +++ src/cid/cidobjs.c (working copy) @@ -4,7 +4,7 @@ /* */ /* CID objects manager (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by */ +/* Copyright 1996-2006, 2008, 2010-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -299,6 +299,13 @@ psaux = (PSAux_Service)FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); + if ( !psaux ) + { + FT_ERROR(( "cid_face_init: cannot access `psaux' module\n" )); + error = CID_Err_Missing_Module; + goto Exit; + } + face->psaux = psaux; } @@ -311,6 +318,8 @@ face->pshinter = pshinter; } + FT_TRACE2(( "CID driver\n" )); + /* open the tokenizer; this will also check the font format */ if ( FT_STREAM_SEEK( 0 ) ) goto Exit; Index: src/cid/cidparse.c =================================================================== --- src/cid/cidparse.c (revision 58178) +++ src/cid/cidparse.c (working copy) @@ -73,7 +73,7 @@ if ( ft_strncmp( (char *)stream->cursor, "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) ) { - FT_TRACE2(( "[not a valid CID-keyed font]\n" )); + FT_TRACE2(( " not a CID-keyed font\n" )); error = CID_Err_Unknown_File_Format; } @@ -99,7 +99,7 @@ if ( stream_len == 0 ) { FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" )); - error = CID_Err_Unknown_File_Format; + error = CID_Err_Invalid_File_Format; goto Exit; } Index: src/cid/cidriver.c =================================================================== --- src/cid/cidriver.c (revision 58178) +++ src/cid/cidriver.c (working copy) @@ -4,7 +4,7 @@ /* */ /* CID driver interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */ +/* Copyright 1996-2004, 2006, 2008, 2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -91,7 +91,8 @@ (PS_GetFontInfoFunc) cid_ps_get_font_info, (PS_GetFontExtraFunc) cid_ps_get_font_extra, (PS_HasGlyphNamesFunc) NULL, /* unsupported with CID fonts */ - (PS_GetFontPrivateFunc)NULL /* unsupported */ + (PS_GetFontPrivateFunc)NULL, /* unsupported */ + (PS_GetFontValueFunc) NULL /* not implemented */ }; @@ -110,13 +111,13 @@ if ( registry ) *registry = cid->registry; - + if ( ordering ) *ordering = cid->ordering; if ( supplement ) *supplement = cid->supplement; - + return CID_Err_Ok; } @@ -195,7 +196,7 @@ FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof( FT_DriverRec ), + sizeof ( FT_DriverRec ), "t1cid", /* module name */ 0x10000L, /* version 1.0 of driver */ 0x20000L, /* requires FreeType 2.0 */ @@ -208,9 +209,9 @@ }, /* then the other font drivers fields */ - sizeof( CID_FaceRec ), - sizeof( CID_SizeRec ), - sizeof( CID_GlyphSlotRec ), + sizeof ( CID_FaceRec ), + sizeof ( CID_SizeRec ), + sizeof ( CID_GlyphSlotRec ), cid_face_init, cid_face_done, Index: src/cid/cidriver.h =================================================================== --- src/cid/cidriver.h (revision 58178) +++ src/cid/cidriver.h (working copy) @@ -28,7 +28,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_CALLBACK_TABLE Index: src/gxvalid/gxvcommn.c =================================================================== --- src/gxvalid/gxvcommn.c (revision 58178) +++ src/gxvalid/gxvcommn.c (working copy) @@ -304,8 +304,7 @@ binSrchHeader->unitSize, binSrchHeader->nUnits, searchRange, entrySelector, rangeShift )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } } @@ -442,8 +441,7 @@ { GXV_TRACE(( "too short, glyphs %d - %d are missing\n", i, valid->face->num_glyphs )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); break; } @@ -531,8 +529,7 @@ GXV_TRACE(( "reverse ordered segment specification:" " lastGlyph[%d]=%d < lastGlyph[%d]=%d\n", unit, lastGlyph, unit - 1 , gid )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } if ( lastGlyph < firstGlyph ) @@ -540,8 +537,7 @@ GXV_TRACE(( "reverse ordered range specification at unit %d:", " lastGlyph %d < firstGlyph %d ", unit, lastGlyph, firstGlyph )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); if ( valid->root->level == FT_VALIDATE_TIGHT ) continue; /* ftxvalidator silently skips such an entry */ @@ -604,8 +600,7 @@ GXV_TRACE(( "reverse ordered segment specification:" " lastGlyph[%d]=%d < lastGlyph[%d]=%d\n", unit, lastGlyph, unit - 1 , gid )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } if ( lastGlyph < firstGlyph ) @@ -613,8 +608,7 @@ GXV_TRACE(( "reverse ordered range specification at unit %d:", " lastGlyph %d < firstGlyph %d ", unit, lastGlyph, firstGlyph )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); if ( valid->root->level == FT_VALIDATE_TIGHT ) continue; /* ftxvalidator silently skips such an entry */ @@ -705,8 +699,7 @@ { GXV_TRACE(( "current gid 0x%04x < previous gid 0x%04x\n", glyph, prev_glyph )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } prev_glyph = glyph; @@ -834,8 +827,7 @@ { GXV_TRACE(( " gxv_glyphid_check() gid overflow: num_glyphs %d < %d\n", face->num_glyphs, gid )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } return 0; @@ -1101,8 +1093,7 @@ if ( ( maxEntry + 1 ) * entrySize > *length_p ) { - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_TOO_SHORT; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_TOO_SHORT ); /* ftxvalidator and FontValidator both warn and continue */ maxEntry = (FT_Byte)( *length_p / entrySize - 1 ); @@ -1126,8 +1117,7 @@ { GXV_TRACE(( " newState offset 0x%04x is out of stateArray\n", newState )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); continue; } @@ -1135,8 +1125,7 @@ { GXV_TRACE(( " newState offset 0x%04x is not aligned to %d-classes\n", newState, 1 + maxClassID )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); continue; } @@ -1173,8 +1162,7 @@ break; default: - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_FORMAT; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT ); goto Exit; } @@ -1346,7 +1334,7 @@ l[1] = stateArray_length_p; l[2] = entryTable_length_p; - gxv_set_length_by_ulong_offset( o, l, buff, 4, table_size, valid ); + gxv_set_length_by_ulong_offset( o, l, buff, 3, table_size, valid ); } @@ -1503,8 +1491,7 @@ { GXV_TRACE(( " newState index 0x%04x points out of stateArray\n", newState_idx )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } state = (FT_UShort)( newState_idx / ( 1 + maxClassID ) ); @@ -1513,8 +1500,7 @@ FT_TRACE4(( "-> new state = %d (supposed)\n" "but newState index 0x%04x is not aligned to %d-classes\n", state, newState_idx, 1 + maxClassID )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } switch ( GXV_GLYPHOFFSET_FMT( xstatetable ) ) @@ -1548,8 +1534,7 @@ break; default: - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_FORMAT; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT ); goto Exit; } @@ -1719,9 +1704,9 @@ const FT_String* name, GXV_odtect_Range odtect ) { - odtect->range[ odtect->nRanges ].start = start; - odtect->range[ odtect->nRanges ].length = length; - odtect->range[ odtect->nRanges ].name = (FT_String*)name; + odtect->range[odtect->nRanges].start = start; + odtect->range[odtect->nRanges].length = length; + odtect->range[odtect->nRanges].name = (FT_String*)name; odtect->nRanges++; } Index: src/gxvalid/gxvcommn.h =================================================================== --- src/gxvalid/gxvcommn.h (revision 58178) +++ src/gxvalid/gxvcommn.h (working copy) @@ -4,7 +4,8 @@ /* */ /* TrueTypeGX/AAT common tables validation (specification). */ /* */ -/* Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ +/* Copyright 2004, 2005, 2012 */ +/* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -51,6 +52,19 @@ FT_BEGIN_HEADER + /* some variables are not evaluated or only used in trace */ + +#ifdef FT_DEBUG_LEVEL_TRACE +#define GXV_LOAD_TRACE_VARS +#else +#undef GXV_LOAD_TRACE_VARS +#endif + +#undef GXV_LOAD_UNUSED_VARS /* debug purpose */ + +#define IS_PARANOID_VALIDATION ( valid->root->level >= FT_VALIDATE_PARANOID ) +#define GXV_SET_ERR_IF_PARANOID( err ) { if ( IS_PARANOID_VALIDATION ) ( err ); } + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -234,6 +248,9 @@ GXV_Lookup_Fmt4_Transit_Func lookupfmt4_trans; FT_Bytes lookuptbl_head; + FT_UShort min_gid; + FT_UShort max_gid; + GXV_StateTable_ValidatorRec statetable; GXV_XStateTable_ValidatorRec xstatetable; @@ -300,7 +317,7 @@ #define GXV_32BIT_ALIGNMENT_VALIDATE( a ) \ FT_BEGIN_STMNT \ { \ - if ( 0 != ( (a) % 4 ) ) \ + if ( (a) & 3 ) \ FT_INVALID_OFFSET ; \ } \ FT_END_STMNT Index: src/gxvalid/gxverror.h =================================================================== --- src/gxvalid/gxverror.h (revision 58178) +++ src/gxvalid/gxverror.h (working copy) @@ -4,7 +4,8 @@ /* */ /* TrueTypeGX/AAT validation module error codes (specification only). */ /* */ -/* Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ +/* Copyright 2004, 2005, 2012 */ +/* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -38,6 +39,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX GXV_Err_ #define FT_ERR_BASE FT_Mod_Err_GXV Index: src/gxvalid/gxvfeat.c =================================================================== --- src/gxvalid/gxvfeat.c (revision 58178) +++ src/gxvalid/gxvfeat.c (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT feat table validation (body). */ /* */ -/* Copyright 2004, 2005, 2008 by */ +/* Copyright 2004, 2005, 2008, 2012 by */ /* suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ @@ -92,8 +92,7 @@ { GXV_TRACE(( "feature number %d is out of range %d\n", feature, gxv_feat_registry_length )); - if ( valid->root->level == FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); goto Exit; } @@ -101,8 +100,7 @@ { GXV_TRACE(( "feature number %d is in defined range but doesn't exist\n", feature )); - if ( valid->root->level == FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); goto Exit; } @@ -178,7 +176,7 @@ setting = FT_NEXT_USHORT( p ); /* If we have exclusive setting, the setting should be odd. */ - if ( exclusive && ( setting % 2 ) == 0 ) + if ( exclusive && ( setting & 1 ) == 0 ) FT_INVALID_DATA; gxv_feat_name_index_validate( p, limit, valid ); @@ -222,9 +220,8 @@ if ( settingTable < reserved_size ) FT_INVALID_OFFSET; - if ( valid->root->level == FT_VALIDATE_PARANOID && - ( featureFlags & GXV_FEAT_MASK_UNUSED ) == 0 ) - FT_INVALID_DATA; + if ( ( featureFlags & GXV_FEAT_MASK_UNUSED ) == 0 ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); exclusive = FT_BOOL( featureFlags & GXV_FEAT_MASK_EXCLUSIVE_SETTINGS ); if ( exclusive ) @@ -252,9 +249,8 @@ { gxv_feat_setting_validate( p, limit, exclusive, valid ); - if ( valid->root->level == FT_VALIDATE_PARANOID && - (FT_Int)GXV_FEAT_DATA( setting ) <= last_setting ) - FT_INVALID_FORMAT; + if ( (FT_Int)GXV_FEAT_DATA( setting ) <= last_setting ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT ); last_setting = (FT_Int)GXV_FEAT_DATA( setting ); /* setting + nameIndex */ @@ -312,8 +308,8 @@ featureNameCount = FT_NEXT_USHORT( p ); GXV_TRACE(( " (featureNameCount = %d)\n", featureNameCount )); - if ( valid->root->level != FT_VALIDATE_PARANOID ) - p += 6; /* skip (none) and (none) */ + if ( !( IS_PARANOID_VALIDATION ) ) + p += 6; /* skip (none) and (none) */ else { if ( FT_NEXT_USHORT( p ) != 0 ) @@ -329,9 +325,8 @@ { gxv_feat_name_validate( p, limit, valid ); - if ( valid->root->level == FT_VALIDATE_PARANOID && - (FT_Int)GXV_FEAT_DATA( feature ) <= last_feature ) - FT_INVALID_FORMAT; + if ( (FT_Int)GXV_FEAT_DATA( feature ) <= last_feature ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT ); last_feature = GXV_FEAT_DATA( feature ); p += 2 + 2 + 4 + 2 + 2; Index: src/gxvalid/gxvjust.c =================================================================== --- src/gxvalid/gxvjust.c (revision 58178) +++ src/gxvalid/gxvjust.c (working copy) @@ -65,31 +65,60 @@ #define GXV_JUST_DATA( a ) GXV_TABLE_DATA( just, a ) + /* GX just table does not define their subset of GID */ static void + gxv_just_check_max_gid( FT_UShort gid, + const FT_String* msg_tag, + GXV_Validator valid ) + { + if ( gid < valid->face->num_glyphs ) + return; + + GXV_TRACE(( "just table includes too large %s" + " GID=%d > %d (in maxp)\n", + msg_tag, gid, valid->face->num_glyphs )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); + } + + + static void gxv_just_wdp_entry_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) { FT_Bytes p = table; FT_ULong justClass; +#ifdef GXV_LOAD_UNUSED_VARS FT_Fixed beforeGrowLimit; FT_Fixed beforeShrinkGrowLimit; FT_Fixed afterGrowLimit; FT_Fixed afterShrinkGrowLimit; FT_UShort growFlags; FT_UShort shrinkFlags; +#endif GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 + 4 + 2 + 2 ); justClass = FT_NEXT_ULONG( p ); +#ifndef GXV_LOAD_UNUSED_VARS + p += 4 + 4 + 4 + 4 + 2 + 2; +#else beforeGrowLimit = FT_NEXT_ULONG( p ); beforeShrinkGrowLimit = FT_NEXT_ULONG( p ); afterGrowLimit = FT_NEXT_ULONG( p ); afterShrinkGrowLimit = FT_NEXT_ULONG( p ); growFlags = FT_NEXT_USHORT( p ); shrinkFlags = FT_NEXT_USHORT( p ); +#endif - /* TODO: decode flags for human readability */ + /* According to Apple spec, only 7bits in justClass is used */ + if ( ( justClass & 0xFFFFFF80 ) != 0 ) + { + GXV_TRACE(( "just table includes non-zero value" + " in unused justClass higher bits" + " of WidthDeltaPair" )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); + } valid->subtable_length = p - table; } @@ -153,8 +182,9 @@ FT_Fixed lowerLimit; FT_Fixed upperLimit; - +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort order; +#endif FT_UShort decomposedCount; FT_UInt i; @@ -163,9 +193,20 @@ GXV_LIMIT_CHECK( 4 + 4 + 2 + 2 ); lowerLimit = FT_NEXT_ULONG( p ); upperLimit = FT_NEXT_ULONG( p ); +#ifdef GXV_LOAD_UNUSED_VARS order = FT_NEXT_USHORT( p ); +#else + p += 2; +#endif decomposedCount = FT_NEXT_USHORT( p ); + if ( lowerLimit >= upperLimit ) + { + GXV_TRACE(( "just table includes invalid range spec:" + " lowerLimit(%d) > upperLimit(%d)\n" )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); + } + for ( i = 0; i < decomposedCount; i++ ) { FT_UShort glyphs; @@ -173,6 +214,7 @@ GXV_LIMIT_CHECK( 2 ); glyphs = FT_NEXT_USHORT( p ); + gxv_just_check_max_gid( glyphs, "type0:glyphs", valid ); } valid->subtable_length = p - table; @@ -191,6 +233,8 @@ GXV_LIMIT_CHECK( 2 ); addGlyph = FT_NEXT_USHORT( p ); + gxv_just_check_max_gid( addGlyph, "type1:addGlyph", valid ); + valid->subtable_length = p - table; } @@ -201,16 +245,27 @@ GXV_Validator valid ) { FT_Bytes p = table; +#ifdef GXV_LOAD_UNUSED_VARS FT_Fixed substThreshhold; /* Apple misspelled "Threshhold" */ +#endif FT_UShort addGlyph; FT_UShort substGlyph; GXV_LIMIT_CHECK( 4 + 2 + 2 ); +#ifdef GXV_LOAD_UNUSED_VARS substThreshhold = FT_NEXT_ULONG( p ); +#else + p += 4; +#endif addGlyph = FT_NEXT_USHORT( p ); substGlyph = FT_NEXT_USHORT( p ); + if ( addGlyph != 0xFFFF ) + gxv_just_check_max_gid( addGlyph, "type2:addGlyph", valid ); + + gxv_just_check_max_gid( substGlyph, "type2:substGlyph", valid ); + valid->subtable_length = p - table; } @@ -234,6 +289,21 @@ maximumLimit = FT_NEXT_ULONG( p ); valid->subtable_length = p - table; + + if ( variantsAxis != 0x64756374 ) /* 'duct' */ + GXV_TRACE(( "variantsAxis 0x%08x is non default value", + variantsAxis )); + + if ( minimumLimit > noStretchValue ) + GXV_TRACE(( "type4:minimumLimit 0x%08x > noStretchValue 0x%08x\n", + minimumLimit, noStretchValue )); + else if ( noStretchValue > maximumLimit ) + GXV_TRACE(( "type4:noStretchValue 0x%08x > maximumLimit 0x%08x\n", + noStretchValue, maximumLimit )); + else if ( !IS_PARANOID_VALIDATION ) + return; + + FT_INVALID_DATA; } @@ -251,6 +321,11 @@ flags = FT_NEXT_USHORT( p ); glyph = FT_NEXT_USHORT( p ); + if ( flags ) + GXV_TRACE(( "type5: nonzero value 0x%04x in unused flags\n", + flags )); + gxv_just_check_max_gid( glyph, "type5:glyph", valid ); + valid->subtable_length = p - table; } @@ -274,6 +349,10 @@ actionType = FT_NEXT_USHORT( p ); actionLength = FT_NEXT_ULONG( p ); + /* actionClass is related with justClass using 7bit only */ + if ( ( actionClass & 0xFF80 ) != 0 ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); + if ( actionType == 0 ) gxv_just_actSubrecord_type0_validate( p, limit, valid ); else if ( actionType == 1 ) @@ -389,10 +468,13 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_UNUSED_VARS + /* TODO: validate markClass & currentClass */ FT_UShort setMark; FT_UShort dontAdvance; FT_UShort markClass; FT_UShort currentClass; +#endif FT_UNUSED( state ); FT_UNUSED( glyphOffset_p ); @@ -400,13 +482,14 @@ FT_UNUSED( limit ); FT_UNUSED( valid ); - +#ifndef GXV_LOAD_UNUSED_VARS + FT_UNUSED( flags ); +#else setMark = (FT_UShort)( ( flags >> 15 ) & 1 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); markClass = (FT_UShort)( ( flags >> 7 ) & 0x7F ); currentClass = (FT_UShort)( flags & 0x7F ); - - /* TODO: validate markClass & currentClass */ +#endif } @@ -428,10 +511,16 @@ coverage = FT_NEXT_USHORT( p ); subFeatureFlags = FT_NEXT_ULONG( p ); - GXV_TRACE(( " justClassTable: coverage = 0x%04x (%s)", - coverage, - ( 0x4000 & coverage ) == 0 ? "ascending" : "descending" )); + GXV_TRACE(( " justClassTable: coverage = 0x%04x (%s) ", coverage )); + if ( ( coverage & 0x4000 ) == 0 ) + GXV_TRACE(( "ascending\n" )); + else + GXV_TRACE(( "descending\n" )); + if ( subFeatureFlags ) + GXV_TRACE(( " justClassTable: nonzero value (0x%08x)" + " in unused subFeatureFlags\n", subFeatureFlags )); + valid->statetable.optdata = NULL; valid->statetable.optdata_load_func = NULL; valid->statetable.subtable_setup_func = NULL; @@ -557,7 +646,6 @@ { FT_Bytes p = table; FT_Bytes limit = 0; - FT_Offset table_size; GXV_ValidatorRec validrec; GXV_Validator valid = &validrec; @@ -582,7 +670,6 @@ GXV_INIT; limit = valid->root->limit; - table_size = limit - table; GXV_LIMIT_CHECK( 4 + 2 + 2 + 2 ); version = FT_NEXT_ULONG( p ); Index: src/gxvalid/gxvkern.c =================================================================== --- src/gxvalid/gxvkern.c (revision 58178) +++ src/gxvalid/gxvkern.c (working copy) @@ -127,7 +127,9 @@ { FT_UShort gid_left; FT_UShort gid_right; +#ifdef GXV_LOAD_UNUSED_VARS FT_Short kernValue; +#endif /* left */ @@ -156,7 +158,11 @@ FT_INVALID_DATA; /* skip the kern value */ +#ifdef GXV_LOAD_UNUSED_VARS kernValue = FT_NEXT_SHORT( p ); +#else + p += 2; +#endif } GXV_EXIT; @@ -261,18 +267,24 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort push; FT_UShort dontAdvance; +#endif FT_UShort valueOffset; +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort kernAction; FT_UShort kernValue; +#endif FT_UNUSED( state ); FT_UNUSED( glyphOffset_p ); +#ifdef GXV_LOAD_UNUSED_VARS push = (FT_UShort)( ( flags >> 15 ) & 1 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); +#endif valueOffset = (FT_UShort)( flags & 0x3FFF ); { @@ -288,8 +300,12 @@ limit = table + vt_rec->valueTable + vt_rec->valueTable_length; GXV_LIMIT_CHECK( 2 + 2 ); +#ifdef GXV_LOAD_UNUSED_VARS kernAction = FT_NEXT_USHORT( p ); kernValue = FT_NEXT_USHORT( p ); +#else + p += 4; +#endif } } @@ -475,10 +491,12 @@ { GXV_TRACE(( "maxGID=%d, but glyphCount=%d\n", valid->face->num_glyphs, glyphCount )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } + if ( flags != 0 ) + GXV_TRACE(( "kern subtable fmt3 has nonzero value" + " (%d) in unused flag\n", flags )); /* * just skip kernValue[kernValueCount] */ @@ -545,20 +563,24 @@ GXV_Validator valid ) { /* new Apple-dialect */ +#ifdef GXV_LOAD_TRACE_VARS FT_Bool kernVertical; FT_Bool kernCrossStream; FT_Bool kernVariation; +#endif FT_UNUSED( valid ); /* reserved bits = 0 */ if ( coverage & 0x1FFC ) - return 0; + return FALSE; +#ifdef GXV_LOAD_TRACE_VARS kernVertical = FT_BOOL( ( coverage >> 15 ) & 1 ); kernCrossStream = FT_BOOL( ( coverage >> 14 ) & 1 ); kernVariation = FT_BOOL( ( coverage >> 13 ) & 1 ); +#endif *format = (FT_UShort)( coverage & 0x0003 ); @@ -568,7 +590,7 @@ GXV_TRACE(( "kerning values in Apple format subtable are ignored\n" )); - return 1; + return TRUE; } @@ -578,20 +600,24 @@ GXV_Validator valid ) { /* classic Apple-dialect */ +#ifdef GXV_LOAD_TRACE_VARS FT_Bool horizontal; FT_Bool cross_stream; +#endif /* check expected flags, but don't check if MS-dialect is impossible */ if ( !( coverage & 0xFD00 ) && KERN_ALLOWS_MS( valid ) ) - return 0; + return FALSE; /* reserved bits = 0 */ if ( coverage & 0x02FC ) - return 0; + return FALSE; +#ifdef GXV_LOAD_TRACE_VARS horizontal = FT_BOOL( ( coverage >> 15 ) & 1 ); cross_stream = FT_BOOL( ( coverage >> 13 ) & 1 ); +#endif *format = (FT_UShort)( coverage & 0x0003 ); @@ -601,11 +627,11 @@ /* format 1 requires GX State Machine, too new for classic */ if ( *format == 1 ) - return 0; + return FALSE; GXV_TRACE(( "kerning values in Apple format subtable are ignored\n" )); - return 1; + return TRUE; } @@ -615,22 +641,26 @@ GXV_Validator valid ) { /* classic Microsoft-dialect */ +#ifdef GXV_LOAD_TRACE_VARS FT_Bool horizontal; FT_Bool minimum; FT_Bool cross_stream; FT_Bool override; +#endif FT_UNUSED( valid ); /* reserved bits = 0 */ if ( coverage & 0xFDF0 ) - return 0; + return FALSE; +#ifdef GXV_LOAD_TRACE_VARS horizontal = FT_BOOL( coverage & 1 ); minimum = FT_BOOL( ( coverage >> 1 ) & 1 ); cross_stream = FT_BOOL( ( coverage >> 2 ) & 1 ); override = FT_BOOL( ( coverage >> 3 ) & 1 ); +#endif *format = (FT_UShort)( ( coverage >> 8 ) & 0x0003 ); @@ -643,7 +673,7 @@ GXV_TRACE(( "kerning values in Microsoft format 2 subtable are ignored\n" )); - return 1; + return TRUE; } @@ -714,10 +744,14 @@ GXV_Validator valid ) { FT_Bytes p = table; +#ifdef GXV_LOAD_TRACE_VARS FT_UShort version = 0; /* MS only: subtable version, unused */ +#endif FT_ULong length; /* MS: 16bit, Apple: 32bit*/ FT_UShort coverage; +#ifdef GXV_LOAD_TRACE_VARS FT_UShort tupleIndex = 0; /* Apple only */ +#endif FT_UShort u16[2]; FT_UShort format = 255; /* subtable format */ @@ -732,23 +766,35 @@ switch ( gxv_kern_coverage_validate( coverage, &format, valid ) ) { case KERN_DIALECT_MS: +#ifdef GXV_LOAD_TRACE_VARS version = u16[0]; +#endif length = u16[1]; +#ifdef GXV_LOAD_TRACE_VARS tupleIndex = 0; +#endif GXV_TRACE(( "Subtable version = %d\n", version )); GXV_TRACE(( "Subtable length = %d\n", length )); break; case KERN_DIALECT_APPLE: +#ifdef GXV_LOAD_TRACE_VARS version = 0; +#endif length = ( u16[0] << 16 ) + u16[1]; +#ifdef GXV_LOAD_TRACE_VARS tupleIndex = 0; +#endif GXV_TRACE(( "Subtable length = %d\n", length )); if ( KERN_IS_NEW( valid ) ) { GXV_LIMIT_CHECK( 2 ); +#ifdef GXV_LOAD_TRACE_VARS tupleIndex = FT_NEXT_USHORT( p ); +#else + p += 2; +#endif GXV_TRACE(( "Subtable tupleIndex = %d\n", tupleIndex )); } break; Index: src/gxvalid/gxvmod.c =================================================================== --- src/gxvalid/gxvmod.c (revision 58178) +++ src/gxvalid/gxvmod.c (working copy) @@ -269,7 +269,7 @@ const FT_Module_Class gxv_module_class = { 0, - sizeof( FT_ModuleRec ), + sizeof ( FT_ModuleRec ), "gxvalid", 0x10000L, 0x20000L, Index: src/gxvalid/gxvmod.h =================================================================== --- src/gxvalid/gxvmod.h (revision 58178) +++ src/gxvalid/gxvmod.h (working copy) @@ -36,7 +36,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Module_Class ) gxv_module_class; Index: src/gxvalid/gxvmort.c =================================================================== --- src/gxvalid/gxvmort.c (revision 58178) +++ src/gxvalid/gxvmort.c (working copy) @@ -47,16 +47,14 @@ GXV_TRACE(( "featureType %d is out of registered range, " "setting %d is unchecked\n", f->featureType, f->featureSetting )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } else if ( !gxv_feat_registry[f->featureType].existence ) { GXV_TRACE(( "featureType %d is within registered area " "but undefined, setting %d is unchecked\n", f->featureType, f->featureSetting )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } else { @@ -74,8 +72,7 @@ if ( f->featureSetting > nSettings_max ) { GXV_TRACE(( "out of defined range %d", nSettings_max )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } GXV_TRACE(( "\n" )); } @@ -176,7 +173,9 @@ { FT_UShort length; FT_UShort coverage; +#ifdef GXV_LOAD_UNUSED_VARS FT_ULong subFeatureFlags; +#endif FT_UInt type; FT_UInt rest; @@ -184,7 +183,11 @@ GXV_LIMIT_CHECK( 2 + 2 + 4 ); length = FT_NEXT_USHORT( p ); coverage = FT_NEXT_USHORT( p ); +#ifdef GXV_LOAD_UNUSED_VARS subFeatureFlags = FT_NEXT_ULONG( p ); +#else + p += 4; +#endif GXV_TRACE(( "validating chain subtable %d/%d (%d bytes)\n", i + 1, nSubtables, length )); @@ -204,6 +207,7 @@ func( p, p + rest, valid ); p += rest; + /* TODO: validate subFeatureFlags */ } valid->subtable_length = p - table; @@ -218,7 +222,9 @@ GXV_Validator valid ) { FT_Bytes p = table; +#ifdef GXV_LOAD_UNUSED_VARS FT_ULong defaultFlags; +#endif FT_ULong chainLength; FT_UShort nFeatureFlags; FT_UShort nSubtables; @@ -227,7 +233,11 @@ GXV_NAME_ENTER( "mort chain header" ); GXV_LIMIT_CHECK( 4 + 4 + 2 + 2 ); +#ifdef GXV_LOAD_UNUSED_VARS defaultFlags = FT_NEXT_ULONG( p ); +#else + p += 4; +#endif chainLength = FT_NEXT_ULONG( p ); nFeatureFlags = FT_NEXT_USHORT( p ); nSubtables = FT_NEXT_USHORT( p ); @@ -238,6 +248,7 @@ gxv_mort_subtables_validate( p, table + chainLength, nSubtables, valid ); valid->subtable_length = chainLength; + /* TODO: validate defaultFlags */ GXV_EXIT; } Index: src/gxvalid/gxvmort0.c =================================================================== --- src/gxvalid/gxvmort0.c (revision 58178) +++ src/gxvalid/gxvmort0.c (working copy) @@ -98,10 +98,24 @@ GXV_TRACE(( " %02d", verb )); GXV_TRACE(( " %s\n", GXV_Mort_IndicScript_Msg[verb] )); + if ( markFirst > 0 && markLast > 0 ) + { + GXV_TRACE(( " [odd] a glyph is marked as the first and last" + " in Indic rearrangement\n" )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); + } + + if ( markFirst > 0 && dontAdvance > 0 ) + { + GXV_TRACE(( " [odd] the first glyph is marked as dontAdvance" + " in Indic rearrangement\n" )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); + } + if ( 0 < reserved ) { GXV_TRACE(( " non-zero bits found in reserved range\n" )); - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } else GXV_TRACE(( "\n" )); Index: src/gxvalid/gxvmort1.c =================================================================== --- src/gxvalid/gxvmort1.c (revision 58178) +++ src/gxvalid/gxvmort1.c (working copy) @@ -106,8 +106,6 @@ { FT_UShort substTable; FT_UShort substTable_limit; - FT_UShort min_gid; - FT_UShort max_gid; FT_UNUSED( tag ); FT_UNUSED( state ); @@ -121,9 +119,10 @@ ((GXV_mort_subtable_type1_StateOptRec *) (valid->statetable.optdata))->substitutionTable_length ); - min_gid = (FT_UShort)( ( substTable - wordOffset * 2 ) / 2 ); - max_gid = (FT_UShort)( ( substTable_limit - wordOffset * 2 ) / 2 ); - max_gid = (FT_UShort)( FT_MAX( max_gid, valid->face->num_glyphs ) ); + valid->min_gid = (FT_UShort)( ( substTable - wordOffset * 2 ) / 2 ); + valid->max_gid = (FT_UShort)( ( substTable_limit - wordOffset * 2 ) / 2 ); + valid->max_gid = (FT_UShort)( FT_MAX( valid->max_gid, + valid->face->num_glyphs ) ); /* XXX: check range? */ @@ -140,8 +139,10 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort setMark; FT_UShort dontAdvance; +#endif FT_UShort reserved; FT_Short markOffset; FT_Short currentOffset; @@ -150,8 +151,10 @@ FT_UNUSED( limit ); +#ifdef GXV_LOAD_UNUSED_VARS setMark = (FT_UShort)( flags >> 15 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); +#endif reserved = (FT_Short)( flags & 0x3FFF ); markOffset = (FT_Short)( glyphOffset_p->ul >> 16 ); @@ -160,8 +163,7 @@ if ( 0 < reserved ) { GXV_TRACE(( " non-zero bits found in reserved range\n" )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } gxv_mort_subtable_type1_offset_to_subst_validate( markOffset, @@ -200,13 +202,12 @@ if ( dst_gid >= 0xFFFFU ) continue; - if ( dst_gid > valid->face->num_glyphs ) + if ( dst_gid < valid->min_gid || valid->max_gid < dst_gid ) { - GXV_TRACE(( "substTable include too large gid[%d]=%d >" - " max defined gid #%d\n", - i, dst_gid, valid->face->num_glyphs )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_GLYPH_ID; + GXV_TRACE(( "substTable include a strange gid[%d]=%d >" + " out of define range (%d..%d)\n", + i, dst_gid, valid->min_gid, valid->max_gid )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } } Index: src/gxvalid/gxvmort2.c =================================================================== --- src/gxvalid/gxvmort2.c (revision 58178) +++ src/gxvalid/gxvmort2.c (working copy) @@ -155,8 +155,7 @@ ligActionOffset, lat_base - p )); /* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */ - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } else if ( lat_limit < p ) { @@ -164,23 +163,46 @@ ligActionOffset, p - lat_limit )); /* FontValidator, ftxvalidator, ftxdumperfuser warn but continue */ - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_OFFSET; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } else { /* validate entry in ligActionTable */ FT_ULong lig_action; +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort last; FT_UShort store; +#endif FT_ULong offset; lig_action = FT_NEXT_ULONG( p ); +#ifdef GXV_LOAD_UNUSED_VARS last = (FT_UShort)( ( lig_action >> 31 ) & 1 ); store = (FT_UShort)( ( lig_action >> 30 ) & 1 ); +#endif + /* Apple spec defines this offset as a word offset */ offset = lig_action & 0x3FFFFFFFUL; + if ( offset * 2 < optdata->ligatureTable ) + { + GXV_TRACE(( "too short offset 0x%08x:" + " 2 x offset < ligatureTable (%d byte rewind)\n", + offset, optdata->ligatureTable - offset * 2 )); + + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); + } else if ( offset * 2 > + optdata->ligatureTable + optdata->ligatureTable_length ) + { + GXV_TRACE(( "too long offset 0x%08x:" + " 2 x offset > ligatureTable + ligatureTable_length" + " (%d byte overrun)\n", + offset, + optdata->ligatureTable + optdata->ligatureTable_length + - offset * 2 )); + + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); + } } } @@ -194,8 +216,10 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort setComponent; FT_UShort dontAdvance; +#endif FT_UShort offset; FT_UNUSED( state ); @@ -203,8 +227,10 @@ FT_UNUSED( limit ); +#ifdef GXV_LOAD_UNUSED_VARS setComponent = (FT_UShort)( ( flags >> 15 ) & 1 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); +#endif offset = (FT_UShort)( flags & 0x3FFFU ); @@ -237,6 +263,9 @@ GXV_LIMIT_CHECK( 2 ); lig_gid = FT_NEXT_USHORT( p ); + + if ( valid->face->num_glyphs < lig_gid ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } } GXV_EXIT; Index: src/gxvalid/gxvmort5.c =================================================================== --- src/gxvalid/gxvmort5.c (revision 58178) +++ src/gxvalid/gxvmort5.c (working copy) @@ -121,6 +121,9 @@ offset < optdata->entryTable + *(optdata->entryTable_length_p) ) GXV_TRACE(( " offset runs into EntryTable" )); +#ifndef GXV_LOAD_TRACE_VARS + GXV_LIMIT_CHECK( count * 2 ); +#else while ( p < table + offset + ( count * 2 ) ) { FT_UShort insert_glyphID; @@ -130,8 +133,8 @@ insert_glyphID = FT_NEXT_USHORT( p ); GXV_TRACE(( " 0x%04x", insert_glyphID )); } - GXV_TRACE(( "\n" )); +#endif } @@ -144,12 +147,14 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_UNUSED_VARS FT_Bool setMark; FT_Bool dontAdvance; FT_Bool currentIsKashidaLike; FT_Bool markedIsKashidaLike; FT_Bool currentInsertBefore; FT_Bool markedInsertBefore; +#endif FT_Byte currentInsertCount; FT_Byte markedInsertCount; FT_UShort currentInsertList; @@ -158,12 +163,14 @@ FT_UNUSED( state ); +#ifdef GXV_LOAD_UNUSED_VARS setMark = FT_BOOL( ( flags >> 15 ) & 1 ); dontAdvance = FT_BOOL( ( flags >> 14 ) & 1 ); currentIsKashidaLike = FT_BOOL( ( flags >> 13 ) & 1 ); markedIsKashidaLike = FT_BOOL( ( flags >> 12 ) & 1 ); currentInsertBefore = FT_BOOL( ( flags >> 11 ) & 1 ); markedInsertBefore = FT_BOOL( ( flags >> 10 ) & 1 ); +#endif currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F ); markedInsertCount = (FT_Byte)( flags & 0x001F ); Index: src/gxvalid/gxvmorx.c =================================================================== --- src/gxvalid/gxvmorx.c (revision 58178) +++ src/gxvalid/gxvmorx.c (working copy) @@ -68,7 +68,9 @@ { FT_ULong length; FT_ULong coverage; +#ifdef GXV_LOAD_UNUSED_VARS FT_ULong subFeatureFlags; +#endif FT_ULong type; FT_ULong rest; @@ -76,7 +78,11 @@ GXV_LIMIT_CHECK( 4 + 4 + 4 ); length = FT_NEXT_ULONG( p ); coverage = FT_NEXT_ULONG( p ); +#ifdef GXV_LOAD_UNUSED_VARS subFeatureFlags = FT_NEXT_ULONG( p ); +#else + p += 4; +#endif GXV_TRACE(( "validating chain subtable %d/%d (%d bytes)\n", i + 1, nSubtables, length )); @@ -97,6 +103,7 @@ func( p, p + rest, valid ); + /* TODO: subFeatureFlags should be unique in a table? */ p += rest; } @@ -112,7 +119,9 @@ GXV_Validator valid ) { FT_Bytes p = table; +#ifdef GXV_LOAD_UNUSED_VARS FT_ULong defaultFlags; +#endif FT_ULong chainLength; FT_ULong nFeatureFlags; FT_ULong nSubtables; @@ -121,7 +130,11 @@ GXV_NAME_ENTER( "morx chain header" ); GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 ); +#ifdef GXV_LOAD_UNUSED_VARS defaultFlags = FT_NEXT_ULONG( p ); +#else + p += 4; +#endif chainLength = FT_NEXT_ULONG( p ); nFeatureFlags = FT_NEXT_ULONG( p ); nSubtables = FT_NEXT_ULONG( p ); @@ -138,6 +151,8 @@ valid->subtable_length = chainLength; + /* TODO: defaultFlags should be compared with the flags in tables */ + GXV_EXIT; } Index: src/gxvalid/gxvmorx0.c =================================================================== --- src/gxvalid/gxvmorx0.c (revision 58178) +++ src/gxvalid/gxvmorx0.c (working copy) @@ -47,11 +47,15 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort markFirst; FT_UShort dontAdvance; FT_UShort markLast; +#endif FT_UShort reserved; +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort verb; +#endif FT_UNUSED( state ); FT_UNUSED( glyphOffset_p ); @@ -59,12 +63,16 @@ FT_UNUSED( limit ); +#ifdef GXV_LOAD_UNUSED_VARS markFirst = (FT_UShort)( ( flags >> 15 ) & 1 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); markLast = (FT_UShort)( ( flags >> 13 ) & 1 ); +#endif reserved = (FT_UShort)( flags & 0x1FF0 ); +#ifdef GXV_LOAD_UNUSED_VARS verb = (FT_UShort)( flags & 0x000F ); +#endif if ( 0 < reserved ) { Index: src/gxvalid/gxvmorx1.c =================================================================== --- src/gxvalid/gxvmorx1.c (revision 58178) +++ src/gxvalid/gxvmorx1.c (working copy) @@ -108,8 +108,10 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_TRACE_VARS FT_UShort setMark; FT_UShort dontAdvance; +#endif FT_UShort reserved; FT_Short markIndex; FT_Short currentIndex; @@ -122,8 +124,10 @@ FT_UNUSED( limit ); +#ifdef GXV_LOAD_TRACE_VARS setMark = (FT_UShort)( ( flags >> 15 ) & 1 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); +#endif reserved = (FT_UShort)( flags & 0x3FFF ); @@ -136,8 +140,7 @@ if ( 0 < reserved ) { GXV_TRACE(( " non-zero bits found in reserved range\n" )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } GXV_TRACE(( "markIndex = %d, currentIndex = %d\n", Index: src/gxvalid/gxvmorx2.c =================================================================== --- src/gxvalid/gxvmorx2.c (revision 58178) +++ src/gxvalid/gxvmorx2.c (working copy) @@ -168,16 +168,52 @@ { /* validate entry in ligActionTable */ FT_ULong lig_action; +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort last; FT_UShort store; +#endif FT_ULong offset; + FT_Long gid_limit; lig_action = FT_NEXT_ULONG( p ); +#ifdef GXV_LOAD_UNUSED_VARS last = (FT_UShort)( ( lig_action >> 31 ) & 1 ); store = (FT_UShort)( ( lig_action >> 30 ) & 1 ); +#endif offset = lig_action & 0x3FFFFFFFUL; + + /* this offset is 30-bit signed value to add to GID */ + /* it is different from the location offset in mort */ + if ( ( offset & 0x3FFF0000UL ) == 0x3FFF0000UL ) + { /* negative offset */ + gid_limit = valid->face->num_glyphs - ( offset & 0x0000FFFFUL ); + if ( gid_limit > 0 ) + return; + + GXV_TRACE(( "ligature action table includes" + " too negative offset moving all GID" + " below defined range: 0x%04x\n", + offset & 0xFFFFU )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); + } + else if ( ( offset & 0x3FFF0000UL ) == 0x0000000UL ) + { /* positive offset */ + if ( (FT_Long)offset < valid->face->num_glyphs ) + return; + + GXV_TRACE(( "ligature action table includes" + " too large offset moving all GID" + " over defined range: 0x%04x\n", + offset & 0xFFFFU )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); + } + + GXV_TRACE(( "ligature action table includes" + " invalid offset to add to 16-bit GID:" + " 0x%08x\n", offset )); + GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET ); } } @@ -191,9 +227,11 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_UNUSED_VARS FT_UShort setComponent; FT_UShort dontAdvance; FT_UShort performAction; +#endif FT_UShort reserved; FT_UShort ligActionIndex; @@ -201,9 +239,11 @@ FT_UNUSED( limit ); +#ifdef GXV_LOAD_UNUSED_VARS setComponent = (FT_UShort)( ( flags >> 15 ) & 1 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); performAction = (FT_UShort)( ( flags >> 13 ) & 1 ); +#endif reserved = (FT_UShort)( flags & 0x1FFF ); ligActionIndex = glyphOffset_p->u; @@ -241,6 +281,8 @@ GXV_LIMIT_CHECK( 2 ); lig_gid = FT_NEXT_USHORT( p ); + if ( lig_gid < valid->face->num_glyphs ) + GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID ); } } Index: src/gxvalid/gxvmorx5.c =================================================================== --- src/gxvalid/gxvmorx5.c (revision 58178) +++ src/gxvalid/gxvmorx5.c (working copy) @@ -118,6 +118,9 @@ FT_Bytes p = table + table_index * 2; +#ifndef GXV_LOAD_TRACE_VARS + GXV_LIMIT_CHECK( count * 2 ); +#else while ( p < table + count * 2 + table_index * 2 ) { FT_UShort insert_glyphID; @@ -129,6 +132,7 @@ } GXV_TRACE(( "\n" )); +#endif } @@ -141,12 +145,14 @@ FT_Bytes limit, GXV_Validator valid ) { +#ifdef GXV_LOAD_UNUSED_VARS FT_Bool setMark; FT_Bool dontAdvance; FT_Bool currentIsKashidaLike; FT_Bool markedIsKashidaLike; FT_Bool currentInsertBefore; FT_Bool markedInsertBefore; +#endif FT_Byte currentInsertCount; FT_Byte markedInsertCount; FT_Byte currentInsertList; @@ -155,12 +161,14 @@ FT_UNUSED( state ); +#ifdef GXV_LOAD_UNUSED_VARS setMark = FT_BOOL( ( flags >> 15 ) & 1 ); dontAdvance = FT_BOOL( ( flags >> 14 ) & 1 ); currentIsKashidaLike = FT_BOOL( ( flags >> 13 ) & 1 ); markedIsKashidaLike = FT_BOOL( ( flags >> 12 ) & 1 ); currentInsertBefore = FT_BOOL( ( flags >> 11 ) & 1 ); markedInsertBefore = FT_BOOL( ( flags >> 10 ) & 1 ); +#endif currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F ); markedInsertCount = (FT_Byte)( flags & 0x001F ); Index: src/gxvalid/gxvprop.c =================================================================== --- src/gxvalid/gxvprop.c (revision 58178) +++ src/gxvalid/gxvprop.c (working copy) @@ -96,7 +96,10 @@ if ( glyph->advance.x != (FT_Pos)0 || glyph->advance.y != (FT_Pos)0 ) + { + GXV_TRACE(( " found non-zero advance in zero-advance glyph\n" )); FT_INVALID_DATA; + } GXV_EXIT; } @@ -119,7 +122,10 @@ offset = (FT_UShort)( property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET ); if ( offset == 0 ) - FT_INVALID_DATA; + { + GXV_TRACE(( " found zero offset to property\n" )); + FT_INVALID_OFFSET; + } complement = (char)( offset >> 8 ); if ( complement & 0x08 ) @@ -131,7 +137,10 @@ /* The gid for complement must be greater than 0 */ if ( glyph <= complement ) + { + GXV_TRACE(( " found non-positive glyph complement\n" )); FT_INVALID_DATA; + } } else { @@ -150,18 +159,27 @@ if ( property & GXV_PROP_ATTACHING_TO_RIGHT ) { if ( GXV_PROP_DATA( version ) == 0x00010000UL ) + { + GXV_TRACE(( " found older version (1.0) in new version table\n" )); FT_INVALID_DATA; + } } if ( property & GXV_PROP_RESERVED ) + { + GXV_TRACE(( " found non-zero bits in reserved bits\n" )); FT_INVALID_DATA; + } if ( ( property & GXV_PROP_DIRECTIONALITY_CLASS ) > 11 ) { /* TODO: Too restricted. Use the validation level. */ if ( GXV_PROP_DATA( version ) == 0x00010000UL || GXV_PROP_DATA( version ) == 0x00020000UL ) + { + GXV_TRACE(( " found too old version in directionality class\n" )); FT_INVALID_DATA; + } } } @@ -215,7 +233,7 @@ /* XXX: check range? */ offset = (FT_UShort)( base_value_p->u + - relative_gindex * sizeof( FT_UShort ) ); + relative_gindex * sizeof ( FT_UShort ) ); p = valid->lookuptbl_head + offset; limit = lookuptbl_limit; @@ -264,16 +282,26 @@ format = FT_NEXT_USHORT( p ); defaultProp = FT_NEXT_USHORT( p ); + GXV_TRACE(( " version 0x%08x\n", version )); + GXV_TRACE(( " format 0x%04x\n", format )); + GXV_TRACE(( " defaultProp 0x%04x\n", defaultProp )); + /* only versions 1.0, 2.0, 3.0 are defined (1996) */ if ( version != 0x00010000UL && version != 0x00020000UL && version != 0x00030000UL ) + { + GXV_TRACE(( " found unknown version\n" )); FT_INVALID_FORMAT; + } /* only formats 0x0000, 0x0001 are defined (1996) */ if ( format > 1 ) + { + GXV_TRACE(( " found unknown format\n" )); FT_INVALID_FORMAT; + } gxv_prop_property_validate( defaultProp, 0, valid ); Index: src/gxvalid/gxvtrak.c =================================================================== --- src/gxvalid/gxvtrak.c (revision 58178) +++ src/gxvalid/gxvtrak.c (working copy) @@ -97,10 +97,10 @@ { FT_Bytes p = table; - FT_Fixed track; + FT_Fixed track, t; FT_UShort nameIndex; FT_UShort offset; - FT_UShort i; + FT_UShort i, j; GXV_NAME_ENTER( "trackTable" ); @@ -108,9 +108,11 @@ GXV_TRAK_DATA( trackValueOffset_min ) = 0xFFFFU; GXV_TRAK_DATA( trackValueOffset_max ) = 0x0000; + GXV_LIMIT_CHECK( nTracks * ( 4 + 2 + 2 ) ); + for ( i = 0; i < nTracks; i ++ ) { - GXV_LIMIT_CHECK( 4 + 2 + 2 ); + p = table + i * ( 4 + 2 + 2 ); track = FT_NEXT_LONG( p ); nameIndex = FT_NEXT_USHORT( p ); offset = FT_NEXT_USHORT( p ); @@ -121,6 +123,15 @@ GXV_TRAK_DATA( trackValueOffset_max ) = offset; gxv_sfntName_validate( nameIndex, 256, 32767, valid ); + + for ( j = i; j < nTracks; j ++ ) + { + p = table + j * ( 4 + 2 + 2 ); + t = FT_NEXT_LONG( p ); + if ( t == track ) + GXV_TRACE(( "duplicated entries found for track value 0x%x\n", + track )); + } } valid->subtable_length = p - table; @@ -198,7 +209,6 @@ { FT_Bytes p = table; FT_Bytes limit = 0; - FT_Offset table_size; GXV_ValidatorRec validrec; GXV_Validator valid = &validrec; @@ -220,7 +230,6 @@ valid->face = face; limit = valid->root->limit; - table_size = limit - table; FT_TRACE3(( "validating `trak' table\n" )); GXV_INIT; Index: src/gzip/ftgzip.c =================================================================== --- src/gzip/ftgzip.c (revision 58178) +++ src/gzip/ftgzip.c (working copy) @@ -8,7 +8,7 @@ /* parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2009, 2010 by */ +/* Copyright 2002-2006, 2009-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,6 +32,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX Gzip_Err_ #define FT_ERR_BASE FT_Mod_Err_Gzip @@ -42,7 +43,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "gzip code does not support PIC yet" -#endif +#endif #ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB @@ -571,7 +572,7 @@ old_pos = stream->pos; if ( !FT_Stream_Seek( stream, stream->size - 4 ) ) { - result = (FT_ULong)FT_Stream_ReadLong( stream, &error ); + result = FT_Stream_ReadULong( stream, &error ); if ( error ) result = 0; @@ -588,7 +589,7 @@ { FT_Error error; FT_Memory memory = source->memory; - FT_GZipFile zip; + FT_GZipFile zip = NULL; /* @@ -628,7 +629,7 @@ if ( zip_size != 0 && zip_size < 40 * 1024 ) { - FT_Byte* zip_buff; + FT_Byte* zip_buff = NULL; if ( !FT_ALLOC( zip_buff, zip_size ) ) Index: src/lzw/ftlzw.c =================================================================== --- src/lzw/ftlzw.c (revision 58178) +++ src/lzw/ftlzw.c (working copy) @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2004, 2005, 2006, 2009, 2010 by */ +/* Copyright 2004-2006, 2009, 2010, 2012 by */ /* Albert Chin-A-Young. */ /* */ /* Based on code in src/gzip/ftgzip.c, Copyright 2004 by */ @@ -34,6 +34,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX LZW_Err_ #define FT_ERR_BASE FT_Mod_Err_LZW @@ -44,7 +45,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "lzw code does not support PIC yet" -#endif +#endif #include "ftzopen.h" @@ -349,7 +350,7 @@ { FT_Error error; FT_Memory memory = source->memory; - FT_LZWFile zip; + FT_LZWFile zip = NULL; /* Index: src/lzw/ftzopen.c =================================================================== --- src/lzw/ftzopen.c (revision 58178) +++ src/lzw/ftzopen.c (working copy) @@ -8,7 +8,7 @@ /* be used to parse compressed PCF fonts, as found with many X11 server */ /* distributions. */ /* */ -/* Copyright 2005, 2006, 2007, 2009 by David Turner. */ +/* Copyright 2005-2007, 2009, 2011 by David Turner. */ /* */ /* This file is part of the FreeType project, and may only be used, */ /* modified, and distributed under the terms of the FreeType project */ @@ -124,6 +124,15 @@ old_size = 0; } + /* requirement of the character stack larger than 1<<LZW_MAX_BITS */ + /* implies bug in the decompression code */ + if ( new_size > ( 1 << LZW_MAX_BITS ) ) + { + new_size = 1 << LZW_MAX_BITS; + if ( new_size == old_size ) + return -1; + } + if ( FT_RENEW_ARRAY( state->stack, old_size, new_size ) ) return -1; @@ -279,7 +288,7 @@ : state->max_free + 1; c = ft_lzwstate_get_code( state ); - if ( c < 0 ) + if ( c < 0 || c > 255 ) goto Eof; old_code = old_char = (FT_UInt)c; @@ -312,11 +321,12 @@ /* why not LZW_FIRST-256 ? */ state->free_ent = ( LZW_FIRST - 1 ) - 256; state->buf_clear = 1; - c = ft_lzwstate_get_code( state ); - if ( c < 0 ) - goto Eof; - code = (FT_UInt)c; + /* not quite right, but at least more predictable */ + old_code = 0; + old_char = 0; + + goto NextCode; } in_code = code; /* save code for later */ @@ -326,6 +336,10 @@ /* special case for KwKwKwK */ if ( code - 256U >= state->free_ent ) { + /* corrupted LZW stream */ + if ( code - 256U > state->free_ent ) + goto Eof; + FTLZW_STACK_PUSH( old_char ); code = old_code; } Index: src/otvalid/otverror.h =================================================================== --- src/otvalid/otverror.h (revision 58178) +++ src/otvalid/otverror.h (working copy) @@ -4,7 +4,7 @@ /* */ /* OpenType validation module error codes (specification only). */ /* */ -/* Copyright 2004, 2005 by */ +/* Copyright 2004, 2005, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX OTV_Err_ #define FT_ERR_BASE FT_Mod_Err_OTvalid Index: src/otvalid/otvmod.c =================================================================== --- src/otvalid/otvmod.c (revision 58178) +++ src/otvalid/otvmod.c (working copy) @@ -266,7 +266,7 @@ const FT_Module_Class otv_module_class = { 0, - sizeof( FT_ModuleRec ), + sizeof ( FT_ModuleRec ), "otvalid", 0x10000L, 0x20000L, Index: src/otvalid/otvmod.h =================================================================== --- src/otvalid/otvmod.h (revision 58178) +++ src/otvalid/otvmod.h (working copy) @@ -29,7 +29,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Module_Class ) otv_module_class; Index: src/pcf/pcf.h =================================================================== --- src/pcf/pcf.h (revision 58178) +++ src/pcf/pcf.h (working copy) @@ -2,7 +2,7 @@ FreeType font driver for pcf fonts - Copyright (C) 2000, 2001, 2002, 2003, 2006 by + Copyright (C) 2000, 2001, 2002, 2003, 2006, 2010 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -136,8 +136,8 @@ { FT_FaceRec root; - FT_StreamRec gzip_stream; - FT_Stream gzip_source; + FT_StreamRec comp_stream; + FT_Stream comp_source; char* charset_encoding; char* charset_registry; Index: src/pcf/pcfdrivr.c =================================================================== --- src/pcf/pcfdrivr.c (revision 58178) +++ src/pcf/pcfdrivr.c (working copy) @@ -2,7 +2,7 @@ FreeType font driver for pcf files - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by + Copyright (C) 2000-2004, 2006-2011 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -32,9 +32,10 @@ #include FT_INTERNAL_OBJECTS_H #include FT_GZIP_H #include FT_LZW_H +#include FT_BZIP2_H #include FT_ERRORS_H #include FT_BDF_H -#include FT_TRUETYPE_IDS_H +#include FT_TRUETYPE_IDS_H #include "pcf.h" #include "pcfdrivr.h" @@ -246,13 +247,11 @@ FT_FREE( face->charset_encoding ); FT_FREE( face->charset_registry ); - FT_TRACE4(( "PCF_Face_Done: done face\n" )); - - /* close gzip/LZW stream if any */ - if ( pcfface->stream == &face->gzip_stream ) + /* close compressed stream if any */ + if ( pcfface->stream == &face->comp_stream ) { - FT_Stream_Close( &face->gzip_stream ); - pcfface->stream = face->gzip_source; + FT_Stream_Close( &face->comp_stream ); + pcfface->stream = face->comp_source; } } @@ -272,13 +271,16 @@ FT_UNUSED( face_index ); + FT_TRACE2(( "PCF driver\n" )); + error = pcf_load_font( stream, face ); if ( error ) { PCF_Face_Done( pcfface ); -#if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \ - defined( FT_CONFIG_OPTION_USE_LZW ) +#if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \ + defined( FT_CONFIG_OPTION_USE_LZW ) || \ + defined( FT_CONFIG_OPTION_USE_BZIP2 ) #ifdef FT_CONFIG_OPTION_USE_ZLIB { @@ -286,7 +288,7 @@ /* this didn't work, try gzip support! */ - error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream ); + error2 = FT_Stream_OpenGzip( &face->comp_stream, stream ); if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature ) goto Fail; @@ -301,7 +303,7 @@ /* this didn't work, try LZW support! */ - error3 = FT_Stream_OpenLZW( &face->gzip_stream, stream ); + error3 = FT_Stream_OpenLZW( &face->comp_stream, stream ); if ( FT_ERROR_BASE( error3 ) == FT_Err_Unimplemented_Feature ) goto Fail; @@ -309,11 +311,26 @@ } #endif /* FT_CONFIG_OPTION_USE_LZW */ +#ifdef FT_CONFIG_OPTION_USE_BZIP2 if ( error ) + { + FT_Error error4; + + + /* this didn't work, try Bzip2 support! */ + error4 = FT_Stream_OpenBzip2( &face->comp_stream, stream ); + if ( FT_ERROR_BASE( error4 ) == FT_Err_Unimplemented_Feature ) + goto Fail; + + error = error4; + } +#endif /* FT_CONFIG_OPTION_USE_BZIP2 */ + + if ( error ) goto Fail; - face->gzip_source = stream; - pcfface->stream = &face->gzip_stream; + face->comp_source = stream; + pcfface->stream = &face->comp_stream; stream = pcfface->stream; @@ -321,7 +338,9 @@ if ( error ) goto Fail; -#else /* !(FT_CONFIG_OPTION_USE_ZLIB || FT_CONFIG_OPTION_USE_LZW) */ +#else /* !(FT_CONFIG_OPTION_USE_ZLIB || + FT_CONFIG_OPTION_USE_LZW || + FT_CONFIG_OPTION_USE_BZIP2) */ goto Fail; @@ -385,7 +404,7 @@ return error; Fail: - FT_TRACE2(( "[not a valid PCF file]\n" )); + FT_TRACE2(( " not a PCF file\n" )); PCF_Face_Done( pcfface ); error = PCF_Err_Unknown_File_Format; /* error */ goto Exit; @@ -664,8 +683,8 @@ 0, - 0, - 0, + 0, /* FT_Module_Constructor */ + 0, /* FT_Module_Destructor */ pcf_driver_requester }, Index: src/pcf/pcfdrivr.h =================================================================== --- src/pcf/pcfdrivr.h (revision 58178) +++ src/pcf/pcfdrivr.h (working copy) @@ -35,7 +35,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Driver_ClassRec ) pcf_driver_class; Index: src/pcf/pcferror.h =================================================================== --- src/pcf/pcferror.h (revision 58178) +++ src/pcf/pcferror.h (working copy) @@ -4,7 +4,7 @@ /* */ /* PCF error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX PCF_Err_ #define FT_ERR_BASE FT_Mod_Err_PCF Index: src/pcf/pcfread.c =================================================================== --- src/pcf/pcfread.c (revision 58178) +++ src/pcf/pcfread.c (working copy) @@ -2,8 +2,7 @@ FreeType font driver for pcf fonts - Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010 by + Copyright 2000-2010, 2012 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -399,7 +398,7 @@ PCF_Face face ) { PCF_ParseProperty props = 0; - PCF_Property properties; + PCF_Property properties = NULL; FT_ULong nprops, i; FT_ULong format, size; FT_Error error; @@ -496,7 +495,8 @@ goto Bail; } - if ( FT_NEW_ARRAY( strings, string_size ) ) + /* allocate one more byte so that we have a final null byte */ + if ( FT_NEW_ARRAY( strings, string_size + 1 ) ) goto Bail; error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size ); @@ -663,9 +663,9 @@ pcf_get_bitmaps( FT_Stream stream, PCF_Face face ) { - FT_Error error = PCF_Err_Ok; - FT_Memory memory = FT_FACE(face)->memory; - FT_Long* offsets; + FT_Error error = PCF_Err_Ok; + FT_Memory memory = FT_FACE(face)->memory; + FT_Long* offsets = NULL; FT_Long bitmapSizes[GLYPHPADOPTIONS]; FT_ULong format, size; FT_ULong nbitmaps, i, sizebitmaps = 0; @@ -772,7 +772,7 @@ int firstRow, lastRow; int nencoding, encodingOffset; int i, j; - PCF_Encoding tmpEncoding, encoding = 0; + PCF_Encoding tmpEncoding = NULL, encoding = 0; error = pcf_seek_to_table_type( stream, Index: src/pcf/README =================================================================== --- src/pcf/README (revision 58178) +++ src/pcf/README (working copy) @@ -31,31 +31,13 @@ Encodings ********* -The variety of encodings that accompanies pcf fonts appears to encompass the -small set defined in freetype.h. On the other hand, each pcf font defines -two properties that specify encoding and registry. +Use `FT_Get_BDF_Charset_ID' to access the encoding and registry. -I decided to make these two properties directly accessible, leaving to the -client application the work of interpreting them. For instance: +The driver always exports `ft_encoding_none' as face->charmap.encoding. +FT_Get_Char_Index() behavior is unmodified, that is, it converts the ULong +value given as argument into the corresponding glyph number. - #include "pcftypes.h" /* include/freetype/internal/pcftypes.h */ - FT_Face face; - PCF_Public_Face pcfface; - - FT_New_Face( library,..., &face ); - - pcfface = (PCF_Public_Face)face; - - if ((pcfface->charset_registry == "ISO10646") && - (pcfface->charset_encoding) == "1")) [..] - -Thus the driver always export `ft_encoding_none' as -face->charmap.encoding. FT_Get_Char_Index() behavior is unmodified, that -is, it converts the ULong value given as argument into the corresponding -glyph number. - - Known problems ************** Index: src/pfr/pfrdrivr.c =================================================================== --- src/pfr/pfrdrivr.c (revision 58178) +++ src/pfr/pfrdrivr.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType PFR driver interface (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2006, 2008, 2010 by */ +/* Copyright 2002-2004, 2006, 2008, 2010, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -173,7 +173,7 @@ FT_MODULE_FONT_DRIVER | FT_MODULE_DRIVER_SCALABLE, - sizeof( FT_DriverRec ), + sizeof ( FT_DriverRec ), "pfr", 0x10000L, @@ -181,14 +181,14 @@ NULL, - 0, - 0, + 0, /* FT_Module_Constructor */ + 0, /* FT_Module_Destructor */ pfr_get_service }, - sizeof( PFR_FaceRec ), - sizeof( PFR_SizeRec ), - sizeof( PFR_SlotRec ), + sizeof ( PFR_FaceRec ), + sizeof ( PFR_SizeRec ), + sizeof ( PFR_SlotRec ), pfr_face_init, pfr_face_done, @@ -205,9 +205,9 @@ pfr_get_kerning, 0, /* FT_Face_AttachFunc */ - 0, /* FT_Face_GetAdvancesFunc */ - 0, /* FT_Size_RequestFunc */ - 0, /* FT_Size_SelectFunc */ + 0, /* FT_Face_GetAdvancesFunc */ + 0, /* FT_Size_RequestFunc */ + 0, /* FT_Size_SelectFunc */ }; Index: src/pfr/pfrdrivr.h =================================================================== --- src/pfr/pfrdrivr.h (revision 58178) +++ src/pfr/pfrdrivr.h (working copy) @@ -28,7 +28,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Driver_ClassRec ) pfr_driver_class; Index: src/pfr/pfrerror.h =================================================================== --- src/pfr/pfrerror.h (revision 58178) +++ src/pfr/pfrerror.h (working copy) @@ -4,7 +4,7 @@ /* */ /* PFR error codes (specification only). */ /* */ -/* Copyright 2002 by */ +/* Copyright 2002, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX PFR_Err_ #define FT_ERR_BASE FT_Mod_Err_PFR Index: src/pfr/pfrload.c =================================================================== --- src/pfr/pfrload.c (revision 58178) +++ src/pfr/pfrload.c (working copy) @@ -476,7 +476,7 @@ PFR_PhyFont phy_font ) { FT_UInt count, num_vert, num_horz; - FT_Int* snaps; + FT_Int* snaps = NULL; FT_Error error = PFR_Err_Ok; FT_Memory memory = phy_font->memory; Index: src/pfr/pfrobjs.c =================================================================== --- src/pfr/pfrobjs.c (revision 58178) +++ src/pfr/pfrobjs.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType PFR object methods (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* Copyright 2002-2008, 2010-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -23,7 +23,7 @@ #include "pfrsbit.h" #include FT_OUTLINE_H #include FT_INTERNAL_DEBUG_H -#include FT_TRUETYPE_IDS_H +#include FT_TRUETYPE_IDS_H #include "pfrerror.h" @@ -77,6 +77,8 @@ FT_UNUSED( params ); + FT_TRACE2(( "PFR driver\n" )); + /* load the header and check it */ error = pfr_header_load( &face->header, stream ); if ( error ) @@ -84,7 +86,7 @@ if ( !pfr_header_check( &face->header ) ) { - FT_TRACE4(( "pfr_face_init: not a valid PFR font\n" )); + FT_TRACE2(( " not a PFR font\n" )); error = PFR_Err_Unknown_File_Format; goto Exit; } Index: src/psaux/afmparse.c =================================================================== --- src/psaux/afmparse.c (revision 58178) +++ src/psaux/afmparse.c (working copy) @@ -4,7 +4,7 @@ /* */ /* AFM parser (body). */ /* */ -/* Copyright 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2006-2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -631,9 +631,6 @@ tk->max_ptsize = shared_vals[3].u.f; tk->max_kern = shared_vals[4].u.f; - /* is this correct? */ - if ( tk->degree < 0 && tk->min_kern > 0 ) - tk->min_kern = -tk->min_kern; break; case AFM_TOKEN_ENDTRACKKERN: @@ -754,7 +751,7 @@ case AFM_TOKEN_ENDFONTMETRICS: fi->NumKernPair = n + 1; ft_qsort( fi->KernPairs, fi->NumKernPair, - sizeof( AFM_KernPairRec ), + sizeof ( AFM_KernPairRec ), afm_compare_kern_pairs ); return PSaux_Err_Ok; Index: src/psaux/psauxerr.h =================================================================== --- src/psaux/psauxerr.h (revision 58178) +++ src/psaux/psauxerr.h (working copy) @@ -4,7 +4,7 @@ /* */ /* PS auxiliary module error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX PSaux_Err_ #define FT_ERR_BASE FT_Mod_Err_PSaux Index: src/psaux/psauxmod.c =================================================================== --- src/psaux/psauxmod.c (revision 58178) +++ src/psaux/psauxmod.c (working copy) @@ -123,7 +123,7 @@ const FT_Module_Class psaux_module_class = { 0, - sizeof( FT_ModuleRec ), + sizeof ( FT_ModuleRec ), "psaux", 0x20000L, 0x20000L, Index: src/psaux/psauxmod.h =================================================================== --- src/psaux/psauxmod.h (revision 58178) +++ src/psaux/psauxmod.h (working copy) @@ -28,7 +28,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class; Index: src/psaux/psconv.c =================================================================== --- src/psaux/psconv.c (revision 58178) +++ src/psaux/psconv.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (body). */ /* */ -/* Copyright 2006, 2008, 2009 by */ +/* Copyright 2006, 2008, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -18,11 +18,22 @@ #include <ft2build.h> #include FT_INTERNAL_POSTSCRIPT_AUX_H +#include FT_INTERNAL_DEBUG_H #include "psconv.h" #include "psauxerr.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_psconv + + /* The following array is used by various functions to quickly convert */ /* digits (both decimal and non-decimal) into numbers. */ @@ -69,18 +80,29 @@ #endif /* 'A' == 193 */ - FT_LOCAL_DEF( FT_Int ) + FT_LOCAL_DEF( FT_Long ) PS_Conv_Strtol( FT_Byte** cursor, FT_Byte* limit, - FT_Int base ) + FT_Long base ) { FT_Byte* p = *cursor; - FT_Int num = 0; - FT_Bool sign = 0; + FT_Long num = 0; + FT_Bool sign = 0; + FT_Bool have_overflow = 0; - if ( p == limit || base < 2 || base > 36 ) + FT_Long num_limit; + FT_Char c_limit; + + + if ( p >= limit ) + goto Bad; + + if ( base < 2 || base > 36 ) + { + FT_TRACE4(( "!!!INVALID BASE:!!!" )); return 0; + } if ( *p == '-' || *p == '+' ) { @@ -88,9 +110,12 @@ p++; if ( p == limit ) - return 0; + goto Bad; } + num_limit = 0x7FFFFFFFL / base; + c_limit = (FT_Char)( 0x7FFFFFFFL % base ); + for ( ; p < limit; p++ ) { FT_Char c; @@ -104,69 +129,109 @@ if ( c < 0 || c >= base ) break; - num = num * base + c; + if ( num > num_limit || ( num == num_limit && c > c_limit ) ) + have_overflow = 1; + else + num = num * base + c; } + *cursor = p; + + if ( have_overflow ) + { + num = 0x7FFFFFFFL; + FT_TRACE4(( "!!!OVERFLOW:!!!" )); + } + if ( sign ) num = -num; - *cursor = p; + return num; - return num; + Bad: + FT_TRACE4(( "!!!END OF DATA:!!!" )); + return 0; } - FT_LOCAL_DEF( FT_Int ) + FT_LOCAL_DEF( FT_Long ) PS_Conv_ToInt( FT_Byte** cursor, FT_Byte* limit ) { - FT_Byte* p; - FT_Int num; + FT_Byte* p = *cursor; + FT_Byte* curp; + FT_Long num; - num = PS_Conv_Strtol( cursor, limit, 10 ); - p = *cursor; + curp = p; + num = PS_Conv_Strtol( &p, limit, 10 ); + + if ( p == curp ) + return 0; + if ( p < limit && *p == '#' ) { - *cursor = p + 1; + p++; - return PS_Conv_Strtol( cursor, limit, num ); + curp = p; + num = PS_Conv_Strtol( &p, limit, num ); + + if ( p == curp ) + return 0; } - else - return num; + + *cursor = p; + + return num; } FT_LOCAL_DEF( FT_Fixed ) PS_Conv_ToFixed( FT_Byte** cursor, FT_Byte* limit, - FT_Int power_ten ) + FT_Long power_ten ) { FT_Byte* p = *cursor; - FT_Fixed integral; - FT_Long decimal = 0, divider = 1; - FT_Bool sign = 0; + FT_Byte* curp; + FT_Fixed integral = 0; + FT_Long decimal = 0; + FT_Long divider = 1; - if ( p == limit ) - return 0; + FT_Bool sign = 0; + FT_Bool have_overflow = 0; + FT_Bool have_underflow = 0; + + if ( p >= limit ) + goto Bad; + if ( *p == '-' || *p == '+' ) { sign = FT_BOOL( *p == '-' ); p++; if ( p == limit ) - return 0; + goto Bad; } + /* read the integer part */ if ( *p != '.' ) - integral = PS_Conv_ToInt( &p, limit ) << 16; - else - integral = 0; + { + curp = p; + integral = PS_Conv_ToInt( &p, limit ); + if ( p == curp ) + return 0; + + if ( integral > 0x7FFF ) + have_overflow = 1; + else + integral <<= 16; + } + /* read the decimal part */ if ( p < limit && *p == '.' ) { @@ -185,18 +250,14 @@ if ( c < 0 || c >= 10 ) break; - if ( !integral && power_ten > 0 ) + if ( decimal < 0xCCCCCCCL ) { - power_ten--; decimal = decimal * 10 + c; - } - else - { - if ( divider < 10000000L ) - { - decimal = decimal * 10 + c; + + if ( !integral && power_ten > 0 ) + power_ten--; + else divider *= 10; - } } } } @@ -204,33 +265,94 @@ /* read exponent, if any */ if ( p + 1 < limit && ( *p == 'e' || *p == 'E' ) ) { + FT_Long exponent; + + p++; - power_ten += PS_Conv_ToInt( &p, limit ); + + curp = p; + exponent = PS_Conv_ToInt( &p, limit ); + + if ( curp == p ) + return 0; + + /* arbitrarily limit exponent */ + if ( exponent > 1000 ) + have_overflow = 1; + else if ( exponent < -1000 ) + have_underflow = 1; + else + power_ten += exponent; } + *cursor = p; + + if ( !integral && !decimal ) + return 0; + + if ( have_overflow ) + goto Overflow; + if ( have_underflow ) + goto Underflow; + while ( power_ten > 0 ) { + if ( integral >= 0xCCCCCCCL ) + goto Overflow; integral *= 10; - decimal *= 10; + + if ( decimal >= 0xCCCCCCCL ) + { + if ( divider == 1 ) + goto Overflow; + divider /= 10; + } + else + decimal *= 10; + power_ten--; } while ( power_ten < 0 ) { integral /= 10; - divider *= 10; + if ( divider < 0xCCCCCCCL ) + divider *= 10; + else + decimal /= 10; + + if ( !integral && !decimal ) + goto Underflow; + power_ten++; } if ( decimal ) - integral += FT_DivFix( decimal, divider ); + { + decimal = FT_DivFix( decimal, divider ); + /* it's not necessary to check this addition for overflow */ + /* due to the structure of the real number representation */ + integral += decimal; + } + Exit: if ( sign ) integral = -integral; - *cursor = p; + return integral; - return integral; + Bad: + FT_TRACE4(( "!!!END OF DATA:!!!" )); + return 0; + + Overflow: + integral = 0x7FFFFFFFL; + FT_TRACE4(( "!!!OVERFLOW:!!!" )); + goto Exit; + + Underflow: + FT_TRACE4(( "!!!UNDERFLOW:!!!" )); + return 0; } @@ -346,7 +468,11 @@ #if 1 - p = *cursor; + p = *cursor; + + if ( p >= limit ) + return 0; + if ( n > (FT_UInt)( limit - p ) ) n = (FT_UInt)( limit - p ); @@ -434,6 +560,10 @@ #if 1 p = *cursor; + + if ( p >= limit ) + return 0; + if ( n > (FT_UInt)(limit - p) ) n = (FT_UInt)(limit - p); Index: src/psaux/psconv.h =================================================================== --- src/psaux/psconv.h (revision 58178) +++ src/psaux/psconv.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Some convenience conversions (specification). */ /* */ -/* Copyright 2006 by */ +/* Copyright 2006, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -26,20 +26,20 @@ FT_BEGIN_HEADER - FT_LOCAL( FT_Int ) + FT_LOCAL( FT_Long ) PS_Conv_Strtol( FT_Byte** cursor, FT_Byte* limit, - FT_Int base ); + FT_Long base ); - FT_LOCAL( FT_Int ) + FT_LOCAL( FT_Long ) PS_Conv_ToInt( FT_Byte** cursor, FT_Byte* limit ); FT_LOCAL( FT_Fixed ) PS_Conv_ToFixed( FT_Byte** cursor, FT_Byte* limit, - FT_Int power_ten ); + FT_Long power_ten ); #if 0 FT_LOCAL( FT_UInt ) Index: src/psaux/psobjs.c =================================================================== --- src/psaux/psobjs.c (revision 58178) +++ src/psaux/psobjs.c (working copy) @@ -4,8 +4,7 @@ /* */ /* Auxiliary functions for PostScript fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -186,13 +185,13 @@ /* grow the base block if needed */ if ( table->cursor + length > table->capacity ) { - FT_Error error; - FT_Offset new_size = table->capacity; - FT_Long in_offset; + FT_Error error; + FT_Offset new_size = table->capacity; + FT_PtrDist in_offset; - in_offset = (FT_Long)((FT_Byte*)object - table->block); - if ( (FT_ULong)in_offset >= table->capacity ) + in_offset = (FT_Byte*)object - table->block; + if ( in_offset < 0 || (FT_Offset)in_offset >= table->capacity ) in_offset = -1; while ( new_size < table->cursor + length ) @@ -590,7 +589,7 @@ } Exit: - if ( cur == parser->cursor ) + if ( cur < limit && cur == parser->cursor ) { FT_ERROR(( "ps_parser_skip_PS_token:" " current token is `%c' which is self-delimiting\n" Index: src/psaux/t1cmap.c =================================================================== --- src/psaux/t1cmap.c (revision 58178) +++ src/psaux/t1cmap.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 1 character map support (body). */ /* */ -/* Copyright 2002, 2003, 2006, 2007 by */ +/* Copyright 2002, 2003, 2006, 2007, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -264,8 +264,8 @@ /*************************************************************************/ FT_CALLBACK_DEF( const char * ) - t1_get_glyph_name( T1_Face face, - FT_UInt idx ) + psaux_get_glyph_name( T1_Face face, + FT_UInt idx ) { return face->type1.glyph_names[idx]; } @@ -282,7 +282,7 @@ return psnames->unicodes_init( memory, unicodes, face->type1.num_glyphs, - (PS_GetGlyphNameFunc)&t1_get_glyph_name, + (PS_GetGlyphNameFunc)&psaux_get_glyph_name, (PS_FreeGlyphNameFunc)NULL, (FT_Pointer)face ); } Index: src/psaux/t1decode.c =================================================================== --- src/psaux/t1decode.c (revision 58178) +++ src/psaux/t1decode.c (working copy) @@ -4,8 +4,7 @@ /* */ /* PostScript Type 1 decoding routines (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 */ -/* 2010 by */ +/* Copyright 2000-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -28,6 +27,8 @@ #include "psauxerr.h" +/* ensure proper sign extension */ +#define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) ) /*************************************************************************/ /* */ @@ -198,7 +199,7 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL T1_Face face = (T1_Face)decoder->builder.face; -#endif +#endif if ( decoder->seac ) @@ -207,6 +208,12 @@ return PSaux_Err_Syntax_Error; } + if ( decoder->builder.metrics_only ) + { + FT_ERROR(( "t1operator_seac: unexpected seac\n" )); + return PSaux_Err_Syntax_Error; + } + /* seac weirdness */ adx += decoder->builder.left_bearing.x; @@ -396,10 +403,10 @@ FT_ASSERT( ( decoder->len_buildchar == 0 ) == ( decoder->buildchar == NULL ) ); - if ( decoder->len_buildchar > 0 ) + if ( decoder->buildchar && decoder->len_buildchar > 0 ) ft_memset( &decoder->buildchar[0], 0, - sizeof( decoder->buildchar[0] ) * decoder->len_buildchar ); + sizeof ( decoder->buildchar[0] ) * decoder->len_buildchar ); FT_TRACE4(( "\n" "Start charstring\n" )); @@ -662,7 +669,7 @@ if ( large_int ) FT_TRACE4(( " %ld", value )); else - FT_TRACE4(( " %ld", (FT_Int32)( value >> 16 ) )); + FT_TRACE4(( " %ld", Fix2Int( value ) )); #endif *top++ = value; @@ -684,8 +691,8 @@ top -= 2; - subr_no = (FT_Int)( top[1] >> 16 ); - arg_cnt = (FT_Int)( top[0] >> 16 ); + subr_no = Fix2Int( top[1] ); + arg_cnt = Fix2Int( top[0] ); /***********************************************************/ /* */ @@ -724,6 +731,24 @@ switch ( subr_no ) { + case 0: /* end flex feature */ + if ( arg_cnt != 3 ) + goto Unexpected_OtherSubr; + + if ( decoder->flex_state == 0 || + decoder->num_flex_vectors != 7 ) + { + FT_ERROR(( "t1_decoder_parse_charstrings:" + " unexpected flex end\n" )); + goto Syntax_Error; + } + + /* the two `results' are popped by the following setcurrentpoint */ + top[0] = x; + top[1] = y; + known_othersubr_result_cnt = 2; + break; + case 1: /* start flex feature */ if ( arg_cnt != 0 ) goto Unexpected_OtherSubr; @@ -745,6 +770,13 @@ if ( arg_cnt != 0 ) goto Unexpected_OtherSubr; + if ( decoder->flex_state == 0 ) + { + FT_ERROR(( "t1_decoder_parse_charstrings:" + " missing flex start\n" )); + goto Syntax_Error; + } + /* note that we should not add a point for index 0; */ /* this will move our current position to the flex */ /* point without adding any point to the outline */ @@ -757,24 +789,6 @@ } break; - case 0: /* end flex feature */ - if ( arg_cnt != 3 ) - goto Unexpected_OtherSubr; - - if ( decoder->flex_state == 0 || - decoder->num_flex_vectors != 7 ) - { - FT_ERROR(( "t1_decoder_parse_charstrings:" - " unexpected flex end\n" )); - goto Syntax_Error; - } - - /* the two `results' are popped by the following setcurrentpoint */ - top[0] = x; - top[1] = y; - known_othersubr_result_cnt = 2; - break; - case 3: /* change hints */ if ( arg_cnt != 1 ) goto Unexpected_OtherSubr; @@ -818,18 +832,19 @@ goto Syntax_Error; } - /* we want to compute: */ + /* We want to compute */ /* */ - /* a0*w0 + a1*w1 + ... + ak*wk */ + /* a0*w0 + a1*w1 + ... + ak*wk */ /* */ - /* but we only have the a0, a1-a0, a2-a0, .. ak-a0 */ - /* however, given that w0 + w1 + ... + wk == 1, we can */ - /* rewrite it easily as: */ + /* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */ /* */ - /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + .. + (ak-a0)*wk */ + /* However, given that w0 + w1 + ... + wk == 1, we can */ + /* rewrite it easily as */ /* */ - /* where k == num_designs-1 */ + /* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */ /* */ + /* where k == num_designs-1. */ + /* */ /* I guess that's why it's written in this `compact' */ /* form. */ /* */ @@ -862,7 +877,7 @@ if ( arg_cnt != 1 || blend == NULL ) goto Unexpected_OtherSubr; - idx = (FT_Int)( top[0] >> 16 ); + idx = Fix2Int( top[0] ); if ( idx < 0 || idx + blend->num_designs > decoder->len_buildchar ) @@ -871,7 +886,7 @@ ft_memcpy( &decoder->buildchar[idx], blend->weight_vector, blend->num_designs * - sizeof( blend->weight_vector[0] ) ); + sizeof ( blend->weight_vector[0] ) ); } break; @@ -930,7 +945,7 @@ if ( arg_cnt != 2 || blend == NULL ) goto Unexpected_OtherSubr; - idx = (FT_Int)( top[1] >> 16 ); + idx = Fix2Int( top[1] ); if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) goto Unexpected_OtherSubr; @@ -951,7 +966,7 @@ if ( arg_cnt != 1 || blend == NULL ) goto Unexpected_OtherSubr; - idx = (FT_Int)( top[0] >> 16 ); + idx = Fix2Int( top[0] ); if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar ) goto Unexpected_OtherSubr; @@ -1009,11 +1024,15 @@ break; default: - FT_ERROR(( "t1_decoder_parse_charstrings:" - " unknown othersubr [%d %d], wish me luck\n", - arg_cnt, subr_no )); - unknown_othersubr_result_cnt = arg_cnt; - break; + if ( arg_cnt >= 0 && subr_no >= 0 ) + { + FT_ERROR(( "t1_decoder_parse_charstrings:" + " unknown othersubr [%d %d], wish me luck\n", + arg_cnt, subr_no )); + unknown_othersubr_result_cnt = arg_cnt; + break; + } + /* fall through */ Unexpected_OtherSubr: FT_ERROR(( "t1_decoder_parse_charstrings:" @@ -1100,7 +1119,7 @@ FT_TRACE4(( "BuildCharArray = [ " )); for ( i = 0; i < decoder->len_buildchar; ++i ) - FT_TRACE4(( "%d ", decoder->buildchar[ i ] )); + FT_TRACE4(( "%d ", decoder->buildchar[i] )); FT_TRACE4(( "]\n" )); } @@ -1139,8 +1158,8 @@ top[0], top[1], top[2], - (FT_Int)( top[3] >> 16 ), - (FT_Int)( top[4] >> 16 ) ); + Fix2Int( top[3] ), + Fix2Int( top[4] ) ); case op_sbw: FT_TRACE4(( " sbw" )); @@ -1324,7 +1343,7 @@ FT_TRACE4(( " callsubr" )); - idx = (FT_Int)( top[0] >> 16 ); + idx = Fix2Int( top[0] ); if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs ) { FT_ERROR(( "t1_decoder_parse_charstrings:" Index: src/pshinter/pshalgo.c =================================================================== --- src/pshinter/pshalgo.c (revision 58178) +++ src/pshinter/pshalgo.c (working copy) @@ -4,8 +4,7 @@ /* */ /* PostScript hinting algorithm (body). */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 */ -/* by */ +/* Copyright 2001-2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -563,7 +562,7 @@ else if ( len > 0 ) { /* This is a very small stem; we simply align it to the - * pixel grid, trying to find the minimal displacement. + * pixel grid, trying to find the minimum displacement. * * left = pos * right = pos + len Index: src/pshinter/pshglob.c =================================================================== --- src/pshinter/pshglob.c (revision 58178) +++ src/pshinter/pshglob.c (working copy) @@ -5,7 +5,7 @@ /* PostScript hinter global hinting management (body). */ /* Inspired by the new auto-hinter module. */ /* */ -/* Copyright 2001, 2002, 2003, 2004, 2006, 2010 by */ +/* Copyright 2001-2004, 2006, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -522,6 +522,28 @@ } + /* calculate the maximum height of given blue zones */ + static FT_Short + psh_calc_max_height( FT_UInt num, + const FT_Short* values, + FT_Short cur_max ) + { + FT_UInt count; + + + for ( count = 0; count < num; count += 2 ) + { + FT_Short cur_height = values[count + 1] - values[count]; + + + if ( cur_height > cur_max ) + cur_max = cur_height; + } + + return cur_max; + } + + FT_LOCAL_DEF( void ) psh_blues_snap_stem( PSH_Blues blues, FT_Int stem_top, @@ -684,7 +706,32 @@ priv->family_blues, priv->num_family_other_blues, priv->family_other_blues, priv->blue_fuzz, 1 ); - globals->blues.blue_scale = priv->blue_scale; + /* limit the BlueScale value to `1 / max_of_blue_zone_heights' */ + { + FT_Fixed max_scale; + FT_Short max_height = 1; + + + max_height = psh_calc_max_height( priv->num_blue_values, + priv->blue_values, + max_height ); + max_height = psh_calc_max_height( priv->num_other_blues, + priv->other_blues, + max_height ); + max_height = psh_calc_max_height( priv->num_family_blues, + priv->family_blues, + max_height ); + max_height = psh_calc_max_height( priv->num_family_other_blues, + priv->family_other_blues, + max_height ); + + /* BlueScale is scaled 1000 times */ + max_scale = FT_DivFix( 1000, max_height ); + globals->blues.blue_scale = priv->blue_scale < max_scale + ? priv->blue_scale + : max_scale; + } + globals->blues.blue_shift = priv->blue_shift; globals->blues.blue_fuzz = priv->blue_fuzz; Index: src/pshinter/pshmod.c =================================================================== --- src/pshinter/pshmod.c (revision 58178) +++ src/pshinter/pshmod.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType PostScript hinter module implementation (body). */ /* */ -/* Copyright 2001, 2002, 2007 by */ +/* Copyright 2001, 2002, 2007, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -93,14 +93,15 @@ } - FT_DEFINE_PSHINTER_INTERFACE(pshinter_interface, + FT_DEFINE_PSHINTER_INTERFACE( + pshinter_interface, pshinter_get_globals_funcs, pshinter_get_t1_funcs, - pshinter_get_t2_funcs - ) + pshinter_get_t2_funcs ) - FT_DEFINE_MODULE(pshinter_module_class, + FT_DEFINE_MODULE( + pshinter_module_class, 0, sizeof ( PS_Hinter_ModuleRec ), @@ -108,11 +109,11 @@ 0x10000L, 0x20000L, - &FTPSHINTER_INTERFACE_GET, /* module-specific interface */ + &PSHINTER_INTERFACE_GET, /* module-specific interface */ (FT_Module_Constructor)ps_hinter_init, (FT_Module_Destructor) ps_hinter_done, - (FT_Module_Requester) 0 /* no additional interface for now */ - ) + (FT_Module_Requester) NULL ) /* no additional interface for now */ + /* END */ Index: src/pshinter/pshnterr.h =================================================================== --- src/pshinter/pshnterr.h (revision 58178) +++ src/pshinter/pshnterr.h (working copy) @@ -4,7 +4,7 @@ /* */ /* PS Hinter error codes (specification only). */ /* */ -/* Copyright 2003 by */ +/* Copyright 2003, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX PSH_Err_ #define FT_ERR_BASE FT_Mod_Err_PShinter Index: src/pshinter/pshpic.c =================================================================== --- src/pshinter/pshpic.c (revision 58178) +++ src/pshinter/pshpic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,17 +20,23 @@ #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #include "pshpic.h" +#include "pshnterr.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from pshmod.c */ - void FT_Init_Class_pshinter_interface( FT_Library, PSHinter_Interface*); + void + FT_Init_Class_pshinter_interface( FT_Library library, + PSHinter_Interface* clazz ); void - pshinter_module_class_pic_free( FT_Library library ) + pshinter_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->pshinter ) { FT_FREE( pic_container->pshinter ); @@ -44,7 +50,7 @@ { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = PSH_Err_Ok; - PSHinterPIC* container; + PSHinterPIC* container = NULL; FT_Memory memory = library->memory; @@ -53,17 +59,17 @@ return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->pshinter = container; - + /* add call to initialization function when you add new scripts */ - FT_Init_Class_pshinter_interface(library, &container->pshinter_interface); + FT_Init_Class_pshinter_interface( + library, &container->pshinter_interface ); -/*Exit:*/ - if(error) - pshinter_module_class_pic_free(library); + if( error ) + pshinter_module_class_pic_free( library ); return error; } - #endif /* FT_CONFIG_OPTION_PIC */ + /* END */ Index: src/pshinter/pshpic.h =================================================================== --- src/pshinter/pshpic.h (revision 58178) +++ src/pshinter/pshpic.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for pshinter module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,28 +19,38 @@ #ifndef __PSHPIC_H__ #define __PSHPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H + #ifndef FT_CONFIG_OPTION_PIC -#define FTPSHINTER_INTERFACE_GET pshinter_interface +#define PSHINTER_INTERFACE_GET pshinter_interface #else /* FT_CONFIG_OPTION_PIC */ #include FT_INTERNAL_POSTSCRIPT_HINTS_H - typedef struct PSHinterPIC_ + typedef struct PSHinterPIC_ { - PSHinter_Interface pshinter_interface; + PSHinter_Interface pshinter_interface; + } PSHinterPIC; -#define GET_PIC(lib) ((PSHinterPIC*)((lib)->pic_container.autofit)) -#define FTPSHINTER_INTERFACE_GET (GET_PIC(library)->pshinter_interface) +#define GET_PIC( lib ) ( (PSHinterPIC*)((lib)->pic_container.autofit) ) +#define PSHINTER_INTERFACE_GET ( GET_PIC( library )->pshinter_interface ) + + /* see pshpic.c for the implementation */ + void + pshinter_module_class_pic_free( FT_Library library ); + + FT_Error + pshinter_module_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: src/pshinter/rules.mk =================================================================== --- src/pshinter/rules.mk (revision 58178) +++ src/pshinter/rules.mk (working copy) @@ -3,7 +3,7 @@ # -# Copyright 2001, 2003 by +# Copyright 2001, 2003, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -25,10 +25,11 @@ # PSHINTER driver sources (i.e., C files) # -PSHINTER_DRV_SRC := $(PSHINTER_DIR)/pshrec.c \ +PSHINTER_DRV_SRC := $(PSHINTER_DIR)/pshalgo.c \ $(PSHINTER_DIR)/pshglob.c \ $(PSHINTER_DIR)/pshmod.c \ - $(PSHINTER_DIR)/pshalgo.c + $(PSHINTER_DIR)/pshpic.c \ + $(PSHINTER_DIR)/pshrec.c # PSHINTER driver headers Index: src/psnames/psmodule.c =================================================================== --- src/psnames/psmodule.c (revision 58178) +++ src/psnames/psmodule.c (working copy) @@ -4,7 +4,7 @@ /* */ /* PSNames module implementation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2003, 2005-2008, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -521,7 +521,9 @@ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface, + + FT_DEFINE_SERVICE_PSCMAPSREC( + pscmaps_interface, (PS_Unicode_ValueFunc) ps_unicode_value, (PS_Unicodes_InitFunc) ps_unicodes_init, (PS_Unicodes_CharIndexFunc)ps_unicodes_char_index, @@ -531,54 +533,64 @@ (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, t1_standard_encoding, - t1_expert_encoding - ) + t1_expert_encoding ) #else - FT_DEFINE_SERVICE_PSCMAPSREC(pscmaps_interface, - 0, - 0, - 0, - 0, + FT_DEFINE_SERVICE_PSCMAPSREC( + pscmaps_interface, + NULL, + NULL, + NULL, + NULL, (PS_Macintosh_NameFunc) ps_get_macintosh_name, (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, t1_standard_encoding, - t1_expert_encoding - ) + t1_expert_encoding ) #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ - FT_DEFINE_SERVICEDESCREC1(pscmaps_services, - FT_SERVICE_ID_POSTSCRIPT_CMAPS, &FT_PSCMAPS_INTERFACE_GET - ) + FT_DEFINE_SERVICEDESCREC1( + pscmaps_services, + FT_SERVICE_ID_POSTSCRIPT_CMAPS, &PSCMAPS_INTERFACE_GET ) - - static FT_Pointer psnames_get_service( FT_Module module, const char* service_id ) { + /* PSCMAPS_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + FT_Library library; + + + if ( !module ) + return NULL; + library = module->library; + if ( !library ) + return NULL; +#else FT_UNUSED( module ); +#endif - return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id ); + return ft_service_list_lookup( PSCMAPS_SERVICES_GET, service_id ); } #endif /* FT_CONFIG_OPTION_POSTSCRIPT_NAMES */ #ifndef FT_CONFIG_OPTION_POSTSCRIPT_NAMES -#define PUT_PS_NAMES_SERVICE(a) 0 +#define PUT_PS_NAMES_SERVICE( a ) NULL #else -#define PUT_PS_NAMES_SERVICE(a) a +#define PUT_PS_NAMES_SERVICE( a ) a #endif - FT_DEFINE_MODULE(psnames_module_class, - + FT_DEFINE_MODULE( + psnames_module_class, + 0, /* this is not a font driver, nor a renderer */ sizeof ( FT_ModuleRec ), @@ -586,12 +598,11 @@ 0x10000L, /* driver version */ 0x20000L, /* driver requires FreeType 2 or above */ - PUT_PS_NAMES_SERVICE((void*)&FT_PSCMAPS_INTERFACE_GET), /* module specific interface */ - (FT_Module_Constructor)0, - (FT_Module_Destructor) 0, - (FT_Module_Requester) PUT_PS_NAMES_SERVICE(psnames_get_service) - ) + PUT_PS_NAMES_SERVICE( + (void*)&PSCMAPS_INTERFACE_GET ), /* module specific interface */ + (FT_Module_Constructor)NULL, + (FT_Module_Destructor) NULL, + (FT_Module_Requester) PUT_PS_NAMES_SERVICE( psnames_get_service ) ) - /* END */ Index: src/psnames/psnamerr.h =================================================================== --- src/psnames/psnamerr.h (revision 58178) +++ src/psnames/psnamerr.h (working copy) @@ -4,7 +4,7 @@ /* */ /* PS names module error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX PSnames_Err_ #define FT_ERR_BASE FT_Mod_Err_PSnames Index: src/psnames/pspic.c =================================================================== --- src/psnames/pspic.c (revision 58178) +++ src/psnames/pspic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,24 +20,39 @@ #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #include "pspic.h" +#include "psnamerr.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from psmodule.c */ - FT_Error FT_Create_Class_pscmaps_services( FT_Library, FT_ServiceDescRec**); - void FT_Destroy_Class_pscmaps_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_pscmaps_interface( FT_Library, FT_Service_PsCMapsRec*); + FT_Error + FT_Create_Class_pscmaps_services( FT_Library library, + FT_ServiceDescRec** output_class ); + void + FT_Destroy_Class_pscmaps_services( FT_Library library, + FT_ServiceDescRec* clazz ); void - psnames_module_class_pic_free( FT_Library library ) + FT_Init_Class_pscmaps_interface( FT_Library library, + FT_Service_PsCMapsRec* clazz ); + + + void + psnames_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->psnames ) { - PSModulePIC* container = (PSModulePIC*)pic_container->psnames; - if(container->pscmaps_services) - FT_Destroy_Class_pscmaps_services(library, container->pscmaps_services); + PSModulePIC* container = (PSModulePIC*)pic_container->psnames; + + + if ( container->pscmaps_services ) + FT_Destroy_Class_pscmaps_services( library, + container->pscmaps_services ); container->pscmaps_services = NULL; FT_FREE( container ); pic_container->psnames = NULL; @@ -50,25 +65,28 @@ { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = PSnames_Err_Ok; - PSModulePIC* container; + PSModulePIC* container = NULL; FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->psnames = container; - /* initialize pointer table - this is how the module usually expects this data */ - error = FT_Create_Class_pscmaps_services(library, &container->pscmaps_services); - if(error) + /* initialize pointer table - */ + /* this is how the module usually expects this data */ + error = FT_Create_Class_pscmaps_services( + library, &container->pscmaps_services ); + if ( error ) goto Exit; - FT_Init_Class_pscmaps_interface(library, &container->pscmaps_interface); - -Exit: - if(error) - psnames_module_class_pic_free(library); + FT_Init_Class_pscmaps_interface( library, + &container->pscmaps_interface ); + + Exit: + if ( error ) + psnames_module_class_pic_free( library ); return error; } Index: src/psnames/pspic.h =================================================================== --- src/psnames/pspic.h (revision 58178) +++ src/psnames/pspic.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for psnames module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,29 +19,41 @@ #ifndef __PSPIC_H__ #define __PSPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H #ifndef FT_CONFIG_OPTION_PIC -#define FT_PSCMAPS_SERVICES_GET pscmaps_services -#define FT_PSCMAPS_INTERFACE_GET pscmaps_interface +#define PSCMAPS_SERVICES_GET pscmaps_services +#define PSCMAPS_INTERFACE_GET pscmaps_interface + #else /* FT_CONFIG_OPTION_PIC */ #include FT_SERVICE_POSTSCRIPT_CMAPS_H - typedef struct PSModulePIC_ + typedef struct PSModulePIC_ { - FT_ServiceDescRec* pscmaps_services; - FT_Service_PsCMapsRec pscmaps_interface; + FT_ServiceDescRec* pscmaps_services; + FT_Service_PsCMapsRec pscmaps_interface; + } PSModulePIC; -#define GET_PIC(lib) ((PSModulePIC*)((lib)->pic_container.psnames)) -#define FT_PSCMAPS_SERVICES_GET (GET_PIC(library)->pscmaps_services) -#define FT_PSCMAPS_INTERFACE_GET (GET_PIC(library)->pscmaps_interface) +#define GET_PIC( lib ) \ + ( (PSModulePIC*)((lib)->pic_container.psnames) ) +#define PSCMAPS_SERVICES_GET ( GET_PIC( library )->pscmaps_services ) +#define PSCMAPS_INTERFACE_GET ( GET_PIC( library )->pscmaps_interface ) + + + /* see pspic.c for the implementation */ + void + psnames_module_class_pic_free( FT_Library library ); + + FT_Error + psnames_module_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: src/psnames/pstables.h =================================================================== --- src/psnames/pstables.h (revision 58178) +++ src/psnames/pstables.h (working copy) @@ -4,7 +4,7 @@ /* */ /* PostScript glyph names. */ /* */ -/* Copyright 2005, 2008 by */ +/* Copyright 2005, 2008, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -564,15 +564,15 @@ #ifdef FT_CONFIG_OPTION_ADOBE_GLYPH_LIST - static const unsigned char ft_adobe_glyph_list[54791L] = + static const unsigned char ft_adobe_glyph_list[55997L] = { 0, 52, 0,106, 2,167, 3, 63, 4,220, 6,125, 9,143, 10, 23, 11,137, 12,199, 14,246, 15, 87, 16,233, 17,219, 18,104, 19, 88, 22,110, 23, 32, 23, 71, 24, 77, 27,156, 29, 73, 31,247, 32,107, - 32,222, 33, 55, 34,154, 35,218, 53, 84, 59,196, 68, 6, 75,183, - 83,178, 88,135, 93,242,101,165,109,185,111, 55,117,254,123, 73, - 130,238,138,206,145, 31,153,182,156,189,163,249,178,221,193, 17, - 197, 99,199,240,204, 27,204,155,210,100, 65,143, 0, 65, 0,140, + 32,222, 33, 55, 34,154, 35,218, 58, 10, 64,122, 72,188, 80,109, + 88,104, 93, 61, 98,168,106, 91,114,111,115,237,122,180,127,255, + 135,164,143,132,149,213,158,108,161,115,168,175,183,147,197,199, + 202, 25,204,166,208,209,209, 81,215, 26, 65,143, 0, 65, 0,140, 0,175, 0,193, 1, 15, 1,147, 1,233, 1,251, 2, 7, 2, 40, 2, 57, 2, 82, 2, 91, 2,128, 2,136, 2,154, 69,131, 0,198, 0,150, 0,158, 0,167,225,227,245,244,101,128, 1,252,237,225, @@ -1139,2858 +1139,2933 @@ 233,243,227,249,242,233,236,236,233, 99,128, 4,220,236,233,238, 229,226,229,236,239,119,128, 30,148,237,239,238,239,243,240,225, 227,101,128,255, 58,115, 2, 35,203, 35,210,237,225,236,108,128, - 247,122,244,242,239,235,101,128, 1,181, 97,149, 0, 97, 36, 8, - 36,144, 37, 35, 37,211, 38, 55, 38, 91, 45, 10, 45, 47, 45, 74, - 46, 43, 46, 81, 47,170, 47,242, 48,197, 48,206, 49, 79, 51, 87, - 52, 77, 52,124, 53, 19, 53, 33, 97, 7, 36, 24, 36, 34, 36, 41, - 36, 48, 36, 73, 36, 89, 36,100,226,229,238,231,225,236,105,128, - 9,134,227,245,244,101,128, 0,225,228,229,246, 97,128, 9, 6, - 231,117, 2, 36, 55, 36, 64,234,225,242,225,244,105,128, 10,134, - 242,237,245,235,232,105,128, 10, 6,237,225,244,242,225,231,245, - 242,237,245,235,232,105,128, 10, 62,242,245,243,241,245,225,242, - 101,128, 51, 3,246,239,247,229,236,243,233,231,110, 3, 36,116, - 36,126, 36,133,226,229,238,231,225,236,105,128, 9,190,228,229, - 246, 97,128, 9, 62,231,245,234,225,242,225,244,105,128, 10,190, - 98, 4, 36,154, 36,195, 36,204, 36,214,226,242,229,246,233,225, - 244,233,239,110, 2, 36,169, 36,184,237,225,242,235,225,242,237, - 229,238,233,225,110,128, 5, 95,243,233,231,238,228,229,246, 97, - 128, 9,112,229,238,231,225,236,105,128, 9,133,239,240,239,237, - 239,230,111,128, 49, 26,242,229,246,101,134, 1, 3, 36,233, 36, - 241, 36,252, 37, 7, 37, 15, 37, 27,225,227,245,244,101,128, 30, - 175,227,249,242,233,236,236,233, 99,128, 4,209,228,239,244,226, - 229,236,239,119,128, 30,183,231,242,225,246,101,128, 30,177,232, - 239,239,235,225,226,239,246,101,128, 30,179,244,233,236,228,101, - 128, 30,181, 99, 4, 37, 45, 37, 52, 37,131, 37,201,225,242,239, - 110,128, 1,206,233,242, 99, 2, 37, 60, 37, 65,236,101,128, 36, - 208,245,237,230,236,229,120,133, 0,226, 37, 84, 37, 92, 37,103, - 37,111, 37,123,225,227,245,244,101,128, 30,165,228,239,244,226, - 229,236,239,119,128, 30,173,231,242,225,246,101,128, 30,167,232, - 239,239,235,225,226,239,246,101,128, 30,169,244,233,236,228,101, - 128, 30,171,245,244,101,133, 0,180, 37,147, 37,158, 37,175, 37, - 182, 37,191,226,229,236,239,247,227,237, 98,128, 3, 23, 99, 2, - 37,164, 37,169,237, 98,128, 3, 1,239,237, 98,128, 3, 1,228, - 229,246, 97,128, 9, 84,236,239,247,237,239,100,128, 2,207,244, - 239,238,229,227,237, 98,128, 3, 65,249,242,233,236,236,233, 99, - 128, 4, 48,100, 5, 37,223, 37,233, 37,247, 37,253, 38, 31,226, - 236,231,242,225,246,101,128, 2, 1,228,225,235,231,245,242,237, - 245,235,232,105,128, 10,113,229,246, 97,128, 9, 5,233,229,242, - 229,243,233,115,130, 0,228, 38, 11, 38, 22,227,249,242,233,236, - 236,233, 99,128, 4,211,237,225,227,242,239,110,128, 1,223,239, - 116, 2, 38, 38, 38, 46,226,229,236,239,119,128, 30,161,237,225, - 227,242,239,110,128, 1,225,101,131, 0,230, 38, 65, 38, 73, 38, - 82,225,227,245,244,101,128, 1,253,235,239,242,229,225,110,128, - 49, 80,237,225,227,242,239,110,128, 1,227,230,233,105, 6, 38, - 107, 38,127, 41, 64, 41, 70, 41, 85, 44,185, 48, 2, 38,113, 38, - 120,176,178,176, 56,128, 32, 21,184,185,180, 49,128, 32,164,177, - 48, 3, 38,136, 40,160, 41, 39, 48, 9, 38,156, 38,176, 38,238, - 39, 44, 39,106, 39,168, 39,230, 40, 36, 40, 98, 49, 3, 38,164, - 38,168, 38,172, 55,128, 4, 16, 56,128, 4, 17, 57,128, 4, 18, - 50, 10, 38,198, 38,202, 38,206, 38,210, 38,214, 38,218, 38,222, - 38,226, 38,230, 38,234, 48,128, 4, 19, 49,128, 4, 20, 50,128, - 4, 21, 51,128, 4, 1, 52,128, 4, 22, 53,128, 4, 23, 54,128, - 4, 24, 55,128, 4, 25, 56,128, 4, 26, 57,128, 4, 27, 51, 10, - 39, 4, 39, 8, 39, 12, 39, 16, 39, 20, 39, 24, 39, 28, 39, 32, - 39, 36, 39, 40, 48,128, 4, 28, 49,128, 4, 29, 50,128, 4, 30, - 51,128, 4, 31, 52,128, 4, 32, 53,128, 4, 33, 54,128, 4, 34, - 55,128, 4, 35, 56,128, 4, 36, 57,128, 4, 37, 52, 10, 39, 66, - 39, 70, 39, 74, 39, 78, 39, 82, 39, 86, 39, 90, 39, 94, 39, 98, - 39,102, 48,128, 4, 38, 49,128, 4, 39, 50,128, 4, 40, 51,128, - 4, 41, 52,128, 4, 42, 53,128, 4, 43, 54,128, 4, 44, 55,128, - 4, 45, 56,128, 4, 46, 57,128, 4, 47, 53, 10, 39,128, 39,132, - 39,136, 39,140, 39,144, 39,148, 39,152, 39,156, 39,160, 39,164, - 48,128, 4,144, 49,128, 4, 2, 50,128, 4, 3, 51,128, 4, 4, - 52,128, 4, 5, 53,128, 4, 6, 54,128, 4, 7, 55,128, 4, 8, - 56,128, 4, 9, 57,128, 4, 10, 54, 10, 39,190, 39,194, 39,198, - 39,202, 39,206, 39,210, 39,214, 39,218, 39,222, 39,226, 48,128, - 4, 11, 49,128, 4, 12, 50,128, 4, 14, 51,128,246,196, 52,128, - 246,197, 53,128, 4, 48, 54,128, 4, 49, 55,128, 4, 50, 56,128, - 4, 51, 57,128, 4, 52, 55, 10, 39,252, 40, 0, 40, 4, 40, 8, - 40, 12, 40, 16, 40, 20, 40, 24, 40, 28, 40, 32, 48,128, 4, 53, - 49,128, 4, 81, 50,128, 4, 54, 51,128, 4, 55, 52,128, 4, 56, - 53,128, 4, 57, 54,128, 4, 58, 55,128, 4, 59, 56,128, 4, 60, - 57,128, 4, 61, 56, 10, 40, 58, 40, 62, 40, 66, 40, 70, 40, 74, - 40, 78, 40, 82, 40, 86, 40, 90, 40, 94, 48,128, 4, 62, 49,128, - 4, 63, 50,128, 4, 64, 51,128, 4, 65, 52,128, 4, 66, 53,128, - 4, 67, 54,128, 4, 68, 55,128, 4, 69, 56,128, 4, 70, 57,128, - 4, 71, 57, 10, 40,120, 40,124, 40,128, 40,132, 40,136, 40,140, - 40,144, 40,148, 40,152, 40,156, 48,128, 4, 72, 49,128, 4, 73, - 50,128, 4, 74, 51,128, 4, 75, 52,128, 4, 76, 53,128, 4, 77, - 54,128, 4, 78, 55,128, 4, 79, 56,128, 4,145, 57,128, 4, 82, - 49, 4, 40,170, 40,232, 40,237, 41, 7, 48, 10, 40,192, 40,196, - 40,200, 40,204, 40,208, 40,212, 40,216, 40,220, 40,224, 40,228, - 48,128, 4, 83, 49,128, 4, 84, 50,128, 4, 85, 51,128, 4, 86, - 52,128, 4, 87, 53,128, 4, 88, 54,128, 4, 89, 55,128, 4, 90, - 56,128, 4, 91, 57,128, 4, 92,177, 48,128, 4, 94, 52, 4, 40, - 247, 40,251, 40,255, 41, 3, 53,128, 4, 15, 54,128, 4, 98, 55, - 128, 4,114, 56,128, 4,116, 57, 5, 41, 19, 41, 23, 41, 27, 41, - 31, 41, 35, 50,128,246,198, 51,128, 4, 95, 52,128, 4, 99, 53, - 128, 4,115, 54,128, 4,117, 56, 2, 41, 45, 41, 59, 51, 2, 41, - 51, 41, 55, 49,128,246,199, 50,128,246,200,180, 54,128, 4,217, - 178,185, 57,128, 32, 14,179, 48, 2, 41, 77, 41, 81, 48,128, 32, - 15, 49,128, 32, 13,181, 55, 7, 41,102, 41,172, 42,237, 43, 58, - 44, 15, 44,108, 44,179, 51, 2, 41,108, 41,122, 56, 2, 41,114, - 41,118, 49,128, 6,106, 56,128, 6, 12, 57, 8, 41,140, 41,144, - 41,148, 41,152, 41,156, 41,160, 41,164, 41,168, 50,128, 6, 96, - 51,128, 6, 97, 52,128, 6, 98, 53,128, 6, 99, 54,128, 6,100, - 55,128, 6,101, 56,128, 6,102, 57,128, 6,103, 52, 7, 41,188, - 41,220, 42, 26, 42, 88, 42,120, 42,176, 42,232, 48, 5, 41,200, - 41,204, 41,208, 41,212, 41,216, 48,128, 6,104, 49,128, 6,105, - 51,128, 6, 27, 55,128, 6, 31, 57,128, 6, 33, 49, 10, 41,242, - 41,246, 41,250, 41,254, 42, 2, 42, 6, 42, 10, 42, 14, 42, 18, - 42, 22, 48,128, 6, 34, 49,128, 6, 35, 50,128, 6, 36, 51,128, - 6, 37, 52,128, 6, 38, 53,128, 6, 39, 54,128, 6, 40, 55,128, - 6, 41, 56,128, 6, 42, 57,128, 6, 43, 50, 10, 42, 48, 42, 52, - 42, 56, 42, 60, 42, 64, 42, 68, 42, 72, 42, 76, 42, 80, 42, 84, - 48,128, 6, 44, 49,128, 6, 45, 50,128, 6, 46, 51,128, 6, 47, - 52,128, 6, 48, 53,128, 6, 49, 54,128, 6, 50, 55,128, 6, 51, - 56,128, 6, 52, 57,128, 6, 53, 51, 5, 42,100, 42,104, 42,108, - 42,112, 42,116, 48,128, 6, 54, 49,128, 6, 55, 50,128, 6, 56, - 51,128, 6, 57, 52,128, 6, 58, 52, 9, 42,140, 42,144, 42,148, - 42,152, 42,156, 42,160, 42,164, 42,168, 42,172, 48,128, 6, 64, - 49,128, 6, 65, 50,128, 6, 66, 51,128, 6, 67, 52,128, 6, 68, - 53,128, 6, 69, 54,128, 6, 70, 56,128, 6, 72, 57,128, 6, 73, - 53, 9, 42,196, 42,200, 42,204, 42,208, 42,212, 42,216, 42,220, - 42,224, 42,228, 48,128, 6, 74, 49,128, 6, 75, 50,128, 6, 76, - 51,128, 6, 77, 52,128, 6, 78, 53,128, 6, 79, 54,128, 6, 80, - 55,128, 6, 81, 56,128, 6, 82,183, 48,128, 6, 71, 53, 3, 42, - 245, 43, 21, 43, 53, 48, 5, 43, 1, 43, 5, 43, 9, 43, 13, 43, - 17, 53,128, 6,164, 54,128, 6,126, 55,128, 6,134, 56,128, 6, - 152, 57,128, 6,175, 49, 5, 43, 33, 43, 37, 43, 41, 43, 45, 43, - 49, 49,128, 6,121, 50,128, 6,136, 51,128, 6,145, 52,128, 6, - 186, 57,128, 6,210,179, 52,128, 6,213, 54, 7, 43, 74, 43, 79, - 43, 84, 43, 89, 43,127, 43,189, 43,251,179, 54,128, 32,170,180, - 53,128, 5,190,181, 56,128, 5,195, 54, 6, 43,103, 43,107, 43, - 111, 43,115, 43,119, 43,123, 52,128, 5,208, 53,128, 5,209, 54, - 128, 5,210, 55,128, 5,211, 56,128, 5,212, 57,128, 5,213, 55, - 10, 43,149, 43,153, 43,157, 43,161, 43,165, 43,169, 43,173, 43, - 177, 43,181, 43,185, 48,128, 5,214, 49,128, 5,215, 50,128, 5, - 216, 51,128, 5,217, 52,128, 5,218, 53,128, 5,219, 54,128, 5, - 220, 55,128, 5,221, 56,128, 5,222, 57,128, 5,223, 56, 10, 43, - 211, 43,215, 43,219, 43,223, 43,227, 43,231, 43,235, 43,239, 43, - 243, 43,247, 48,128, 5,224, 49,128, 5,225, 50,128, 5,226, 51, - 128, 5,227, 52,128, 5,228, 53,128, 5,229, 54,128, 5,230, 55, - 128, 5,231, 56,128, 5,232, 57,128, 5,233, 57, 3, 44, 3, 44, - 7, 44, 11, 48,128, 5,234, 52,128,251, 42, 53,128,251, 43, 55, - 4, 44, 25, 44, 39, 44, 59, 44, 64, 48, 2, 44, 31, 44, 35, 48, - 128,251, 75, 53,128,251, 31, 49, 3, 44, 47, 44, 51, 44, 55, 54, - 128, 5,240, 55,128, 5,241, 56,128, 5,242,178, 51,128,251, 53, - 57, 7, 44, 80, 44, 84, 44, 88, 44, 92, 44, 96, 44,100, 44,104, - 51,128, 5,180, 52,128, 5,181, 53,128, 5,182, 54,128, 5,187, - 55,128, 5,184, 56,128, 5,183, 57,128, 5,176, 56, 3, 44,116, - 44,160, 44,165, 48, 7, 44,132, 44,136, 44,140, 44,144, 44,148, - 44,152, 44,156, 48,128, 5,178, 49,128, 5,177, 50,128, 5,179, - 51,128, 5,194, 52,128, 5,193, 54,128, 5,185, 55,128, 5,188, - 179, 57,128, 5,189, 52, 2, 44,171, 44,175, 49,128, 5,191, 50, - 128, 5,192,185,178, 57,128, 2,188, 54, 3, 44,193, 44,252, 45, - 3, 49, 4, 44,203, 44,219, 44,225, 44,246, 50, 2, 44,209, 44, - 214,180, 56,128, 33, 5,184, 57,128, 33, 19,179,181, 50,128, 33, - 22,181, 55, 3, 44,234, 44,238, 44,242, 51,128, 32, 44, 52,128, - 32, 45, 53,128, 32, 46,182,182, 52,128, 32, 12,179,177,182, 55, - 128, 6,109,180,185,179, 55,128, 2,189,103, 2, 45, 16, 45, 23, - 242,225,246,101,128, 0,224,117, 2, 45, 29, 45, 38,234,225,242, - 225,244,105,128, 10,133,242,237,245,235,232,105,128, 10, 5,104, - 2, 45, 53, 45, 63,233,242,225,231,225,238, 97,128, 48, 66,239, - 239,235,225,226,239,246,101,128, 30,163,105, 7, 45, 90, 45,115, - 45,122, 45,134, 45,159, 45,175, 45,255, 98, 2, 45, 96, 45,105, - 229,238,231,225,236,105,128, 9,144,239,240,239,237,239,230,111, - 128, 49, 30,228,229,246, 97,128, 9, 16,229,227,249,242,233,236, - 236,233, 99,128, 4,213,231,117, 2, 45,141, 45,150,234,225,242, - 225,244,105,128, 10,144,242,237,245,235,232,105,128, 10, 16,237, - 225,244,242,225,231,245,242,237,245,235,232,105,128, 10, 72,110, - 5, 45,187, 45,196, 45,210, 45,226, 45,241,225,242,225,226,233, - 99,128, 6, 57,230,233,238,225,236,225,242,225,226,233, 99,128, - 254,202,233,238,233,244,233,225,236,225,242,225,226,233, 99,128, - 254,203,237,229,228,233,225,236,225,242,225,226,233, 99,128,254, - 204,246,229,242,244,229,228,226,242,229,246,101,128, 2, 3,246, - 239,247,229,236,243,233,231,110, 3, 46, 15, 46, 25, 46, 32,226, - 229,238,231,225,236,105,128, 9,200,228,229,246, 97,128, 9, 72, - 231,245,234,225,242,225,244,105,128, 10,200,107, 2, 46, 49, 46, - 73,225,244,225,235,225,238, 97,129, 48,162, 46, 61,232,225,236, - 230,247,233,228,244,104,128,255,113,239,242,229,225,110,128, 49, - 79,108, 3, 46, 89, 47,145, 47,154,101, 2, 46, 95, 47,140,102, - 136, 5,208, 46,115, 46,124, 46,139, 46,153, 46,242, 47, 0, 47, - 111, 47,125,225,242,225,226,233, 99,128, 6, 39,228,225,231,229, - 243,232,232,229,226,242,229,119,128,251, 48,230,233,238,225,236, - 225,242,225,226,233, 99,128,254,142,104, 2, 46,159, 46,234,225, - 237,250, 97, 2, 46,168, 46,201,225,226,239,246,101, 2, 46,178, - 46,187,225,242,225,226,233, 99,128, 6, 35,230,233,238,225,236, - 225,242,225,226,233, 99,128,254,132,226,229,236,239,119, 2, 46, - 211, 46,220,225,242,225,226,233, 99,128, 6, 37,230,233,238,225, - 236,225,242,225,226,233, 99,128,254,136,229,226,242,229,119,128, - 5,208,236,225,237,229,228,232,229,226,242,229,119,128,251, 79, - 237, 97, 2, 47, 7, 47, 43,228,228,225,225,226,239,246,101, 2, - 47, 20, 47, 29,225,242,225,226,233, 99,128, 6, 34,230,233,238, - 225,236,225,242,225,226,233, 99,128,254,130,235,243,245,242, 97, - 4, 47, 57, 47, 66, 47, 80, 47, 96,225,242,225,226,233, 99,128, - 6, 73,230,233,238,225,236,225,242,225,226,233, 99,128,254,240, - 233,238,233,244,233,225,236,225,242,225,226,233, 99,128,254,243, - 237,229,228,233,225,236,225,242,225,226,233, 99,128,254,244,240, - 225,244,225,232,232,229,226,242,229,119,128,251, 46,241,225,237, - 225,244,243,232,229,226,242,229,119,128,251, 47,240,104,128, 33, - 53,236,229,241,245,225,108,128, 34, 76,240,232, 97,129, 3,177, - 47,162,244,239,238,239,115,128, 3,172,109, 4, 47,180, 47,188, - 47,199, 47,233,225,227,242,239,110,128, 1, 1,239,238,239,243, - 240,225,227,101,128,255, 65,240,229,242,243,225,238,100,130, 0, - 38, 47,213, 47,225,237,239,238,239,243,240,225,227,101,128,255, - 6,243,237,225,236,108,128,247, 38,243,241,245,225,242,101,128, - 51,194,110, 4, 47,252, 48, 7, 48,129, 48,139,226,239,240,239, - 237,239,230,111,128, 49, 34,103, 4, 48, 17, 48, 28, 48, 42, 48, - 121,226,239,240,239,237,239,230,111,128, 49, 36,235,232,225,238, - 235,232,245,244,232,225,105,128, 14, 90,236,101,131, 34, 32, 48, - 53, 48,106, 48,113,226,242,225,227,235,229,116, 2, 48, 65, 48, - 85,236,229,230,116,129, 48, 8, 48, 74,246,229,242,244,233,227, - 225,108,128,254, 63,242,233,231,232,116,129, 48, 9, 48, 95,246, - 229,242,244,233,227,225,108,128,254, 64,236,229,230,116,128, 35, - 41,242,233,231,232,116,128, 35, 42,243,244,242,239,109,128, 33, - 43,239,244,229,236,229,233, 97,128, 3,135,117, 2, 48,145, 48, - 157,228,225,244,244,225,228,229,246, 97,128, 9, 82,243,246,225, - 242, 97, 3, 48,169, 48,179, 48,186,226,229,238,231,225,236,105, - 128, 9,130,228,229,246, 97,128, 9, 2,231,245,234,225,242,225, - 244,105,128, 10,130,239,231,239,238,229,107,128, 1, 5,112, 3, - 48,214, 48,238, 49, 12, 97, 2, 48,220, 48,232,225,244,239,243, - 241,245,225,242,101,128, 51, 0,242,229,110,128, 36,156,239,243, - 244,242,239,240,232,101, 2, 48,251, 49, 6,225,242,237,229,238, - 233,225,110,128, 5, 90,237,239,100,128, 2,188,112, 2, 49, 18, - 49, 23,236,101,128,248,255,242,111, 2, 49, 30, 49, 38,225,227, - 232,229,115,128, 34, 80,120, 2, 49, 44, 49, 64,229,241,245,225, - 108,129, 34, 72, 49, 54,239,242,233,237,225,231,101,128, 34, 82, - 233,237,225,244,229,236,249,229,241,245,225,108,128, 34, 69,114, - 4, 49, 89, 49,116, 49,120, 49,165,225,229, 97, 2, 49, 97, 49, - 107,229,235,239,242,229,225,110,128, 49,142,235,239,242,229,225, - 110,128, 49,141, 99,128, 35, 18,105, 2, 49,126, 49,140,231,232, - 244,232,225,236,230,242,233,238,103,128, 30,154,238,103,130, 0, - 229, 49,149, 49,157,225,227,245,244,101,128, 1,251,226,229,236, - 239,119,128, 30, 1,242,239,119, 8, 49,185, 49,192, 50, 65, 50, - 131, 50,181, 50,236, 51, 3, 51, 78,226,239,244,104,128, 33,148, - 100, 3, 49,200, 49,239, 50, 30,225,243,104, 4, 49,212, 49,219, - 49,226, 49,234,228,239,247,110,128, 33,227,236,229,230,116,128, - 33,224,242,233,231,232,116,128, 33,226,245,112,128, 33,225,226, - 108, 5, 49,252, 50, 3, 50, 10, 50, 17, 50, 25,226,239,244,104, - 128, 33,212,228,239,247,110,128, 33,211,236,229,230,116,128, 33, - 208,242,233,231,232,116,128, 33,210,245,112,128, 33,209,239,247, - 110,131, 33,147, 50, 42, 50, 49, 50, 57,236,229,230,116,128, 33, - 153,242,233,231,232,116,128, 33,152,247,232,233,244,101,128, 33, - 233,104, 2, 50, 71, 50,122,229,225,100, 4, 50, 83, 50, 93, 50, - 103, 50,114,228,239,247,238,237,239,100,128, 2,197,236,229,230, - 244,237,239,100,128, 2,194,242,233,231,232,244,237,239,100,128, - 2,195,245,240,237,239,100,128, 2,196,239,242,233,250,229,120, - 128,248,231,236,229,230,116,131, 33,144, 50,144, 50,161, 50,173, - 228,226,108,129, 33,208, 50,152,243,244,242,239,235,101,128, 33, - 205,239,246,229,242,242,233,231,232,116,128, 33,198,247,232,233, - 244,101,128, 33,230,242,233,231,232,116,132, 33,146, 50,197, 50, - 209, 50,217, 50,228,228,226,236,243,244,242,239,235,101,128, 33, - 207,232,229,225,246,121,128, 39,158,239,246,229,242,236,229,230, - 116,128, 33,196,247,232,233,244,101,128, 33,232,244,225, 98, 2, - 50,244, 50,251,236,229,230,116,128, 33,228,242,233,231,232,116, - 128, 33,229,245,112,132, 33,145, 51, 16, 51, 44, 51, 62, 51, 70, - 100, 2, 51, 22, 51, 34,110,129, 33,149, 51, 28,226,243,101,128, - 33,168,239,247,238,226,225,243,101,128, 33,168,236,229,230,116, - 129, 33,150, 51, 53,239,230,228,239,247,110,128, 33,197,242,233, - 231,232,116,128, 33,151,247,232,233,244,101,128, 33,231,246,229, - 242,244,229,120,128,248,230,115, 5, 51, 99, 51,175, 51,220, 52, - 47, 52, 57, 99, 2, 51,105, 51,157,233,105, 2, 51,112, 51,135, - 227,233,242,227,245,109,129, 0, 94, 51,123,237,239,238,239,243, - 240,225,227,101,128,255, 62,244,233,236,228,101,129, 0,126, 51, - 145,237,239,238,239,243,240,225,227,101,128,255, 94,242,233,240, - 116,129, 2, 81, 51,166,244,245,242,238,229,100,128, 2, 82,237, - 225,236,108, 2, 51,184, 51,195,232,233,242,225,231,225,238, 97, - 128, 48, 65,235,225,244,225,235,225,238, 97,129, 48,161, 51,208, - 232,225,236,230,247,233,228,244,104,128,255,103,244,229,242,233, - 115, 2, 51,230, 52, 43,107,131, 0, 42, 51,240, 52, 12, 52, 35, - 97, 2, 51,246, 52, 4,236,244,239,238,229,225,242,225,226,233, - 99,128, 6,109,242,225,226,233, 99,128, 6,109,109, 2, 52, 18, - 52, 24,225,244,104,128, 34, 23,239,238,239,243,240,225,227,101, - 128,255, 10,243,237,225,236,108,128,254, 97,109,128, 32, 66,245, - 240,229,242,233,239,114,128,246,233,249,237,240,244,239,244,233, - 227,225,236,236,249,229,241,245,225,108,128, 34, 67,116,132, 0, - 64, 52, 89, 52, 96, 52,108, 52,116,233,236,228,101,128, 0,227, - 237,239,238,239,243,240,225,227,101,128,255, 32,243,237,225,236, - 108,128,254,107,245,242,238,229,100,128, 2, 80,117, 6, 52,138, - 52,163, 52,170, 52,195, 52,215, 52,231, 98, 2, 52,144, 52,153, - 229,238,231,225,236,105,128, 9,148,239,240,239,237,239,230,111, - 128, 49, 32,228,229,246, 97,128, 9, 20,231,117, 2, 52,177, 52, - 186,234,225,242,225,244,105,128, 10,148,242,237,245,235,232,105, - 128, 10, 20,236,229,238,231,244,232,237,225,242,235,226,229,238, - 231,225,236,105,128, 9,215,237,225,244,242,225,231,245,242,237, - 245,235,232,105,128, 10, 76,246,239,247,229,236,243,233,231,110, - 3, 52,247, 53, 1, 53, 8,226,229,238,231,225,236,105,128, 9, - 204,228,229,246, 97,128, 9, 76,231,245,234,225,242,225,244,105, - 128, 10,204,246,225,231,242,225,232,225,228,229,246, 97,128, 9, - 61,121, 2, 53, 39, 53, 51,226,225,242,237,229,238,233,225,110, - 128, 5, 97,233,110,130, 5,226, 53, 60, 53, 75,225,236,244,239, - 238,229,232,229,226,242,229,119,128,251, 32,232,229,226,242,229, - 119,128, 5,226, 98,144, 0, 98, 53,120, 53,255, 54, 10, 54, 19, - 54, 44, 55, 85, 55,147, 55,220, 57,146, 57,158, 57,201, 57,209, - 57,219, 59, 89, 59,113, 59,122, 97, 7, 53,136, 53,146, 53,170, - 53,177, 53,202, 53,226, 53,237,226,229,238,231,225,236,105,128, - 9,172,227,235,243,236,225,243,104,129, 0, 92, 53,158,237,239, - 238,239,243,240,225,227,101,128,255, 60,228,229,246, 97,128, 9, - 44,231,117, 2, 53,184, 53,193,234,225,242,225,244,105,128, 10, - 172,242,237,245,235,232,105,128, 10, 44,104, 2, 53,208, 53,218, - 233,242,225,231,225,238, 97,128, 48,112,244,244,232,225,105,128, - 14, 63,235,225,244,225,235,225,238, 97,128, 48,208,114,129, 0, - 124, 53,243,237,239,238,239,243,240,225,227,101,128,255, 92,226, - 239,240,239,237,239,230,111,128, 49, 5,227,233,242,227,236,101, - 128, 36,209,228,239,116, 2, 54, 27, 54, 36,225,227,227,229,238, - 116,128, 30, 3,226,229,236,239,119,128, 30, 5,101, 6, 54, 58, - 54, 79, 54,102, 54,244, 54,255, 55, 11,225,237,229,228,243,233, - 248,244,229,229,238,244,232,238,239,244,229,115,128, 38,108, 99, - 2, 54, 85, 54, 92,225,245,243,101,128, 34, 53,249,242,233,236, - 236,233, 99,128, 4, 49,104, 5, 54,114, 54,123, 54,137, 54,167, - 54,226,225,242,225,226,233, 99,128, 6, 40,230,233,238,225,236, - 225,242,225,226,233, 99,128,254,144,105, 2, 54,143, 54,158,238, - 233,244,233,225,236,225,242,225,226,233, 99,128,254,145,242,225, - 231,225,238, 97,128, 48,121,237,101, 2, 54,174, 54,187,228,233, - 225,236,225,242,225,226,233, 99,128,254,146,229,237,105, 2, 54, - 195, 54,210,238,233,244,233,225,236,225,242,225,226,233, 99,128, - 252,159,243,239,236,225,244,229,228,225,242,225,226,233, 99,128, - 252, 8,238,239,239,238,230,233,238,225,236,225,242,225,226,233, - 99,128,252,109,235,225,244,225,235,225,238, 97,128, 48,217,238, - 225,242,237,229,238,233,225,110,128, 5, 98,116,132, 5,209, 55, - 23, 55, 43, 55, 63, 55, 72, 97,129, 3,178, 55, 29,243,249,237, - 226,239,236,231,242,229,229,107,128, 3,208,228,225,231,229,243, - 104,129,251, 49, 55, 54,232,229,226,242,229,119,128,251, 49,232, - 229,226,242,229,119,128, 5,209,242,225,230,229,232,229,226,242, - 229,119,128,251, 76,104, 2, 55, 91, 55,141, 97, 3, 55, 99, 55, - 109, 55,116,226,229,238,231,225,236,105,128, 9,173,228,229,246, - 97,128, 9, 45,231,117, 2, 55,123, 55,132,234,225,242,225,244, - 105,128, 10,173,242,237,245,235,232,105,128, 10, 45,239,239,107, - 128, 2, 83,105, 5, 55,159, 55,170, 55,181, 55,195, 55,209,232, - 233,242,225,231,225,238, 97,128, 48,115,235,225,244,225,235,225, - 238, 97,128, 48,211,236,225,226,233,225,236,227,236,233,227,107, - 128, 2,152,238,228,233,231,245,242,237,245,235,232,105,128, 10, - 2,242,245,243,241,245,225,242,101,128, 51, 49,108, 3, 55,228, - 57,129, 57,140, 97, 2, 55,234, 57,124,227,107, 6, 55,249, 56, - 2, 56, 39, 56,188, 56,243, 57, 39,227,233,242,227,236,101,128, - 37,207,100, 2, 56, 8, 56, 17,233,225,237,239,238,100,128, 37, - 198,239,247,238,240,239,233,238,244,233,238,231,244,242,233,225, - 238,231,236,101,128, 37,188,108, 2, 56, 45, 56,148,101, 2, 56, - 51, 56, 87,230,244,240,239,233,238,244,233,238,103, 2, 56, 66, - 56, 76,240,239,233,238,244,229,114,128, 37,196,244,242,233,225, - 238,231,236,101,128, 37,192,238,244,233,227,245,236,225,242,226, - 242,225,227,235,229,116, 2, 56,107, 56,127,236,229,230,116,129, - 48, 16, 56,116,246,229,242,244,233,227,225,108,128,254, 59,242, - 233,231,232,116,129, 48, 17, 56,137,246,229,242,244,233,227,225, - 108,128,254, 60,239,247,229,114, 2, 56,157, 56,172,236,229,230, - 244,244,242,233,225,238,231,236,101,128, 37,227,242,233,231,232, - 244,244,242,233,225,238,231,236,101,128, 37,226,114, 2, 56,194, - 56,205,229,227,244,225,238,231,236,101,128, 37,172,233,231,232, - 244,240,239,233,238,244,233,238,103, 2, 56,222, 56,232,240,239, - 233,238,244,229,114,128, 37,186,244,242,233,225,238,231,236,101, - 128, 37,182,115, 3, 56,251, 57, 25, 57, 33,109, 2, 57, 1, 57, - 13,225,236,236,243,241,245,225,242,101,128, 37,170,233,236,233, - 238,231,230,225,227,101,128, 38, 59,241,245,225,242,101,128, 37, - 160,244,225,114,128, 38, 5,245,240,112, 2, 57, 47, 57, 85,229, - 114, 2, 57, 54, 57, 69,236,229,230,244,244,242,233,225,238,231, - 236,101,128, 37,228,242,233,231,232,244,244,242,233,225,238,231, - 236,101,128, 37,229,239,233,238,244,233,238,103, 2, 57, 97, 57, - 113,243,237,225,236,236,244,242,233,225,238,231,236,101,128, 37, - 180,244,242,233,225,238,231,236,101,128, 37,178,238,107,128, 36, - 35,233,238,229,226,229,236,239,119,128, 30, 7,239,227,107,128, - 37,136,237,239,238,239,243,240,225,227,101,128,255, 66,111, 3, - 57,166, 57,179, 57,190,226,225,233,237,225,233,244,232,225,105, - 128, 14, 26,232,233,242,225,231,225,238, 97,128, 48,124,235,225, - 244,225,235,225,238, 97,128, 48,220,240,225,242,229,110,128, 36, - 157,241,243,241,245,225,242,101,128, 51,195,114, 4, 57,229, 58, - 223, 59, 40, 59, 79,225, 99, 2, 57,236, 58,130,101, 3, 57,244, - 57,249, 58, 61,229,120,128,248,244,236,229,230,116,133, 0,123, - 58, 10, 58, 15, 58, 37, 58, 45, 58, 50,226,116,128,248,243,109, - 2, 58, 21, 58, 26,233,100,128,248,242,239,238,239,243,240,225, - 227,101,128,255, 91,243,237,225,236,108,128,254, 91,244,112,128, - 248,241,246,229,242,244,233,227,225,108,128,254, 55,242,233,231, - 232,116,133, 0,125, 58, 79, 58, 84, 58,106, 58,114, 58,119,226, - 116,128,248,254,109, 2, 58, 90, 58, 95,233,100,128,248,253,239, - 238,239,243,240,225,227,101,128,255, 93,243,237,225,236,108,128, - 254, 92,244,112,128,248,252,246,229,242,244,233,227,225,108,128, - 254, 56,235,229,116, 2, 58,138, 58,180,236,229,230,116,132, 0, - 91, 58,153, 58,158, 58,163, 58,175,226,116,128,248,240,229,120, - 128,248,239,237,239,238,239,243,240,225,227,101,128,255, 59,244, - 112,128,248,238,242,233,231,232,116,132, 0, 93, 58,196, 58,201, - 58,206, 58,218,226,116,128,248,251,229,120,128,248,250,237,239, - 238,239,243,240,225,227,101,128,255, 61,244,112,128,248,249,229, - 246,101,131, 2,216, 58,235, 58,246, 58,252,226,229,236,239,247, - 227,237, 98,128, 3, 46,227,237, 98,128, 3, 6,233,238,246,229, - 242,244,229,100, 3, 59, 11, 59, 22, 59, 28,226,229,236,239,247, - 227,237, 98,128, 3, 47,227,237, 98,128, 3, 17,228,239,245,226, - 236,229,227,237, 98,128, 3, 97,233,228,231,101, 2, 59, 49, 59, - 60,226,229,236,239,247,227,237, 98,128, 3, 42,233,238,246,229, - 242,244,229,228,226,229,236,239,247,227,237, 98,128, 3, 58,239, - 235,229,238,226,225,114,128, 0,166,115, 2, 59, 95, 59,103,244, - 242,239,235,101,128, 1,128,245,240,229,242,233,239,114,128,246, - 234,244,239,240,226,225,114,128, 1,131,117, 3, 59,130, 59,141, - 59,152,232,233,242,225,231,225,238, 97,128, 48,118,235,225,244, - 225,235,225,238, 97,128, 48,214,236,108, 2, 59,159, 59,189,229, - 116,130, 32, 34, 59,168, 59,178,233,238,246,229,242,243,101,128, - 37,216,239,240,229,242,225,244,239,114,128, 34, 25,243,229,249, - 101,128, 37,206, 99,143, 0, 99, 59,230, 60,179, 60,190, 60,254, - 61, 29, 61,122, 63, 33, 64, 17, 64,117, 64,166, 67,158, 67,166, - 67,176, 67,188, 67,221, 97, 9, 59,250, 60, 5, 60, 15, 60, 22, - 60, 29, 60, 54, 60, 64, 60,116, 60,125,225,242,237,229,238,233, - 225,110,128, 5,110,226,229,238,231,225,236,105,128, 9,154,227, - 245,244,101,128, 1, 7,228,229,246, 97,128, 9, 26,231,117, 2, - 60, 36, 60, 45,234,225,242,225,244,105,128, 10,154,242,237,245, - 235,232,105,128, 10, 26,236,243,241,245,225,242,101,128, 51,136, - 238,228,242,225,226,233,238,228,117, 4, 60, 82, 60, 92, 60, 98, - 60,105,226,229,238,231,225,236,105,128, 9,129,227,237, 98,128, - 3, 16,228,229,246, 97,128, 9, 1,231,245,234,225,242,225,244, - 105,128, 10,129,240,243,236,239,227,107,128, 33,234,114, 3, 60, - 133, 60,139, 60,165,229,239,102,128, 33, 5,239,110,130, 2,199, - 60,148, 60,159,226,229,236,239,247,227,237, 98,128, 3, 44,227, - 237, 98,128, 3, 12,242,233,225,231,229,242,229,244,245,242,110, - 128, 33,181,226,239,240,239,237,239,230,111,128, 49, 24, 99, 4, - 60,200, 60,207, 60,226, 60,248,225,242,239,110,128, 1, 13,229, - 228,233,236,236, 97,129, 0,231, 60,218,225,227,245,244,101,128, - 30, 9,233,242, 99, 2, 60,234, 60,239,236,101,128, 36,210,245, - 237,230,236,229,120,128, 1, 9,245,242,108,128, 2, 85,100, 2, - 61, 4, 61, 20,239,116,129, 1, 11, 61, 11,225,227,227,229,238, - 116,128, 1, 11,243,241,245,225,242,101,128, 51,197,101, 2, 61, - 35, 61, 51,228,233,236,236, 97,129, 0,184, 61, 45,227,237, 98, - 128, 3, 39,238,116,132, 0,162, 61, 64, 61, 88, 61,100, 61,111, - 105, 2, 61, 70, 61, 78,231,242,225,228,101,128, 33, 3,238,230, - 229,242,233,239,114,128,246,223,237,239,238,239,243,240,225,227, - 101,128,255,224,239,236,228,243,244,249,236,101,128,247,162,243, - 245,240,229,242,233,239,114,128,246,224,104, 5, 61,134, 61,197, - 61,208, 62,136, 62,228, 97, 4, 61,144, 61,155, 61,165, 61,172, - 225,242,237,229,238,233,225,110,128, 5,121,226,229,238,231,225, - 236,105,128, 9,155,228,229,246, 97,128, 9, 27,231,117, 2, 61, - 179, 61,188,234,225,242,225,244,105,128, 10,155,242,237,245,235, - 232,105,128, 10, 27,226,239,240,239,237,239,230,111,128, 49, 20, - 101, 6, 61,222, 61,242, 62, 10, 62, 78, 62, 90, 62,111,225,226, - 235,232,225,243,233,225,238,227,249,242,233,236,236,233, 99,128, - 4,189, 99, 2, 61,248, 62, 0,235,237,225,242,107,128, 39, 19, - 249,242,233,236,236,233, 99,128, 4, 71,100, 2, 62, 16, 62, 60, - 229,243,227,229,238,228,229,114, 2, 62, 29, 62, 49,225,226,235, + 247,122,244,242,239,235,101,128, 1,181, 97,158, 0, 97, 36, 26, + 38,154, 39, 4, 39, 68, 39,132, 39,196, 40, 4, 40, 68, 40,126, + 40,190, 41, 70, 41,217, 42,137, 42,237, 43, 17, 49,192, 49,229, + 50, 0, 50,225, 51, 7, 52, 96, 52,168, 53,123, 53,132, 54, 5, + 56, 13, 57, 3, 57, 50, 57,201, 57,215, 49,138, 39, 1, 36, 50, + 36,114, 36,154, 36,218, 37, 26, 37, 90, 37,154, 37,218, 38, 26, + 38, 90, 48,138, 39, 33, 36, 74, 36, 78, 36, 82, 36, 86, 36, 90, + 36, 94, 36, 98, 36,102, 36,106, 36,110, 48,128, 39, 94, 49,128, + 39, 97, 50,128, 39, 98, 51,128, 39, 99, 52,128, 39,100, 53,128, + 39, 16, 54,128, 39,101, 55,128, 39,102, 56,128, 39,103, 57,128, + 38, 96, 49,134, 38, 27, 36,130, 36,134, 36,138, 36,142, 36,146, + 36,150, 48,128, 38,101, 49,128, 38,102, 50,128, 38, 99, 55,128, + 39, 9, 56,128, 39, 8, 57,128, 39, 7, 50,138, 38, 30, 36,178, + 36,182, 36,186, 36,190, 36,194, 36,198, 36,202, 36,206, 36,210, + 36,214, 48,128, 36, 96, 49,128, 36, 97, 50,128, 36, 98, 51,128, + 36, 99, 52,128, 36,100, 53,128, 36,101, 54,128, 36,102, 55,128, + 36,103, 56,128, 36,104, 57,128, 36,105, 51,138, 39, 12, 36,242, + 36,246, 36,250, 36,254, 37, 2, 37, 6, 37, 10, 37, 14, 37, 18, + 37, 22, 48,128, 39,118, 49,128, 39,119, 50,128, 39,120, 51,128, + 39,121, 52,128, 39,122, 53,128, 39,123, 54,128, 39,124, 55,128, + 39,125, 56,128, 39,126, 57,128, 39,127, 52,138, 39, 13, 37, 50, + 37, 54, 37, 58, 37, 62, 37, 66, 37, 70, 37, 74, 37, 78, 37, 82, + 37, 86, 48,128, 39,128, 49,128, 39,129, 50,128, 39,130, 51,128, + 39,131, 52,128, 39,132, 53,128, 39,133, 54,128, 39,134, 55,128, + 39,135, 56,128, 39,136, 57,128, 39,137, 53,138, 39, 14, 37,114, + 37,118, 37,122, 37,126, 37,130, 37,134, 37,138, 37,142, 37,146, + 37,150, 48,128, 39,138, 49,128, 39,139, 50,128, 39,140, 51,128, + 39,141, 52,128, 39,142, 53,128, 39,143, 54,128, 39,144, 55,128, + 39,145, 56,128, 39,146, 57,128, 39,147, 54,138, 39, 15, 37,178, + 37,182, 37,186, 37,190, 37,194, 37,198, 37,202, 37,206, 37,210, + 37,214, 48,128, 39,148, 49,128, 33,146, 50,128, 39,163, 51,128, + 33,148, 52,128, 33,149, 53,128, 39,153, 54,128, 39,155, 55,128, + 39,156, 56,128, 39,157, 57,128, 39,158, 55,138, 39, 17, 37,242, + 37,246, 37,250, 37,254, 38, 2, 38, 6, 38, 10, 38, 14, 38, 18, + 38, 22, 48,128, 39,159, 49,128, 39,160, 50,128, 39,161, 51,128, + 39,162, 52,128, 39,164, 53,128, 39,165, 54,128, 39,166, 55,128, + 39,167, 56,128, 39,168, 57,128, 39,169, 56,138, 39, 18, 38, 50, + 38, 54, 38, 58, 38, 62, 38, 66, 38, 70, 38, 74, 38, 78, 38, 82, + 38, 86, 48,128, 39,171, 49,128, 39,173, 50,128, 39,175, 51,128, + 39,178, 52,128, 39,179, 53,128, 39,181, 54,128, 39,184, 55,128, + 39,186, 56,128, 39,187, 57,128, 39,188, 57,138, 39, 19, 38,114, + 38,118, 38,122, 38,126, 38,130, 38,134, 38,138, 38,142, 38,146, + 38,150, 48,128, 39,189, 49,128, 39,190, 50,128, 39,154, 51,128, + 39,170, 52,128, 39,182, 53,128, 39,185, 54,128, 39,152, 55,128, + 39,180, 56,128, 39,183, 57,128, 39,172, 50,138, 39, 2, 38,178, + 38,224, 38,228, 38,232, 38,236, 38,240, 38,244, 38,248, 38,252, + 39, 0, 48,135, 39, 20, 38,196, 38,200, 38,204, 38,208, 38,212, + 38,216, 38,220, 48,128, 39,174, 49,128, 39,177, 50,128, 39, 3, + 51,128, 39, 80, 52,128, 39, 82, 53,128, 39,110, 54,128, 39,112, + 49,128, 39, 21, 50,128, 39, 22, 51,128, 39, 23, 52,128, 39, 24, + 53,128, 39, 25, 54,128, 39, 26, 55,128, 39, 27, 56,128, 39, 28, + 57,128, 39, 34, 51,138, 39, 4, 39, 28, 39, 32, 39, 36, 39, 40, + 39, 44, 39, 48, 39, 52, 39, 56, 39, 60, 39, 64, 48,128, 39, 35, + 49,128, 39, 36, 50,128, 39, 37, 51,128, 39, 38, 52,128, 39, 39, + 53,128, 38, 5, 54,128, 39, 41, 55,128, 39, 42, 56,128, 39, 43, + 57,128, 39, 44, 52,138, 38, 14, 39, 92, 39, 96, 39,100, 39,104, + 39,108, 39,112, 39,116, 39,120, 39,124, 39,128, 48,128, 39, 45, + 49,128, 39, 46, 50,128, 39, 47, 51,128, 39, 48, 52,128, 39, 49, + 53,128, 39, 50, 54,128, 39, 51, 55,128, 39, 52, 56,128, 39, 53, + 57,128, 39, 54, 53,138, 39, 6, 39,156, 39,160, 39,164, 39,168, + 39,172, 39,176, 39,180, 39,184, 39,188, 39,192, 48,128, 39, 55, + 49,128, 39, 56, 50,128, 39, 57, 51,128, 39, 58, 52,128, 39, 59, + 53,128, 39, 60, 54,128, 39, 61, 55,128, 39, 62, 56,128, 39, 63, + 57,128, 39, 64, 54,138, 39, 29, 39,220, 39,224, 39,228, 39,232, + 39,236, 39,240, 39,244, 39,248, 39,252, 40, 0, 48,128, 39, 65, + 49,128, 39, 66, 50,128, 39, 67, 51,128, 39, 68, 52,128, 39, 69, + 53,128, 39, 70, 54,128, 39, 71, 55,128, 39, 72, 56,128, 39, 73, + 57,128, 39, 74, 55,138, 39, 30, 40, 28, 40, 32, 40, 36, 40, 40, + 40, 44, 40, 48, 40, 52, 40, 56, 40, 60, 40, 64, 48,128, 39, 75, + 49,128, 37,207, 50,128, 39, 77, 51,128, 37,160, 52,128, 39, 79, + 53,128, 39, 81, 54,128, 37,178, 55,128, 37,188, 56,128, 37,198, + 57,128, 39, 86, 56,137, 39, 31, 40, 90, 40, 94, 40, 98, 40,102, + 40,106, 40,110, 40,114, 40,118, 40,122, 49,128, 37,215, 50,128, + 39, 88, 51,128, 39, 89, 52,128, 39, 90, 53,128, 39,111, 54,128, + 39,113, 55,128, 39,114, 56,128, 39,115, 57,128, 39,104, 57,138, + 39, 32, 40,150, 40,154, 40,158, 40,162, 40,166, 40,170, 40,174, + 40,178, 40,182, 40,186, 48,128, 39,105, 49,128, 39,108, 50,128, + 39,109, 51,128, 39,106, 52,128, 39,107, 53,128, 39,116, 54,128, + 39,117, 55,128, 39, 91, 56,128, 39, 92, 57,128, 39, 93, 97, 7, + 40,206, 40,216, 40,223, 40,230, 40,255, 41, 15, 41, 26,226,229, + 238,231,225,236,105,128, 9,134,227,245,244,101,128, 0,225,228, + 229,246, 97,128, 9, 6,231,117, 2, 40,237, 40,246,234,225,242, + 225,244,105,128, 10,134,242,237,245,235,232,105,128, 10, 6,237, + 225,244,242,225,231,245,242,237,245,235,232,105,128, 10, 62,242, + 245,243,241,245,225,242,101,128, 51, 3,246,239,247,229,236,243, + 233,231,110, 3, 41, 42, 41, 52, 41, 59,226,229,238,231,225,236, + 105,128, 9,190,228,229,246, 97,128, 9, 62,231,245,234,225,242, + 225,244,105,128, 10,190, 98, 4, 41, 80, 41,121, 41,130, 41,140, + 226,242,229,246,233,225,244,233,239,110, 2, 41, 95, 41,110,237, + 225,242,235,225,242,237,229,238,233,225,110,128, 5, 95,243,233, + 231,238,228,229,246, 97,128, 9,112,229,238,231,225,236,105,128, + 9,133,239,240,239,237,239,230,111,128, 49, 26,242,229,246,101, + 134, 1, 3, 41,159, 41,167, 41,178, 41,189, 41,197, 41,209,225, + 227,245,244,101,128, 30,175,227,249,242,233,236,236,233, 99,128, + 4,209,228,239,244,226,229,236,239,119,128, 30,183,231,242,225, + 246,101,128, 30,177,232,239,239,235,225,226,239,246,101,128, 30, + 179,244,233,236,228,101,128, 30,181, 99, 4, 41,227, 41,234, 42, + 57, 42,127,225,242,239,110,128, 1,206,233,242, 99, 2, 41,242, + 41,247,236,101,128, 36,208,245,237,230,236,229,120,133, 0,226, + 42, 10, 42, 18, 42, 29, 42, 37, 42, 49,225,227,245,244,101,128, + 30,165,228,239,244,226,229,236,239,119,128, 30,173,231,242,225, + 246,101,128, 30,167,232,239,239,235,225,226,239,246,101,128, 30, + 169,244,233,236,228,101,128, 30,171,245,244,101,133, 0,180, 42, + 73, 42, 84, 42,101, 42,108, 42,117,226,229,236,239,247,227,237, + 98,128, 3, 23, 99, 2, 42, 90, 42, 95,237, 98,128, 3, 1,239, + 237, 98,128, 3, 1,228,229,246, 97,128, 9, 84,236,239,247,237, + 239,100,128, 2,207,244,239,238,229,227,237, 98,128, 3, 65,249, + 242,233,236,236,233, 99,128, 4, 48,100, 5, 42,149, 42,159, 42, + 173, 42,179, 42,213,226,236,231,242,225,246,101,128, 2, 1,228, + 225,235,231,245,242,237,245,235,232,105,128, 10,113,229,246, 97, + 128, 9, 5,233,229,242,229,243,233,115,130, 0,228, 42,193, 42, + 204,227,249,242,233,236,236,233, 99,128, 4,211,237,225,227,242, + 239,110,128, 1,223,239,116, 2, 42,220, 42,228,226,229,236,239, + 119,128, 30,161,237,225,227,242,239,110,128, 1,225,101,131, 0, + 230, 42,247, 42,255, 43, 8,225,227,245,244,101,128, 1,253,235, + 239,242,229,225,110,128, 49, 80,237,225,227,242,239,110,128, 1, + 227,230,233,105, 6, 43, 33, 43, 53, 45,246, 45,252, 46, 11, 49, + 111, 48, 2, 43, 39, 43, 46,176,178,176, 56,128, 32, 21,184,185, + 180, 49,128, 32,164,177, 48, 3, 43, 62, 45, 86, 45,221, 48, 9, + 43, 82, 43,102, 43,164, 43,226, 44, 32, 44, 94, 44,156, 44,218, + 45, 24, 49, 3, 43, 90, 43, 94, 43, 98, 55,128, 4, 16, 56,128, + 4, 17, 57,128, 4, 18, 50, 10, 43,124, 43,128, 43,132, 43,136, + 43,140, 43,144, 43,148, 43,152, 43,156, 43,160, 48,128, 4, 19, + 49,128, 4, 20, 50,128, 4, 21, 51,128, 4, 1, 52,128, 4, 22, + 53,128, 4, 23, 54,128, 4, 24, 55,128, 4, 25, 56,128, 4, 26, + 57,128, 4, 27, 51, 10, 43,186, 43,190, 43,194, 43,198, 43,202, + 43,206, 43,210, 43,214, 43,218, 43,222, 48,128, 4, 28, 49,128, + 4, 29, 50,128, 4, 30, 51,128, 4, 31, 52,128, 4, 32, 53,128, + 4, 33, 54,128, 4, 34, 55,128, 4, 35, 56,128, 4, 36, 57,128, + 4, 37, 52, 10, 43,248, 43,252, 44, 0, 44, 4, 44, 8, 44, 12, + 44, 16, 44, 20, 44, 24, 44, 28, 48,128, 4, 38, 49,128, 4, 39, + 50,128, 4, 40, 51,128, 4, 41, 52,128, 4, 42, 53,128, 4, 43, + 54,128, 4, 44, 55,128, 4, 45, 56,128, 4, 46, 57,128, 4, 47, + 53, 10, 44, 54, 44, 58, 44, 62, 44, 66, 44, 70, 44, 74, 44, 78, + 44, 82, 44, 86, 44, 90, 48,128, 4,144, 49,128, 4, 2, 50,128, + 4, 3, 51,128, 4, 4, 52,128, 4, 5, 53,128, 4, 6, 54,128, + 4, 7, 55,128, 4, 8, 56,128, 4, 9, 57,128, 4, 10, 54, 10, + 44,116, 44,120, 44,124, 44,128, 44,132, 44,136, 44,140, 44,144, + 44,148, 44,152, 48,128, 4, 11, 49,128, 4, 12, 50,128, 4, 14, + 51,128,246,196, 52,128,246,197, 53,128, 4, 48, 54,128, 4, 49, + 55,128, 4, 50, 56,128, 4, 51, 57,128, 4, 52, 55, 10, 44,178, + 44,182, 44,186, 44,190, 44,194, 44,198, 44,202, 44,206, 44,210, + 44,214, 48,128, 4, 53, 49,128, 4, 81, 50,128, 4, 54, 51,128, + 4, 55, 52,128, 4, 56, 53,128, 4, 57, 54,128, 4, 58, 55,128, + 4, 59, 56,128, 4, 60, 57,128, 4, 61, 56, 10, 44,240, 44,244, + 44,248, 44,252, 45, 0, 45, 4, 45, 8, 45, 12, 45, 16, 45, 20, + 48,128, 4, 62, 49,128, 4, 63, 50,128, 4, 64, 51,128, 4, 65, + 52,128, 4, 66, 53,128, 4, 67, 54,128, 4, 68, 55,128, 4, 69, + 56,128, 4, 70, 57,128, 4, 71, 57, 10, 45, 46, 45, 50, 45, 54, + 45, 58, 45, 62, 45, 66, 45, 70, 45, 74, 45, 78, 45, 82, 48,128, + 4, 72, 49,128, 4, 73, 50,128, 4, 74, 51,128, 4, 75, 52,128, + 4, 76, 53,128, 4, 77, 54,128, 4, 78, 55,128, 4, 79, 56,128, + 4,145, 57,128, 4, 82, 49, 4, 45, 96, 45,158, 45,163, 45,189, + 48, 10, 45,118, 45,122, 45,126, 45,130, 45,134, 45,138, 45,142, + 45,146, 45,150, 45,154, 48,128, 4, 83, 49,128, 4, 84, 50,128, + 4, 85, 51,128, 4, 86, 52,128, 4, 87, 53,128, 4, 88, 54,128, + 4, 89, 55,128, 4, 90, 56,128, 4, 91, 57,128, 4, 92,177, 48, + 128, 4, 94, 52, 4, 45,173, 45,177, 45,181, 45,185, 53,128, 4, + 15, 54,128, 4, 98, 55,128, 4,114, 56,128, 4,116, 57, 5, 45, + 201, 45,205, 45,209, 45,213, 45,217, 50,128,246,198, 51,128, 4, + 95, 52,128, 4, 99, 53,128, 4,115, 54,128, 4,117, 56, 2, 45, + 227, 45,241, 51, 2, 45,233, 45,237, 49,128,246,199, 50,128,246, + 200,180, 54,128, 4,217,178,185, 57,128, 32, 14,179, 48, 2, 46, + 3, 46, 7, 48,128, 32, 15, 49,128, 32, 13,181, 55, 7, 46, 28, + 46, 98, 47,163, 47,240, 48,197, 49, 34, 49,105, 51, 2, 46, 34, + 46, 48, 56, 2, 46, 40, 46, 44, 49,128, 6,106, 56,128, 6, 12, + 57, 8, 46, 66, 46, 70, 46, 74, 46, 78, 46, 82, 46, 86, 46, 90, + 46, 94, 50,128, 6, 96, 51,128, 6, 97, 52,128, 6, 98, 53,128, + 6, 99, 54,128, 6,100, 55,128, 6,101, 56,128, 6,102, 57,128, + 6,103, 52, 7, 46,114, 46,146, 46,208, 47, 14, 47, 46, 47,102, + 47,158, 48, 5, 46,126, 46,130, 46,134, 46,138, 46,142, 48,128, + 6,104, 49,128, 6,105, 51,128, 6, 27, 55,128, 6, 31, 57,128, + 6, 33, 49, 10, 46,168, 46,172, 46,176, 46,180, 46,184, 46,188, + 46,192, 46,196, 46,200, 46,204, 48,128, 6, 34, 49,128, 6, 35, + 50,128, 6, 36, 51,128, 6, 37, 52,128, 6, 38, 53,128, 6, 39, + 54,128, 6, 40, 55,128, 6, 41, 56,128, 6, 42, 57,128, 6, 43, + 50, 10, 46,230, 46,234, 46,238, 46,242, 46,246, 46,250, 46,254, + 47, 2, 47, 6, 47, 10, 48,128, 6, 44, 49,128, 6, 45, 50,128, + 6, 46, 51,128, 6, 47, 52,128, 6, 48, 53,128, 6, 49, 54,128, + 6, 50, 55,128, 6, 51, 56,128, 6, 52, 57,128, 6, 53, 51, 5, + 47, 26, 47, 30, 47, 34, 47, 38, 47, 42, 48,128, 6, 54, 49,128, + 6, 55, 50,128, 6, 56, 51,128, 6, 57, 52,128, 6, 58, 52, 9, + 47, 66, 47, 70, 47, 74, 47, 78, 47, 82, 47, 86, 47, 90, 47, 94, + 47, 98, 48,128, 6, 64, 49,128, 6, 65, 50,128, 6, 66, 51,128, + 6, 67, 52,128, 6, 68, 53,128, 6, 69, 54,128, 6, 70, 56,128, + 6, 72, 57,128, 6, 73, 53, 9, 47,122, 47,126, 47,130, 47,134, + 47,138, 47,142, 47,146, 47,150, 47,154, 48,128, 6, 74, 49,128, + 6, 75, 50,128, 6, 76, 51,128, 6, 77, 52,128, 6, 78, 53,128, + 6, 79, 54,128, 6, 80, 55,128, 6, 81, 56,128, 6, 82,183, 48, + 128, 6, 71, 53, 3, 47,171, 47,203, 47,235, 48, 5, 47,183, 47, + 187, 47,191, 47,195, 47,199, 53,128, 6,164, 54,128, 6,126, 55, + 128, 6,134, 56,128, 6,152, 57,128, 6,175, 49, 5, 47,215, 47, + 219, 47,223, 47,227, 47,231, 49,128, 6,121, 50,128, 6,136, 51, + 128, 6,145, 52,128, 6,186, 57,128, 6,210,179, 52,128, 6,213, + 54, 7, 48, 0, 48, 5, 48, 10, 48, 15, 48, 53, 48,115, 48,177, + 179, 54,128, 32,170,180, 53,128, 5,190,181, 56,128, 5,195, 54, + 6, 48, 29, 48, 33, 48, 37, 48, 41, 48, 45, 48, 49, 52,128, 5, + 208, 53,128, 5,209, 54,128, 5,210, 55,128, 5,211, 56,128, 5, + 212, 57,128, 5,213, 55, 10, 48, 75, 48, 79, 48, 83, 48, 87, 48, + 91, 48, 95, 48, 99, 48,103, 48,107, 48,111, 48,128, 5,214, 49, + 128, 5,215, 50,128, 5,216, 51,128, 5,217, 52,128, 5,218, 53, + 128, 5,219, 54,128, 5,220, 55,128, 5,221, 56,128, 5,222, 57, + 128, 5,223, 56, 10, 48,137, 48,141, 48,145, 48,149, 48,153, 48, + 157, 48,161, 48,165, 48,169, 48,173, 48,128, 5,224, 49,128, 5, + 225, 50,128, 5,226, 51,128, 5,227, 52,128, 5,228, 53,128, 5, + 229, 54,128, 5,230, 55,128, 5,231, 56,128, 5,232, 57,128, 5, + 233, 57, 3, 48,185, 48,189, 48,193, 48,128, 5,234, 52,128,251, + 42, 53,128,251, 43, 55, 4, 48,207, 48,221, 48,241, 48,246, 48, + 2, 48,213, 48,217, 48,128,251, 75, 53,128,251, 31, 49, 3, 48, + 229, 48,233, 48,237, 54,128, 5,240, 55,128, 5,241, 56,128, 5, + 242,178, 51,128,251, 53, 57, 7, 49, 6, 49, 10, 49, 14, 49, 18, + 49, 22, 49, 26, 49, 30, 51,128, 5,180, 52,128, 5,181, 53,128, + 5,182, 54,128, 5,187, 55,128, 5,184, 56,128, 5,183, 57,128, + 5,176, 56, 3, 49, 42, 49, 86, 49, 91, 48, 7, 49, 58, 49, 62, + 49, 66, 49, 70, 49, 74, 49, 78, 49, 82, 48,128, 5,178, 49,128, + 5,177, 50,128, 5,179, 51,128, 5,194, 52,128, 5,193, 54,128, + 5,185, 55,128, 5,188,179, 57,128, 5,189, 52, 2, 49, 97, 49, + 101, 49,128, 5,191, 50,128, 5,192,185,178, 57,128, 2,188, 54, + 3, 49,119, 49,178, 49,185, 49, 4, 49,129, 49,145, 49,151, 49, + 172, 50, 2, 49,135, 49,140,180, 56,128, 33, 5,184, 57,128, 33, + 19,179,181, 50,128, 33, 22,181, 55, 3, 49,160, 49,164, 49,168, + 51,128, 32, 44, 52,128, 32, 45, 53,128, 32, 46,182,182, 52,128, + 32, 12,179,177,182, 55,128, 6,109,180,185,179, 55,128, 2,189, + 103, 2, 49,198, 49,205,242,225,246,101,128, 0,224,117, 2, 49, + 211, 49,220,234,225,242,225,244,105,128, 10,133,242,237,245,235, + 232,105,128, 10, 5,104, 2, 49,235, 49,245,233,242,225,231,225, + 238, 97,128, 48, 66,239,239,235,225,226,239,246,101,128, 30,163, + 105, 7, 50, 16, 50, 41, 50, 48, 50, 60, 50, 85, 50,101, 50,181, + 98, 2, 50, 22, 50, 31,229,238,231,225,236,105,128, 9,144,239, + 240,239,237,239,230,111,128, 49, 30,228,229,246, 97,128, 9, 16, + 229,227,249,242,233,236,236,233, 99,128, 4,213,231,117, 2, 50, + 67, 50, 76,234,225,242,225,244,105,128, 10,144,242,237,245,235, + 232,105,128, 10, 16,237,225,244,242,225,231,245,242,237,245,235, + 232,105,128, 10, 72,110, 5, 50,113, 50,122, 50,136, 50,152, 50, + 167,225,242,225,226,233, 99,128, 6, 57,230,233,238,225,236,225, + 242,225,226,233, 99,128,254,202,233,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,254,203,237,229,228,233,225,236,225,242, + 225,226,233, 99,128,254,204,246,229,242,244,229,228,226,242,229, + 246,101,128, 2, 3,246,239,247,229,236,243,233,231,110, 3, 50, + 197, 50,207, 50,214,226,229,238,231,225,236,105,128, 9,200,228, + 229,246, 97,128, 9, 72,231,245,234,225,242,225,244,105,128, 10, + 200,107, 2, 50,231, 50,255,225,244,225,235,225,238, 97,129, 48, + 162, 50,243,232,225,236,230,247,233,228,244,104,128,255,113,239, + 242,229,225,110,128, 49, 79,108, 3, 51, 15, 52, 71, 52, 80,101, + 2, 51, 21, 52, 66,102,136, 5,208, 51, 41, 51, 50, 51, 65, 51, + 79, 51,168, 51,182, 52, 37, 52, 51,225,242,225,226,233, 99,128, + 6, 39,228,225,231,229,243,232,232,229,226,242,229,119,128,251, + 48,230,233,238,225,236,225,242,225,226,233, 99,128,254,142,104, + 2, 51, 85, 51,160,225,237,250, 97, 2, 51, 94, 51,127,225,226, + 239,246,101, 2, 51,104, 51,113,225,242,225,226,233, 99,128, 6, + 35,230,233,238,225,236,225,242,225,226,233, 99,128,254,132,226, + 229,236,239,119, 2, 51,137, 51,146,225,242,225,226,233, 99,128, + 6, 37,230,233,238,225,236,225,242,225,226,233, 99,128,254,136, + 229,226,242,229,119,128, 5,208,236,225,237,229,228,232,229,226, + 242,229,119,128,251, 79,237, 97, 2, 51,189, 51,225,228,228,225, + 225,226,239,246,101, 2, 51,202, 51,211,225,242,225,226,233, 99, + 128, 6, 34,230,233,238,225,236,225,242,225,226,233, 99,128,254, + 130,235,243,245,242, 97, 4, 51,239, 51,248, 52, 6, 52, 22,225, + 242,225,226,233, 99,128, 6, 73,230,233,238,225,236,225,242,225, + 226,233, 99,128,254,240,233,238,233,244,233,225,236,225,242,225, + 226,233, 99,128,254,243,237,229,228,233,225,236,225,242,225,226, + 233, 99,128,254,244,240,225,244,225,232,232,229,226,242,229,119, + 128,251, 46,241,225,237,225,244,243,232,229,226,242,229,119,128, + 251, 47,240,104,128, 33, 53,236,229,241,245,225,108,128, 34, 76, + 240,232, 97,129, 3,177, 52, 88,244,239,238,239,115,128, 3,172, + 109, 4, 52,106, 52,114, 52,125, 52,159,225,227,242,239,110,128, + 1, 1,239,238,239,243,240,225,227,101,128,255, 65,240,229,242, + 243,225,238,100,130, 0, 38, 52,139, 52,151,237,239,238,239,243, + 240,225,227,101,128,255, 6,243,237,225,236,108,128,247, 38,243, + 241,245,225,242,101,128, 51,194,110, 4, 52,178, 52,189, 53, 55, + 53, 65,226,239,240,239,237,239,230,111,128, 49, 34,103, 4, 52, + 199, 52,210, 52,224, 53, 47,226,239,240,239,237,239,230,111,128, + 49, 36,235,232,225,238,235,232,245,244,232,225,105,128, 14, 90, + 236,101,131, 34, 32, 52,235, 53, 32, 53, 39,226,242,225,227,235, + 229,116, 2, 52,247, 53, 11,236,229,230,116,129, 48, 8, 53, 0, + 246,229,242,244,233,227,225,108,128,254, 63,242,233,231,232,116, + 129, 48, 9, 53, 21,246,229,242,244,233,227,225,108,128,254, 64, + 236,229,230,116,128, 35, 41,242,233,231,232,116,128, 35, 42,243, + 244,242,239,109,128, 33, 43,239,244,229,236,229,233, 97,128, 3, + 135,117, 2, 53, 71, 53, 83,228,225,244,244,225,228,229,246, 97, + 128, 9, 82,243,246,225,242, 97, 3, 53, 95, 53,105, 53,112,226, + 229,238,231,225,236,105,128, 9,130,228,229,246, 97,128, 9, 2, + 231,245,234,225,242,225,244,105,128, 10,130,239,231,239,238,229, + 107,128, 1, 5,112, 3, 53,140, 53,164, 53,194, 97, 2, 53,146, + 53,158,225,244,239,243,241,245,225,242,101,128, 51, 0,242,229, + 110,128, 36,156,239,243,244,242,239,240,232,101, 2, 53,177, 53, + 188,225,242,237,229,238,233,225,110,128, 5, 90,237,239,100,128, + 2,188,112, 2, 53,200, 53,205,236,101,128,248,255,242,111, 2, + 53,212, 53,220,225,227,232,229,115,128, 34, 80,120, 2, 53,226, + 53,246,229,241,245,225,108,129, 34, 72, 53,236,239,242,233,237, + 225,231,101,128, 34, 82,233,237,225,244,229,236,249,229,241,245, + 225,108,128, 34, 69,114, 4, 54, 15, 54, 42, 54, 46, 54, 91,225, + 229, 97, 2, 54, 23, 54, 33,229,235,239,242,229,225,110,128, 49, + 142,235,239,242,229,225,110,128, 49,141, 99,128, 35, 18,105, 2, + 54, 52, 54, 66,231,232,244,232,225,236,230,242,233,238,103,128, + 30,154,238,103,130, 0,229, 54, 75, 54, 83,225,227,245,244,101, + 128, 1,251,226,229,236,239,119,128, 30, 1,242,239,119, 8, 54, + 111, 54,118, 54,247, 55, 57, 55,107, 55,162, 55,185, 56, 4,226, + 239,244,104,128, 33,148,100, 3, 54,126, 54,165, 54,212,225,243, + 104, 4, 54,138, 54,145, 54,152, 54,160,228,239,247,110,128, 33, + 227,236,229,230,116,128, 33,224,242,233,231,232,116,128, 33,226, + 245,112,128, 33,225,226,108, 5, 54,178, 54,185, 54,192, 54,199, + 54,207,226,239,244,104,128, 33,212,228,239,247,110,128, 33,211, + 236,229,230,116,128, 33,208,242,233,231,232,116,128, 33,210,245, + 112,128, 33,209,239,247,110,131, 33,147, 54,224, 54,231, 54,239, + 236,229,230,116,128, 33,153,242,233,231,232,116,128, 33,152,247, + 232,233,244,101,128, 33,233,104, 2, 54,253, 55, 48,229,225,100, + 4, 55, 9, 55, 19, 55, 29, 55, 40,228,239,247,238,237,239,100, + 128, 2,197,236,229,230,244,237,239,100,128, 2,194,242,233,231, + 232,244,237,239,100,128, 2,195,245,240,237,239,100,128, 2,196, + 239,242,233,250,229,120,128,248,231,236,229,230,116,131, 33,144, + 55, 70, 55, 87, 55, 99,228,226,108,129, 33,208, 55, 78,243,244, + 242,239,235,101,128, 33,205,239,246,229,242,242,233,231,232,116, + 128, 33,198,247,232,233,244,101,128, 33,230,242,233,231,232,116, + 132, 33,146, 55,123, 55,135, 55,143, 55,154,228,226,236,243,244, + 242,239,235,101,128, 33,207,232,229,225,246,121,128, 39,158,239, + 246,229,242,236,229,230,116,128, 33,196,247,232,233,244,101,128, + 33,232,244,225, 98, 2, 55,170, 55,177,236,229,230,116,128, 33, + 228,242,233,231,232,116,128, 33,229,245,112,132, 33,145, 55,198, + 55,226, 55,244, 55,252,100, 2, 55,204, 55,216,110,129, 33,149, + 55,210,226,243,101,128, 33,168,239,247,238,226,225,243,101,128, + 33,168,236,229,230,116,129, 33,150, 55,235,239,230,228,239,247, + 110,128, 33,197,242,233,231,232,116,128, 33,151,247,232,233,244, + 101,128, 33,231,246,229,242,244,229,120,128,248,230,115, 5, 56, + 25, 56,101, 56,146, 56,229, 56,239, 99, 2, 56, 31, 56, 83,233, + 105, 2, 56, 38, 56, 61,227,233,242,227,245,109,129, 0, 94, 56, + 49,237,239,238,239,243,240,225,227,101,128,255, 62,244,233,236, + 228,101,129, 0,126, 56, 71,237,239,238,239,243,240,225,227,101, + 128,255, 94,242,233,240,116,129, 2, 81, 56, 92,244,245,242,238, + 229,100,128, 2, 82,237,225,236,108, 2, 56,110, 56,121,232,233, + 242,225,231,225,238, 97,128, 48, 65,235,225,244,225,235,225,238, + 97,129, 48,161, 56,134,232,225,236,230,247,233,228,244,104,128, + 255,103,244,229,242,233,115, 2, 56,156, 56,225,107,131, 0, 42, + 56,166, 56,194, 56,217, 97, 2, 56,172, 56,186,236,244,239,238, + 229,225,242,225,226,233, 99,128, 6,109,242,225,226,233, 99,128, + 6,109,109, 2, 56,200, 56,206,225,244,104,128, 34, 23,239,238, + 239,243,240,225,227,101,128,255, 10,243,237,225,236,108,128,254, + 97,109,128, 32, 66,245,240,229,242,233,239,114,128,246,233,249, + 237,240,244,239,244,233,227,225,236,236,249,229,241,245,225,108, + 128, 34, 67,116,132, 0, 64, 57, 15, 57, 22, 57, 34, 57, 42,233, + 236,228,101,128, 0,227,237,239,238,239,243,240,225,227,101,128, + 255, 32,243,237,225,236,108,128,254,107,245,242,238,229,100,128, + 2, 80,117, 6, 57, 64, 57, 89, 57, 96, 57,121, 57,141, 57,157, + 98, 2, 57, 70, 57, 79,229,238,231,225,236,105,128, 9,148,239, + 240,239,237,239,230,111,128, 49, 32,228,229,246, 97,128, 9, 20, + 231,117, 2, 57,103, 57,112,234,225,242,225,244,105,128, 10,148, + 242,237,245,235,232,105,128, 10, 20,236,229,238,231,244,232,237, + 225,242,235,226,229,238,231,225,236,105,128, 9,215,237,225,244, + 242,225,231,245,242,237,245,235,232,105,128, 10, 76,246,239,247, + 229,236,243,233,231,110, 3, 57,173, 57,183, 57,190,226,229,238, + 231,225,236,105,128, 9,204,228,229,246, 97,128, 9, 76,231,245, + 234,225,242,225,244,105,128, 10,204,246,225,231,242,225,232,225, + 228,229,246, 97,128, 9, 61,121, 2, 57,221, 57,233,226,225,242, + 237,229,238,233,225,110,128, 5, 97,233,110,130, 5,226, 57,242, + 58, 1,225,236,244,239,238,229,232,229,226,242,229,119,128,251, + 32,232,229,226,242,229,119,128, 5,226, 98,144, 0, 98, 58, 46, + 58,181, 58,192, 58,201, 58,226, 60, 11, 60, 73, 60,146, 62, 72, + 62, 84, 62,127, 62,135, 62,145, 64, 15, 64, 39, 64, 48, 97, 7, + 58, 62, 58, 72, 58, 96, 58,103, 58,128, 58,152, 58,163,226,229, + 238,231,225,236,105,128, 9,172,227,235,243,236,225,243,104,129, + 0, 92, 58, 84,237,239,238,239,243,240,225,227,101,128,255, 60, + 228,229,246, 97,128, 9, 44,231,117, 2, 58,110, 58,119,234,225, + 242,225,244,105,128, 10,172,242,237,245,235,232,105,128, 10, 44, + 104, 2, 58,134, 58,144,233,242,225,231,225,238, 97,128, 48,112, + 244,244,232,225,105,128, 14, 63,235,225,244,225,235,225,238, 97, + 128, 48,208,114,129, 0,124, 58,169,237,239,238,239,243,240,225, + 227,101,128,255, 92,226,239,240,239,237,239,230,111,128, 49, 5, + 227,233,242,227,236,101,128, 36,209,228,239,116, 2, 58,209, 58, + 218,225,227,227,229,238,116,128, 30, 3,226,229,236,239,119,128, + 30, 5,101, 6, 58,240, 59, 5, 59, 28, 59,170, 59,181, 59,193, + 225,237,229,228,243,233,248,244,229,229,238,244,232,238,239,244, + 229,115,128, 38,108, 99, 2, 59, 11, 59, 18,225,245,243,101,128, + 34, 53,249,242,233,236,236,233, 99,128, 4, 49,104, 5, 59, 40, + 59, 49, 59, 63, 59, 93, 59,152,225,242,225,226,233, 99,128, 6, + 40,230,233,238,225,236,225,242,225,226,233, 99,128,254,144,105, + 2, 59, 69, 59, 84,238,233,244,233,225,236,225,242,225,226,233, + 99,128,254,145,242,225,231,225,238, 97,128, 48,121,237,101, 2, + 59,100, 59,113,228,233,225,236,225,242,225,226,233, 99,128,254, + 146,229,237,105, 2, 59,121, 59,136,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,252,159,243,239,236,225,244,229,228,225, + 242,225,226,233, 99,128,252, 8,238,239,239,238,230,233,238,225, + 236,225,242,225,226,233, 99,128,252,109,235,225,244,225,235,225, + 238, 97,128, 48,217,238,225,242,237,229,238,233,225,110,128, 5, + 98,116,132, 5,209, 59,205, 59,225, 59,245, 59,254, 97,129, 3, + 178, 59,211,243,249,237,226,239,236,231,242,229,229,107,128, 3, + 208,228,225,231,229,243,104,129,251, 49, 59,236,232,229,226,242, + 229,119,128,251, 49,232,229,226,242,229,119,128, 5,209,242,225, + 230,229,232,229,226,242,229,119,128,251, 76,104, 2, 60, 17, 60, + 67, 97, 3, 60, 25, 60, 35, 60, 42,226,229,238,231,225,236,105, + 128, 9,173,228,229,246, 97,128, 9, 45,231,117, 2, 60, 49, 60, + 58,234,225,242,225,244,105,128, 10,173,242,237,245,235,232,105, + 128, 10, 45,239,239,107,128, 2, 83,105, 5, 60, 85, 60, 96, 60, + 107, 60,121, 60,135,232,233,242,225,231,225,238, 97,128, 48,115, + 235,225,244,225,235,225,238, 97,128, 48,211,236,225,226,233,225, + 236,227,236,233,227,107,128, 2,152,238,228,233,231,245,242,237, + 245,235,232,105,128, 10, 2,242,245,243,241,245,225,242,101,128, + 51, 49,108, 3, 60,154, 62, 55, 62, 66, 97, 2, 60,160, 62, 50, + 227,107, 6, 60,175, 60,184, 60,221, 61,114, 61,169, 61,221,227, + 233,242,227,236,101,128, 37,207,100, 2, 60,190, 60,199,233,225, + 237,239,238,100,128, 37,198,239,247,238,240,239,233,238,244,233, + 238,231,244,242,233,225,238,231,236,101,128, 37,188,108, 2, 60, + 227, 61, 74,101, 2, 60,233, 61, 13,230,244,240,239,233,238,244, + 233,238,103, 2, 60,248, 61, 2,240,239,233,238,244,229,114,128, + 37,196,244,242,233,225,238,231,236,101,128, 37,192,238,244,233, + 227,245,236,225,242,226,242,225,227,235,229,116, 2, 61, 33, 61, + 53,236,229,230,116,129, 48, 16, 61, 42,246,229,242,244,233,227, + 225,108,128,254, 59,242,233,231,232,116,129, 48, 17, 61, 63,246, + 229,242,244,233,227,225,108,128,254, 60,239,247,229,114, 2, 61, + 83, 61, 98,236,229,230,244,244,242,233,225,238,231,236,101,128, + 37,227,242,233,231,232,244,244,242,233,225,238,231,236,101,128, + 37,226,114, 2, 61,120, 61,131,229,227,244,225,238,231,236,101, + 128, 37,172,233,231,232,244,240,239,233,238,244,233,238,103, 2, + 61,148, 61,158,240,239,233,238,244,229,114,128, 37,186,244,242, + 233,225,238,231,236,101,128, 37,182,115, 3, 61,177, 61,207, 61, + 215,109, 2, 61,183, 61,195,225,236,236,243,241,245,225,242,101, + 128, 37,170,233,236,233,238,231,230,225,227,101,128, 38, 59,241, + 245,225,242,101,128, 37,160,244,225,114,128, 38, 5,245,240,112, + 2, 61,229, 62, 11,229,114, 2, 61,236, 61,251,236,229,230,244, + 244,242,233,225,238,231,236,101,128, 37,228,242,233,231,232,244, + 244,242,233,225,238,231,236,101,128, 37,229,239,233,238,244,233, + 238,103, 2, 62, 23, 62, 39,243,237,225,236,236,244,242,233,225, + 238,231,236,101,128, 37,180,244,242,233,225,238,231,236,101,128, + 37,178,238,107,128, 36, 35,233,238,229,226,229,236,239,119,128, + 30, 7,239,227,107,128, 37,136,237,239,238,239,243,240,225,227, + 101,128,255, 66,111, 3, 62, 92, 62,105, 62,116,226,225,233,237, + 225,233,244,232,225,105,128, 14, 26,232,233,242,225,231,225,238, + 97,128, 48,124,235,225,244,225,235,225,238, 97,128, 48,220,240, + 225,242,229,110,128, 36,157,241,243,241,245,225,242,101,128, 51, + 195,114, 4, 62,155, 63,149, 63,222, 64, 5,225, 99, 2, 62,162, + 63, 56,101, 3, 62,170, 62,175, 62,243,229,120,128,248,244,236, + 229,230,116,133, 0,123, 62,192, 62,197, 62,219, 62,227, 62,232, + 226,116,128,248,243,109, 2, 62,203, 62,208,233,100,128,248,242, + 239,238,239,243,240,225,227,101,128,255, 91,243,237,225,236,108, + 128,254, 91,244,112,128,248,241,246,229,242,244,233,227,225,108, + 128,254, 55,242,233,231,232,116,133, 0,125, 63, 5, 63, 10, 63, + 32, 63, 40, 63, 45,226,116,128,248,254,109, 2, 63, 16, 63, 21, + 233,100,128,248,253,239,238,239,243,240,225,227,101,128,255, 93, + 243,237,225,236,108,128,254, 92,244,112,128,248,252,246,229,242, + 244,233,227,225,108,128,254, 56,235,229,116, 2, 63, 64, 63,106, + 236,229,230,116,132, 0, 91, 63, 79, 63, 84, 63, 89, 63,101,226, + 116,128,248,240,229,120,128,248,239,237,239,238,239,243,240,225, + 227,101,128,255, 59,244,112,128,248,238,242,233,231,232,116,132, + 0, 93, 63,122, 63,127, 63,132, 63,144,226,116,128,248,251,229, + 120,128,248,250,237,239,238,239,243,240,225,227,101,128,255, 61, + 244,112,128,248,249,229,246,101,131, 2,216, 63,161, 63,172, 63, + 178,226,229,236,239,247,227,237, 98,128, 3, 46,227,237, 98,128, + 3, 6,233,238,246,229,242,244,229,100, 3, 63,193, 63,204, 63, + 210,226,229,236,239,247,227,237, 98,128, 3, 47,227,237, 98,128, + 3, 17,228,239,245,226,236,229,227,237, 98,128, 3, 97,233,228, + 231,101, 2, 63,231, 63,242,226,229,236,239,247,227,237, 98,128, + 3, 42,233,238,246,229,242,244,229,228,226,229,236,239,247,227, + 237, 98,128, 3, 58,239,235,229,238,226,225,114,128, 0,166,115, + 2, 64, 21, 64, 29,244,242,239,235,101,128, 1,128,245,240,229, + 242,233,239,114,128,246,234,244,239,240,226,225,114,128, 1,131, + 117, 3, 64, 56, 64, 67, 64, 78,232,233,242,225,231,225,238, 97, + 128, 48,118,235,225,244,225,235,225,238, 97,128, 48,214,236,108, + 2, 64, 85, 64,115,229,116,130, 32, 34, 64, 94, 64,104,233,238, + 246,229,242,243,101,128, 37,216,239,240,229,242,225,244,239,114, + 128, 34, 25,243,229,249,101,128, 37,206, 99,143, 0, 99, 64,156, + 65,105, 65,116, 65,180, 65,211, 66, 48, 67,215, 68,199, 69, 43, + 69, 92, 72, 84, 72, 92, 72,102, 72,114, 72,147, 97, 9, 64,176, + 64,187, 64,197, 64,204, 64,211, 64,236, 64,246, 65, 42, 65, 51, + 225,242,237,229,238,233,225,110,128, 5,110,226,229,238,231,225, + 236,105,128, 9,154,227,245,244,101,128, 1, 7,228,229,246, 97, + 128, 9, 26,231,117, 2, 64,218, 64,227,234,225,242,225,244,105, + 128, 10,154,242,237,245,235,232,105,128, 10, 26,236,243,241,245, + 225,242,101,128, 51,136,238,228,242,225,226,233,238,228,117, 4, + 65, 8, 65, 18, 65, 24, 65, 31,226,229,238,231,225,236,105,128, + 9,129,227,237, 98,128, 3, 16,228,229,246, 97,128, 9, 1,231, + 245,234,225,242,225,244,105,128, 10,129,240,243,236,239,227,107, + 128, 33,234,114, 3, 65, 59, 65, 65, 65, 91,229,239,102,128, 33, + 5,239,110,130, 2,199, 65, 74, 65, 85,226,229,236,239,247,227, + 237, 98,128, 3, 44,227,237, 98,128, 3, 12,242,233,225,231,229, + 242,229,244,245,242,110,128, 33,181,226,239,240,239,237,239,230, + 111,128, 49, 24, 99, 4, 65,126, 65,133, 65,152, 65,174,225,242, + 239,110,128, 1, 13,229,228,233,236,236, 97,129, 0,231, 65,144, + 225,227,245,244,101,128, 30, 9,233,242, 99, 2, 65,160, 65,165, + 236,101,128, 36,210,245,237,230,236,229,120,128, 1, 9,245,242, + 108,128, 2, 85,100, 2, 65,186, 65,202,239,116,129, 1, 11, 65, + 193,225,227,227,229,238,116,128, 1, 11,243,241,245,225,242,101, + 128, 51,197,101, 2, 65,217, 65,233,228,233,236,236, 97,129, 0, + 184, 65,227,227,237, 98,128, 3, 39,238,116,132, 0,162, 65,246, + 66, 14, 66, 26, 66, 37,105, 2, 65,252, 66, 4,231,242,225,228, + 101,128, 33, 3,238,230,229,242,233,239,114,128,246,223,237,239, + 238,239,243,240,225,227,101,128,255,224,239,236,228,243,244,249, + 236,101,128,247,162,243,245,240,229,242,233,239,114,128,246,224, + 104, 5, 66, 60, 66,123, 66,134, 67, 62, 67,154, 97, 4, 66, 70, + 66, 81, 66, 91, 66, 98,225,242,237,229,238,233,225,110,128, 5, + 121,226,229,238,231,225,236,105,128, 9,155,228,229,246, 97,128, + 9, 27,231,117, 2, 66,105, 66,114,234,225,242,225,244,105,128, + 10,155,242,237,245,235,232,105,128, 10, 27,226,239,240,239,237, + 239,230,111,128, 49, 20,101, 6, 66,148, 66,168, 66,192, 67, 4, + 67, 16, 67, 37,225,226,235,232,225,243,233,225,238,227,249,242, + 233,236,236,233, 99,128, 4,189, 99, 2, 66,174, 66,182,235,237, + 225,242,107,128, 39, 19,249,242,233,236,236,233, 99,128, 4, 71, + 100, 2, 66,198, 66,242,229,243,227,229,238,228,229,114, 2, 66, + 211, 66,231,225,226,235,232,225,243,233,225,238,227,249,242,233, + 236,236,233, 99,128, 4,191,227,249,242,233,236,236,233, 99,128, + 4,183,233,229,242,229,243,233,243,227,249,242,233,236,236,233, + 99,128, 4,245,232,225,242,237,229,238,233,225,110,128, 5,115, + 235,232,225,235,225,243,243,233,225,238,227,249,242,233,236,236, + 233, 99,128, 4,204,246,229,242,244,233,227,225,236,243,244,242, + 239,235,229,227,249,242,233,236,236,233, 99,128, 4,185,105,129, + 3,199, 67, 68,229,245,227,104, 4, 67, 81, 67,116, 67,131, 67, + 140, 97, 2, 67, 87, 67,102,227,233,242,227,236,229,235,239,242, + 229,225,110,128, 50,119,240,225,242,229,238,235,239,242,229,225, + 110,128, 50, 23,227,233,242,227,236,229,235,239,242,229,225,110, + 128, 50,105,235,239,242,229,225,110,128, 49, 74,240,225,242,229, + 238,235,239,242,229,225,110,128, 50, 9,111, 2, 67,160, 67,210, + 227,104, 3, 67,169, 67,191, 67,201,225,110, 2, 67,176, 67,184, + 231,244,232,225,105,128, 14, 10,244,232,225,105,128, 14, 8,233, + 238,231,244,232,225,105,128, 14, 9,239,229,244,232,225,105,128, + 14, 12,239,107,128, 1,136,105, 2, 67,221, 68, 67,229,245, 99, + 5, 67,235, 68, 14, 68, 29, 68, 38, 68, 52, 97, 2, 67,241, 68, + 0,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,118, + 240,225,242,229,238,235,239,242,229,225,110,128, 50, 22,227,233, + 242,227,236,229,235,239,242,229,225,110,128, 50,104,235,239,242, + 229,225,110,128, 49, 72,240,225,242,229,238,235,239,242,229,225, + 110,128, 50, 8,245,240,225,242,229,238,235,239,242,229,225,110, + 128, 50, 28,242, 99, 2, 68, 74, 68,169,236,101,132, 37,203, 68, + 87, 68, 98, 68,103, 68,127,237,245,236,244,233,240,236,121,128, + 34,151,239,116,128, 34,153,112, 2, 68,109, 68,115,236,245,115, + 128, 34,149,239,243,244,225,236,237,225,242,107,128, 48, 54,247, + 233,244,104, 2, 68,136, 68,152,236,229,230,244,232,225,236,230, + 226,236,225,227,107,128, 37,208,242,233,231,232,244,232,225,236, + 230,226,236,225,227,107,128, 37,209,245,237,230,236,229,120,130, + 2,198, 68,182, 68,193,226,229,236,239,247,227,237, 98,128, 3, + 45,227,237, 98,128, 3, 2,108, 3, 68,207, 68,213, 69, 11,229, + 225,114,128, 35, 39,233,227,107, 4, 68,225, 68,236, 68,245, 68, + 255,225,236,246,229,239,236,225,114,128, 1,194,228,229,238,244, + 225,108,128, 1,192,236,225,244,229,242,225,108,128, 1,193,242, + 229,244,242,239,230,236,229,120,128, 1,195,245, 98,129, 38, 99, + 69, 18,243,245,233,116, 2, 69, 27, 69, 35,226,236,225,227,107, + 128, 38, 99,247,232,233,244,101,128, 38,103,109, 3, 69, 51, 69, + 65, 69, 76,227,245,226,229,228,243,241,245,225,242,101,128, 51, + 164,239,238,239,243,240,225,227,101,128,255, 67,243,241,245,225, + 242,229,228,243,241,245,225,242,101,128, 51,160,111, 8, 69,110, + 69,121, 69,208, 70,150, 71,179, 71,210, 72, 61, 72, 70,225,242, + 237,229,238,233,225,110,128, 5,129,236,239,110,131, 0, 58, 69, + 133, 69,158, 69,177,237,239,110, 2, 69,141, 69,149,229,244,225, + 242,121,128, 32,161,239,243,240,225,227,101,128,255, 26,115, 2, + 69,164, 69,170,233,231,110,128, 32,161,237,225,236,108,128,254, + 85,244,242,233,225,238,231,245,236,225,114, 2, 69,192, 69,202, + 232,225,236,230,237,239,100,128, 2,209,237,239,100,128, 2,208, + 109, 2, 69,214, 70,143,237, 97,134, 0, 44, 69,231, 70, 39, 70, + 50, 70, 62, 70, 92, 70,115, 97, 3, 69,239, 70, 9, 70, 17,226, + 239,246,101, 2, 69,248, 69,254,227,237, 98,128, 3, 19,242,233, + 231,232,244,227,237, 98,128, 3, 21,227,227,229,238,116,128,246, + 195,114, 2, 70, 23, 70, 30,225,226,233, 99,128, 6, 12,237,229, + 238,233,225,110,128, 5, 93,233,238,230,229,242,233,239,114,128, + 246,225,237,239,238,239,243,240,225,227,101,128,255, 12,242,229, + 246,229,242,243,229,100, 2, 70, 75, 70, 86,225,226,239,246,229, + 227,237, 98,128, 3, 20,237,239,100,128, 2,189,115, 2, 70, 98, + 70,105,237,225,236,108,128,254, 80,245,240,229,242,233,239,114, + 128,246,226,244,245,242,238,229,100, 2, 70,126, 70,137,225,226, + 239,246,229,227,237, 98,128, 3, 18,237,239,100,128, 2,187,240, + 225,243,115,128, 38, 60,110, 2, 70,156, 70,165,231,242,245,229, + 238,116,128, 34, 69,116, 2, 70,171, 70,185,239,245,242,233,238, + 244,229,231,242,225,108,128, 34, 46,242,239,108,142, 35, 3, 70, + 219, 70,225, 70,240, 70,255, 71, 43, 71, 88, 71,102, 71,107, 71, + 112, 71,117, 71,123, 71,128, 71,169, 71,174,193,195, 75,128, 0, + 6, 66, 2, 70,231, 70,236,197, 76,128, 0, 7, 83,128, 0, 8, + 67, 2, 70,246, 70,251,193, 78,128, 0, 24, 82,128, 0, 13, 68, + 3, 71, 7, 71, 33, 71, 38, 67, 4, 71, 17, 71, 21, 71, 25, 71, + 29, 49,128, 0, 17, 50,128, 0, 18, 51,128, 0, 19, 52,128, 0, + 20,197, 76,128, 0,127,204, 69,128, 0, 16, 69, 5, 71, 55, 71, + 59, 71, 64, 71, 69, 71, 74, 77,128, 0, 25,206, 81,128, 0, 5, + 207, 84,128, 0, 4,211, 67,128, 0, 27, 84, 2, 71, 80, 71, 84, + 66,128, 0, 23, 88,128, 0, 3, 70, 2, 71, 94, 71, 98, 70,128, + 0, 12, 83,128, 0, 28,199, 83,128, 0, 29,200, 84,128, 0, 9, + 204, 70,128, 0, 10,206,193, 75,128, 0, 21,210, 83,128, 0, 30, + 83, 5, 71,140, 71,144, 71,154, 71,159, 71,164, 73,128, 0, 15, + 79,129, 0, 14, 71,150, 84,128, 0, 2,212, 88,128, 0, 1,213, + 66,128, 0, 26,217, 78,128, 0, 22,213, 83,128, 0, 31,214, 84, + 128, 0, 11,240,249,242,233,231,232,116,129, 0,169, 71,191,115, + 2, 71,197, 71,203,225,238,115,128,248,233,229,242,233,102,128, + 246,217,114, 2, 71,216, 72, 44,238,229,242,226,242,225,227,235, + 229,116, 2, 71,231, 72, 9,236,229,230,116,130, 48, 12, 71,242, + 71,254,232,225,236,230,247,233,228,244,104,128,255, 98,246,229, + 242,244,233,227,225,108,128,254, 65,242,233,231,232,116,130, 48, + 13, 72, 21, 72, 33,232,225,236,230,247,233,228,244,104,128,255, + 99,246,229,242,244,233,227,225,108,128,254, 66,240,239,242,225, + 244,233,239,238,243,241,245,225,242,101,128, 51,127,243,241,245, + 225,242,101,128, 51,199,246,229,242,235,231,243,241,245,225,242, + 101,128, 51,198,240,225,242,229,110,128, 36,158,242,245,250,229, + 233,242,111,128, 32,162,243,244,242,229,244,227,232,229,100,128, + 2,151,245,114, 2, 72,121, 72,139,236,121, 2, 72,128, 72,134, + 225,238,100,128, 34,207,239,114,128, 34,206,242,229,238,227,121, + 128, 0,164,249,114, 4, 72,158, 72,166, 72,173, 72,181,194,242, + 229,246,101,128,246,209,198,236,229,120,128,246,210,226,242,229, + 246,101,128,246,212,230,236,229,120,128,246,213,100,146, 0,100, + 72,228, 74,110, 75,134, 75,194, 76,114, 77, 68, 77,130, 78, 59, + 78, 72, 78, 81, 78,107, 78,132, 78,141, 79,208, 79,216, 79,227, + 79,247, 80, 19, 97, 11, 72,252, 73, 7, 73, 17, 73, 89, 73,152, + 73,163, 73,174, 73,243, 74, 49, 74, 55, 74, 85,225,242,237,229, + 238,233,225,110,128, 5,100,226,229,238,231,225,236,105,128, 9, + 166,100, 5, 73, 29, 73, 38, 73, 44, 73, 58, 73, 74,225,242,225, + 226,233, 99,128, 6, 54,229,246, 97,128, 9, 38,230,233,238,225, + 236,225,242,225,226,233, 99,128,254,190,233,238,233,244,233,225, + 236,225,242,225,226,233, 99,128,254,191,237,229,228,233,225,236, + 225,242,225,226,233, 99,128,254,192,103, 3, 73, 97, 73,114, 73, + 128,229,243,104,129, 5,188, 73,105,232,229,226,242,229,119,128, + 5,188,231,229,114,129, 32, 32, 73,122,228,226,108,128, 32, 33, + 117, 2, 73,134, 73,143,234,225,242,225,244,105,128, 10,166,242, + 237,245,235,232,105,128, 10, 38,232,233,242,225,231,225,238, 97, + 128, 48, 96,235,225,244,225,235,225,238, 97,128, 48,192,108, 3, + 73,182, 73,191, 73,229,225,242,225,226,233, 99,128, 6, 47,229, + 116,130, 5,211, 73,200, 73,220,228,225,231,229,243,104,129,251, + 51, 73,211,232,229,226,242,229,119,128,251, 51,232,229,226,242, + 229,119,128, 5,211,230,233,238,225,236,225,242,225,226,233, 99, + 128,254,170,237,237, 97, 3, 73,253, 74, 6, 74, 18,225,242,225, + 226,233, 99,128, 6, 79,236,239,247,225,242,225,226,233, 99,128, + 6, 79,244,225,238, 97, 2, 74, 27, 74, 41,236,244,239,238,229, + 225,242,225,226,233, 99,128, 6, 76,242,225,226,233, 99,128, 6, + 76,238,228, 97,128, 9,100,242,231, 97, 2, 74, 63, 74, 72,232, + 229,226,242,229,119,128, 5,167,236,229,230,244,232,229,226,242, + 229,119,128, 5,167,243,233,225,240,238,229,245,237,225,244,225, + 227,249,242,233,236,236,233,227,227,237, 98,128, 4,133, 98, 3, + 74,118, 75,115, 75,125,108, 9, 74,138, 74,146, 75, 3, 75, 11, + 75, 27, 75, 38, 75, 56, 75, 70, 75, 81,199,242,225,246,101,128, + 246,211, 97, 2, 74,152, 74,209,238,231,236,229,226,242,225,227, + 235,229,116, 2, 74,168, 74,188,236,229,230,116,129, 48, 10, 74, + 177,246,229,242,244,233,227,225,108,128,254, 61,242,233,231,232, + 116,129, 48, 11, 74,198,246,229,242,244,233,227,225,108,128,254, + 62,114, 2, 74,215, 74,236,227,232,233,238,246,229,242,244,229, + 228,226,229,236,239,247,227,237, 98,128, 3, 43,242,239,119, 2, + 74,244, 74,251,236,229,230,116,128, 33,212,242,233,231,232,116, + 128, 33,210,228,225,238,228, 97,128, 9,101,231,242,225,246,101, + 129,246,214, 75, 21,227,237, 98,128, 3, 15,233,238,244,229,231, + 242,225,108,128, 34, 44,236,239,247,236,233,238,101,129, 32, 23, + 75, 50,227,237, 98,128, 3, 51,239,246,229,242,236,233,238,229, + 227,237, 98,128, 3, 63,240,242,233,237,229,237,239,100,128, 2, + 186,246,229,242,244,233,227,225,108, 2, 75, 94, 75,100,226,225, + 114,128, 32, 22,236,233,238,229,225,226,239,246,229,227,237, 98, + 128, 3, 14,239,240,239,237,239,230,111,128, 49, 9,243,241,245, + 225,242,101,128, 51,200, 99, 4, 75,144, 75,151, 75,160, 75,187, + 225,242,239,110,128, 1, 15,229,228,233,236,236, 97,128, 30, 17, + 233,242, 99, 2, 75,168, 75,173,236,101,128, 36,211,245,237,230, + 236,229,248,226,229,236,239,119,128, 30, 19,242,239,225,116,128, + 1, 17,100, 4, 75,204, 76, 29, 76, 39, 76, 90, 97, 4, 75,214, + 75,224, 75,231, 76, 0,226,229,238,231,225,236,105,128, 9,161, + 228,229,246, 97,128, 9, 33,231,117, 2, 75,238, 75,247,234,225, + 242,225,244,105,128, 10,161,242,237,245,235,232,105,128, 10, 33, + 108, 2, 76, 6, 76, 15,225,242,225,226,233, 99,128, 6,136,230, + 233,238,225,236,225,242,225,226,233, 99,128,251,137,228,232,225, + 228,229,246, 97,128, 9, 92,232, 97, 3, 76, 48, 76, 58, 76, 65, + 226,229,238,231,225,236,105,128, 9,162,228,229,246, 97,128, 9, + 34,231,117, 2, 76, 72, 76, 81,234,225,242,225,244,105,128, 10, + 162,242,237,245,235,232,105,128, 10, 34,239,116, 2, 76, 97, 76, + 106,225,227,227,229,238,116,128, 30, 11,226,229,236,239,119,128, + 30, 13,101, 8, 76,132, 76,185, 76,192, 76,217, 76,227, 76,238, + 77, 27, 77, 63, 99, 2, 76,138, 76,175,233,237,225,236,243,229, + 240,225,242,225,244,239,114, 2, 76,156, 76,165,225,242,225,226, + 233, 99,128, 6,107,240,229,242,243,233,225,110,128, 6,107,249, + 242,233,236,236,233, 99,128, 4, 52,231,242,229,101,128, 0,176, + 232,105, 2, 76,199, 76,208,232,229,226,242,229,119,128, 5,173, + 242,225,231,225,238, 97,128, 48,103,233,227,239,240,244,233, 99, + 128, 3,239,235,225,244,225,235,225,238, 97,128, 48,199,108, 2, + 76,244, 77, 11,229,244,101, 2, 76,252, 77, 3,236,229,230,116, + 128, 35, 43,242,233,231,232,116,128, 35, 38,244, 97,129, 3,180, + 77, 18,244,245,242,238,229,100,128, 1,141,238,239,237,233,238, + 225,244,239,242,237,233,238,245,243,239,238,229,238,245,237,229, + 242,225,244,239,242,226,229,238,231,225,236,105,128, 9,248,250, + 104,128, 2,164,104, 2, 77, 74, 77,124, 97, 3, 77, 82, 77, 92, + 77, 99,226,229,238,231,225,236,105,128, 9,167,228,229,246, 97, + 128, 9, 39,231,117, 2, 77,106, 77,115,234,225,242,225,244,105, + 128, 10,167,242,237,245,235,232,105,128, 10, 39,239,239,107,128, + 2, 87,105, 6, 77,144, 77,193, 77,253, 78, 8, 78, 19, 78, 29, + 97, 2, 77,150, 77,172,236,249,244,233,235,225,244,239,238,239, + 115,129, 3,133, 77,166,227,237, 98,128, 3, 68,237,239,238,100, + 129, 38,102, 77,181,243,245,233,244,247,232,233,244,101,128, 38, + 98,229,242,229,243,233,115,133, 0,168, 77,212, 77,220, 77,231, + 77,237, 77,245,225,227,245,244,101,128,246,215,226,229,236,239, + 247,227,237, 98,128, 3, 36,227,237, 98,128, 3, 8,231,242,225, + 246,101,128,246,216,244,239,238,239,115,128, 3,133,232,233,242, + 225,231,225,238, 97,128, 48, 98,235,225,244,225,235,225,238, 97, + 128, 48,194,244,244,239,237,225,242,107,128, 48, 3,246,105, 2, + 78, 36, 78, 47,228,101,129, 0,247, 78, 43,115,128, 34, 35,243, + 233,239,238,243,236,225,243,104,128, 34, 21,234,229,227,249,242, + 233,236,236,233, 99,128, 4, 82,235,243,232,225,228,101,128, 37, + 147,108, 2, 78, 87, 78, 98,233,238,229,226,229,236,239,119,128, + 30, 15,243,241,245,225,242,101,128, 51,151,109, 2, 78,113, 78, + 121,225,227,242,239,110,128, 1, 17,239,238,239,243,240,225,227, + 101,128,255, 68,238,226,236,239,227,107,128, 37,132,111, 10, 78, + 163, 78,175, 78,185, 78,196, 78,207, 79, 23, 79, 28, 79, 39, 79, + 154, 79,180,227,232,225,228,225,244,232,225,105,128, 14, 14,228, + 229,235,244,232,225,105,128, 14, 20,232,233,242,225,231,225,238, + 97,128, 48,105,235,225,244,225,235,225,238, 97,128, 48,201,236, + 236,225,114,132, 0, 36, 78,222, 78,233, 78,245, 79, 0,233,238, + 230,229,242,233,239,114,128,246,227,237,239,238,239,243,240,225, + 227,101,128,255, 4,239,236,228,243,244,249,236,101,128,247, 36, + 115, 2, 79, 6, 79, 13,237,225,236,108,128,254,105,245,240,229, + 242,233,239,114,128,246,228,238,103,128, 32,171,242,245,243,241, + 245,225,242,101,128, 51, 38,116, 6, 79, 53, 79, 70, 79, 92, 79, + 103, 79,135, 79,142,225,227,227,229,238,116,129, 2,217, 79, 64, + 227,237, 98,128, 3, 7,226,229,236,239,247, 99, 2, 79, 81, 79, + 86,237, 98,128, 3, 35,239,237, 98,128, 3, 35,235,225,244,225, + 235,225,238, 97,128, 48,251,236,229,243,115, 2, 79,112, 79,116, + 105,128, 1, 49,106,129,246,190, 79,122,243,244,242,239,235,229, + 232,239,239,107,128, 2,132,237,225,244,104,128, 34,197,244,229, + 228,227,233,242,227,236,101,128, 37,204,245,226,236,229,249,239, + 228,240,225,244,225,104,129,251, 31, 79,171,232,229,226,242,229, + 119,128,251, 31,247,238,244,225,227,107, 2, 79,191, 79,202,226, + 229,236,239,247,227,237, 98,128, 3, 30,237,239,100,128, 2,213, + 240,225,242,229,110,128, 36,159,243,245,240,229,242,233,239,114, + 128,246,235,116, 2, 79,233, 79,239,225,233,108,128, 2, 86,239, + 240,226,225,114,128, 1,140,117, 2, 79,253, 80, 8,232,233,242, + 225,231,225,238, 97,128, 48,101,235,225,244,225,235,225,238, 97, + 128, 48,197,122,132, 1,243, 80, 31, 80, 40, 80, 59, 80, 96,225, + 236,244,239,238,101,128, 2,163, 99, 2, 80, 46, 80, 53,225,242, + 239,110,128, 1,198,245,242,108,128, 2,165,101, 2, 80, 65, 80, + 85,225,226,235,232,225,243,233,225,238,227,249,242,233,236,236, + 233, 99,128, 4,225,227,249,242,233,236,236,233, 99,128, 4, 85, + 232,229,227,249,242,233,236,236,233, 99,128, 4, 95,101,151, 0, + 101, 80,159, 80,178, 80,212, 81,186, 81,248, 82, 25, 82, 37, 82, + 60, 82,113, 83,225, 84, 27, 84,129, 84,245, 85,124, 85,199, 85, + 230, 86, 36, 86, 89, 87, 24, 87,157, 87,177, 87,221, 88, 56, 97, + 2, 80,165, 80,172,227,245,244,101,128, 0,233,242,244,104,128, + 38, 65, 98, 3, 80,186, 80,195, 80,205,229,238,231,225,236,105, + 128, 9,143,239,240,239,237,239,230,111,128, 49, 28,242,229,246, + 101,128, 1, 21, 99, 5, 80,224, 81, 41, 81, 55, 81, 87, 81,176, + 97, 2, 80,230, 81, 35,238,228,242, 97, 3, 80,241, 80,248, 81, + 3,228,229,246, 97,128, 9, 13,231,245,234,225,242,225,244,105, + 128, 10,141,246,239,247,229,236,243,233,231,110, 2, 81, 17, 81, + 24,228,229,246, 97,128, 9, 69,231,245,234,225,242,225,244,105, + 128, 10,197,242,239,110,128, 1, 27,229,228,233,236,236,225,226, + 242,229,246,101,128, 30, 29,104, 2, 81, 61, 81, 72,225,242,237, + 229,238,233,225,110,128, 5,101,249,233,247,238,225,242,237,229, + 238,233,225,110,128, 5,135,233,242, 99, 2, 81, 95, 81,100,236, + 101,128, 36,212,245,237,230,236,229,120,134, 0,234, 81,121, 81, + 129, 81,137, 81,148, 81,156, 81,168,225,227,245,244,101,128, 30, + 191,226,229,236,239,119,128, 30, 25,228,239,244,226,229,236,239, + 119,128, 30,199,231,242,225,246,101,128, 30,193,232,239,239,235, + 225,226,239,246,101,128, 30,195,244,233,236,228,101,128, 30,197, + 249,242,233,236,236,233, 99,128, 4, 84,100, 4, 81,196, 81,206, + 81,212, 81,222,226,236,231,242,225,246,101,128, 2, 5,229,246, + 97,128, 9, 15,233,229,242,229,243,233,115,128, 0,235,239,116, + 130, 1, 23, 81,231, 81,240,225,227,227,229,238,116,128, 1, 23, + 226,229,236,239,119,128, 30,185,101, 2, 81,254, 82, 9,231,245, + 242,237,245,235,232,105,128, 10, 15,237,225,244,242,225,231,245, + 242,237,245,235,232,105,128, 10, 71,230,227,249,242,233,236,236, + 233, 99,128, 4, 68,103, 2, 82, 43, 82, 50,242,225,246,101,128, + 0,232,245,234,225,242,225,244,105,128, 10,143,104, 4, 82, 70, + 82, 81, 82, 92, 82,102,225,242,237,229,238,233,225,110,128, 5, + 103,226,239,240,239,237,239,230,111,128, 49, 29,233,242,225,231, + 225,238, 97,128, 48, 72,239,239,235,225,226,239,246,101,128, 30, + 187,105, 4, 82,123, 82,134, 83,192, 83,207,226,239,240,239,237, + 239,230,111,128, 49, 31,231,232,116,142, 0, 56, 82,168, 82,177, + 82,187, 82,217, 82,224, 83, 6, 83, 31, 83, 76, 83,110, 83,122, + 83,133, 83,166, 83,174, 83,185,225,242,225,226,233, 99,128, 6, + 104,226,229,238,231,225,236,105,128, 9,238,227,233,242,227,236, + 101,129, 36,103, 82,198,233,238,246,229,242,243,229,243,225,238, + 243,243,229,242,233,102,128, 39,145,228,229,246, 97,128, 9,110, + 229,229,110, 2, 82,232, 82,241,227,233,242,227,236,101,128, 36, + 113,112, 2, 82,247, 82,254,225,242,229,110,128, 36,133,229,242, + 233,239,100,128, 36,153,231,117, 2, 83, 13, 83, 22,234,225,242, + 225,244,105,128, 10,238,242,237,245,235,232,105,128, 10,110,104, + 2, 83, 37, 83, 63, 97, 2, 83, 43, 83, 54,227,235,225,242,225, + 226,233, 99,128, 6,104,238,231,250,232,239,117,128, 48, 40,238, + 239,244,229,226,229,225,237,229,100,128, 38,107,105, 2, 83, 82, + 83,100,228,229,239,231,242,225,240,232,233,227,240,225,242,229, + 110,128, 50, 39,238,230,229,242,233,239,114,128, 32,136,237,239, + 238,239,243,240,225,227,101,128,255, 24,239,236,228,243,244,249, + 236,101,128,247, 56,112, 2, 83,139, 83,146,225,242,229,110,128, + 36,123,229,114, 2, 83,153, 83,159,233,239,100,128, 36,143,243, + 233,225,110,128, 6,248,242,239,237,225,110,128, 33,119,243,245, + 240,229,242,233,239,114,128, 32,120,244,232,225,105,128, 14, 88, + 238,246,229,242,244,229,228,226,242,229,246,101,128, 2, 7,239, + 244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128, 4, + 101,107, 2, 83,231, 83,255,225,244,225,235,225,238, 97,129, 48, + 168, 83,243,232,225,236,230,247,233,228,244,104,128,255,116,111, + 2, 84, 5, 84, 20,238,235,225,242,231,245,242,237,245,235,232, + 105,128, 10,116,242,229,225,110,128, 49, 84,108, 3, 84, 35, 84, + 46, 84,107,227,249,242,233,236,236,233, 99,128, 4, 59,101, 2, + 84, 52, 84, 59,237,229,238,116,128, 34, 8,246,229,110, 3, 84, + 69, 84, 78, 84, 99,227,233,242,227,236,101,128, 36,106,112, 2, + 84, 84, 84, 91,225,242,229,110,128, 36,126,229,242,233,239,100, + 128, 36,146,242,239,237,225,110,128, 33,122,236,233,240,243,233, + 115,129, 32, 38, 84,118,246,229,242,244,233,227,225,108,128, 34, + 238,109, 5, 84,141, 84,169, 84,180, 84,200, 84,211,225,227,242, + 239,110,130, 1, 19, 84,153, 84,161,225,227,245,244,101,128, 30, + 23,231,242,225,246,101,128, 30, 21,227,249,242,233,236,236,233, + 99,128, 4, 60,228,225,243,104,129, 32, 20, 84,189,246,229,242, + 244,233,227,225,108,128,254, 49,239,238,239,243,240,225,227,101, + 128,255, 69,112, 2, 84,217, 84,237,232,225,243,233,243,237,225, + 242,235,225,242,237,229,238,233,225,110,128, 5, 91,244,249,243, + 229,116,128, 34, 5,110, 6, 85, 3, 85, 14, 85, 25, 85, 69, 85, + 101, 85,116,226,239,240,239,237,239,230,111,128, 49, 35,227,249, + 242,233,236,236,233, 99,128, 4, 61,100, 2, 85, 31, 85, 50,225, + 243,104,129, 32, 19, 85, 39,246,229,242,244,233,227,225,108,128, + 254, 50,229,243,227,229,238,228,229,242,227,249,242,233,236,236, + 233, 99,128, 4,163,103,130, 1, 75, 85, 77, 85, 88,226,239,240, + 239,237,239,230,111,128, 49, 37,232,229,227,249,242,233,236,236, + 233, 99,128, 4,165,232,239,239,235,227,249,242,233,236,236,233, + 99,128, 4,200,243,240,225,227,101,128, 32, 2,111, 3, 85,132, + 85,140, 85,149,231,239,238,229,107,128, 1, 25,235,239,242,229, + 225,110,128, 49, 83,240,229,110,130, 2, 91, 85,159, 85,168,227, + 236,239,243,229,100,128, 2,154,242,229,246,229,242,243,229,100, + 130, 2, 92, 85,183, 85,192,227,236,239,243,229,100,128, 2, 94, + 232,239,239,107,128, 2, 93,112, 2, 85,205, 85,212,225,242,229, + 110,128, 36,160,243,233,236,239,110,129, 3,181, 85,222,244,239, + 238,239,115,128, 3,173,241,117, 2, 85,237, 86, 25,225,108,130, + 0, 61, 85,246, 86, 2,237,239,238,239,243,240,225,227,101,128, + 255, 29,115, 2, 86, 8, 86, 15,237,225,236,108,128,254,102,245, + 240,229,242,233,239,114,128, 32,124,233,246,225,236,229,238,227, + 101,128, 34, 97,114, 3, 86, 44, 86, 55, 86, 66,226,239,240,239, + 237,239,230,111,128, 49, 38,227,249,242,233,236,236,233, 99,128, + 4, 64,229,246,229,242,243,229,100,129, 2, 88, 86, 78,227,249, + 242,233,236,236,233, 99,128, 4, 77,115, 6, 86,103, 86,114, 86, + 134, 86,215, 87, 4, 87, 14,227,249,242,233,236,236,233, 99,128, + 4, 65,228,229,243,227,229,238,228,229,242,227,249,242,233,236, + 236,233, 99,128, 4,171,104,132, 2,131, 86,146, 86,153, 86,184, + 86,199,227,245,242,108,128, 2,134,239,242,116, 2, 86,161, 86, + 168,228,229,246, 97,128, 9, 14,246,239,247,229,236,243,233,231, + 238,228,229,246, 97,128, 9, 70,242,229,246,229,242,243,229,228, + 236,239,239,112,128, 1,170,243,241,245,225,244,242,229,246,229, + 242,243,229,100,128, 2,133,237,225,236,108, 2, 86,224, 86,235, + 232,233,242,225,231,225,238, 97,128, 48, 71,235,225,244,225,235, + 225,238, 97,129, 48,167, 86,248,232,225,236,230,247,233,228,244, + 104,128,255,106,244,233,237,225,244,229,100,128, 33, 46,245,240, + 229,242,233,239,114,128,246,236,116, 5, 87, 36, 87, 62, 87, 66, + 87, 83, 87,149, 97,130, 3,183, 87, 44, 87, 54,242,237,229,238, + 233,225,110,128, 5,104,244,239,238,239,115,128, 3,174,104,128, + 0,240,233,236,228,101,129, 30,189, 87, 75,226,229,236,239,119, + 128, 30, 27,238,225,232,244, 97, 3, 87, 95, 87,127, 87,136,230, + 239,245,235,104, 2, 87,105, 87,114,232,229,226,242,229,119,128, + 5,145,236,229,230,244,232,229,226,242,229,119,128, 5,145,232, + 229,226,242,229,119,128, 5,145,236,229,230,244,232,229,226,242, + 229,119,128, 5,145,245,242,238,229,100,128, 1,221,117, 2, 87, + 163, 87,172,235,239,242,229,225,110,128, 49, 97,242,111,128, 32, + 172,246,239,247,229,236,243,233,231,110, 3, 87,193, 87,203, 87, + 210,226,229,238,231,225,236,105,128, 9,199,228,229,246, 97,128, + 9, 71,231,245,234,225,242,225,244,105,128, 10,199,120, 2, 87, + 227, 88, 44,227,236,225,109,132, 0, 33, 87,242, 87,253, 88, 24, + 88, 36,225,242,237,229,238,233,225,110,128, 5, 92,100, 2, 88, + 3, 88, 8,226,108,128, 32, 60,239,247,110,129, 0,161, 88, 16, + 243,237,225,236,108,128,247,161,237,239,238,239,243,240,225,227, + 101,128,255, 1,243,237,225,236,108,128,247, 33,233,243,244,229, + 238,244,233,225,108,128, 34, 3,250,104,131, 2,146, 88, 67, 88, + 86, 88, 97, 99, 2, 88, 73, 88, 80,225,242,239,110,128, 1,239, + 245,242,108,128, 2,147,242,229,246,229,242,243,229,100,128, 1, + 185,244,225,233,108,128, 1,186,102,140, 0,102, 88,132, 88,214, + 88,225, 88,234, 88,246, 89, 93, 89,109, 91,117, 91,130, 91,156, + 93, 33, 93, 41, 97, 4, 88,142, 88,149, 88,160, 88,171,228,229, + 246, 97,128, 9, 94,231,245,242,237,245,235,232,105,128, 10, 94, + 232,242,229,238,232,229,233,116,128, 33, 9,244,232, 97, 3, 88, + 181, 88,190, 88,202,225,242,225,226,233, 99,128, 6, 78,236,239, + 247,225,242,225,226,233, 99,128, 6, 78,244,225,238,225,242,225, + 226,233, 99,128, 6, 75,226,239,240,239,237,239,230,111,128, 49, + 8,227,233,242,227,236,101,128, 36,213,228,239,244,225,227,227, + 229,238,116,128, 30, 31,101, 3, 88,254, 89, 76, 89, 86,104, 4, + 89, 8, 89, 31, 89, 45, 89, 61,225,114, 2, 89, 15, 89, 22,225, + 226,233, 99,128, 6, 65,237,229,238,233,225,110,128, 5,134,230, + 233,238,225,236,225,242,225,226,233, 99,128,254,210,233,238,233, + 244,233,225,236,225,242,225,226,233, 99,128,254,211,237,229,228, + 233,225,236,225,242,225,226,233, 99,128,254,212,233,227,239,240, + 244,233, 99,128, 3,229,237,225,236,101,128, 38, 64,102,130,251, + 0, 89,101, 89,105,105,128,251, 3,108,128,251, 4,105,136,251, + 1, 89,129, 89,169, 89,180, 89,202, 90, 68, 90, 85, 90, 93, 90, + 106,230,244,229,229,110, 2, 89,139, 89,148,227,233,242,227,236, + 101,128, 36,110,112, 2, 89,154, 89,161,225,242,229,110,128, 36, + 130,229,242,233,239,100,128, 36,150,231,245,242,229,228,225,243, + 104,128, 32, 18,236,236,229,100, 2, 89,189, 89,195,226,239,120, + 128, 37,160,242,229,227,116,128, 37,172,238,225,108, 5, 89,216, + 89,255, 90, 16, 90, 33, 90, 49,235,225,102,130, 5,218, 89,226, + 89,246,228,225,231,229,243,104,129,251, 58, 89,237,232,229,226, + 242,229,119,128,251, 58,232,229,226,242,229,119,128, 5,218,237, + 229,109,129, 5,221, 90, 7,232,229,226,242,229,119,128, 5,221, + 238,245,110,129, 5,223, 90, 24,232,229,226,242,229,119,128, 5, + 223,240,101,129, 5,227, 90, 40,232,229,226,242,229,119,128, 5, + 227,244,243,225,228,105,129, 5,229, 90, 59,232,229,226,242,229, + 119,128, 5,229,242,243,244,244,239,238,229,227,232,233,238,229, + 243,101,128, 2,201,243,232,229,249,101,128, 37,201,244,225,227, + 249,242,233,236,236,233, 99,128, 4,115,246,101,142, 0, 53, 90, + 139, 90,148, 90,158, 90,188, 90,195, 90,205, 90,230, 91, 1, 91, + 35, 91, 47, 91, 58, 91, 91, 91, 99, 91,110,225,242,225,226,233, + 99,128, 6,101,226,229,238,231,225,236,105,128, 9,235,227,233, + 242,227,236,101,129, 36,100, 90,169,233,238,246,229,242,243,229, + 243,225,238,243,243,229,242,233,102,128, 39,142,228,229,246, 97, + 128, 9,107,229,233,231,232,244,232,115,128, 33, 93,231,117, 2, + 90,212, 90,221,234,225,242,225,244,105,128, 10,235,242,237,245, + 235,232,105,128, 10,107,232, 97, 2, 90,237, 90,248,227,235,225, + 242,225,226,233, 99,128, 6,101,238,231,250,232,239,117,128, 48, + 37,105, 2, 91, 7, 91, 25,228,229,239,231,242,225,240,232,233, + 227,240,225,242,229,110,128, 50, 36,238,230,229,242,233,239,114, + 128, 32,133,237,239,238,239,243,240,225,227,101,128,255, 21,239, + 236,228,243,244,249,236,101,128,247, 53,112, 2, 91, 64, 91, 71, + 225,242,229,110,128, 36,120,229,114, 2, 91, 78, 91, 84,233,239, + 100,128, 36,140,243,233,225,110,128, 6,245,242,239,237,225,110, + 128, 33,116,243,245,240,229,242,233,239,114,128, 32,117,244,232, + 225,105,128, 14, 85,108,129,251, 2, 91,123,239,242,233,110,128, + 1,146,109, 2, 91,136, 91,147,239,238,239,243,240,225,227,101, + 128,255, 70,243,241,245,225,242,101,128, 51,153,111, 4, 91,166, + 91,188, 91,200, 91,207,230, 97, 2, 91,173, 91,181,238,244,232, + 225,105,128, 14, 31,244,232,225,105,128, 14, 29,238,231,237,225, + 238,244,232,225,105,128, 14, 79,242,225,236,108,128, 34, 0,245, + 114,142, 0, 52, 91,240, 91,249, 92, 3, 92, 33, 92, 40, 92, 65, + 92, 92, 92,126, 92,138, 92,157, 92,168, 92,201, 92,209, 92,220, + 225,242,225,226,233, 99,128, 6,100,226,229,238,231,225,236,105, + 128, 9,234,227,233,242,227,236,101,129, 36, 99, 92, 14,233,238, + 246,229,242,243,229,243,225,238,243,243,229,242,233,102,128, 39, + 141,228,229,246, 97,128, 9,106,231,117, 2, 92, 47, 92, 56,234, + 225,242,225,244,105,128, 10,234,242,237,245,235,232,105,128, 10, + 106,232, 97, 2, 92, 72, 92, 83,227,235,225,242,225,226,233, 99, + 128, 6,100,238,231,250,232,239,117,128, 48, 36,105, 2, 92, 98, + 92,116,228,229,239,231,242,225,240,232,233,227,240,225,242,229, + 110,128, 50, 35,238,230,229,242,233,239,114,128, 32,132,237,239, + 238,239,243,240,225,227,101,128,255, 20,238,245,237,229,242,225, + 244,239,242,226,229,238,231,225,236,105,128, 9,247,239,236,228, + 243,244,249,236,101,128,247, 52,112, 2, 92,174, 92,181,225,242, + 229,110,128, 36,119,229,114, 2, 92,188, 92,194,233,239,100,128, + 36,139,243,233,225,110,128, 6,244,242,239,237,225,110,128, 33, + 115,243,245,240,229,242,233,239,114,128, 32,116,116, 2, 92,226, + 93, 8,229,229,110, 2, 92,234, 92,243,227,233,242,227,236,101, + 128, 36,109,112, 2, 92,249, 93, 0,225,242,229,110,128, 36,129, + 229,242,233,239,100,128, 36,149,104, 2, 93, 14, 93, 19,225,105, + 128, 14, 84,244,239,238,229,227,232,233,238,229,243,101,128, 2, + 203,240,225,242,229,110,128, 36,161,242, 97, 2, 93, 48, 93, 56, + 227,244,233,239,110,128, 32, 68,238, 99,128, 32,163,103,144, 0, + 103, 93, 97, 94, 43, 94, 66, 94,127, 94,144, 95, 65, 96, 58, 96, + 143, 96,156, 97, 14, 97, 39, 97, 67, 97, 89, 98, 34, 98, 56, 98, + 158, 97, 9, 93,117, 93,127, 93,134, 93,141, 93,205, 93,230, 93, + 241, 93,252, 94, 30,226,229,238,231,225,236,105,128, 9,151,227, + 245,244,101,128, 1,245,228,229,246, 97,128, 9, 23,102, 4, 93, + 151, 93,160, 93,174, 93,190,225,242,225,226,233, 99,128, 6,175, + 230,233,238,225,236,225,242,225,226,233, 99,128,251,147,233,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,251,148,237,229, + 228,233,225,236,225,242,225,226,233, 99,128,251,149,231,117, 2, + 93,212, 93,221,234,225,242,225,244,105,128, 10,151,242,237,245, + 235,232,105,128, 10, 23,232,233,242,225,231,225,238, 97,128, 48, + 76,235,225,244,225,235,225,238, 97,128, 48,172,237,237, 97,130, + 3,179, 94, 6, 94, 19,236,225,244,233,238,243,237,225,236,108, + 128, 2, 99,243,245,240,229,242,233,239,114,128, 2,224,238,231, + 233,225,227,239,240,244,233, 99,128, 3,235, 98, 2, 94, 49, 94, + 59,239,240,239,237,239,230,111,128, 49, 13,242,229,246,101,128, + 1, 31, 99, 4, 94, 76, 94, 83, 94, 92, 94,114,225,242,239,110, + 128, 1,231,229,228,233,236,236, 97,128, 1, 35,233,242, 99, 2, + 94,100, 94,105,236,101,128, 36,214,245,237,230,236,229,120,128, + 1, 29,239,237,237,225,225,227,227,229,238,116,128, 1, 35,228, + 239,116,129, 1, 33, 94,135,225,227,227,229,238,116,128, 1, 33, + 101, 6, 94,158, 94,169, 94,180, 94,191, 94,210, 95, 56,227,249, + 242,233,236,236,233, 99,128, 4, 51,232,233,242,225,231,225,238, + 97,128, 48, 82,235,225,244,225,235,225,238, 97,128, 48,178,239, + 237,229,244,242,233,227,225,236,236,249,229,241,245,225,108,128, + 34, 81,114, 3, 94,218, 95, 11, 95, 21,229,243,104, 3, 94,228, + 94,243, 94,252,225,227,227,229,238,244,232,229,226,242,229,119, + 128, 5,156,232,229,226,242,229,119,128, 5,243,237,245,241,228, + 225,237,232,229,226,242,229,119,128, 5,157,237,225,238,228,226, + 236,115,128, 0,223,243,232,225,249,233,109, 2, 95, 32, 95, 47, + 225,227,227,229,238,244,232,229,226,242,229,119,128, 5,158,232, + 229,226,242,229,119,128, 5,244,244,225,237,225,242,107,128, 48, + 19,104, 5, 95, 77, 95,210, 96, 17, 96, 42, 96, 48, 97, 4, 95, + 87, 95, 97, 95,120, 95,145,226,229,238,231,225,236,105,128, 9, + 152,100, 2, 95,103, 95,114,225,242,237,229,238,233,225,110,128, + 5,114,229,246, 97,128, 9, 24,231,117, 2, 95,127, 95,136,234, + 225,242,225,244,105,128, 10,152,242,237,245,235,232,105,128, 10, + 24,233,110, 4, 95,156, 95,165, 95,179, 95,195,225,242,225,226, + 233, 99,128, 6, 58,230,233,238,225,236,225,242,225,226,233, 99, + 128,254,206,233,238,233,244,233,225,236,225,242,225,226,233, 99, + 128,254,207,237,229,228,233,225,236,225,242,225,226,233, 99,128, + 254,208,101, 3, 95,218, 95,239, 96, 0,237,233,228,228,236,229, + 232,239,239,235,227,249,242,233,236,236,233, 99,128, 4,149,243, + 244,242,239,235,229,227,249,242,233,236,236,233, 99,128, 4,147, + 245,240,244,245,242,238,227,249,242,233,236,236,233, 99,128, 4, + 145,232, 97, 2, 96, 24, 96, 31,228,229,246, 97,128, 9, 90,231, + 245,242,237,245,235,232,105,128, 10, 90,239,239,107,128, 2, 96, + 250,243,241,245,225,242,101,128, 51,147,105, 3, 96, 66, 96, 77, + 96, 88,232,233,242,225,231,225,238, 97,128, 48, 78,235,225,244, + 225,235,225,238, 97,128, 48,174,109, 2, 96, 94, 96,105,225,242, + 237,229,238,233,225,110,128, 5, 99,229,108,130, 5,210, 96,114, + 96,134,228,225,231,229,243,104,129,251, 50, 96,125,232,229,226, + 242,229,119,128,251, 50,232,229,226,242,229,119,128, 5,210,234, + 229,227,249,242,233,236,236,233, 99,128, 4, 83,236,239,244,244, + 225,108, 2, 96,167, 96,184,233,238,246,229,242,244,229,228,243, + 244,242,239,235,101,128, 1,190,243,244,239,112,132, 2,148, 96, + 199, 96,210, 96,216, 96,248,233,238,246,229,242,244,229,100,128, + 2,150,237,239,100,128, 2,192,242,229,246,229,242,243,229,100, + 130, 2,149, 96,231, 96,237,237,239,100,128, 2,193,243,245,240, + 229,242,233,239,114,128, 2,228,243,244,242,239,235,101,129, 2, + 161, 97, 3,242,229,246,229,242,243,229,100,128, 2,162,109, 2, + 97, 20, 97, 28,225,227,242,239,110,128, 30, 33,239,238,239,243, + 240,225,227,101,128,255, 71,111, 2, 97, 45, 97, 56,232,233,242, + 225,231,225,238, 97,128, 48, 84,235,225,244,225,235,225,238, 97, + 128, 48,180,240, 97, 2, 97, 74, 97, 80,242,229,110,128, 36,162, + 243,241,245,225,242,101,128, 51,172,114, 2, 97, 95, 97,192, 97, + 2, 97,101, 97,109,228,233,229,238,116,128, 34, 7,246,101,134, + 0, 96, 97,126, 97,137, 97,154, 97,161, 97,170, 97,182,226,229, + 236,239,247,227,237, 98,128, 3, 22, 99, 2, 97,143, 97,148,237, + 98,128, 3, 0,239,237, 98,128, 3, 0,228,229,246, 97,128, 9, + 83,236,239,247,237,239,100,128, 2,206,237,239,238,239,243,240, + 225,227,101,128,255, 64,244,239,238,229,227,237, 98,128, 3, 64, + 229,225,244,229,114,132, 0, 62, 97,208, 97,227, 97,239, 98, 26, + 229,241,245,225,108,129, 34,101, 97,218,239,242,236,229,243,115, + 128, 34,219,237,239,238,239,243,240,225,227,101,128,255, 30,111, + 2, 97,245, 98, 15,114, 2, 97,251, 98, 8,229,241,245,233,246, + 225,236,229,238,116,128, 34,115,236,229,243,115,128, 34,119,246, + 229,242,229,241,245,225,108,128, 34,103,243,237,225,236,108,128, + 254,101,115, 2, 98, 40, 98, 48,227,242,233,240,116,128, 2, 97, + 244,242,239,235,101,128, 1,229,117, 4, 98, 66, 98, 77, 98,134, + 98,145,232,233,242,225,231,225,238, 97,128, 48, 80,233,108, 2, + 98, 84, 98,109,236,229,237,239,116, 2, 98, 94, 98,101,236,229, + 230,116,128, 0,171,242,233,231,232,116,128, 0,187,243,233,238, + 231,108, 2, 98,119, 98,126,236,229,230,116,128, 32, 57,242,233, + 231,232,116,128, 32, 58,235,225,244,225,235,225,238, 97,128, 48, + 176,242,225,237,245,243,241,245,225,242,101,128, 51, 24,249,243, + 241,245,225,242,101,128, 51,201,104,144, 0,104, 98,204,101, 90, + 101,125,101,162,101,202,103, 90,103,110,104, 75,104, 87,104, 99, + 105,167,105,175,105,186,105,195,106, 19,106, 23, 97, 13, 98,232, + 99, 15, 99, 25, 99, 55, 99, 80, 99,158, 99,170, 99,195, 99,210, + 99,239, 99,252,100, 54,100, 63, 97, 2, 98,238, 99, 1,226,235, 232,225,243,233,225,238,227,249,242,233,236,236,233, 99,128, 4, - 191,227,249,242,233,236,236,233, 99,128, 4,183,233,229,242,229, - 243,233,243,227,249,242,233,236,236,233, 99,128, 4,245,232,225, - 242,237,229,238,233,225,110,128, 5,115,235,232,225,235,225,243, - 243,233,225,238,227,249,242,233,236,236,233, 99,128, 4,204,246, - 229,242,244,233,227,225,236,243,244,242,239,235,229,227,249,242, - 233,236,236,233, 99,128, 4,185,105,129, 3,199, 62,142,229,245, - 227,104, 4, 62,155, 62,190, 62,205, 62,214, 97, 2, 62,161, 62, - 176,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,119, - 240,225,242,229,238,235,239,242,229,225,110,128, 50, 23,227,233, - 242,227,236,229,235,239,242,229,225,110,128, 50,105,235,239,242, - 229,225,110,128, 49, 74,240,225,242,229,238,235,239,242,229,225, - 110,128, 50, 9,111, 2, 62,234, 63, 28,227,104, 3, 62,243, 63, - 9, 63, 19,225,110, 2, 62,250, 63, 2,231,244,232,225,105,128, - 14, 10,244,232,225,105,128, 14, 8,233,238,231,244,232,225,105, - 128, 14, 9,239,229,244,232,225,105,128, 14, 12,239,107,128, 1, - 136,105, 2, 63, 39, 63,141,229,245, 99, 5, 63, 53, 63, 88, 63, - 103, 63,112, 63,126, 97, 2, 63, 59, 63, 74,227,233,242,227,236, - 229,235,239,242,229,225,110,128, 50,118,240,225,242,229,238,235, - 239,242,229,225,110,128, 50, 22,227,233,242,227,236,229,235,239, - 242,229,225,110,128, 50,104,235,239,242,229,225,110,128, 49, 72, - 240,225,242,229,238,235,239,242,229,225,110,128, 50, 8,245,240, - 225,242,229,238,235,239,242,229,225,110,128, 50, 28,242, 99, 2, - 63,148, 63,243,236,101,132, 37,203, 63,161, 63,172, 63,177, 63, - 201,237,245,236,244,233,240,236,121,128, 34,151,239,116,128, 34, - 153,112, 2, 63,183, 63,189,236,245,115,128, 34,149,239,243,244, - 225,236,237,225,242,107,128, 48, 54,247,233,244,104, 2, 63,210, - 63,226,236,229,230,244,232,225,236,230,226,236,225,227,107,128, - 37,208,242,233,231,232,244,232,225,236,230,226,236,225,227,107, - 128, 37,209,245,237,230,236,229,120,130, 2,198, 64, 0, 64, 11, - 226,229,236,239,247,227,237, 98,128, 3, 45,227,237, 98,128, 3, - 2,108, 3, 64, 25, 64, 31, 64, 85,229,225,114,128, 35, 39,233, - 227,107, 4, 64, 43, 64, 54, 64, 63, 64, 73,225,236,246,229,239, - 236,225,114,128, 1,194,228,229,238,244,225,108,128, 1,192,236, - 225,244,229,242,225,108,128, 1,193,242,229,244,242,239,230,236, - 229,120,128, 1,195,245, 98,129, 38, 99, 64, 92,243,245,233,116, - 2, 64,101, 64,109,226,236,225,227,107,128, 38, 99,247,232,233, - 244,101,128, 38,103,109, 3, 64,125, 64,139, 64,150,227,245,226, - 229,228,243,241,245,225,242,101,128, 51,164,239,238,239,243,240, - 225,227,101,128,255, 67,243,241,245,225,242,229,228,243,241,245, - 225,242,101,128, 51,160,111, 8, 64,184, 64,195, 65, 26, 65,224, - 66,253, 67, 28, 67,135, 67,144,225,242,237,229,238,233,225,110, - 128, 5,129,236,239,110,131, 0, 58, 64,207, 64,232, 64,251,237, - 239,110, 2, 64,215, 64,223,229,244,225,242,121,128, 32,161,239, - 243,240,225,227,101,128,255, 26,115, 2, 64,238, 64,244,233,231, - 110,128, 32,161,237,225,236,108,128,254, 85,244,242,233,225,238, - 231,245,236,225,114, 2, 65, 10, 65, 20,232,225,236,230,237,239, - 100,128, 2,209,237,239,100,128, 2,208,109, 2, 65, 32, 65,217, - 237, 97,134, 0, 44, 65, 49, 65,113, 65,124, 65,136, 65,166, 65, - 189, 97, 3, 65, 57, 65, 83, 65, 91,226,239,246,101, 2, 65, 66, - 65, 72,227,237, 98,128, 3, 19,242,233,231,232,244,227,237, 98, - 128, 3, 21,227,227,229,238,116,128,246,195,114, 2, 65, 97, 65, - 104,225,226,233, 99,128, 6, 12,237,229,238,233,225,110,128, 5, - 93,233,238,230,229,242,233,239,114,128,246,225,237,239,238,239, - 243,240,225,227,101,128,255, 12,242,229,246,229,242,243,229,100, - 2, 65,149, 65,160,225,226,239,246,229,227,237, 98,128, 3, 20, - 237,239,100,128, 2,189,115, 2, 65,172, 65,179,237,225,236,108, - 128,254, 80,245,240,229,242,233,239,114,128,246,226,244,245,242, - 238,229,100, 2, 65,200, 65,211,225,226,239,246,229,227,237, 98, - 128, 3, 18,237,239,100,128, 2,187,240,225,243,115,128, 38, 60, - 110, 2, 65,230, 65,239,231,242,245,229,238,116,128, 34, 69,116, - 2, 65,245, 66, 3,239,245,242,233,238,244,229,231,242,225,108, - 128, 34, 46,242,239,108,142, 35, 3, 66, 37, 66, 43, 66, 58, 66, - 73, 66,117, 66,162, 66,176, 66,181, 66,186, 66,191, 66,197, 66, - 202, 66,243, 66,248,193,195, 75,128, 0, 6, 66, 2, 66, 49, 66, - 54,197, 76,128, 0, 7, 83,128, 0, 8, 67, 2, 66, 64, 66, 69, - 193, 78,128, 0, 24, 82,128, 0, 13, 68, 3, 66, 81, 66,107, 66, - 112, 67, 4, 66, 91, 66, 95, 66, 99, 66,103, 49,128, 0, 17, 50, - 128, 0, 18, 51,128, 0, 19, 52,128, 0, 20,197, 76,128, 0,127, - 204, 69,128, 0, 16, 69, 5, 66,129, 66,133, 66,138, 66,143, 66, - 148, 77,128, 0, 25,206, 81,128, 0, 5,207, 84,128, 0, 4,211, - 67,128, 0, 27, 84, 2, 66,154, 66,158, 66,128, 0, 23, 88,128, - 0, 3, 70, 2, 66,168, 66,172, 70,128, 0, 12, 83,128, 0, 28, - 199, 83,128, 0, 29,200, 84,128, 0, 9,204, 70,128, 0, 10,206, - 193, 75,128, 0, 21,210, 83,128, 0, 30, 83, 5, 66,214, 66,218, - 66,228, 66,233, 66,238, 73,128, 0, 15, 79,129, 0, 14, 66,224, - 84,128, 0, 2,212, 88,128, 0, 1,213, 66,128, 0, 26,217, 78, - 128, 0, 22,213, 83,128, 0, 31,214, 84,128, 0, 11,240,249,242, - 233,231,232,116,129, 0,169, 67, 9,115, 2, 67, 15, 67, 21,225, - 238,115,128,248,233,229,242,233,102,128,246,217,114, 2, 67, 34, - 67,118,238,229,242,226,242,225,227,235,229,116, 2, 67, 49, 67, - 83,236,229,230,116,130, 48, 12, 67, 60, 67, 72,232,225,236,230, - 247,233,228,244,104,128,255, 98,246,229,242,244,233,227,225,108, - 128,254, 65,242,233,231,232,116,130, 48, 13, 67, 95, 67,107,232, - 225,236,230,247,233,228,244,104,128,255, 99,246,229,242,244,233, - 227,225,108,128,254, 66,240,239,242,225,244,233,239,238,243,241, - 245,225,242,101,128, 51,127,243,241,245,225,242,101,128, 51,199, - 246,229,242,235,231,243,241,245,225,242,101,128, 51,198,240,225, - 242,229,110,128, 36,158,242,245,250,229,233,242,111,128, 32,162, - 243,244,242,229,244,227,232,229,100,128, 2,151,245,114, 2, 67, - 195, 67,213,236,121, 2, 67,202, 67,208,225,238,100,128, 34,207, - 239,114,128, 34,206,242,229,238,227,121,128, 0,164,249,114, 4, - 67,232, 67,240, 67,247, 67,255,194,242,229,246,101,128,246,209, - 198,236,229,120,128,246,210,226,242,229,246,101,128,246,212,230, - 236,229,120,128,246,213,100,146, 0,100, 68, 46, 69,184, 70,208, - 71, 12, 71,188, 72,142, 72,204, 73,133, 73,146, 73,155, 73,181, - 73,206, 73,215, 75, 26, 75, 34, 75, 45, 75, 65, 75, 93, 97, 11, - 68, 70, 68, 81, 68, 91, 68,163, 68,226, 68,237, 68,248, 69, 61, - 69,123, 69,129, 69,159,225,242,237,229,238,233,225,110,128, 5, - 100,226,229,238,231,225,236,105,128, 9,166,100, 5, 68,103, 68, - 112, 68,118, 68,132, 68,148,225,242,225,226,233, 99,128, 6, 54, - 229,246, 97,128, 9, 38,230,233,238,225,236,225,242,225,226,233, - 99,128,254,190,233,238,233,244,233,225,236,225,242,225,226,233, - 99,128,254,191,237,229,228,233,225,236,225,242,225,226,233, 99, - 128,254,192,103, 3, 68,171, 68,188, 68,202,229,243,104,129, 5, - 188, 68,179,232,229,226,242,229,119,128, 5,188,231,229,114,129, - 32, 32, 68,196,228,226,108,128, 32, 33,117, 2, 68,208, 68,217, - 234,225,242,225,244,105,128, 10,166,242,237,245,235,232,105,128, - 10, 38,232,233,242,225,231,225,238, 97,128, 48, 96,235,225,244, - 225,235,225,238, 97,128, 48,192,108, 3, 69, 0, 69, 9, 69, 47, - 225,242,225,226,233, 99,128, 6, 47,229,116,130, 5,211, 69, 18, - 69, 38,228,225,231,229,243,104,129,251, 51, 69, 29,232,229,226, - 242,229,119,128,251, 51,232,229,226,242,229,119,128, 5,211,230, - 233,238,225,236,225,242,225,226,233, 99,128,254,170,237,237, 97, - 3, 69, 71, 69, 80, 69, 92,225,242,225,226,233, 99,128, 6, 79, - 236,239,247,225,242,225,226,233, 99,128, 6, 79,244,225,238, 97, - 2, 69,101, 69,115,236,244,239,238,229,225,242,225,226,233, 99, - 128, 6, 76,242,225,226,233, 99,128, 6, 76,238,228, 97,128, 9, - 100,242,231, 97, 2, 69,137, 69,146,232,229,226,242,229,119,128, - 5,167,236,229,230,244,232,229,226,242,229,119,128, 5,167,243, - 233,225,240,238,229,245,237,225,244,225,227,249,242,233,236,236, - 233,227,227,237, 98,128, 4,133, 98, 3, 69,192, 70,189, 70,199, - 108, 9, 69,212, 69,220, 70, 77, 70, 85, 70,101, 70,112, 70,130, - 70,144, 70,155,199,242,225,246,101,128,246,211, 97, 2, 69,226, - 70, 27,238,231,236,229,226,242,225,227,235,229,116, 2, 69,242, - 70, 6,236,229,230,116,129, 48, 10, 69,251,246,229,242,244,233, - 227,225,108,128,254, 61,242,233,231,232,116,129, 48, 11, 70, 16, - 246,229,242,244,233,227,225,108,128,254, 62,114, 2, 70, 33, 70, - 54,227,232,233,238,246,229,242,244,229,228,226,229,236,239,247, - 227,237, 98,128, 3, 43,242,239,119, 2, 70, 62, 70, 69,236,229, - 230,116,128, 33,212,242,233,231,232,116,128, 33,210,228,225,238, - 228, 97,128, 9,101,231,242,225,246,101,129,246,214, 70, 95,227, - 237, 98,128, 3, 15,233,238,244,229,231,242,225,108,128, 34, 44, - 236,239,247,236,233,238,101,129, 32, 23, 70,124,227,237, 98,128, - 3, 51,239,246,229,242,236,233,238,229,227,237, 98,128, 3, 63, - 240,242,233,237,229,237,239,100,128, 2,186,246,229,242,244,233, - 227,225,108, 2, 70,168, 70,174,226,225,114,128, 32, 22,236,233, - 238,229,225,226,239,246,229,227,237, 98,128, 3, 14,239,240,239, - 237,239,230,111,128, 49, 9,243,241,245,225,242,101,128, 51,200, - 99, 4, 70,218, 70,225, 70,234, 71, 5,225,242,239,110,128, 1, - 15,229,228,233,236,236, 97,128, 30, 17,233,242, 99, 2, 70,242, - 70,247,236,101,128, 36,211,245,237,230,236,229,248,226,229,236, - 239,119,128, 30, 19,242,239,225,116,128, 1, 17,100, 4, 71, 22, - 71,103, 71,113, 71,164, 97, 4, 71, 32, 71, 42, 71, 49, 71, 74, - 226,229,238,231,225,236,105,128, 9,161,228,229,246, 97,128, 9, - 33,231,117, 2, 71, 56, 71, 65,234,225,242,225,244,105,128, 10, - 161,242,237,245,235,232,105,128, 10, 33,108, 2, 71, 80, 71, 89, - 225,242,225,226,233, 99,128, 6,136,230,233,238,225,236,225,242, - 225,226,233, 99,128,251,137,228,232,225,228,229,246, 97,128, 9, - 92,232, 97, 3, 71,122, 71,132, 71,139,226,229,238,231,225,236, - 105,128, 9,162,228,229,246, 97,128, 9, 34,231,117, 2, 71,146, - 71,155,234,225,242,225,244,105,128, 10,162,242,237,245,235,232, - 105,128, 10, 34,239,116, 2, 71,171, 71,180,225,227,227,229,238, - 116,128, 30, 11,226,229,236,239,119,128, 30, 13,101, 8, 71,206, - 72, 3, 72, 10, 72, 35, 72, 45, 72, 56, 72,101, 72,137, 99, 2, - 71,212, 71,249,233,237,225,236,243,229,240,225,242,225,244,239, - 114, 2, 71,230, 71,239,225,242,225,226,233, 99,128, 6,107,240, - 229,242,243,233,225,110,128, 6,107,249,242,233,236,236,233, 99, - 128, 4, 52,231,242,229,101,128, 0,176,232,105, 2, 72, 17, 72, - 26,232,229,226,242,229,119,128, 5,173,242,225,231,225,238, 97, - 128, 48,103,233,227,239,240,244,233, 99,128, 3,239,235,225,244, - 225,235,225,238, 97,128, 48,199,108, 2, 72, 62, 72, 85,229,244, - 101, 2, 72, 70, 72, 77,236,229,230,116,128, 35, 43,242,233,231, - 232,116,128, 35, 38,244, 97,129, 3,180, 72, 92,244,245,242,238, - 229,100,128, 1,141,238,239,237,233,238,225,244,239,242,237,233, - 238,245,243,239,238,229,238,245,237,229,242,225,244,239,242,226, - 229,238,231,225,236,105,128, 9,248,250,104,128, 2,164,104, 2, - 72,148, 72,198, 97, 3, 72,156, 72,166, 72,173,226,229,238,231, - 225,236,105,128, 9,167,228,229,246, 97,128, 9, 39,231,117, 2, - 72,180, 72,189,234,225,242,225,244,105,128, 10,167,242,237,245, - 235,232,105,128, 10, 39,239,239,107,128, 2, 87,105, 6, 72,218, - 73, 11, 73, 71, 73, 82, 73, 93, 73,103, 97, 2, 72,224, 72,246, - 236,249,244,233,235,225,244,239,238,239,115,129, 3,133, 72,240, - 227,237, 98,128, 3, 68,237,239,238,100,129, 38,102, 72,255,243, - 245,233,244,247,232,233,244,101,128, 38, 98,229,242,229,243,233, - 115,133, 0,168, 73, 30, 73, 38, 73, 49, 73, 55, 73, 63,225,227, - 245,244,101,128,246,215,226,229,236,239,247,227,237, 98,128, 3, - 36,227,237, 98,128, 3, 8,231,242,225,246,101,128,246,216,244, - 239,238,239,115,128, 3,133,232,233,242,225,231,225,238, 97,128, - 48, 98,235,225,244,225,235,225,238, 97,128, 48,194,244,244,239, - 237,225,242,107,128, 48, 3,246,105, 2, 73,110, 73,121,228,101, - 129, 0,247, 73,117,115,128, 34, 35,243,233,239,238,243,236,225, - 243,104,128, 34, 21,234,229,227,249,242,233,236,236,233, 99,128, - 4, 82,235,243,232,225,228,101,128, 37,147,108, 2, 73,161, 73, - 172,233,238,229,226,229,236,239,119,128, 30, 15,243,241,245,225, - 242,101,128, 51,151,109, 2, 73,187, 73,195,225,227,242,239,110, - 128, 1, 17,239,238,239,243,240,225,227,101,128,255, 68,238,226, - 236,239,227,107,128, 37,132,111, 10, 73,237, 73,249, 74, 3, 74, - 14, 74, 25, 74, 97, 74,102, 74,113, 74,228, 74,254,227,232,225, - 228,225,244,232,225,105,128, 14, 14,228,229,235,244,232,225,105, - 128, 14, 20,232,233,242,225,231,225,238, 97,128, 48,105,235,225, - 244,225,235,225,238, 97,128, 48,201,236,236,225,114,132, 0, 36, - 74, 40, 74, 51, 74, 63, 74, 74,233,238,230,229,242,233,239,114, - 128,246,227,237,239,238,239,243,240,225,227,101,128,255, 4,239, - 236,228,243,244,249,236,101,128,247, 36,115, 2, 74, 80, 74, 87, - 237,225,236,108,128,254,105,245,240,229,242,233,239,114,128,246, - 228,238,103,128, 32,171,242,245,243,241,245,225,242,101,128, 51, - 38,116, 6, 74,127, 74,144, 74,166, 74,177, 74,209, 74,216,225, - 227,227,229,238,116,129, 2,217, 74,138,227,237, 98,128, 3, 7, - 226,229,236,239,247, 99, 2, 74,155, 74,160,237, 98,128, 3, 35, - 239,237, 98,128, 3, 35,235,225,244,225,235,225,238, 97,128, 48, - 251,236,229,243,115, 2, 74,186, 74,190,105,128, 1, 49,106,129, - 246,190, 74,196,243,244,242,239,235,229,232,239,239,107,128, 2, - 132,237,225,244,104,128, 34,197,244,229,228,227,233,242,227,236, - 101,128, 37,204,245,226,236,229,249,239,228,240,225,244,225,104, - 129,251, 31, 74,245,232,229,226,242,229,119,128,251, 31,247,238, - 244,225,227,107, 2, 75, 9, 75, 20,226,229,236,239,247,227,237, - 98,128, 3, 30,237,239,100,128, 2,213,240,225,242,229,110,128, - 36,159,243,245,240,229,242,233,239,114,128,246,235,116, 2, 75, - 51, 75, 57,225,233,108,128, 2, 86,239,240,226,225,114,128, 1, - 140,117, 2, 75, 71, 75, 82,232,233,242,225,231,225,238, 97,128, - 48,101,235,225,244,225,235,225,238, 97,128, 48,197,122,132, 1, - 243, 75,105, 75,114, 75,133, 75,170,225,236,244,239,238,101,128, - 2,163, 99, 2, 75,120, 75,127,225,242,239,110,128, 1,198,245, - 242,108,128, 2,165,101, 2, 75,139, 75,159,225,226,235,232,225, - 243,233,225,238,227,249,242,233,236,236,233, 99,128, 4,225,227, - 249,242,233,236,236,233, 99,128, 4, 85,232,229,227,249,242,233, - 236,236,233, 99,128, 4, 95,101,151, 0,101, 75,233, 75,252, 76, - 30, 77, 4, 77, 66, 77, 99, 77,111, 77,134, 77,187, 79, 43, 79, - 101, 79,203, 80, 63, 80,198, 81, 17, 81, 48, 81,110, 81,163, 82, - 98, 82,231, 82,251, 83, 39, 83,130, 97, 2, 75,239, 75,246,227, - 245,244,101,128, 0,233,242,244,104,128, 38, 65, 98, 3, 76, 4, - 76, 13, 76, 23,229,238,231,225,236,105,128, 9,143,239,240,239, - 237,239,230,111,128, 49, 28,242,229,246,101,128, 1, 21, 99, 5, - 76, 42, 76,115, 76,129, 76,161, 76,250, 97, 2, 76, 48, 76,109, - 238,228,242, 97, 3, 76, 59, 76, 66, 76, 77,228,229,246, 97,128, - 9, 13,231,245,234,225,242,225,244,105,128, 10,141,246,239,247, - 229,236,243,233,231,110, 2, 76, 91, 76, 98,228,229,246, 97,128, - 9, 69,231,245,234,225,242,225,244,105,128, 10,197,242,239,110, - 128, 1, 27,229,228,233,236,236,225,226,242,229,246,101,128, 30, - 29,104, 2, 76,135, 76,146,225,242,237,229,238,233,225,110,128, - 5,101,249,233,247,238,225,242,237,229,238,233,225,110,128, 5, - 135,233,242, 99, 2, 76,169, 76,174,236,101,128, 36,212,245,237, - 230,236,229,120,134, 0,234, 76,195, 76,203, 76,211, 76,222, 76, - 230, 76,242,225,227,245,244,101,128, 30,191,226,229,236,239,119, - 128, 30, 25,228,239,244,226,229,236,239,119,128, 30,199,231,242, - 225,246,101,128, 30,193,232,239,239,235,225,226,239,246,101,128, - 30,195,244,233,236,228,101,128, 30,197,249,242,233,236,236,233, - 99,128, 4, 84,100, 4, 77, 14, 77, 24, 77, 30, 77, 40,226,236, - 231,242,225,246,101,128, 2, 5,229,246, 97,128, 9, 15,233,229, - 242,229,243,233,115,128, 0,235,239,116,130, 1, 23, 77, 49, 77, - 58,225,227,227,229,238,116,128, 1, 23,226,229,236,239,119,128, - 30,185,101, 2, 77, 72, 77, 83,231,245,242,237,245,235,232,105, - 128, 10, 15,237,225,244,242,225,231,245,242,237,245,235,232,105, - 128, 10, 71,230,227,249,242,233,236,236,233, 99,128, 4, 68,103, - 2, 77,117, 77,124,242,225,246,101,128, 0,232,245,234,225,242, - 225,244,105,128, 10,143,104, 4, 77,144, 77,155, 77,166, 77,176, - 225,242,237,229,238,233,225,110,128, 5,103,226,239,240,239,237, - 239,230,111,128, 49, 29,233,242,225,231,225,238, 97,128, 48, 72, - 239,239,235,225,226,239,246,101,128, 30,187,105, 4, 77,197, 77, - 208, 79, 10, 79, 25,226,239,240,239,237,239,230,111,128, 49, 31, - 231,232,116,142, 0, 56, 77,242, 77,251, 78, 5, 78, 35, 78, 42, - 78, 80, 78,105, 78,150, 78,184, 78,196, 78,207, 78,240, 78,248, - 79, 3,225,242,225,226,233, 99,128, 6,104,226,229,238,231,225, - 236,105,128, 9,238,227,233,242,227,236,101,129, 36,103, 78, 16, - 233,238,246,229,242,243,229,243,225,238,243,243,229,242,233,102, - 128, 39,145,228,229,246, 97,128, 9,110,229,229,110, 2, 78, 50, - 78, 59,227,233,242,227,236,101,128, 36,113,112, 2, 78, 65, 78, - 72,225,242,229,110,128, 36,133,229,242,233,239,100,128, 36,153, - 231,117, 2, 78, 87, 78, 96,234,225,242,225,244,105,128, 10,238, - 242,237,245,235,232,105,128, 10,110,104, 2, 78,111, 78,137, 97, - 2, 78,117, 78,128,227,235,225,242,225,226,233, 99,128, 6,104, - 238,231,250,232,239,117,128, 48, 40,238,239,244,229,226,229,225, - 237,229,100,128, 38,107,105, 2, 78,156, 78,174,228,229,239,231, - 242,225,240,232,233,227,240,225,242,229,110,128, 50, 39,238,230, - 229,242,233,239,114,128, 32,136,237,239,238,239,243,240,225,227, - 101,128,255, 24,239,236,228,243,244,249,236,101,128,247, 56,112, - 2, 78,213, 78,220,225,242,229,110,128, 36,123,229,114, 2, 78, - 227, 78,233,233,239,100,128, 36,143,243,233,225,110,128, 6,248, - 242,239,237,225,110,128, 33,119,243,245,240,229,242,233,239,114, - 128, 32,120,244,232,225,105,128, 14, 88,238,246,229,242,244,229, - 228,226,242,229,246,101,128, 2, 7,239,244,233,230,233,229,228, - 227,249,242,233,236,236,233, 99,128, 4,101,107, 2, 79, 49, 79, - 73,225,244,225,235,225,238, 97,129, 48,168, 79, 61,232,225,236, - 230,247,233,228,244,104,128,255,116,111, 2, 79, 79, 79, 94,238, - 235,225,242,231,245,242,237,245,235,232,105,128, 10,116,242,229, - 225,110,128, 49, 84,108, 3, 79,109, 79,120, 79,181,227,249,242, - 233,236,236,233, 99,128, 4, 59,101, 2, 79,126, 79,133,237,229, - 238,116,128, 34, 8,246,229,110, 3, 79,143, 79,152, 79,173,227, - 233,242,227,236,101,128, 36,106,112, 2, 79,158, 79,165,225,242, - 229,110,128, 36,126,229,242,233,239,100,128, 36,146,242,239,237, - 225,110,128, 33,122,236,233,240,243,233,115,129, 32, 38, 79,192, - 246,229,242,244,233,227,225,108,128, 34,238,109, 5, 79,215, 79, - 243, 79,254, 80, 18, 80, 29,225,227,242,239,110,130, 1, 19, 79, - 227, 79,235,225,227,245,244,101,128, 30, 23,231,242,225,246,101, - 128, 30, 21,227,249,242,233,236,236,233, 99,128, 4, 60,228,225, - 243,104,129, 32, 20, 80, 7,246,229,242,244,233,227,225,108,128, - 254, 49,239,238,239,243,240,225,227,101,128,255, 69,112, 2, 80, - 35, 80, 55,232,225,243,233,243,237,225,242,235,225,242,237,229, - 238,233,225,110,128, 5, 91,244,249,243,229,116,128, 34, 5,110, - 6, 80, 77, 80, 88, 80, 99, 80,143, 80,175, 80,190,226,239,240, - 239,237,239,230,111,128, 49, 35,227,249,242,233,236,236,233, 99, - 128, 4, 61,100, 2, 80,105, 80,124,225,243,104,129, 32, 19, 80, - 113,246,229,242,244,233,227,225,108,128,254, 50,229,243,227,229, - 238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,163,103, - 130, 1, 75, 80,151, 80,162,226,239,240,239,237,239,230,111,128, - 49, 37,232,229,227,249,242,233,236,236,233, 99,128, 4,165,232, - 239,239,235,227,249,242,233,236,236,233, 99,128, 4,200,243,240, - 225,227,101,128, 32, 2,111, 3, 80,206, 80,214, 80,223,231,239, - 238,229,107,128, 1, 25,235,239,242,229,225,110,128, 49, 83,240, - 229,110,130, 2, 91, 80,233, 80,242,227,236,239,243,229,100,128, - 2,154,242,229,246,229,242,243,229,100,130, 2, 92, 81, 1, 81, - 10,227,236,239,243,229,100,128, 2, 94,232,239,239,107,128, 2, - 93,112, 2, 81, 23, 81, 30,225,242,229,110,128, 36,160,243,233, - 236,239,110,129, 3,181, 81, 40,244,239,238,239,115,128, 3,173, - 241,117, 2, 81, 55, 81, 99,225,108,130, 0, 61, 81, 64, 81, 76, - 237,239,238,239,243,240,225,227,101,128,255, 29,115, 2, 81, 82, - 81, 89,237,225,236,108,128,254,102,245,240,229,242,233,239,114, - 128, 32,124,233,246,225,236,229,238,227,101,128, 34, 97,114, 3, - 81,118, 81,129, 81,140,226,239,240,239,237,239,230,111,128, 49, - 38,227,249,242,233,236,236,233, 99,128, 4, 64,229,246,229,242, - 243,229,100,129, 2, 88, 81,152,227,249,242,233,236,236,233, 99, - 128, 4, 77,115, 6, 81,177, 81,188, 81,208, 82, 33, 82, 78, 82, - 88,227,249,242,233,236,236,233, 99,128, 4, 65,228,229,243,227, - 229,238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,171, - 104,132, 2,131, 81,220, 81,227, 82, 2, 82, 17,227,245,242,108, - 128, 2,134,239,242,116, 2, 81,235, 81,242,228,229,246, 97,128, - 9, 14,246,239,247,229,236,243,233,231,238,228,229,246, 97,128, - 9, 70,242,229,246,229,242,243,229,228,236,239,239,112,128, 1, - 170,243,241,245,225,244,242,229,246,229,242,243,229,100,128, 2, - 133,237,225,236,108, 2, 82, 42, 82, 53,232,233,242,225,231,225, - 238, 97,128, 48, 71,235,225,244,225,235,225,238, 97,129, 48,167, - 82, 66,232,225,236,230,247,233,228,244,104,128,255,106,244,233, - 237,225,244,229,100,128, 33, 46,245,240,229,242,233,239,114,128, - 246,236,116, 5, 82,110, 82,136, 82,140, 82,157, 82,223, 97,130, - 3,183, 82,118, 82,128,242,237,229,238,233,225,110,128, 5,104, - 244,239,238,239,115,128, 3,174,104,128, 0,240,233,236,228,101, - 129, 30,189, 82,149,226,229,236,239,119,128, 30, 27,238,225,232, - 244, 97, 3, 82,169, 82,201, 82,210,230,239,245,235,104, 2, 82, - 179, 82,188,232,229,226,242,229,119,128, 5,145,236,229,230,244, - 232,229,226,242,229,119,128, 5,145,232,229,226,242,229,119,128, - 5,145,236,229,230,244,232,229,226,242,229,119,128, 5,145,245, - 242,238,229,100,128, 1,221,117, 2, 82,237, 82,246,235,239,242, - 229,225,110,128, 49, 97,242,111,128, 32,172,246,239,247,229,236, - 243,233,231,110, 3, 83, 11, 83, 21, 83, 28,226,229,238,231,225, - 236,105,128, 9,199,228,229,246, 97,128, 9, 71,231,245,234,225, - 242,225,244,105,128, 10,199,120, 2, 83, 45, 83,118,227,236,225, - 109,132, 0, 33, 83, 60, 83, 71, 83, 98, 83,110,225,242,237,229, - 238,233,225,110,128, 5, 92,100, 2, 83, 77, 83, 82,226,108,128, - 32, 60,239,247,110,129, 0,161, 83, 90,243,237,225,236,108,128, - 247,161,237,239,238,239,243,240,225,227,101,128,255, 1,243,237, - 225,236,108,128,247, 33,233,243,244,229,238,244,233,225,108,128, - 34, 3,250,104,131, 2,146, 83,141, 83,160, 83,171, 99, 2, 83, - 147, 83,154,225,242,239,110,128, 1,239,245,242,108,128, 2,147, - 242,229,246,229,242,243,229,100,128, 1,185,244,225,233,108,128, - 1,186,102,140, 0,102, 83,206, 84, 32, 84, 43, 84, 52, 84, 64, - 84,167, 84,183, 86,191, 86,204, 86,230, 88,107, 88,115, 97, 4, - 83,216, 83,223, 83,234, 83,245,228,229,246, 97,128, 9, 94,231, - 245,242,237,245,235,232,105,128, 10, 94,232,242,229,238,232,229, - 233,116,128, 33, 9,244,232, 97, 3, 83,255, 84, 8, 84, 20,225, - 242,225,226,233, 99,128, 6, 78,236,239,247,225,242,225,226,233, - 99,128, 6, 78,244,225,238,225,242,225,226,233, 99,128, 6, 75, - 226,239,240,239,237,239,230,111,128, 49, 8,227,233,242,227,236, - 101,128, 36,213,228,239,244,225,227,227,229,238,116,128, 30, 31, - 101, 3, 84, 72, 84,150, 84,160,104, 4, 84, 82, 84,105, 84,119, - 84,135,225,114, 2, 84, 89, 84, 96,225,226,233, 99,128, 6, 65, - 237,229,238,233,225,110,128, 5,134,230,233,238,225,236,225,242, - 225,226,233, 99,128,254,210,233,238,233,244,233,225,236,225,242, - 225,226,233, 99,128,254,211,237,229,228,233,225,236,225,242,225, - 226,233, 99,128,254,212,233,227,239,240,244,233, 99,128, 3,229, - 237,225,236,101,128, 38, 64,102,130,251, 0, 84,175, 84,179,105, - 128,251, 3,108,128,251, 4,105,136,251, 1, 84,203, 84,243, 84, - 254, 85, 20, 85,142, 85,159, 85,167, 85,180,230,244,229,229,110, - 2, 84,213, 84,222,227,233,242,227,236,101,128, 36,110,112, 2, - 84,228, 84,235,225,242,229,110,128, 36,130,229,242,233,239,100, - 128, 36,150,231,245,242,229,228,225,243,104,128, 32, 18,236,236, - 229,100, 2, 85, 7, 85, 13,226,239,120,128, 37,160,242,229,227, - 116,128, 37,172,238,225,108, 5, 85, 34, 85, 73, 85, 90, 85,107, - 85,123,235,225,102,130, 5,218, 85, 44, 85, 64,228,225,231,229, - 243,104,129,251, 58, 85, 55,232,229,226,242,229,119,128,251, 58, - 232,229,226,242,229,119,128, 5,218,237,229,109,129, 5,221, 85, - 81,232,229,226,242,229,119,128, 5,221,238,245,110,129, 5,223, - 85, 98,232,229,226,242,229,119,128, 5,223,240,101,129, 5,227, - 85,114,232,229,226,242,229,119,128, 5,227,244,243,225,228,105, - 129, 5,229, 85,133,232,229,226,242,229,119,128, 5,229,242,243, - 244,244,239,238,229,227,232,233,238,229,243,101,128, 2,201,243, - 232,229,249,101,128, 37,201,244,225,227,249,242,233,236,236,233, - 99,128, 4,115,246,101,142, 0, 53, 85,213, 85,222, 85,232, 86, - 6, 86, 13, 86, 23, 86, 48, 86, 75, 86,109, 86,121, 86,132, 86, - 165, 86,173, 86,184,225,242,225,226,233, 99,128, 6,101,226,229, - 238,231,225,236,105,128, 9,235,227,233,242,227,236,101,129, 36, - 100, 85,243,233,238,246,229,242,243,229,243,225,238,243,243,229, - 242,233,102,128, 39,142,228,229,246, 97,128, 9,107,229,233,231, - 232,244,232,115,128, 33, 93,231,117, 2, 86, 30, 86, 39,234,225, - 242,225,244,105,128, 10,235,242,237,245,235,232,105,128, 10,107, - 232, 97, 2, 86, 55, 86, 66,227,235,225,242,225,226,233, 99,128, - 6,101,238,231,250,232,239,117,128, 48, 37,105, 2, 86, 81, 86, - 99,228,229,239,231,242,225,240,232,233,227,240,225,242,229,110, - 128, 50, 36,238,230,229,242,233,239,114,128, 32,133,237,239,238, - 239,243,240,225,227,101,128,255, 21,239,236,228,243,244,249,236, - 101,128,247, 53,112, 2, 86,138, 86,145,225,242,229,110,128, 36, - 120,229,114, 2, 86,152, 86,158,233,239,100,128, 36,140,243,233, - 225,110,128, 6,245,242,239,237,225,110,128, 33,116,243,245,240, - 229,242,233,239,114,128, 32,117,244,232,225,105,128, 14, 85,108, - 129,251, 2, 86,197,239,242,233,110,128, 1,146,109, 2, 86,210, - 86,221,239,238,239,243,240,225,227,101,128,255, 70,243,241,245, - 225,242,101,128, 51,153,111, 4, 86,240, 87, 6, 87, 18, 87, 25, - 230, 97, 2, 86,247, 86,255,238,244,232,225,105,128, 14, 31,244, - 232,225,105,128, 14, 29,238,231,237,225,238,244,232,225,105,128, - 14, 79,242,225,236,108,128, 34, 0,245,114,142, 0, 52, 87, 58, - 87, 67, 87, 77, 87,107, 87,114, 87,139, 87,166, 87,200, 87,212, - 87,231, 87,242, 88, 19, 88, 27, 88, 38,225,242,225,226,233, 99, - 128, 6,100,226,229,238,231,225,236,105,128, 9,234,227,233,242, - 227,236,101,129, 36, 99, 87, 88,233,238,246,229,242,243,229,243, - 225,238,243,243,229,242,233,102,128, 39,141,228,229,246, 97,128, - 9,106,231,117, 2, 87,121, 87,130,234,225,242,225,244,105,128, - 10,234,242,237,245,235,232,105,128, 10,106,232, 97, 2, 87,146, - 87,157,227,235,225,242,225,226,233, 99,128, 6,100,238,231,250, - 232,239,117,128, 48, 36,105, 2, 87,172, 87,190,228,229,239,231, - 242,225,240,232,233,227,240,225,242,229,110,128, 50, 35,238,230, - 229,242,233,239,114,128, 32,132,237,239,238,239,243,240,225,227, - 101,128,255, 20,238,245,237,229,242,225,244,239,242,226,229,238, - 231,225,236,105,128, 9,247,239,236,228,243,244,249,236,101,128, - 247, 52,112, 2, 87,248, 87,255,225,242,229,110,128, 36,119,229, - 114, 2, 88, 6, 88, 12,233,239,100,128, 36,139,243,233,225,110, - 128, 6,244,242,239,237,225,110,128, 33,115,243,245,240,229,242, - 233,239,114,128, 32,116,116, 2, 88, 44, 88, 82,229,229,110, 2, - 88, 52, 88, 61,227,233,242,227,236,101,128, 36,109,112, 2, 88, - 67, 88, 74,225,242,229,110,128, 36,129,229,242,233,239,100,128, - 36,149,104, 2, 88, 88, 88, 93,225,105,128, 14, 84,244,239,238, - 229,227,232,233,238,229,243,101,128, 2,203,240,225,242,229,110, - 128, 36,161,242, 97, 2, 88,122, 88,130,227,244,233,239,110,128, - 32, 68,238, 99,128, 32,163,103,144, 0,103, 88,171, 89,117, 89, - 140, 89,201, 89,218, 90,139, 91,132, 91,217, 91,230, 92, 88, 92, - 113, 92,141, 92,163, 93,108, 93,130, 93,232, 97, 9, 88,191, 88, - 201, 88,208, 88,215, 89, 23, 89, 48, 89, 59, 89, 70, 89,104,226, - 229,238,231,225,236,105,128, 9,151,227,245,244,101,128, 1,245, - 228,229,246, 97,128, 9, 23,102, 4, 88,225, 88,234, 88,248, 89, - 8,225,242,225,226,233, 99,128, 6,175,230,233,238,225,236,225, - 242,225,226,233, 99,128,251,147,233,238,233,244,233,225,236,225, - 242,225,226,233, 99,128,251,148,237,229,228,233,225,236,225,242, - 225,226,233, 99,128,251,149,231,117, 2, 89, 30, 89, 39,234,225, - 242,225,244,105,128, 10,151,242,237,245,235,232,105,128, 10, 23, - 232,233,242,225,231,225,238, 97,128, 48, 76,235,225,244,225,235, - 225,238, 97,128, 48,172,237,237, 97,130, 3,179, 89, 80, 89, 93, - 236,225,244,233,238,243,237,225,236,108,128, 2, 99,243,245,240, - 229,242,233,239,114,128, 2,224,238,231,233,225,227,239,240,244, - 233, 99,128, 3,235, 98, 2, 89,123, 89,133,239,240,239,237,239, - 230,111,128, 49, 13,242,229,246,101,128, 1, 31, 99, 4, 89,150, - 89,157, 89,166, 89,188,225,242,239,110,128, 1,231,229,228,233, - 236,236, 97,128, 1, 35,233,242, 99, 2, 89,174, 89,179,236,101, - 128, 36,214,245,237,230,236,229,120,128, 1, 29,239,237,237,225, - 225,227,227,229,238,116,128, 1, 35,228,239,116,129, 1, 33, 89, - 209,225,227,227,229,238,116,128, 1, 33,101, 6, 89,232, 89,243, - 89,254, 90, 9, 90, 28, 90,130,227,249,242,233,236,236,233, 99, - 128, 4, 51,232,233,242,225,231,225,238, 97,128, 48, 82,235,225, - 244,225,235,225,238, 97,128, 48,178,239,237,229,244,242,233,227, - 225,236,236,249,229,241,245,225,108,128, 34, 81,114, 3, 90, 36, - 90, 85, 90, 95,229,243,104, 3, 90, 46, 90, 61, 90, 70,225,227, - 227,229,238,244,232,229,226,242,229,119,128, 5,156,232,229,226, - 242,229,119,128, 5,243,237,245,241,228,225,237,232,229,226,242, - 229,119,128, 5,157,237,225,238,228,226,236,115,128, 0,223,243, - 232,225,249,233,109, 2, 90,106, 90,121,225,227,227,229,238,244, - 232,229,226,242,229,119,128, 5,158,232,229,226,242,229,119,128, - 5,244,244,225,237,225,242,107,128, 48, 19,104, 5, 90,151, 91, - 28, 91, 91, 91,116, 91,122, 97, 4, 90,161, 90,171, 90,194, 90, - 219,226,229,238,231,225,236,105,128, 9,152,100, 2, 90,177, 90, - 188,225,242,237,229,238,233,225,110,128, 5,114,229,246, 97,128, - 9, 24,231,117, 2, 90,201, 90,210,234,225,242,225,244,105,128, - 10,152,242,237,245,235,232,105,128, 10, 24,233,110, 4, 90,230, - 90,239, 90,253, 91, 13,225,242,225,226,233, 99,128, 6, 58,230, - 233,238,225,236,225,242,225,226,233, 99,128,254,206,233,238,233, - 244,233,225,236,225,242,225,226,233, 99,128,254,207,237,229,228, - 233,225,236,225,242,225,226,233, 99,128,254,208,101, 3, 91, 36, - 91, 57, 91, 74,237,233,228,228,236,229,232,239,239,235,227,249, - 242,233,236,236,233, 99,128, 4,149,243,244,242,239,235,229,227, - 249,242,233,236,236,233, 99,128, 4,147,245,240,244,245,242,238, - 227,249,242,233,236,236,233, 99,128, 4,145,232, 97, 2, 91, 98, - 91,105,228,229,246, 97,128, 9, 90,231,245,242,237,245,235,232, - 105,128, 10, 90,239,239,107,128, 2, 96,250,243,241,245,225,242, - 101,128, 51,147,105, 3, 91,140, 91,151, 91,162,232,233,242,225, - 231,225,238, 97,128, 48, 78,235,225,244,225,235,225,238, 97,128, - 48,174,109, 2, 91,168, 91,179,225,242,237,229,238,233,225,110, - 128, 5, 99,229,108,130, 5,210, 91,188, 91,208,228,225,231,229, - 243,104,129,251, 50, 91,199,232,229,226,242,229,119,128,251, 50, - 232,229,226,242,229,119,128, 5,210,234,229,227,249,242,233,236, - 236,233, 99,128, 4, 83,236,239,244,244,225,108, 2, 91,241, 92, - 2,233,238,246,229,242,244,229,228,243,244,242,239,235,101,128, - 1,190,243,244,239,112,132, 2,148, 92, 17, 92, 28, 92, 34, 92, - 66,233,238,246,229,242,244,229,100,128, 2,150,237,239,100,128, - 2,192,242,229,246,229,242,243,229,100,130, 2,149, 92, 49, 92, - 55,237,239,100,128, 2,193,243,245,240,229,242,233,239,114,128, - 2,228,243,244,242,239,235,101,129, 2,161, 92, 77,242,229,246, - 229,242,243,229,100,128, 2,162,109, 2, 92, 94, 92,102,225,227, - 242,239,110,128, 30, 33,239,238,239,243,240,225,227,101,128,255, - 71,111, 2, 92,119, 92,130,232,233,242,225,231,225,238, 97,128, - 48, 84,235,225,244,225,235,225,238, 97,128, 48,180,240, 97, 2, - 92,148, 92,154,242,229,110,128, 36,162,243,241,245,225,242,101, - 128, 51,172,114, 2, 92,169, 93, 10, 97, 2, 92,175, 92,183,228, - 233,229,238,116,128, 34, 7,246,101,134, 0, 96, 92,200, 92,211, - 92,228, 92,235, 92,244, 93, 0,226,229,236,239,247,227,237, 98, - 128, 3, 22, 99, 2, 92,217, 92,222,237, 98,128, 3, 0,239,237, - 98,128, 3, 0,228,229,246, 97,128, 9, 83,236,239,247,237,239, - 100,128, 2,206,237,239,238,239,243,240,225,227,101,128,255, 64, - 244,239,238,229,227,237, 98,128, 3, 64,229,225,244,229,114,132, - 0, 62, 93, 26, 93, 45, 93, 57, 93,100,229,241,245,225,108,129, - 34,101, 93, 36,239,242,236,229,243,115,128, 34,219,237,239,238, - 239,243,240,225,227,101,128,255, 30,111, 2, 93, 63, 93, 89,114, - 2, 93, 69, 93, 82,229,241,245,233,246,225,236,229,238,116,128, - 34,115,236,229,243,115,128, 34,119,246,229,242,229,241,245,225, - 108,128, 34,103,243,237,225,236,108,128,254,101,115, 2, 93,114, - 93,122,227,242,233,240,116,128, 2, 97,244,242,239,235,101,128, - 1,229,117, 4, 93,140, 93,151, 93,208, 93,219,232,233,242,225, - 231,225,238, 97,128, 48, 80,233,108, 2, 93,158, 93,183,236,229, - 237,239,116, 2, 93,168, 93,175,236,229,230,116,128, 0,171,242, - 233,231,232,116,128, 0,187,243,233,238,231,108, 2, 93,193, 93, - 200,236,229,230,116,128, 32, 57,242,233,231,232,116,128, 32, 58, - 235,225,244,225,235,225,238, 97,128, 48,176,242,225,237,245,243, - 241,245,225,242,101,128, 51, 24,249,243,241,245,225,242,101,128, - 51,201,104,144, 0,104, 94, 22, 96,164, 96,199, 96,236, 97, 20, - 98,164, 98,184, 99,149, 99,161, 99,173,100,241,100,249,101, 4, - 101, 13,101, 93,101, 97, 97, 13, 94, 50, 94, 89, 94, 99, 94,129, - 94,154, 94,232, 94,244, 95, 13, 95, 28, 95, 57, 95, 70, 95,128, - 95,137, 97, 2, 94, 56, 94, 75,226,235,232,225,243,233,225,238, - 227,249,242,233,236,236,233, 99,128, 4,169,236,244,239,238,229, - 225,242,225,226,233, 99,128, 6,193,226,229,238,231,225,236,105, - 128, 9,185,228,101, 2, 94,106, 94,124,243,227,229,238,228,229, - 242,227,249,242,233,236,236,233, 99,128, 4,179,246, 97,128, 9, - 57,231,117, 2, 94,136, 94,145,234,225,242,225,244,105,128, 10, - 185,242,237,245,235,232,105,128, 10, 57,104, 4, 94,164, 94,173, - 94,187, 94,217,225,242,225,226,233, 99,128, 6, 45,230,233,238, - 225,236,225,242,225,226,233, 99,128,254,162,105, 2, 94,193, 94, - 208,238,233,244,233,225,236,225,242,225,226,233, 99,128,254,163, - 242,225,231,225,238, 97,128, 48,111,237,229,228,233,225,236,225, - 242,225,226,233, 99,128,254,164,233,244,245,243,241,245,225,242, - 101,128, 51, 42,235,225,244,225,235,225,238, 97,129, 48,207, 95, - 1,232,225,236,230,247,233,228,244,104,128,255,138,236,225,238, - 244,231,245,242,237,245,235,232,105,128, 10, 77,237,250, 97, 2, - 95, 36, 95, 45,225,242,225,226,233, 99,128, 6, 33,236,239,247, - 225,242,225,226,233, 99,128, 6, 33,238,231,245,236,230,233,236, - 236,229,114,128, 49,100,114, 2, 95, 76, 95, 92,228,243,233,231, - 238,227,249,242,233,236,236,233, 99,128, 4, 74,240,239,239,110, - 2, 95,101, 95,114,236,229,230,244,226,225,242,226,245,112,128, - 33,188,242,233,231,232,244,226,225,242,226,245,112,128, 33,192, - 243,241,245,225,242,101,128, 51,202,244,225,102, 3, 95,147, 95, - 239, 96, 74,240,225,244,225,104,134, 5,178, 95,167, 95,172, 95, - 186, 95,195, 95,210, 95,226,177, 54,128, 5,178, 50, 2, 95,178, - 95,182, 51,128, 5,178,102,128, 5,178,232,229,226,242,229,119, - 128, 5,178,238,225,242,242,239,247,232,229,226,242,229,119,128, - 5,178,241,245,225,242,244,229,242,232,229,226,242,229,119,128, - 5,178,247,233,228,229,232,229,226,242,229,119,128, 5,178,241, - 225,237,225,244,115,135, 5,179, 96, 6, 96, 11, 96, 16, 96, 21, - 96, 30, 96, 45, 96, 61,177, 98,128, 5,179,178, 56,128, 5,179, - 179, 52,128, 5,179,232,229,226,242,229,119,128, 5,179,238,225, - 242,242,239,247,232,229,226,242,229,119,128, 5,179,241,245,225, - 242,244,229,242,232,229,226,242,229,119,128, 5,179,247,233,228, - 229,232,229,226,242,229,119,128, 5,179,243,229,231,239,108,135, - 5,177, 96, 96, 96,101, 96,106, 96,111, 96,120, 96,135, 96,151, - 177, 55,128, 5,177,178, 52,128, 5,177,179, 48,128, 5,177,232, - 229,226,242,229,119,128, 5,177,238,225,242,242,239,247,232,229, - 226,242,229,119,128, 5,177,241,245,225,242,244,229,242,232,229, - 226,242,229,119,128, 5,177,247,233,228,229,232,229,226,242,229, - 119,128, 5,177, 98, 3, 96,172, 96,177, 96,187,225,114,128, 1, - 39,239,240,239,237,239,230,111,128, 49, 15,242,229,246,229,226, - 229,236,239,119,128, 30, 43, 99, 2, 96,205, 96,214,229,228,233, - 236,236, 97,128, 30, 41,233,242, 99, 2, 96,222, 96,227,236,101, - 128, 36,215,245,237,230,236,229,120,128, 1, 37,100, 2, 96,242, - 96,252,233,229,242,229,243,233,115,128, 30, 39,239,116, 2, 97, - 3, 97, 12,225,227,227,229,238,116,128, 30, 35,226,229,236,239, - 119,128, 30, 37,101,136, 5,212, 97, 40, 97, 73, 97, 93, 98, 66, - 98, 82, 98,127, 98,136, 98,149,225,242,116,129, 38,101, 97, 48, - 243,245,233,116, 2, 97, 57, 97, 65,226,236,225,227,107,128, 38, - 101,247,232,233,244,101,128, 38, 97,228,225,231,229,243,104,129, - 251, 52, 97, 84,232,229,226,242,229,119,128,251, 52,104, 6, 97, - 107, 97,135, 97,143, 97,193, 97,239, 98, 32, 97, 2, 97,113, 97, - 127,236,244,239,238,229,225,242,225,226,233, 99,128, 6,193,242, - 225,226,233, 99,128, 6, 71,229,226,242,229,119,128, 5,212,230, - 233,238,225,236, 97, 2, 97,154, 97,185,236,116, 2, 97,161, 97, - 173,239,238,229,225,242,225,226,233, 99,128,251,167,244,247,239, - 225,242,225,226,233, 99,128,254,234,242,225,226,233, 99,128,254, - 234,232,225,237,250,225,225,226,239,246,101, 2, 97,208, 97,222, - 230,233,238,225,236,225,242,225,226,233, 99,128,251,165,233,243, - 239,236,225,244,229,228,225,242,225,226,233, 99,128,251,164,105, - 2, 97,245, 98, 23,238,233,244,233,225,236, 97, 2, 98, 1, 98, - 15,236,244,239,238,229,225,242,225,226,233, 99,128,251,168,242, - 225,226,233, 99,128,254,235,242,225,231,225,238, 97,128, 48,120, - 237,229,228,233,225,236, 97, 2, 98, 44, 98, 58,236,244,239,238, - 229,225,242,225,226,233, 99,128,251,169,242,225,226,233, 99,128, - 254,236,233,243,229,233,229,242,225,243,241,245,225,242,101,128, - 51,123,107, 2, 98, 88, 98,112,225,244,225,235,225,238, 97,129, - 48,216, 98,100,232,225,236,230,247,233,228,244,104,128,255,141, - 245,244,225,225,242,245,243,241,245,225,242,101,128, 51, 54,238, - 231,232,239,239,107,128, 2,103,242,245,244,245,243,241,245,225, - 242,101,128, 51, 57,116,129, 5,215, 98,155,232,229,226,242,229, - 119,128, 5,215,232,239,239,107,129, 2,102, 98,173,243,245,240, - 229,242,233,239,114,128, 2,177,105, 4, 98,194, 99, 23, 99, 34, - 99, 59,229,245,104, 4, 98,206, 98,241, 99, 0, 99, 9, 97, 2, - 98,212, 98,227,227,233,242,227,236,229,235,239,242,229,225,110, - 128, 50,123,240,225,242,229,238,235,239,242,229,225,110,128, 50, - 27,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,109, - 235,239,242,229,225,110,128, 49, 78,240,225,242,229,238,235,239, - 242,229,225,110,128, 50, 13,232,233,242,225,231,225,238, 97,128, - 48,114,235,225,244,225,235,225,238, 97,129, 48,210, 99, 47,232, - 225,236,230,247,233,228,244,104,128,255,139,242,233,113,134, 5, - 180, 99, 77, 99, 82, 99, 96, 99,105, 99,120, 99,136,177, 52,128, - 5,180, 50, 2, 99, 88, 99, 92, 49,128, 5,180,100,128, 5,180, - 232,229,226,242,229,119,128, 5,180,238,225,242,242,239,247,232, - 229,226,242,229,119,128, 5,180,241,245,225,242,244,229,242,232, - 229,226,242,229,119,128, 5,180,247,233,228,229,232,229,226,242, - 229,119,128, 5,180,236,233,238,229,226,229,236,239,119,128, 30, - 150,237,239,238,239,243,240,225,227,101,128,255, 72,111, 9, 99, - 193, 99,204, 99,228, 99,253,100, 85,100, 98,100,184,100,224,100, - 235,225,242,237,229,238,233,225,110,128, 5,112,232,105, 2, 99, - 211, 99,219,240,244,232,225,105,128, 14, 43,242,225,231,225,238, - 97,128, 48,123,235,225,244,225,235,225,238, 97,129, 48,219, 99, - 241,232,225,236,230,247,233,228,244,104,128,255,142,236,225,109, - 135, 5,185,100, 17,100, 22,100, 27,100, 32,100, 41,100, 56,100, - 72,177, 57,128, 5,185,178, 54,128, 5,185,179, 50,128, 5,185, - 232,229,226,242,229,119,128, 5,185,238,225,242,242,239,247,232, - 229,226,242,229,119,128, 5,185,241,245,225,242,244,229,242,232, - 229,226,242,229,119,128, 5,185,247,233,228,229,232,229,226,242, - 229,119,128, 5,185,238,239,235,232,245,235,244,232,225,105,128, - 14, 46,111, 2,100,104,100,174,107, 4,100,114,100,126,100,132, - 100,154,225,226,239,246,229,227,239,237, 98,128, 3, 9,227,237, - 98,128, 3, 9,240,225,236,225,244,225,236,233,250,229,228,226, - 229,236,239,247,227,237, 98,128, 3, 33,242,229,244,242,239,230, - 236,229,248,226,229,236,239,247,227,237, 98,128, 3, 34,238,243, - 241,245,225,242,101,128, 51, 66,114, 2,100,190,100,217,105, 2, - 100,196,100,205,227,239,240,244,233, 99,128, 3,233,250,239,238, - 244,225,236,226,225,114,128, 32, 21,238,227,237, 98,128, 3, 27, - 244,243,240,242,233,238,231,115,128, 38,104,245,243,101,128, 35, - 2,240,225,242,229,110,128, 36,163,243,245,240,229,242,233,239, - 114,128, 2,176,244,245,242,238,229,100,128, 2,101,117, 4,101, - 23,101, 34,101, 47,101, 72,232,233,242,225,231,225,238, 97,128, - 48,117,233,233,244,239,243,241,245,225,242,101,128, 51, 51,235, - 225,244,225,235,225,238, 97,129, 48,213,101, 60,232,225,236,230, - 247,233,228,244,104,128,255,140,238,231,225,242,245,237,236,225, - 245,116,129, 2,221,101, 87,227,237, 98,128, 3, 11,118,128, 1, - 149,249,240,232,229,110,132, 0, 45,101,113,101,124,101,136,101, - 159,233,238,230,229,242,233,239,114,128,246,229,237,239,238,239, - 243,240,225,227,101,128,255, 13,115, 2,101,142,101,149,237,225, - 236,108,128,254, 99,245,240,229,242,233,239,114,128,246,230,244, - 247,111,128, 32, 16,105,149, 0,105,101,211,101,234,102, 12,102, - 59,105,197,106, 61,106, 98,106,125,107, 31,107, 35,107, 73,107, - 95,107,179,108, 88,108,163,108,171,108,184,109, 15,109, 72,109, - 100,109,144,225, 99, 2,101,218,101,224,245,244,101,128, 0,237, - 249,242,233,236,236,233, 99,128, 4, 79, 98, 3,101,242,101,251, - 102, 5,229,238,231,225,236,105,128, 9,135,239,240,239,237,239, - 230,111,128, 49, 39,242,229,246,101,128, 1, 45, 99, 3,102, 20, - 102, 27,102, 49,225,242,239,110,128, 1,208,233,242, 99, 2,102, - 35,102, 40,236,101,128, 36,216,245,237,230,236,229,120,128, 0, - 238,249,242,233,236,236,233, 99,128, 4, 86,100, 4,102, 69,102, - 79,105,154,105,187,226,236,231,242,225,246,101,128, 2, 9,101, - 2,102, 85,105,149,239,231,242,225,240,104, 7,102,106,102,120, - 102,133,105, 62,105, 93,105,106,105,118,229,225,242,244,232,227, - 233,242,227,236,101,128, 50,143,230,233,242,229,227,233,242,227, - 236,101,128, 50,139,233, 99, 14,102,164,102,180,103, 23,103, 77, - 103,143,103,172,103,188,103,245,104, 38,104, 50,104, 77,104,144, - 105, 26,105, 55,225,236,236,233,225,238,227,229,240,225,242,229, - 110,128, 50, 63, 99, 4,102,190,102,201,102,215,102,222,225,236, - 236,240,225,242,229,110,128, 50, 58,229,238,244,242,229,227,233, - 242,227,236,101,128, 50,165,236,239,243,101,128, 48, 6,111, 3, - 102,230,102,245,103, 9,237,237, 97,129, 48, 1,102,238,236,229, - 230,116,128,255,100,238,231,242,225,244,245,236,225,244,233,239, - 238,240,225,242,229,110,128, 50, 55,242,242,229,227,244,227,233, - 242,227,236,101,128, 50,163,101, 3,103, 31,103, 43,103, 60,225, - 242,244,232,240,225,242,229,110,128, 50, 47,238,244,229,242,240, - 242,233,243,229,240,225,242,229,110,128, 50, 61,248,227,229,236, - 236,229,238,244,227,233,242,227,236,101,128, 50,157,102, 2,103, - 83,103, 98,229,243,244,233,246,225,236,240,225,242,229,110,128, - 50, 64,105, 2,103,104,103,133,238,225,238,227,233,225,108, 2, - 103,116,103,125,227,233,242,227,236,101,128, 50,150,240,225,242, - 229,110,128, 50, 54,242,229,240,225,242,229,110,128, 50, 43,104, - 2,103,149,103,160,225,246,229,240,225,242,229,110,128, 50, 50, - 233,231,232,227,233,242,227,236,101,128, 50,164,233,244,229,242, - 225,244,233,239,238,237,225,242,107,128, 48, 5,108, 3,103,196, - 103,222,103,234,225,226,239,114, 2,103,205,103,214,227,233,242, - 227,236,101,128, 50,152,240,225,242,229,110,128, 50, 56,229,230, - 244,227,233,242,227,236,101,128, 50,167,239,247,227,233,242,227, - 236,101,128, 50,166,109, 2,103,251,104, 27,101, 2,104, 1,104, - 16,228,233,227,233,238,229,227,233,242,227,236,101,128, 50,169, - 244,225,236,240,225,242,229,110,128, 50, 46,239,239,238,240,225, - 242,229,110,128, 50, 42,238,225,237,229,240,225,242,229,110,128, - 50, 52,112, 2,104, 56,104, 64,229,242,233,239,100,128, 48, 2, - 242,233,238,244,227,233,242,227,236,101,128, 50,158,114, 2,104, - 83,104,131,101, 3,104, 91,104,102,104,117,225,227,232,240,225, - 242,229,110,128, 50, 67,240,242,229,243,229,238,244,240,225,242, - 229,110,128, 50, 57,243,239,245,242,227,229,240,225,242,229,110, - 128, 50, 62,233,231,232,244,227,233,242,227,236,101,128, 50,168, - 115, 5,104,156,104,185,104,199,104,224,104,252,101, 2,104,162, - 104,175,227,242,229,244,227,233,242,227,236,101,128, 50,153,236, - 230,240,225,242,229,110,128, 50, 66,239,227,233,229,244,249,240, - 225,242,229,110,128, 50, 51,112, 2,104,205,104,211,225,227,101, - 128, 48, 0,229,227,233,225,236,240,225,242,229,110,128, 50, 53, - 116, 2,104,230,104,241,239,227,235,240,225,242,229,110,128, 50, - 49,245,228,249,240,225,242,229,110,128, 50, 59,117, 2,105, 2, - 105, 11,238,240,225,242,229,110,128, 50, 48,240,229,242,246,233, - 243,229,240,225,242,229,110,128, 50, 60,119, 2,105, 32,105, 44, - 225,244,229,242,240,225,242,229,110,128, 50, 44,239,239,228,240, - 225,242,229,110,128, 50, 45,250,229,242,111,128, 48, 7,109, 2, - 105, 68,105, 81,229,244,225,236,227,233,242,227,236,101,128, 50, - 142,239,239,238,227,233,242,227,236,101,128, 50,138,238,225,237, - 229,227,233,242,227,236,101,128, 50,148,243,245,238,227,233,242, - 227,236,101,128, 50,144,119, 2,105,124,105,137,225,244,229,242, - 227,233,242,227,236,101,128, 50,140,239,239,228,227,233,242,227, - 236,101,128, 50,141,246, 97,128, 9, 7,233,229,242,229,243,233, - 115,130, 0,239,105,168,105,176,225,227,245,244,101,128, 30, 47, - 227,249,242,233,236,236,233, 99,128, 4,229,239,244,226,229,236, - 239,119,128, 30,203,101, 3,105,205,105,221,105,232,226,242,229, - 246,229,227,249,242,233,236,236,233, 99,128, 4,215,227,249,242, - 233,236,236,233, 99,128, 4, 53,245,238,103, 4,105,244,106, 23, - 106, 38,106, 47, 97, 2,105,250,106, 9,227,233,242,227,236,229, - 235,239,242,229,225,110,128, 50,117,240,225,242,229,238,235,239, - 242,229,225,110,128, 50, 21,227,233,242,227,236,229,235,239,242, - 229,225,110,128, 50,103,235,239,242,229,225,110,128, 49, 71,240, - 225,242,229,238,235,239,242,229,225,110,128, 50, 7,103, 2,106, - 67,106, 74,242,225,246,101,128, 0,236,117, 2,106, 80,106, 89, - 234,225,242,225,244,105,128, 10,135,242,237,245,235,232,105,128, - 10, 7,104, 2,106,104,106,114,233,242,225,231,225,238, 97,128, - 48, 68,239,239,235,225,226,239,246,101,128, 30,201,105, 8,106, - 143,106,153,106,164,106,171,106,196,106,212,106,227,106,243,226, - 229,238,231,225,236,105,128, 9,136,227,249,242,233,236,236,233, - 99,128, 4, 56,228,229,246, 97,128, 9, 8,231,117, 2,106,178, - 106,187,234,225,242,225,244,105,128, 10,136,242,237,245,235,232, - 105,128, 10, 8,237,225,244,242,225,231,245,242,237,245,235,232, - 105,128, 10, 64,238,246,229,242,244,229,228,226,242,229,246,101, - 128, 2, 11,243,232,239,242,244,227,249,242,233,236,236,233, 99, - 128, 4, 57,246,239,247,229,236,243,233,231,110, 3,107, 3,107, - 13,107, 20,226,229,238,231,225,236,105,128, 9,192,228,229,246, - 97,128, 9, 64,231,245,234,225,242,225,244,105,128, 10,192,106, - 128, 1, 51,107, 2,107, 41,107, 65,225,244,225,235,225,238, 97, - 129, 48,164,107, 53,232,225,236,230,247,233,228,244,104,128,255, - 114,239,242,229,225,110,128, 49, 99,108, 2,107, 79,107, 84,228, - 101,128, 2,220,245,249,232,229,226,242,229,119,128, 5,172,109, - 2,107,101,107,168, 97, 3,107,109,107,129,107,154,227,242,239, - 110,129, 1, 43,107,118,227,249,242,233,236,236,233, 99,128, 4, - 227,231,229,239,242,225,240,240,242,239,248,233,237,225,244,229, - 236,249,229,241,245,225,108,128, 34, 83,244,242,225,231,245,242, - 237,245,235,232,105,128, 10, 63,239,238,239,243,240,225,227,101, - 128,255, 73,110, 5,107,191,107,201,107,210,107,222,108, 50,227, - 242,229,237,229,238,116,128, 34, 6,230,233,238,233,244,121,128, - 34, 30,233,225,242,237,229,238,233,225,110,128, 5,107,116, 2, - 107,228,108, 40,101, 2,107,234,108, 29,231,242,225,108,131, 34, - 43,107,247,108, 9,108, 14, 98, 2,107,253,108, 5,239,244,244, - 239,109,128, 35, 33,116,128, 35, 33,229,120,128,248,245,116, 2, - 108, 20,108, 25,239,112,128, 35, 32,112,128, 35, 32,242,243,229, - 227,244,233,239,110,128, 34, 41,233,243,241,245,225,242,101,128, - 51, 5,118, 3,108, 58,108, 67,108, 76,226,245,236,236,229,116, - 128, 37,216,227,233,242,227,236,101,128, 37,217,243,237,233,236, - 229,230,225,227,101,128, 38, 59,111, 3,108, 96,108,107,108,115, - 227,249,242,233,236,236,233, 99,128, 4, 81,231,239,238,229,107, - 128, 1, 47,244, 97,131, 3,185,108,126,108,147,108,155,228,233, - 229,242,229,243,233,115,129, 3,202,108,139,244,239,238,239,115, - 128, 3,144,236,225,244,233,110,128, 2,105,244,239,238,239,115, - 128, 3,175,240,225,242,229,110,128, 36,164,242,233,231,245,242, - 237,245,235,232,105,128, 10,114,115, 4,108,194,108,239,108,253, - 109, 5,237,225,236,108, 2,108,203,108,214,232,233,242,225,231, - 225,238, 97,128, 48, 67,235,225,244,225,235,225,238, 97,129, 48, - 163,108,227,232,225,236,230,247,233,228,244,104,128,255,104,243, - 232,225,242,226,229,238,231,225,236,105,128, 9,250,244,242,239, - 235,101,128, 2,104,245,240,229,242,233,239,114,128,246,237,116, - 2,109, 21,109, 55,229,242,225,244,233,239,110, 2,109, 33,109, - 44,232,233,242,225,231,225,238, 97,128, 48,157,235,225,244,225, - 235,225,238, 97,128, 48,253,233,236,228,101,129, 1, 41,109, 64, - 226,229,236,239,119,128, 30, 45,117, 2,109, 78,109, 89,226,239, - 240,239,237,239,230,111,128, 49, 41,227,249,242,233,236,236,233, - 99,128, 4, 78,246,239,247,229,236,243,233,231,110, 3,109,116, - 109,126,109,133,226,229,238,231,225,236,105,128, 9,191,228,229, - 246, 97,128, 9, 63,231,245,234,225,242,225,244,105,128, 10,191, - 250,232,233,244,243, 97, 2,109,155,109,166,227,249,242,233,236, - 236,233, 99,128, 4,117,228,226,236,231,242,225,246,229,227,249, - 242,233,236,236,233, 99,128, 4,119,106,138, 0,106,109,209,110, - 16,110, 27,110, 77,110, 93,110,206,111, 19,111, 24,111, 36,111, - 44, 97, 4,109,219,109,230,109,240,109,247,225,242,237,229,238, - 233,225,110,128, 5,113,226,229,238,231,225,236,105,128, 9,156, - 228,229,246, 97,128, 9, 28,231,117, 2,109,254,110, 7,234,225, - 242,225,244,105,128, 10,156,242,237,245,235,232,105,128, 10, 28, - 226,239,240,239,237,239,230,111,128, 49, 16, 99, 3,110, 35,110, - 42,110, 64,225,242,239,110,128, 1,240,233,242, 99, 2,110, 50, - 110, 55,236,101,128, 36,217,245,237,230,236,229,120,128, 1, 53, - 242,239,243,243,229,228,244,225,233,108,128, 2,157,228,239,244, - 236,229,243,243,243,244,242,239,235,101,128, 2, 95,101, 3,110, - 101,110,112,110,177,227,249,242,233,236,236,233, 99,128, 4, 88, - 229,109, 4,110,123,110,132,110,146,110,162,225,242,225,226,233, - 99,128, 6, 44,230,233,238,225,236,225,242,225,226,233, 99,128, - 254,158,233,238,233,244,233,225,236,225,242,225,226,233, 99,128, - 254,159,237,229,228,233,225,236,225,242,225,226,233, 99,128,254, - 160,104, 2,110,183,110,192,225,242,225,226,233, 99,128, 6,152, - 230,233,238,225,236,225,242,225,226,233, 99,128,251,139,104, 2, - 110,212,111, 6, 97, 3,110,220,110,230,110,237,226,229,238,231, - 225,236,105,128, 9,157,228,229,246, 97,128, 9, 29,231,117, 2, - 110,244,110,253,234,225,242,225,244,105,128, 10,157,242,237,245, - 235,232,105,128, 10, 29,229,232,225,242,237,229,238,233,225,110, - 128, 5,123,233,115,128, 48, 4,237,239,238,239,243,240,225,227, - 101,128,255, 74,240,225,242,229,110,128, 36,165,243,245,240,229, - 242,233,239,114,128, 2,178,107,146, 0,107,111, 95,113,184,113, - 195,114, 1,114, 12,114,102,114,116,115,224,116,164,116,177,116, - 203,116,252,117,134,117,156,117,169,117,192,117,234,117,244, 97, - 12,111,121,111,153,111,175,111,205,112, 63,112, 88,112,118,112, - 143,112,249,113, 7,113,130,113,159, 98, 2,111,127,111,144,225, - 243,232,235,233,242,227,249,242,233,236,236,233, 99,128, 4,161, - 229,238,231,225,236,105,128, 9,149, 99, 2,111,159,111,165,245, - 244,101,128, 30, 49,249,242,233,236,236,233, 99,128, 4, 58,228, - 101, 2,111,182,111,200,243,227,229,238,228,229,242,227,249,242, - 233,236,236,233, 99,128, 4,155,246, 97,128, 9, 21,102,135, 5, - 219,111,223,111,232,111,252,112, 10,112, 19,112, 35,112, 50,225, - 242,225,226,233, 99,128, 6, 67,228,225,231,229,243,104,129,251, - 59,111,243,232,229,226,242,229,119,128,251, 59,230,233,238,225, - 236,225,242,225,226,233, 99,128,254,218,232,229,226,242,229,119, - 128, 5,219,233,238,233,244,233,225,236,225,242,225,226,233, 99, - 128,254,219,237,229,228,233,225,236,225,242,225,226,233, 99,128, - 254,220,242,225,230,229,232,229,226,242,229,119,128,251, 77,231, - 117, 2,112, 70,112, 79,234,225,242,225,244,105,128, 10,149,242, - 237,245,235,232,105,128, 10, 21,104, 2,112, 94,112,104,233,242, - 225,231,225,238, 97,128, 48, 75,239,239,235,227,249,242,233,236, - 236,233, 99,128, 4,196,235,225,244,225,235,225,238, 97,129, 48, - 171,112,131,232,225,236,230,247,233,228,244,104,128,255,118,112, - 2,112,149,112,170,240, 97,129, 3,186,112,156,243,249,237,226, - 239,236,231,242,229,229,107,128, 3,240,249,229,239,245,110, 3, - 112,182,112,196,112,230,237,233,229,245,237,235,239,242,229,225, - 110,128, 49,113,112, 2,112,202,112,217,232,233,229,245,240,232, - 235,239,242,229,225,110,128, 49,132,233,229,245,240,235,239,242, - 229,225,110,128, 49,120,243,243,225,238,231,240,233,229,245,240, - 235,239,242,229,225,110,128, 49,121,242,239,242,233,233,243,241, - 245,225,242,101,128, 51, 13,115, 5,113, 19,113, 63,113, 78,113, - 86,113,114,232,233,228,225,225,245,244,111, 2,113, 32,113, 41, - 225,242,225,226,233, 99,128, 6, 64,238,239,243,233,228,229,226, - 229,225,242,233,238,231,225,242,225,226,233, 99,128, 6, 64,237, - 225,236,236,235,225,244,225,235,225,238, 97,128, 48,245,241,245, - 225,242,101,128, 51,132,242, 97, 2,113, 93,113,102,225,242,225, - 226,233, 99,128, 6, 80,244,225,238,225,242,225,226,233, 99,128, - 6, 77,244,242,239,235,229,227,249,242,233,236,236,233, 99,128, - 4,159,244,225,232,233,242,225,240,242,239,236,239,238,231,237, - 225,242,235,232,225,236,230,247,233,228,244,104,128,255,112,246, - 229,242,244,233,227,225,236,243,244,242,239,235,229,227,249,242, - 233,236,236,233, 99,128, 4,157,226,239,240,239,237,239,230,111, - 128, 49, 14, 99, 4,113,205,113,227,113,236,113,244, 97, 2,113, - 211,113,221,236,243,241,245,225,242,101,128, 51,137,242,239,110, - 128, 1,233,229,228,233,236,236, 97,128, 1, 55,233,242,227,236, - 101,128, 36,218,239,237,237,225,225,227,227,229,238,116,128, 1, - 55,228,239,244,226,229,236,239,119,128, 30, 51,101, 4,114, 22, - 114, 49,114, 74,114, 86,104, 2,114, 28,114, 39,225,242,237,229, - 238,233,225,110,128, 5,132,233,242,225,231,225,238, 97,128, 48, - 81,235,225,244,225,235,225,238, 97,129, 48,177,114, 62,232,225, - 236,230,247,233,228,244,104,128,255,121,238,225,242,237,229,238, - 233,225,110,128, 5,111,243,237,225,236,236,235,225,244,225,235, - 225,238, 97,128, 48,246,231,242,229,229,238,236,225,238,228,233, - 99,128, 1, 56,104, 6,114,130,115, 3,115, 14,115, 39,115,126, - 115,214, 97, 5,114,142,114,152,114,163,114,170,114,195,226,229, - 238,231,225,236,105,128, 9,150,227,249,242,233,236,236,233, 99, - 128, 4, 69,228,229,246, 97,128, 9, 22,231,117, 2,114,177,114, - 186,234,225,242,225,244,105,128, 10,150,242,237,245,235,232,105, - 128, 10, 22,104, 4,114,205,114,214,114,228,114,244,225,242,225, - 226,233, 99,128, 6, 46,230,233,238,225,236,225,242,225,226,233, - 99,128,254,166,233,238,233,244,233,225,236,225,242,225,226,233, - 99,128,254,167,237,229,228,233,225,236,225,242,225,226,233, 99, - 128,254,168,229,233,227,239,240,244,233, 99,128, 3,231,232, 97, - 2,115, 21,115, 28,228,229,246, 97,128, 9, 89,231,245,242,237, - 245,235,232,105,128, 10, 89,233,229,245,235,104, 4,115, 53,115, - 88,115,103,115,112, 97, 2,115, 59,115, 74,227,233,242,227,236, - 229,235,239,242,229,225,110,128, 50,120,240,225,242,229,238,235, - 239,242,229,225,110,128, 50, 24,227,233,242,227,236,229,235,239, - 242,229,225,110,128, 50,106,235,239,242,229,225,110,128, 49, 75, - 240,225,242,229,238,235,239,242,229,225,110,128, 50, 10,111, 4, - 115,136,115,185,115,195,115,200,235,104, 4,115,147,115,156,115, - 165,115,175,225,233,244,232,225,105,128, 14, 2,239,238,244,232, - 225,105,128, 14, 5,245,225,244,244,232,225,105,128, 14, 3,247, - 225,233,244,232,225,105,128, 14, 4,237,245,244,244,232,225,105, - 128, 14, 91,239,107,128, 1,153,242,225,235,232,225,238,231,244, - 232,225,105,128, 14, 6,250,243,241,245,225,242,101,128, 51,145, - 105, 4,115,234,115,245,116, 14,116, 63,232,233,242,225,231,225, - 238, 97,128, 48, 77,235,225,244,225,235,225,238, 97,129, 48,173, - 116, 2,232,225,236,230,247,233,228,244,104,128,255,119,242,111, - 3,116, 23,116, 38,116, 54,231,245,242,225,237,245,243,241,245, - 225,242,101,128, 51, 21,237,229,229,244,239,242,245,243,241,245, - 225,242,101,128, 51, 22,243,241,245,225,242,101,128, 51, 20,249, - 229,239,107, 5,116, 78,116,113,116,128,116,137,116,151, 97, 2, - 116, 84,116, 99,227,233,242,227,236,229,235,239,242,229,225,110, - 128, 50,110,240,225,242,229,238,235,239,242,229,225,110,128, 50, - 14,227,233,242,227,236,229,235,239,242,229,225,110,128, 50, 96, - 235,239,242,229,225,110,128, 49, 49,240,225,242,229,238,235,239, - 242,229,225,110,128, 50, 0,243,233,239,243,235,239,242,229,225, - 110,128, 49, 51,234,229,227,249,242,233,236,236,233, 99,128, 4, - 92,108, 2,116,183,116,194,233,238,229,226,229,236,239,119,128, - 30, 53,243,241,245,225,242,101,128, 51,152,109, 3,116,211,116, - 225,116,236,227,245,226,229,228,243,241,245,225,242,101,128, 51, - 166,239,238,239,243,240,225,227,101,128,255, 75,243,241,245,225, - 242,229,228,243,241,245,225,242,101,128, 51,162,111, 5,117, 8, - 117, 34,117, 72,117, 84,117, 98,104, 2,117, 14,117, 24,233,242, - 225,231,225,238, 97,128, 48, 83,237,243,241,245,225,242,101,128, - 51,192,235, 97, 2,117, 41,117, 49,233,244,232,225,105,128, 14, - 1,244,225,235,225,238, 97,129, 48,179,117, 60,232,225,236,230, - 247,233,228,244,104,128,255,122,239,240,239,243,241,245,225,242, - 101,128, 51, 30,240,240,225,227,249,242,233,236,236,233, 99,128, - 4,129,114, 2,117,104,117,124,229,225,238,243,244,225,238,228, - 225,242,228,243,249,237,226,239,108,128, 50,127,239,238,233,243, - 227,237, 98,128, 3, 67,240, 97, 2,117,141,117,147,242,229,110, - 128, 36,166,243,241,245,225,242,101,128, 51,170,243,233,227,249, - 242,233,236,236,233, 99,128, 4,111,116, 2,117,175,117,184,243, - 241,245,225,242,101,128, 51,207,245,242,238,229,100,128, 2,158, - 117, 2,117,198,117,209,232,233,242,225,231,225,238, 97,128, 48, - 79,235,225,244,225,235,225,238, 97,129, 48,175,117,222,232,225, - 236,230,247,233,228,244,104,128,255,120,246,243,241,245,225,242, - 101,128, 51,184,247,243,241,245,225,242,101,128, 51,190,108,146, - 0,108,118, 38,120, 65,120, 94,120,160,120,198,121, 94,121,103, - 121,119,121,143,121,161,122, 23,122, 64,122,199,122,207,122,240, - 122,249,123, 1,123, 63, 97, 7,118, 54,118, 64,118, 71,118, 78, - 118,103,118,119,120, 53,226,229,238,231,225,236,105,128, 9,178, - 227,245,244,101,128, 1, 58,228,229,246, 97,128, 9, 50,231,117, - 2,118, 85,118, 94,234,225,242,225,244,105,128, 10,178,242,237, - 245,235,232,105,128, 10, 50,235,235,232,225,238,231,249,225,239, - 244,232,225,105,128, 14, 69,109, 10,118,141,119, 80,119, 97,119, - 135,119,149,119,168,119,184,119,204,119,224,119,247, 97, 2,118, - 147,119, 72,236,229,102, 4,118,159,118,173,119, 9,119, 26,230, - 233,238,225,236,225,242,225,226,233, 99,128,254,252,232,225,237, - 250, 97, 2,118,183,118,224,225,226,239,246,101, 2,118,193,118, - 207,230,233,238,225,236,225,242,225,226,233, 99,128,254,248,233, - 243,239,236,225,244,229,228,225,242,225,226,233, 99,128,254,247, - 226,229,236,239,119, 2,118,234,118,248,230,233,238,225,236,225, - 242,225,226,233, 99,128,254,250,233,243,239,236,225,244,229,228, - 225,242,225,226,233, 99,128,254,249,233,243,239,236,225,244,229, - 228,225,242,225,226,233, 99,128,254,251,237,225,228,228,225,225, - 226,239,246,101, 2,119, 41,119, 55,230,233,238,225,236,225,242, - 225,226,233, 99,128,254,246,233,243,239,236,225,244,229,228,225, - 242,225,226,233, 99,128,254,245,242,225,226,233, 99,128, 6, 68, - 226,228, 97,129, 3,187,119, 88,243,244,242,239,235,101,128, 1, - 155,229,100,130, 5,220,119,106,119,126,228,225,231,229,243,104, - 129,251, 60,119,117,232,229,226,242,229,119,128,251, 60,232,229, - 226,242,229,119,128, 5,220,230,233,238,225,236,225,242,225,226, - 233, 99,128,254,222,232,225,232,233,238,233,244,233,225,236,225, - 242,225,226,233, 99,128,252,202,233,238,233,244,233,225,236,225, - 242,225,226,233, 99,128,254,223,234,229,229,237,233,238,233,244, - 233,225,236,225,242,225,226,233, 99,128,252,201,235,232,225,232, - 233,238,233,244,233,225,236,225,242,225,226,233, 99,128,252,203, - 236,225,237,232,229,232,233,243,239,236,225,244,229,228,225,242, - 225,226,233, 99,128,253,242,237,101, 2,119,254,120, 11,228,233, - 225,236,225,242,225,226,233, 99,128,254,224,229,109, 2,120, 18, - 120, 37,232,225,232,233,238,233,244,233,225,236,225,242,225,226, - 233, 99,128,253,136,233,238,233,244,233,225,236,225,242,225,226, - 233, 99,128,252,204,242,231,229,227,233,242,227,236,101,128, 37, - 239, 98, 3,120, 73,120, 78,120, 84,225,114,128, 1,154,229,236, - 116,128, 2,108,239,240,239,237,239,230,111,128, 49, 12, 99, 4, - 120,104,120,111,120,120,120,147,225,242,239,110,128, 1, 62,229, - 228,233,236,236, 97,128, 1, 60,233,242, 99, 2,120,128,120,133, - 236,101,128, 36,219,245,237,230,236,229,248,226,229,236,239,119, - 128, 30, 61,239,237,237,225,225,227,227,229,238,116,128, 1, 60, - 228,239,116,130, 1, 64,120,170,120,179,225,227,227,229,238,116, - 128, 1, 64,226,229,236,239,119,129, 30, 55,120,189,237,225,227, - 242,239,110,128, 30, 57,101, 3,120,206,120,244,121, 89,230,116, - 2,120,213,120,229,225,238,231,236,229,225,226,239,246,229,227, - 237, 98,128, 3, 26,244,225,227,235,226,229,236,239,247,227,237, - 98,128, 3, 24,243,115,132, 0, 60,121, 1,121, 23,121, 35,121, - 81,229,241,245,225,108,129, 34,100,121, 11,239,242,231,242,229, - 225,244,229,114,128, 34,218,237,239,238,239,243,240,225,227,101, - 128,255, 28,111, 2,121, 41,121, 70,114, 2,121, 47,121, 60,229, - 241,245,233,246,225,236,229,238,116,128, 34,114,231,242,229,225, - 244,229,114,128, 34,118,246,229,242,229,241,245,225,108,128, 34, - 102,243,237,225,236,108,128,254,100,250,104,128, 2,110,230,226, - 236,239,227,107,128, 37,140,232,239,239,235,242,229,244,242,239, - 230,236,229,120,128, 2,109,105, 2,121,125,121,130,242, 97,128, - 32,164,247,238,225,242,237,229,238,233,225,110,128, 5,108,106, - 129, 1,201,121,149,229,227,249,242,233,236,236,233, 99,128, 4, - 89,108,132,246,192,121,173,121,197,121,208,121,217, 97, 2,121, - 179,121,186,228,229,246, 97,128, 9, 51,231,245,234,225,242,225, - 244,105,128, 10,179,233,238,229,226,229,236,239,119,128, 30, 59, - 236,225,228,229,246, 97,128, 9, 52,246,239,227,225,236,233, 99, - 3,121,231,121,241,121,248,226,229,238,231,225,236,105,128, 9, - 225,228,229,246, 97,128, 9, 97,246,239,247,229,236,243,233,231, - 110, 2,122, 6,122, 16,226,229,238,231,225,236,105,128, 9,227, - 228,229,246, 97,128, 9, 99,109, 3,122, 31,122, 44,122, 55,233, - 228,228,236,229,244,233,236,228,101,128, 2,107,239,238,239,243, - 240,225,227,101,128,255, 76,243,241,245,225,242,101,128, 51,208, - 111, 6,122, 78,122, 90,122,132,122,143,122,149,122,191,227,232, - 245,236,225,244,232,225,105,128, 14, 44,231,233,227,225,108, 3, - 122,102,122,108,122,127,225,238,100,128, 34, 39,238,239,116,129, - 0,172,122,116,242,229,246,229,242,243,229,100,128, 35, 16,239, - 114,128, 34, 40,236,233,238,231,244,232,225,105,128, 14, 37,238, - 231,115,128, 1,127,247,236,233,238,101, 2,122,159,122,182, 99, - 2,122,165,122,177,229,238,244,229,242,236,233,238,101,128,254, - 78,237, 98,128, 3, 50,228,225,243,232,229,100,128,254, 77,250, - 229,238,231,101,128, 37,202,240,225,242,229,110,128, 36,167,115, - 3,122,215,122,222,122,230,236,225,243,104,128, 1, 66,241,245, - 225,242,101,128, 33, 19,245,240,229,242,233,239,114,128,246,238, - 244,243,232,225,228,101,128, 37,145,245,244,232,225,105,128, 14, - 38,246,239,227,225,236,233, 99, 3,123, 15,123, 25,123, 32,226, - 229,238,231,225,236,105,128, 9,140,228,229,246, 97,128, 9, 12, - 246,239,247,229,236,243,233,231,110, 2,123, 46,123, 56,226,229, - 238,231,225,236,105,128, 9,226,228,229,246, 97,128, 9, 98,248, - 243,241,245,225,242,101,128, 51,211,109,144, 0,109,123,109,125, - 218,125,243,126, 14,126, 39,127, 92,127,114,128,169,128,199,128, - 248,129, 99,129,121,129,146,129,155,130,182,130,210, 97, 12,123, - 135,123,145,123,209,123,216,123,241,124, 33,125,125,125,150,125, - 155,125,169,125,181,125,186,226,229,238,231,225,236,105,128, 9, - 174, 99, 2,123,151,123,203,242,239,110,132, 0,175,123,165,123, - 176,123,182,123,191,226,229,236,239,247,227,237, 98,128, 3, 49, - 227,237, 98,128, 3, 4,236,239,247,237,239,100,128, 2,205,237, - 239,238,239,243,240,225,227,101,128,255,227,245,244,101,128, 30, - 63,228,229,246, 97,128, 9, 46,231,117, 2,123,223,123,232,234, - 225,242,225,244,105,128, 10,174,242,237,245,235,232,105,128, 10, - 46,104, 2,123,247,124, 23,225,240,225,235,104, 2,124, 1,124, - 10,232,229,226,242,229,119,128, 5,164,236,229,230,244,232,229, - 226,242,229,119,128, 5,164,233,242,225,231,225,238, 97,128, 48, - 126,105, 5,124, 45,124,114,124,177,124,207,125,113,227,232,225, - 244,244,225,247, 97, 3,124, 60,124, 91,124, 98,236,239,119, 2, - 124, 68,124, 79,236,229,230,244,244,232,225,105,128,248,149,242, - 233,231,232,244,244,232,225,105,128,248,148,244,232,225,105,128, - 14, 75,245,240,240,229,242,236,229,230,244,244,232,225,105,128, - 248,147,229,107, 3,124,123,124,154,124,161,236,239,119, 2,124, - 131,124,142,236,229,230,244,244,232,225,105,128,248,140,242,233, - 231,232,244,244,232,225,105,128,248,139,244,232,225,105,128, 14, - 72,245,240,240,229,242,236,229,230,244,244,232,225,105,128,248, - 138,232,225,238,225,235,225,116, 2,124,189,124,200,236,229,230, - 244,244,232,225,105,128,248,132,244,232,225,105,128, 14, 49,116, - 3,124,215,124,243,125, 50,225,233,235,232,117, 2,124,225,124, - 236,236,229,230,244,244,232,225,105,128,248,137,244,232,225,105, - 128, 14, 71,232,111, 3,124,252,125, 27,125, 34,236,239,119, 2, - 125, 4,125, 15,236,229,230,244,244,232,225,105,128,248,143,242, - 233,231,232,244,244,232,225,105,128,248,142,244,232,225,105,128, - 14, 73,245,240,240,229,242,236,229,230,244,244,232,225,105,128, - 248,141,242,105, 3,125, 59,125, 90,125, 97,236,239,119, 2,125, - 67,125, 78,236,229,230,244,244,232,225,105,128,248,146,242,233, - 231,232,244,244,232,225,105,128,248,145,244,232,225,105,128, 14, - 74,245,240,240,229,242,236,229,230,244,244,232,225,105,128,248, - 144,249,225,237,239,235,244,232,225,105,128, 14, 70,235,225,244, - 225,235,225,238, 97,129, 48,222,125,138,232,225,236,230,247,233, - 228,244,104,128,255,143,236,101,128, 38, 66,238,243,249,239,238, - 243,241,245,225,242,101,128, 51, 71,241,225,230,232,229,226,242, - 229,119,128, 5,190,242,115,128, 38, 66,115, 2,125,192,125,210, - 239,242,225,227,233,242,227,236,229,232,229,226,242,229,119,128, - 5,175,241,245,225,242,101,128, 51,131, 98, 2,125,224,125,234, - 239,240,239,237,239,230,111,128, 49, 7,243,241,245,225,242,101, - 128, 51,212, 99, 2,125,249,126, 1,233,242,227,236,101,128, 36, - 220,245,226,229,228,243,241,245,225,242,101,128, 51,165,228,239, - 116, 2,126, 22,126, 31,225,227,227,229,238,116,128, 30, 65,226, - 229,236,239,119,128, 30, 67,101, 7,126, 55,126,182,126,193,126, - 208,126,233,127, 14,127, 26,101, 2,126, 61,126,169,109, 4,126, - 71,126, 80,126, 94,126,110,225,242,225,226,233, 99,128, 6, 69, - 230,233,238,225,236,225,242,225,226,233, 99,128,254,226,233,238, - 233,244,233,225,236,225,242,225,226,233, 99,128,254,227,237,101, - 2,126,117,126,130,228,233,225,236,225,242,225,226,233, 99,128, - 254,228,229,237,105, 2,126,138,126,153,238,233,244,233,225,236, - 225,242,225,226,233, 99,128,252,209,243,239,236,225,244,229,228, - 225,242,225,226,233, 99,128,252, 72,244,239,242,245,243,241,245, - 225,242,101,128, 51, 77,232,233,242,225,231,225,238, 97,128, 48, - 129,233,250,233,229,242,225,243,241,245,225,242,101,128, 51,126, - 235,225,244,225,235,225,238, 97,129, 48,225,126,221,232,225,236, - 230,247,233,228,244,104,128,255,146,109,130, 5,222,126,241,127, - 5,228,225,231,229,243,104,129,251, 62,126,252,232,229,226,242, - 229,119,128,251, 62,232,229,226,242,229,119,128, 5,222,238,225, - 242,237,229,238,233,225,110,128, 5,116,242,235,232, 97, 3,127, - 37,127, 46,127, 79,232,229,226,242,229,119,128, 5,165,235,229, - 230,245,236, 97, 2,127, 57,127, 66,232,229,226,242,229,119,128, - 5,166,236,229,230,244,232,229,226,242,229,119,128, 5,166,236, - 229,230,244,232,229,226,242,229,119,128, 5,165,104, 2,127, 98, - 127,104,239,239,107,128, 2,113,250,243,241,245,225,242,101,128, - 51,146,105, 6,127,128,127,165,128, 46,128, 57,128, 82,128,139, - 228,100, 2,127,135,127,160,236,229,228,239,244,235,225,244,225, - 235,225,238,225,232,225,236,230,247,233,228,244,104,128,255,101, - 239,116,128, 0,183,229,245,109, 5,127,179,127,214,127,229,127, - 238,128, 33, 97, 2,127,185,127,200,227,233,242,227,236,229,235, - 239,242,229,225,110,128, 50,114,240,225,242,229,238,235,239,242, - 229,225,110,128, 50, 18,227,233,242,227,236,229,235,239,242,229, - 225,110,128, 50,100,235,239,242,229,225,110,128, 49, 65,112, 2, - 127,244,128, 20, 97, 2,127,250,128, 8,238,243,233,239,243,235, - 239,242,229,225,110,128, 49,112,242,229,238,235,239,242,229,225, - 110,128, 50, 4,233,229,245,240,235,239,242,229,225,110,128, 49, - 110,243,233,239,243,235,239,242,229,225,110,128, 49,111,232,233, - 242,225,231,225,238, 97,128, 48,127,235,225,244,225,235,225,238, - 97,129, 48,223,128, 70,232,225,236,230,247,233,228,244,104,128, - 255,144,238,117, 2,128, 89,128,134,115,132, 34, 18,128,101,128, - 112,128,121,128,127,226,229,236,239,247,227,237, 98,128, 3, 32, - 227,233,242,227,236,101,128, 34,150,237,239,100,128, 2,215,240, - 236,245,115,128, 34, 19,244,101,128, 32, 50,242,105, 2,128,146, - 128,160,226,225,225,242,245,243,241,245,225,242,101,128, 51, 74, - 243,241,245,225,242,101,128, 51, 73,108, 2,128,175,128,190,239, - 238,231,236,229,231,244,245,242,238,229,100,128, 2,112,243,241, - 245,225,242,101,128, 51,150,109, 3,128,207,128,221,128,232,227, - 245,226,229,228,243,241,245,225,242,101,128, 51,163,239,238,239, - 243,240,225,227,101,128,255, 77,243,241,245,225,242,229,228,243, - 241,245,225,242,101,128, 51,159,111, 5,129, 4,129, 30,129, 55, - 129, 65,129, 74,104, 2,129, 10,129, 20,233,242,225,231,225,238, - 97,128, 48,130,237,243,241,245,225,242,101,128, 51,193,235,225, - 244,225,235,225,238, 97,129, 48,226,129, 43,232,225,236,230,247, - 233,228,244,104,128,255,147,236,243,241,245,225,242,101,128, 51, - 214,237,225,244,232,225,105,128, 14, 33,246,229,242,243,243,241, - 245,225,242,101,129, 51,167,129, 89,228,243,241,245,225,242,101, - 128, 51,168,240, 97, 2,129,106,129,112,242,229,110,128, 36,168, - 243,241,245,225,242,101,128, 51,171,115, 2,129,127,129,136,243, - 241,245,225,242,101,128, 51,179,245,240,229,242,233,239,114,128, - 246,239,244,245,242,238,229,100,128, 2,111,117,141, 0,181,129, - 185,129,189,129,199,129,223,129,233,129,255,130, 10,130, 35,130, - 58,130, 68,130, 98,130,162,130,172, 49,128, 0,181,225,243,241, - 245,225,242,101,128, 51,130,227,104, 2,129,206,129,216,231,242, - 229,225,244,229,114,128, 34,107,236,229,243,115,128, 34,106,230, - 243,241,245,225,242,101,128, 51,140,103, 2,129,239,129,246,242, - 229,229,107,128, 3,188,243,241,245,225,242,101,128, 51,141,232, - 233,242,225,231,225,238, 97,128, 48,128,235,225,244,225,235,225, - 238, 97,129, 48,224,130, 23,232,225,236,230,247,233,228,244,104, - 128,255,145,108, 2,130, 41,130, 50,243,241,245,225,242,101,128, - 51,149,244,233,240,236,121,128, 0,215,237,243,241,245,225,242, - 101,128, 51,155,238,225,104, 2,130, 76,130, 85,232,229,226,242, - 229,119,128, 5,163,236,229,230,244,232,229,226,242,229,119,128, - 5,163,115, 2,130,104,130,153,233, 99, 3,130,113,130,130,130, - 141,225,236,238,239,244,101,129, 38,106,130,124,228,226,108,128, - 38,107,230,236,225,244,243,233,231,110,128, 38,109,243,232,225, - 242,240,243,233,231,110,128, 38,111,243,241,245,225,242,101,128, - 51,178,246,243,241,245,225,242,101,128, 51,182,247,243,241,245, - 225,242,101,128, 51,188,118, 2,130,188,130,201,237,229,231,225, - 243,241,245,225,242,101,128, 51,185,243,241,245,225,242,101,128, - 51,183,119, 2,130,216,130,229,237,229,231,225,243,241,245,225, - 242,101,128, 51,191,243,241,245,225,242,101,128, 51,189,110,150, - 0,110,131, 30,131,164,131,188,131,254,132, 23,132, 81,132, 91, - 132,158,132,201,134,235,134,253,135, 22,135, 53,135, 79,135,144, - 137,126,137,134,137,159,137,167,138,135,138,145,138,155, 97, 8, - 131, 48,131, 68,131, 75,131, 82,131,107,131,118,131,143,131,155, - 98, 2,131, 54,131, 63,229,238,231,225,236,105,128, 9,168,236, - 97,128, 34, 7,227,245,244,101,128, 1, 68,228,229,246, 97,128, - 9, 40,231,117, 2,131, 89,131, 98,234,225,242,225,244,105,128, - 10,168,242,237,245,235,232,105,128, 10, 40,232,233,242,225,231, - 225,238, 97,128, 48,106,235,225,244,225,235,225,238, 97,129, 48, - 202,131,131,232,225,236,230,247,233,228,244,104,128,255,133,240, - 239,243,244,242,239,240,232,101,128, 1, 73,243,241,245,225,242, - 101,128, 51,129, 98, 2,131,170,131,180,239,240,239,237,239,230, - 111,128, 49, 11,243,240,225,227,101,128, 0,160, 99, 4,131,198, - 131,205,131,214,131,241,225,242,239,110,128, 1, 72,229,228,233, - 236,236, 97,128, 1, 70,233,242, 99, 2,131,222,131,227,236,101, - 128, 36,221,245,237,230,236,229,248,226,229,236,239,119,128, 30, - 75,239,237,237,225,225,227,227,229,238,116,128, 1, 70,228,239, - 116, 2,132, 6,132, 15,225,227,227,229,238,116,128, 30, 69,226, - 229,236,239,119,128, 30, 71,101, 3,132, 31,132, 42,132, 67,232, - 233,242,225,231,225,238, 97,128, 48,109,235,225,244,225,235,225, - 238, 97,129, 48,205,132, 55,232,225,236,230,247,233,228,244,104, - 128,255,136,247,243,232,229,241,229,236,243,233,231,110,128, 32, - 170,230,243,241,245,225,242,101,128, 51,139,103, 2,132, 97,132, - 147, 97, 3,132,105,132,115,132,122,226,229,238,231,225,236,105, - 128, 9,153,228,229,246, 97,128, 9, 25,231,117, 2,132,129,132, - 138,234,225,242,225,244,105,128, 10,153,242,237,245,235,232,105, - 128, 10, 25,239,238,231,245,244,232,225,105,128, 14, 7,104, 2, - 132,164,132,174,233,242,225,231,225,238, 97,128, 48,147,239,239, - 107, 2,132,182,132,189,236,229,230,116,128, 2,114,242,229,244, - 242,239,230,236,229,120,128, 2,115,105, 4,132,211,133,124,133, - 135,133,193,229,245,110, 7,132,229,133, 8,133, 40,133, 54,133, - 63,133, 96,133,109, 97, 2,132,235,132,250,227,233,242,227,236, - 229,235,239,242,229,225,110,128, 50,111,240,225,242,229,238,235, - 239,242,229,225,110,128, 50, 15,227,105, 2,133, 15,133, 27,229, - 245,227,235,239,242,229,225,110,128, 49, 53,242,227,236,229,235, - 239,242,229,225,110,128, 50, 97,232,233,229,245,232,235,239,242, - 229,225,110,128, 49, 54,235,239,242,229,225,110,128, 49, 52,240, - 97, 2,133, 70,133, 84,238,243,233,239,243,235,239,242,229,225, - 110,128, 49,104,242,229,238,235,239,242,229,225,110,128, 50, 1, - 243,233,239,243,235,239,242,229,225,110,128, 49,103,244,233,235, - 229,245,244,235,239,242,229,225,110,128, 49,102,232,233,242,225, - 231,225,238, 97,128, 48,107,107, 2,133,141,133,165,225,244,225, - 235,225,238, 97,129, 48,203,133,153,232,225,236,230,247,233,228, - 244,104,128,255,134,232,225,232,233,116, 2,133,175,133,186,236, - 229,230,244,244,232,225,105,128,248,153,244,232,225,105,128, 14, - 77,238,101,141, 0, 57,133,224,133,233,133,243,134, 17,134, 24, - 134, 49,134, 76,134,110,134,122,134,133,134,166,134,174,134,185, - 225,242,225,226,233, 99,128, 6,105,226,229,238,231,225,236,105, - 128, 9,239,227,233,242,227,236,101,129, 36,104,133,254,233,238, - 246,229,242,243,229,243,225,238,243,243,229,242,233,102,128, 39, - 146,228,229,246, 97,128, 9,111,231,117, 2,134, 31,134, 40,234, - 225,242,225,244,105,128, 10,239,242,237,245,235,232,105,128, 10, - 111,232, 97, 2,134, 56,134, 67,227,235,225,242,225,226,233, 99, - 128, 6,105,238,231,250,232,239,117,128, 48, 41,105, 2,134, 82, - 134,100,228,229,239,231,242,225,240,232,233,227,240,225,242,229, - 110,128, 50, 40,238,230,229,242,233,239,114,128, 32,137,237,239, - 238,239,243,240,225,227,101,128,255, 25,239,236,228,243,244,249, - 236,101,128,247, 57,112, 2,134,139,134,146,225,242,229,110,128, - 36,124,229,114, 2,134,153,134,159,233,239,100,128, 36,144,243, - 233,225,110,128, 6,249,242,239,237,225,110,128, 33,120,243,245, - 240,229,242,233,239,114,128, 32,121,116, 2,134,191,134,229,229, - 229,110, 2,134,199,134,208,227,233,242,227,236,101,128, 36,114, - 112, 2,134,214,134,221,225,242,229,110,128, 36,134,229,242,233, - 239,100,128, 36,154,232,225,105,128, 14, 89,106,129, 1,204,134, - 241,229,227,249,242,233,236,236,233, 99,128, 4, 90,235,225,244, - 225,235,225,238, 97,129, 48,243,135, 10,232,225,236,230,247,233, - 228,244,104,128,255,157,108, 2,135, 28,135, 42,229,231,242,233, - 231,232,244,236,239,238,103,128, 1,158,233,238,229,226,229,236, - 239,119,128, 30, 73,109, 2,135, 59,135, 70,239,238,239,243,240, - 225,227,101,128,255, 78,243,241,245,225,242,101,128, 51,154,110, - 2,135, 85,135,135, 97, 3,135, 93,135,103,135,110,226,229,238, - 231,225,236,105,128, 9,163,228,229,246, 97,128, 9, 35,231,117, - 2,135,117,135,126,234,225,242,225,244,105,128, 10,163,242,237, - 245,235,232,105,128, 10, 35,238,225,228,229,246, 97,128, 9, 41, - 111, 6,135,158,135,169,135,194,135,235,136,187,137,114,232,233, - 242,225,231,225,238, 97,128, 48,110,235,225,244,225,235,225,238, - 97,129, 48,206,135,182,232,225,236,230,247,233,228,244,104,128, - 255,137,110, 3,135,202,135,218,135,227,226,242,229,225,235,233, - 238,231,243,240,225,227,101,128, 0,160,229,238,244,232,225,105, - 128, 14, 19,245,244,232,225,105,128, 14, 25,239,110, 7,135,252, - 136, 5,136, 19,136, 53,136, 69,136,110,136,169,225,242,225,226, - 233, 99,128, 6, 70,230,233,238,225,236,225,242,225,226,233, 99, - 128,254,230,231,232,245,238,238, 97, 2,136, 30,136, 39,225,242, - 225,226,233, 99,128, 6,186,230,233,238,225,236,225,242,225,226, - 233, 99,128,251,159,233,238,233,244,233,225,236,225,242,225,226, - 233, 99,128,254,231,234,229,229,237,105, 2,136, 79,136, 94,238, - 233,244,233,225,236,225,242,225,226,233, 99,128,252,210,243,239, - 236,225,244,229,228,225,242,225,226,233, 99,128,252, 75,237,101, - 2,136,117,136,130,228,233,225,236,225,242,225,226,233, 99,128, - 254,232,229,237,105, 2,136,138,136,153,238,233,244,233,225,236, - 225,242,225,226,233, 99,128,252,213,243,239,236,225,244,229,228, - 225,242,225,226,233, 99,128,252, 78,238,239,239,238,230,233,238, - 225,236,225,242,225,226,233, 99,128,252,141,116, 7,136,203,136, - 214,136,243,137, 22,137, 34,137, 54,137, 80,227,239,238,244,225, - 233,238,115,128, 34, 12,101, 2,136,220,136,236,236,229,237,229, - 238,116,129, 34, 9,136,231,239,102,128, 34, 9,241,245,225,108, - 128, 34, 96,231,242,229,225,244,229,114,129, 34,111,136,255,238, - 239,114, 2,137, 7,137, 15,229,241,245,225,108,128, 34,113,236, - 229,243,115,128, 34,121,233,228,229,238,244,233,227,225,108,128, - 34, 98,236,229,243,115,129, 34,110,137, 43,238,239,242,229,241, - 245,225,108,128, 34,112,112, 2,137, 60,137, 70,225,242,225,236, - 236,229,108,128, 34, 38,242,229,227,229,228,229,115,128, 34,128, - 243,117, 3,137, 89,137, 96,137,105,226,243,229,116,128, 34,132, - 227,227,229,229,228,115,128, 34,129,240,229,242,243,229,116,128, - 34,133,247,225,242,237,229,238,233,225,110,128, 5,118,240,225, - 242,229,110,128, 36,169,115, 2,137,140,137,149,243,241,245,225, - 242,101,128, 51,177,245,240,229,242,233,239,114,128, 32,127,244, - 233,236,228,101,128, 0,241,117,132, 3,189,137,179,137,190,138, - 15,138, 98,232,233,242,225,231,225,238, 97,128, 48,108,107, 2, - 137,196,137,220,225,244,225,235,225,238, 97,129, 48,204,137,208, - 232,225,236,230,247,233,228,244,104,128,255,135,244, 97, 3,137, - 229,137,239,137,246,226,229,238,231,225,236,105,128, 9,188,228, - 229,246, 97,128, 9, 60,231,117, 2,137,253,138, 6,234,225,242, - 225,244,105,128, 10,188,242,237,245,235,232,105,128, 10, 60,109, - 2,138, 21,138, 55,226,229,242,243,233,231,110,130, 0, 35,138, - 35,138, 47,237,239,238,239,243,240,225,227,101,128,255, 3,243, - 237,225,236,108,128,254, 95,229,114, 2,138, 62,138, 94,225,236, - 243,233,231,110, 2,138, 73,138, 81,231,242,229,229,107,128, 3, - 116,236,239,247,229,242,231,242,229,229,107,128, 3,117,111,128, - 33, 22,110,130, 5,224,138,106,138,126,228,225,231,229,243,104, - 129,251, 64,138,117,232,229,226,242,229,119,128,251, 64,232,229, - 226,242,229,119,128, 5,224,246,243,241,245,225,242,101,128, 51, - 181,247,243,241,245,225,242,101,128, 51,187,249, 97, 3,138,164, - 138,174,138,181,226,229,238,231,225,236,105,128, 9,158,228,229, - 246, 97,128, 9, 30,231,117, 2,138,188,138,197,234,225,242,225, - 244,105,128, 10,158,242,237,245,235,232,105,128, 10, 30,111,147, - 0,111,138,248,139, 14,139, 92,140, 6,140, 78,140, 93,140,133, - 141, 0,141, 21,141, 59,141, 70,141,248,143, 82,143,146,143,179, - 143,225,144, 98,144,145,144,157, 97, 2,138,254,139, 5,227,245, - 244,101,128, 0,243,238,231,244,232,225,105,128, 14, 45, 98, 4, - 139, 24,139, 66,139, 75,139, 85,225,242,242,229,100,130, 2,117, - 139, 36,139, 47,227,249,242,233,236,236,233, 99,128, 4,233,228, + 169,236,244,239,238,229,225,242,225,226,233, 99,128, 6,193,226, + 229,238,231,225,236,105,128, 9,185,228,101, 2, 99, 32, 99, 50, + 243,227,229,238,228,229,242,227,249,242,233,236,236,233, 99,128, + 4,179,246, 97,128, 9, 57,231,117, 2, 99, 62, 99, 71,234,225, + 242,225,244,105,128, 10,185,242,237,245,235,232,105,128, 10, 57, + 104, 4, 99, 90, 99, 99, 99,113, 99,143,225,242,225,226,233, 99, + 128, 6, 45,230,233,238,225,236,225,242,225,226,233, 99,128,254, + 162,105, 2, 99,119, 99,134,238,233,244,233,225,236,225,242,225, + 226,233, 99,128,254,163,242,225,231,225,238, 97,128, 48,111,237, + 229,228,233,225,236,225,242,225,226,233, 99,128,254,164,233,244, + 245,243,241,245,225,242,101,128, 51, 42,235,225,244,225,235,225, + 238, 97,129, 48,207, 99,183,232,225,236,230,247,233,228,244,104, + 128,255,138,236,225,238,244,231,245,242,237,245,235,232,105,128, + 10, 77,237,250, 97, 2, 99,218, 99,227,225,242,225,226,233, 99, + 128, 6, 33,236,239,247,225,242,225,226,233, 99,128, 6, 33,238, + 231,245,236,230,233,236,236,229,114,128, 49,100,114, 2,100, 2, + 100, 18,228,243,233,231,238,227,249,242,233,236,236,233, 99,128, + 4, 74,240,239,239,110, 2,100, 27,100, 40,236,229,230,244,226, + 225,242,226,245,112,128, 33,188,242,233,231,232,244,226,225,242, + 226,245,112,128, 33,192,243,241,245,225,242,101,128, 51,202,244, + 225,102, 3,100, 73,100,165,101, 0,240,225,244,225,104,134, 5, + 178,100, 93,100, 98,100,112,100,121,100,136,100,152,177, 54,128, + 5,178, 50, 2,100,104,100,108, 51,128, 5,178,102,128, 5,178, + 232,229,226,242,229,119,128, 5,178,238,225,242,242,239,247,232, + 229,226,242,229,119,128, 5,178,241,245,225,242,244,229,242,232, + 229,226,242,229,119,128, 5,178,247,233,228,229,232,229,226,242, + 229,119,128, 5,178,241,225,237,225,244,115,135, 5,179,100,188, + 100,193,100,198,100,203,100,212,100,227,100,243,177, 98,128, 5, + 179,178, 56,128, 5,179,179, 52,128, 5,179,232,229,226,242,229, + 119,128, 5,179,238,225,242,242,239,247,232,229,226,242,229,119, + 128, 5,179,241,245,225,242,244,229,242,232,229,226,242,229,119, + 128, 5,179,247,233,228,229,232,229,226,242,229,119,128, 5,179, + 243,229,231,239,108,135, 5,177,101, 22,101, 27,101, 32,101, 37, + 101, 46,101, 61,101, 77,177, 55,128, 5,177,178, 52,128, 5,177, + 179, 48,128, 5,177,232,229,226,242,229,119,128, 5,177,238,225, + 242,242,239,247,232,229,226,242,229,119,128, 5,177,241,245,225, + 242,244,229,242,232,229,226,242,229,119,128, 5,177,247,233,228, + 229,232,229,226,242,229,119,128, 5,177, 98, 3,101, 98,101,103, + 101,113,225,114,128, 1, 39,239,240,239,237,239,230,111,128, 49, + 15,242,229,246,229,226,229,236,239,119,128, 30, 43, 99, 2,101, + 131,101,140,229,228,233,236,236, 97,128, 30, 41,233,242, 99, 2, + 101,148,101,153,236,101,128, 36,215,245,237,230,236,229,120,128, + 1, 37,100, 2,101,168,101,178,233,229,242,229,243,233,115,128, + 30, 39,239,116, 2,101,185,101,194,225,227,227,229,238,116,128, + 30, 35,226,229,236,239,119,128, 30, 37,101,136, 5,212,101,222, + 101,255,102, 19,102,248,103, 8,103, 53,103, 62,103, 75,225,242, + 116,129, 38,101,101,230,243,245,233,116, 2,101,239,101,247,226, + 236,225,227,107,128, 38,101,247,232,233,244,101,128, 38, 97,228, + 225,231,229,243,104,129,251, 52,102, 10,232,229,226,242,229,119, + 128,251, 52,104, 6,102, 33,102, 61,102, 69,102,119,102,165,102, + 214, 97, 2,102, 39,102, 53,236,244,239,238,229,225,242,225,226, + 233, 99,128, 6,193,242,225,226,233, 99,128, 6, 71,229,226,242, + 229,119,128, 5,212,230,233,238,225,236, 97, 2,102, 80,102,111, + 236,116, 2,102, 87,102, 99,239,238,229,225,242,225,226,233, 99, + 128,251,167,244,247,239,225,242,225,226,233, 99,128,254,234,242, + 225,226,233, 99,128,254,234,232,225,237,250,225,225,226,239,246, + 101, 2,102,134,102,148,230,233,238,225,236,225,242,225,226,233, + 99,128,251,165,233,243,239,236,225,244,229,228,225,242,225,226, + 233, 99,128,251,164,105, 2,102,171,102,205,238,233,244,233,225, + 236, 97, 2,102,183,102,197,236,244,239,238,229,225,242,225,226, + 233, 99,128,251,168,242,225,226,233, 99,128,254,235,242,225,231, + 225,238, 97,128, 48,120,237,229,228,233,225,236, 97, 2,102,226, + 102,240,236,244,239,238,229,225,242,225,226,233, 99,128,251,169, + 242,225,226,233, 99,128,254,236,233,243,229,233,229,242,225,243, + 241,245,225,242,101,128, 51,123,107, 2,103, 14,103, 38,225,244, + 225,235,225,238, 97,129, 48,216,103, 26,232,225,236,230,247,233, + 228,244,104,128,255,141,245,244,225,225,242,245,243,241,245,225, + 242,101,128, 51, 54,238,231,232,239,239,107,128, 2,103,242,245, + 244,245,243,241,245,225,242,101,128, 51, 57,116,129, 5,215,103, + 81,232,229,226,242,229,119,128, 5,215,232,239,239,107,129, 2, + 102,103, 99,243,245,240,229,242,233,239,114,128, 2,177,105, 4, + 103,120,103,205,103,216,103,241,229,245,104, 4,103,132,103,167, + 103,182,103,191, 97, 2,103,138,103,153,227,233,242,227,236,229, + 235,239,242,229,225,110,128, 50,123,240,225,242,229,238,235,239, + 242,229,225,110,128, 50, 27,227,233,242,227,236,229,235,239,242, + 229,225,110,128, 50,109,235,239,242,229,225,110,128, 49, 78,240, + 225,242,229,238,235,239,242,229,225,110,128, 50, 13,232,233,242, + 225,231,225,238, 97,128, 48,114,235,225,244,225,235,225,238, 97, + 129, 48,210,103,229,232,225,236,230,247,233,228,244,104,128,255, + 139,242,233,113,134, 5,180,104, 3,104, 8,104, 22,104, 31,104, + 46,104, 62,177, 52,128, 5,180, 50, 2,104, 14,104, 18, 49,128, + 5,180,100,128, 5,180,232,229,226,242,229,119,128, 5,180,238, + 225,242,242,239,247,232,229,226,242,229,119,128, 5,180,241,245, + 225,242,244,229,242,232,229,226,242,229,119,128, 5,180,247,233, + 228,229,232,229,226,242,229,119,128, 5,180,236,233,238,229,226, + 229,236,239,119,128, 30,150,237,239,238,239,243,240,225,227,101, + 128,255, 72,111, 9,104,119,104,130,104,154,104,179,105, 11,105, + 24,105,110,105,150,105,161,225,242,237,229,238,233,225,110,128, + 5,112,232,105, 2,104,137,104,145,240,244,232,225,105,128, 14, + 43,242,225,231,225,238, 97,128, 48,123,235,225,244,225,235,225, + 238, 97,129, 48,219,104,167,232,225,236,230,247,233,228,244,104, + 128,255,142,236,225,109,135, 5,185,104,199,104,204,104,209,104, + 214,104,223,104,238,104,254,177, 57,128, 5,185,178, 54,128, 5, + 185,179, 50,128, 5,185,232,229,226,242,229,119,128, 5,185,238, + 225,242,242,239,247,232,229,226,242,229,119,128, 5,185,241,245, + 225,242,244,229,242,232,229,226,242,229,119,128, 5,185,247,233, + 228,229,232,229,226,242,229,119,128, 5,185,238,239,235,232,245, + 235,244,232,225,105,128, 14, 46,111, 2,105, 30,105,100,107, 4, + 105, 40,105, 52,105, 58,105, 80,225,226,239,246,229,227,239,237, + 98,128, 3, 9,227,237, 98,128, 3, 9,240,225,236,225,244,225, + 236,233,250,229,228,226,229,236,239,247,227,237, 98,128, 3, 33, + 242,229,244,242,239,230,236,229,248,226,229,236,239,247,227,237, + 98,128, 3, 34,238,243,241,245,225,242,101,128, 51, 66,114, 2, + 105,116,105,143,105, 2,105,122,105,131,227,239,240,244,233, 99, + 128, 3,233,250,239,238,244,225,236,226,225,114,128, 32, 21,238, + 227,237, 98,128, 3, 27,244,243,240,242,233,238,231,115,128, 38, + 104,245,243,101,128, 35, 2,240,225,242,229,110,128, 36,163,243, + 245,240,229,242,233,239,114,128, 2,176,244,245,242,238,229,100, + 128, 2,101,117, 4,105,205,105,216,105,229,105,254,232,233,242, + 225,231,225,238, 97,128, 48,117,233,233,244,239,243,241,245,225, + 242,101,128, 51, 51,235,225,244,225,235,225,238, 97,129, 48,213, + 105,242,232,225,236,230,247,233,228,244,104,128,255,140,238,231, + 225,242,245,237,236,225,245,116,129, 2,221,106, 13,227,237, 98, + 128, 3, 11,118,128, 1,149,249,240,232,229,110,132, 0, 45,106, + 39,106, 50,106, 62,106, 85,233,238,230,229,242,233,239,114,128, + 246,229,237,239,238,239,243,240,225,227,101,128,255, 13,115, 2, + 106, 68,106, 75,237,225,236,108,128,254, 99,245,240,229,242,233, + 239,114,128,246,230,244,247,111,128, 32, 16,105,149, 0,105,106, + 137,106,160,106,194,106,241,110,123,110,243,111, 24,111, 51,111, + 213,111,217,111,255,112, 21,112,105,113, 14,113, 89,113, 97,113, + 110,113,197,113,254,114, 26,114, 70,225, 99, 2,106,144,106,150, + 245,244,101,128, 0,237,249,242,233,236,236,233, 99,128, 4, 79, + 98, 3,106,168,106,177,106,187,229,238,231,225,236,105,128, 9, + 135,239,240,239,237,239,230,111,128, 49, 39,242,229,246,101,128, + 1, 45, 99, 3,106,202,106,209,106,231,225,242,239,110,128, 1, + 208,233,242, 99, 2,106,217,106,222,236,101,128, 36,216,245,237, + 230,236,229,120,128, 0,238,249,242,233,236,236,233, 99,128, 4, + 86,100, 4,106,251,107, 5,110, 80,110,113,226,236,231,242,225, + 246,101,128, 2, 9,101, 2,107, 11,110, 75,239,231,242,225,240, + 104, 7,107, 32,107, 46,107, 59,109,244,110, 19,110, 32,110, 44, + 229,225,242,244,232,227,233,242,227,236,101,128, 50,143,230,233, + 242,229,227,233,242,227,236,101,128, 50,139,233, 99, 14,107, 90, + 107,106,107,205,108, 3,108, 69,108, 98,108,114,108,171,108,220, + 108,232,109, 3,109, 70,109,208,109,237,225,236,236,233,225,238, + 227,229,240,225,242,229,110,128, 50, 63, 99, 4,107,116,107,127, + 107,141,107,148,225,236,236,240,225,242,229,110,128, 50, 58,229, + 238,244,242,229,227,233,242,227,236,101,128, 50,165,236,239,243, + 101,128, 48, 6,111, 3,107,156,107,171,107,191,237,237, 97,129, + 48, 1,107,164,236,229,230,116,128,255,100,238,231,242,225,244, + 245,236,225,244,233,239,238,240,225,242,229,110,128, 50, 55,242, + 242,229,227,244,227,233,242,227,236,101,128, 50,163,101, 3,107, + 213,107,225,107,242,225,242,244,232,240,225,242,229,110,128, 50, + 47,238,244,229,242,240,242,233,243,229,240,225,242,229,110,128, + 50, 61,248,227,229,236,236,229,238,244,227,233,242,227,236,101, + 128, 50,157,102, 2,108, 9,108, 24,229,243,244,233,246,225,236, + 240,225,242,229,110,128, 50, 64,105, 2,108, 30,108, 59,238,225, + 238,227,233,225,108, 2,108, 42,108, 51,227,233,242,227,236,101, + 128, 50,150,240,225,242,229,110,128, 50, 54,242,229,240,225,242, + 229,110,128, 50, 43,104, 2,108, 75,108, 86,225,246,229,240,225, + 242,229,110,128, 50, 50,233,231,232,227,233,242,227,236,101,128, + 50,164,233,244,229,242,225,244,233,239,238,237,225,242,107,128, + 48, 5,108, 3,108,122,108,148,108,160,225,226,239,114, 2,108, + 131,108,140,227,233,242,227,236,101,128, 50,152,240,225,242,229, + 110,128, 50, 56,229,230,244,227,233,242,227,236,101,128, 50,167, + 239,247,227,233,242,227,236,101,128, 50,166,109, 2,108,177,108, + 209,101, 2,108,183,108,198,228,233,227,233,238,229,227,233,242, + 227,236,101,128, 50,169,244,225,236,240,225,242,229,110,128, 50, + 46,239,239,238,240,225,242,229,110,128, 50, 42,238,225,237,229, + 240,225,242,229,110,128, 50, 52,112, 2,108,238,108,246,229,242, + 233,239,100,128, 48, 2,242,233,238,244,227,233,242,227,236,101, + 128, 50,158,114, 2,109, 9,109, 57,101, 3,109, 17,109, 28,109, + 43,225,227,232,240,225,242,229,110,128, 50, 67,240,242,229,243, + 229,238,244,240,225,242,229,110,128, 50, 57,243,239,245,242,227, + 229,240,225,242,229,110,128, 50, 62,233,231,232,244,227,233,242, + 227,236,101,128, 50,168,115, 5,109, 82,109,111,109,125,109,150, + 109,178,101, 2,109, 88,109,101,227,242,229,244,227,233,242,227, + 236,101,128, 50,153,236,230,240,225,242,229,110,128, 50, 66,239, + 227,233,229,244,249,240,225,242,229,110,128, 50, 51,112, 2,109, + 131,109,137,225,227,101,128, 48, 0,229,227,233,225,236,240,225, + 242,229,110,128, 50, 53,116, 2,109,156,109,167,239,227,235,240, + 225,242,229,110,128, 50, 49,245,228,249,240,225,242,229,110,128, + 50, 59,117, 2,109,184,109,193,238,240,225,242,229,110,128, 50, + 48,240,229,242,246,233,243,229,240,225,242,229,110,128, 50, 60, + 119, 2,109,214,109,226,225,244,229,242,240,225,242,229,110,128, + 50, 44,239,239,228,240,225,242,229,110,128, 50, 45,250,229,242, + 111,128, 48, 7,109, 2,109,250,110, 7,229,244,225,236,227,233, + 242,227,236,101,128, 50,142,239,239,238,227,233,242,227,236,101, + 128, 50,138,238,225,237,229,227,233,242,227,236,101,128, 50,148, + 243,245,238,227,233,242,227,236,101,128, 50,144,119, 2,110, 50, + 110, 63,225,244,229,242,227,233,242,227,236,101,128, 50,140,239, + 239,228,227,233,242,227,236,101,128, 50,141,246, 97,128, 9, 7, + 233,229,242,229,243,233,115,130, 0,239,110, 94,110,102,225,227, + 245,244,101,128, 30, 47,227,249,242,233,236,236,233, 99,128, 4, + 229,239,244,226,229,236,239,119,128, 30,203,101, 3,110,131,110, + 147,110,158,226,242,229,246,229,227,249,242,233,236,236,233, 99, + 128, 4,215,227,249,242,233,236,236,233, 99,128, 4, 53,245,238, + 103, 4,110,170,110,205,110,220,110,229, 97, 2,110,176,110,191, + 227,233,242,227,236,229,235,239,242,229,225,110,128, 50,117,240, + 225,242,229,238,235,239,242,229,225,110,128, 50, 21,227,233,242, + 227,236,229,235,239,242,229,225,110,128, 50,103,235,239,242,229, + 225,110,128, 49, 71,240,225,242,229,238,235,239,242,229,225,110, + 128, 50, 7,103, 2,110,249,111, 0,242,225,246,101,128, 0,236, + 117, 2,111, 6,111, 15,234,225,242,225,244,105,128, 10,135,242, + 237,245,235,232,105,128, 10, 7,104, 2,111, 30,111, 40,233,242, + 225,231,225,238, 97,128, 48, 68,239,239,235,225,226,239,246,101, + 128, 30,201,105, 8,111, 69,111, 79,111, 90,111, 97,111,122,111, + 138,111,153,111,169,226,229,238,231,225,236,105,128, 9,136,227, + 249,242,233,236,236,233, 99,128, 4, 56,228,229,246, 97,128, 9, + 8,231,117, 2,111,104,111,113,234,225,242,225,244,105,128, 10, + 136,242,237,245,235,232,105,128, 10, 8,237,225,244,242,225,231, + 245,242,237,245,235,232,105,128, 10, 64,238,246,229,242,244,229, + 228,226,242,229,246,101,128, 2, 11,243,232,239,242,244,227,249, + 242,233,236,236,233, 99,128, 4, 57,246,239,247,229,236,243,233, + 231,110, 3,111,185,111,195,111,202,226,229,238,231,225,236,105, + 128, 9,192,228,229,246, 97,128, 9, 64,231,245,234,225,242,225, + 244,105,128, 10,192,106,128, 1, 51,107, 2,111,223,111,247,225, + 244,225,235,225,238, 97,129, 48,164,111,235,232,225,236,230,247, + 233,228,244,104,128,255,114,239,242,229,225,110,128, 49, 99,108, + 2,112, 5,112, 10,228,101,128, 2,220,245,249,232,229,226,242, + 229,119,128, 5,172,109, 2,112, 27,112, 94, 97, 3,112, 35,112, + 55,112, 80,227,242,239,110,129, 1, 43,112, 44,227,249,242,233, + 236,236,233, 99,128, 4,227,231,229,239,242,225,240,240,242,239, + 248,233,237,225,244,229,236,249,229,241,245,225,108,128, 34, 83, + 244,242,225,231,245,242,237,245,235,232,105,128, 10, 63,239,238, + 239,243,240,225,227,101,128,255, 73,110, 5,112,117,112,127,112, + 136,112,148,112,232,227,242,229,237,229,238,116,128, 34, 6,230, + 233,238,233,244,121,128, 34, 30,233,225,242,237,229,238,233,225, + 110,128, 5,107,116, 2,112,154,112,222,101, 2,112,160,112,211, + 231,242,225,108,131, 34, 43,112,173,112,191,112,196, 98, 2,112, + 179,112,187,239,244,244,239,109,128, 35, 33,116,128, 35, 33,229, + 120,128,248,245,116, 2,112,202,112,207,239,112,128, 35, 32,112, + 128, 35, 32,242,243,229,227,244,233,239,110,128, 34, 41,233,243, + 241,245,225,242,101,128, 51, 5,118, 3,112,240,112,249,113, 2, + 226,245,236,236,229,116,128, 37,216,227,233,242,227,236,101,128, + 37,217,243,237,233,236,229,230,225,227,101,128, 38, 59,111, 3, + 113, 22,113, 33,113, 41,227,249,242,233,236,236,233, 99,128, 4, + 81,231,239,238,229,107,128, 1, 47,244, 97,131, 3,185,113, 52, + 113, 73,113, 81,228,233,229,242,229,243,233,115,129, 3,202,113, + 65,244,239,238,239,115,128, 3,144,236,225,244,233,110,128, 2, + 105,244,239,238,239,115,128, 3,175,240,225,242,229,110,128, 36, + 164,242,233,231,245,242,237,245,235,232,105,128, 10,114,115, 4, + 113,120,113,165,113,179,113,187,237,225,236,108, 2,113,129,113, + 140,232,233,242,225,231,225,238, 97,128, 48, 67,235,225,244,225, + 235,225,238, 97,129, 48,163,113,153,232,225,236,230,247,233,228, + 244,104,128,255,104,243,232,225,242,226,229,238,231,225,236,105, + 128, 9,250,244,242,239,235,101,128, 2,104,245,240,229,242,233, + 239,114,128,246,237,116, 2,113,203,113,237,229,242,225,244,233, + 239,110, 2,113,215,113,226,232,233,242,225,231,225,238, 97,128, + 48,157,235,225,244,225,235,225,238, 97,128, 48,253,233,236,228, + 101,129, 1, 41,113,246,226,229,236,239,119,128, 30, 45,117, 2, + 114, 4,114, 15,226,239,240,239,237,239,230,111,128, 49, 41,227, + 249,242,233,236,236,233, 99,128, 4, 78,246,239,247,229,236,243, + 233,231,110, 3,114, 42,114, 52,114, 59,226,229,238,231,225,236, + 105,128, 9,191,228,229,246, 97,128, 9, 63,231,245,234,225,242, + 225,244,105,128, 10,191,250,232,233,244,243, 97, 2,114, 81,114, + 92,227,249,242,233,236,236,233, 99,128, 4,117,228,226,236,231, + 242,225,246,229,227,249,242,233,236,236,233, 99,128, 4,119,106, + 138, 0,106,114,135,114,198,114,209,115, 3,115, 19,115,132,115, + 201,115,206,115,218,115,226, 97, 4,114,145,114,156,114,166,114, + 173,225,242,237,229,238,233,225,110,128, 5,113,226,229,238,231, + 225,236,105,128, 9,156,228,229,246, 97,128, 9, 28,231,117, 2, + 114,180,114,189,234,225,242,225,244,105,128, 10,156,242,237,245, + 235,232,105,128, 10, 28,226,239,240,239,237,239,230,111,128, 49, + 16, 99, 3,114,217,114,224,114,246,225,242,239,110,128, 1,240, + 233,242, 99, 2,114,232,114,237,236,101,128, 36,217,245,237,230, + 236,229,120,128, 1, 53,242,239,243,243,229,228,244,225,233,108, + 128, 2,157,228,239,244,236,229,243,243,243,244,242,239,235,101, + 128, 2, 95,101, 3,115, 27,115, 38,115,103,227,249,242,233,236, + 236,233, 99,128, 4, 88,229,109, 4,115, 49,115, 58,115, 72,115, + 88,225,242,225,226,233, 99,128, 6, 44,230,233,238,225,236,225, + 242,225,226,233, 99,128,254,158,233,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,254,159,237,229,228,233,225,236,225,242, + 225,226,233, 99,128,254,160,104, 2,115,109,115,118,225,242,225, + 226,233, 99,128, 6,152,230,233,238,225,236,225,242,225,226,233, + 99,128,251,139,104, 2,115,138,115,188, 97, 3,115,146,115,156, + 115,163,226,229,238,231,225,236,105,128, 9,157,228,229,246, 97, + 128, 9, 29,231,117, 2,115,170,115,179,234,225,242,225,244,105, + 128, 10,157,242,237,245,235,232,105,128, 10, 29,229,232,225,242, + 237,229,238,233,225,110,128, 5,123,233,115,128, 48, 4,237,239, + 238,239,243,240,225,227,101,128,255, 74,240,225,242,229,110,128, + 36,165,243,245,240,229,242,233,239,114,128, 2,178,107,146, 0, + 107,116, 21,118,110,118,121,118,183,118,194,119, 28,119, 42,120, + 150,121, 90,121,103,121,129,121,178,122, 60,122, 82,122, 95,122, + 118,122,160,122,170, 97, 12,116, 47,116, 79,116,101,116,131,116, + 245,117, 14,117, 44,117, 69,117,175,117,189,118, 56,118, 85, 98, + 2,116, 53,116, 70,225,243,232,235,233,242,227,249,242,233,236, + 236,233, 99,128, 4,161,229,238,231,225,236,105,128, 9,149, 99, + 2,116, 85,116, 91,245,244,101,128, 30, 49,249,242,233,236,236, + 233, 99,128, 4, 58,228,101, 2,116,108,116,126,243,227,229,238, + 228,229,242,227,249,242,233,236,236,233, 99,128, 4,155,246, 97, + 128, 9, 21,102,135, 5,219,116,149,116,158,116,178,116,192,116, + 201,116,217,116,232,225,242,225,226,233, 99,128, 6, 67,228,225, + 231,229,243,104,129,251, 59,116,169,232,229,226,242,229,119,128, + 251, 59,230,233,238,225,236,225,242,225,226,233, 99,128,254,218, + 232,229,226,242,229,119,128, 5,219,233,238,233,244,233,225,236, + 225,242,225,226,233, 99,128,254,219,237,229,228,233,225,236,225, + 242,225,226,233, 99,128,254,220,242,225,230,229,232,229,226,242, + 229,119,128,251, 77,231,117, 2,116,252,117, 5,234,225,242,225, + 244,105,128, 10,149,242,237,245,235,232,105,128, 10, 21,104, 2, + 117, 20,117, 30,233,242,225,231,225,238, 97,128, 48, 75,239,239, + 235,227,249,242,233,236,236,233, 99,128, 4,196,235,225,244,225, + 235,225,238, 97,129, 48,171,117, 57,232,225,236,230,247,233,228, + 244,104,128,255,118,112, 2,117, 75,117, 96,240, 97,129, 3,186, + 117, 82,243,249,237,226,239,236,231,242,229,229,107,128, 3,240, + 249,229,239,245,110, 3,117,108,117,122,117,156,237,233,229,245, + 237,235,239,242,229,225,110,128, 49,113,112, 2,117,128,117,143, + 232,233,229,245,240,232,235,239,242,229,225,110,128, 49,132,233, + 229,245,240,235,239,242,229,225,110,128, 49,120,243,243,225,238, + 231,240,233,229,245,240,235,239,242,229,225,110,128, 49,121,242, + 239,242,233,233,243,241,245,225,242,101,128, 51, 13,115, 5,117, + 201,117,245,118, 4,118, 12,118, 40,232,233,228,225,225,245,244, + 111, 2,117,214,117,223,225,242,225,226,233, 99,128, 6, 64,238, + 239,243,233,228,229,226,229,225,242,233,238,231,225,242,225,226, + 233, 99,128, 6, 64,237,225,236,236,235,225,244,225,235,225,238, + 97,128, 48,245,241,245,225,242,101,128, 51,132,242, 97, 2,118, + 19,118, 28,225,242,225,226,233, 99,128, 6, 80,244,225,238,225, + 242,225,226,233, 99,128, 6, 77,244,242,239,235,229,227,249,242, + 233,236,236,233, 99,128, 4,159,244,225,232,233,242,225,240,242, + 239,236,239,238,231,237,225,242,235,232,225,236,230,247,233,228, + 244,104,128,255,112,246,229,242,244,233,227,225,236,243,244,242, + 239,235,229,227,249,242,233,236,236,233, 99,128, 4,157,226,239, + 240,239,237,239,230,111,128, 49, 14, 99, 4,118,131,118,153,118, + 162,118,170, 97, 2,118,137,118,147,236,243,241,245,225,242,101, + 128, 51,137,242,239,110,128, 1,233,229,228,233,236,236, 97,128, + 1, 55,233,242,227,236,101,128, 36,218,239,237,237,225,225,227, + 227,229,238,116,128, 1, 55,228,239,244,226,229,236,239,119,128, + 30, 51,101, 4,118,204,118,231,119, 0,119, 12,104, 2,118,210, + 118,221,225,242,237,229,238,233,225,110,128, 5,132,233,242,225, + 231,225,238, 97,128, 48, 81,235,225,244,225,235,225,238, 97,129, + 48,177,118,244,232,225,236,230,247,233,228,244,104,128,255,121, + 238,225,242,237,229,238,233,225,110,128, 5,111,243,237,225,236, + 236,235,225,244,225,235,225,238, 97,128, 48,246,231,242,229,229, + 238,236,225,238,228,233, 99,128, 1, 56,104, 6,119, 56,119,185, + 119,196,119,221,120, 52,120,140, 97, 5,119, 68,119, 78,119, 89, + 119, 96,119,121,226,229,238,231,225,236,105,128, 9,150,227,249, + 242,233,236,236,233, 99,128, 4, 69,228,229,246, 97,128, 9, 22, + 231,117, 2,119,103,119,112,234,225,242,225,244,105,128, 10,150, + 242,237,245,235,232,105,128, 10, 22,104, 4,119,131,119,140,119, + 154,119,170,225,242,225,226,233, 99,128, 6, 46,230,233,238,225, + 236,225,242,225,226,233, 99,128,254,166,233,238,233,244,233,225, + 236,225,242,225,226,233, 99,128,254,167,237,229,228,233,225,236, + 225,242,225,226,233, 99,128,254,168,229,233,227,239,240,244,233, + 99,128, 3,231,232, 97, 2,119,203,119,210,228,229,246, 97,128, + 9, 89,231,245,242,237,245,235,232,105,128, 10, 89,233,229,245, + 235,104, 4,119,235,120, 14,120, 29,120, 38, 97, 2,119,241,120, + 0,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,120, + 240,225,242,229,238,235,239,242,229,225,110,128, 50, 24,227,233, + 242,227,236,229,235,239,242,229,225,110,128, 50,106,235,239,242, + 229,225,110,128, 49, 75,240,225,242,229,238,235,239,242,229,225, + 110,128, 50, 10,111, 4,120, 62,120,111,120,121,120,126,235,104, + 4,120, 73,120, 82,120, 91,120,101,225,233,244,232,225,105,128, + 14, 2,239,238,244,232,225,105,128, 14, 5,245,225,244,244,232, + 225,105,128, 14, 3,247,225,233,244,232,225,105,128, 14, 4,237, + 245,244,244,232,225,105,128, 14, 91,239,107,128, 1,153,242,225, + 235,232,225,238,231,244,232,225,105,128, 14, 6,250,243,241,245, + 225,242,101,128, 51,145,105, 4,120,160,120,171,120,196,120,245, + 232,233,242,225,231,225,238, 97,128, 48, 77,235,225,244,225,235, + 225,238, 97,129, 48,173,120,184,232,225,236,230,247,233,228,244, + 104,128,255,119,242,111, 3,120,205,120,220,120,236,231,245,242, + 225,237,245,243,241,245,225,242,101,128, 51, 21,237,229,229,244, + 239,242,245,243,241,245,225,242,101,128, 51, 22,243,241,245,225, + 242,101,128, 51, 20,249,229,239,107, 5,121, 4,121, 39,121, 54, + 121, 63,121, 77, 97, 2,121, 10,121, 25,227,233,242,227,236,229, + 235,239,242,229,225,110,128, 50,110,240,225,242,229,238,235,239, + 242,229,225,110,128, 50, 14,227,233,242,227,236,229,235,239,242, + 229,225,110,128, 50, 96,235,239,242,229,225,110,128, 49, 49,240, + 225,242,229,238,235,239,242,229,225,110,128, 50, 0,243,233,239, + 243,235,239,242,229,225,110,128, 49, 51,234,229,227,249,242,233, + 236,236,233, 99,128, 4, 92,108, 2,121,109,121,120,233,238,229, + 226,229,236,239,119,128, 30, 53,243,241,245,225,242,101,128, 51, + 152,109, 3,121,137,121,151,121,162,227,245,226,229,228,243,241, + 245,225,242,101,128, 51,166,239,238,239,243,240,225,227,101,128, + 255, 75,243,241,245,225,242,229,228,243,241,245,225,242,101,128, + 51,162,111, 5,121,190,121,216,121,254,122, 10,122, 24,104, 2, + 121,196,121,206,233,242,225,231,225,238, 97,128, 48, 83,237,243, + 241,245,225,242,101,128, 51,192,235, 97, 2,121,223,121,231,233, + 244,232,225,105,128, 14, 1,244,225,235,225,238, 97,129, 48,179, + 121,242,232,225,236,230,247,233,228,244,104,128,255,122,239,240, + 239,243,241,245,225,242,101,128, 51, 30,240,240,225,227,249,242, + 233,236,236,233, 99,128, 4,129,114, 2,122, 30,122, 50,229,225, + 238,243,244,225,238,228,225,242,228,243,249,237,226,239,108,128, + 50,127,239,238,233,243,227,237, 98,128, 3, 67,240, 97, 2,122, + 67,122, 73,242,229,110,128, 36,166,243,241,245,225,242,101,128, + 51,170,243,233,227,249,242,233,236,236,233, 99,128, 4,111,116, + 2,122,101,122,110,243,241,245,225,242,101,128, 51,207,245,242, + 238,229,100,128, 2,158,117, 2,122,124,122,135,232,233,242,225, + 231,225,238, 97,128, 48, 79,235,225,244,225,235,225,238, 97,129, + 48,175,122,148,232,225,236,230,247,233,228,244,104,128,255,120, + 246,243,241,245,225,242,101,128, 51,184,247,243,241,245,225,242, + 101,128, 51,190,108,146, 0,108,122,220,124,247,125, 20,125, 86, + 125,124,126, 20,126, 29,126, 45,126, 69,126, 87,126,205,126,246, + 127,125,127,133,127,166,127,175,127,183,127,245, 97, 7,122,236, + 122,246,122,253,123, 4,123, 29,123, 45,124,235,226,229,238,231, + 225,236,105,128, 9,178,227,245,244,101,128, 1, 58,228,229,246, + 97,128, 9, 50,231,117, 2,123, 11,123, 20,234,225,242,225,244, + 105,128, 10,178,242,237,245,235,232,105,128, 10, 50,235,235,232, + 225,238,231,249,225,239,244,232,225,105,128, 14, 69,109, 10,123, + 67,124, 6,124, 23,124, 61,124, 75,124, 94,124,110,124,130,124, + 150,124,173, 97, 2,123, 73,123,254,236,229,102, 4,123, 85,123, + 99,123,191,123,208,230,233,238,225,236,225,242,225,226,233, 99, + 128,254,252,232,225,237,250, 97, 2,123,109,123,150,225,226,239, + 246,101, 2,123,119,123,133,230,233,238,225,236,225,242,225,226, + 233, 99,128,254,248,233,243,239,236,225,244,229,228,225,242,225, + 226,233, 99,128,254,247,226,229,236,239,119, 2,123,160,123,174, + 230,233,238,225,236,225,242,225,226,233, 99,128,254,250,233,243, + 239,236,225,244,229,228,225,242,225,226,233, 99,128,254,249,233, + 243,239,236,225,244,229,228,225,242,225,226,233, 99,128,254,251, + 237,225,228,228,225,225,226,239,246,101, 2,123,223,123,237,230, + 233,238,225,236,225,242,225,226,233, 99,128,254,246,233,243,239, + 236,225,244,229,228,225,242,225,226,233, 99,128,254,245,242,225, + 226,233, 99,128, 6, 68,226,228, 97,129, 3,187,124, 14,243,244, + 242,239,235,101,128, 1,155,229,100,130, 5,220,124, 32,124, 52, + 228,225,231,229,243,104,129,251, 60,124, 43,232,229,226,242,229, + 119,128,251, 60,232,229,226,242,229,119,128, 5,220,230,233,238, + 225,236,225,242,225,226,233, 99,128,254,222,232,225,232,233,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,252,202,233,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,254,223,234,229, + 229,237,233,238,233,244,233,225,236,225,242,225,226,233, 99,128, + 252,201,235,232,225,232,233,238,233,244,233,225,236,225,242,225, + 226,233, 99,128,252,203,236,225,237,232,229,232,233,243,239,236, + 225,244,229,228,225,242,225,226,233, 99,128,253,242,237,101, 2, + 124,180,124,193,228,233,225,236,225,242,225,226,233, 99,128,254, + 224,229,109, 2,124,200,124,219,232,225,232,233,238,233,244,233, + 225,236,225,242,225,226,233, 99,128,253,136,233,238,233,244,233, + 225,236,225,242,225,226,233, 99,128,252,204,242,231,229,227,233, + 242,227,236,101,128, 37,239, 98, 3,124,255,125, 4,125, 10,225, + 114,128, 1,154,229,236,116,128, 2,108,239,240,239,237,239,230, + 111,128, 49, 12, 99, 4,125, 30,125, 37,125, 46,125, 73,225,242, + 239,110,128, 1, 62,229,228,233,236,236, 97,128, 1, 60,233,242, + 99, 2,125, 54,125, 59,236,101,128, 36,219,245,237,230,236,229, + 248,226,229,236,239,119,128, 30, 61,239,237,237,225,225,227,227, + 229,238,116,128, 1, 60,228,239,116,130, 1, 64,125, 96,125,105, + 225,227,227,229,238,116,128, 1, 64,226,229,236,239,119,129, 30, + 55,125,115,237,225,227,242,239,110,128, 30, 57,101, 3,125,132, + 125,170,126, 15,230,116, 2,125,139,125,155,225,238,231,236,229, + 225,226,239,246,229,227,237, 98,128, 3, 26,244,225,227,235,226, + 229,236,239,247,227,237, 98,128, 3, 24,243,115,132, 0, 60,125, + 183,125,205,125,217,126, 7,229,241,245,225,108,129, 34,100,125, + 193,239,242,231,242,229,225,244,229,114,128, 34,218,237,239,238, + 239,243,240,225,227,101,128,255, 28,111, 2,125,223,125,252,114, + 2,125,229,125,242,229,241,245,233,246,225,236,229,238,116,128, + 34,114,231,242,229,225,244,229,114,128, 34,118,246,229,242,229, + 241,245,225,108,128, 34,102,243,237,225,236,108,128,254,100,250, + 104,128, 2,110,230,226,236,239,227,107,128, 37,140,232,239,239, + 235,242,229,244,242,239,230,236,229,120,128, 2,109,105, 2,126, + 51,126, 56,242, 97,128, 32,164,247,238,225,242,237,229,238,233, + 225,110,128, 5,108,106,129, 1,201,126, 75,229,227,249,242,233, + 236,236,233, 99,128, 4, 89,108,132,246,192,126, 99,126,123,126, + 134,126,143, 97, 2,126,105,126,112,228,229,246, 97,128, 9, 51, + 231,245,234,225,242,225,244,105,128, 10,179,233,238,229,226,229, + 236,239,119,128, 30, 59,236,225,228,229,246, 97,128, 9, 52,246, + 239,227,225,236,233, 99, 3,126,157,126,167,126,174,226,229,238, + 231,225,236,105,128, 9,225,228,229,246, 97,128, 9, 97,246,239, + 247,229,236,243,233,231,110, 2,126,188,126,198,226,229,238,231, + 225,236,105,128, 9,227,228,229,246, 97,128, 9, 99,109, 3,126, + 213,126,226,126,237,233,228,228,236,229,244,233,236,228,101,128, + 2,107,239,238,239,243,240,225,227,101,128,255, 76,243,241,245, + 225,242,101,128, 51,208,111, 6,127, 4,127, 16,127, 58,127, 69, + 127, 75,127,117,227,232,245,236,225,244,232,225,105,128, 14, 44, + 231,233,227,225,108, 3,127, 28,127, 34,127, 53,225,238,100,128, + 34, 39,238,239,116,129, 0,172,127, 42,242,229,246,229,242,243, + 229,100,128, 35, 16,239,114,128, 34, 40,236,233,238,231,244,232, + 225,105,128, 14, 37,238,231,115,128, 1,127,247,236,233,238,101, + 2,127, 85,127,108, 99, 2,127, 91,127,103,229,238,244,229,242, + 236,233,238,101,128,254, 78,237, 98,128, 3, 50,228,225,243,232, + 229,100,128,254, 77,250,229,238,231,101,128, 37,202,240,225,242, + 229,110,128, 36,167,115, 3,127,141,127,148,127,156,236,225,243, + 104,128, 1, 66,241,245,225,242,101,128, 33, 19,245,240,229,242, + 233,239,114,128,246,238,244,243,232,225,228,101,128, 37,145,245, + 244,232,225,105,128, 14, 38,246,239,227,225,236,233, 99, 3,127, + 197,127,207,127,214,226,229,238,231,225,236,105,128, 9,140,228, + 229,246, 97,128, 9, 12,246,239,247,229,236,243,233,231,110, 2, + 127,228,127,238,226,229,238,231,225,236,105,128, 9,226,228,229, + 246, 97,128, 9, 98,248,243,241,245,225,242,101,128, 51,211,109, + 144, 0,109,128, 35,130,144,130,169,130,196,130,221,132, 18,132, + 40,133, 95,133,125,133,174,134, 25,134, 47,134, 72,134, 81,135, + 108,135,136, 97, 12,128, 61,128, 71,128,135,128,142,128,167,128, + 215,130, 51,130, 76,130, 81,130, 95,130,107,130,112,226,229,238, + 231,225,236,105,128, 9,174, 99, 2,128, 77,128,129,242,239,110, + 132, 0,175,128, 91,128,102,128,108,128,117,226,229,236,239,247, + 227,237, 98,128, 3, 49,227,237, 98,128, 3, 4,236,239,247,237, + 239,100,128, 2,205,237,239,238,239,243,240,225,227,101,128,255, + 227,245,244,101,128, 30, 63,228,229,246, 97,128, 9, 46,231,117, + 2,128,149,128,158,234,225,242,225,244,105,128, 10,174,242,237, + 245,235,232,105,128, 10, 46,104, 2,128,173,128,205,225,240,225, + 235,104, 2,128,183,128,192,232,229,226,242,229,119,128, 5,164, + 236,229,230,244,232,229,226,242,229,119,128, 5,164,233,242,225, + 231,225,238, 97,128, 48,126,105, 5,128,227,129, 40,129,103,129, + 133,130, 39,227,232,225,244,244,225,247, 97, 3,128,242,129, 17, + 129, 24,236,239,119, 2,128,250,129, 5,236,229,230,244,244,232, + 225,105,128,248,149,242,233,231,232,244,244,232,225,105,128,248, + 148,244,232,225,105,128, 14, 75,245,240,240,229,242,236,229,230, + 244,244,232,225,105,128,248,147,229,107, 3,129, 49,129, 80,129, + 87,236,239,119, 2,129, 57,129, 68,236,229,230,244,244,232,225, + 105,128,248,140,242,233,231,232,244,244,232,225,105,128,248,139, + 244,232,225,105,128, 14, 72,245,240,240,229,242,236,229,230,244, + 244,232,225,105,128,248,138,232,225,238,225,235,225,116, 2,129, + 115,129,126,236,229,230,244,244,232,225,105,128,248,132,244,232, + 225,105,128, 14, 49,116, 3,129,141,129,169,129,232,225,233,235, + 232,117, 2,129,151,129,162,236,229,230,244,244,232,225,105,128, + 248,137,244,232,225,105,128, 14, 71,232,111, 3,129,178,129,209, + 129,216,236,239,119, 2,129,186,129,197,236,229,230,244,244,232, + 225,105,128,248,143,242,233,231,232,244,244,232,225,105,128,248, + 142,244,232,225,105,128, 14, 73,245,240,240,229,242,236,229,230, + 244,244,232,225,105,128,248,141,242,105, 3,129,241,130, 16,130, + 23,236,239,119, 2,129,249,130, 4,236,229,230,244,244,232,225, + 105,128,248,146,242,233,231,232,244,244,232,225,105,128,248,145, + 244,232,225,105,128, 14, 74,245,240,240,229,242,236,229,230,244, + 244,232,225,105,128,248,144,249,225,237,239,235,244,232,225,105, + 128, 14, 70,235,225,244,225,235,225,238, 97,129, 48,222,130, 64, + 232,225,236,230,247,233,228,244,104,128,255,143,236,101,128, 38, + 66,238,243,249,239,238,243,241,245,225,242,101,128, 51, 71,241, + 225,230,232,229,226,242,229,119,128, 5,190,242,115,128, 38, 66, + 115, 2,130,118,130,136,239,242,225,227,233,242,227,236,229,232, + 229,226,242,229,119,128, 5,175,241,245,225,242,101,128, 51,131, + 98, 2,130,150,130,160,239,240,239,237,239,230,111,128, 49, 7, + 243,241,245,225,242,101,128, 51,212, 99, 2,130,175,130,183,233, + 242,227,236,101,128, 36,220,245,226,229,228,243,241,245,225,242, + 101,128, 51,165,228,239,116, 2,130,204,130,213,225,227,227,229, + 238,116,128, 30, 65,226,229,236,239,119,128, 30, 67,101, 7,130, + 237,131,108,131,119,131,134,131,159,131,196,131,208,101, 2,130, + 243,131, 95,109, 4,130,253,131, 6,131, 20,131, 36,225,242,225, + 226,233, 99,128, 6, 69,230,233,238,225,236,225,242,225,226,233, + 99,128,254,226,233,238,233,244,233,225,236,225,242,225,226,233, + 99,128,254,227,237,101, 2,131, 43,131, 56,228,233,225,236,225, + 242,225,226,233, 99,128,254,228,229,237,105, 2,131, 64,131, 79, + 238,233,244,233,225,236,225,242,225,226,233, 99,128,252,209,243, + 239,236,225,244,229,228,225,242,225,226,233, 99,128,252, 72,244, + 239,242,245,243,241,245,225,242,101,128, 51, 77,232,233,242,225, + 231,225,238, 97,128, 48,129,233,250,233,229,242,225,243,241,245, + 225,242,101,128, 51,126,235,225,244,225,235,225,238, 97,129, 48, + 225,131,147,232,225,236,230,247,233,228,244,104,128,255,146,109, + 130, 5,222,131,167,131,187,228,225,231,229,243,104,129,251, 62, + 131,178,232,229,226,242,229,119,128,251, 62,232,229,226,242,229, + 119,128, 5,222,238,225,242,237,229,238,233,225,110,128, 5,116, + 242,235,232, 97, 3,131,219,131,228,132, 5,232,229,226,242,229, + 119,128, 5,165,235,229,230,245,236, 97, 2,131,239,131,248,232, + 229,226,242,229,119,128, 5,166,236,229,230,244,232,229,226,242, + 229,119,128, 5,166,236,229,230,244,232,229,226,242,229,119,128, + 5,165,104, 2,132, 24,132, 30,239,239,107,128, 2,113,250,243, + 241,245,225,242,101,128, 51,146,105, 6,132, 54,132, 91,132,228, + 132,239,133, 8,133, 65,228,100, 2,132, 61,132, 86,236,229,228, + 239,244,235,225,244,225,235,225,238,225,232,225,236,230,247,233, + 228,244,104,128,255,101,239,116,128, 0,183,229,245,109, 5,132, + 105,132,140,132,155,132,164,132,215, 97, 2,132,111,132,126,227, + 233,242,227,236,229,235,239,242,229,225,110,128, 50,114,240,225, + 242,229,238,235,239,242,229,225,110,128, 50, 18,227,233,242,227, + 236,229,235,239,242,229,225,110,128, 50,100,235,239,242,229,225, + 110,128, 49, 65,112, 2,132,170,132,202, 97, 2,132,176,132,190, + 238,243,233,239,243,235,239,242,229,225,110,128, 49,112,242,229, + 238,235,239,242,229,225,110,128, 50, 4,233,229,245,240,235,239, + 242,229,225,110,128, 49,110,243,233,239,243,235,239,242,229,225, + 110,128, 49,111,232,233,242,225,231,225,238, 97,128, 48,127,235, + 225,244,225,235,225,238, 97,129, 48,223,132,252,232,225,236,230, + 247,233,228,244,104,128,255,144,238,117, 2,133, 15,133, 60,115, + 132, 34, 18,133, 27,133, 38,133, 47,133, 53,226,229,236,239,247, + 227,237, 98,128, 3, 32,227,233,242,227,236,101,128, 34,150,237, + 239,100,128, 2,215,240,236,245,115,128, 34, 19,244,101,128, 32, + 50,242,105, 2,133, 72,133, 86,226,225,225,242,245,243,241,245, + 225,242,101,128, 51, 74,243,241,245,225,242,101,128, 51, 73,108, + 2,133,101,133,116,239,238,231,236,229,231,244,245,242,238,229, + 100,128, 2,112,243,241,245,225,242,101,128, 51,150,109, 3,133, + 133,133,147,133,158,227,245,226,229,228,243,241,245,225,242,101, + 128, 51,163,239,238,239,243,240,225,227,101,128,255, 77,243,241, + 245,225,242,229,228,243,241,245,225,242,101,128, 51,159,111, 5, + 133,186,133,212,133,237,133,247,134, 0,104, 2,133,192,133,202, + 233,242,225,231,225,238, 97,128, 48,130,237,243,241,245,225,242, + 101,128, 51,193,235,225,244,225,235,225,238, 97,129, 48,226,133, + 225,232,225,236,230,247,233,228,244,104,128,255,147,236,243,241, + 245,225,242,101,128, 51,214,237,225,244,232,225,105,128, 14, 33, + 246,229,242,243,243,241,245,225,242,101,129, 51,167,134, 15,228, + 243,241,245,225,242,101,128, 51,168,240, 97, 2,134, 32,134, 38, + 242,229,110,128, 36,168,243,241,245,225,242,101,128, 51,171,115, + 2,134, 53,134, 62,243,241,245,225,242,101,128, 51,179,245,240, + 229,242,233,239,114,128,246,239,244,245,242,238,229,100,128, 2, + 111,117,141, 0,181,134,111,134,115,134,125,134,149,134,159,134, + 181,134,192,134,217,134,240,134,250,135, 24,135, 88,135, 98, 49, + 128, 0,181,225,243,241,245,225,242,101,128, 51,130,227,104, 2, + 134,132,134,142,231,242,229,225,244,229,114,128, 34,107,236,229, + 243,115,128, 34,106,230,243,241,245,225,242,101,128, 51,140,103, + 2,134,165,134,172,242,229,229,107,128, 3,188,243,241,245,225, + 242,101,128, 51,141,232,233,242,225,231,225,238, 97,128, 48,128, + 235,225,244,225,235,225,238, 97,129, 48,224,134,205,232,225,236, + 230,247,233,228,244,104,128,255,145,108, 2,134,223,134,232,243, + 241,245,225,242,101,128, 51,149,244,233,240,236,121,128, 0,215, + 237,243,241,245,225,242,101,128, 51,155,238,225,104, 2,135, 2, + 135, 11,232,229,226,242,229,119,128, 5,163,236,229,230,244,232, + 229,226,242,229,119,128, 5,163,115, 2,135, 30,135, 79,233, 99, + 3,135, 39,135, 56,135, 67,225,236,238,239,244,101,129, 38,106, + 135, 50,228,226,108,128, 38,107,230,236,225,244,243,233,231,110, + 128, 38,109,243,232,225,242,240,243,233,231,110,128, 38,111,243, + 241,245,225,242,101,128, 51,178,246,243,241,245,225,242,101,128, + 51,182,247,243,241,245,225,242,101,128, 51,188,118, 2,135,114, + 135,127,237,229,231,225,243,241,245,225,242,101,128, 51,185,243, + 241,245,225,242,101,128, 51,183,119, 2,135,142,135,155,237,229, + 231,225,243,241,245,225,242,101,128, 51,191,243,241,245,225,242, + 101,128, 51,189,110,150, 0,110,135,212,136, 90,136,114,136,180, + 136,205,137, 7,137, 17,137, 84,137,127,139,161,139,179,139,204, + 139,235,140, 5,140, 70,142, 52,142, 60,142, 85,142, 93,143, 61, + 143, 71,143, 81, 97, 8,135,230,135,250,136, 1,136, 8,136, 33, + 136, 44,136, 69,136, 81, 98, 2,135,236,135,245,229,238,231,225, + 236,105,128, 9,168,236, 97,128, 34, 7,227,245,244,101,128, 1, + 68,228,229,246, 97,128, 9, 40,231,117, 2,136, 15,136, 24,234, + 225,242,225,244,105,128, 10,168,242,237,245,235,232,105,128, 10, + 40,232,233,242,225,231,225,238, 97,128, 48,106,235,225,244,225, + 235,225,238, 97,129, 48,202,136, 57,232,225,236,230,247,233,228, + 244,104,128,255,133,240,239,243,244,242,239,240,232,101,128, 1, + 73,243,241,245,225,242,101,128, 51,129, 98, 2,136, 96,136,106, + 239,240,239,237,239,230,111,128, 49, 11,243,240,225,227,101,128, + 0,160, 99, 4,136,124,136,131,136,140,136,167,225,242,239,110, + 128, 1, 72,229,228,233,236,236, 97,128, 1, 70,233,242, 99, 2, + 136,148,136,153,236,101,128, 36,221,245,237,230,236,229,248,226, + 229,236,239,119,128, 30, 75,239,237,237,225,225,227,227,229,238, + 116,128, 1, 70,228,239,116, 2,136,188,136,197,225,227,227,229, + 238,116,128, 30, 69,226,229,236,239,119,128, 30, 71,101, 3,136, + 213,136,224,136,249,232,233,242,225,231,225,238, 97,128, 48,109, + 235,225,244,225,235,225,238, 97,129, 48,205,136,237,232,225,236, + 230,247,233,228,244,104,128,255,136,247,243,232,229,241,229,236, + 243,233,231,110,128, 32,170,230,243,241,245,225,242,101,128, 51, + 139,103, 2,137, 23,137, 73, 97, 3,137, 31,137, 41,137, 48,226, + 229,238,231,225,236,105,128, 9,153,228,229,246, 97,128, 9, 25, + 231,117, 2,137, 55,137, 64,234,225,242,225,244,105,128, 10,153, + 242,237,245,235,232,105,128, 10, 25,239,238,231,245,244,232,225, + 105,128, 14, 7,104, 2,137, 90,137,100,233,242,225,231,225,238, + 97,128, 48,147,239,239,107, 2,137,108,137,115,236,229,230,116, + 128, 2,114,242,229,244,242,239,230,236,229,120,128, 2,115,105, + 4,137,137,138, 50,138, 61,138,119,229,245,110, 7,137,155,137, + 190,137,222,137,236,137,245,138, 22,138, 35, 97, 2,137,161,137, + 176,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,111, + 240,225,242,229,238,235,239,242,229,225,110,128, 50, 15,227,105, + 2,137,197,137,209,229,245,227,235,239,242,229,225,110,128, 49, + 53,242,227,236,229,235,239,242,229,225,110,128, 50, 97,232,233, + 229,245,232,235,239,242,229,225,110,128, 49, 54,235,239,242,229, + 225,110,128, 49, 52,240, 97, 2,137,252,138, 10,238,243,233,239, + 243,235,239,242,229,225,110,128, 49,104,242,229,238,235,239,242, + 229,225,110,128, 50, 1,243,233,239,243,235,239,242,229,225,110, + 128, 49,103,244,233,235,229,245,244,235,239,242,229,225,110,128, + 49,102,232,233,242,225,231,225,238, 97,128, 48,107,107, 2,138, + 67,138, 91,225,244,225,235,225,238, 97,129, 48,203,138, 79,232, + 225,236,230,247,233,228,244,104,128,255,134,232,225,232,233,116, + 2,138,101,138,112,236,229,230,244,244,232,225,105,128,248,153, + 244,232,225,105,128, 14, 77,238,101,141, 0, 57,138,150,138,159, + 138,169,138,199,138,206,138,231,139, 2,139, 36,139, 48,139, 59, + 139, 92,139,100,139,111,225,242,225,226,233, 99,128, 6,105,226, + 229,238,231,225,236,105,128, 9,239,227,233,242,227,236,101,129, + 36,104,138,180,233,238,246,229,242,243,229,243,225,238,243,243, + 229,242,233,102,128, 39,146,228,229,246, 97,128, 9,111,231,117, + 2,138,213,138,222,234,225,242,225,244,105,128, 10,239,242,237, + 245,235,232,105,128, 10,111,232, 97, 2,138,238,138,249,227,235, + 225,242,225,226,233, 99,128, 6,105,238,231,250,232,239,117,128, + 48, 41,105, 2,139, 8,139, 26,228,229,239,231,242,225,240,232, + 233,227,240,225,242,229,110,128, 50, 40,238,230,229,242,233,239, + 114,128, 32,137,237,239,238,239,243,240,225,227,101,128,255, 25, + 239,236,228,243,244,249,236,101,128,247, 57,112, 2,139, 65,139, + 72,225,242,229,110,128, 36,124,229,114, 2,139, 79,139, 85,233, + 239,100,128, 36,144,243,233,225,110,128, 6,249,242,239,237,225, + 110,128, 33,120,243,245,240,229,242,233,239,114,128, 32,121,116, + 2,139,117,139,155,229,229,110, 2,139,125,139,134,227,233,242, + 227,236,101,128, 36,114,112, 2,139,140,139,147,225,242,229,110, + 128, 36,134,229,242,233,239,100,128, 36,154,232,225,105,128, 14, + 89,106,129, 1,204,139,167,229,227,249,242,233,236,236,233, 99, + 128, 4, 90,235,225,244,225,235,225,238, 97,129, 48,243,139,192, + 232,225,236,230,247,233,228,244,104,128,255,157,108, 2,139,210, + 139,224,229,231,242,233,231,232,244,236,239,238,103,128, 1,158, + 233,238,229,226,229,236,239,119,128, 30, 73,109, 2,139,241,139, + 252,239,238,239,243,240,225,227,101,128,255, 78,243,241,245,225, + 242,101,128, 51,154,110, 2,140, 11,140, 61, 97, 3,140, 19,140, + 29,140, 36,226,229,238,231,225,236,105,128, 9,163,228,229,246, + 97,128, 9, 35,231,117, 2,140, 43,140, 52,234,225,242,225,244, + 105,128, 10,163,242,237,245,235,232,105,128, 10, 35,238,225,228, + 229,246, 97,128, 9, 41,111, 6,140, 84,140, 95,140,120,140,161, + 141,113,142, 40,232,233,242,225,231,225,238, 97,128, 48,110,235, + 225,244,225,235,225,238, 97,129, 48,206,140,108,232,225,236,230, + 247,233,228,244,104,128,255,137,110, 3,140,128,140,144,140,153, + 226,242,229,225,235,233,238,231,243,240,225,227,101,128, 0,160, + 229,238,244,232,225,105,128, 14, 19,245,244,232,225,105,128, 14, + 25,239,110, 7,140,178,140,187,140,201,140,235,140,251,141, 36, + 141, 95,225,242,225,226,233, 99,128, 6, 70,230,233,238,225,236, + 225,242,225,226,233, 99,128,254,230,231,232,245,238,238, 97, 2, + 140,212,140,221,225,242,225,226,233, 99,128, 6,186,230,233,238, + 225,236,225,242,225,226,233, 99,128,251,159,233,238,233,244,233, + 225,236,225,242,225,226,233, 99,128,254,231,234,229,229,237,105, + 2,141, 5,141, 20,238,233,244,233,225,236,225,242,225,226,233, + 99,128,252,210,243,239,236,225,244,229,228,225,242,225,226,233, + 99,128,252, 75,237,101, 2,141, 43,141, 56,228,233,225,236,225, + 242,225,226,233, 99,128,254,232,229,237,105, 2,141, 64,141, 79, + 238,233,244,233,225,236,225,242,225,226,233, 99,128,252,213,243, + 239,236,225,244,229,228,225,242,225,226,233, 99,128,252, 78,238, + 239,239,238,230,233,238,225,236,225,242,225,226,233, 99,128,252, + 141,116, 7,141,129,141,140,141,169,141,204,141,216,141,236,142, + 6,227,239,238,244,225,233,238,115,128, 34, 12,101, 2,141,146, + 141,162,236,229,237,229,238,116,129, 34, 9,141,157,239,102,128, + 34, 9,241,245,225,108,128, 34, 96,231,242,229,225,244,229,114, + 129, 34,111,141,181,238,239,114, 2,141,189,141,197,229,241,245, + 225,108,128, 34,113,236,229,243,115,128, 34,121,233,228,229,238, + 244,233,227,225,108,128, 34, 98,236,229,243,115,129, 34,110,141, + 225,238,239,242,229,241,245,225,108,128, 34,112,112, 2,141,242, + 141,252,225,242,225,236,236,229,108,128, 34, 38,242,229,227,229, + 228,229,115,128, 34,128,243,117, 3,142, 15,142, 22,142, 31,226, + 243,229,116,128, 34,132,227,227,229,229,228,115,128, 34,129,240, + 229,242,243,229,116,128, 34,133,247,225,242,237,229,238,233,225, + 110,128, 5,118,240,225,242,229,110,128, 36,169,115, 2,142, 66, + 142, 75,243,241,245,225,242,101,128, 51,177,245,240,229,242,233, + 239,114,128, 32,127,244,233,236,228,101,128, 0,241,117,132, 3, + 189,142,105,142,116,142,197,143, 24,232,233,242,225,231,225,238, + 97,128, 48,108,107, 2,142,122,142,146,225,244,225,235,225,238, + 97,129, 48,204,142,134,232,225,236,230,247,233,228,244,104,128, + 255,135,244, 97, 3,142,155,142,165,142,172,226,229,238,231,225, + 236,105,128, 9,188,228,229,246, 97,128, 9, 60,231,117, 2,142, + 179,142,188,234,225,242,225,244,105,128, 10,188,242,237,245,235, + 232,105,128, 10, 60,109, 2,142,203,142,237,226,229,242,243,233, + 231,110,130, 0, 35,142,217,142,229,237,239,238,239,243,240,225, + 227,101,128,255, 3,243,237,225,236,108,128,254, 95,229,114, 2, + 142,244,143, 20,225,236,243,233,231,110, 2,142,255,143, 7,231, + 242,229,229,107,128, 3,116,236,239,247,229,242,231,242,229,229, + 107,128, 3,117,111,128, 33, 22,110,130, 5,224,143, 32,143, 52, + 228,225,231,229,243,104,129,251, 64,143, 43,232,229,226,242,229, + 119,128,251, 64,232,229,226,242,229,119,128, 5,224,246,243,241, + 245,225,242,101,128, 51,181,247,243,241,245,225,242,101,128, 51, + 187,249, 97, 3,143, 90,143,100,143,107,226,229,238,231,225,236, + 105,128, 9,158,228,229,246, 97,128, 9, 30,231,117, 2,143,114, + 143,123,234,225,242,225,244,105,128, 10,158,242,237,245,235,232, + 105,128, 10, 30,111,147, 0,111,143,174,143,196,144, 18,144,188, + 145, 4,145, 19,145, 59,145,182,145,203,145,241,145,252,146,174, + 148, 8,148, 72,148,105,148,151,149, 24,149, 71,149, 83, 97, 2, + 143,180,143,187,227,245,244,101,128, 0,243,238,231,244,232,225, + 105,128, 14, 45, 98, 4,143,206,143,248,144, 1,144, 11,225,242, + 242,229,100,130, 2,117,143,218,143,229,227,249,242,233,236,236, + 233, 99,128, 4,233,228,233,229,242,229,243,233,243,227,249,242, + 233,236,236,233, 99,128, 4,235,229,238,231,225,236,105,128, 9, + 147,239,240,239,237,239,230,111,128, 49, 27,242,229,246,101,128, + 1, 79, 99, 3,144, 26,144, 99,144,178, 97, 2,144, 32,144, 93, + 238,228,242, 97, 3,144, 43,144, 50,144, 61,228,229,246, 97,128, + 9, 17,231,245,234,225,242,225,244,105,128, 10,145,246,239,247, + 229,236,243,233,231,110, 2,144, 75,144, 82,228,229,246, 97,128, + 9, 73,231,245,234,225,242,225,244,105,128, 10,201,242,239,110, + 128, 1,210,233,242, 99, 2,144,107,144,112,236,101,128, 36,222, + 245,237,230,236,229,120,133, 0,244,144,131,144,139,144,150,144, + 158,144,170,225,227,245,244,101,128, 30,209,228,239,244,226,229, + 236,239,119,128, 30,217,231,242,225,246,101,128, 30,211,232,239, + 239,235,225,226,239,246,101,128, 30,213,244,233,236,228,101,128, + 30,215,249,242,233,236,236,233, 99,128, 4, 62,100, 4,144,198, + 144,221,144,227,144,250,226,108, 2,144,205,144,213,225,227,245, + 244,101,128, 1, 81,231,242,225,246,101,128, 2, 13,229,246, 97, + 128, 9, 19,233,229,242,229,243,233,115,129, 0,246,144,239,227, + 249,242,233,236,236,233, 99,128, 4,231,239,244,226,229,236,239, + 119,128, 30,205,101,129, 1, 83,145, 10,235,239,242,229,225,110, + 128, 49, 90,103, 3,145, 27,145, 42,145, 49,239,238,229,107,129, + 2,219,145, 36,227,237, 98,128, 3, 40,242,225,246,101,128, 0, + 242,245,234,225,242,225,244,105,128, 10,147,104, 4,145, 69,145, + 80,145, 90,145,168,225,242,237,229,238,233,225,110,128, 5,133, + 233,242,225,231,225,238, 97,128, 48, 74,111, 2,145, 96,145,106, + 239,235,225,226,239,246,101,128, 30,207,242,110,133, 1,161,145, + 121,145,129,145,140,145,148,145,160,225,227,245,244,101,128, 30, + 219,228,239,244,226,229,236,239,119,128, 30,227,231,242,225,246, + 101,128, 30,221,232,239,239,235,225,226,239,246,101,128, 30,223, + 244,233,236,228,101,128, 30,225,245,238,231,225,242,245,237,236, + 225,245,116,128, 1, 81,105,129, 1,163,145,188,238,246,229,242, + 244,229,228,226,242,229,246,101,128, 2, 15,107, 2,145,209,145, + 233,225,244,225,235,225,238, 97,129, 48,170,145,221,232,225,236, + 230,247,233,228,244,104,128,255,117,239,242,229,225,110,128, 49, + 87,236,229,232,229,226,242,229,119,128, 5,171,109, 6,146, 10, + 146, 38,146, 45,146,134,146,145,146,163,225,227,242,239,110,130, + 1, 77,146, 22,146, 30,225,227,245,244,101,128, 30, 83,231,242, + 225,246,101,128, 30, 81,228,229,246, 97,128, 9, 80,229,231, 97, + 133, 3,201,146, 61,146, 65,146, 76,146, 90,146,106, 49,128, 3, + 214,227,249,242,233,236,236,233, 99,128, 4, 97,236,225,244,233, + 238,227,236,239,243,229,100,128, 2,119,242,239,245,238,228,227, + 249,242,233,236,236,233, 99,128, 4,123,116, 2,146,112,146,127, + 233,244,236,239,227,249,242,233,236,236,233, 99,128, 4,125,239, + 238,239,115,128, 3,206,231,245,234,225,242,225,244,105,128, 10, + 208,233,227,242,239,110,129, 3,191,146,155,244,239,238,239,115, + 128, 3,204,239,238,239,243,240,225,227,101,128,255, 79,238,101, + 145, 0, 49,146,213,146,222,146,232,147, 6,147, 31,147, 40,147, + 49,147, 74,147,108,147,142,147,154,147,173,147,184,147,217,147, + 227,147,235,147,246,225,242,225,226,233, 99,128, 6, 97,226,229, + 238,231,225,236,105,128, 9,231,227,233,242,227,236,101,129, 36, + 96,146,243,233,238,246,229,242,243,229,243,225,238,243,243,229, + 242,233,102,128, 39,138,100, 2,147, 12,147, 18,229,246, 97,128, + 9,103,239,244,229,238,236,229,225,228,229,114,128, 32, 36,229, + 233,231,232,244,104,128, 33, 91,230,233,244,244,229,100,128,246, + 220,231,117, 2,147, 56,147, 65,234,225,242,225,244,105,128, 10, + 231,242,237,245,235,232,105,128, 10,103,232, 97, 3,147, 83,147, + 94,147, 99,227,235,225,242,225,226,233, 99,128, 6, 97,236,102, + 128, 0,189,238,231,250,232,239,117,128, 48, 33,105, 2,147,114, + 147,132,228,229,239,231,242,225,240,232,233,227,240,225,242,229, + 110,128, 50, 32,238,230,229,242,233,239,114,128, 32,129,237,239, + 238,239,243,240,225,227,101,128,255, 17,238,245,237,229,242,225, + 244,239,242,226,229,238,231,225,236,105,128, 9,244,239,236,228, + 243,244,249,236,101,128,247, 49,112, 2,147,190,147,197,225,242, + 229,110,128, 36,116,229,114, 2,147,204,147,210,233,239,100,128, + 36,136,243,233,225,110,128, 6,241,241,245,225,242,244,229,114, + 128, 0,188,242,239,237,225,110,128, 33,112,243,245,240,229,242, + 233,239,114,128, 0,185,244,104, 2,147,253,148, 2,225,105,128, + 14, 81,233,242,100,128, 33, 83,111, 3,148, 16,148, 50,148, 66, + 103, 2,148, 22,148, 40,239,238,229,107,129, 1,235,148, 31,237, + 225,227,242,239,110,128, 1,237,245,242,237,245,235,232,105,128, + 10, 19,237,225,244,242,225,231,245,242,237,245,235,232,105,128, + 10, 75,240,229,110,128, 2, 84,112, 3,148, 80,148, 87,148, 98, + 225,242,229,110,128, 36,170,229,238,226,245,236,236,229,116,128, + 37,230,244,233,239,110,128, 35, 37,114, 2,148,111,148,140,100, + 2,148,117,148,128,230,229,237,233,238,233,238,101,128, 0,170, + 237,225,243,227,245,236,233,238,101,128, 0,186,244,232,239,231, + 239,238,225,108,128, 34, 31,115, 5,148,163,148,195,148,212,149, + 1,149, 14,232,239,242,116, 2,148,172,148,179,228,229,246, 97, + 128, 9, 18,246,239,247,229,236,243,233,231,238,228,229,246, 97, + 128, 9, 74,236,225,243,104,129, 0,248,148,204,225,227,245,244, + 101,128, 1,255,237,225,236,108, 2,148,221,148,232,232,233,242, + 225,231,225,238, 97,128, 48, 73,235,225,244,225,235,225,238, 97, + 129, 48,169,148,245,232,225,236,230,247,233,228,244,104,128,255, + 107,244,242,239,235,229,225,227,245,244,101,128, 1,255,245,240, + 229,242,233,239,114,128,246,240,116, 2,149, 30,149, 41,227,249, + 242,233,236,236,233, 99,128, 4,127,233,236,228,101,130, 0,245, + 149, 52,149, 60,225,227,245,244,101,128, 30, 77,228,233,229,242, + 229,243,233,115,128, 30, 79,245,226,239,240,239,237,239,230,111, + 128, 49, 33,118, 2,149, 89,149,170,229,114, 2,149, 96,149,162, + 236,233,238,101,131, 32, 62,149,109,149,132,149,155, 99, 2,149, + 115,149,127,229,238,244,229,242,236,233,238,101,128,254, 74,237, + 98,128, 3, 5,100, 2,149,138,149,146,225,243,232,229,100,128, + 254, 73,226,236,247,225,246,121,128,254, 76,247,225,246,121,128, + 254, 75,243,227,239,242,101,128, 0,175,239,247,229,236,243,233, + 231,110, 3,149,185,149,195,149,202,226,229,238,231,225,236,105, + 128, 9,203,228,229,246, 97,128, 9, 75,231,245,234,225,242,225, + 244,105,128, 10,203,112,145, 0,112,149,251,152,123,152,134,152, + 143,152,155,154, 80,154, 90,155, 82,156,101,156,191,156,217,157, + 92,157,100,158, 2,158, 60,158, 88,158, 98, 97, 14,150, 25,150, + 57,150, 67,150, 74,150, 81,150,129,150,140,150,154,150,165,150, + 212,150,226,151,238,152, 21,152,111, 97, 2,150, 31,150, 43,237, + 240,243,243,241,245,225,242,101,128, 51,128,243,229,238,244,239, + 243,241,245,225,242,101,128, 51, 43,226,229,238,231,225,236,105, + 128, 9,170,227,245,244,101,128, 30, 85,228,229,246, 97,128, 9, + 42,103, 2,150, 87,150,105,101, 2,150, 93,150,100,228,239,247, + 110,128, 33,223,245,112,128, 33,222,117, 2,150,111,150,120,234, + 225,242,225,244,105,128, 10,170,242,237,245,235,232,105,128, 10, + 42,232,233,242,225,231,225,238, 97,128, 48,113,233,249,225,238, + 238,239,233,244,232,225,105,128, 14, 47,235,225,244,225,235,225, + 238, 97,128, 48,209,108, 2,150,171,150,196,225,244,225,236,233, + 250,225,244,233,239,238,227,249,242,233,236,236,233,227,227,237, + 98,128, 4,132,239,227,232,235,225,227,249,242,233,236,236,233, + 99,128, 4,192,238,243,233,239,243,235,239,242,229,225,110,128, + 49,127,114, 3,150,234,150,255,151,227, 97, 2,150,240,150,248, + 231,242,225,240,104,128, 0,182,236,236,229,108,128, 34, 37,229, + 110, 2,151, 6,151,116,236,229,230,116,136, 0, 40,151, 29,151, + 44,151, 49,151, 54,151, 65,151, 77,151,100,151,105,225,236,244, + 239,238,229,225,242,225,226,233, 99,128,253, 62,226,116,128,248, + 237,229,120,128,248,236,233,238,230,229,242,233,239,114,128, 32, + 141,237,239,238,239,243,240,225,227,101,128,255, 8,115, 2,151, + 83,151, 90,237,225,236,108,128,254, 89,245,240,229,242,233,239, + 114,128, 32,125,244,112,128,248,235,246,229,242,244,233,227,225, + 108,128,254, 53,242,233,231,232,116,136, 0, 41,151,140,151,155, + 151,160,151,165,151,176,151,188,151,211,151,216,225,236,244,239, + 238,229,225,242,225,226,233, 99,128,253, 63,226,116,128,248,248, + 229,120,128,248,247,233,238,230,229,242,233,239,114,128, 32,142, + 237,239,238,239,243,240,225,227,101,128,255, 9,115, 2,151,194, + 151,201,237,225,236,108,128,254, 90,245,240,229,242,233,239,114, + 128, 32,126,244,112,128,248,246,246,229,242,244,233,227,225,108, + 128,254, 54,244,233,225,236,228,233,230,102,128, 34, 2,115, 3, + 151,246,152, 1,152, 13,229,241,232,229,226,242,229,119,128, 5, + 192,232,244,225,232,229,226,242,229,119,128, 5,153,241,245,225, + 242,101,128, 51,169,244,225,104,134, 5,183,152, 39,152, 53,152, + 58,152, 67,152, 82,152, 98, 49, 2,152, 45,152, 49, 49,128, 5, + 183,100,128, 5,183,178, 97,128, 5,183,232,229,226,242,229,119, + 128, 5,183,238,225,242,242,239,247,232,229,226,242,229,119,128, + 5,183,241,245,225,242,244,229,242,232,229,226,242,229,119,128, + 5,183,247,233,228,229,232,229,226,242,229,119,128, 5,183,250, + 229,242,232,229,226,242,229,119,128, 5,161,226,239,240,239,237, + 239,230,111,128, 49, 6,227,233,242,227,236,101,128, 36,223,228, + 239,244,225,227,227,229,238,116,128, 30, 87,101,137, 5,228,152, + 177,152,188,152,208,152,220,152,240,153, 86,153, 97,153,118,154, + 73,227,249,242,233,236,236,233, 99,128, 4, 63,228,225,231,229, + 243,104,129,251, 68,152,199,232,229,226,242,229,119,128,251, 68, + 229,250,233,243,241,245,225,242,101,128, 51, 59,230,233,238,225, + 236,228,225,231,229,243,232,232,229,226,242,229,119,128,251, 67, + 104, 5,152,252,153, 19,153, 27,153, 41,153, 71,225,114, 2,153, + 3,153, 10,225,226,233, 99,128, 6,126,237,229,238,233,225,110, + 128, 5,122,229,226,242,229,119,128, 5,228,230,233,238,225,236, + 225,242,225,226,233, 99,128,251, 87,105, 2,153, 47,153, 62,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,251, 88,242,225, + 231,225,238, 97,128, 48,122,237,229,228,233,225,236,225,242,225, + 226,233, 99,128,251, 89,235,225,244,225,235,225,238, 97,128, 48, + 218,237,233,228,228,236,229,232,239,239,235,227,249,242,233,236, + 236,233, 99,128, 4,167,114, 5,153,130,153,142,153,184,154, 49, + 154, 62,225,230,229,232,229,226,242,229,119,128,251, 78,227,229, + 238,116,131, 0, 37,153,155,153,164,153,176,225,242,225,226,233, + 99,128, 6,106,237,239,238,239,243,240,225,227,101,128,255, 5, + 243,237,225,236,108,128,254,106,105, 2,153,190,154, 31,239,100, + 134, 0, 46,153,207,153,218,153,229,153,241,153,252,154, 8,225, + 242,237,229,238,233,225,110,128, 5,137,227,229,238,244,229,242, + 229,100,128, 0,183,232,225,236,230,247,233,228,244,104,128,255, + 97,233,238,230,229,242,233,239,114,128,246,231,237,239,238,239, + 243,240,225,227,101,128,255, 14,115, 2,154, 14,154, 21,237,225, + 236,108,128,254, 82,245,240,229,242,233,239,114,128,246,232,243, + 240,239,237,229,238,233,231,242,229,229,235,227,237, 98,128, 3, + 66,240,229,238,228,233,227,245,236,225,114,128, 34,165,244,232, + 239,245,243,225,238,100,128, 32, 48,243,229,244, 97,128, 32,167, + 230,243,241,245,225,242,101,128, 51,138,104, 3,154, 98,154,148, + 155, 29, 97, 3,154,106,154,116,154,123,226,229,238,231,225,236, + 105,128, 9,171,228,229,246, 97,128, 9, 43,231,117, 2,154,130, + 154,139,234,225,242,225,244,105,128, 10,171,242,237,245,235,232, + 105,128, 10, 43,105,133, 3,198,154,162,154,166,154,252,155, 4, + 155, 15, 49,128, 3,213,229,245,240,104, 4,154,179,154,214,154, + 229,154,238, 97, 2,154,185,154,200,227,233,242,227,236,229,235, + 239,242,229,225,110,128, 50,122,240,225,242,229,238,235,239,242, + 229,225,110,128, 50, 26,227,233,242,227,236,229,235,239,242,229, + 225,110,128, 50,108,235,239,242,229,225,110,128, 49, 77,240,225, + 242,229,238,235,239,242,229,225,110,128, 50, 12,236,225,244,233, + 110,128, 2,120,238,244,232,245,244,232,225,105,128, 14, 58,243, + 249,237,226,239,236,231,242,229,229,107,128, 3,213,111, 3,155, + 37,155, 42,155, 68,239,107,128, 1,165,240,104, 2,155, 49,155, + 58,225,238,244,232,225,105,128, 14, 30,245,238,231,244,232,225, + 105,128, 14, 28,243,225,237,240,232,225,239,244,232,225,105,128, + 14, 32,105,133, 3,192,155, 96,156, 52,156, 63,156, 74,156, 88, + 229,245,112, 6,155,112,155,147,155,179,155,207,155,221,156, 17, + 97, 2,155,118,155,133,227,233,242,227,236,229,235,239,242,229, + 225,110,128, 50,115,240,225,242,229,238,235,239,242,229,225,110, + 128, 50, 19,227,105, 2,155,154,155,166,229,245,227,235,239,242, + 229,225,110,128, 49,118,242,227,236,229,235,239,242,229,225,110, + 128, 50,101,107, 2,155,185,155,199,233,249,229,239,235,235,239, + 242,229,225,110,128, 49,114,239,242,229,225,110,128, 49, 66,240, + 225,242,229,238,235,239,242,229,225,110,128, 50, 5,243,233,239, + 115, 2,155,230,156, 2,107, 2,155,236,155,250,233,249,229,239, + 235,235,239,242,229,225,110,128, 49,116,239,242,229,225,110,128, + 49, 68,244,233,235,229,245,244,235,239,242,229,225,110,128, 49, + 117,116, 2,156, 23,156, 38,232,233,229,245,244,232,235,239,242, + 229,225,110,128, 49,119,233,235,229,245,244,235,239,242,229,225, + 110,128, 49,115,232,233,242,225,231,225,238, 97,128, 48,116,235, + 225,244,225,235,225,238, 97,128, 48,212,243,249,237,226,239,236, + 231,242,229,229,107,128, 3,214,247,242,225,242,237,229,238,233, + 225,110,128, 5,131,236,245,115,132, 0, 43,156,115,156,126,156, + 135,156,168,226,229,236,239,247,227,237, 98,128, 3, 31,227,233, + 242,227,236,101,128, 34,149,109, 2,156,141,156,148,233,238,245, + 115,128, 0,177,111, 2,156,154,156,158,100,128, 2,214,238,239, + 243,240,225,227,101,128,255, 11,115, 2,156,174,156,181,237,225, + 236,108,128,254, 98,245,240,229,242,233,239,114,128, 32,122,109, + 2,156,197,156,208,239,238,239,243,240,225,227,101,128,255, 80, + 243,241,245,225,242,101,128, 51,216,111, 5,156,229,156,240,157, + 51,157, 62,157, 72,232,233,242,225,231,225,238, 97,128, 48,125, + 233,238,244,233,238,231,233,238,228,229,120, 4,157, 4,157, 16, + 157, 28,157, 41,228,239,247,238,247,232,233,244,101,128, 38, 31, + 236,229,230,244,247,232,233,244,101,128, 38, 28,242,233,231,232, + 244,247,232,233,244,101,128, 38, 30,245,240,247,232,233,244,101, + 128, 38, 29,235,225,244,225,235,225,238, 97,128, 48,221,240,236, + 225,244,232,225,105,128, 14, 27,243,244,225,236,237,225,242,107, + 129, 48, 18,157, 85,230,225,227,101,128, 48, 32,240,225,242,229, + 110,128, 36,171,114, 3,157,108,157,134,157,159,101, 2,157,114, + 157,122,227,229,228,229,115,128, 34,122,243,227,242,233,240,244, + 233,239,110,128, 33, 30,233,237,101, 2,157,142,157,148,237,239, + 100,128, 2,185,242,229,246,229,242,243,229,100,128, 32, 53,111, + 4,157,169,157,176,157,186,157,199,228,245,227,116,128, 34, 15, + 234,229,227,244,233,246,101,128, 35, 5,236,239,238,231,229,228, + 235,225,238, 97,128, 48,252,112, 2,157,205,157,242,101, 2,157, + 211,157,218,236,236,239,114,128, 35, 24,242,243,117, 2,157,226, + 157,233,226,243,229,116,128, 34,130,240,229,242,243,229,116,128, + 34,131,239,242,244,233,239,110,129, 34, 55,157,253,225,108,128, + 34, 29,115, 2,158, 8,158, 51,105,130, 3,200,158, 16,158, 27, + 227,249,242,233,236,236,233, 99,128, 4,113,236,233,240,238,229, + 245,237,225,244,225,227,249,242,233,236,236,233,227,227,237, 98, + 128, 4,134,243,241,245,225,242,101,128, 51,176,117, 2,158, 66, + 158, 77,232,233,242,225,231,225,238, 97,128, 48,119,235,225,244, + 225,235,225,238, 97,128, 48,215,246,243,241,245,225,242,101,128, + 51,180,247,243,241,245,225,242,101,128, 51,186,113,136, 0,113, + 158,128,159,177,159,188,159,197,159,204,159,216,159,254,160, 6, + 97, 4,158,138,158,161,158,225,159,160,100, 2,158,144,158,150, + 229,246, 97,128, 9, 88,237,225,232,229,226,242,229,119,128, 5, + 168,102, 4,158,171,158,180,158,194,158,210,225,242,225,226,233, + 99,128, 6, 66,230,233,238,225,236,225,242,225,226,233, 99,128, + 254,214,233,238,233,244,233,225,236,225,242,225,226,233, 99,128, + 254,215,237,229,228,233,225,236,225,242,225,226,233, 99,128,254, + 216,237,225,244,115,136, 5,184,158,248,159, 12,159, 26,159, 31, + 159, 36,159, 45,159, 60,159,147, 49, 3,159, 0,159, 4,159, 8, + 48,128, 5,184, 97,128, 5,184, 99,128, 5,184, 50, 2,159, 18, + 159, 22, 55,128, 5,184, 57,128, 5,184,179, 51,128, 5,184,228, + 101,128, 5,184,232,229,226,242,229,119,128, 5,184,238,225,242, + 242,239,247,232,229,226,242,229,119,128, 5,184,113, 2,159, 66, + 159,132,225,244,225,110, 4,159, 79,159, 88,159,103,159,119,232, + 229,226,242,229,119,128, 5,184,238,225,242,242,239,247,232,229, + 226,242,229,119,128, 5,184,241,245,225,242,244,229,242,232,229, + 226,242,229,119,128, 5,184,247,233,228,229,232,229,226,242,229, + 119,128, 5,184,245,225,242,244,229,242,232,229,226,242,229,119, + 128, 5,184,247,233,228,229,232,229,226,242,229,119,128, 5,184, + 242,238,229,249,240,225,242,225,232,229,226,242,229,119,128, 5, + 159,226,239,240,239,237,239,230,111,128, 49, 17,227,233,242,227, + 236,101,128, 36,224,232,239,239,107,128, 2,160,237,239,238,239, + 243,240,225,227,101,128,255, 81,239,102,130, 5,231,159,225,159, + 245,228,225,231,229,243,104,129,251, 71,159,236,232,229,226,242, + 229,119,128,251, 71,232,229,226,242,229,119,128, 5,231,240,225, + 242,229,110,128, 36,172,117, 4,160, 16,160, 28,160,117,160,204, + 225,242,244,229,242,238,239,244,101,128, 38,105,226,245,244,115, + 135, 5,187,160, 49,160, 54,160, 59,160, 64,160, 73,160, 88,160, + 104,177, 56,128, 5,187,178, 53,128, 5,187,179, 49,128, 5,187, + 232,229,226,242,229,119,128, 5,187,238,225,242,242,239,247,232, + 229,226,242,229,119,128, 5,187,241,245,225,242,244,229,242,232, + 229,226,242,229,119,128, 5,187,247,233,228,229,232,229,226,242, + 229,119,128, 5,187,229,243,244,233,239,110,133, 0, 63,160,136, + 160,159,160,176,160,184,160,196,225,114, 2,160,143,160,150,225, + 226,233, 99,128, 6, 31,237,229,238,233,225,110,128, 5, 94,228, + 239,247,110,129, 0,191,160,168,243,237,225,236,108,128,247,191, + 231,242,229,229,107,128, 3,126,237,239,238,239,243,240,225,227, + 101,128,255, 31,243,237,225,236,108,128,247, 63,239,244,101, 4, + 160,216,161, 31,161, 51,161, 80,228,226,108,133, 0, 34,160,232, + 160,239,160,246,161, 2,161, 23,226,225,243,101,128, 32, 30,236, + 229,230,116,128, 32, 28,237,239,238,239,243,240,225,227,101,128, + 255, 2,240,242,233,237,101,129, 48, 30,161, 12,242,229,246,229, + 242,243,229,100,128, 48, 29,242,233,231,232,116,128, 32, 29,236, + 229,230,116,129, 32, 24,161, 40,242,229,246,229,242,243,229,100, + 128, 32, 27,114, 2,161, 57,161, 67,229,246,229,242,243,229,100, + 128, 32, 27,233,231,232,116,129, 32, 25,161, 76,110,128, 1, 73, + 243,233,238,231,108, 2,161, 90,161, 97,226,225,243,101,128, 32, + 26,101,129, 0, 39,161,103,237,239,238,239,243,240,225,227,101, + 128,255, 7,114,145, 0,114,161,153,162,157,162,168,162,215,163, + 10,164, 27,164, 51,164,146,166,180,166,217,166,229,167, 27,167, + 35,167,197,167,208,167,243,168, 87, 97, 11,161,177,161,188,161, + 198,161,205,162, 14,162, 30,162, 55,162, 66,162, 91,162,114,162, + 151,225,242,237,229,238,233,225,110,128, 5,124,226,229,238,231, + 225,236,105,128, 9,176,227,245,244,101,128, 1, 85,100, 4,161, + 215,161,221,161,235,162, 5,229,246, 97,128, 9, 48,233,227,225, + 108,129, 34, 26,161,230,229,120,128,248,229,239,246,229,242,243, + 243,241,245,225,242,101,129, 51,174,161,251,228,243,241,245,225, + 242,101,128, 51,175,243,241,245,225,242,101,128, 51,173,230,101, + 129, 5,191,162, 21,232,229,226,242,229,119,128, 5,191,231,117, + 2,162, 37,162, 46,234,225,242,225,244,105,128, 10,176,242,237, + 245,235,232,105,128, 10, 48,232,233,242,225,231,225,238, 97,128, + 48,137,235,225,244,225,235,225,238, 97,129, 48,233,162, 79,232, + 225,236,230,247,233,228,244,104,128,255,151,236,239,247,229,242, + 228,233,225,231,239,238,225,236,226,229,238,231,225,236,105,128, + 9,241,109, 2,162,120,162,143,233,228,228,236,229,228,233,225, + 231,239,238,225,236,226,229,238,231,225,236,105,128, 9,240,243, + 232,239,242,110,128, 2,100,244,233,111,128, 34, 54,226,239,240, + 239,237,239,230,111,128, 49, 22, 99, 4,162,178,162,185,162,194, + 162,202,225,242,239,110,128, 1, 89,229,228,233,236,236, 97,128, + 1, 87,233,242,227,236,101,128, 36,225,239,237,237,225,225,227, + 227,229,238,116,128, 1, 87,100, 2,162,221,162,231,226,236,231, + 242,225,246,101,128, 2, 17,239,116, 2,162,238,162,247,225,227, + 227,229,238,116,128, 30, 89,226,229,236,239,119,129, 30, 91,163, + 1,237,225,227,242,239,110,128, 30, 93,101, 6,163, 24,163, 69, + 163,104,163,159,163,184,163,217,102, 2,163, 30,163, 43,229,242, + 229,238,227,229,237,225,242,107,128, 32, 59,236,229,248,243,117, + 2,163, 53,163, 60,226,243,229,116,128, 34,134,240,229,242,243, + 229,116,128, 34,135,231,233,243,244,229,114, 2,163, 80,163, 85, + 229,100,128, 0,174,115, 2,163, 91,163, 97,225,238,115,128,248, + 232,229,242,233,102,128,246,218,104, 3,163,112,163,135,163,149, + 225,114, 2,163,119,163,126,225,226,233, 99,128, 6, 49,237,229, + 238,233,225,110,128, 5,128,230,233,238,225,236,225,242,225,226, + 233, 99,128,254,174,233,242,225,231,225,238, 97,128, 48,140,235, + 225,244,225,235,225,238, 97,129, 48,236,163,172,232,225,236,230, + 247,233,228,244,104,128,255,154,243,104,130, 5,232,163,193,163, + 208,228,225,231,229,243,232,232,229,226,242,229,119,128,251, 72, + 232,229,226,242,229,119,128, 5,232,118, 3,163,225,163,238,164, + 14,229,242,243,229,228,244,233,236,228,101,128, 34, 61,233, 97, + 2,163,245,163,254,232,229,226,242,229,119,128, 5,151,237,245, + 231,242,225,243,232,232,229,226,242,229,119,128, 5,151,236,239, + 231,233,227,225,236,238,239,116,128, 35, 16,230,233,243,232,232, + 239,239,107,129, 2,126,164, 40,242,229,246,229,242,243,229,100, + 128, 2,127,104, 2,164, 57,164, 80, 97, 2,164, 63,164, 73,226, + 229,238,231,225,236,105,128, 9,221,228,229,246, 97,128, 9, 93, + 111,131, 3,193,164, 90,164,119,164,133,239,107,129, 2,125,164, + 97,244,245,242,238,229,100,129, 2,123,164,108,243,245,240,229, + 242,233,239,114,128, 2,181,243,249,237,226,239,236,231,242,229, + 229,107,128, 3,241,244,233,227,232,239,239,235,237,239,100,128, + 2,222,105, 6,164,160,165,204,165,250,166, 5,166, 30,166,166, + 229,245,108, 9,164,182,164,217,164,232,164,246,165, 36,165, 50, + 165,136,165,149,165,184, 97, 2,164,188,164,203,227,233,242,227, + 236,229,235,239,242,229,225,110,128, 50,113,240,225,242,229,238, + 235,239,242,229,225,110,128, 50, 17,227,233,242,227,236,229,235, + 239,242,229,225,110,128, 50, 99,232,233,229,245,232,235,239,242, + 229,225,110,128, 49, 64,107, 2,164,252,165, 28,233,249,229,239, + 107, 2,165, 6,165, 15,235,239,242,229,225,110,128, 49, 58,243, + 233,239,243,235,239,242,229,225,110,128, 49,105,239,242,229,225, + 110,128, 49, 57,237,233,229,245,237,235,239,242,229,225,110,128, + 49, 59,112, 3,165, 58,165, 90,165,105, 97, 2,165, 64,165, 78, + 238,243,233,239,243,235,239,242,229,225,110,128, 49,108,242,229, + 238,235,239,242,229,225,110,128, 50, 3,232,233,229,245,240,232, + 235,239,242,229,225,110,128, 49, 63,233,229,245,112, 2,165,114, + 165,123,235,239,242,229,225,110,128, 49, 60,243,233,239,243,235, + 239,242,229,225,110,128, 49,107,243,233,239,243,235,239,242,229, + 225,110,128, 49, 61,116, 2,165,155,165,170,232,233,229,245,244, + 232,235,239,242,229,225,110,128, 49, 62,233,235,229,245,244,235, + 239,242,229,225,110,128, 49,106,249,229,239,242,233,238,232,233, + 229,245,232,235,239,242,229,225,110,128, 49,109,231,232,116, 2, + 165,212,165,220,225,238,231,236,101,128, 34, 31,116, 2,165,226, + 165,240,225,227,235,226,229,236,239,247,227,237, 98,128, 3, 25, + 242,233,225,238,231,236,101,128, 34,191,232,233,242,225,231,225, + 238, 97,128, 48,138,235,225,244,225,235,225,238, 97,129, 48,234, + 166, 18,232,225,236,230,247,233,228,244,104,128,255,152,110, 2, + 166, 36,166,152,103,131, 2,218,166, 46,166, 57,166, 63,226,229, + 236,239,247,227,237, 98,128, 3, 37,227,237, 98,128, 3, 10,232, + 225,236,102, 2,166, 72,166,118,236,229,230,116,131, 2,191,166, + 85,166, 96,166,107,225,242,237,229,238,233,225,110,128, 5, 89, + 226,229,236,239,247,227,237, 98,128, 3, 28,227,229,238,244,229, + 242,229,100,128, 2,211,242,233,231,232,116,130, 2,190,166,130, + 166,141,226,229,236,239,247,227,237, 98,128, 3, 57,227,229,238, + 244,229,242,229,100,128, 2,210,246,229,242,244,229,228,226,242, + 229,246,101,128, 2, 19,244,244,239,242,245,243,241,245,225,242, + 101,128, 51, 81,108, 2,166,186,166,197,233,238,229,226,229,236, + 239,119,128, 30, 95,239,238,231,236,229,103,129, 2,124,166,208, + 244,245,242,238,229,100,128, 2,122,237,239,238,239,243,240,225, + 227,101,128,255, 82,111, 3,166,237,166,248,167, 17,232,233,242, + 225,231,225,238, 97,128, 48,141,235,225,244,225,235,225,238, 97, + 129, 48,237,167, 5,232,225,236,230,247,233,228,244,104,128,255, + 155,242,245,225,244,232,225,105,128, 14, 35,240,225,242,229,110, + 128, 36,173,114, 3,167, 43,167, 79,167,109, 97, 3,167, 51,167, + 61,167, 68,226,229,238,231,225,236,105,128, 9,220,228,229,246, + 97,128, 9, 49,231,245,242,237,245,235,232,105,128, 10, 92,229, + 104, 2,167, 86,167, 95,225,242,225,226,233, 99,128, 6,145,230, + 233,238,225,236,225,242,225,226,233, 99,128,251,141,246,239,227, + 225,236,233, 99, 4,167,125,167,135,167,142,167,153,226,229,238, + 231,225,236,105,128, 9,224,228,229,246, 97,128, 9, 96,231,245, + 234,225,242,225,244,105,128, 10,224,246,239,247,229,236,243,233, + 231,110, 3,167,169,167,179,167,186,226,229,238,231,225,236,105, + 128, 9,196,228,229,246, 97,128, 9, 68,231,245,234,225,242,225, + 244,105,128, 10,196,243,245,240,229,242,233,239,114,128,246,241, + 116, 2,167,214,167,222,226,236,239,227,107,128, 37,144,245,242, + 238,229,100,129, 2,121,167,232,243,245,240,229,242,233,239,114, + 128, 2,180,117, 4,167,253,168, 8,168, 33,168, 80,232,233,242, + 225,231,225,238, 97,128, 48,139,235,225,244,225,235,225,238, 97, + 129, 48,235,168, 21,232,225,236,230,247,233,228,244,104,128,255, + 153,112, 2,168, 39,168, 74,229,101, 2,168, 46,168, 60,237,225, + 242,235,226,229,238,231,225,236,105,128, 9,242,243,233,231,238, + 226,229,238,231,225,236,105,128, 9,243,233,225,104,128,246,221, + 244,232,225,105,128, 14, 36,246,239,227,225,236,233, 99, 4,168, + 103,168,113,168,120,168,131,226,229,238,231,225,236,105,128, 9, + 139,228,229,246, 97,128, 9, 11,231,245,234,225,242,225,244,105, + 128, 10,139,246,239,247,229,236,243,233,231,110, 3,168,147,168, + 157,168,164,226,229,238,231,225,236,105,128, 9,195,228,229,246, + 97,128, 9, 67,231,245,234,225,242,225,244,105,128, 10,195,115, + 147, 0,115,168,217,170,187,170,198,171, 68,171,107,174, 49,174, + 60,176,203,179, 85,179,131,179,158,180, 93,180,160,181,193,181, + 203,182,133,182,206,183,120,183,130, 97, 9,168,237,168,247,169, + 12,169, 84,169,109,169,120,169,145,169,177,169,217,226,229,238, + 231,225,236,105,128, 9,184,227,245,244,101,129, 1, 91,169, 0, + 228,239,244,225,227,227,229,238,116,128, 30,101,100, 5,169, 24, + 169, 33,169, 39,169, 53,169, 69,225,242,225,226,233, 99,128, 6, + 53,229,246, 97,128, 9, 56,230,233,238,225,236,225,242,225,226, + 233, 99,128,254,186,233,238,233,244,233,225,236,225,242,225,226, + 233, 99,128,254,187,237,229,228,233,225,236,225,242,225,226,233, + 99,128,254,188,231,117, 2,169, 91,169,100,234,225,242,225,244, + 105,128, 10,184,242,237,245,235,232,105,128, 10, 56,232,233,242, + 225,231,225,238, 97,128, 48, 85,235,225,244,225,235,225,238, 97, + 129, 48,181,169,133,232,225,236,230,247,233,228,244,104,128,255, + 123,236,236,225,236,236,225,232,239,245,225,236,225,249,232,229, + 247,225,243,225,236,236,225,237,225,242,225,226,233, 99,128,253, + 250,237,229,235,104,130, 5,225,169,188,169,208,228,225,231,229, + 243,104,129,251, 65,169,199,232,229,226,242,229,119,128,251, 65, + 232,229,226,242,229,119,128, 5,225,242, 97, 5,169,230,170, 48, + 170, 56,170,106,170,114, 97, 5,169,242,169,250,170, 2,170, 33, + 170, 41,225,244,232,225,105,128, 14, 50,229,244,232,225,105,128, + 14, 65,233,237,225,233,109, 2,170, 12,170, 23,225,236,225,233, + 244,232,225,105,128, 14, 68,245,225,238,244,232,225,105,128, 14, + 67,237,244,232,225,105,128, 14, 51,244,232,225,105,128, 14, 48, + 229,244,232,225,105,128, 14, 64,105, 3,170, 64,170, 88,170, 99, + 105, 2,170, 70,170, 81,236,229,230,244,244,232,225,105,128,248, + 134,244,232,225,105,128, 14, 53,236,229,230,244,244,232,225,105, + 128,248,133,244,232,225,105,128, 14, 52,239,244,232,225,105,128, + 14, 66,117, 3,170,122,170,172,170,179,101, 3,170,130,170,154, + 170,165,101, 2,170,136,170,147,236,229,230,244,244,232,225,105, + 128,248,136,244,232,225,105,128, 14, 55,236,229,230,244,244,232, + 225,105,128,248,135,244,232,225,105,128, 14, 54,244,232,225,105, + 128, 14, 56,245,244,232,225,105,128, 14, 57,226,239,240,239,237, + 239,230,111,128, 49, 25, 99, 5,170,210,170,231,170,240,171, 33, + 171, 55,225,242,239,110,129, 1, 97,170,219,228,239,244,225,227, + 227,229,238,116,128, 30,103,229,228,233,236,236, 97,128, 1, 95, + 232,247, 97,131, 2, 89,170,252,171, 7,171, 26,227,249,242,233, + 236,236,233, 99,128, 4,217,228,233,229,242,229,243,233,243,227, + 249,242,233,236,236,233, 99,128, 4,219,232,239,239,107,128, 2, + 90,233,242, 99, 2,171, 41,171, 46,236,101,128, 36,226,245,237, + 230,236,229,120,128, 1, 93,239,237,237,225,225,227,227,229,238, + 116,128, 2, 25,228,239,116, 2,171, 76,171, 85,225,227,227,229, + 238,116,128, 30, 97,226,229,236,239,119,129, 30, 99,171, 95,228, + 239,244,225,227,227,229,238,116,128, 30,105,101, 9,171,127,171, + 143,171,178,171,243,172, 90,172,117,172,142,172,223,172,250,225, + 231,245,236,236,226,229,236,239,247,227,237, 98,128, 3, 60, 99, + 2,171,149,171,171,239,238,100,129, 32, 51,171,157,244,239,238, + 229,227,232,233,238,229,243,101,128, 2,202,244,233,239,110,128, + 0,167,229,110, 4,171,189,171,198,171,212,171,228,225,242,225, + 226,233, 99,128, 6, 51,230,233,238,225,236,225,242,225,226,233, + 99,128,254,178,233,238,233,244,233,225,236,225,242,225,226,233, + 99,128,254,179,237,229,228,233,225,236,225,242,225,226,233, 99, + 128,254,180,231,239,108,135, 5,182,172, 7,172, 21,172, 26,172, + 35,172, 50,172, 66,172, 77, 49, 2,172, 13,172, 17, 51,128, 5, + 182,102,128, 5,182,178, 99,128, 5,182,232,229,226,242,229,119, + 128, 5,182,238,225,242,242,239,247,232,229,226,242,229,119,128, + 5,182,241,245,225,242,244,229,242,232,229,226,242,229,119,128, + 5,182,244,225,232,229,226,242,229,119,128, 5,146,247,233,228, + 229,232,229,226,242,229,119,128, 5,182,104, 2,172, 96,172,107, + 225,242,237,229,238,233,225,110,128, 5,125,233,242,225,231,225, + 238, 97,128, 48, 91,235,225,244,225,235,225,238, 97,129, 48,187, + 172,130,232,225,236,230,247,233,228,244,104,128,255,126,237,105, + 2,172,149,172,192,227,239,236,239,110,131, 0, 59,172,163,172, + 172,172,184,225,242,225,226,233, 99,128, 6, 27,237,239,238,239, + 243,240,225,227,101,128,255, 27,243,237,225,236,108,128,254, 84, + 246,239,233,227,229,228,237,225,242,235,235,225,238, 97,129, 48, + 156,172,211,232,225,236,230,247,233,228,244,104,128,255,159,238, + 116, 2,172,230,172,240,233,243,241,245,225,242,101,128, 51, 34, + 239,243,241,245,225,242,101,128, 51, 35,246,229,110,142, 0, 55, + 173, 28,173, 37,173, 47,173, 77,173, 84,173, 94,173,119,173,146, + 173,180,173,192,173,203,173,236,173,244,173,255,225,242,225,226, + 233, 99,128, 6,103,226,229,238,231,225,236,105,128, 9,237,227, + 233,242,227,236,101,129, 36,102,173, 58,233,238,246,229,242,243, + 229,243,225,238,243,243,229,242,233,102,128, 39,144,228,229,246, + 97,128, 9,109,229,233,231,232,244,232,115,128, 33, 94,231,117, + 2,173,101,173,110,234,225,242,225,244,105,128, 10,237,242,237, + 245,235,232,105,128, 10,109,232, 97, 2,173,126,173,137,227,235, + 225,242,225,226,233, 99,128, 6,103,238,231,250,232,239,117,128, + 48, 39,105, 2,173,152,173,170,228,229,239,231,242,225,240,232, + 233,227,240,225,242,229,110,128, 50, 38,238,230,229,242,233,239, + 114,128, 32,135,237,239,238,239,243,240,225,227,101,128,255, 23, + 239,236,228,243,244,249,236,101,128,247, 55,112, 2,173,209,173, + 216,225,242,229,110,128, 36,122,229,114, 2,173,223,173,229,233, + 239,100,128, 36,142,243,233,225,110,128, 6,247,242,239,237,225, + 110,128, 33,118,243,245,240,229,242,233,239,114,128, 32,119,116, + 2,174, 5,174, 43,229,229,110, 2,174, 13,174, 22,227,233,242, + 227,236,101,128, 36,112,112, 2,174, 28,174, 35,225,242,229,110, + 128, 36,132,229,242,233,239,100,128, 36,152,232,225,105,128, 14, + 87,230,244,232,249,240,232,229,110,128, 0,173,104, 7,174, 76, + 175, 50,175, 61,175, 75,176, 20,176, 33,176,197, 97, 6,174, 90, + 174,101,174,111,174,122,175, 9,175, 34,225,242,237,229,238,233, + 225,110,128, 5,119,226,229,238,231,225,236,105,128, 9,182,227, + 249,242,233,236,236,233, 99,128, 4, 72,100, 2,174,128,174,224, + 228, 97, 4,174,139,174,148,174,179,174,193,225,242,225,226,233, + 99,128, 6, 81,228,225,237,237, 97, 2,174,158,174,167,225,242, + 225,226,233, 99,128,252, 97,244,225,238,225,242,225,226,233, 99, + 128,252, 94,230,225,244,232,225,225,242,225,226,233, 99,128,252, + 96,235,225,243,242, 97, 2,174,203,174,212,225,242,225,226,233, + 99,128,252, 98,244,225,238,225,242,225,226,233, 99,128,252, 95, + 101,132, 37,146,174,236,174,243,174,251,175, 4,228,225,242,107, + 128, 37,147,236,233,231,232,116,128, 37,145,237,229,228,233,245, + 109,128, 37,146,246, 97,128, 9, 54,231,117, 2,175, 16,175, 25, + 234,225,242,225,244,105,128, 10,182,242,237,245,235,232,105,128, + 10, 54,236,243,232,229,236,229,244,232,229,226,242,229,119,128, + 5,147,226,239,240,239,237,239,230,111,128, 49, 21,227,232,225, + 227,249,242,233,236,236,233, 99,128, 4, 73,101, 4,175, 85,175, + 150,175,160,175,177,229,110, 4,175, 96,175,105,175,119,175,135, + 225,242,225,226,233, 99,128, 6, 52,230,233,238,225,236,225,242, + 225,226,233, 99,128,254,182,233,238,233,244,233,225,236,225,242, + 225,226,233, 99,128,254,183,237,229,228,233,225,236,225,242,225, + 226,233, 99,128,254,184,233,227,239,240,244,233, 99,128, 3,227, + 241,229,108,129, 32,170,175,168,232,229,226,242,229,119,128, 32, + 170,246, 97,134, 5,176,175,194,175,209,175,223,175,232,175,247, + 176, 7, 49, 2,175,200,175,205,177, 53,128, 5,176, 53,128, 5, + 176, 50, 2,175,215,175,219, 50,128, 5,176,101,128, 5,176,232, + 229,226,242,229,119,128, 5,176,238,225,242,242,239,247,232,229, + 226,242,229,119,128, 5,176,241,245,225,242,244,229,242,232,229, + 226,242,229,119,128, 5,176,247,233,228,229,232,229,226,242,229, + 119,128, 5,176,232,225,227,249,242,233,236,236,233, 99,128, 4, + 187,105, 2,176, 39,176, 50,237,225,227,239,240,244,233, 99,128, + 3,237,110,131, 5,233,176, 60,176,143,176,152,100, 2,176, 66, + 176,132,225,231,229,243,104,130,251, 73,176, 78,176, 87,232,229, + 226,242,229,119,128,251, 73,115, 2,176, 93,176,113,232,233,238, + 228,239,116,129,251, 44,176,104,232,229,226,242,229,119,128,251, + 44,233,238,228,239,116,129,251, 45,176,123,232,229,226,242,229, + 119,128,251, 45,239,244,232,229,226,242,229,119,128, 5,193,232, + 229,226,242,229,119,128, 5,233,115, 2,176,158,176,178,232,233, + 238,228,239,116,129,251, 42,176,169,232,229,226,242,229,119,128, + 251, 42,233,238,228,239,116,129,251, 43,176,188,232,229,226,242, + 229,119,128,251, 43,239,239,107,128, 2,130,105, 8,176,221,177, + 9,177, 20,177, 45,177, 75,177, 83,177, 96,178, 11,231,237, 97, + 131, 3,195,176,233,176,237,176,245, 49,128, 3,194,230,233,238, + 225,108,128, 3,194,236,245,238,225,244,229,243,249,237,226,239, + 236,231,242,229,229,107,128, 3,242,232,233,242,225,231,225,238, + 97,128, 48, 87,235,225,244,225,235,225,238, 97,129, 48,183,177, + 33,232,225,236,230,247,233,228,244,104,128,255,124,236,245,113, + 2,177, 53,177, 62,232,229,226,242,229,119,128, 5,189,236,229, + 230,244,232,229,226,242,229,119,128, 5,189,237,233,236,225,114, + 128, 34, 60,238,228,239,244,232,229,226,242,229,119,128, 5,194, + 239,115, 6,177,111,177,146,177,178,177,206,177,220,177,252, 97, + 2,177,117,177,132,227,233,242,227,236,229,235,239,242,229,225, + 110,128, 50,116,240,225,242,229,238,235,239,242,229,225,110,128, + 50, 20,227,105, 2,177,153,177,165,229,245,227,235,239,242,229, + 225,110,128, 49,126,242,227,236,229,235,239,242,229,225,110,128, + 50,102,107, 2,177,184,177,198,233,249,229,239,235,235,239,242, + 229,225,110,128, 49,122,239,242,229,225,110,128, 49, 69,238,233, + 229,245,238,235,239,242,229,225,110,128, 49,123,112, 2,177,226, + 177,239,225,242,229,238,235,239,242,229,225,110,128, 50, 6,233, + 229,245,240,235,239,242,229,225,110,128, 49,125,244,233,235,229, + 245,244,235,239,242,229,225,110,128, 49,124,120,141, 0, 54,178, + 41,178, 50,178, 60,178, 90,178, 97,178,122,178,149,178,183,178, + 195,178,206,178,239,178,247,179, 2,225,242,225,226,233, 99,128, + 6,102,226,229,238,231,225,236,105,128, 9,236,227,233,242,227, + 236,101,129, 36,101,178, 71,233,238,246,229,242,243,229,243,225, + 238,243,243,229,242,233,102,128, 39,143,228,229,246, 97,128, 9, + 108,231,117, 2,178,104,178,113,234,225,242,225,244,105,128, 10, + 236,242,237,245,235,232,105,128, 10,108,232, 97, 2,178,129,178, + 140,227,235,225,242,225,226,233, 99,128, 6,102,238,231,250,232, + 239,117,128, 48, 38,105, 2,178,155,178,173,228,229,239,231,242, + 225,240,232,233,227,240,225,242,229,110,128, 50, 37,238,230,229, + 242,233,239,114,128, 32,134,237,239,238,239,243,240,225,227,101, + 128,255, 22,239,236,228,243,244,249,236,101,128,247, 54,112, 2, + 178,212,178,219,225,242,229,110,128, 36,121,229,114, 2,178,226, + 178,232,233,239,100,128, 36,141,243,233,225,110,128, 6,246,242, + 239,237,225,110,128, 33,117,243,245,240,229,242,233,239,114,128, + 32,118,116, 2,179, 8,179, 79,229,229,110, 2,179, 16,179, 58, + 99, 2,179, 22,179, 30,233,242,227,236,101,128, 36,111,245,242, + 242,229,238,227,249,228,229,238,239,237,233,238,225,244,239,242, + 226,229,238,231,225,236,105,128, 9,249,112, 2,179, 64,179, 71, + 225,242,229,110,128, 36,131,229,242,233,239,100,128, 36,151,232, + 225,105,128, 14, 86,108, 2,179, 91,179,111,225,243,104,129, 0, + 47,179, 99,237,239,238,239,243,240,225,227,101,128,255, 15,239, + 238,103,129, 1,127,179,119,228,239,244,225,227,227,229,238,116, + 128, 30,155,109, 2,179,137,179,147,233,236,229,230,225,227,101, + 128, 38, 58,239,238,239,243,240,225,227,101,128,255, 83,111, 6, + 179,172,179,222,179,233,180, 2,180, 47,180, 58,102, 2,179,178, + 179,192,240,225,243,245,241,232,229,226,242,229,119,128, 5,195, + 116, 2,179,198,179,207,232,249,240,232,229,110,128, 0,173,243, + 233,231,238,227,249,242,233,236,236,233, 99,128, 4, 76,232,233, + 242,225,231,225,238, 97,128, 48, 93,235,225,244,225,235,225,238, + 97,129, 48,189,179,246,232,225,236,230,247,233,228,244,104,128, + 255,127,236,233,228,245,115, 2,180, 12,180, 29,236,239,238,231, + 239,246,229,242,236,225,249,227,237, 98,128, 3, 56,243,232,239, + 242,244,239,246,229,242,236,225,249,227,237, 98,128, 3, 55,242, + 245,243,233,244,232,225,105,128, 14, 41,115, 3,180, 66,180, 76, + 180, 84,225,236,225,244,232,225,105,128, 14, 40,239,244,232,225, + 105,128, 14, 11,245,225,244,232,225,105,128, 14, 42,240, 97, 3, + 180,102,180,122,180,154,227,101,129, 0, 32,180,109,232,225,227, + 235,225,242,225,226,233, 99,128, 0, 32,228,101,129, 38, 96,180, + 129,243,245,233,116, 2,180,138,180,146,226,236,225,227,107,128, + 38, 96,247,232,233,244,101,128, 38,100,242,229,110,128, 36,174, + 241,245,225,242,101, 11,180,188,180,199,180,213,180,238,180,255, + 181, 25,181, 40,181, 73,181,100,181,156,181,171,226,229,236,239, + 247,227,237, 98,128, 3, 59, 99, 2,180,205,180,209, 99,128, 51, + 196,109,128, 51,157,228,233,225,231,239,238,225,236,227,242,239, + 243,243,232,225,244,227,232,230,233,236,108,128, 37,169,232,239, + 242,233,250,239,238,244,225,236,230,233,236,108,128, 37,164,107, + 2,181, 5,181, 9,103,128, 51,143,109,129, 51,158,181, 15,227, + 225,240,233,244,225,108,128, 51,206,108, 2,181, 31,181, 35,110, + 128, 51,209,239,103,128, 51,210,109, 4,181, 50,181, 54,181, 59, + 181, 63,103,128, 51,142,233,108,128, 51,213,109,128, 51,156,243, + 241,245,225,242,229,100,128, 51,161,239,242,244,232,239,231,239, + 238,225,236,227,242,239,243,243,232,225,244,227,232,230,233,236, + 108,128, 37,166,245,240,240,229,114, 2,181,110,181,133,236,229, + 230,244,244,239,236,239,247,229,242,242,233,231,232,244,230,233, + 236,108,128, 37,167,242,233,231,232,244,244,239,236,239,247,229, + 242,236,229,230,244,230,233,236,108,128, 37,168,246,229,242,244, + 233,227,225,236,230,233,236,108,128, 37,165,247,232,233,244,229, + 247,233,244,232,243,237,225,236,236,226,236,225,227,107,128, 37, + 163,242,243,241,245,225,242,101,128, 51,219,115, 2,181,209,182, + 123, 97, 4,181,219,181,229,181,236,181,247,226,229,238,231,225, + 236,105,128, 9,183,228,229,246, 97,128, 9, 55,231,245,234,225, + 242,225,244,105,128, 10,183,238,103, 8,182, 10,182, 24,182, 38, + 182, 52,182, 67,182, 81,182, 95,182,108,227,233,229,245,227,235, + 239,242,229,225,110,128, 49, 73,232,233,229,245,232,235,239,242, + 229,225,110,128, 49,133,233,229,245,238,231,235,239,242,229,225, + 110,128, 49,128,235,233,249,229,239,235,235,239,242,229,225,110, + 128, 49, 50,238,233,229,245,238,235,239,242,229,225,110,128, 49, + 101,240,233,229,245,240,235,239,242,229,225,110,128, 49, 67,243, + 233,239,243,235,239,242,229,225,110,128, 49, 70,244,233,235,229, + 245,244,235,239,242,229,225,110,128, 49, 56,245,240,229,242,233, + 239,114,128,246,242,116, 2,182,139,182,162,229,242,236,233,238, + 103,129, 0,163,182,150,237,239,238,239,243,240,225,227,101,128, + 255,225,242,239,235,101, 2,182,171,182,188,236,239,238,231,239, + 246,229,242,236,225,249,227,237, 98,128, 3, 54,243,232,239,242, + 244,239,246,229,242,236,225,249,227,237, 98,128, 3, 53,117, 7, + 182,222,182,254,183, 20,183, 31,183, 72,183, 82,183, 86,226,243, + 229,116,130, 34,130,182,233,182,244,238,239,244,229,241,245,225, + 108,128, 34,138,239,242,229,241,245,225,108,128, 34,134, 99, 2, + 183, 4,183, 12,227,229,229,228,115,128, 34,123,232,244,232,225, + 116,128, 34, 11,232,233,242,225,231,225,238, 97,128, 48, 89,107, + 2,183, 37,183, 61,225,244,225,235,225,238, 97,129, 48,185,183, + 49,232,225,236,230,247,233,228,244,104,128,255,125,245,238,225, + 242,225,226,233, 99,128, 6, 82,237,237,225,244,233,239,110,128, + 34, 17,110,128, 38, 60,240,229,242,243,229,116,130, 34,131,183, + 99,183,110,238,239,244,229,241,245,225,108,128, 34,139,239,242, + 229,241,245,225,108,128, 34,135,246,243,241,245,225,242,101,128, + 51,220,249,239,245,247,225,229,242,225,243,241,245,225,242,101, + 128, 51,124,116,144, 0,116,183,183,184,192,184,213,185,100,185, + 140,187,188,191, 70,192,145,192,157,192,169,193,202,193,227,194, + 57,194,237,195,165,195,255, 97, 10,183,205,183,215,183,236,183, + 243,184, 12,184, 90,184,107,184,132,184,146,184,150,226,229,238, + 231,225,236,105,128, 9,164,227,107, 2,183,222,183,229,228,239, + 247,110,128, 34,164,236,229,230,116,128, 34,163,228,229,246, 97, + 128, 9, 36,231,117, 2,183,250,184, 3,234,225,242,225,244,105, + 128, 10,164,242,237,245,235,232,105,128, 10, 36,104, 4,184, 22, + 184, 31,184, 45,184, 75,225,242,225,226,233, 99,128, 6, 55,230, + 233,238,225,236,225,242,225,226,233, 99,128,254,194,105, 2,184, + 51,184, 66,238,233,244,233,225,236,225,242,225,226,233, 99,128, + 254,195,242,225,231,225,238, 97,128, 48, 95,237,229,228,233,225, + 236,225,242,225,226,233, 99,128,254,196,233,243,249,239,245,229, + 242,225,243,241,245,225,242,101,128, 51,125,235,225,244,225,235, + 225,238, 97,129, 48,191,184,120,232,225,236,230,247,233,228,244, + 104,128,255,128,244,247,229,229,236,225,242,225,226,233, 99,128, + 6, 64,117,128, 3,196,118,130, 5,234,184,158,184,183,228,225, + 231,229,115,129,251, 74,184,168,104,129,251, 74,184,174,232,229, + 226,242,229,119,128,251, 74,232,229,226,242,229,119,128, 5,234, + 98, 2,184,198,184,203,225,114,128, 1,103,239,240,239,237,239, + 230,111,128, 49, 10, 99, 6,184,227,184,234,184,241,184,250,185, + 60,185, 87,225,242,239,110,128, 1,101,227,245,242,108,128, 2, + 168,229,228,233,236,236, 97,128, 1, 99,232,229,104, 4,185, 6, + 185, 15,185, 29,185, 45,225,242,225,226,233, 99,128, 6,134,230, + 233,238,225,236,225,242,225,226,233, 99,128,251,123,233,238,233, + 244,233,225,236,225,242,225,226,233, 99,128,251,124,237,229,228, + 233,225,236,225,242,225,226,233, 99,128,251,125,233,242, 99, 2, + 185, 68,185, 73,236,101,128, 36,227,245,237,230,236,229,248,226, + 229,236,239,119,128, 30,113,239,237,237,225,225,227,227,229,238, + 116,128, 1, 99,100, 2,185,106,185,116,233,229,242,229,243,233, + 115,128, 30,151,239,116, 2,185,123,185,132,225,227,227,229,238, + 116,128, 30,107,226,229,236,239,119,128, 30,109,101, 9,185,160, + 185,171,185,191,186,201,186,226,187, 34,187,101,187,106,187,158, + 227,249,242,233,236,236,233, 99,128, 4, 66,228,229,243,227,229, + 238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,173,104, + 7,185,207,185,216,185,230,186, 14,186, 44,186, 85,186,183,225, + 242,225,226,233, 99,128, 6, 42,230,233,238,225,236,225,242,225, + 226,233, 99,128,254,150,232,225,232,105, 2,185,239,185,254,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,252,162,243,239, + 236,225,244,229,228,225,242,225,226,233, 99,128,252, 12,105, 2, + 186, 20,186, 35,238,233,244,233,225,236,225,242,225,226,233, 99, + 128,254,151,242,225,231,225,238, 97,128, 48,102,234,229,229,237, + 105, 2,186, 54,186, 69,238,233,244,233,225,236,225,242,225,226, + 233, 99,128,252,161,243,239,236,225,244,229,228,225,242,225,226, + 233, 99,128,252, 11,109, 2,186, 91,186,125,225,242,226,245,244, + 97, 2,186,102,186,111,225,242,225,226,233, 99,128, 6, 41,230, + 233,238,225,236,225,242,225,226,233, 99,128,254,148,101, 2,186, + 131,186,144,228,233,225,236,225,242,225,226,233, 99,128,254,152, + 229,237,105, 2,186,152,186,167,238,233,244,233,225,236,225,242, + 225,226,233, 99,128,252,164,243,239,236,225,244,229,228,225,242, + 225,226,233, 99,128,252, 14,238,239,239,238,230,233,238,225,236, + 225,242,225,226,233, 99,128,252,115,235,225,244,225,235,225,238, + 97,129, 48,198,186,214,232,225,236,230,247,233,228,244,104,128, + 255,131,108, 2,186,232,186,251,229,240,232,239,238,101,129, 33, + 33,186,243,226,236,225,227,107,128, 38, 14,233,243,232, 97, 2, + 187, 4,187, 19,231,229,228,239,236,225,232,229,226,242,229,119, + 128, 5,160,241,229,244,225,238,225,232,229,226,242,229,119,128, + 5,169,110, 4,187, 44,187, 53,187, 72,187, 93,227,233,242,227, + 236,101,128, 36,105,233,228,229,239,231,242,225,240,232,233,227, + 240,225,242,229,110,128, 50, 41,112, 2,187, 78,187, 85,225,242, + 229,110,128, 36,125,229,242,233,239,100,128, 36,145,242,239,237, + 225,110,128, 33,121,243,104,128, 2,167,116,131, 5,216,187,116, + 187,136,187,145,228,225,231,229,243,104,129,251, 56,187,127,232, + 229,226,242,229,119,128,251, 56,232,229,226,242,229,119,128, 5, + 216,243,229,227,249,242,233,236,236,233, 99,128, 4,181,246,233, + 114, 2,187,166,187,175,232,229,226,242,229,119,128, 5,155,236, + 229,230,244,232,229,226,242,229,119,128, 5,155,104, 6,187,202, + 188, 98,188,220,189, 96,190, 3,191, 60, 97, 5,187,214,187,224, + 187,231,188, 0,188, 29,226,229,238,231,225,236,105,128, 9,165, + 228,229,246, 97,128, 9, 37,231,117, 2,187,238,187,247,234,225, + 242,225,244,105,128, 10,165,242,237,245,235,232,105,128, 10, 37, + 108, 2,188, 6,188, 15,225,242,225,226,233, 99,128, 6, 48,230, + 233,238,225,236,225,242,225,226,233, 99,128,254,172,238,244,232, + 225,235,232,225,116, 3,188, 44,188, 75,188, 82,236,239,119, 2, + 188, 52,188, 63,236,229,230,244,244,232,225,105,128,248,152,242, + 233,231,232,244,244,232,225,105,128,248,151,244,232,225,105,128, + 14, 76,245,240,240,229,242,236,229,230,244,244,232,225,105,128, + 248,150,101, 3,188,106,188,170,188,193,104, 4,188,116,188,125, + 188,139,188,155,225,242,225,226,233, 99,128, 6, 43,230,233,238, + 225,236,225,242,225,226,233, 99,128,254,154,233,238,233,244,233, + 225,236,225,242,225,226,233, 99,128,254,155,237,229,228,233,225, + 236,225,242,225,226,233, 99,128,254,156,242,101, 2,188,177,188, + 186,229,248,233,243,244,115,128, 34, 3,230,239,242,101,128, 34, + 52,244, 97,130, 3,184,188,202,188,206, 49,128, 3,209,243,249, + 237,226,239,236,231,242,229,229,107,128, 3,209,105, 2,188,226, + 189, 56,229,245,244,104, 4,188,239,189, 18,189, 33,189, 42, 97, + 2,188,245,189, 4,227,233,242,227,236,229,235,239,242,229,225, + 110,128, 50,121,240,225,242,229,238,235,239,242,229,225,110,128, + 50, 25,227,233,242,227,236,229,235,239,242,229,225,110,128, 50, + 107,235,239,242,229,225,110,128, 49, 76,240,225,242,229,238,235, + 239,242,229,225,110,128, 50, 11,242,244,229,229,110, 2,189, 66, + 189, 75,227,233,242,227,236,101,128, 36,108,112, 2,189, 81,189, + 88,225,242,229,110,128, 36,128,229,242,233,239,100,128, 36,148, + 111, 6,189,110,189,127,189,132,189,146,189,151,189,204,238,225, + 238,231,237,239,238,244,232,239,244,232,225,105,128, 14, 17,239, + 107,128, 1,173,240,232,245,244,232,225,239,244,232,225,105,128, + 14, 18,242,110,128, 0,254,244,104, 3,189,160,189,184,189,194, + 97, 2,189,166,189,176,232,225,238,244,232,225,105,128, 14, 23, + 238,244,232,225,105,128, 14, 16,239,238,231,244,232,225,105,128, + 14, 24,245,238,231,244,232,225,105,128, 14, 22,245,243,225,238, + 100, 2,189,214,189,225,227,249,242,233,236,236,233, 99,128, 4, + 130,243,243,229,240,225,242,225,244,239,114, 2,189,240,189,249, + 225,242,225,226,233, 99,128, 6,108,240,229,242,243,233,225,110, + 128, 6,108,242,229,101,144, 0, 51,190, 41,190, 50,190, 60,190, + 90,190, 97,190,107,190,132,190,159,190,193,190,205,190,224,190, + 235,191, 12,191, 34,191, 42,191, 53,225,242,225,226,233, 99,128, + 6, 99,226,229,238,231,225,236,105,128, 9,233,227,233,242,227, + 236,101,129, 36, 98,190, 71,233,238,246,229,242,243,229,243,225, + 238,243,243,229,242,233,102,128, 39,140,228,229,246, 97,128, 9, + 105,229,233,231,232,244,232,115,128, 33, 92,231,117, 2,190,114, + 190,123,234,225,242,225,244,105,128, 10,233,242,237,245,235,232, + 105,128, 10,105,232, 97, 2,190,139,190,150,227,235,225,242,225, + 226,233, 99,128, 6, 99,238,231,250,232,239,117,128, 48, 35,105, + 2,190,165,190,183,228,229,239,231,242,225,240,232,233,227,240, + 225,242,229,110,128, 50, 34,238,230,229,242,233,239,114,128, 32, + 131,237,239,238,239,243,240,225,227,101,128,255, 19,238,245,237, + 229,242,225,244,239,242,226,229,238,231,225,236,105,128, 9,246, + 239,236,228,243,244,249,236,101,128,247, 51,112, 2,190,241,190, + 248,225,242,229,110,128, 36,118,229,114, 2,190,255,191, 5,233, + 239,100,128, 36,138,243,233,225,110,128, 6,243,241,245,225,242, + 244,229,242,115,129, 0,190,191, 25,229,237,228,225,243,104,128, + 246,222,242,239,237,225,110,128, 33,114,243,245,240,229,242,233, + 239,114,128, 0,179,244,232,225,105,128, 14, 83,250,243,241,245, + 225,242,101,128, 51,148,105, 7,191, 86,191, 97,191,212,192, 54, + 192, 66,192,115,192,132,232,233,242,225,231,225,238, 97,128, 48, + 97,107, 2,191,103,191,127,225,244,225,235,225,238, 97,129, 48, + 193,191,115,232,225,236,230,247,233,228,244,104,128,255,129,229, + 245,116, 4,191,139,191,174,191,189,191,198, 97, 2,191,145,191, + 160,227,233,242,227,236,229,235,239,242,229,225,110,128, 50,112, + 240,225,242,229,238,235,239,242,229,225,110,128, 50, 16,227,233, + 242,227,236,229,235,239,242,229,225,110,128, 50, 98,235,239,242, + 229,225,110,128, 49, 55,240,225,242,229,238,235,239,242,229,225, + 110,128, 50, 2,236,228,101,133, 2,220,191,228,191,239,192, 0, + 192, 12,192, 40,226,229,236,239,247,227,237, 98,128, 3, 48, 99, + 2,191,245,191,250,237, 98,128, 3, 3,239,237, 98,128, 3, 3, + 228,239,245,226,236,229,227,237, 98,128, 3, 96,111, 2,192, 18, + 192, 28,240,229,242,225,244,239,114,128, 34, 60,246,229,242,236, + 225,249,227,237, 98,128, 3, 52,246,229,242,244,233,227,225,236, + 227,237, 98,128, 3, 62,237,229,243,227,233,242,227,236,101,128, + 34,151,112, 2,192, 72,192,102,229,232, 97, 2,192, 80,192, 89, + 232,229,226,242,229,119,128, 5,150,236,229,230,244,232,229,226, + 242,229,119,128, 5,150,240,233,231,245,242,237,245,235,232,105, + 128, 10,112,244,236,239,227,249,242,233,236,236,233,227,227,237, + 98,128, 4,131,247,238,225,242,237,229,238,233,225,110,128, 5, + 127,236,233,238,229,226,229,236,239,119,128, 30,111,237,239,238, + 239,243,240,225,227,101,128,255, 84,111, 7,192,185,192,196,192, + 207,192,232,193, 96,193,108,193,192,225,242,237,229,238,233,225, + 110,128, 5,105,232,233,242,225,231,225,238, 97,128, 48,104,235, + 225,244,225,235,225,238, 97,129, 48,200,192,220,232,225,236,230, + 247,233,228,244,104,128,255,132,110, 3,192,240,193, 82,193, 87, + 101, 4,192,250,193, 63,193, 70,193, 76,226,225,114, 4,193, 6, + 193, 35,193, 45,193, 54,229,248,244,242, 97, 2,193, 16,193, 26, + 232,233,231,232,237,239,100,128, 2,229,236,239,247,237,239,100, + 128, 2,233,232,233,231,232,237,239,100,128, 2,230,236,239,247, + 237,239,100,128, 2,232,237,233,228,237,239,100,128, 2,231,230, + 233,246,101,128, 1,189,243,233,120,128, 1,133,244,247,111,128, + 1,168,239,115,128, 3,132,243,241,245,225,242,101,128, 51, 39, + 240,225,244,225,235,244,232,225,105,128, 14, 15,242,244,239,233, + 243,229,243,232,229,236,236,226,242,225,227,235,229,116, 2,193, + 131,193,161,236,229,230,116,130, 48, 20,193,142,193,150,243,237, + 225,236,108,128,254, 93,246,229,242,244,233,227,225,108,128,254, + 57,242,233,231,232,116,130, 48, 21,193,173,193,181,243,237,225, + 236,108,128,254, 94,246,229,242,244,233,227,225,108,128,254, 58, + 244,225,239,244,232,225,105,128, 14, 21,240, 97, 2,193,209,193, + 221,236,225,244,225,236,232,239,239,107,128, 1,171,242,229,110, + 128, 36,175,114, 3,193,235,194, 10,194, 25,225,228,229,237,225, + 242,107,129, 33, 34,193,247,115, 2,193,253,194, 3,225,238,115, + 128,248,234,229,242,233,102,128,246,219,229,244,242,239,230,236, + 229,248,232,239,239,107,128, 2,136,233,225,103, 4,194, 37,194, + 42,194, 47,194, 52,228,110,128, 37,188,236,102,128, 37,196,242, + 116,128, 37,186,245,112,128, 37,178,115,132, 2,166,194, 69,194, + 108,194,214,194,227,225,228,105,130, 5,230,194, 79,194, 99,228, + 225,231,229,243,104,129,251, 70,194, 90,232,229,226,242,229,119, + 128,251, 70,232,229,226,242,229,119,128, 5,230,101, 2,194,114, + 194,125,227,249,242,233,236,236,233, 99,128, 4, 70,242,101,134, + 5,181,194,142,194,156,194,161,194,170,194,185,194,201, 49, 2, + 194,148,194,152, 50,128, 5,181,101,128, 5,181,178, 98,128, 5, + 181,232,229,226,242,229,119,128, 5,181,238,225,242,242,239,247, + 232,229,226,242,229,119,128, 5,181,241,245,225,242,244,229,242, + 232,229,226,242,229,119,128, 5,181,247,233,228,229,232,229,226, + 242,229,119,128, 5,181,232,229,227,249,242,233,236,236,233, 99, + 128, 4, 91,245,240,229,242,233,239,114,128,246,243,116, 4,194, + 247,195, 41,195,106,195,157, 97, 3,194,255,195, 9,195, 16,226, + 229,238,231,225,236,105,128, 9,159,228,229,246, 97,128, 9, 31, + 231,117, 2,195, 23,195, 32,234,225,242,225,244,105,128, 10,159, + 242,237,245,235,232,105,128, 10, 31,229,104, 4,195, 52,195, 61, + 195, 75,195, 91,225,242,225,226,233, 99,128, 6,121,230,233,238, + 225,236,225,242,225,226,233, 99,128,251,103,233,238,233,244,233, + 225,236,225,242,225,226,233, 99,128,251,104,237,229,228,233,225, + 236,225,242,225,226,233, 99,128,251,105,232, 97, 3,195,115,195, + 125,195,132,226,229,238,231,225,236,105,128, 9,160,228,229,246, + 97,128, 9, 32,231,117, 2,195,139,195,148,234,225,242,225,244, + 105,128, 10,160,242,237,245,235,232,105,128, 10, 32,245,242,238, + 229,100,128, 2,135,117, 3,195,173,195,184,195,209,232,233,242, + 225,231,225,238, 97,128, 48,100,235,225,244,225,235,225,238, 97, + 129, 48,196,195,197,232,225,236,230,247,233,228,244,104,128,255, + 130,243,237,225,236,108, 2,195,219,195,230,232,233,242,225,231, + 225,238, 97,128, 48, 99,235,225,244,225,235,225,238, 97,129, 48, + 195,195,243,232,225,236,230,247,233,228,244,104,128,255,111,119, + 2,196, 5,196,110,101, 2,196, 11,196, 59,236,246,101, 3,196, + 21,196, 30,196, 51,227,233,242,227,236,101,128, 36,107,112, 2, + 196, 36,196, 43,225,242,229,110,128, 36,127,229,242,233,239,100, + 128, 36,147,242,239,237,225,110,128, 33,123,238,244,121, 3,196, + 69,196, 78,196, 89,227,233,242,227,236,101,128, 36,115,232,225, + 238,231,250,232,239,117,128, 83, 68,112, 2,196, 95,196,102,225, + 242,229,110,128, 36,135,229,242,233,239,100,128, 36,155,111,142, + 0, 50,196,142,196,151,196,161,196,191,196,243,197, 12,197, 39, + 197, 73,197, 85,197,104,197,115,197,148,197,156,197,180,225,242, + 225,226,233, 99,128, 6, 98,226,229,238,231,225,236,105,128, 9, + 232,227,233,242,227,236,101,129, 36, 97,196,172,233,238,246,229, + 242,243,229,243,225,238,243,243,229,242,233,102,128, 39,139,100, + 2,196,197,196,203,229,246, 97,128, 9,104,239,116, 2,196,210, + 196,221,229,238,236,229,225,228,229,114,128, 32, 37,236,229,225, + 228,229,114,129, 32, 37,196,232,246,229,242,244,233,227,225,108, + 128,254, 48,231,117, 2,196,250,197, 3,234,225,242,225,244,105, + 128, 10,232,242,237,245,235,232,105,128, 10,104,232, 97, 2,197, + 19,197, 30,227,235,225,242,225,226,233, 99,128, 6, 98,238,231, + 250,232,239,117,128, 48, 34,105, 2,197, 45,197, 63,228,229,239, + 231,242,225,240,232,233,227,240,225,242,229,110,128, 50, 33,238, + 230,229,242,233,239,114,128, 32,130,237,239,238,239,243,240,225, + 227,101,128,255, 18,238,245,237,229,242,225,244,239,242,226,229, + 238,231,225,236,105,128, 9,245,239,236,228,243,244,249,236,101, + 128,247, 50,112, 2,197,121,197,128,225,242,229,110,128, 36,117, + 229,114, 2,197,135,197,141,233,239,100,128, 36,137,243,233,225, + 110,128, 6,242,242,239,237,225,110,128, 33,113,115, 2,197,162, + 197,170,244,242,239,235,101,128, 1,187,245,240,229,242,233,239, + 114,128, 0,178,244,104, 2,197,187,197,192,225,105,128, 14, 82, + 233,242,228,115,128, 33, 84,117,145, 0,117,197,237,197,245,198, + 30,198, 87,198,225,199, 6,199,129,199,145,199,196,200, 10,200, + 91,200,100,200,219,200,243,201, 95,201,123,201,237,225,227,245, + 244,101,128, 0,250, 98, 4,197,255,198, 4,198, 13,198, 23,225, + 114,128, 2,137,229,238,231,225,236,105,128, 9,137,239,240,239, + 237,239,230,111,128, 49, 40,242,229,246,101,128, 1,109, 99, 3, + 198, 38,198, 45,198, 77,225,242,239,110,128, 1,212,233,242, 99, + 2,198, 53,198, 58,236,101,128, 36,228,245,237,230,236,229,120, + 129, 0,251,198, 69,226,229,236,239,119,128, 30,119,249,242,233, + 236,236,233, 99,128, 4, 67,100, 5,198, 99,198,110,198,133,198, + 139,198,215,225,244,244,225,228,229,246, 97,128, 9, 81,226,108, + 2,198,117,198,125,225,227,245,244,101,128, 1,113,231,242,225, + 246,101,128, 2, 21,229,246, 97,128, 9, 9,233,229,242,229,243, + 233,115,133, 0,252,198,159,198,167,198,175,198,198,198,206,225, + 227,245,244,101,128, 1,216,226,229,236,239,119,128, 30,115, 99, + 2,198,181,198,188,225,242,239,110,128, 1,218,249,242,233,236, + 236,233, 99,128, 4,241,231,242,225,246,101,128, 1,220,237,225, + 227,242,239,110,128, 1,214,239,244,226,229,236,239,119,128, 30, + 229,103, 2,198,231,198,238,242,225,246,101,128, 0,249,117, 2, + 198,244,198,253,234,225,242,225,244,105,128, 10,137,242,237,245, + 235,232,105,128, 10, 9,104, 3,199, 14,199, 24,199,102,233,242, + 225,231,225,238, 97,128, 48, 70,111, 2,199, 30,199, 40,239,235, + 225,226,239,246,101,128, 30,231,242,110,133, 1,176,199, 55,199, + 63,199, 74,199, 82,199, 94,225,227,245,244,101,128, 30,233,228, + 239,244,226,229,236,239,119,128, 30,241,231,242,225,246,101,128, + 30,235,232,239,239,235,225,226,239,246,101,128, 30,237,244,233, + 236,228,101,128, 30,239,245,238,231,225,242,245,237,236,225,245, + 116,129, 1,113,199,118,227,249,242,233,236,236,233, 99,128, 4, + 243,233,238,246,229,242,244,229,228,226,242,229,246,101,128, 2, + 23,107, 3,199,153,199,177,199,188,225,244,225,235,225,238, 97, + 129, 48,166,199,165,232,225,236,230,247,233,228,244,104,128,255, + 115,227,249,242,233,236,236,233, 99,128, 4,121,239,242,229,225, + 110,128, 49, 92,109, 2,199,202,199,255, 97, 2,199,208,199,241, + 227,242,239,110,130, 1,107,199,219,199,230,227,249,242,233,236, + 236,233, 99,128, 4,239,228,233,229,242,229,243,233,115,128, 30, + 123,244,242,225,231,245,242,237,245,235,232,105,128, 10, 65,239, + 238,239,243,240,225,227,101,128,255, 85,110, 2,200, 16,200, 71, + 228,229,242,243,227,239,242,101,132, 0, 95,200, 35,200, 41,200, + 53,200, 64,228,226,108,128, 32, 23,237,239,238,239,243,240,225, + 227,101,128,255, 63,246,229,242,244,233,227,225,108,128,254, 51, + 247,225,246,121,128,254, 79,105, 2,200, 77,200, 82,239,110,128, + 34, 42,246,229,242,243,225,108,128, 34, 0,239,231,239,238,229, + 107,128, 1,115,112, 5,200,112,200,119,200,127,200,142,200,193, + 225,242,229,110,128, 36,176,226,236,239,227,107,128, 37,128,240, + 229,242,228,239,244,232,229,226,242,229,119,128, 5,196,243,233, + 236,239,110,131, 3,197,200,156,200,177,200,185,228,233,229,242, + 229,243,233,115,129, 3,203,200,169,244,239,238,239,115,128, 3, + 176,236,225,244,233,110,128, 2,138,244,239,238,239,115,128, 3, + 205,244,225,227,107, 2,200,202,200,213,226,229,236,239,247,227, + 237, 98,128, 3, 29,237,239,100,128, 2,212,114, 2,200,225,200, + 237,225,231,245,242,237,245,235,232,105,128, 10,115,233,238,103, + 128, 1,111,115, 3,200,251,201, 10,201, 55,232,239,242,244,227, + 249,242,233,236,236,233, 99,128, 4, 94,237,225,236,108, 2,201, + 19,201, 30,232,233,242,225,231,225,238, 97,128, 48, 69,235,225, + 244,225,235,225,238, 97,129, 48,165,201, 43,232,225,236,230,247, + 233,228,244,104,128,255,105,244,242,225,233,231,232,116, 2,201, + 67,201, 78,227,249,242,233,236,236,233, 99,128, 4,175,243,244, + 242,239,235,229,227,249,242,233,236,236,233, 99,128, 4,177,244, + 233,236,228,101,130, 1,105,201,107,201,115,225,227,245,244,101, + 128, 30,121,226,229,236,239,119,128, 30,117,117, 5,201,135,201, + 145,201,152,201,177,201,193,226,229,238,231,225,236,105,128, 9, + 138,228,229,246, 97,128, 9, 10,231,117, 2,201,159,201,168,234, + 225,242,225,244,105,128, 10,138,242,237,245,235,232,105,128, 10, + 10,237,225,244,242,225,231,245,242,237,245,235,232,105,128, 10, + 66,246,239,247,229,236,243,233,231,110, 3,201,209,201,219,201, + 226,226,229,238,231,225,236,105,128, 9,194,228,229,246, 97,128, + 9, 66,231,245,234,225,242,225,244,105,128, 10,194,246,239,247, + 229,236,243,233,231,110, 3,201,253,202, 7,202, 14,226,229,238, + 231,225,236,105,128, 9,193,228,229,246, 97,128, 9, 65,231,245, + 234,225,242,225,244,105,128, 10,193,118,139, 0,118,202, 51,202, + 199,202,208,202,219,203,148,203,155,203,253,204, 9,204,109,204, + 117,204,138, 97, 4,202, 61,202, 68,202, 93,202,104,228,229,246, + 97,128, 9, 53,231,117, 2,202, 75,202, 84,234,225,242,225,244, + 105,128, 10,181,242,237,245,235,232,105,128, 10, 53,235,225,244, + 225,235,225,238, 97,128, 48,247,118,132, 5,213,202,116,202,143, + 202,175,202,187,228,225,231,229,243,104,130,251, 53,202,129,202, + 134,182, 53,128,251, 53,232,229,226,242,229,119,128,251, 53,104, + 2,202,149,202,157,229,226,242,229,119,128, 5,213,239,236,225, + 109,129,251, 75,202,166,232,229,226,242,229,119,128,251, 75,246, + 225,246,232,229,226,242,229,119,128, 5,240,249,239,228,232,229, + 226,242,229,119,128, 5,241,227,233,242,227,236,101,128, 36,229, + 228,239,244,226,229,236,239,119,128, 30,127,101, 6,202,233,202, + 244,203, 52,203, 63,203, 69,203,136,227,249,242,233,236,236,233, + 99,128, 4, 50,104, 4,202,254,203, 7,203, 21,203, 37,225,242, + 225,226,233, 99,128, 6,164,230,233,238,225,236,225,242,225,226, + 233, 99,128,251,107,233,238,233,244,233,225,236,225,242,225,226, + 233, 99,128,251,108,237,229,228,233,225,236,225,242,225,226,233, + 99,128,251,109,235,225,244,225,235,225,238, 97,128, 48,249,238, + 245,115,128, 38, 64,242,244,233,227,225,108, 2,203, 80,203, 86, + 226,225,114,128, 0,124,236,233,238,101, 4,203, 99,203,110,203, + 121,203,130,225,226,239,246,229,227,237, 98,128, 3, 13,226,229, + 236,239,247,227,237, 98,128, 3, 41,236,239,247,237,239,100,128, + 2,204,237,239,100,128, 2,200,247,225,242,237,229,238,233,225, + 110,128, 5,126,232,239,239,107,128, 2,139,105, 3,203,163,203, + 174,203,213,235,225,244,225,235,225,238, 97,128, 48,248,242,225, + 237, 97, 3,203,185,203,195,203,202,226,229,238,231,225,236,105, + 128, 9,205,228,229,246, 97,128, 9, 77,231,245,234,225,242,225, + 244,105,128, 10,205,243,225,242,231, 97, 3,203,225,203,235,203, + 242,226,229,238,231,225,236,105,128, 9,131,228,229,246, 97,128, + 9, 3,231,245,234,225,242,225,244,105,128, 10,131,237,239,238, + 239,243,240,225,227,101,128,255, 86,111, 3,204, 17,204, 28,204, + 98,225,242,237,229,238,233,225,110,128, 5,120,233,227,229,100, + 2,204, 37,204, 73,233,244,229,242,225,244,233,239,110, 2,204, + 51,204, 62,232,233,242,225,231,225,238, 97,128, 48,158,235,225, + 244,225,235,225,238, 97,128, 48,254,237,225,242,235,235,225,238, + 97,129, 48,155,204, 86,232,225,236,230,247,233,228,244,104,128, + 255,158,235,225,244,225,235,225,238, 97,128, 48,250,240,225,242, + 229,110,128, 36,177,116, 2,204,123,204,130,233,236,228,101,128, + 30,125,245,242,238,229,100,128, 2,140,117, 2,204,144,204,155, + 232,233,242,225,231,225,238, 97,128, 48,148,235,225,244,225,235, + 225,238, 97,128, 48,244,119,143, 0,119,204,200,205,177,205,187, + 205,210,205,250,206, 61,206, 69,208, 40,208, 81,208, 93,208,168, + 208,176,208,183,208,194,208,203, 97, 8,204,218,204,225,204,235, + 204,246,205, 28,205, 60,205, 72,205,108,227,245,244,101,128, 30, + 131,229,235,239,242,229,225,110,128, 49, 89,232,233,242,225,231, + 225,238, 97,128, 48,143,107, 2,204,252,205, 20,225,244,225,235, + 225,238, 97,129, 48,239,205, 8,232,225,236,230,247,233,228,244, + 104,128,255,156,239,242,229,225,110,128, 49, 88,243,237,225,236, + 108, 2,205, 38,205, 49,232,233,242,225,231,225,238, 97,128, 48, + 142,235,225,244,225,235,225,238, 97,128, 48,238,244,244,239,243, + 241,245,225,242,101,128, 51, 87,118, 2,205, 78,205, 86,229,228, + 225,243,104,128, 48, 28,249,245,238,228,229,242,243,227,239,242, + 229,246,229,242,244,233,227,225,108,128,254, 52,119, 3,205,116, + 205,125,205,139,225,242,225,226,233, 99,128, 6, 72,230,233,238, + 225,236,225,242,225,226,233, 99,128,254,238,232,225,237,250,225, + 225,226,239,246,101, 2,205,154,205,163,225,242,225,226,233, 99, + 128, 6, 36,230,233,238,225,236,225,242,225,226,233, 99,128,254, + 134,226,243,241,245,225,242,101,128, 51,221,227,233,242, 99, 2, + 205,196,205,201,236,101,128, 36,230,245,237,230,236,229,120,128, + 1,117,100, 2,205,216,205,226,233,229,242,229,243,233,115,128, + 30,133,239,116, 2,205,233,205,242,225,227,227,229,238,116,128, + 30,135,226,229,236,239,119,128, 30,137,101, 4,206, 4,206, 15, + 206, 27,206, 51,232,233,242,225,231,225,238, 97,128, 48,145,233, + 229,242,243,244,242,225,243,115,128, 33, 24,107, 2,206, 33,206, + 43,225,244,225,235,225,238, 97,128, 48,241,239,242,229,225,110, + 128, 49, 94,239,235,239,242,229,225,110,128, 49, 93,231,242,225, + 246,101,128, 30,129,232,233,244,101, 8,206, 90,206, 99,206,183, + 207, 17,207,101,207,146,207,198,207,254,226,245,236,236,229,116, + 128, 37,230, 99, 2,206,105,206,125,233,242,227,236,101,129, 37, + 203,206,115,233,238,246,229,242,243,101,128, 37,217,239,242,238, + 229,242,226,242,225,227,235,229,116, 2,206,142,206,162,236,229, + 230,116,129, 48, 14,206,151,246,229,242,244,233,227,225,108,128, + 254, 67,242,233,231,232,116,129, 48, 15,206,172,246,229,242,244, + 233,227,225,108,128,254, 68,100, 2,206,189,206,230,233,225,237, + 239,238,100,129, 37,199,206,200,227,239,238,244,225,233,238,233, + 238,231,226,236,225,227,235,243,237,225,236,236,228,233,225,237, + 239,238,100,128, 37,200,239,247,238,240,239,233,238,244,233,238, + 103, 2,206,246,207, 6,243,237,225,236,236,244,242,233,225,238, + 231,236,101,128, 37,191,244,242,233,225,238,231,236,101,128, 37, + 189,236,101, 2,207, 24,207, 66,230,244,240,239,233,238,244,233, + 238,103, 2,207, 39,207, 55,243,237,225,236,236,244,242,233,225, + 238,231,236,101,128, 37,195,244,242,233,225,238,231,236,101,128, + 37,193,238,244,233,227,245,236,225,242,226,242,225,227,235,229, + 116, 2,207, 86,207, 93,236,229,230,116,128, 48, 22,242,233,231, + 232,116,128, 48, 23,242,233,231,232,244,240,239,233,238,244,233, + 238,103, 2,207,119,207,135,243,237,225,236,236,244,242,233,225, + 238,231,236,101,128, 37,185,244,242,233,225,238,231,236,101,128, + 37,183,115, 3,207,154,207,184,207,192,109, 2,207,160,207,172, + 225,236,236,243,241,245,225,242,101,128, 37,171,233,236,233,238, + 231,230,225,227,101,128, 38, 58,241,245,225,242,101,128, 37,161, + 244,225,114,128, 38, 6,116, 2,207,204,207,215,229,236,229,240, + 232,239,238,101,128, 38, 15,239,242,244,239,233,243,229,243,232, + 229,236,236,226,242,225,227,235,229,116, 2,207,239,207,246,236, + 229,230,116,128, 48, 24,242,233,231,232,116,128, 48, 25,245,240, + 240,239,233,238,244,233,238,103, 2,208, 13,208, 29,243,237,225, + 236,236,244,242,233,225,238,231,236,101,128, 37,181,244,242,233, + 225,238,231,236,101,128, 37,179,105, 2,208, 46,208, 57,232,233, + 242,225,231,225,238, 97,128, 48,144,107, 2,208, 63,208, 73,225, + 244,225,235,225,238, 97,128, 48,240,239,242,229,225,110,128, 49, + 95,237,239,238,239,243,240,225,227,101,128,255, 87,111, 4,208, + 103,208,114,208,139,208,157,232,233,242,225,231,225,238, 97,128, + 48,146,235,225,244,225,235,225,238, 97,129, 48,242,208,127,232, + 225,236,230,247,233,228,244,104,128,255,102,110,129, 32,169,208, + 145,237,239,238,239,243,240,225,227,101,128,255,230,247,225,229, + 238,244,232,225,105,128, 14, 39,240,225,242,229,110,128, 36,178, + 242,233,238,103,128, 30,152,243,245,240,229,242,233,239,114,128, + 2,183,244,245,242,238,229,100,128, 2,141,249,238,110,128, 1, + 191,120,137, 0,120,208,231,208,242,208,253,209, 6,209, 33,209, + 46,209, 50,209, 62,209, 70,225,226,239,246,229,227,237, 98,128, + 3, 61,226,239,240,239,237,239,230,111,128, 49, 18,227,233,242, + 227,236,101,128, 36,231,100, 2,209, 12,209, 22,233,229,242,229, + 243,233,115,128, 30,141,239,244,225,227,227,229,238,116,128, 30, + 139,229,232,225,242,237,229,238,233,225,110,128, 5,109,105,128, + 3,190,237,239,238,239,243,240,225,227,101,128,255, 88,240,225, + 242,229,110,128, 36,179,243,245,240,229,242,233,239,114,128, 2, + 227,121,143, 0,121,209,115,210, 74,210, 97,210,137,212,103,212, + 111,212,128,212,192,212,204,213,201,213,241,213,253,214, 8,214, + 29,215, 2, 97, 11,209,139,209,151,209,161,209,168,209,175,209, + 185,209,210,209,221,210, 3,210, 16,210, 62,225,228,239,243,241, + 245,225,242,101,128, 51, 78,226,229,238,231,225,236,105,128, 9, + 175,227,245,244,101,128, 0,253,228,229,246, 97,128, 9, 47,229, + 235,239,242,229,225,110,128, 49, 82,231,117, 2,209,192,209,201, + 234,225,242,225,244,105,128, 10,175,242,237,245,235,232,105,128, + 10, 47,232,233,242,225,231,225,238, 97,128, 48,132,107, 2,209, + 227,209,251,225,244,225,235,225,238, 97,129, 48,228,209,239,232, + 225,236,230,247,233,228,244,104,128,255,148,239,242,229,225,110, + 128, 49, 81,237,225,235,235,225,238,244,232,225,105,128, 14, 78, + 243,237,225,236,108, 2,210, 26,210, 37,232,233,242,225,231,225, + 238, 97,128, 48,131,235,225,244,225,235,225,238, 97,129, 48,227, + 210, 50,232,225,236,230,247,233,228,244,104,128,255,108,244,227, + 249,242,233,236,236,233, 99,128, 4, 99,227,233,242, 99, 2,210, + 83,210, 88,236,101,128, 36,232,245,237,230,236,229,120,128, 1, + 119,100, 2,210,103,210,113,233,229,242,229,243,233,115,128, 0, + 255,239,116, 2,210,120,210,129,225,227,227,229,238,116,128, 30, + 143,226,229,236,239,119,128, 30,245,101, 7,210,153,211,161,211, + 170,211,188,211,220,212, 40,212, 91,104, 8,210,171,210,180,210, + 214,210,228,211, 45,211, 61,211,120,211,138,225,242,225,226,233, + 99,128, 6, 74,226,225,242,242,229,101, 2,210,191,210,200,225, + 242,225,226,233, 99,128, 6,210,230,233,238,225,236,225,242,225, + 226,233, 99,128,251,175,230,233,238,225,236,225,242,225,226,233, + 99,128,254,242,232,225,237,250,225,225,226,239,246,101, 4,210, + 247,211, 0,211, 14,211, 30,225,242,225,226,233, 99,128, 6, 38, + 230,233,238,225,236,225,242,225,226,233, 99,128,254,138,233,238, + 233,244,233,225,236,225,242,225,226,233, 99,128,254,139,237,229, + 228,233,225,236,225,242,225,226,233, 99,128,254,140,233,238,233, + 244,233,225,236,225,242,225,226,233, 99,128,254,243,237,101, 2, + 211, 68,211, 81,228,233,225,236,225,242,225,226,233, 99,128,254, + 244,229,237,105, 2,211, 89,211,104,238,233,244,233,225,236,225, + 242,225,226,233, 99,128,252,221,243,239,236,225,244,229,228,225, + 242,225,226,233, 99,128,252, 88,238,239,239,238,230,233,238,225, + 236,225,242,225,226,233, 99,128,252,148,244,232,242,229,229,228, + 239,244,243,226,229,236,239,247,225,242,225,226,233, 99,128, 6, + 209,235,239,242,229,225,110,128, 49, 86,110,129, 0,165,211,176, + 237,239,238,239,243,240,225,227,101,128,255,229,111, 2,211,194, + 211,203,235,239,242,229,225,110,128, 49, 85,242,233,238,232,233, + 229,245,232,235,239,242,229,225,110,128, 49,134,114, 3,211,228, + 212, 8,212, 20,225,232,226,229,238,249,239,237,111, 2,211,242, + 211,251,232,229,226,242,229,119,128, 5,170,236,229,230,244,232, + 229,226,242,229,119,128, 5,170,233,227,249,242,233,236,236,233, + 99,128, 4, 75,245,228,233,229,242,229,243,233,243,227,249,242, + 233,236,236,233, 99,128, 4,249,243,233,229,245,238,103, 3,212, + 53,212, 62,212, 78,235,239,242,229,225,110,128, 49,129,240,225, + 238,243,233,239,243,235,239,242,229,225,110,128, 49,131,243,233, + 239,243,235,239,242,229,225,110,128, 49,130,244,233,246,232,229, + 226,242,229,119,128, 5,154,231,242,225,246,101,128, 30,243,232, + 239,239,107,129, 1,180,212,120,225,226,239,246,101,128, 30,247, + 105, 5,212,140,212,151,212,162,212,171,212,179,225,242,237,229, + 238,233,225,110,128, 5,117,227,249,242,233,236,236,233, 99,128, + 4, 87,235,239,242,229,225,110,128, 49, 98,238,249,225,238,103, + 128, 38, 47,247,238,225,242,237,229,238,233,225,110,128, 5,130, + 237,239,238,239,243,240,225,227,101,128,255, 89,111, 7,212,220, + 213, 34,213, 45,213, 55,213, 93,213,139,213,148,100,131, 5,217, + 212,230,212,250,213, 3,228,225,231,229,243,104,129,251, 57,212, + 241,232,229,226,242,229,119,128,251, 57,232,229,226,242,229,119, + 128, 5,217,249,239,100, 2,213, 11,213, 20,232,229,226,242,229, + 119,128, 5,242,240,225,244,225,232,232,229,226,242,229,119,128, + 251, 31,232,233,242,225,231,225,238, 97,128, 48,136,233,235,239, + 242,229,225,110,128, 49,137,107, 2,213, 61,213, 85,225,244,225, + 235,225,238, 97,129, 48,232,213, 73,232,225,236,230,247,233,228, + 244,104,128,255,150,239,242,229,225,110,128, 49, 91,243,237,225, + 236,108, 2,213,103,213,114,232,233,242,225,231,225,238, 97,128, + 48,135,235,225,244,225,235,225,238, 97,129, 48,231,213,127,232, + 225,236,230,247,233,228,244,104,128,255,110,244,231,242,229,229, + 107,128, 3,243,121, 2,213,154,213,191, 97, 2,213,160,213,170, + 229,235,239,242,229,225,110,128, 49,136,107, 2,213,176,213,184, + 239,242,229,225,110,128, 49,135,244,232,225,105,128, 14, 34,233, + 238,231,244,232,225,105,128, 14, 13,112, 2,213,207,213,214,225, + 242,229,110,128, 36,180,239,231,229,231,242,225,237,237,229,238, + 105,129, 3,122,213,230,231,242,229,229,235,227,237, 98,128, 3, + 69,114,129, 1,166,213,247,233,238,103,128, 30,153,243,245,240, + 229,242,233,239,114,128, 2,184,116, 2,214, 14,214, 21,233,236, + 228,101,128, 30,249,245,242,238,229,100,128, 2,142,117, 5,214, + 41,214, 52,214, 62,214,100,214,232,232,233,242,225,231,225,238, + 97,128, 48,134,233,235,239,242,229,225,110,128, 49,140,107, 2, + 214, 68,214, 92,225,244,225,235,225,238, 97,129, 48,230,214, 80, + 232,225,236,230,247,233,228,244,104,128,255,149,239,242,229,225, + 110,128, 49, 96,115, 3,214,108,214,146,214,187,226,233,103, 2, + 214,116,214,127,227,249,242,233,236,236,233, 99,128, 4,107,233, + 239,244,233,230,233,229,228,227,249,242,233,236,236,233, 99,128, + 4,109,236,233,244,244,236,101, 2,214,157,214,168,227,249,242, + 233,236,236,233, 99,128, 4,103,233,239,244,233,230,233,229,228, + 227,249,242,233,236,236,233, 99,128, 4,105,237,225,236,108, 2, + 214,196,214,207,232,233,242,225,231,225,238, 97,128, 48,133,235, + 225,244,225,235,225,238, 97,129, 48,229,214,220,232,225,236,230, + 247,233,228,244,104,128,255,109,249,101, 2,214,239,214,248,235, + 239,242,229,225,110,128, 49,139,239,235,239,242,229,225,110,128, + 49,138,249, 97, 2,215, 9,215, 19,226,229,238,231,225,236,105, + 128, 9,223,228,229,246, 97,128, 9, 95,122,142, 0,122,215, 58, + 216, 66,216, 77,216,120,216,147,217,182,218, 34,218, 76,218, 88, + 218,100,218,128,218,136,218,152,218,161, 97, 10,215, 80,215, 91, + 215, 98,215,105,215,116,215,194,215,224,215,235,216, 15,216, 27, + 225,242,237,229,238,233,225,110,128, 5,102,227,245,244,101,128, + 1,122,228,229,246, 97,128, 9, 91,231,245,242,237,245,235,232, + 105,128, 10, 91,104, 4,215,126,215,135,215,149,215,179,225,242, + 225,226,233, 99,128, 6, 56,230,233,238,225,236,225,242,225,226, + 233, 99,128,254,198,105, 2,215,155,215,170,238,233,244,233,225, + 236,225,242,225,226,233, 99,128,254,199,242,225,231,225,238, 97, + 128, 48, 86,237,229,228,233,225,236,225,242,225,226,233, 99,128, + 254,200,233,110, 2,215,201,215,210,225,242,225,226,233, 99,128, + 6, 50,230,233,238,225,236,225,242,225,226,233, 99,128,254,176, + 235,225,244,225,235,225,238, 97,128, 48,182,241,229,102, 2,215, + 243,216, 1,231,225,228,239,236,232,229,226,242,229,119,128, 5, + 149,241,225,244,225,238,232,229,226,242,229,119,128, 5,148,242, + 241,225,232,229,226,242,229,119,128, 5,152,249,233,110,130, 5, + 214,216, 37,216, 57,228,225,231,229,243,104,129,251, 54,216, 48, + 232,229,226,242,229,119,128,251, 54,232,229,226,242,229,119,128, + 5,214,226,239,240,239,237,239,230,111,128, 49, 23, 99, 3,216, + 85,216, 92,216,114,225,242,239,110,128, 1,126,233,242, 99, 2, + 216,100,216,105,236,101,128, 36,233,245,237,230,236,229,120,128, + 30,145,245,242,108,128, 2,145,228,239,116,130, 1,124,216,130, + 216,139,225,227,227,229,238,116,128, 1,124,226,229,236,239,119, + 128, 30,147,101, 6,216,161,216,172,216,215,216,226,216,237,217, + 177,227,249,242,233,236,236,233, 99,128, 4, 55,100, 2,216,178, + 216,197,229,243,227,229,238,228,229,242,227,249,242,233,236,236, + 233, 99,128, 4,153,233,229,242,229,243,233,243,227,249,242,233, + 236,236,233, 99,128, 4,223,232,233,242,225,231,225,238, 97,128, + 48, 92,235,225,244,225,235,225,238, 97,128, 48,188,242,111,140, + 0, 48,217, 10,217, 19,217, 29,217, 36,217, 61,217, 74,217, 85, + 217, 97,217,108,217,118,217,129,217,136,225,242,225,226,233, 99, + 128, 6, 96,226,229,238,231,225,236,105,128, 9,230,228,229,246, + 97,128, 9,102,231,117, 2,217, 43,217, 52,234,225,242,225,244, + 105,128, 10,230,242,237,245,235,232,105,128, 10,102,232,225,227, + 235,225,242,225,226,233, 99,128, 6, 96,233,238,230,229,242,233, + 239,114,128, 32,128,237,239,238,239,243,240,225,227,101,128,255, + 16,239,236,228,243,244,249,236,101,128,247, 48,240,229,242,243, + 233,225,110,128, 6,240,243,245,240,229,242,233,239,114,128, 32, + 112,244,232,225,105,128, 14, 80,247,233,228,244,104, 3,217,148, + 217,157,217,169,234,239,233,238,229,114,128,254,255,238,239,238, + 234,239,233,238,229,114,128, 32, 12,243,240,225,227,101,128, 32, + 11,244, 97,128, 3,182,104, 2,217,188,217,199,226,239,240,239, + 237,239,230,111,128, 49, 19,101, 4,217,209,217,220,217,236,217, + 247,225,242,237,229,238,233,225,110,128, 5,106,226,242,229,246, + 229,227,249,242,233,236,236,233, 99,128, 4,194,227,249,242,233, + 236,236,233, 99,128, 4, 54,100, 2,217,253,218, 16,229,243,227, + 229,238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,151, 233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99,128, - 4,235,229,238,231,225,236,105,128, 9,147,239,240,239,237,239, - 230,111,128, 49, 27,242,229,246,101,128, 1, 79, 99, 3,139,100, - 139,173,139,252, 97, 2,139,106,139,167,238,228,242, 97, 3,139, - 117,139,124,139,135,228,229,246, 97,128, 9, 17,231,245,234,225, - 242,225,244,105,128, 10,145,246,239,247,229,236,243,233,231,110, - 2,139,149,139,156,228,229,246, 97,128, 9, 73,231,245,234,225, - 242,225,244,105,128, 10,201,242,239,110,128, 1,210,233,242, 99, - 2,139,181,139,186,236,101,128, 36,222,245,237,230,236,229,120, - 133, 0,244,139,205,139,213,139,224,139,232,139,244,225,227,245, - 244,101,128, 30,209,228,239,244,226,229,236,239,119,128, 30,217, - 231,242,225,246,101,128, 30,211,232,239,239,235,225,226,239,246, - 101,128, 30,213,244,233,236,228,101,128, 30,215,249,242,233,236, - 236,233, 99,128, 4, 62,100, 4,140, 16,140, 39,140, 45,140, 68, - 226,108, 2,140, 23,140, 31,225,227,245,244,101,128, 1, 81,231, - 242,225,246,101,128, 2, 13,229,246, 97,128, 9, 19,233,229,242, - 229,243,233,115,129, 0,246,140, 57,227,249,242,233,236,236,233, - 99,128, 4,231,239,244,226,229,236,239,119,128, 30,205,101,129, - 1, 83,140, 84,235,239,242,229,225,110,128, 49, 90,103, 3,140, - 101,140,116,140,123,239,238,229,107,129, 2,219,140,110,227,237, - 98,128, 3, 40,242,225,246,101,128, 0,242,245,234,225,242,225, - 244,105,128, 10,147,104, 4,140,143,140,154,140,164,140,242,225, - 242,237,229,238,233,225,110,128, 5,133,233,242,225,231,225,238, - 97,128, 48, 74,111, 2,140,170,140,180,239,235,225,226,239,246, - 101,128, 30,207,242,110,133, 1,161,140,195,140,203,140,214,140, - 222,140,234,225,227,245,244,101,128, 30,219,228,239,244,226,229, - 236,239,119,128, 30,227,231,242,225,246,101,128, 30,221,232,239, - 239,235,225,226,239,246,101,128, 30,223,244,233,236,228,101,128, - 30,225,245,238,231,225,242,245,237,236,225,245,116,128, 1, 81, - 105,129, 1,163,141, 6,238,246,229,242,244,229,228,226,242,229, - 246,101,128, 2, 15,107, 2,141, 27,141, 51,225,244,225,235,225, - 238, 97,129, 48,170,141, 39,232,225,236,230,247,233,228,244,104, - 128,255,117,239,242,229,225,110,128, 49, 87,236,229,232,229,226, - 242,229,119,128, 5,171,109, 6,141, 84,141,112,141,119,141,208, - 141,219,141,237,225,227,242,239,110,130, 1, 77,141, 96,141,104, - 225,227,245,244,101,128, 30, 83,231,242,225,246,101,128, 30, 81, - 228,229,246, 97,128, 9, 80,229,231, 97,133, 3,201,141,135,141, - 139,141,150,141,164,141,180, 49,128, 3,214,227,249,242,233,236, - 236,233, 99,128, 4, 97,236,225,244,233,238,227,236,239,243,229, - 100,128, 2,119,242,239,245,238,228,227,249,242,233,236,236,233, - 99,128, 4,123,116, 2,141,186,141,201,233,244,236,239,227,249, - 242,233,236,236,233, 99,128, 4,125,239,238,239,115,128, 3,206, - 231,245,234,225,242,225,244,105,128, 10,208,233,227,242,239,110, - 129, 3,191,141,229,244,239,238,239,115,128, 3,204,239,238,239, - 243,240,225,227,101,128,255, 79,238,101,145, 0, 49,142, 31,142, - 40,142, 50,142, 80,142,105,142,114,142,123,142,148,142,182,142, - 216,142,228,142,247,143, 2,143, 35,143, 45,143, 53,143, 64,225, - 242,225,226,233, 99,128, 6, 97,226,229,238,231,225,236,105,128, - 9,231,227,233,242,227,236,101,129, 36, 96,142, 61,233,238,246, - 229,242,243,229,243,225,238,243,243,229,242,233,102,128, 39,138, - 100, 2,142, 86,142, 92,229,246, 97,128, 9,103,239,244,229,238, - 236,229,225,228,229,114,128, 32, 36,229,233,231,232,244,104,128, - 33, 91,230,233,244,244,229,100,128,246,220,231,117, 2,142,130, - 142,139,234,225,242,225,244,105,128, 10,231,242,237,245,235,232, - 105,128, 10,103,232, 97, 3,142,157,142,168,142,173,227,235,225, - 242,225,226,233, 99,128, 6, 97,236,102,128, 0,189,238,231,250, - 232,239,117,128, 48, 33,105, 2,142,188,142,206,228,229,239,231, - 242,225,240,232,233,227,240,225,242,229,110,128, 50, 32,238,230, - 229,242,233,239,114,128, 32,129,237,239,238,239,243,240,225,227, - 101,128,255, 17,238,245,237,229,242,225,244,239,242,226,229,238, - 231,225,236,105,128, 9,244,239,236,228,243,244,249,236,101,128, - 247, 49,112, 2,143, 8,143, 15,225,242,229,110,128, 36,116,229, - 114, 2,143, 22,143, 28,233,239,100,128, 36,136,243,233,225,110, - 128, 6,241,241,245,225,242,244,229,114,128, 0,188,242,239,237, - 225,110,128, 33,112,243,245,240,229,242,233,239,114,128, 0,185, - 244,104, 2,143, 71,143, 76,225,105,128, 14, 81,233,242,100,128, - 33, 83,111, 3,143, 90,143,124,143,140,103, 2,143, 96,143,114, - 239,238,229,107,129, 1,235,143,105,237,225,227,242,239,110,128, - 1,237,245,242,237,245,235,232,105,128, 10, 19,237,225,244,242, - 225,231,245,242,237,245,235,232,105,128, 10, 75,240,229,110,128, - 2, 84,112, 3,143,154,143,161,143,172,225,242,229,110,128, 36, - 170,229,238,226,245,236,236,229,116,128, 37,230,244,233,239,110, - 128, 35, 37,114, 2,143,185,143,214,100, 2,143,191,143,202,230, - 229,237,233,238,233,238,101,128, 0,170,237,225,243,227,245,236, - 233,238,101,128, 0,186,244,232,239,231,239,238,225,108,128, 34, - 31,115, 5,143,237,144, 13,144, 30,144, 75,144, 88,232,239,242, - 116, 2,143,246,143,253,228,229,246, 97,128, 9, 18,246,239,247, - 229,236,243,233,231,238,228,229,246, 97,128, 9, 74,236,225,243, - 104,129, 0,248,144, 22,225,227,245,244,101,128, 1,255,237,225, - 236,108, 2,144, 39,144, 50,232,233,242,225,231,225,238, 97,128, - 48, 73,235,225,244,225,235,225,238, 97,129, 48,169,144, 63,232, - 225,236,230,247,233,228,244,104,128,255,107,244,242,239,235,229, - 225,227,245,244,101,128, 1,255,245,240,229,242,233,239,114,128, - 246,240,116, 2,144,104,144,115,227,249,242,233,236,236,233, 99, - 128, 4,127,233,236,228,101,130, 0,245,144,126,144,134,225,227, - 245,244,101,128, 30, 77,228,233,229,242,229,243,233,115,128, 30, - 79,245,226,239,240,239,237,239,230,111,128, 49, 33,118, 2,144, - 163,144,244,229,114, 2,144,170,144,236,236,233,238,101,131, 32, - 62,144,183,144,206,144,229, 99, 2,144,189,144,201,229,238,244, - 229,242,236,233,238,101,128,254, 74,237, 98,128, 3, 5,100, 2, - 144,212,144,220,225,243,232,229,100,128,254, 73,226,236,247,225, - 246,121,128,254, 76,247,225,246,121,128,254, 75,243,227,239,242, - 101,128, 0,175,239,247,229,236,243,233,231,110, 3,145, 3,145, - 13,145, 20,226,229,238,231,225,236,105,128, 9,203,228,229,246, - 97,128, 9, 75,231,245,234,225,242,225,244,105,128, 10,203,112, - 145, 0,112,145, 69,147,197,147,208,147,217,147,229,149,154,149, - 164,150,156,151,175,152, 9,152, 35,152,166,152,174,153, 76,153, - 134,153,162,153,172, 97, 14,145, 99,145,131,145,141,145,148,145, - 155,145,203,145,214,145,228,145,239,146, 30,146, 44,147, 56,147, - 95,147,185, 97, 2,145,105,145,117,237,240,243,243,241,245,225, - 242,101,128, 51,128,243,229,238,244,239,243,241,245,225,242,101, - 128, 51, 43,226,229,238,231,225,236,105,128, 9,170,227,245,244, - 101,128, 30, 85,228,229,246, 97,128, 9, 42,103, 2,145,161,145, - 179,101, 2,145,167,145,174,228,239,247,110,128, 33,223,245,112, - 128, 33,222,117, 2,145,185,145,194,234,225,242,225,244,105,128, - 10,170,242,237,245,235,232,105,128, 10, 42,232,233,242,225,231, - 225,238, 97,128, 48,113,233,249,225,238,238,239,233,244,232,225, - 105,128, 14, 47,235,225,244,225,235,225,238, 97,128, 48,209,108, - 2,145,245,146, 14,225,244,225,236,233,250,225,244,233,239,238, - 227,249,242,233,236,236,233,227,227,237, 98,128, 4,132,239,227, - 232,235,225,227,249,242,233,236,236,233, 99,128, 4,192,238,243, - 233,239,243,235,239,242,229,225,110,128, 49,127,114, 3,146, 52, - 146, 73,147, 45, 97, 2,146, 58,146, 66,231,242,225,240,104,128, - 0,182,236,236,229,108,128, 34, 37,229,110, 2,146, 80,146,190, - 236,229,230,116,136, 0, 40,146,103,146,118,146,123,146,128,146, - 139,146,151,146,174,146,179,225,236,244,239,238,229,225,242,225, - 226,233, 99,128,253, 62,226,116,128,248,237,229,120,128,248,236, - 233,238,230,229,242,233,239,114,128, 32,141,237,239,238,239,243, - 240,225,227,101,128,255, 8,115, 2,146,157,146,164,237,225,236, - 108,128,254, 89,245,240,229,242,233,239,114,128, 32,125,244,112, - 128,248,235,246,229,242,244,233,227,225,108,128,254, 53,242,233, - 231,232,116,136, 0, 41,146,214,146,229,146,234,146,239,146,250, - 147, 6,147, 29,147, 34,225,236,244,239,238,229,225,242,225,226, - 233, 99,128,253, 63,226,116,128,248,248,229,120,128,248,247,233, - 238,230,229,242,233,239,114,128, 32,142,237,239,238,239,243,240, - 225,227,101,128,255, 9,115, 2,147, 12,147, 19,237,225,236,108, - 128,254, 90,245,240,229,242,233,239,114,128, 32,126,244,112,128, - 248,246,246,229,242,244,233,227,225,108,128,254, 54,244,233,225, - 236,228,233,230,102,128, 34, 2,115, 3,147, 64,147, 75,147, 87, - 229,241,232,229,226,242,229,119,128, 5,192,232,244,225,232,229, - 226,242,229,119,128, 5,153,241,245,225,242,101,128, 51,169,244, - 225,104,134, 5,183,147,113,147,127,147,132,147,141,147,156,147, - 172, 49, 2,147,119,147,123, 49,128, 5,183,100,128, 5,183,178, - 97,128, 5,183,232,229,226,242,229,119,128, 5,183,238,225,242, - 242,239,247,232,229,226,242,229,119,128, 5,183,241,245,225,242, - 244,229,242,232,229,226,242,229,119,128, 5,183,247,233,228,229, - 232,229,226,242,229,119,128, 5,183,250,229,242,232,229,226,242, - 229,119,128, 5,161,226,239,240,239,237,239,230,111,128, 49, 6, - 227,233,242,227,236,101,128, 36,223,228,239,244,225,227,227,229, - 238,116,128, 30, 87,101,137, 5,228,147,251,148, 6,148, 26,148, - 38,148, 58,148,160,148,171,148,192,149,147,227,249,242,233,236, - 236,233, 99,128, 4, 63,228,225,231,229,243,104,129,251, 68,148, - 17,232,229,226,242,229,119,128,251, 68,229,250,233,243,241,245, - 225,242,101,128, 51, 59,230,233,238,225,236,228,225,231,229,243, - 232,232,229,226,242,229,119,128,251, 67,104, 5,148, 70,148, 93, - 148,101,148,115,148,145,225,114, 2,148, 77,148, 84,225,226,233, - 99,128, 6,126,237,229,238,233,225,110,128, 5,122,229,226,242, - 229,119,128, 5,228,230,233,238,225,236,225,242,225,226,233, 99, - 128,251, 87,105, 2,148,121,148,136,238,233,244,233,225,236,225, - 242,225,226,233, 99,128,251, 88,242,225,231,225,238, 97,128, 48, - 122,237,229,228,233,225,236,225,242,225,226,233, 99,128,251, 89, - 235,225,244,225,235,225,238, 97,128, 48,218,237,233,228,228,236, - 229,232,239,239,235,227,249,242,233,236,236,233, 99,128, 4,167, - 114, 5,148,204,148,216,149, 2,149,123,149,136,225,230,229,232, - 229,226,242,229,119,128,251, 78,227,229,238,116,131, 0, 37,148, - 229,148,238,148,250,225,242,225,226,233, 99,128, 6,106,237,239, - 238,239,243,240,225,227,101,128,255, 5,243,237,225,236,108,128, - 254,106,105, 2,149, 8,149,105,239,100,134, 0, 46,149, 25,149, - 36,149, 47,149, 59,149, 70,149, 82,225,242,237,229,238,233,225, - 110,128, 5,137,227,229,238,244,229,242,229,100,128, 0,183,232, - 225,236,230,247,233,228,244,104,128,255, 97,233,238,230,229,242, - 233,239,114,128,246,231,237,239,238,239,243,240,225,227,101,128, - 255, 14,115, 2,149, 88,149, 95,237,225,236,108,128,254, 82,245, - 240,229,242,233,239,114,128,246,232,243,240,239,237,229,238,233, - 231,242,229,229,235,227,237, 98,128, 3, 66,240,229,238,228,233, - 227,245,236,225,114,128, 34,165,244,232,239,245,243,225,238,100, - 128, 32, 48,243,229,244, 97,128, 32,167,230,243,241,245,225,242, - 101,128, 51,138,104, 3,149,172,149,222,150,103, 97, 3,149,180, - 149,190,149,197,226,229,238,231,225,236,105,128, 9,171,228,229, - 246, 97,128, 9, 43,231,117, 2,149,204,149,213,234,225,242,225, - 244,105,128, 10,171,242,237,245,235,232,105,128, 10, 43,105,133, - 3,198,149,236,149,240,150, 70,150, 78,150, 89, 49,128, 3,213, - 229,245,240,104, 4,149,253,150, 32,150, 47,150, 56, 97, 2,150, - 3,150, 18,227,233,242,227,236,229,235,239,242,229,225,110,128, - 50,122,240,225,242,229,238,235,239,242,229,225,110,128, 50, 26, - 227,233,242,227,236,229,235,239,242,229,225,110,128, 50,108,235, - 239,242,229,225,110,128, 49, 77,240,225,242,229,238,235,239,242, - 229,225,110,128, 50, 12,236,225,244,233,110,128, 2,120,238,244, - 232,245,244,232,225,105,128, 14, 58,243,249,237,226,239,236,231, - 242,229,229,107,128, 3,213,111, 3,150,111,150,116,150,142,239, - 107,128, 1,165,240,104, 2,150,123,150,132,225,238,244,232,225, - 105,128, 14, 30,245,238,231,244,232,225,105,128, 14, 28,243,225, - 237,240,232,225,239,244,232,225,105,128, 14, 32,105,133, 3,192, - 150,170,151,126,151,137,151,148,151,162,229,245,112, 6,150,186, - 150,221,150,253,151, 25,151, 39,151, 91, 97, 2,150,192,150,207, - 227,233,242,227,236,229,235,239,242,229,225,110,128, 50,115,240, - 225,242,229,238,235,239,242,229,225,110,128, 50, 19,227,105, 2, - 150,228,150,240,229,245,227,235,239,242,229,225,110,128, 49,118, - 242,227,236,229,235,239,242,229,225,110,128, 50,101,107, 2,151, - 3,151, 17,233,249,229,239,235,235,239,242,229,225,110,128, 49, - 114,239,242,229,225,110,128, 49, 66,240,225,242,229,238,235,239, - 242,229,225,110,128, 50, 5,243,233,239,115, 2,151, 48,151, 76, - 107, 2,151, 54,151, 68,233,249,229,239,235,235,239,242,229,225, - 110,128, 49,116,239,242,229,225,110,128, 49, 68,244,233,235,229, - 245,244,235,239,242,229,225,110,128, 49,117,116, 2,151, 97,151, - 112,232,233,229,245,244,232,235,239,242,229,225,110,128, 49,119, - 233,235,229,245,244,235,239,242,229,225,110,128, 49,115,232,233, - 242,225,231,225,238, 97,128, 48,116,235,225,244,225,235,225,238, - 97,128, 48,212,243,249,237,226,239,236,231,242,229,229,107,128, - 3,214,247,242,225,242,237,229,238,233,225,110,128, 5,131,236, - 245,115,132, 0, 43,151,189,151,200,151,209,151,242,226,229,236, - 239,247,227,237, 98,128, 3, 31,227,233,242,227,236,101,128, 34, - 149,109, 2,151,215,151,222,233,238,245,115,128, 0,177,111, 2, - 151,228,151,232,100,128, 2,214,238,239,243,240,225,227,101,128, - 255, 11,115, 2,151,248,151,255,237,225,236,108,128,254, 98,245, - 240,229,242,233,239,114,128, 32,122,109, 2,152, 15,152, 26,239, - 238,239,243,240,225,227,101,128,255, 80,243,241,245,225,242,101, - 128, 51,216,111, 5,152, 47,152, 58,152,125,152,136,152,146,232, - 233,242,225,231,225,238, 97,128, 48,125,233,238,244,233,238,231, - 233,238,228,229,120, 4,152, 78,152, 90,152,102,152,115,228,239, - 247,238,247,232,233,244,101,128, 38, 31,236,229,230,244,247,232, - 233,244,101,128, 38, 28,242,233,231,232,244,247,232,233,244,101, - 128, 38, 30,245,240,247,232,233,244,101,128, 38, 29,235,225,244, - 225,235,225,238, 97,128, 48,221,240,236,225,244,232,225,105,128, - 14, 27,243,244,225,236,237,225,242,107,129, 48, 18,152,159,230, - 225,227,101,128, 48, 32,240,225,242,229,110,128, 36,171,114, 3, - 152,182,152,208,152,233,101, 2,152,188,152,196,227,229,228,229, - 115,128, 34,122,243,227,242,233,240,244,233,239,110,128, 33, 30, - 233,237,101, 2,152,216,152,222,237,239,100,128, 2,185,242,229, - 246,229,242,243,229,100,128, 32, 53,111, 4,152,243,152,250,153, - 4,153, 17,228,245,227,116,128, 34, 15,234,229,227,244,233,246, - 101,128, 35, 5,236,239,238,231,229,228,235,225,238, 97,128, 48, - 252,112, 2,153, 23,153, 60,101, 2,153, 29,153, 36,236,236,239, - 114,128, 35, 24,242,243,117, 2,153, 44,153, 51,226,243,229,116, - 128, 34,130,240,229,242,243,229,116,128, 34,131,239,242,244,233, - 239,110,129, 34, 55,153, 71,225,108,128, 34, 29,115, 2,153, 82, - 153,125,105,130, 3,200,153, 90,153,101,227,249,242,233,236,236, - 233, 99,128, 4,113,236,233,240,238,229,245,237,225,244,225,227, - 249,242,233,236,236,233,227,227,237, 98,128, 4,134,243,241,245, - 225,242,101,128, 51,176,117, 2,153,140,153,151,232,233,242,225, - 231,225,238, 97,128, 48,119,235,225,244,225,235,225,238, 97,128, - 48,215,246,243,241,245,225,242,101,128, 51,180,247,243,241,245, - 225,242,101,128, 51,186,113,136, 0,113,153,202,154,251,155, 6, - 155, 15,155, 22,155, 34,155, 72,155, 80, 97, 4,153,212,153,235, - 154, 43,154,234,100, 2,153,218,153,224,229,246, 97,128, 9, 88, - 237,225,232,229,226,242,229,119,128, 5,168,102, 4,153,245,153, - 254,154, 12,154, 28,225,242,225,226,233, 99,128, 6, 66,230,233, - 238,225,236,225,242,225,226,233, 99,128,254,214,233,238,233,244, - 233,225,236,225,242,225,226,233, 99,128,254,215,237,229,228,233, - 225,236,225,242,225,226,233, 99,128,254,216,237,225,244,115,136, - 5,184,154, 66,154, 86,154,100,154,105,154,110,154,119,154,134, - 154,221, 49, 3,154, 74,154, 78,154, 82, 48,128, 5,184, 97,128, - 5,184, 99,128, 5,184, 50, 2,154, 92,154, 96, 55,128, 5,184, - 57,128, 5,184,179, 51,128, 5,184,228,101,128, 5,184,232,229, - 226,242,229,119,128, 5,184,238,225,242,242,239,247,232,229,226, - 242,229,119,128, 5,184,113, 2,154,140,154,206,225,244,225,110, - 4,154,153,154,162,154,177,154,193,232,229,226,242,229,119,128, - 5,184,238,225,242,242,239,247,232,229,226,242,229,119,128, 5, - 184,241,245,225,242,244,229,242,232,229,226,242,229,119,128, 5, - 184,247,233,228,229,232,229,226,242,229,119,128, 5,184,245,225, - 242,244,229,242,232,229,226,242,229,119,128, 5,184,247,233,228, - 229,232,229,226,242,229,119,128, 5,184,242,238,229,249,240,225, - 242,225,232,229,226,242,229,119,128, 5,159,226,239,240,239,237, - 239,230,111,128, 49, 17,227,233,242,227,236,101,128, 36,224,232, - 239,239,107,128, 2,160,237,239,238,239,243,240,225,227,101,128, - 255, 81,239,102,130, 5,231,155, 43,155, 63,228,225,231,229,243, - 104,129,251, 71,155, 54,232,229,226,242,229,119,128,251, 71,232, - 229,226,242,229,119,128, 5,231,240,225,242,229,110,128, 36,172, - 117, 4,155, 90,155,102,155,191,156, 22,225,242,244,229,242,238, - 239,244,101,128, 38,105,226,245,244,115,135, 5,187,155,123,155, - 128,155,133,155,138,155,147,155,162,155,178,177, 56,128, 5,187, - 178, 53,128, 5,187,179, 49,128, 5,187,232,229,226,242,229,119, - 128, 5,187,238,225,242,242,239,247,232,229,226,242,229,119,128, - 5,187,241,245,225,242,244,229,242,232,229,226,242,229,119,128, - 5,187,247,233,228,229,232,229,226,242,229,119,128, 5,187,229, - 243,244,233,239,110,133, 0, 63,155,210,155,233,155,250,156, 2, - 156, 14,225,114, 2,155,217,155,224,225,226,233, 99,128, 6, 31, - 237,229,238,233,225,110,128, 5, 94,228,239,247,110,129, 0,191, - 155,242,243,237,225,236,108,128,247,191,231,242,229,229,107,128, - 3,126,237,239,238,239,243,240,225,227,101,128,255, 31,243,237, - 225,236,108,128,247, 63,239,244,101, 4,156, 34,156,105,156,125, - 156,154,228,226,108,133, 0, 34,156, 50,156, 57,156, 64,156, 76, - 156, 97,226,225,243,101,128, 32, 30,236,229,230,116,128, 32, 28, - 237,239,238,239,243,240,225,227,101,128,255, 2,240,242,233,237, - 101,129, 48, 30,156, 86,242,229,246,229,242,243,229,100,128, 48, - 29,242,233,231,232,116,128, 32, 29,236,229,230,116,129, 32, 24, - 156,114,242,229,246,229,242,243,229,100,128, 32, 27,114, 2,156, - 131,156,141,229,246,229,242,243,229,100,128, 32, 27,233,231,232, - 116,129, 32, 25,156,150,110,128, 1, 73,243,233,238,231,108, 2, - 156,164,156,171,226,225,243,101,128, 32, 26,101,129, 0, 39,156, - 177,237,239,238,239,243,240,225,227,101,128,255, 7,114,145, 0, - 114,156,227,157,231,157,242,158, 33,158, 84,159,101,159,125,159, - 220,161,254,162, 35,162, 47,162,101,162,109,163, 15,163, 26,163, - 61,163,161, 97, 11,156,251,157, 6,157, 16,157, 23,157, 88,157, - 104,157,129,157,140,157,165,157,188,157,225,225,242,237,229,238, - 233,225,110,128, 5,124,226,229,238,231,225,236,105,128, 9,176, - 227,245,244,101,128, 1, 85,100, 4,157, 33,157, 39,157, 53,157, - 79,229,246, 97,128, 9, 48,233,227,225,108,129, 34, 26,157, 48, - 229,120,128,248,229,239,246,229,242,243,243,241,245,225,242,101, - 129, 51,174,157, 69,228,243,241,245,225,242,101,128, 51,175,243, - 241,245,225,242,101,128, 51,173,230,101,129, 5,191,157, 95,232, - 229,226,242,229,119,128, 5,191,231,117, 2,157,111,157,120,234, - 225,242,225,244,105,128, 10,176,242,237,245,235,232,105,128, 10, - 48,232,233,242,225,231,225,238, 97,128, 48,137,235,225,244,225, - 235,225,238, 97,129, 48,233,157,153,232,225,236,230,247,233,228, - 244,104,128,255,151,236,239,247,229,242,228,233,225,231,239,238, - 225,236,226,229,238,231,225,236,105,128, 9,241,109, 2,157,194, - 157,217,233,228,228,236,229,228,233,225,231,239,238,225,236,226, - 229,238,231,225,236,105,128, 9,240,243,232,239,242,110,128, 2, - 100,244,233,111,128, 34, 54,226,239,240,239,237,239,230,111,128, - 49, 22, 99, 4,157,252,158, 3,158, 12,158, 20,225,242,239,110, - 128, 1, 89,229,228,233,236,236, 97,128, 1, 87,233,242,227,236, - 101,128, 36,225,239,237,237,225,225,227,227,229,238,116,128, 1, - 87,100, 2,158, 39,158, 49,226,236,231,242,225,246,101,128, 2, - 17,239,116, 2,158, 56,158, 65,225,227,227,229,238,116,128, 30, - 89,226,229,236,239,119,129, 30, 91,158, 75,237,225,227,242,239, - 110,128, 30, 93,101, 6,158, 98,158,143,158,178,158,233,159, 2, - 159, 35,102, 2,158,104,158,117,229,242,229,238,227,229,237,225, - 242,107,128, 32, 59,236,229,248,243,117, 2,158,127,158,134,226, - 243,229,116,128, 34,134,240,229,242,243,229,116,128, 34,135,231, - 233,243,244,229,114, 2,158,154,158,159,229,100,128, 0,174,115, - 2,158,165,158,171,225,238,115,128,248,232,229,242,233,102,128, - 246,218,104, 3,158,186,158,209,158,223,225,114, 2,158,193,158, - 200,225,226,233, 99,128, 6, 49,237,229,238,233,225,110,128, 5, - 128,230,233,238,225,236,225,242,225,226,233, 99,128,254,174,233, - 242,225,231,225,238, 97,128, 48,140,235,225,244,225,235,225,238, - 97,129, 48,236,158,246,232,225,236,230,247,233,228,244,104,128, - 255,154,243,104,130, 5,232,159, 11,159, 26,228,225,231,229,243, - 232,232,229,226,242,229,119,128,251, 72,232,229,226,242,229,119, - 128, 5,232,118, 3,159, 43,159, 56,159, 88,229,242,243,229,228, - 244,233,236,228,101,128, 34, 61,233, 97, 2,159, 63,159, 72,232, - 229,226,242,229,119,128, 5,151,237,245,231,242,225,243,232,232, - 229,226,242,229,119,128, 5,151,236,239,231,233,227,225,236,238, - 239,116,128, 35, 16,230,233,243,232,232,239,239,107,129, 2,126, - 159,114,242,229,246,229,242,243,229,100,128, 2,127,104, 2,159, - 131,159,154, 97, 2,159,137,159,147,226,229,238,231,225,236,105, - 128, 9,221,228,229,246, 97,128, 9, 93,111,131, 3,193,159,164, - 159,193,159,207,239,107,129, 2,125,159,171,244,245,242,238,229, - 100,129, 2,123,159,182,243,245,240,229,242,233,239,114,128, 2, - 181,243,249,237,226,239,236,231,242,229,229,107,128, 3,241,244, - 233,227,232,239,239,235,237,239,100,128, 2,222,105, 6,159,234, - 161, 22,161, 68,161, 79,161,104,161,240,229,245,108, 9,160, 0, - 160, 35,160, 50,160, 64,160,110,160,124,160,210,160,223,161, 2, - 97, 2,160, 6,160, 21,227,233,242,227,236,229,235,239,242,229, - 225,110,128, 50,113,240,225,242,229,238,235,239,242,229,225,110, - 128, 50, 17,227,233,242,227,236,229,235,239,242,229,225,110,128, - 50, 99,232,233,229,245,232,235,239,242,229,225,110,128, 49, 64, - 107, 2,160, 70,160,102,233,249,229,239,107, 2,160, 80,160, 89, - 235,239,242,229,225,110,128, 49, 58,243,233,239,243,235,239,242, - 229,225,110,128, 49,105,239,242,229,225,110,128, 49, 57,237,233, - 229,245,237,235,239,242,229,225,110,128, 49, 59,112, 3,160,132, - 160,164,160,179, 97, 2,160,138,160,152,238,243,233,239,243,235, - 239,242,229,225,110,128, 49,108,242,229,238,235,239,242,229,225, - 110,128, 50, 3,232,233,229,245,240,232,235,239,242,229,225,110, - 128, 49, 63,233,229,245,112, 2,160,188,160,197,235,239,242,229, - 225,110,128, 49, 60,243,233,239,243,235,239,242,229,225,110,128, - 49,107,243,233,239,243,235,239,242,229,225,110,128, 49, 61,116, - 2,160,229,160,244,232,233,229,245,244,232,235,239,242,229,225, - 110,128, 49, 62,233,235,229,245,244,235,239,242,229,225,110,128, - 49,106,249,229,239,242,233,238,232,233,229,245,232,235,239,242, - 229,225,110,128, 49,109,231,232,116, 2,161, 30,161, 38,225,238, - 231,236,101,128, 34, 31,116, 2,161, 44,161, 58,225,227,235,226, - 229,236,239,247,227,237, 98,128, 3, 25,242,233,225,238,231,236, - 101,128, 34,191,232,233,242,225,231,225,238, 97,128, 48,138,235, - 225,244,225,235,225,238, 97,129, 48,234,161, 92,232,225,236,230, - 247,233,228,244,104,128,255,152,110, 2,161,110,161,226,103,131, - 2,218,161,120,161,131,161,137,226,229,236,239,247,227,237, 98, - 128, 3, 37,227,237, 98,128, 3, 10,232,225,236,102, 2,161,146, - 161,192,236,229,230,116,131, 2,191,161,159,161,170,161,181,225, - 242,237,229,238,233,225,110,128, 5, 89,226,229,236,239,247,227, - 237, 98,128, 3, 28,227,229,238,244,229,242,229,100,128, 2,211, - 242,233,231,232,116,130, 2,190,161,204,161,215,226,229,236,239, - 247,227,237, 98,128, 3, 57,227,229,238,244,229,242,229,100,128, - 2,210,246,229,242,244,229,228,226,242,229,246,101,128, 2, 19, - 244,244,239,242,245,243,241,245,225,242,101,128, 51, 81,108, 2, - 162, 4,162, 15,233,238,229,226,229,236,239,119,128, 30, 95,239, - 238,231,236,229,103,129, 2,124,162, 26,244,245,242,238,229,100, - 128, 2,122,237,239,238,239,243,240,225,227,101,128,255, 82,111, - 3,162, 55,162, 66,162, 91,232,233,242,225,231,225,238, 97,128, - 48,141,235,225,244,225,235,225,238, 97,129, 48,237,162, 79,232, - 225,236,230,247,233,228,244,104,128,255,155,242,245,225,244,232, - 225,105,128, 14, 35,240,225,242,229,110,128, 36,173,114, 3,162, - 117,162,153,162,183, 97, 3,162,125,162,135,162,142,226,229,238, - 231,225,236,105,128, 9,220,228,229,246, 97,128, 9, 49,231,245, - 242,237,245,235,232,105,128, 10, 92,229,104, 2,162,160,162,169, - 225,242,225,226,233, 99,128, 6,145,230,233,238,225,236,225,242, - 225,226,233, 99,128,251,141,246,239,227,225,236,233, 99, 4,162, - 199,162,209,162,216,162,227,226,229,238,231,225,236,105,128, 9, - 224,228,229,246, 97,128, 9, 96,231,245,234,225,242,225,244,105, - 128, 10,224,246,239,247,229,236,243,233,231,110, 3,162,243,162, - 253,163, 4,226,229,238,231,225,236,105,128, 9,196,228,229,246, - 97,128, 9, 68,231,245,234,225,242,225,244,105,128, 10,196,243, - 245,240,229,242,233,239,114,128,246,241,116, 2,163, 32,163, 40, - 226,236,239,227,107,128, 37,144,245,242,238,229,100,129, 2,121, - 163, 50,243,245,240,229,242,233,239,114,128, 2,180,117, 4,163, - 71,163, 82,163,107,163,154,232,233,242,225,231,225,238, 97,128, - 48,139,235,225,244,225,235,225,238, 97,129, 48,235,163, 95,232, - 225,236,230,247,233,228,244,104,128,255,153,112, 2,163,113,163, - 148,229,101, 2,163,120,163,134,237,225,242,235,226,229,238,231, - 225,236,105,128, 9,242,243,233,231,238,226,229,238,231,225,236, - 105,128, 9,243,233,225,104,128,246,221,244,232,225,105,128, 14, - 36,246,239,227,225,236,233, 99, 4,163,177,163,187,163,194,163, - 205,226,229,238,231,225,236,105,128, 9,139,228,229,246, 97,128, - 9, 11,231,245,234,225,242,225,244,105,128, 10,139,246,239,247, - 229,236,243,233,231,110, 3,163,221,163,231,163,238,226,229,238, - 231,225,236,105,128, 9,195,228,229,246, 97,128, 9, 67,231,245, - 234,225,242,225,244,105,128, 10,195,115,147, 0,115,164, 35,166, - 5,166, 16,166,142,166,181,169,123,169,134,172, 21,174,159,174, - 205,174,232,175,167,175,234,177, 11,177, 21,177,207,178, 24,178, - 194,178,204, 97, 9,164, 55,164, 65,164, 86,164,158,164,183,164, - 194,164,219,164,251,165, 35,226,229,238,231,225,236,105,128, 9, - 184,227,245,244,101,129, 1, 91,164, 74,228,239,244,225,227,227, - 229,238,116,128, 30,101,100, 5,164, 98,164,107,164,113,164,127, - 164,143,225,242,225,226,233, 99,128, 6, 53,229,246, 97,128, 9, - 56,230,233,238,225,236,225,242,225,226,233, 99,128,254,186,233, - 238,233,244,233,225,236,225,242,225,226,233, 99,128,254,187,237, - 229,228,233,225,236,225,242,225,226,233, 99,128,254,188,231,117, - 2,164,165,164,174,234,225,242,225,244,105,128, 10,184,242,237, - 245,235,232,105,128, 10, 56,232,233,242,225,231,225,238, 97,128, - 48, 85,235,225,244,225,235,225,238, 97,129, 48,181,164,207,232, - 225,236,230,247,233,228,244,104,128,255,123,236,236,225,236,236, - 225,232,239,245,225,236,225,249,232,229,247,225,243,225,236,236, - 225,237,225,242,225,226,233, 99,128,253,250,237,229,235,104,130, - 5,225,165, 6,165, 26,228,225,231,229,243,104,129,251, 65,165, - 17,232,229,226,242,229,119,128,251, 65,232,229,226,242,229,119, - 128, 5,225,242, 97, 5,165, 48,165,122,165,130,165,180,165,188, - 97, 5,165, 60,165, 68,165, 76,165,107,165,115,225,244,232,225, - 105,128, 14, 50,229,244,232,225,105,128, 14, 65,233,237,225,233, - 109, 2,165, 86,165, 97,225,236,225,233,244,232,225,105,128, 14, - 68,245,225,238,244,232,225,105,128, 14, 67,237,244,232,225,105, - 128, 14, 51,244,232,225,105,128, 14, 48,229,244,232,225,105,128, - 14, 64,105, 3,165,138,165,162,165,173,105, 2,165,144,165,155, - 236,229,230,244,244,232,225,105,128,248,134,244,232,225,105,128, - 14, 53,236,229,230,244,244,232,225,105,128,248,133,244,232,225, - 105,128, 14, 52,239,244,232,225,105,128, 14, 66,117, 3,165,196, - 165,246,165,253,101, 3,165,204,165,228,165,239,101, 2,165,210, - 165,221,236,229,230,244,244,232,225,105,128,248,136,244,232,225, - 105,128, 14, 55,236,229,230,244,244,232,225,105,128,248,135,244, - 232,225,105,128, 14, 54,244,232,225,105,128, 14, 56,245,244,232, - 225,105,128, 14, 57,226,239,240,239,237,239,230,111,128, 49, 25, - 99, 5,166, 28,166, 49,166, 58,166,107,166,129,225,242,239,110, - 129, 1, 97,166, 37,228,239,244,225,227,227,229,238,116,128, 30, - 103,229,228,233,236,236, 97,128, 1, 95,232,247, 97,131, 2, 89, - 166, 70,166, 81,166,100,227,249,242,233,236,236,233, 99,128, 4, - 217,228,233,229,242,229,243,233,243,227,249,242,233,236,236,233, - 99,128, 4,219,232,239,239,107,128, 2, 90,233,242, 99, 2,166, - 115,166,120,236,101,128, 36,226,245,237,230,236,229,120,128, 1, - 93,239,237,237,225,225,227,227,229,238,116,128, 2, 25,228,239, - 116, 2,166,150,166,159,225,227,227,229,238,116,128, 30, 97,226, - 229,236,239,119,129, 30, 99,166,169,228,239,244,225,227,227,229, - 238,116,128, 30,105,101, 9,166,201,166,217,166,252,167, 61,167, - 164,167,191,167,216,168, 41,168, 68,225,231,245,236,236,226,229, - 236,239,247,227,237, 98,128, 3, 60, 99, 2,166,223,166,245,239, - 238,100,129, 32, 51,166,231,244,239,238,229,227,232,233,238,229, - 243,101,128, 2,202,244,233,239,110,128, 0,167,229,110, 4,167, - 7,167, 16,167, 30,167, 46,225,242,225,226,233, 99,128, 6, 51, - 230,233,238,225,236,225,242,225,226,233, 99,128,254,178,233,238, - 233,244,233,225,236,225,242,225,226,233, 99,128,254,179,237,229, - 228,233,225,236,225,242,225,226,233, 99,128,254,180,231,239,108, - 135, 5,182,167, 81,167, 95,167,100,167,109,167,124,167,140,167, - 151, 49, 2,167, 87,167, 91, 51,128, 5,182,102,128, 5,182,178, - 99,128, 5,182,232,229,226,242,229,119,128, 5,182,238,225,242, - 242,239,247,232,229,226,242,229,119,128, 5,182,241,245,225,242, - 244,229,242,232,229,226,242,229,119,128, 5,182,244,225,232,229, - 226,242,229,119,128, 5,146,247,233,228,229,232,229,226,242,229, - 119,128, 5,182,104, 2,167,170,167,181,225,242,237,229,238,233, - 225,110,128, 5,125,233,242,225,231,225,238, 97,128, 48, 91,235, - 225,244,225,235,225,238, 97,129, 48,187,167,204,232,225,236,230, - 247,233,228,244,104,128,255,126,237,105, 2,167,223,168, 10,227, - 239,236,239,110,131, 0, 59,167,237,167,246,168, 2,225,242,225, - 226,233, 99,128, 6, 27,237,239,238,239,243,240,225,227,101,128, - 255, 27,243,237,225,236,108,128,254, 84,246,239,233,227,229,228, - 237,225,242,235,235,225,238, 97,129, 48,156,168, 29,232,225,236, - 230,247,233,228,244,104,128,255,159,238,116, 2,168, 48,168, 58, - 233,243,241,245,225,242,101,128, 51, 34,239,243,241,245,225,242, - 101,128, 51, 35,246,229,110,142, 0, 55,168,102,168,111,168,121, - 168,151,168,158,168,168,168,193,168,220,168,254,169, 10,169, 21, - 169, 54,169, 62,169, 73,225,242,225,226,233, 99,128, 6,103,226, - 229,238,231,225,236,105,128, 9,237,227,233,242,227,236,101,129, - 36,102,168,132,233,238,246,229,242,243,229,243,225,238,243,243, - 229,242,233,102,128, 39,144,228,229,246, 97,128, 9,109,229,233, - 231,232,244,232,115,128, 33, 94,231,117, 2,168,175,168,184,234, - 225,242,225,244,105,128, 10,237,242,237,245,235,232,105,128, 10, - 109,232, 97, 2,168,200,168,211,227,235,225,242,225,226,233, 99, - 128, 6,103,238,231,250,232,239,117,128, 48, 39,105, 2,168,226, - 168,244,228,229,239,231,242,225,240,232,233,227,240,225,242,229, - 110,128, 50, 38,238,230,229,242,233,239,114,128, 32,135,237,239, - 238,239,243,240,225,227,101,128,255, 23,239,236,228,243,244,249, - 236,101,128,247, 55,112, 2,169, 27,169, 34,225,242,229,110,128, - 36,122,229,114, 2,169, 41,169, 47,233,239,100,128, 36,142,243, - 233,225,110,128, 6,247,242,239,237,225,110,128, 33,118,243,245, - 240,229,242,233,239,114,128, 32,119,116, 2,169, 79,169,117,229, - 229,110, 2,169, 87,169, 96,227,233,242,227,236,101,128, 36,112, - 112, 2,169,102,169,109,225,242,229,110,128, 36,132,229,242,233, - 239,100,128, 36,152,232,225,105,128, 14, 87,230,244,232,249,240, - 232,229,110,128, 0,173,104, 7,169,150,170,124,170,135,170,149, - 171, 94,171,107,172, 15, 97, 6,169,164,169,175,169,185,169,196, - 170, 83,170,108,225,242,237,229,238,233,225,110,128, 5,119,226, - 229,238,231,225,236,105,128, 9,182,227,249,242,233,236,236,233, - 99,128, 4, 72,100, 2,169,202,170, 42,228, 97, 4,169,213,169, - 222,169,253,170, 11,225,242,225,226,233, 99,128, 6, 81,228,225, - 237,237, 97, 2,169,232,169,241,225,242,225,226,233, 99,128,252, - 97,244,225,238,225,242,225,226,233, 99,128,252, 94,230,225,244, - 232,225,225,242,225,226,233, 99,128,252, 96,235,225,243,242, 97, - 2,170, 21,170, 30,225,242,225,226,233, 99,128,252, 98,244,225, - 238,225,242,225,226,233, 99,128,252, 95,101,132, 37,146,170, 54, - 170, 61,170, 69,170, 78,228,225,242,107,128, 37,147,236,233,231, - 232,116,128, 37,145,237,229,228,233,245,109,128, 37,146,246, 97, - 128, 9, 54,231,117, 2,170, 90,170, 99,234,225,242,225,244,105, - 128, 10,182,242,237,245,235,232,105,128, 10, 54,236,243,232,229, - 236,229,244,232,229,226,242,229,119,128, 5,147,226,239,240,239, - 237,239,230,111,128, 49, 21,227,232,225,227,249,242,233,236,236, - 233, 99,128, 4, 73,101, 4,170,159,170,224,170,234,170,251,229, - 110, 4,170,170,170,179,170,193,170,209,225,242,225,226,233, 99, - 128, 6, 52,230,233,238,225,236,225,242,225,226,233, 99,128,254, - 182,233,238,233,244,233,225,236,225,242,225,226,233, 99,128,254, - 183,237,229,228,233,225,236,225,242,225,226,233, 99,128,254,184, - 233,227,239,240,244,233, 99,128, 3,227,241,229,108,129, 32,170, - 170,242,232,229,226,242,229,119,128, 32,170,246, 97,134, 5,176, - 171, 12,171, 27,171, 41,171, 50,171, 65,171, 81, 49, 2,171, 18, - 171, 23,177, 53,128, 5,176, 53,128, 5,176, 50, 2,171, 33,171, - 37, 50,128, 5,176,101,128, 5,176,232,229,226,242,229,119,128, - 5,176,238,225,242,242,239,247,232,229,226,242,229,119,128, 5, - 176,241,245,225,242,244,229,242,232,229,226,242,229,119,128, 5, - 176,247,233,228,229,232,229,226,242,229,119,128, 5,176,232,225, - 227,249,242,233,236,236,233, 99,128, 4,187,105, 2,171,113,171, - 124,237,225,227,239,240,244,233, 99,128, 3,237,110,131, 5,233, - 171,134,171,217,171,226,100, 2,171,140,171,206,225,231,229,243, - 104,130,251, 73,171,152,171,161,232,229,226,242,229,119,128,251, - 73,115, 2,171,167,171,187,232,233,238,228,239,116,129,251, 44, - 171,178,232,229,226,242,229,119,128,251, 44,233,238,228,239,116, - 129,251, 45,171,197,232,229,226,242,229,119,128,251, 45,239,244, - 232,229,226,242,229,119,128, 5,193,232,229,226,242,229,119,128, - 5,233,115, 2,171,232,171,252,232,233,238,228,239,116,129,251, - 42,171,243,232,229,226,242,229,119,128,251, 42,233,238,228,239, - 116,129,251, 43,172, 6,232,229,226,242,229,119,128,251, 43,239, - 239,107,128, 2,130,105, 8,172, 39,172, 83,172, 94,172,119,172, - 149,172,157,172,170,173, 85,231,237, 97,131, 3,195,172, 51,172, - 55,172, 63, 49,128, 3,194,230,233,238,225,108,128, 3,194,236, - 245,238,225,244,229,243,249,237,226,239,236,231,242,229,229,107, - 128, 3,242,232,233,242,225,231,225,238, 97,128, 48, 87,235,225, - 244,225,235,225,238, 97,129, 48,183,172,107,232,225,236,230,247, - 233,228,244,104,128,255,124,236,245,113, 2,172,127,172,136,232, - 229,226,242,229,119,128, 5,189,236,229,230,244,232,229,226,242, - 229,119,128, 5,189,237,233,236,225,114,128, 34, 60,238,228,239, - 244,232,229,226,242,229,119,128, 5,194,239,115, 6,172,185,172, - 220,172,252,173, 24,173, 38,173, 70, 97, 2,172,191,172,206,227, - 233,242,227,236,229,235,239,242,229,225,110,128, 50,116,240,225, - 242,229,238,235,239,242,229,225,110,128, 50, 20,227,105, 2,172, - 227,172,239,229,245,227,235,239,242,229,225,110,128, 49,126,242, - 227,236,229,235,239,242,229,225,110,128, 50,102,107, 2,173, 2, - 173, 16,233,249,229,239,235,235,239,242,229,225,110,128, 49,122, - 239,242,229,225,110,128, 49, 69,238,233,229,245,238,235,239,242, - 229,225,110,128, 49,123,112, 2,173, 44,173, 57,225,242,229,238, - 235,239,242,229,225,110,128, 50, 6,233,229,245,240,235,239,242, - 229,225,110,128, 49,125,244,233,235,229,245,244,235,239,242,229, - 225,110,128, 49,124,120,141, 0, 54,173,115,173,124,173,134,173, - 164,173,171,173,196,173,223,174, 1,174, 13,174, 24,174, 57,174, - 65,174, 76,225,242,225,226,233, 99,128, 6,102,226,229,238,231, - 225,236,105,128, 9,236,227,233,242,227,236,101,129, 36,101,173, - 145,233,238,246,229,242,243,229,243,225,238,243,243,229,242,233, - 102,128, 39,143,228,229,246, 97,128, 9,108,231,117, 2,173,178, - 173,187,234,225,242,225,244,105,128, 10,236,242,237,245,235,232, - 105,128, 10,108,232, 97, 2,173,203,173,214,227,235,225,242,225, - 226,233, 99,128, 6,102,238,231,250,232,239,117,128, 48, 38,105, - 2,173,229,173,247,228,229,239,231,242,225,240,232,233,227,240, - 225,242,229,110,128, 50, 37,238,230,229,242,233,239,114,128, 32, - 134,237,239,238,239,243,240,225,227,101,128,255, 22,239,236,228, - 243,244,249,236,101,128,247, 54,112, 2,174, 30,174, 37,225,242, - 229,110,128, 36,121,229,114, 2,174, 44,174, 50,233,239,100,128, - 36,141,243,233,225,110,128, 6,246,242,239,237,225,110,128, 33, - 117,243,245,240,229,242,233,239,114,128, 32,118,116, 2,174, 82, - 174,153,229,229,110, 2,174, 90,174,132, 99, 2,174, 96,174,104, - 233,242,227,236,101,128, 36,111,245,242,242,229,238,227,249,228, - 229,238,239,237,233,238,225,244,239,242,226,229,238,231,225,236, - 105,128, 9,249,112, 2,174,138,174,145,225,242,229,110,128, 36, - 131,229,242,233,239,100,128, 36,151,232,225,105,128, 14, 86,108, - 2,174,165,174,185,225,243,104,129, 0, 47,174,173,237,239,238, - 239,243,240,225,227,101,128,255, 15,239,238,103,129, 1,127,174, - 193,228,239,244,225,227,227,229,238,116,128, 30,155,109, 2,174, - 211,174,221,233,236,229,230,225,227,101,128, 38, 58,239,238,239, - 243,240,225,227,101,128,255, 83,111, 6,174,246,175, 40,175, 51, - 175, 76,175,121,175,132,102, 2,174,252,175, 10,240,225,243,245, - 241,232,229,226,242,229,119,128, 5,195,116, 2,175, 16,175, 25, - 232,249,240,232,229,110,128, 0,173,243,233,231,238,227,249,242, - 233,236,236,233, 99,128, 4, 76,232,233,242,225,231,225,238, 97, - 128, 48, 93,235,225,244,225,235,225,238, 97,129, 48,189,175, 64, - 232,225,236,230,247,233,228,244,104,128,255,127,236,233,228,245, - 115, 2,175, 86,175,103,236,239,238,231,239,246,229,242,236,225, - 249,227,237, 98,128, 3, 56,243,232,239,242,244,239,246,229,242, - 236,225,249,227,237, 98,128, 3, 55,242,245,243,233,244,232,225, - 105,128, 14, 41,115, 3,175,140,175,150,175,158,225,236,225,244, - 232,225,105,128, 14, 40,239,244,232,225,105,128, 14, 11,245,225, - 244,232,225,105,128, 14, 42,240, 97, 3,175,176,175,196,175,228, - 227,101,129, 0, 32,175,183,232,225,227,235,225,242,225,226,233, - 99,128, 0, 32,228,101,129, 38, 96,175,203,243,245,233,116, 2, - 175,212,175,220,226,236,225,227,107,128, 38, 96,247,232,233,244, - 101,128, 38,100,242,229,110,128, 36,174,241,245,225,242,101, 11, - 176, 6,176, 17,176, 31,176, 56,176, 73,176, 99,176,114,176,147, - 176,174,176,230,176,245,226,229,236,239,247,227,237, 98,128, 3, - 59, 99, 2,176, 23,176, 27, 99,128, 51,196,109,128, 51,157,228, - 233,225,231,239,238,225,236,227,242,239,243,243,232,225,244,227, - 232,230,233,236,108,128, 37,169,232,239,242,233,250,239,238,244, - 225,236,230,233,236,108,128, 37,164,107, 2,176, 79,176, 83,103, - 128, 51,143,109,129, 51,158,176, 89,227,225,240,233,244,225,108, - 128, 51,206,108, 2,176,105,176,109,110,128, 51,209,239,103,128, - 51,210,109, 4,176,124,176,128,176,133,176,137,103,128, 51,142, - 233,108,128, 51,213,109,128, 51,156,243,241,245,225,242,229,100, - 128, 51,161,239,242,244,232,239,231,239,238,225,236,227,242,239, - 243,243,232,225,244,227,232,230,233,236,108,128, 37,166,245,240, - 240,229,114, 2,176,184,176,207,236,229,230,244,244,239,236,239, - 247,229,242,242,233,231,232,244,230,233,236,108,128, 37,167,242, - 233,231,232,244,244,239,236,239,247,229,242,236,229,230,244,230, - 233,236,108,128, 37,168,246,229,242,244,233,227,225,236,230,233, - 236,108,128, 37,165,247,232,233,244,229,247,233,244,232,243,237, - 225,236,236,226,236,225,227,107,128, 37,163,242,243,241,245,225, - 242,101,128, 51,219,115, 2,177, 27,177,197, 97, 4,177, 37,177, - 47,177, 54,177, 65,226,229,238,231,225,236,105,128, 9,183,228, - 229,246, 97,128, 9, 55,231,245,234,225,242,225,244,105,128, 10, - 183,238,103, 8,177, 84,177, 98,177,112,177,126,177,141,177,155, - 177,169,177,182,227,233,229,245,227,235,239,242,229,225,110,128, - 49, 73,232,233,229,245,232,235,239,242,229,225,110,128, 49,133, - 233,229,245,238,231,235,239,242,229,225,110,128, 49,128,235,233, - 249,229,239,235,235,239,242,229,225,110,128, 49, 50,238,233,229, - 245,238,235,239,242,229,225,110,128, 49,101,240,233,229,245,240, - 235,239,242,229,225,110,128, 49, 67,243,233,239,243,235,239,242, - 229,225,110,128, 49, 70,244,233,235,229,245,244,235,239,242,229, - 225,110,128, 49, 56,245,240,229,242,233,239,114,128,246,242,116, - 2,177,213,177,236,229,242,236,233,238,103,129, 0,163,177,224, - 237,239,238,239,243,240,225,227,101,128,255,225,242,239,235,101, - 2,177,245,178, 6,236,239,238,231,239,246,229,242,236,225,249, - 227,237, 98,128, 3, 54,243,232,239,242,244,239,246,229,242,236, - 225,249,227,237, 98,128, 3, 53,117, 7,178, 40,178, 72,178, 94, - 178,105,178,146,178,156,178,160,226,243,229,116,130, 34,130,178, - 51,178, 62,238,239,244,229,241,245,225,108,128, 34,138,239,242, - 229,241,245,225,108,128, 34,134, 99, 2,178, 78,178, 86,227,229, - 229,228,115,128, 34,123,232,244,232,225,116,128, 34, 11,232,233, - 242,225,231,225,238, 97,128, 48, 89,107, 2,178,111,178,135,225, - 244,225,235,225,238, 97,129, 48,185,178,123,232,225,236,230,247, - 233,228,244,104,128,255,125,245,238,225,242,225,226,233, 99,128, - 6, 82,237,237,225,244,233,239,110,128, 34, 17,110,128, 38, 60, - 240,229,242,243,229,116,130, 34,131,178,173,178,184,238,239,244, - 229,241,245,225,108,128, 34,139,239,242,229,241,245,225,108,128, - 34,135,246,243,241,245,225,242,101,128, 51,220,249,239,245,247, - 225,229,242,225,243,241,245,225,242,101,128, 51,124,116,144, 0, - 116,179, 1,180, 10,180, 31,180,174,180,214,183, 6,186,144,187, - 219,187,231,187,243,189, 20,189, 45,189,131,190, 55,190,239,191, - 73, 97, 10,179, 23,179, 33,179, 54,179, 61,179, 86,179,164,179, - 181,179,206,179,220,179,224,226,229,238,231,225,236,105,128, 9, - 164,227,107, 2,179, 40,179, 47,228,239,247,110,128, 34,164,236, - 229,230,116,128, 34,163,228,229,246, 97,128, 9, 36,231,117, 2, - 179, 68,179, 77,234,225,242,225,244,105,128, 10,164,242,237,245, - 235,232,105,128, 10, 36,104, 4,179, 96,179,105,179,119,179,149, - 225,242,225,226,233, 99,128, 6, 55,230,233,238,225,236,225,242, - 225,226,233, 99,128,254,194,105, 2,179,125,179,140,238,233,244, - 233,225,236,225,242,225,226,233, 99,128,254,195,242,225,231,225, - 238, 97,128, 48, 95,237,229,228,233,225,236,225,242,225,226,233, - 99,128,254,196,233,243,249,239,245,229,242,225,243,241,245,225, - 242,101,128, 51,125,235,225,244,225,235,225,238, 97,129, 48,191, - 179,194,232,225,236,230,247,233,228,244,104,128,255,128,244,247, - 229,229,236,225,242,225,226,233, 99,128, 6, 64,117,128, 3,196, - 118,130, 5,234,179,232,180, 1,228,225,231,229,115,129,251, 74, - 179,242,104,129,251, 74,179,248,232,229,226,242,229,119,128,251, - 74,232,229,226,242,229,119,128, 5,234, 98, 2,180, 16,180, 21, - 225,114,128, 1,103,239,240,239,237,239,230,111,128, 49, 10, 99, - 6,180, 45,180, 52,180, 59,180, 68,180,134,180,161,225,242,239, - 110,128, 1,101,227,245,242,108,128, 2,168,229,228,233,236,236, - 97,128, 1, 99,232,229,104, 4,180, 80,180, 89,180,103,180,119, - 225,242,225,226,233, 99,128, 6,134,230,233,238,225,236,225,242, - 225,226,233, 99,128,251,123,233,238,233,244,233,225,236,225,242, - 225,226,233, 99,128,251,124,237,229,228,233,225,236,225,242,225, - 226,233, 99,128,251,125,233,242, 99, 2,180,142,180,147,236,101, - 128, 36,227,245,237,230,236,229,248,226,229,236,239,119,128, 30, - 113,239,237,237,225,225,227,227,229,238,116,128, 1, 99,100, 2, - 180,180,180,190,233,229,242,229,243,233,115,128, 30,151,239,116, - 2,180,197,180,206,225,227,227,229,238,116,128, 30,107,226,229, - 236,239,119,128, 30,109,101, 9,180,234,180,245,181, 9,182, 19, - 182, 44,182,108,182,175,182,180,182,232,227,249,242,233,236,236, - 233, 99,128, 4, 66,228,229,243,227,229,238,228,229,242,227,249, - 242,233,236,236,233, 99,128, 4,173,104, 7,181, 25,181, 34,181, - 48,181, 88,181,118,181,159,182, 1,225,242,225,226,233, 99,128, - 6, 42,230,233,238,225,236,225,242,225,226,233, 99,128,254,150, - 232,225,232,105, 2,181, 57,181, 72,238,233,244,233,225,236,225, - 242,225,226,233, 99,128,252,162,243,239,236,225,244,229,228,225, - 242,225,226,233, 99,128,252, 12,105, 2,181, 94,181,109,238,233, - 244,233,225,236,225,242,225,226,233, 99,128,254,151,242,225,231, - 225,238, 97,128, 48,102,234,229,229,237,105, 2,181,128,181,143, - 238,233,244,233,225,236,225,242,225,226,233, 99,128,252,161,243, - 239,236,225,244,229,228,225,242,225,226,233, 99,128,252, 11,109, - 2,181,165,181,199,225,242,226,245,244, 97, 2,181,176,181,185, - 225,242,225,226,233, 99,128, 6, 41,230,233,238,225,236,225,242, - 225,226,233, 99,128,254,148,101, 2,181,205,181,218,228,233,225, - 236,225,242,225,226,233, 99,128,254,152,229,237,105, 2,181,226, - 181,241,238,233,244,233,225,236,225,242,225,226,233, 99,128,252, - 164,243,239,236,225,244,229,228,225,242,225,226,233, 99,128,252, - 14,238,239,239,238,230,233,238,225,236,225,242,225,226,233, 99, - 128,252,115,235,225,244,225,235,225,238, 97,129, 48,198,182, 32, - 232,225,236,230,247,233,228,244,104,128,255,131,108, 2,182, 50, - 182, 69,229,240,232,239,238,101,129, 33, 33,182, 61,226,236,225, - 227,107,128, 38, 14,233,243,232, 97, 2,182, 78,182, 93,231,229, - 228,239,236,225,232,229,226,242,229,119,128, 5,160,241,229,244, - 225,238,225,232,229,226,242,229,119,128, 5,169,110, 4,182,118, - 182,127,182,146,182,167,227,233,242,227,236,101,128, 36,105,233, - 228,229,239,231,242,225,240,232,233,227,240,225,242,229,110,128, - 50, 41,112, 2,182,152,182,159,225,242,229,110,128, 36,125,229, - 242,233,239,100,128, 36,145,242,239,237,225,110,128, 33,121,243, - 104,128, 2,167,116,131, 5,216,182,190,182,210,182,219,228,225, - 231,229,243,104,129,251, 56,182,201,232,229,226,242,229,119,128, - 251, 56,232,229,226,242,229,119,128, 5,216,243,229,227,249,242, - 233,236,236,233, 99,128, 4,181,246,233,114, 2,182,240,182,249, - 232,229,226,242,229,119,128, 5,155,236,229,230,244,232,229,226, - 242,229,119,128, 5,155,104, 6,183, 20,183,172,184, 38,184,170, - 185, 77,186,134, 97, 5,183, 32,183, 42,183, 49,183, 74,183,103, - 226,229,238,231,225,236,105,128, 9,165,228,229,246, 97,128, 9, - 37,231,117, 2,183, 56,183, 65,234,225,242,225,244,105,128, 10, - 165,242,237,245,235,232,105,128, 10, 37,108, 2,183, 80,183, 89, - 225,242,225,226,233, 99,128, 6, 48,230,233,238,225,236,225,242, - 225,226,233, 99,128,254,172,238,244,232,225,235,232,225,116, 3, - 183,118,183,149,183,156,236,239,119, 2,183,126,183,137,236,229, - 230,244,244,232,225,105,128,248,152,242,233,231,232,244,244,232, - 225,105,128,248,151,244,232,225,105,128, 14, 76,245,240,240,229, - 242,236,229,230,244,244,232,225,105,128,248,150,101, 3,183,180, - 183,244,184, 11,104, 4,183,190,183,199,183,213,183,229,225,242, - 225,226,233, 99,128, 6, 43,230,233,238,225,236,225,242,225,226, - 233, 99,128,254,154,233,238,233,244,233,225,236,225,242,225,226, - 233, 99,128,254,155,237,229,228,233,225,236,225,242,225,226,233, - 99,128,254,156,242,101, 2,183,251,184, 4,229,248,233,243,244, - 115,128, 34, 3,230,239,242,101,128, 34, 52,244, 97,130, 3,184, - 184, 20,184, 24, 49,128, 3,209,243,249,237,226,239,236,231,242, - 229,229,107,128, 3,209,105, 2,184, 44,184,130,229,245,244,104, - 4,184, 57,184, 92,184,107,184,116, 97, 2,184, 63,184, 78,227, - 233,242,227,236,229,235,239,242,229,225,110,128, 50,121,240,225, - 242,229,238,235,239,242,229,225,110,128, 50, 25,227,233,242,227, - 236,229,235,239,242,229,225,110,128, 50,107,235,239,242,229,225, - 110,128, 49, 76,240,225,242,229,238,235,239,242,229,225,110,128, - 50, 11,242,244,229,229,110, 2,184,140,184,149,227,233,242,227, - 236,101,128, 36,108,112, 2,184,155,184,162,225,242,229,110,128, - 36,128,229,242,233,239,100,128, 36,148,111, 6,184,184,184,201, - 184,206,184,220,184,225,185, 22,238,225,238,231,237,239,238,244, - 232,239,244,232,225,105,128, 14, 17,239,107,128, 1,173,240,232, - 245,244,232,225,239,244,232,225,105,128, 14, 18,242,110,128, 0, - 254,244,104, 3,184,234,185, 2,185, 12, 97, 2,184,240,184,250, - 232,225,238,244,232,225,105,128, 14, 23,238,244,232,225,105,128, - 14, 16,239,238,231,244,232,225,105,128, 14, 24,245,238,231,244, - 232,225,105,128, 14, 22,245,243,225,238,100, 2,185, 32,185, 43, - 227,249,242,233,236,236,233, 99,128, 4,130,243,243,229,240,225, - 242,225,244,239,114, 2,185, 58,185, 67,225,242,225,226,233, 99, - 128, 6,108,240,229,242,243,233,225,110,128, 6,108,242,229,101, - 144, 0, 51,185,115,185,124,185,134,185,164,185,171,185,181,185, - 206,185,233,186, 11,186, 23,186, 42,186, 53,186, 86,186,108,186, - 116,186,127,225,242,225,226,233, 99,128, 6, 99,226,229,238,231, - 225,236,105,128, 9,233,227,233,242,227,236,101,129, 36, 98,185, - 145,233,238,246,229,242,243,229,243,225,238,243,243,229,242,233, - 102,128, 39,140,228,229,246, 97,128, 9,105,229,233,231,232,244, - 232,115,128, 33, 92,231,117, 2,185,188,185,197,234,225,242,225, - 244,105,128, 10,233,242,237,245,235,232,105,128, 10,105,232, 97, - 2,185,213,185,224,227,235,225,242,225,226,233, 99,128, 6, 99, - 238,231,250,232,239,117,128, 48, 35,105, 2,185,239,186, 1,228, - 229,239,231,242,225,240,232,233,227,240,225,242,229,110,128, 50, - 34,238,230,229,242,233,239,114,128, 32,131,237,239,238,239,243, - 240,225,227,101,128,255, 19,238,245,237,229,242,225,244,239,242, - 226,229,238,231,225,236,105,128, 9,246,239,236,228,243,244,249, - 236,101,128,247, 51,112, 2,186, 59,186, 66,225,242,229,110,128, - 36,118,229,114, 2,186, 73,186, 79,233,239,100,128, 36,138,243, - 233,225,110,128, 6,243,241,245,225,242,244,229,242,115,129, 0, - 190,186, 99,229,237,228,225,243,104,128,246,222,242,239,237,225, - 110,128, 33,114,243,245,240,229,242,233,239,114,128, 0,179,244, - 232,225,105,128, 14, 83,250,243,241,245,225,242,101,128, 51,148, - 105, 7,186,160,186,171,187, 30,187,128,187,140,187,189,187,206, - 232,233,242,225,231,225,238, 97,128, 48, 97,107, 2,186,177,186, - 201,225,244,225,235,225,238, 97,129, 48,193,186,189,232,225,236, - 230,247,233,228,244,104,128,255,129,229,245,116, 4,186,213,186, - 248,187, 7,187, 16, 97, 2,186,219,186,234,227,233,242,227,236, - 229,235,239,242,229,225,110,128, 50,112,240,225,242,229,238,235, - 239,242,229,225,110,128, 50, 16,227,233,242,227,236,229,235,239, - 242,229,225,110,128, 50, 98,235,239,242,229,225,110,128, 49, 55, - 240,225,242,229,238,235,239,242,229,225,110,128, 50, 2,236,228, - 101,133, 2,220,187, 46,187, 57,187, 74,187, 86,187,114,226,229, - 236,239,247,227,237, 98,128, 3, 48, 99, 2,187, 63,187, 68,237, - 98,128, 3, 3,239,237, 98,128, 3, 3,228,239,245,226,236,229, - 227,237, 98,128, 3, 96,111, 2,187, 92,187,102,240,229,242,225, - 244,239,114,128, 34, 60,246,229,242,236,225,249,227,237, 98,128, - 3, 52,246,229,242,244,233,227,225,236,227,237, 98,128, 3, 62, - 237,229,243,227,233,242,227,236,101,128, 34,151,112, 2,187,146, - 187,176,229,232, 97, 2,187,154,187,163,232,229,226,242,229,119, - 128, 5,150,236,229,230,244,232,229,226,242,229,119,128, 5,150, - 240,233,231,245,242,237,245,235,232,105,128, 10,112,244,236,239, - 227,249,242,233,236,236,233,227,227,237, 98,128, 4,131,247,238, - 225,242,237,229,238,233,225,110,128, 5,127,236,233,238,229,226, - 229,236,239,119,128, 30,111,237,239,238,239,243,240,225,227,101, - 128,255, 84,111, 7,188, 3,188, 14,188, 25,188, 50,188,170,188, - 182,189, 10,225,242,237,229,238,233,225,110,128, 5,105,232,233, - 242,225,231,225,238, 97,128, 48,104,235,225,244,225,235,225,238, - 97,129, 48,200,188, 38,232,225,236,230,247,233,228,244,104,128, - 255,132,110, 3,188, 58,188,156,188,161,101, 4,188, 68,188,137, - 188,144,188,150,226,225,114, 4,188, 80,188,109,188,119,188,128, - 229,248,244,242, 97, 2,188, 90,188,100,232,233,231,232,237,239, - 100,128, 2,229,236,239,247,237,239,100,128, 2,233,232,233,231, - 232,237,239,100,128, 2,230,236,239,247,237,239,100,128, 2,232, - 237,233,228,237,239,100,128, 2,231,230,233,246,101,128, 1,189, - 243,233,120,128, 1,133,244,247,111,128, 1,168,239,115,128, 3, - 132,243,241,245,225,242,101,128, 51, 39,240,225,244,225,235,244, - 232,225,105,128, 14, 15,242,244,239,233,243,229,243,232,229,236, - 236,226,242,225,227,235,229,116, 2,188,205,188,235,236,229,230, - 116,130, 48, 20,188,216,188,224,243,237,225,236,108,128,254, 93, - 246,229,242,244,233,227,225,108,128,254, 57,242,233,231,232,116, - 130, 48, 21,188,247,188,255,243,237,225,236,108,128,254, 94,246, - 229,242,244,233,227,225,108,128,254, 58,244,225,239,244,232,225, - 105,128, 14, 21,240, 97, 2,189, 27,189, 39,236,225,244,225,236, - 232,239,239,107,128, 1,171,242,229,110,128, 36,175,114, 3,189, - 53,189, 84,189, 99,225,228,229,237,225,242,107,129, 33, 34,189, - 65,115, 2,189, 71,189, 77,225,238,115,128,248,234,229,242,233, - 102,128,246,219,229,244,242,239,230,236,229,248,232,239,239,107, - 128, 2,136,233,225,103, 4,189,111,189,116,189,121,189,126,228, - 110,128, 37,188,236,102,128, 37,196,242,116,128, 37,186,245,112, - 128, 37,178,115,132, 2,166,189,143,189,182,190, 32,190, 45,225, - 228,105,130, 5,230,189,153,189,173,228,225,231,229,243,104,129, - 251, 70,189,164,232,229,226,242,229,119,128,251, 70,232,229,226, - 242,229,119,128, 5,230,101, 2,189,188,189,199,227,249,242,233, - 236,236,233, 99,128, 4, 70,242,101,134, 5,181,189,216,189,230, - 189,235,189,244,190, 3,190, 19, 49, 2,189,222,189,226, 50,128, - 5,181,101,128, 5,181,178, 98,128, 5,181,232,229,226,242,229, - 119,128, 5,181,238,225,242,242,239,247,232,229,226,242,229,119, - 128, 5,181,241,245,225,242,244,229,242,232,229,226,242,229,119, - 128, 5,181,247,233,228,229,232,229,226,242,229,119,128, 5,181, - 232,229,227,249,242,233,236,236,233, 99,128, 4, 91,245,240,229, - 242,233,239,114,128,246,243,116, 4,190, 65,190,115,190,180,190, - 231, 97, 3,190, 73,190, 83,190, 90,226,229,238,231,225,236,105, - 128, 9,159,228,229,246, 97,128, 9, 31,231,117, 2,190, 97,190, - 106,234,225,242,225,244,105,128, 10,159,242,237,245,235,232,105, - 128, 10, 31,229,104, 4,190,126,190,135,190,149,190,165,225,242, - 225,226,233, 99,128, 6,121,230,233,238,225,236,225,242,225,226, - 233, 99,128,251,103,233,238,233,244,233,225,236,225,242,225,226, - 233, 99,128,251,104,237,229,228,233,225,236,225,242,225,226,233, - 99,128,251,105,232, 97, 3,190,189,190,199,190,206,226,229,238, - 231,225,236,105,128, 9,160,228,229,246, 97,128, 9, 32,231,117, - 2,190,213,190,222,234,225,242,225,244,105,128, 10,160,242,237, - 245,235,232,105,128, 10, 32,245,242,238,229,100,128, 2,135,117, - 3,190,247,191, 2,191, 27,232,233,242,225,231,225,238, 97,128, - 48,100,235,225,244,225,235,225,238, 97,129, 48,196,191, 15,232, - 225,236,230,247,233,228,244,104,128,255,130,243,237,225,236,108, - 2,191, 37,191, 48,232,233,242,225,231,225,238, 97,128, 48, 99, - 235,225,244,225,235,225,238, 97,129, 48,195,191, 61,232,225,236, - 230,247,233,228,244,104,128,255,111,119, 2,191, 79,191,184,101, - 2,191, 85,191,133,236,246,101, 3,191, 95,191,104,191,125,227, - 233,242,227,236,101,128, 36,107,112, 2,191,110,191,117,225,242, - 229,110,128, 36,127,229,242,233,239,100,128, 36,147,242,239,237, - 225,110,128, 33,123,238,244,121, 3,191,143,191,152,191,163,227, - 233,242,227,236,101,128, 36,115,232,225,238,231,250,232,239,117, - 128, 83, 68,112, 2,191,169,191,176,225,242,229,110,128, 36,135, - 229,242,233,239,100,128, 36,155,111,142, 0, 50,191,216,191,225, - 191,235,192, 9,192, 61,192, 86,192,113,192,147,192,159,192,178, - 192,189,192,222,192,230,192,254,225,242,225,226,233, 99,128, 6, - 98,226,229,238,231,225,236,105,128, 9,232,227,233,242,227,236, - 101,129, 36, 97,191,246,233,238,246,229,242,243,229,243,225,238, - 243,243,229,242,233,102,128, 39,139,100, 2,192, 15,192, 21,229, - 246, 97,128, 9,104,239,116, 2,192, 28,192, 39,229,238,236,229, - 225,228,229,114,128, 32, 37,236,229,225,228,229,114,129, 32, 37, - 192, 50,246,229,242,244,233,227,225,108,128,254, 48,231,117, 2, - 192, 68,192, 77,234,225,242,225,244,105,128, 10,232,242,237,245, - 235,232,105,128, 10,104,232, 97, 2,192, 93,192,104,227,235,225, - 242,225,226,233, 99,128, 6, 98,238,231,250,232,239,117,128, 48, - 34,105, 2,192,119,192,137,228,229,239,231,242,225,240,232,233, - 227,240,225,242,229,110,128, 50, 33,238,230,229,242,233,239,114, - 128, 32,130,237,239,238,239,243,240,225,227,101,128,255, 18,238, - 245,237,229,242,225,244,239,242,226,229,238,231,225,236,105,128, - 9,245,239,236,228,243,244,249,236,101,128,247, 50,112, 2,192, - 195,192,202,225,242,229,110,128, 36,117,229,114, 2,192,209,192, - 215,233,239,100,128, 36,137,243,233,225,110,128, 6,242,242,239, - 237,225,110,128, 33,113,115, 2,192,236,192,244,244,242,239,235, - 101,128, 1,187,245,240,229,242,233,239,114,128, 0,178,244,104, - 2,193, 5,193, 10,225,105,128, 14, 82,233,242,228,115,128, 33, - 84,117,145, 0,117,193, 55,193, 63,193,104,193,161,194, 43,194, - 80,194,203,194,219,195, 14,195, 84,195,165,195,174,196, 37,196, - 61,196,169,196,197,197, 55,225,227,245,244,101,128, 0,250, 98, - 4,193, 73,193, 78,193, 87,193, 97,225,114,128, 2,137,229,238, - 231,225,236,105,128, 9,137,239,240,239,237,239,230,111,128, 49, - 40,242,229,246,101,128, 1,109, 99, 3,193,112,193,119,193,151, - 225,242,239,110,128, 1,212,233,242, 99, 2,193,127,193,132,236, - 101,128, 36,228,245,237,230,236,229,120,129, 0,251,193,143,226, - 229,236,239,119,128, 30,119,249,242,233,236,236,233, 99,128, 4, - 67,100, 5,193,173,193,184,193,207,193,213,194, 33,225,244,244, - 225,228,229,246, 97,128, 9, 81,226,108, 2,193,191,193,199,225, - 227,245,244,101,128, 1,113,231,242,225,246,101,128, 2, 21,229, - 246, 97,128, 9, 9,233,229,242,229,243,233,115,133, 0,252,193, - 233,193,241,193,249,194, 16,194, 24,225,227,245,244,101,128, 1, - 216,226,229,236,239,119,128, 30,115, 99, 2,193,255,194, 6,225, - 242,239,110,128, 1,218,249,242,233,236,236,233, 99,128, 4,241, - 231,242,225,246,101,128, 1,220,237,225,227,242,239,110,128, 1, - 214,239,244,226,229,236,239,119,128, 30,229,103, 2,194, 49,194, - 56,242,225,246,101,128, 0,249,117, 2,194, 62,194, 71,234,225, - 242,225,244,105,128, 10,137,242,237,245,235,232,105,128, 10, 9, - 104, 3,194, 88,194, 98,194,176,233,242,225,231,225,238, 97,128, - 48, 70,111, 2,194,104,194,114,239,235,225,226,239,246,101,128, - 30,231,242,110,133, 1,176,194,129,194,137,194,148,194,156,194, - 168,225,227,245,244,101,128, 30,233,228,239,244,226,229,236,239, - 119,128, 30,241,231,242,225,246,101,128, 30,235,232,239,239,235, - 225,226,239,246,101,128, 30,237,244,233,236,228,101,128, 30,239, - 245,238,231,225,242,245,237,236,225,245,116,129, 1,113,194,192, - 227,249,242,233,236,236,233, 99,128, 4,243,233,238,246,229,242, - 244,229,228,226,242,229,246,101,128, 2, 23,107, 3,194,227,194, - 251,195, 6,225,244,225,235,225,238, 97,129, 48,166,194,239,232, - 225,236,230,247,233,228,244,104,128,255,115,227,249,242,233,236, - 236,233, 99,128, 4,121,239,242,229,225,110,128, 49, 92,109, 2, - 195, 20,195, 73, 97, 2,195, 26,195, 59,227,242,239,110,130, 1, - 107,195, 37,195, 48,227,249,242,233,236,236,233, 99,128, 4,239, - 228,233,229,242,229,243,233,115,128, 30,123,244,242,225,231,245, - 242,237,245,235,232,105,128, 10, 65,239,238,239,243,240,225,227, - 101,128,255, 85,110, 2,195, 90,195,145,228,229,242,243,227,239, - 242,101,132, 0, 95,195,109,195,115,195,127,195,138,228,226,108, - 128, 32, 23,237,239,238,239,243,240,225,227,101,128,255, 63,246, - 229,242,244,233,227,225,108,128,254, 51,247,225,246,121,128,254, - 79,105, 2,195,151,195,156,239,110,128, 34, 42,246,229,242,243, - 225,108,128, 34, 0,239,231,239,238,229,107,128, 1,115,112, 5, - 195,186,195,193,195,201,195,216,196, 11,225,242,229,110,128, 36, - 176,226,236,239,227,107,128, 37,128,240,229,242,228,239,244,232, - 229,226,242,229,119,128, 5,196,243,233,236,239,110,131, 3,197, - 195,230,195,251,196, 3,228,233,229,242,229,243,233,115,129, 3, - 203,195,243,244,239,238,239,115,128, 3,176,236,225,244,233,110, - 128, 2,138,244,239,238,239,115,128, 3,205,244,225,227,107, 2, - 196, 20,196, 31,226,229,236,239,247,227,237, 98,128, 3, 29,237, - 239,100,128, 2,212,114, 2,196, 43,196, 55,225,231,245,242,237, - 245,235,232,105,128, 10,115,233,238,103,128, 1,111,115, 3,196, - 69,196, 84,196,129,232,239,242,244,227,249,242,233,236,236,233, - 99,128, 4, 94,237,225,236,108, 2,196, 93,196,104,232,233,242, - 225,231,225,238, 97,128, 48, 69,235,225,244,225,235,225,238, 97, - 129, 48,165,196,117,232,225,236,230,247,233,228,244,104,128,255, - 105,244,242,225,233,231,232,116, 2,196,141,196,152,227,249,242, - 233,236,236,233, 99,128, 4,175,243,244,242,239,235,229,227,249, - 242,233,236,236,233, 99,128, 4,177,244,233,236,228,101,130, 1, - 105,196,181,196,189,225,227,245,244,101,128, 30,121,226,229,236, - 239,119,128, 30,117,117, 5,196,209,196,219,196,226,196,251,197, - 11,226,229,238,231,225,236,105,128, 9,138,228,229,246, 97,128, - 9, 10,231,117, 2,196,233,196,242,234,225,242,225,244,105,128, - 10,138,242,237,245,235,232,105,128, 10, 10,237,225,244,242,225, - 231,245,242,237,245,235,232,105,128, 10, 66,246,239,247,229,236, - 243,233,231,110, 3,197, 27,197, 37,197, 44,226,229,238,231,225, - 236,105,128, 9,194,228,229,246, 97,128, 9, 66,231,245,234,225, - 242,225,244,105,128, 10,194,246,239,247,229,236,243,233,231,110, - 3,197, 71,197, 81,197, 88,226,229,238,231,225,236,105,128, 9, - 193,228,229,246, 97,128, 9, 65,231,245,234,225,242,225,244,105, - 128, 10,193,118,139, 0,118,197,125,198, 17,198, 26,198, 37,198, - 222,198,229,199, 71,199, 83,199,183,199,191,199,212, 97, 4,197, - 135,197,142,197,167,197,178,228,229,246, 97,128, 9, 53,231,117, - 2,197,149,197,158,234,225,242,225,244,105,128, 10,181,242,237, - 245,235,232,105,128, 10, 53,235,225,244,225,235,225,238, 97,128, - 48,247,118,132, 5,213,197,190,197,217,197,249,198, 5,228,225, - 231,229,243,104,130,251, 53,197,203,197,208,182, 53,128,251, 53, - 232,229,226,242,229,119,128,251, 53,104, 2,197,223,197,231,229, - 226,242,229,119,128, 5,213,239,236,225,109,129,251, 75,197,240, - 232,229,226,242,229,119,128,251, 75,246,225,246,232,229,226,242, - 229,119,128, 5,240,249,239,228,232,229,226,242,229,119,128, 5, - 241,227,233,242,227,236,101,128, 36,229,228,239,244,226,229,236, - 239,119,128, 30,127,101, 6,198, 51,198, 62,198,126,198,137,198, - 143,198,210,227,249,242,233,236,236,233, 99,128, 4, 50,104, 4, - 198, 72,198, 81,198, 95,198,111,225,242,225,226,233, 99,128, 6, - 164,230,233,238,225,236,225,242,225,226,233, 99,128,251,107,233, - 238,233,244,233,225,236,225,242,225,226,233, 99,128,251,108,237, - 229,228,233,225,236,225,242,225,226,233, 99,128,251,109,235,225, - 244,225,235,225,238, 97,128, 48,249,238,245,115,128, 38, 64,242, - 244,233,227,225,108, 2,198,154,198,160,226,225,114,128, 0,124, - 236,233,238,101, 4,198,173,198,184,198,195,198,204,225,226,239, - 246,229,227,237, 98,128, 3, 13,226,229,236,239,247,227,237, 98, - 128, 3, 41,236,239,247,237,239,100,128, 2,204,237,239,100,128, - 2,200,247,225,242,237,229,238,233,225,110,128, 5,126,232,239, - 239,107,128, 2,139,105, 3,198,237,198,248,199, 31,235,225,244, - 225,235,225,238, 97,128, 48,248,242,225,237, 97, 3,199, 3,199, - 13,199, 20,226,229,238,231,225,236,105,128, 9,205,228,229,246, - 97,128, 9, 77,231,245,234,225,242,225,244,105,128, 10,205,243, - 225,242,231, 97, 3,199, 43,199, 53,199, 60,226,229,238,231,225, - 236,105,128, 9,131,228,229,246, 97,128, 9, 3,231,245,234,225, - 242,225,244,105,128, 10,131,237,239,238,239,243,240,225,227,101, - 128,255, 86,111, 3,199, 91,199,102,199,172,225,242,237,229,238, - 233,225,110,128, 5,120,233,227,229,100, 2,199,111,199,147,233, - 244,229,242,225,244,233,239,110, 2,199,125,199,136,232,233,242, - 225,231,225,238, 97,128, 48,158,235,225,244,225,235,225,238, 97, - 128, 48,254,237,225,242,235,235,225,238, 97,129, 48,155,199,160, - 232,225,236,230,247,233,228,244,104,128,255,158,235,225,244,225, - 235,225,238, 97,128, 48,250,240,225,242,229,110,128, 36,177,116, - 2,199,197,199,204,233,236,228,101,128, 30,125,245,242,238,229, - 100,128, 2,140,117, 2,199,218,199,229,232,233,242,225,231,225, - 238, 97,128, 48,148,235,225,244,225,235,225,238, 97,128, 48,244, - 119,143, 0,119,200, 18,200,251,201, 5,201, 28,201, 68,201,135, - 201,143,203,114,203,155,203,167,203,242,203,250,204, 1,204, 12, - 204, 21, 97, 8,200, 36,200, 43,200, 53,200, 64,200,102,200,134, - 200,146,200,182,227,245,244,101,128, 30,131,229,235,239,242,229, - 225,110,128, 49, 89,232,233,242,225,231,225,238, 97,128, 48,143, - 107, 2,200, 70,200, 94,225,244,225,235,225,238, 97,129, 48,239, - 200, 82,232,225,236,230,247,233,228,244,104,128,255,156,239,242, - 229,225,110,128, 49, 88,243,237,225,236,108, 2,200,112,200,123, - 232,233,242,225,231,225,238, 97,128, 48,142,235,225,244,225,235, - 225,238, 97,128, 48,238,244,244,239,243,241,245,225,242,101,128, - 51, 87,118, 2,200,152,200,160,229,228,225,243,104,128, 48, 28, - 249,245,238,228,229,242,243,227,239,242,229,246,229,242,244,233, - 227,225,108,128,254, 52,119, 3,200,190,200,199,200,213,225,242, - 225,226,233, 99,128, 6, 72,230,233,238,225,236,225,242,225,226, - 233, 99,128,254,238,232,225,237,250,225,225,226,239,246,101, 2, - 200,228,200,237,225,242,225,226,233, 99,128, 6, 36,230,233,238, - 225,236,225,242,225,226,233, 99,128,254,134,226,243,241,245,225, - 242,101,128, 51,221,227,233,242, 99, 2,201, 14,201, 19,236,101, - 128, 36,230,245,237,230,236,229,120,128, 1,117,100, 2,201, 34, - 201, 44,233,229,242,229,243,233,115,128, 30,133,239,116, 2,201, - 51,201, 60,225,227,227,229,238,116,128, 30,135,226,229,236,239, - 119,128, 30,137,101, 4,201, 78,201, 89,201,101,201,125,232,233, - 242,225,231,225,238, 97,128, 48,145,233,229,242,243,244,242,225, - 243,115,128, 33, 24,107, 2,201,107,201,117,225,244,225,235,225, - 238, 97,128, 48,241,239,242,229,225,110,128, 49, 94,239,235,239, - 242,229,225,110,128, 49, 93,231,242,225,246,101,128, 30,129,232, - 233,244,101, 8,201,164,201,173,202, 1,202, 91,202,175,202,220, - 203, 16,203, 72,226,245,236,236,229,116,128, 37,230, 99, 2,201, - 179,201,199,233,242,227,236,101,129, 37,203,201,189,233,238,246, - 229,242,243,101,128, 37,217,239,242,238,229,242,226,242,225,227, - 235,229,116, 2,201,216,201,236,236,229,230,116,129, 48, 14,201, - 225,246,229,242,244,233,227,225,108,128,254, 67,242,233,231,232, - 116,129, 48, 15,201,246,246,229,242,244,233,227,225,108,128,254, - 68,100, 2,202, 7,202, 48,233,225,237,239,238,100,129, 37,199, - 202, 18,227,239,238,244,225,233,238,233,238,231,226,236,225,227, - 235,243,237,225,236,236,228,233,225,237,239,238,100,128, 37,200, - 239,247,238,240,239,233,238,244,233,238,103, 2,202, 64,202, 80, - 243,237,225,236,236,244,242,233,225,238,231,236,101,128, 37,191, - 244,242,233,225,238,231,236,101,128, 37,189,236,101, 2,202, 98, - 202,140,230,244,240,239,233,238,244,233,238,103, 2,202,113,202, - 129,243,237,225,236,236,244,242,233,225,238,231,236,101,128, 37, - 195,244,242,233,225,238,231,236,101,128, 37,193,238,244,233,227, - 245,236,225,242,226,242,225,227,235,229,116, 2,202,160,202,167, - 236,229,230,116,128, 48, 22,242,233,231,232,116,128, 48, 23,242, - 233,231,232,244,240,239,233,238,244,233,238,103, 2,202,193,202, - 209,243,237,225,236,236,244,242,233,225,238,231,236,101,128, 37, - 185,244,242,233,225,238,231,236,101,128, 37,183,115, 3,202,228, - 203, 2,203, 10,109, 2,202,234,202,246,225,236,236,243,241,245, - 225,242,101,128, 37,171,233,236,233,238,231,230,225,227,101,128, - 38, 58,241,245,225,242,101,128, 37,161,244,225,114,128, 38, 6, - 116, 2,203, 22,203, 33,229,236,229,240,232,239,238,101,128, 38, - 15,239,242,244,239,233,243,229,243,232,229,236,236,226,242,225, - 227,235,229,116, 2,203, 57,203, 64,236,229,230,116,128, 48, 24, - 242,233,231,232,116,128, 48, 25,245,240,240,239,233,238,244,233, - 238,103, 2,203, 87,203,103,243,237,225,236,236,244,242,233,225, - 238,231,236,101,128, 37,181,244,242,233,225,238,231,236,101,128, - 37,179,105, 2,203,120,203,131,232,233,242,225,231,225,238, 97, - 128, 48,144,107, 2,203,137,203,147,225,244,225,235,225,238, 97, - 128, 48,240,239,242,229,225,110,128, 49, 95,237,239,238,239,243, - 240,225,227,101,128,255, 87,111, 4,203,177,203,188,203,213,203, - 231,232,233,242,225,231,225,238, 97,128, 48,146,235,225,244,225, - 235,225,238, 97,129, 48,242,203,201,232,225,236,230,247,233,228, - 244,104,128,255,102,110,129, 32,169,203,219,237,239,238,239,243, - 240,225,227,101,128,255,230,247,225,229,238,244,232,225,105,128, - 14, 39,240,225,242,229,110,128, 36,178,242,233,238,103,128, 30, - 152,243,245,240,229,242,233,239,114,128, 2,183,244,245,242,238, - 229,100,128, 2,141,249,238,110,128, 1,191,120,137, 0,120,204, - 49,204, 60,204, 71,204, 80,204,107,204,120,204,124,204,136,204, - 144,225,226,239,246,229,227,237, 98,128, 3, 61,226,239,240,239, - 237,239,230,111,128, 49, 18,227,233,242,227,236,101,128, 36,231, - 100, 2,204, 86,204, 96,233,229,242,229,243,233,115,128, 30,141, - 239,244,225,227,227,229,238,116,128, 30,139,229,232,225,242,237, - 229,238,233,225,110,128, 5,109,105,128, 3,190,237,239,238,239, - 243,240,225,227,101,128,255, 88,240,225,242,229,110,128, 36,179, - 243,245,240,229,242,233,239,114,128, 2,227,121,143, 0,121,204, - 189,205,148,205,171,205,211,207,177,207,185,207,202,208, 10,208, - 22,209, 19,209, 59,209, 71,209, 82,209,103,210, 76, 97, 11,204, - 213,204,225,204,235,204,242,204,249,205, 3,205, 28,205, 39,205, - 77,205, 90,205,136,225,228,239,243,241,245,225,242,101,128, 51, - 78,226,229,238,231,225,236,105,128, 9,175,227,245,244,101,128, - 0,253,228,229,246, 97,128, 9, 47,229,235,239,242,229,225,110, - 128, 49, 82,231,117, 2,205, 10,205, 19,234,225,242,225,244,105, - 128, 10,175,242,237,245,235,232,105,128, 10, 47,232,233,242,225, - 231,225,238, 97,128, 48,132,107, 2,205, 45,205, 69,225,244,225, - 235,225,238, 97,129, 48,228,205, 57,232,225,236,230,247,233,228, - 244,104,128,255,148,239,242,229,225,110,128, 49, 81,237,225,235, - 235,225,238,244,232,225,105,128, 14, 78,243,237,225,236,108, 2, - 205,100,205,111,232,233,242,225,231,225,238, 97,128, 48,131,235, - 225,244,225,235,225,238, 97,129, 48,227,205,124,232,225,236,230, - 247,233,228,244,104,128,255,108,244,227,249,242,233,236,236,233, - 99,128, 4, 99,227,233,242, 99, 2,205,157,205,162,236,101,128, - 36,232,245,237,230,236,229,120,128, 1,119,100, 2,205,177,205, - 187,233,229,242,229,243,233,115,128, 0,255,239,116, 2,205,194, - 205,203,225,227,227,229,238,116,128, 30,143,226,229,236,239,119, - 128, 30,245,101, 7,205,227,206,235,206,244,207, 6,207, 38,207, - 114,207,165,104, 8,205,245,205,254,206, 32,206, 46,206,119,206, - 135,206,194,206,212,225,242,225,226,233, 99,128, 6, 74,226,225, - 242,242,229,101, 2,206, 9,206, 18,225,242,225,226,233, 99,128, - 6,210,230,233,238,225,236,225,242,225,226,233, 99,128,251,175, - 230,233,238,225,236,225,242,225,226,233, 99,128,254,242,232,225, - 237,250,225,225,226,239,246,101, 4,206, 65,206, 74,206, 88,206, - 104,225,242,225,226,233, 99,128, 6, 38,230,233,238,225,236,225, - 242,225,226,233, 99,128,254,138,233,238,233,244,233,225,236,225, - 242,225,226,233, 99,128,254,139,237,229,228,233,225,236,225,242, - 225,226,233, 99,128,254,140,233,238,233,244,233,225,236,225,242, - 225,226,233, 99,128,254,243,237,101, 2,206,142,206,155,228,233, - 225,236,225,242,225,226,233, 99,128,254,244,229,237,105, 2,206, - 163,206,178,238,233,244,233,225,236,225,242,225,226,233, 99,128, - 252,221,243,239,236,225,244,229,228,225,242,225,226,233, 99,128, - 252, 88,238,239,239,238,230,233,238,225,236,225,242,225,226,233, - 99,128,252,148,244,232,242,229,229,228,239,244,243,226,229,236, - 239,247,225,242,225,226,233, 99,128, 6,209,235,239,242,229,225, - 110,128, 49, 86,110,129, 0,165,206,250,237,239,238,239,243,240, - 225,227,101,128,255,229,111, 2,207, 12,207, 21,235,239,242,229, - 225,110,128, 49, 85,242,233,238,232,233,229,245,232,235,239,242, - 229,225,110,128, 49,134,114, 3,207, 46,207, 82,207, 94,225,232, - 226,229,238,249,239,237,111, 2,207, 60,207, 69,232,229,226,242, - 229,119,128, 5,170,236,229,230,244,232,229,226,242,229,119,128, - 5,170,233,227,249,242,233,236,236,233, 99,128, 4, 75,245,228, - 233,229,242,229,243,233,243,227,249,242,233,236,236,233, 99,128, - 4,249,243,233,229,245,238,103, 3,207,127,207,136,207,152,235, - 239,242,229,225,110,128, 49,129,240,225,238,243,233,239,243,235, - 239,242,229,225,110,128, 49,131,243,233,239,243,235,239,242,229, - 225,110,128, 49,130,244,233,246,232,229,226,242,229,119,128, 5, - 154,231,242,225,246,101,128, 30,243,232,239,239,107,129, 1,180, - 207,194,225,226,239,246,101,128, 30,247,105, 5,207,214,207,225, - 207,236,207,245,207,253,225,242,237,229,238,233,225,110,128, 5, - 117,227,249,242,233,236,236,233, 99,128, 4, 87,235,239,242,229, - 225,110,128, 49, 98,238,249,225,238,103,128, 38, 47,247,238,225, - 242,237,229,238,233,225,110,128, 5,130,237,239,238,239,243,240, - 225,227,101,128,255, 89,111, 7,208, 38,208,108,208,119,208,129, - 208,167,208,213,208,222,100,131, 5,217,208, 48,208, 68,208, 77, - 228,225,231,229,243,104,129,251, 57,208, 59,232,229,226,242,229, - 119,128,251, 57,232,229,226,242,229,119,128, 5,217,249,239,100, - 2,208, 85,208, 94,232,229,226,242,229,119,128, 5,242,240,225, - 244,225,232,232,229,226,242,229,119,128,251, 31,232,233,242,225, - 231,225,238, 97,128, 48,136,233,235,239,242,229,225,110,128, 49, - 137,107, 2,208,135,208,159,225,244,225,235,225,238, 97,129, 48, - 232,208,147,232,225,236,230,247,233,228,244,104,128,255,150,239, - 242,229,225,110,128, 49, 91,243,237,225,236,108, 2,208,177,208, - 188,232,233,242,225,231,225,238, 97,128, 48,135,235,225,244,225, - 235,225,238, 97,129, 48,231,208,201,232,225,236,230,247,233,228, - 244,104,128,255,110,244,231,242,229,229,107,128, 3,243,121, 2, - 208,228,209, 9, 97, 2,208,234,208,244,229,235,239,242,229,225, - 110,128, 49,136,107, 2,208,250,209, 2,239,242,229,225,110,128, - 49,135,244,232,225,105,128, 14, 34,233,238,231,244,232,225,105, - 128, 14, 13,112, 2,209, 25,209, 32,225,242,229,110,128, 36,180, - 239,231,229,231,242,225,237,237,229,238,105,129, 3,122,209, 48, - 231,242,229,229,235,227,237, 98,128, 3, 69,114,129, 1,166,209, - 65,233,238,103,128, 30,153,243,245,240,229,242,233,239,114,128, - 2,184,116, 2,209, 88,209, 95,233,236,228,101,128, 30,249,245, - 242,238,229,100,128, 2,142,117, 5,209,115,209,126,209,136,209, - 174,210, 50,232,233,242,225,231,225,238, 97,128, 48,134,233,235, - 239,242,229,225,110,128, 49,140,107, 2,209,142,209,166,225,244, - 225,235,225,238, 97,129, 48,230,209,154,232,225,236,230,247,233, - 228,244,104,128,255,149,239,242,229,225,110,128, 49, 96,115, 3, - 209,182,209,220,210, 5,226,233,103, 2,209,190,209,201,227,249, - 242,233,236,236,233, 99,128, 4,107,233,239,244,233,230,233,229, - 228,227,249,242,233,236,236,233, 99,128, 4,109,236,233,244,244, - 236,101, 2,209,231,209,242,227,249,242,233,236,236,233, 99,128, - 4,103,233,239,244,233,230,233,229,228,227,249,242,233,236,236, - 233, 99,128, 4,105,237,225,236,108, 2,210, 14,210, 25,232,233, - 242,225,231,225,238, 97,128, 48,133,235,225,244,225,235,225,238, - 97,129, 48,229,210, 38,232,225,236,230,247,233,228,244,104,128, - 255,109,249,101, 2,210, 57,210, 66,235,239,242,229,225,110,128, - 49,139,239,235,239,242,229,225,110,128, 49,138,249, 97, 2,210, - 83,210, 93,226,229,238,231,225,236,105,128, 9,223,228,229,246, - 97,128, 9, 95,122,142, 0,122,210,132,211,140,211,151,211,194, - 211,221,213, 0,213,108,213,150,213,162,213,174,213,202,213,210, - 213,226,213,235, 97, 10,210,154,210,165,210,172,210,179,210,190, - 211, 12,211, 42,211, 53,211, 89,211,101,225,242,237,229,238,233, - 225,110,128, 5,102,227,245,244,101,128, 1,122,228,229,246, 97, - 128, 9, 91,231,245,242,237,245,235,232,105,128, 10, 91,104, 4, - 210,200,210,209,210,223,210,253,225,242,225,226,233, 99,128, 6, - 56,230,233,238,225,236,225,242,225,226,233, 99,128,254,198,105, - 2,210,229,210,244,238,233,244,233,225,236,225,242,225,226,233, - 99,128,254,199,242,225,231,225,238, 97,128, 48, 86,237,229,228, - 233,225,236,225,242,225,226,233, 99,128,254,200,233,110, 2,211, - 19,211, 28,225,242,225,226,233, 99,128, 6, 50,230,233,238,225, - 236,225,242,225,226,233, 99,128,254,176,235,225,244,225,235,225, - 238, 97,128, 48,182,241,229,102, 2,211, 61,211, 75,231,225,228, - 239,236,232,229,226,242,229,119,128, 5,149,241,225,244,225,238, - 232,229,226,242,229,119,128, 5,148,242,241,225,232,229,226,242, - 229,119,128, 5,152,249,233,110,130, 5,214,211,111,211,131,228, - 225,231,229,243,104,129,251, 54,211,122,232,229,226,242,229,119, - 128,251, 54,232,229,226,242,229,119,128, 5,214,226,239,240,239, - 237,239,230,111,128, 49, 23, 99, 3,211,159,211,166,211,188,225, - 242,239,110,128, 1,126,233,242, 99, 2,211,174,211,179,236,101, - 128, 36,233,245,237,230,236,229,120,128, 30,145,245,242,108,128, - 2,145,228,239,116,130, 1,124,211,204,211,213,225,227,227,229, - 238,116,128, 1,124,226,229,236,239,119,128, 30,147,101, 6,211, - 235,211,246,212, 33,212, 44,212, 55,212,251,227,249,242,233,236, - 236,233, 99,128, 4, 55,100, 2,211,252,212, 15,229,243,227,229, - 238,228,229,242,227,249,242,233,236,236,233, 99,128, 4,153,233, - 229,242,229,243,233,243,227,249,242,233,236,236,233, 99,128, 4, - 223,232,233,242,225,231,225,238, 97,128, 48, 92,235,225,244,225, - 235,225,238, 97,128, 48,188,242,111,140, 0, 48,212, 84,212, 93, - 212,103,212,110,212,135,212,148,212,159,212,171,212,182,212,192, - 212,203,212,210,225,242,225,226,233, 99,128, 6, 96,226,229,238, - 231,225,236,105,128, 9,230,228,229,246, 97,128, 9,102,231,117, - 2,212,117,212,126,234,225,242,225,244,105,128, 10,230,242,237, - 245,235,232,105,128, 10,102,232,225,227,235,225,242,225,226,233, - 99,128, 6, 96,233,238,230,229,242,233,239,114,128, 32,128,237, - 239,238,239,243,240,225,227,101,128,255, 16,239,236,228,243,244, - 249,236,101,128,247, 48,240,229,242,243,233,225,110,128, 6,240, - 243,245,240,229,242,233,239,114,128, 32,112,244,232,225,105,128, - 14, 80,247,233,228,244,104, 3,212,222,212,231,212,243,234,239, - 233,238,229,114,128,254,255,238,239,238,234,239,233,238,229,114, - 128, 32, 12,243,240,225,227,101,128, 32, 11,244, 97,128, 3,182, - 104, 2,213, 6,213, 17,226,239,240,239,237,239,230,111,128, 49, - 19,101, 4,213, 27,213, 38,213, 54,213, 65,225,242,237,229,238, - 233,225,110,128, 5,106,226,242,229,246,229,227,249,242,233,236, - 236,233, 99,128, 4,194,227,249,242,233,236,236,233, 99,128, 4, - 54,100, 2,213, 71,213, 90,229,243,227,229,238,228,229,242,227, - 249,242,233,236,236,233, 99,128, 4,151,233,229,242,229,243,233, - 243,227,249,242,233,236,236,233, 99,128, 4,221,105, 3,213,116, - 213,127,213,138,232,233,242,225,231,225,238, 97,128, 48, 88,235, - 225,244,225,235,225,238, 97,128, 48,184,238,239,242,232,229,226, - 242,229,119,128, 5,174,236,233,238,229,226,229,236,239,119,128, - 30,149,237,239,238,239,243,240,225,227,101,128,255, 90,111, 2, - 213,180,213,191,232,233,242,225,231,225,238, 97,128, 48, 94,235, - 225,244,225,235,225,238, 97,128, 48,190,240,225,242,229,110,128, - 36,181,242,229,244,242,239,230,236,229,248,232,239,239,107,128, - 2,144,243,244,242,239,235,101,128, 1,182,117, 2,213,241,213, - 252,232,233,242,225,231,225,238, 97,128, 48, 90,235,225,244,225, - 235,225,238, 97,128, 48,186 + 4,221,105, 3,218, 42,218, 53,218, 64,232,233,242,225,231,225, + 238, 97,128, 48, 88,235,225,244,225,235,225,238, 97,128, 48,184, + 238,239,242,232,229,226,242,229,119,128, 5,174,236,233,238,229, + 226,229,236,239,119,128, 30,149,237,239,238,239,243,240,225,227, + 101,128,255, 90,111, 2,218,106,218,117,232,233,242,225,231,225, + 238, 97,128, 48, 94,235,225,244,225,235,225,238, 97,128, 48,190, + 240,225,242,229,110,128, 36,181,242,229,244,242,239,230,236,229, + 248,232,239,239,107,128, 2,144,243,244,242,239,235,101,128, 1, + 182,117, 2,218,167,218,178,232,233,242,225,231,225,238, 97,128, + 48, 90,235,225,244,225,235,225,238, 97,128, 48,186 }; Index: src/psnames/rules.mk =================================================================== --- src/psnames/rules.mk (revision 58178) +++ src/psnames/rules.mk (working copy) @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003 by +# Copyright 1996-2000, 2001, 2003, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -25,14 +25,15 @@ # PSNames driver sources (i.e., C files) # -PSNAMES_DRV_SRC := $(PSNAMES_DIR)/psmodule.c +PSNAMES_DRV_SRC := $(PSNAMES_DIR)/psmodule.c \ + $(PSNAMES_DIR)/pspic.c # PSNames driver headers # PSNAMES_DRV_H := $(PSNAMES_DRV_SRC:%.c=%.h) \ - $(PSNAMES_DIR)/pstables.h \ - $(PSNAMES_DIR)/psnamerr.h + $(PSNAMES_DIR)/psnamerr.h \ + $(PSNAMES_DIR)/pstables.h # PSNames driver object(s) Index: src/raster/ftmisc.h =================================================================== --- src/raster/ftmisc.h (revision 58178) +++ src/raster/ftmisc.h (working copy) @@ -115,6 +115,27 @@ return ( s > 0 ) ? d : -d; } + + static FT_Long + FT_MulDiv_No_Round( FT_Long a, + FT_Long b, + FT_Long c ) + { + FT_Int s; + FT_Long d; + + + s = 1; + if ( a < 0 ) { a = -a; s = -1; } + if ( b < 0 ) { b = -b; s = -s; } + if ( c < 0 ) { c = -c; s = -s; } + + d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c + : 0x7FFFFFFFL ); + + return ( s > 0 ) ? d : -d; + } + #endif /* __FTMISC_H__ */ Index: src/raster/ftraster.c =================================================================== --- src/raster/ftraster.c (revision 58178) +++ src/raster/ftraster.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2005, 2007, 2008, 2009, 2010 by */ +/* Copyright 1996-2003, 2005, 2007-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -60,7 +60,7 @@ #include <ft2build.h> #include "ftraster.h" -#include FT_INTERNAL_CALC_H /* for FT_MulDiv only */ +#include FT_INTERNAL_CALC_H /* for FT_MulDiv and FT_MulDiv_No_Round */ #include "rastpic.h" @@ -255,7 +255,8 @@ /* On the other hand, SMulDiv means `Slow MulDiv', and is used typically */ /* for clipping computations. It simply uses the FT_MulDiv() function */ /* defined in `ftcalc.h'. */ -#define SMulDiv FT_MulDiv +#define SMulDiv FT_MulDiv +#define SMulDiv_No_Round FT_MulDiv_No_Round /* The rasterizer is a very general purpose component; please leave */ /* the following redefinitions there (you never know your target */ @@ -369,18 +370,23 @@ /* Simple record used to implement a stack of bands, required */ /* by the sub-banding mechanism */ - typedef struct TBand_ + typedef struct black_TBand_ { Short y_min; /* band's minimum */ Short y_max; /* band's maximum */ - } TBand; + } black_TBand; #define AlignProfileSize \ ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) ) +#undef RAS_ARG +#undef RAS_ARGS +#undef RAS_VAR +#undef RAS_VARS + #ifdef FT_STATIC_RASTER @@ -396,8 +402,8 @@ #else /* !FT_STATIC_RASTER */ -#define RAS_ARGS PWorker worker, -#define RAS_ARG PWorker worker +#define RAS_ARGS black_PWorker worker, +#define RAS_ARG black_PWorker worker #define RAS_VARS worker, #define RAS_VAR worker @@ -408,7 +414,7 @@ #endif /* !FT_STATIC_RASTER */ - typedef struct TWorker_ TWorker, *PWorker; + typedef struct black_TWorker_ black_TWorker, *black_PWorker; /* prototypes used for sweep function dispatch */ @@ -428,6 +434,10 @@ /* NOTE: These operations are only valid on 2's complement processors */ +#undef FLOOR +#undef CEILING +#undef TRUNC +#undef SCALED #define FLOOR( x ) ( (x) & -ras.precision ) #define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision ) @@ -442,7 +452,7 @@ /* Thus, their offset can be coded with less opcodes, resulting in a */ /* smaller executable. */ - struct TWorker_ + struct black_TWorker_ { Int precision_bits; /* precision related variables */ Int precision; @@ -515,8 +525,8 @@ TPoint arcs[3 * MaxBezier + 1]; /* The Bezier stack */ - TBand band_stack[16]; /* band stack used for sub-banding */ - Int band_top; /* band stack top */ + black_TBand band_stack[16]; /* band stack used for sub-banding */ + Int band_top; /* band stack top */ #ifdef FT_RASTER_OPTION_ANTI_ALIASING @@ -540,20 +550,20 @@ }; - typedef struct TRaster_ + typedef struct black_TRaster_ { - char* buffer; - long buffer_size; - void* memory; - PWorker worker; - Byte grays[5]; - Short gray_width; + char* buffer; + long buffer_size; + void* memory; + black_PWorker worker; + Byte grays[5]; + Short gray_width; - } TRaster, *PRaster; + } black_TRaster, *black_PRaster; #ifdef FT_STATIC_RASTER - static TWorker cur_ras; + static black_TWorker cur_ras; #define ras cur_ras #else /* !FT_STATIC_RASTER */ @@ -651,11 +661,33 @@ static void Set_High_Precision( RAS_ARGS Int High ) { + /* + * `precision_step' is used in `Bezier_Up' to decide when to split a + * given y-monotonous Bezier arc that crosses a scanline before + * approximating it as a straight segment. The default value of 32 (for + * low accuracy) corresponds to + * + * 32 / 64 == 0.5 pixels , + * + * while for the high accuracy case we have + * + * 256/ (1 << 12) = 0.0625 pixels . + * + * `precision_jitter' is an epsilon threshold used in + * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier + * decomposition (after all, we are working with approximations only); + * it avoids switching on additional pixels which would cause artifacts + * otherwise. + * + * The value of `precision_jitter' has been determined heuristically. + * + */ + if ( High ) { ras.precision_bits = 12; ras.precision_step = 256; - ras.precision_jitter = 50; + ras.precision_jitter = 30; } else { @@ -1119,14 +1151,14 @@ if ( Dx > 0 ) { - Ix = SMulDiv( ras.precision, Dx, Dy); + Ix = SMulDiv_No_Round( ras.precision, Dx, Dy ); Rx = ( ras.precision * Dx ) % Dy; Dx = 1; } else { - Ix = SMulDiv( ras.precision, -Dx, Dy) * -1; - Rx = ( ras.precision * -Dx ) % Dy; + Ix = -SMulDiv_No_Round( ras.precision, -Dx, Dy ); + Rx = ( ras.precision * -Dx ) % Dy; Dx = -1; } @@ -2403,6 +2435,14 @@ return; /* no drop-out control */ } + /* undocumented but confirmed: If the drop-out would result in a */ + /* pixel outside of the bounding box, use the pixel inside of the */ + /* bounding box instead */ + if ( pxl < 0 ) + pxl = e1; + else if ( TRUNC( pxl ) >= ras.bWidth ) + pxl = e2; + /* check that the other pixel isn't set */ e1 = pxl == e1 ? e2 : e1; @@ -2579,6 +2619,14 @@ return; /* no drop-out control */ } + /* undocumented but confirmed: If the drop-out would result in a */ + /* pixel outside of the bounding box, use the pixel inside of the */ + /* bounding box instead */ + if ( pxl < 0 ) + pxl = e1; + else if ( TRUNC( pxl ) >= ras.target.rows ) + pxl = e2; + /* check that the other pixel isn't set */ e1 = pxl == e1 ? e2 : e1; @@ -3353,7 +3401,7 @@ static void - ft_black_init( PRaster raster ) + ft_black_init( black_PRaster raster ) { #ifdef FT_RASTER_OPTION_ANTI_ALIASING FT_UInt n; @@ -3381,7 +3429,7 @@ ft_black_new( void* memory, FT_Raster *araster ) { - static TRaster the_raster; + static black_TRaster the_raster; FT_UNUSED( memory ); @@ -3405,11 +3453,11 @@ static int - ft_black_new( FT_Memory memory, - PRaster *araster ) + ft_black_new( FT_Memory memory, + black_PRaster *araster ) { - FT_Error error; - PRaster raster = NULL; + FT_Error error; + black_PRaster raster = NULL; *araster = 0; @@ -3426,9 +3474,11 @@ static void - ft_black_done( PRaster raster ) + ft_black_done( black_PRaster raster ) { FT_Memory memory = (FT_Memory)raster->memory; + + FT_FREE( raster ); } @@ -3437,15 +3487,15 @@ static void - ft_black_reset( PRaster raster, - char* pool_base, - long pool_size ) + ft_black_reset( black_PRaster raster, + char* pool_base, + long pool_size ) { if ( raster ) { - if ( pool_base && pool_size >= (long)sizeof(TWorker) + 2048 ) + if ( pool_base && pool_size >= (long)sizeof ( black_TWorker ) + 2048 ) { - PWorker worker = (PWorker)pool_base; + black_PWorker worker = (black_PWorker)pool_base; raster->buffer = pool_base + ( ( sizeof ( *worker ) + 7 ) & ~7 ); @@ -3463,7 +3513,7 @@ static void - ft_black_set_mode( PRaster raster, + ft_black_set_mode( black_PRaster raster, unsigned long mode, const char* palette ) { @@ -3490,12 +3540,12 @@ static int - ft_black_render( PRaster raster, + ft_black_render( black_PRaster raster, const FT_Raster_Params* params ) { const FT_Outline* outline = (const FT_Outline*)params->source; const FT_Bitmap* target_map = params->target; - PWorker worker; + black_PWorker worker; if ( !raster || !raster->buffer || !raster->buffer_size ) Index: src/raster/ftrend1.c =================================================================== --- src/raster/ftrend1.c (revision 58178) +++ src/raster/ftrend1.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType glyph rasterizer interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2005, 2006 by */ +/* Copyright 1996-2003, 2005, 2006, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -161,13 +161,28 @@ /* compute the control box, and grid fit it */ FT_Outline_Get_CBox( outline, &cbox ); + /* undocumented but confirmed: bbox values get rounded */ +#if 1 + cbox.xMin = FT_PIX_ROUND( cbox.xMin ); + cbox.yMin = FT_PIX_ROUND( cbox.yMin ); + cbox.xMax = FT_PIX_ROUND( cbox.xMax ); + cbox.yMax = FT_PIX_ROUND( cbox.yMax ); +#else cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); cbox.xMax = FT_PIX_CEIL( cbox.xMax ); cbox.yMax = FT_PIX_CEIL( cbox.yMax ); +#endif width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); + + if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) + { + error = Raster_Err_Invalid_Argument; + goto Exit; + } + bitmap = &slot->bitmap; memory = render->root.memory; @@ -229,10 +244,10 @@ } - FT_DEFINE_RENDERER(ft_raster1_renderer_class, - + FT_DEFINE_RENDERER( ft_raster1_renderer_class, + FT_MODULE_RENDERER, - sizeof( FT_RendererRec ), + sizeof ( FT_RendererRec ), "raster1", 0x10000L, @@ -260,11 +275,10 @@ /* to register it by hand in your application. It should only be */ /* used for backwards-compatibility with FT 1.x anyway. */ /* */ - FT_DEFINE_RENDERER(ft_raster5_renderer_class, - - + FT_DEFINE_RENDERER( ft_raster5_renderer_class, + FT_MODULE_RENDERER, - sizeof( FT_RendererRec ), + sizeof ( FT_RendererRec ), "raster5", 0x10000L, Index: src/raster/rasterrs.h =================================================================== --- src/raster/rasterrs.h (revision 58178) +++ src/raster/rasterrs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* monochrome renderer error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX Raster_Err_ #define FT_ERR_BASE FT_Mod_Err_Raster Index: src/raster/rastpic.c =================================================================== --- src/raster/rastpic.c (revision 58178) +++ src/raster/rastpic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for raster module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,21 +20,25 @@ #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #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*); + void + FT_Init_Class_ft_standard_raster( FT_Raster_Funcs* funcs ); void - ft_raster1_renderer_class_pic_free( FT_Library library ) + ft_raster1_renderer_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->raster ) { RasterPIC* container = (RasterPIC*)pic_container->raster; - if(--container->ref_count) + if ( --container->ref_count ) return; FT_FREE( container ); pic_container->raster = NULL; @@ -43,15 +47,15 @@ FT_Error - ft_raster1_renderer_class_pic_init( FT_Library library ) + 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; + RasterPIC* container = NULL; FT_Memory memory = library->memory; - /* since this function also serve raster5 renderer, + /* since this function also serve raster5 renderer, it implements reference counting */ if ( pic_container->raster ) { @@ -60,28 +64,31 @@ } /* 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) ); + 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 */ - FT_Init_Class_ft_standard_raster(&container->ft_standard_raster); + FT_Init_Class_ft_standard_raster( &container->ft_standard_raster ); /*Exit:*/ - if(error) - ft_raster1_renderer_class_pic_free(library); + 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) + FT_Error + ft_raster5_renderer_class_pic_init( FT_Library library ) { - return ft_raster1_renderer_class_pic_init(library); + return ft_raster1_renderer_class_pic_init( library ); } - void ft_raster5_renderer_class_pic_free(FT_Library library) + + void + ft_raster5_renderer_class_pic_free( FT_Library library ) { - ft_raster1_renderer_class_pic_free(library); + ft_raster1_renderer_class_pic_free( library ); } #endif /* FT_CONFIG_OPTION_PIC */ Index: src/raster/rastpic.h =================================================================== --- src/raster/rastpic.h (revision 58178) +++ src/raster/rastpic.h (working copy) @@ -19,7 +19,7 @@ #ifndef __RASTPIC_H__ #define __RASTPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H @@ -38,6 +38,19 @@ #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 + ft_raster1_renderer_class_pic_free( FT_Library library ); + + void + ft_raster5_renderer_class_pic_free( FT_Library library ); + + FT_Error + ft_raster1_renderer_class_pic_init( FT_Library library ); + + FT_Error + ft_raster5_renderer_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: src/raster/rules.mk =================================================================== --- src/raster/rules.mk (revision 58178) +++ src/raster/rules.mk (working copy) @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003, 2008, 2009 by +# Copyright 1996-2000, 2001, 2003, 2008, 2009, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -25,7 +25,8 @@ # raster driver sources (i.e., C files) # RASTER_DRV_SRC := $(RASTER_DIR)/ftraster.c \ - $(RASTER_DIR)/ftrend1.c + $(RASTER_DIR)/ftrend1.c \ + $(RASTER_DIR)/rastpic.c # raster driver headers Index: src/sfnt/rules.mk =================================================================== --- src/sfnt/rules.mk (revision 58178) +++ src/sfnt/rules.mk (working copy) @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by +# Copyright 1996-2000, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -33,7 +33,8 @@ $(SFNT_DIR)/ttkern.c \ $(SFNT_DIR)/ttbdf.c \ $(SFNT_DIR)/sfobjs.c \ - $(SFNT_DIR)/sfdriver.c + $(SFNT_DIR)/sfdriver.c \ + $(SFNT_DIR)/sfntpic.c # SFNT driver headers # Index: src/sfnt/sfdriver.c =================================================================== --- src/sfnt/sfdriver.c (revision 58178) +++ src/sfnt/sfdriver.c (working copy) @@ -4,7 +4,7 @@ /* */ /* High-level SFNT driver interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by */ +/* Copyright 1996-2007, 2009-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -50,6 +50,7 @@ #include FT_SERVICE_SFNT_H #include FT_SERVICE_TT_CMAP_H + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -60,10 +61,10 @@ #define FT_COMPONENT trace_sfdriver - /* - * SFNT TABLE SERVICE - * - */ + /* + * SFNT TABLE SERVICE + * + */ static void* get_sfnt_table( TT_Face face, @@ -117,33 +118,38 @@ FT_ULong *offset, FT_ULong *length ) { - if ( !tag || !offset || !length ) + if ( !offset || !length ) return SFNT_Err_Invalid_Argument; - if ( idx >= face->num_tables ) - return SFNT_Err_Table_Missing; + if ( !tag ) + *length = face->num_tables; + else + { + if ( idx >= face->num_tables ) + return SFNT_Err_Table_Missing; - *tag = face->dir_tables[idx].Tag; - *offset = face->dir_tables[idx].Offset; - *length = face->dir_tables[idx].Length; + *tag = face->dir_tables[idx].Tag; + *offset = face->dir_tables[idx].Offset; + *length = face->dir_tables[idx].Length; + } return SFNT_Err_Ok; } - FT_DEFINE_SERVICE_SFNT_TABLEREC(sfnt_service_sfnt_table, + FT_DEFINE_SERVICE_SFNT_TABLEREC( + sfnt_service_sfnt_table, (FT_SFNT_TableLoadFunc)tt_face_load_any, (FT_SFNT_TableGetFunc) get_sfnt_table, - (FT_SFNT_TableInfoFunc)sfnt_table_info - ) + (FT_SFNT_TableInfoFunc)sfnt_table_info ) #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES - /* - * GLYPH DICT SERVICE - * - */ + /* + * GLYPH DICT SERVICE + * + */ static FT_Error sfnt_get_glyph_name( TT_Face face, @@ -167,17 +173,18 @@ sfnt_get_name_index( TT_Face face, FT_String* glyph_name ) { - FT_Face root = &face->root; - FT_UInt i, max_gid = FT_UINT_MAX; + FT_Face root = &face->root; + FT_UInt i, max_gid = FT_UINT_MAX; + if ( root->num_glyphs < 0 ) return 0; - else if ( ( FT_ULong ) root->num_glyphs < FT_UINT_MAX ) - max_gid = ( FT_UInt ) root->num_glyphs; + else if ( (FT_ULong)root->num_glyphs < FT_UINT_MAX ) + max_gid = (FT_UInt)root->num_glyphs; else FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n", - FT_UINT_MAX, root->num_glyphs )); + FT_UINT_MAX, root->num_glyphs )); for ( i = 0; i < max_gid; i++ ) { @@ -196,18 +203,19 @@ } - FT_DEFINE_SERVICE_GLYPHDICTREC(sfnt_service_glyph_dict, + FT_DEFINE_SERVICE_GLYPHDICTREC( + sfnt_service_glyph_dict, (FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name, - (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index - ) + (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index ) + #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ - /* - * POSTSCRIPT NAME SERVICE - * - */ + /* + * POSTSCRIPT NAME SERVICE + * + */ static const char* sfnt_get_ps_name( TT_Face face ) @@ -319,17 +327,18 @@ return result; } - FT_DEFINE_SERVICE_PSFONTNAMEREC(sfnt_service_ps_name, - (FT_PsName_GetFunc)sfnt_get_ps_name - ) + FT_DEFINE_SERVICE_PSFONTNAMEREC( + sfnt_service_ps_name, + (FT_PsName_GetFunc)sfnt_get_ps_name ) + /* * TT CMAP INFO */ - FT_DEFINE_SERVICE_TTCMAPSREC(tt_service_get_cmap_info, - (TT_CMap_Info_GetFunc)tt_get_cmap_info - ) + FT_DEFINE_SERVICE_TTCMAPSREC( + tt_service_get_cmap_info, + (TT_CMap_Info_GetFunc)tt_get_cmap_info ) #ifdef TT_CONFIG_OPTION_BDF @@ -370,11 +379,12 @@ } - FT_DEFINE_SERVICE_BDFRec(sfnt_service_bdf, - (FT_BDF_GetCharsetIdFunc) sfnt_get_charset_id, - (FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop - ) + FT_DEFINE_SERVICE_BDFRec( + sfnt_service_bdf, + (FT_BDF_GetCharsetIdFunc)sfnt_get_charset_id, + (FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop ) + #endif /* TT_CONFIG_OPTION_BDF */ @@ -383,33 +393,33 @@ */ #if defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES && defined TT_CONFIG_OPTION_BDF - FT_DEFINE_SERVICEDESCREC5(sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &FT_SFNT_SERVICE_SFNT_TABLE_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &FT_SFNT_SERVICE_GLYPH_DICT_GET, - FT_SERVICE_ID_BDF, &FT_SFNT_SERVICE_BDF_GET, - FT_SERVICE_ID_TT_CMAP, &FT_TT_SERVICE_GET_CMAP_INFO_GET - ) + FT_DEFINE_SERVICEDESCREC5( + sfnt_services, + FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, + FT_SERVICE_ID_GLYPH_DICT, &SFNT_SERVICE_GLYPH_DICT_GET, + FT_SERVICE_ID_BDF, &SFNT_SERVICE_BDF_GET, + FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET ) #elif defined TT_CONFIG_OPTION_POSTSCRIPT_NAMES - FT_DEFINE_SERVICEDESCREC4(sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &FT_SFNT_SERVICE_SFNT_TABLE_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_GLYPH_DICT, &FT_SFNT_SERVICE_GLYPH_DICT_GET, - FT_SERVICE_ID_TT_CMAP, &FT_TT_SERVICE_GET_CMAP_INFO_GET - ) + FT_DEFINE_SERVICEDESCREC4( + sfnt_services, + FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, + FT_SERVICE_ID_GLYPH_DICT, &SFNT_SERVICE_GLYPH_DICT_GET, + FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET ) #elif defined TT_CONFIG_OPTION_BDF - FT_DEFINE_SERVICEDESCREC4(sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &FT_SFNT_SERVICE_SFNT_TABLE_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_BDF, &FT_SFNT_SERVICE_BDF_GET, - FT_SERVICE_ID_TT_CMAP, &FT_TT_SERVICE_GET_CMAP_INFO_GET - ) + FT_DEFINE_SERVICEDESCREC4( + sfnt_services, + FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, + FT_SERVICE_ID_BDF, &SFNT_SERVICE_BDF_GET, + FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET ) #else - FT_DEFINE_SERVICEDESCREC3(sfnt_services, - FT_SERVICE_ID_SFNT_TABLE, &FT_SFNT_SERVICE_SFNT_TABLE_GET, - FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_SFNT_SERVICE_PS_NAME_GET, - FT_SERVICE_ID_TT_CMAP, &FT_TT_SERVICE_GET_CMAP_INFO_GET - ) + FT_DEFINE_SERVICEDESCREC3( + sfnt_services, + FT_SERVICE_ID_SFNT_TABLE, &SFNT_SERVICE_SFNT_TABLE_GET, + FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &SFNT_SERVICE_PS_NAME_GET, + FT_SERVICE_ID_TT_CMAP, &TT_SERVICE_CMAP_INFO_GET ) #endif @@ -417,9 +427,21 @@ sfnt_get_interface( FT_Module module, const char* module_interface ) { + /* SFNT_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + FT_Library library; + + + if ( !module ) + return NULL; + library = module->library; + if ( !library ) + return NULL; +#else FT_UNUSED( module ); +#endif - return ft_service_list_lookup( FT_SFNT_SERVICES_GET, module_interface ); + return ft_service_list_lookup( SFNT_SERVICES_GET, module_interface ); } @@ -550,18 +572,21 @@ #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ + #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS -#define PUT_EMBEDDED_BITMAPS(a) a +#define PUT_EMBEDDED_BITMAPS( a ) a #else -#define PUT_EMBEDDED_BITMAPS(a) 0 +#define PUT_EMBEDDED_BITMAPS( a ) NULL #endif + #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES -#define PUT_PS_NAMES(a) a +#define PUT_PS_NAMES( a ) a #else -#define PUT_PS_NAMES(a) 0 +#define PUT_PS_NAMES( a ) NULL #endif - FT_DEFINE_SFNT_INTERFACE(sfnt_interface, + FT_DEFINE_SFNT_INTERFACE( + sfnt_interface, tt_face_goto_table, sfnt_init_face, @@ -572,7 +597,7 @@ 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_directory_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ tt_face_load_head, tt_face_load_hhea, @@ -592,21 +617,21 @@ tt_face_load_pclt, /* see `ttload.h' */ - PUT_EMBEDDED_BITMAPS(tt_face_load_bhed), + 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_face_load_sbit_stub, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - tt_find_sbit_image, /* 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), + 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), + 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 */ @@ -621,31 +646,31 @@ tt_face_load_hmtx, /* see `ttsbit.h' and `sfnt.h' */ - PUT_EMBEDDED_BITMAPS(tt_face_load_eblc), - PUT_EMBEDDED_BITMAPS(tt_face_free_eblc), + PUT_EMBEDDED_BITMAPS( tt_face_load_eblc ), + PUT_EMBEDDED_BITMAPS( tt_face_free_eblc ), - PUT_EMBEDDED_BITMAPS(tt_face_set_sbit_strike), - PUT_EMBEDDED_BITMAPS(tt_face_load_strike_metrics), + PUT_EMBEDDED_BITMAPS( tt_face_set_sbit_strike ), + PUT_EMBEDDED_BITMAPS( tt_face_load_strike_metrics ), tt_face_get_metrics ) - FT_DEFINE_MODULE(sfnt_module_class, - + FT_DEFINE_MODULE( + sfnt_module_class, + 0, /* not a font driver or renderer */ - sizeof( FT_ModuleRec ), + sizeof ( FT_ModuleRec ), "sfnt", /* driver name */ 0x10000L, /* driver version 1.0 */ 0x20000L, /* driver requires FreeType 2.0 or higher */ - (const void*)&FT_SFNT_INTERFACE_GET, /* module specific interface */ + (const void*)&SFNT_INTERFACE_GET, /* module specific interface */ (FT_Module_Constructor)0, (FT_Module_Destructor) 0, - (FT_Module_Requester) sfnt_get_interface - ) + (FT_Module_Requester) sfnt_get_interface ) /* END */ Index: src/sfnt/sferrors.h =================================================================== --- src/sfnt/sferrors.h (revision 58178) +++ src/sfnt/sferrors.h (working copy) @@ -4,7 +4,7 @@ /* */ /* SFNT error codes (specification only). */ /* */ -/* Copyright 2001, 2004 by */ +/* Copyright 2001, 2004, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX SFNT_Err_ #define FT_ERR_BASE FT_Mod_Err_SFNT Index: src/sfnt/sfntpic.c =================================================================== --- src/sfnt/sfntpic.c (revision 58178) +++ src/sfnt/sfntpic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,37 +20,78 @@ #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #include "sfntpic.h" +#include "sferrors.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from sfdriver.c */ - FT_Error FT_Create_Class_sfnt_services( FT_Library, FT_ServiceDescRec**); - void FT_Destroy_Class_sfnt_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec*); - void FT_Init_Class_sfnt_interface( FT_Library, SFNT_Interface*); - void FT_Init_Class_sfnt_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*); - void FT_Init_Class_sfnt_service_ps_name( FT_Library, FT_Service_PsFontNameRec*); - void FT_Init_Class_tt_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*); - void FT_Init_Class_sfnt_service_sfnt_table( FT_Service_SFNT_TableRec*); + 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, TT_CMap_Class**); - void FT_Destroy_Class_tt_cmap_classes( FT_Library, TT_CMap_Class*); + FT_Error + FT_Create_Class_tt_cmap_classes( FT_Library library, + TT_CMap_Class** output_class ); void - sfnt_module_class_pic_free( FT_Library library ) + FT_Destroy_Class_tt_cmap_classes( FT_Library library, + TT_CMap_Class* clazz ); + + + void + sfnt_module_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->sfnt ) { - sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt; - if(container->sfnt_services) - FT_Destroy_Class_sfnt_services(library, container->sfnt_services); + sfntModulePIC* container = (sfntModulePIC*)pic_container->sfnt; + + + if ( container->sfnt_services ) + FT_Destroy_Class_sfnt_services( library, + container->sfnt_services ); container->sfnt_services = NULL; - if(container->tt_cmap_classes) - FT_Destroy_Class_tt_cmap_classes(library, container->tt_cmap_classes); + + if ( container->tt_cmap_classes ) + FT_Destroy_Class_tt_cmap_classes( library, + container->tt_cmap_classes ); container->tt_cmap_classes = NULL; + FT_FREE( container ); pic_container->sfnt = NULL; } @@ -58,12 +99,12 @@ 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; - sfntModulePIC* container; - FT_Memory memory = library->memory; + FT_Error error = SFNT_Err_Ok; + sfntModulePIC* container = NULL; + FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ @@ -72,30 +113,37 @@ FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->sfnt = container; - /* initialize pointer table - this is how the module usually expects this data */ - error = FT_Create_Class_sfnt_services(library, &container->sfnt_services); - if(error) + /* initialize pointer table - */ + /* this is how the module usually expects this data */ + error = FT_Create_Class_sfnt_services( library, + &container->sfnt_services ); + if ( error ) goto Exit; - error = FT_Create_Class_tt_cmap_classes(library, &container->tt_cmap_classes); - if(error) + + error = FT_Create_Class_tt_cmap_classes( library, + &container->tt_cmap_classes ); + if ( error ) goto Exit; - FT_Init_Class_sfnt_service_glyph_dict(library, &container->sfnt_service_glyph_dict); - FT_Init_Class_sfnt_service_ps_name(library, &container->sfnt_service_ps_name); - FT_Init_Class_tt_service_get_cmap_info(library, &container->tt_service_get_cmap_info); - FT_Init_Class_sfnt_service_sfnt_table(&container->sfnt_service_sfnt_table); + + FT_Init_Class_sfnt_service_glyph_dict( + library, &container->sfnt_service_glyph_dict ); + FT_Init_Class_sfnt_service_ps_name( + library, &container->sfnt_service_ps_name ); + FT_Init_Class_tt_service_get_cmap_info( + library, &container->tt_service_get_cmap_info ); + FT_Init_Class_sfnt_service_sfnt_table( + &container->sfnt_service_sfnt_table ); #ifdef TT_CONFIG_OPTION_BDF - FT_Init_Class_sfnt_service_bdf(&container->sfnt_service_bdf); + FT_Init_Class_sfnt_service_bdf( &container->sfnt_service_bdf ); #endif - FT_Init_Class_sfnt_interface(library, &container->sfnt_interface); + FT_Init_Class_sfnt_interface( library, &container->sfnt_interface ); -Exit: - if(error) - sfnt_module_class_pic_free(library); + Exit: + if ( error ) + sfnt_module_class_pic_free( library ); return error; } - - #endif /* FT_CONFIG_OPTION_PIC */ Index: src/sfnt/sfntpic.h =================================================================== --- src/sfnt/sfntpic.h (revision 58178) +++ src/sfnt/sfntpic.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for sfnt module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,66 +19,92 @@ #ifndef __SFNTPIC_H__ #define __SFNTPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H - #ifndef FT_CONFIG_OPTION_PIC -#define FT_SFNT_SERVICES_GET sfnt_services -#define FT_SFNT_SERVICE_GLYPH_DICT_GET sfnt_service_glyph_dict -#define FT_SFNT_SERVICE_PS_NAME_GET sfnt_service_ps_name -#define FT_TT_SERVICE_GET_CMAP_INFO_GET tt_service_get_cmap_info -#define FT_SFNT_SERVICES_GET sfnt_services -#define FT_TT_CMAP_CLASSES_GET tt_cmap_classes -#define FT_SFNT_SERVICE_SFNT_TABLE_GET sfnt_service_sfnt_table -#define FT_SFNT_SERVICE_BDF_GET sfnt_service_bdf -#define FT_SFNT_INTERFACE_GET sfnt_interface +#ifndef FT_CONFIG_OPTION_PIC + +#define SFNT_SERVICES_GET sfnt_services +#define SFNT_SERVICE_GLYPH_DICT_GET sfnt_service_glyph_dict +#define SFNT_SERVICE_PS_NAME_GET sfnt_service_ps_name +#define TT_SERVICE_CMAP_INFO_GET tt_service_get_cmap_info +#define SFNT_SERVICES_GET sfnt_services +#define TT_CMAP_CLASSES_GET tt_cmap_classes +#define SFNT_SERVICE_SFNT_TABLE_GET sfnt_service_sfnt_table +#define SFNT_SERVICE_BDF_GET sfnt_service_bdf +#define SFNT_INTERFACE_GET sfnt_interface + #else /* FT_CONFIG_OPTION_PIC */ -/* some include files required for members of sfntModulePIC */ + /* some include files required for members of sfntModulePIC */ #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_POSTSCRIPT_NAME_H #include FT_SERVICE_SFNT_H #include FT_SERVICE_TT_CMAP_H + #ifdef TT_CONFIG_OPTION_BDF #include "ttbdf.h" #include FT_SERVICE_BDF_H #endif + #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_SFNT_H #include "ttcmap.h" -typedef struct sfntModulePIC_ + + typedef struct sfntModulePIC_ { - FT_ServiceDescRec* sfnt_services; - FT_Service_GlyphDictRec sfnt_service_glyph_dict; + FT_ServiceDescRec* sfnt_services; + FT_Service_GlyphDictRec sfnt_service_glyph_dict; FT_Service_PsFontNameRec sfnt_service_ps_name; - FT_Service_TTCMapsRec tt_service_get_cmap_info; - TT_CMap_Class* tt_cmap_classes; - FT_Service_SFNT_TableRec sfnt_service_sfnt_table; + FT_Service_TTCMapsRec tt_service_get_cmap_info; + TT_CMap_Class* tt_cmap_classes; + FT_Service_SFNT_TableRec sfnt_service_sfnt_table; #ifdef TT_CONFIG_OPTION_BDF - FT_Service_BDFRec sfnt_service_bdf; + FT_Service_BDFRec sfnt_service_bdf; #endif - SFNT_Interface sfnt_interface; + SFNT_Interface sfnt_interface; + } sfntModulePIC; -#define GET_PIC(lib) ((sfntModulePIC*)((lib)->pic_container.sfnt)) -#define FT_SFNT_SERVICES_GET (GET_PIC(library)->sfnt_services) -#define FT_SFNT_SERVICE_GLYPH_DICT_GET (GET_PIC(library)->sfnt_service_glyph_dict) -#define FT_SFNT_SERVICE_PS_NAME_GET (GET_PIC(library)->sfnt_service_ps_name) -#define FT_TT_SERVICE_GET_CMAP_INFO_GET (GET_PIC(library)->tt_service_get_cmap_info) -#define FT_SFNT_SERVICES_GET (GET_PIC(library)->sfnt_services) -#define FT_TT_CMAP_CLASSES_GET (GET_PIC(library)->tt_cmap_classes) -#define FT_SFNT_SERVICE_SFNT_TABLE_GET (GET_PIC(library)->sfnt_service_sfnt_table) -#define FT_SFNT_SERVICE_BDF_GET (GET_PIC(library)->sfnt_service_bdf) -#define FT_SFNT_INTERFACE_GET (GET_PIC(library)->sfnt_interface) +#define GET_PIC( lib ) \ + ( (sfntModulePIC*)((lib)->pic_container.sfnt) ) + +#define SFNT_SERVICES_GET \ + ( GET_PIC( library )->sfnt_services ) +#define SFNT_SERVICE_GLYPH_DICT_GET \ + ( GET_PIC( library )->sfnt_service_glyph_dict ) +#define SFNT_SERVICE_PS_NAME_GET \ + ( GET_PIC( library )->sfnt_service_ps_name ) +#define TT_SERVICE_CMAP_INFO_GET \ + ( GET_PIC( library )->tt_service_get_cmap_info ) +#define SFNT_SERVICES_GET \ + ( GET_PIC( library )->sfnt_services ) +#define TT_CMAP_CLASSES_GET \ + ( GET_PIC( library )->tt_cmap_classes ) +#define SFNT_SERVICE_SFNT_TABLE_GET \ + ( GET_PIC( library )->sfnt_service_sfnt_table ) +#define SFNT_SERVICE_BDF_GET \ + ( GET_PIC( library )->sfnt_service_bdf ) +#define SFNT_INTERFACE_GET \ + ( GET_PIC( library )->sfnt_interface ) + + + /* see sfntpic.c for the implementation */ + void + sfnt_module_class_pic_free( FT_Library library ); + + FT_Error + sfnt_module_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ -/* */ + /* */ FT_END_HEADER Index: src/sfnt/sfobjs.c =================================================================== --- src/sfnt/sfobjs.c (revision 58178) +++ src/sfnt/sfobjs.c (working copy) @@ -4,7 +4,7 @@ /* */ /* SFNT object management (base). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by */ +/* Copyright 1996-2008, 2010-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -64,13 +64,17 @@ for ( n = 0; n < len; n++ ) { code = FT_NEXT_USHORT( read ); + + if ( code == 0 ) + break; + if ( code < 32 || code > 127 ) code = '?'; string[n] = (char)code; } - string[len] = 0; + string[n] = 0; return string; } @@ -95,13 +99,17 @@ for ( n = 0; n < len; n++ ) { code = *read++; + + if ( code == 0 ) + break; + if ( code < 32 || code > 127 ) code = '?'; string[n] = (char)code; } - string[len] = 0; + string[n] = 0; return string; } @@ -356,7 +364,7 @@ FT_FRAME_START( 8 ), FT_FRAME_LONG( version ), - FT_FRAME_LONG( count ), + FT_FRAME_LONG( count ), /* this is ULong in the specs */ FT_FRAME_END }; @@ -376,7 +384,10 @@ tag != TTAG_true && tag != TTAG_typ1 && tag != 0x00020000UL ) + { + FT_TRACE2(( " not a font using the SFNT container format\n" )); return SFNT_Err_Unknown_File_Format; + } face->ttc_header.tag = TTAG_ttcf; @@ -390,6 +401,17 @@ if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) ) return error; + if ( face->ttc_header.count == 0 ) + return SFNT_Err_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 = */ + /* 28 bytes), thus we have (at least) `12 + 4*count' bytes for the */ + /* 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; + /* now read the offsets of each font in the file */ if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) ) return error; @@ -441,7 +463,10 @@ { sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) - return SFNT_Err_Invalid_File_Format; + { + FT_ERROR(( "sfnt_init_face: cannot access `sfnt' module\n" )); + return SFNT_Err_Missing_Module; + } face->sfnt = sfnt; face->goto_table = sfnt->goto_table; @@ -449,6 +474,8 @@ FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS ); + FT_TRACE2(( "SFNT driver\n" )); + error = sfnt_open_font( stream, face ); if ( error ) return error; @@ -481,7 +508,7 @@ FT_TRACE2(( "`" #x "' " )); \ FT_TRACE3(( "-->\n" )); \ \ - error = sfnt->load_##x( face, stream ); \ + error = sfnt->load_ ## x( face, stream ); \ \ FT_TRACE2(( "%s\n", ( !error ) \ ? "loaded" \ @@ -497,7 +524,7 @@ vertical ? "vertical " : "" )); \ FT_TRACE3(( "-->\n" )); \ \ - error = sfnt->load_##x( face, stream, vertical ); \ + error = sfnt->load_ ## x( face, stream, vertical ); \ \ FT_TRACE2(( "%s\n", ( !error ) \ ? "loaded" \ @@ -507,11 +534,11 @@ FT_TRACE3(( "\n" )); \ } while ( 0 ) -#define GET_NAME( id, field ) \ - do { \ - error = tt_face_get_name( face, TT_NAME_ID_##id, field ); \ - if ( error ) \ - goto Exit; \ +#define GET_NAME( id, field ) \ + do { \ + error = tt_face_get_name( face, TT_NAME_ID_ ## id, field ); \ + if ( error ) \ + goto Exit; \ } while ( 0 ) @@ -528,15 +555,16 @@ #endif FT_Bool has_outline; FT_Bool is_apple_sbit; - FT_Bool ignore_preferred_family = FALSE; + FT_Bool ignore_preferred_family = FALSE; FT_Bool ignore_preferred_subfamily = FALSE; SFNT_Service sfnt = (SFNT_Service)face->sfnt; FT_UNUSED( face_index ); + /* Check parameters */ - + { FT_Int i; @@ -571,12 +599,12 @@ /* do we have outlines in there? */ #ifdef FT_CONFIG_OPTION_INCREMENTAL - has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 || - tt_face_lookup_table( face, TTAG_glyf ) != 0 || - tt_face_lookup_table( face, TTAG_CFF ) != 0 ); + has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 || + tt_face_lookup_table( face, TTAG_glyf ) != 0 || + tt_face_lookup_table( face, TTAG_CFF ) != 0 ); #else - has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 || - tt_face_lookup_table( face, TTAG_CFF ) != 0 ); + has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 || + tt_face_lookup_table( face, TTAG_CFF ) != 0 ); #endif is_apple_sbit = 0; @@ -640,7 +668,7 @@ get_glyph_metrics ) { face->horizontal.number_Of_HMetrics = 0; - error = SFNT_Err_Ok; + error = SFNT_Err_Ok; } #endif } @@ -651,8 +679,9 @@ if ( face->format_tag == TTAG_true ) { FT_TRACE2(( "This is an SFNT Mac font.\n" )); + has_outline = 0; - error = SFNT_Err_Ok; + error = SFNT_Err_Ok; } else { @@ -666,7 +695,7 @@ get_glyph_metrics ) { face->horizontal.number_Of_HMetrics = 0; - error = SFNT_Err_Ok; + error = SFNT_Err_Ok; } #endif @@ -987,40 +1016,36 @@ /* table cannot be used to compute the text height reliably! */ /* */ - /* The ascender/descender/height are computed from the OS/2 table */ - /* when found. Otherwise, they're taken from the horizontal */ - /* header. */ - /* */ + /* The ascender and descender are taken from the `hhea' table. */ + /* If zero, they are taken from the `OS/2' table. */ root->ascender = face->horizontal.Ascender; root->descender = face->horizontal.Descender; - root->height = (FT_Short)( root->ascender - root->descender + - face->horizontal.Line_Gap ); + root->height = (FT_Short)( root->ascender - root->descender + + face->horizontal.Line_Gap ); -#if 0 - /* if the line_gap is 0, we add an extra 15% to the text height -- */ - /* this computation is based on various versions of Times New Roman */ - if ( face->horizontal.Line_Gap == 0 ) - root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 ); -#endif /* 0 */ - -#if 0 - /* some fonts have the OS/2 "sTypoAscender", "sTypoDescender" & */ - /* "sTypoLineGap" fields set to 0, like ARIALNB.TTF */ - if ( face->os2.version != 0xFFFFU && root->ascender ) + if ( !( root->ascender || root->descender ) ) { - FT_Int height; + if ( face->os2.version != 0xFFFFU ) + { + if ( face->os2.sTypoAscender || face->os2.sTypoDescender ) + { + root->ascender = face->os2.sTypoAscender; + root->descender = face->os2.sTypoDescender; + root->height = (FT_Short)( root->ascender - root->descender + + face->os2.sTypoLineGap ); + } + else + { + root->ascender = (FT_Short)face->os2.usWinAscent; + root->descender = -(FT_Short)face->os2.usWinDescent; - root->ascender = face->os2.sTypoAscender; - root->descender = -face->os2.sTypoDescender; - - height = root->ascender + root->descender + face->os2.sTypoLineGap; - if ( height > root->height ) - root->height = height; + root->height = (FT_UShort)( root->ascender - root->descender ); + } + } } -#endif /* 0 */ root->max_advance_width = face->horizontal.advance_Width_Max; root->max_advance_height = (FT_Short)( face->vertical_info Index: src/sfnt/ttcmap.c =================================================================== --- src/sfnt/ttcmap.c (revision 58178) +++ src/sfnt/ttcmap.c (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2002-2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -165,20 +165,24 @@ } - FT_DEFINE_TT_CMAP(tt_cmap0_class_rec, - sizeof ( TT_CMapRec ), + FT_DEFINE_TT_CMAP( + tt_cmap0_class_rec, + sizeof ( TT_CMapRec ), - (FT_CMap_InitFunc) tt_cmap_init, - (FT_CMap_DoneFunc) NULL, - (FT_CMap_CharIndexFunc)tt_cmap0_char_index, - (FT_CMap_CharNextFunc) tt_cmap0_char_next, + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap0_char_index, + (FT_CMap_CharNextFunc) tt_cmap0_char_next, - NULL, NULL, NULL, NULL, NULL - , + NULL, + NULL, + NULL, + NULL, + NULL, + 0, - (TT_CMap_ValidateFunc) tt_cmap0_validate, - (TT_CMap_Info_GetFunc) tt_cmap0_get_info - ) + (TT_CMap_ValidateFunc)tt_cmap0_validate, + (TT_CMap_Info_GetFunc)tt_cmap0_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_0 */ @@ -541,20 +545,24 @@ } - FT_DEFINE_TT_CMAP(tt_cmap2_class_rec, - sizeof ( TT_CMapRec ), + FT_DEFINE_TT_CMAP( + tt_cmap2_class_rec, + sizeof ( TT_CMapRec ), - (FT_CMap_InitFunc) tt_cmap_init, - (FT_CMap_DoneFunc) NULL, - (FT_CMap_CharIndexFunc)tt_cmap2_char_index, - (FT_CMap_CharNextFunc) tt_cmap2_char_next, + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap2_char_index, + (FT_CMap_CharNextFunc) tt_cmap2_char_next, - NULL, NULL, NULL, NULL, NULL - , + NULL, + NULL, + NULL, + NULL, + NULL, + 2, - (TT_CMap_ValidateFunc) tt_cmap2_validate, - (TT_CMap_Info_GetFunc) tt_cmap2_get_info - ) + (TT_CMap_ValidateFunc)tt_cmap2_validate, + (TT_CMap_Info_GetFunc)tt_cmap2_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_2 */ @@ -1377,19 +1385,23 @@ } - FT_DEFINE_TT_CMAP(tt_cmap4_class_rec, - sizeof ( TT_CMap4Rec ), - (FT_CMap_InitFunc) tt_cmap4_init, - (FT_CMap_DoneFunc) NULL, - (FT_CMap_CharIndexFunc)tt_cmap4_char_index, - (FT_CMap_CharNextFunc) tt_cmap4_char_next, + FT_DEFINE_TT_CMAP( + tt_cmap4_class_rec, + sizeof ( TT_CMap4Rec ), + (FT_CMap_InitFunc) tt_cmap4_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap4_char_index, + (FT_CMap_CharNextFunc) tt_cmap4_char_next, - NULL, NULL, NULL, NULL, NULL - , + NULL, + NULL, + NULL, + NULL, + NULL, + 4, - (TT_CMap_ValidateFunc) tt_cmap4_validate, - (TT_CMap_Info_GetFunc) tt_cmap4_get_info - ) + (TT_CMap_ValidateFunc)tt_cmap4_validate, + (TT_CMap_Info_GetFunc)tt_cmap4_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_4 */ @@ -1536,20 +1548,24 @@ } - FT_DEFINE_TT_CMAP(tt_cmap6_class_rec, - sizeof ( TT_CMapRec ), + FT_DEFINE_TT_CMAP( + tt_cmap6_class_rec, + sizeof ( TT_CMapRec ), - (FT_CMap_InitFunc) tt_cmap_init, - (FT_CMap_DoneFunc) NULL, - (FT_CMap_CharIndexFunc)tt_cmap6_char_index, - (FT_CMap_CharNextFunc) tt_cmap6_char_next, + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap6_char_index, + (FT_CMap_CharNextFunc) tt_cmap6_char_next, - NULL, NULL, NULL, NULL, NULL - , + NULL, + NULL, + NULL, + NULL, + NULL, + 6, - (TT_CMap_ValidateFunc) tt_cmap6_validate, - (TT_CMap_Info_GetFunc) tt_cmap6_get_info - ) + (TT_CMap_ValidateFunc)tt_cmap6_validate, + (TT_CMap_Info_GetFunc)tt_cmap6_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_6 */ @@ -1789,20 +1805,24 @@ } - FT_DEFINE_TT_CMAP(tt_cmap8_class_rec, - sizeof ( TT_CMapRec ), + FT_DEFINE_TT_CMAP( + tt_cmap8_class_rec, + sizeof ( TT_CMapRec ), - (FT_CMap_InitFunc) tt_cmap_init, - (FT_CMap_DoneFunc) NULL, - (FT_CMap_CharIndexFunc)tt_cmap8_char_index, - (FT_CMap_CharNextFunc) tt_cmap8_char_next, + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap8_char_index, + (FT_CMap_CharNextFunc) tt_cmap8_char_next, - NULL, NULL, NULL, NULL, NULL - , + NULL, + NULL, + NULL, + NULL, + NULL, + 8, - (TT_CMap_ValidateFunc) tt_cmap8_validate, - (TT_CMap_Info_GetFunc) tt_cmap8_get_info - ) + (TT_CMap_ValidateFunc)tt_cmap8_validate, + (TT_CMap_Info_GetFunc)tt_cmap8_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_8 */ @@ -1938,20 +1958,24 @@ } - FT_DEFINE_TT_CMAP(tt_cmap10_class_rec, - sizeof ( TT_CMapRec ), + FT_DEFINE_TT_CMAP( + tt_cmap10_class_rec, + sizeof ( TT_CMapRec ), - (FT_CMap_InitFunc) tt_cmap_init, - (FT_CMap_DoneFunc) NULL, - (FT_CMap_CharIndexFunc)tt_cmap10_char_index, - (FT_CMap_CharNextFunc) tt_cmap10_char_next, + (FT_CMap_InitFunc) tt_cmap_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap10_char_index, + (FT_CMap_CharNextFunc) tt_cmap10_char_next, - NULL, NULL, NULL, NULL, NULL - , + NULL, + NULL, + NULL, + NULL, + NULL, + 10, - (TT_CMap_ValidateFunc) tt_cmap10_validate, - (TT_CMap_Info_GetFunc) tt_cmap10_get_info - ) + (TT_CMap_ValidateFunc)tt_cmap10_validate, + (TT_CMap_Info_GetFunc)tt_cmap10_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_10 */ @@ -2258,20 +2282,24 @@ } - FT_DEFINE_TT_CMAP(tt_cmap12_class_rec, - sizeof ( TT_CMap12Rec ), + FT_DEFINE_TT_CMAP( + tt_cmap12_class_rec, + sizeof ( TT_CMap12Rec ), - (FT_CMap_InitFunc) tt_cmap12_init, - (FT_CMap_DoneFunc) NULL, - (FT_CMap_CharIndexFunc)tt_cmap12_char_index, - (FT_CMap_CharNextFunc) tt_cmap12_char_next, + (FT_CMap_InitFunc) tt_cmap12_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap12_char_index, + (FT_CMap_CharNextFunc) tt_cmap12_char_next, - NULL, NULL, NULL, NULL, NULL - , + NULL, + NULL, + NULL, + NULL, + NULL, + 12, - (TT_CMap_ValidateFunc) tt_cmap12_validate, - (TT_CMap_Info_GetFunc) tt_cmap12_get_info - ) + (TT_CMap_ValidateFunc)tt_cmap12_validate, + (TT_CMap_Info_GetFunc)tt_cmap12_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_12 */ @@ -2338,9 +2366,9 @@ tt_cmap13_validate( FT_Byte* table, FT_Validator valid ) { - FT_Byte* p; - FT_ULong length; - FT_ULong num_groups; + FT_Byte* p; + FT_ULong length; + FT_ULong num_groups; if ( table + 16 > valid->limit ) @@ -2490,7 +2518,6 @@ /* if `char_code' is not in any group, then `mid' is */ /* the group nearest to `char_code' */ - /* */ if ( char_code > end ) { @@ -2574,20 +2601,24 @@ } - FT_DEFINE_TT_CMAP(tt_cmap13_class_rec, - sizeof ( TT_CMap13Rec ), + FT_DEFINE_TT_CMAP( + tt_cmap13_class_rec, + sizeof ( TT_CMap13Rec ), - (FT_CMap_InitFunc) tt_cmap13_init, - (FT_CMap_DoneFunc) NULL, - (FT_CMap_CharIndexFunc)tt_cmap13_char_index, - (FT_CMap_CharNextFunc) tt_cmap13_char_next, + (FT_CMap_InitFunc) tt_cmap13_init, + (FT_CMap_DoneFunc) NULL, + (FT_CMap_CharIndexFunc)tt_cmap13_char_index, + (FT_CMap_CharNextFunc) tt_cmap13_char_next, - NULL, NULL, NULL, NULL, NULL - , + NULL, + NULL, + NULL, + NULL, + NULL, + 13, - (TT_CMap_ValidateFunc) tt_cmap13_validate, - (TT_CMap_Info_GetFunc) tt_cmap13_get_info - ) + (TT_CMap_ValidateFunc)tt_cmap13_validate, + (TT_CMap_Info_GetFunc)tt_cmap13_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_13 */ @@ -2688,8 +2719,8 @@ FT_UInt32 num_results, FT_Memory memory ) { - FT_UInt32 old_max = cmap->max_results; - FT_Error error = SFNT_Err_Ok; + FT_UInt32 old_max = cmap->max_results; + FT_Error error = SFNT_Err_Ok; if ( num_results > cmap->max_results ) @@ -2713,9 +2744,9 @@ cmap->cmap.data = table; table += 6; - cmap->num_selectors = FT_PEEK_ULONG( table ); - cmap->max_results = 0; - cmap->results = NULL; + cmap->num_selectors = FT_PEEK_ULONG( table ); + cmap->max_results = 0; + cmap->results = NULL; return SFNT_Err_Ok; } @@ -2791,7 +2822,7 @@ { FT_Byte* ndp = table + nondefOff; FT_ULong numMappings = TT_NEXT_ULONG( ndp ); - FT_ULong i, lastUni = 0; + FT_ULong i, lastUni = 0; if ( numMappings * 4 > (FT_ULong)( valid->limit - ndp ) ) @@ -2965,7 +2996,7 @@ tt_cmap14_char_var_index( TT_CMap cmap, TT_CMap ucmap, FT_UInt32 charcode, - FT_UInt32 variantSelector) + FT_UInt32 variantSelector ) { FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector ); FT_ULong defOff; @@ -3106,9 +3137,9 @@ static FT_UInt32* - tt_cmap14_get_def_chars( TT_CMap cmap, - FT_Byte* p, - FT_Memory memory ) + tt_cmap14_get_def_chars( TT_CMap cmap, + FT_Byte* p, + FT_Memory memory ) { TT_CMap14 cmap14 = (TT_CMap14) cmap; FT_UInt32 numRanges; @@ -3124,7 +3155,7 @@ for ( q = cmap14->results; numRanges > 0; --numRanges ) { - FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p ); + FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p ); cnt = FT_NEXT_BYTE( p ) + 1; @@ -3133,6 +3164,7 @@ q[0] = uni; uni += 1; q += 1; + } while ( --cnt != 0 ); } q[0] = 0; @@ -3306,25 +3338,25 @@ } - FT_DEFINE_TT_CMAP(tt_cmap14_class_rec, - sizeof ( TT_CMap14Rec ), + FT_DEFINE_TT_CMAP( + tt_cmap14_class_rec, + sizeof ( TT_CMap14Rec ), - (FT_CMap_InitFunc) tt_cmap14_init, - (FT_CMap_DoneFunc) tt_cmap14_done, - (FT_CMap_CharIndexFunc)tt_cmap14_char_index, - (FT_CMap_CharNextFunc) tt_cmap14_char_next, + (FT_CMap_InitFunc) tt_cmap14_init, + (FT_CMap_DoneFunc) tt_cmap14_done, + (FT_CMap_CharIndexFunc)tt_cmap14_char_index, + (FT_CMap_CharNextFunc) tt_cmap14_char_next, - /* Format 14 extension functions */ - (FT_CMap_CharVarIndexFunc) tt_cmap14_char_var_index, - (FT_CMap_CharVarIsDefaultFunc)tt_cmap14_char_var_isdefault, - (FT_CMap_VariantListFunc) tt_cmap14_variants, - (FT_CMap_CharVariantListFunc) tt_cmap14_char_variants, - (FT_CMap_VariantCharListFunc) tt_cmap14_variant_chars - , + /* Format 14 extension functions */ + (FT_CMap_CharVarIndexFunc) tt_cmap14_char_var_index, + (FT_CMap_CharVarIsDefaultFunc)tt_cmap14_char_var_isdefault, + (FT_CMap_VariantListFunc) tt_cmap14_variants, + (FT_CMap_CharVariantListFunc) tt_cmap14_char_variants, + (FT_CMap_VariantCharListFunc) tt_cmap14_variant_chars, + 14, (TT_CMap_ValidateFunc)tt_cmap14_validate, - (TT_CMap_Info_GetFunc)tt_cmap14_get_info - ) + (TT_CMap_Info_GetFunc)tt_cmap14_get_info ) #endif /* TT_CONFIG_CMAP_FORMAT_14 */ @@ -3333,43 +3365,55 @@ static const TT_CMap_Class tt_cmap_classes[] = { -#define TTCMAPCITEM(a) &a, +#define TTCMAPCITEM( a ) &a, #include "ttcmapc.h" NULL, }; #else /*FT_CONFIG_OPTION_PIC*/ - void FT_Destroy_Class_tt_cmap_classes(FT_Library library, TT_CMap_Class* clazz) + void + FT_Destroy_Class_tt_cmap_classes( FT_Library library, + TT_CMap_Class* clazz ) { - FT_Memory memory = library->memory; + FT_Memory memory = library->memory; + + if ( clazz ) FT_FREE( clazz ); } - FT_Error FT_Create_Class_tt_cmap_classes(FT_Library library, TT_CMap_Class** output_class) + + FT_Error + FT_Create_Class_tt_cmap_classes( FT_Library library, + TT_CMap_Class** output_class ) { - TT_CMap_Class* clazz; - TT_CMap_ClassRec* recs; - FT_Error error; - FT_Memory memory = library->memory; - int i = 0; + TT_CMap_Class* clazz = NULL; + TT_CMap_ClassRec* recs; + FT_Error error; + FT_Memory memory = library->memory; -#define TTCMAPCITEM(a) i++; + int i = 0; + + +#define TTCMAPCITEM( a ) i++; #include "ttcmapc.h" - /* allocate enough space for both the pointers +terminator and the class instances */ - if ( FT_ALLOC( clazz, sizeof(*clazz)*(i+1)+sizeof(TT_CMap_ClassRec)*i ) ) + /* allocate enough space for both the pointers */ + /* plus terminator and the class instances */ + if ( FT_ALLOC( clazz, sizeof ( *clazz ) * ( i + 1 ) + + sizeof ( TT_CMap_ClassRec ) * i ) ) return error; /* the location of the class instances follows the array of pointers */ - recs = (TT_CMap_ClassRec*) (((char*)clazz)+(sizeof(*clazz)*(i+1))); - i=0; + recs = (TT_CMap_ClassRec*)( (char*)clazz + + sizeof ( *clazz ) * ( i + 1 ) ); + i = 0; #undef TTCMAPCITEM -#define TTCMAPCITEM(a) \ - FT_Init_Class_##a(&recs[i]); \ - clazz[i] = &recs[i]; \ +#define TTCMAPCITEM( a ) \ + FT_Init_Class_ ## a( &recs[i] ); \ + clazz[i] = &recs[i]; \ i++; #include "ttcmapc.h" @@ -3411,10 +3455,12 @@ } num_cmaps = TT_NEXT_USHORT( p ); + #ifdef FT_MAX_CHARMAP_CACHEABLE if ( num_cmaps > FT_MAX_CHARMAP_CACHEABLE ) - FT_ERROR(( "tt_face_build_cmaps: too many cmap subtables(%d) " - "subtable#%d and later are loaded but cannot be searched\n", + FT_ERROR(( "tt_face_build_cmaps: too many cmap subtables (%d)\n" + " subtable #%d and higher are loaded" + " but cannot be searched\n", num_cmaps, FT_MAX_CHARMAP_CACHEABLE + 1 )); #endif @@ -3434,7 +3480,7 @@ { FT_Byte* volatile cmap = table + offset; volatile FT_UInt format = TT_PEEK_USHORT( cmap ); - const TT_CMap_Class* volatile pclazz = FT_TT_CMAP_CLASSES_GET; + const TT_CMap_Class* volatile pclazz = TT_CMAP_CLASSES_GET; TT_CMap_Class volatile clazz; @@ -3452,8 +3498,7 @@ valid.num_glyphs = (FT_UInt)face->max_profile.numGlyphs; - if ( ft_setjmp( - *((ft_jmp_buf*)&FT_VALIDATOR( &valid )->jump_buffer) ) == 0 ) + if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer) == 0 ) { /* validate this cmap sub-table */ error = clazz->validate( cmap, FT_VALIDATOR( &valid ) ); @@ -3464,9 +3509,9 @@ FT_CMap ttcmap; - /* It might make sense to store the single variation selector */ - /* cmap somewhere special. But it would have to be in the */ - /* public FT_FaceRec, and we can't change that. */ + /* It might make sense to store the single variation */ + /* selector cmap somewhere special. But it would have to be */ + /* in the public FT_FaceRec, and we can't change that. */ if ( !FT_CMap_New( (FT_CMap_Class)clazz, cmap, &charmap, &ttcmap ) ) Index: src/sfnt/ttcmap.h =================================================================== --- src/sfnt/ttcmap.h (revision 58178) +++ src/sfnt/ttcmap.h (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueType character mapping table (cmap) support (specification). */ /* */ -/* Copyright 2002, 2003, 2004, 2005 by */ +/* Copyright 2002-2005, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -55,47 +55,80 @@ } TT_CMap_ClassRec; + #ifndef FT_CONFIG_OPTION_PIC -#define FT_DEFINE_TT_CMAP(class_, size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_,variantchar_list_, \ - format_, validate_, get_cmap_info_) \ - FT_CALLBACK_TABLE_DEF \ - const TT_CMap_ClassRec class_ = \ - { \ - {size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_, variantchar_list_}, \ - format_, validate_, get_cmap_info_ \ +#define FT_DEFINE_TT_CMAP( class_, \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_, \ + format_, \ + validate_, \ + get_cmap_info_ ) \ + FT_CALLBACK_TABLE_DEF \ + const TT_CMap_ClassRec class_ = \ + { \ + { size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_ \ + }, \ + \ + format_, \ + validate_, \ + get_cmap_info_ \ }; -#else /* FT_CONFIG_OPTION_PIC */ +#else /* FT_CONFIG_OPTION_PIC */ -#define FT_DEFINE_TT_CMAP(class_, size_, init_, done_, char_index_, \ - char_next_, char_var_index_, char_var_default_, variant_list_, \ - charvariant_list_,variantchar_list_, \ - format_, validate_, get_cmap_info_) \ - void \ - FT_Init_Class_##class_( TT_CMap_ClassRec* clazz ) \ - { \ - clazz->clazz.size = size_; \ - clazz->clazz.init = init_; \ - clazz->clazz.done = done_; \ - clazz->clazz.char_index = char_index_; \ - clazz->clazz.char_next = char_next_; \ - clazz->clazz.char_var_index = char_var_index_; \ - clazz->clazz.char_var_default = char_var_default_; \ - clazz->clazz.variant_list = variant_list_; \ - clazz->clazz.charvariant_list = charvariant_list_; \ - clazz->clazz.variantchar_list = variantchar_list_; \ - clazz->format = format_; \ - clazz->validate = validate_; \ - clazz->get_cmap_info = get_cmap_info_; \ - } +#define FT_DEFINE_TT_CMAP( class_, \ + size_, \ + init_, \ + done_, \ + char_index_, \ + char_next_, \ + char_var_index_, \ + char_var_default_, \ + variant_list_, \ + charvariant_list_, \ + variantchar_list_, \ + format_, \ + validate_, \ + get_cmap_info_ ) \ + void \ + FT_Init_Class_ ## class_( TT_CMap_ClassRec* clazz ) \ + { \ + clazz->clazz.size = size_; \ + clazz->clazz.init = init_; \ + clazz->clazz.done = done_; \ + clazz->clazz.char_index = char_index_; \ + clazz->clazz.char_next = char_next_; \ + clazz->clazz.char_var_index = char_var_index_; \ + clazz->clazz.char_var_default = char_var_default_; \ + clazz->clazz.variant_list = variant_list_; \ + clazz->clazz.charvariant_list = charvariant_list_; \ + clazz->clazz.variantchar_list = variantchar_list_; \ + clazz->format = format_; \ + clazz->validate = validate_; \ + clazz->get_cmap_info = get_cmap_info_; \ + } -#endif /* FT_CONFIG_OPTION_PIC */ +#endif /* FT_CONFIG_OPTION_PIC */ + typedef struct TT_ValidatorRec_ { FT_ValidatorRec validator; @@ -104,7 +137,7 @@ } TT_ValidatorRec, *TT_Validator; -#define TT_VALIDATOR( x ) ((TT_Validator)( x )) +#define TT_VALIDATOR( x ) ( (TT_Validator)( x ) ) #define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs Index: src/sfnt/ttcmapc.h =================================================================== --- src/sfnt/ttcmapc.h (revision 58178) +++ src/sfnt/ttcmapc.h (working copy) @@ -17,39 +17,40 @@ #ifdef TT_CONFIG_CMAP_FORMAT_0 - TTCMAPCITEM(tt_cmap0_class_rec) + TTCMAPCITEM( tt_cmap0_class_rec ) #endif #ifdef TT_CONFIG_CMAP_FORMAT_2 - TTCMAPCITEM(tt_cmap2_class_rec) + TTCMAPCITEM( tt_cmap2_class_rec ) #endif #ifdef TT_CONFIG_CMAP_FORMAT_4 - TTCMAPCITEM(tt_cmap4_class_rec) + TTCMAPCITEM( tt_cmap4_class_rec ) #endif #ifdef TT_CONFIG_CMAP_FORMAT_6 - TTCMAPCITEM(tt_cmap6_class_rec) + TTCMAPCITEM( tt_cmap6_class_rec ) #endif #ifdef TT_CONFIG_CMAP_FORMAT_8 - TTCMAPCITEM(tt_cmap8_class_rec) + TTCMAPCITEM( tt_cmap8_class_rec ) #endif #ifdef TT_CONFIG_CMAP_FORMAT_10 - TTCMAPCITEM(tt_cmap10_class_rec) + TTCMAPCITEM( tt_cmap10_class_rec ) #endif #ifdef TT_CONFIG_CMAP_FORMAT_12 - TTCMAPCITEM(tt_cmap12_class_rec) + TTCMAPCITEM( tt_cmap12_class_rec ) #endif #ifdef TT_CONFIG_CMAP_FORMAT_13 - TTCMAPCITEM(tt_cmap13_class_rec) + TTCMAPCITEM( tt_cmap13_class_rec ) #endif #ifdef TT_CONFIG_CMAP_FORMAT_14 - TTCMAPCITEM(tt_cmap14_class_rec) + TTCMAPCITEM( tt_cmap14_class_rec ) #endif + /* END */ Index: src/sfnt/ttload.c =================================================================== --- src/sfnt/ttload.c (revision 58178) +++ src/sfnt/ttload.c (working copy) @@ -5,8 +5,7 @@ /* Load the basic TrueType tables, i.e., tables that can be either in */ /* TTF or OTF fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -362,14 +361,17 @@ FT_TRACE2(( "-- Number of tables: %10u\n", sfnt.num_tables )); FT_TRACE2(( "-- Format version: 0x%08lx\n", sfnt.format_tag )); - /* check first */ - error = check_table_dir( &sfnt, stream ); - if ( error ) + if ( sfnt.format_tag != TTAG_OTTO ) { - FT_TRACE2(( "tt_face_load_font_dir:" - " invalid table directory for TrueType\n" )); + /* check first */ + error = check_table_dir( &sfnt, stream ); + if ( error ) + { + FT_TRACE2(( "tt_face_load_font_dir:" + " invalid table directory for TrueType\n" )); - goto Exit; + goto Exit; + } } face->num_tables = sfnt.num_tables; @@ -624,7 +626,7 @@ FT_Error error; TT_MaxProfile* maxProfile = &face->max_profile; - const FT_Frame_Field maxp_fields[] = + static const FT_Frame_Field maxp_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_MaxProfile @@ -635,7 +637,7 @@ FT_FRAME_END }; - const FT_Frame_Field maxp_fields_extra[] = + static const FT_Frame_Field maxp_fields_extra[] = { FT_FRAME_START( 26 ), FT_FRAME_USHORT( maxPoints ), @@ -721,7 +723,7 @@ /*************************************************************************/ /* */ /* <Function> */ - /* tt_face_load_names */ + /* tt_face_load_name */ /* */ /* <Description> */ /* Loads the name records. */ @@ -952,7 +954,7 @@ FT_Error error; TT_OS2* os2; - const FT_Frame_Field os2_fields[] = + static const FT_Frame_Field os2_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_OS2 @@ -1004,7 +1006,7 @@ FT_FRAME_END }; - const FT_Frame_Field os2_fields_extra[] = + static const FT_Frame_Field os2_fields_extra[] = { FT_FRAME_START( 8 ), FT_FRAME_ULONG( ulCodePageRange1 ), @@ -1012,7 +1014,7 @@ FT_FRAME_END }; - const FT_Frame_Field os2_fields_extra2[] = + static const FT_Frame_Field os2_fields_extra2[] = { FT_FRAME_START( 10 ), FT_FRAME_SHORT ( sxHeight ), @@ -1213,7 +1215,7 @@ FT_Memory memory = stream->memory; FT_UInt j,num_ranges; - TT_GaspRange gaspranges; + TT_GaspRange gaspranges = NULL; /* the gasp table is optional */ @@ -1240,11 +1242,11 @@ num_ranges = face->gasp.numRanges; FT_TRACE3(( "numRanges: %u\n", num_ranges )); - if ( FT_QNEW_ARRAY( gaspranges, num_ranges ) || - FT_FRAME_ENTER( num_ranges * 4L ) ) + if ( FT_QNEW_ARRAY( face->gasp.gaspRanges, num_ranges ) || + FT_FRAME_ENTER( num_ranges * 4L ) ) goto Exit; - face->gasp.gaspRanges = gaspranges; + gaspranges = face->gasp.gaspRanges; for ( j = 0; j < num_ranges; j++ ) { Index: src/sfnt/ttmtx.c =================================================================== --- src/sfnt/ttmtx.c (revision 58178) +++ src/sfnt/ttmtx.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Load the metrics tables common to TTF and OTF fonts (body). */ /* */ -/* Copyright 2006, 2007, 2008, 2009 by */ +/* Copyright 2006-2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -163,7 +163,7 @@ { FT_TRACE0(( "tt_face_load_hmtx:" " %cmtx has more metrics than glyphs.\n", - vertical ? "v" : "h" )); + vertical ? 'v' : 'h' )); /* Adobe simply ignores this problem. So we shall do the same. */ #if 0 @@ -260,7 +260,7 @@ FT_Error error; TT_HoriHeader* header; - const FT_Frame_Field metrics_header_fields[] = + static const FT_Frame_Field metrics_header_fields[] = { #undef FT_STRUCTURE #define FT_STRUCTURE TT_HoriHeader Index: src/sfnt/ttsbit.c =================================================================== --- src/sfnt/ttsbit.c (revision 58178) +++ src/sfnt/ttsbit.c (working copy) @@ -1343,7 +1343,7 @@ /* All right, we have a compound format. First of all, read */ /* the array of elements. */ { - TT_SBit_Component components; + TT_SBit_Component components = NULL; TT_SBit_Component comp; FT_UShort num_components, count; Index: src/smooth/ftgrays.c =================================================================== --- src/smooth/ftgrays.c (revision 58178) +++ src/smooth/ftgrays.c (working copy) @@ -4,7 +4,7 @@ /* */ /* A new `perfect' anti-aliasing renderer (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2000-2003, 2005-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -232,10 +232,15 @@ /* as usual, for the speed hungry :-) */ +#undef RAS_ARG +#undef RAS_ARG_ +#undef RAS_VAR +#undef RAS_VAR_ + #ifndef FT_STATIC_RASTER -#define RAS_ARG PWorker worker -#define RAS_ARG_ PWorker worker, +#define RAS_ARG gray_PWorker worker +#define RAS_ARG_ gray_PWorker worker, #define RAS_VAR worker #define RAS_VAR_ worker, @@ -253,6 +258,11 @@ /* must be at least 6 bits! */ #define PIXEL_BITS 8 +#undef FLOOR +#undef CEILING +#undef TRUNC +#undef SCALED + #define ONE_PIXEL ( 1L << PIXEL_BITS ) #define PIXEL_MASK ( -1L << PIXEL_BITS ) #define TRUNC( x ) ( (TCoord)( (x) >> PIXEL_BITS ) ) @@ -302,7 +312,7 @@ #endif /* PIXEL_BITS >= 8 */ - /* maximal number of gray spans in a call to the span callback */ + /* maximum number of gray spans in a call to the span callback */ #define FT_MAX_GRAY_SPANS 32 @@ -310,15 +320,15 @@ typedef struct TCell_ { - TPos x; /* same with TWorker.ex */ - TCoord cover; /* same with TWorker.cover */ - TArea area; - PCell next; + TPos x; /* same with gray_TWorker.ex */ + TCoord cover; /* same with gray_TWorker.cover */ + TArea area; + PCell next; } TCell; - typedef struct TWorker_ + typedef struct gray_TWorker_ { TCoord ex, ey; TPos min_ex, max_ex; @@ -329,7 +339,7 @@ TCoord cover; int invalid; - PCell cells; + PCell cells; FT_PtrDist max_cells; FT_PtrDist num_cells; @@ -363,25 +373,25 @@ PCell* ycells; TPos ycount; - } TWorker, *PWorker; + } gray_TWorker, *gray_PWorker; #ifndef FT_STATIC_RASTER #define ras (*worker) #else - static TWorker ras; + static gray_TWorker ras; #endif - typedef struct TRaster_ + typedef struct gray_TRaster_ { - void* buffer; - long buffer_size; - int band_size; - void* memory; - PWorker worker; + void* buffer; + long buffer_size; + int band_size; + void* memory; + gray_PWorker worker; - } TRaster, *PRaster; + } gray_TRaster, *gray_PRaster; @@ -872,11 +882,14 @@ const FT_Vector* to ) { TPos dx, dy; + TPos min, max, y; int top, level; int* levels; FT_Vector* arc; + levels = ras.lev_stack; + arc = ras.bez_stack; arc[0].x = UPSCALE( to->x ); arc[0].y = UPSCALE( to->y ); @@ -884,51 +897,44 @@ arc[1].y = UPSCALE( control->y ); arc[2].x = ras.x; arc[2].y = ras.y; + top = 0; dx = FT_ABS( arc[2].x + arc[0].x - 2 * arc[1].x ); dy = FT_ABS( arc[2].y + arc[0].y - 2 * arc[1].y ); if ( dx < dy ) dx = dy; - if ( dx <= ONE_PIXEL / 4 ) - { - gray_render_line( RAS_VAR_ arc[0].x, arc[0].y ); - return; - } + if ( dx < ONE_PIXEL / 4 ) + goto Draw; + /* short-cut the arc that crosses the current band */ + min = max = arc[0].y; + + y = arc[1].y; + if ( y < min ) min = y; + if ( y > max ) max = y; + + y = arc[2].y; + if ( y < min ) min = y; + if ( y > max ) max = y; + + if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey ) + goto Draw; + level = 0; - while ( dx > ONE_PIXEL / 4 ) + do { dx >>= 2; level++; - } + } while ( dx > ONE_PIXEL / 4 ); - levels = ras.lev_stack; levels[0] = level; - top = 0; - while ( top >= 0 ) + do { level = levels[top]; - if ( level > 1 ) + if ( level > 0 ) { - /* check that the arc crosses the current band */ - TPos min, max, y; - - - min = max = arc[0].y; - - y = arc[1].y; - if ( y < min ) min = y; - if ( y > max ) max = y; - - y = arc[2].y; - if ( y < min ) min = y; - if ( y > max ) max = y; - - if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey ) - goto Draw; - gray_split_conic( arc ); arc += 2; top++; @@ -940,9 +946,8 @@ gray_render_line( RAS_VAR_ arc[0].x, arc[0].y ); top--; arc -= 2; - } - return; + } while ( top >= 0 ); } @@ -980,6 +985,7 @@ const FT_Vector* to ) { FT_Vector* arc; + TPos min, max, y; arc = ras.bez_stack; @@ -992,35 +998,32 @@ arc[3].x = ras.x; arc[3].y = ras.y; - for (;;) - { - /* Check that the arc crosses the current band. */ - TPos min, max, y; + /* Short-cut the arc that crosses the current band. */ + min = max = arc[0].y; + y = arc[1].y; + if ( y < min ) + min = y; + if ( y > max ) + max = y; - min = max = arc[0].y; + y = arc[2].y; + if ( y < min ) + min = y; + if ( y > max ) + max = y; - y = arc[1].y; - if ( y < min ) - min = y; - if ( y > max ) - max = y; + y = arc[3].y; + if ( y < min ) + min = y; + if ( y > max ) + max = y; - y = arc[2].y; - if ( y < min ) - min = y; - if ( y > max ) - max = y; + if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey ) + goto Draw; - y = arc[3].y; - if ( y < min ) - min = y; - if ( y > max ) - max = y; - - if ( TRUNC( min ) >= ras.max_ey || TRUNC( max ) < ras.min_ey ) - goto Draw; - + for (;;) + { /* Decide whether to split or draw. See `Rapid Termination */ /* Evaluation for Recursive Subdivision of Bezier Curves' by Thomas */ /* F. Hain, at */ @@ -1088,11 +1091,11 @@ if ( s > s_limit ) goto Split; - /* If P1 or P2 is outside P0-P3, split the curve. */ - if ( dy * dy1 + dx * dx1 < 0 || - dy * dy2 + dx * dx2 < 0 || - dy * (arc[3].y - arc[1].y) + dx * (arc[3].x - arc[1].x) < 0 || - dy * (arc[3].y - arc[2].y) + dx * (arc[3].x - arc[2].x) < 0 ) + /* 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 + acute as detected by appropriate dot products. */ + if ( dx1 * ( dx1 - dx ) + dy1 * ( dy1 - dy ) > 0 || + dx2 * ( dx2 - dx ) + dy2 * ( dy2 - dy ) > 0 ) goto Split; /* No reason to split. */ @@ -1117,7 +1120,7 @@ static int gray_move_to( const FT_Vector* to, - PWorker worker ) + gray_PWorker worker ) { TPos x, y; @@ -1139,7 +1142,7 @@ static int gray_line_to( const FT_Vector* to, - PWorker worker ) + gray_PWorker worker ) { gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) ); return 0; @@ -1149,7 +1152,7 @@ static int gray_conic_to( const FT_Vector* control, const FT_Vector* to, - PWorker worker ) + gray_PWorker worker ) { gray_render_conic( RAS_VAR_ control, to ); return 0; @@ -1160,7 +1163,7 @@ gray_cubic_to( const FT_Vector* control1, const FT_Vector* control2, const FT_Vector* to, - PWorker worker ) + gray_PWorker worker ) { gray_render_cubic( RAS_VAR_ control1, control2, to ); return 0; @@ -1171,7 +1174,7 @@ gray_render_span( int y, int count, const FT_Span* spans, - PWorker worker ) + gray_PWorker worker ) { unsigned char* p; FT_Bitmap* map = &worker->target; @@ -1397,7 +1400,26 @@ ras.render_span( ras.span_y, ras.num_gray_spans, ras.gray_spans, ras.render_span_data ); +#ifdef FT_DEBUG_LEVEL_TRACE + + if ( ras.num_gray_spans > 0 ) + { + FT_Span* span; + int n; + + + FT_TRACE7(( "y = %3d ", ras.span_y )); + span = ras.gray_spans; + for ( n = 0; n < ras.num_gray_spans; n++, span++ ) + FT_TRACE7(( "[%d..%d]:%02x ", + span->x, span->x + span->len - 1, span->coverage )); + FT_TRACE7(( "\n" )); + } + FT_TRACE7(( "gray_sweep: end\n" )); + +#endif /* FT_DEBUG_LEVEL_TRACE */ + } @@ -1683,11 +1705,11 @@ #endif /* _STANDALONE_ */ - typedef struct TBand_ + typedef struct gray_TBand_ { TPos min, max; - } TBand; + } gray_TBand; FT_DEFINE_OUTLINE_FUNCS(func_interface, (FT_Outline_MoveTo_Func) gray_move_to, @@ -1724,11 +1746,11 @@ static int gray_convert_glyph( RAS_ARG ) { - TBand bands[40]; - TBand* volatile band; - int volatile n, num_bands; - TPos volatile min, max, max_y; - FT_BBox* clip; + gray_TBand bands[40]; + gray_TBand* volatile band; + int volatile n, num_bands; + TPos volatile min, max, max_y; + FT_BBox* clip; /* Set up state in the raster object */ @@ -1792,7 +1814,7 @@ cell_start += sizeof ( TCell ) - cell_mod; cell_end = ras.buffer_size; - cell_end -= cell_end % sizeof( TCell ); + cell_end -= cell_end % sizeof ( TCell ); cells_max = (PCell)( (char*)ras.buffer + cell_end ); ras.cells = (PCell)( (char*)ras.buffer + cell_start ); @@ -1859,12 +1881,12 @@ static int - gray_raster_render( PRaster raster, + gray_raster_render( gray_PRaster raster, const FT_Raster_Params* params ) { const FT_Outline* outline = (const FT_Outline*)params->source; const FT_Bitmap* target_map = params->target; - PWorker worker; + gray_PWorker worker; if ( !raster || !raster->buffer || !raster->buffer_size ) @@ -1956,7 +1978,7 @@ gray_raster_new( void* memory, FT_Raster* araster ) { - static TRaster the_raster; + static gray_TRaster the_raster; FT_UNUSED( memory ); @@ -1981,15 +2003,15 @@ gray_raster_new( FT_Memory memory, FT_Raster* araster ) { - FT_Error error; - PRaster raster = NULL; + FT_Error error; + gray_PRaster raster = NULL; *araster = 0; - if ( !FT_ALLOC( raster, sizeof ( TRaster ) ) ) + if ( !FT_ALLOC( raster, sizeof ( gray_TRaster ) ) ) { raster->memory = memory; - *araster = (FT_Raster)raster; + *araster = (FT_Raster)raster; } return error; @@ -1999,7 +2021,7 @@ static void gray_raster_done( FT_Raster raster ) { - FT_Memory memory = (FT_Memory)((PRaster)raster)->memory; + FT_Memory memory = (FT_Memory)((gray_PRaster)raster)->memory; FT_FREE( raster ); @@ -2013,19 +2035,20 @@ char* pool_base, long pool_size ) { - PRaster rast = (PRaster)raster; + gray_PRaster rast = (gray_PRaster)raster; if ( raster ) { - if ( pool_base && pool_size >= (long)sizeof ( TWorker ) + 2048 ) + if ( pool_base && pool_size >= (long)sizeof ( gray_TWorker ) + 2048 ) { - PWorker worker = (PWorker)pool_base; + gray_PWorker worker = (gray_PWorker)pool_base; rast->worker = worker; rast->buffer = pool_base + - ( ( sizeof ( TWorker ) + sizeof ( TCell ) - 1 ) & + ( ( sizeof ( gray_TWorker ) + + sizeof ( TCell ) - 1 ) & ~( sizeof ( TCell ) - 1 ) ); rast->buffer_size = (long)( ( pool_base + pool_size ) - (char*)rast->buffer ) & Index: src/smooth/ftsmerrs.h =================================================================== --- src/smooth/ftsmerrs.h (revision 58178) +++ src/smooth/ftsmerrs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* smooth renderer error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX Smooth_Err_ #define FT_ERR_BASE FT_Mod_Err_Smooth Index: src/smooth/ftsmooth.c =================================================================== --- src/smooth/ftsmooth.c (revision 58178) +++ src/smooth/ftsmooth.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Anti-aliasing renderer interface (body). */ /* */ -/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by */ +/* Copyright 2000-2006, 2009-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -105,7 +105,10 @@ FT_Error error; FT_Outline* outline = NULL; FT_BBox cbox; - FT_UInt width, height, height_org, width_org, pitch; + FT_Pos width, height, pitch; +#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; @@ -114,7 +117,11 @@ FT_Raster_Params params; + FT_Bool have_translated_origin = FALSE; + FT_Bool have_outline_shifted = FALSE; + FT_Bool have_buffer = FALSE; + /* check glyph image format */ if ( slot->format != render->glyph_format ) { @@ -124,13 +131,19 @@ /* check mode */ if ( mode != required_mode ) - return Smooth_Err_Cannot_Render_Glyph; + { + error = Smooth_Err_Cannot_Render_Glyph; + goto Exit; + } outline = &slot->outline; /* translate the outline to the new origin if needed */ if ( origin ) + { FT_Outline_Translate( outline, origin->x, origin->y ); + have_translated_origin = TRUE; + } /* compute the control box, and grid fit it */ FT_Outline_Get_CBox( outline, &cbox ); @@ -145,26 +158,30 @@ FT_ERROR(( "ft_smooth_render_generic: glyph too large:" " xMin = %d, xMax = %d\n", cbox.xMin >> 6, cbox.xMax >> 6 )); - return Smooth_Err_Raster_Overflow; + error = Smooth_Err_Raster_Overflow; + goto Exit; } else - width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); + width = ( cbox.xMax - cbox.xMin ) >> 6; if ( cbox.yMin < 0 && cbox.yMax > FT_INT_MAX + cbox.yMin ) { FT_ERROR(( "ft_smooth_render_generic: glyph too large:" " yMin = %d, yMax = %d\n", cbox.yMin >> 6, cbox.yMax >> 6 )); - return Smooth_Err_Raster_Overflow; + error = Smooth_Err_Raster_Overflow; + goto Exit; } else - height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); + 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; +#endif /* release old bitmap buffer */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) @@ -216,13 +233,14 @@ #if FT_UINT_MAX > 0xFFFFU - /* Required check is ( pitch * height < FT_ULONG_MAX ), */ - /* but we care realistic cases only. Always pitch <= width. */ - if ( width > 0x7FFFU || height > 0x7FFFU ) + /* Required check is (pitch * height < FT_ULONG_MAX), */ + /* but we care realistic cases only. Always pitch <= width. */ + if ( width > 0x7FFF || height > 0x7FFF ) { FT_ERROR(( "ft_smooth_render_generic: glyph too large: %u x %u\n", width, height )); - return Smooth_Err_Raster_Overflow; + error = Smooth_Err_Raster_Overflow; + goto Exit; } #endif @@ -235,9 +253,12 @@ /* translate outline to render it into the bitmap */ FT_Outline_Translate( outline, -x_shift, -y_shift ); + have_outline_shifted = TRUE; if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) ) goto Exit; + else + have_buffer = TRUE; slot->internal->flags |= FT_GLYPH_OWN_BITMAP; @@ -283,6 +304,9 @@ vec->y /= 3; } + if ( error ) + goto Exit; + if ( slot->library->lcd_filter_func ) slot->library->lcd_filter_func( bitmap, mode, slot->library ); @@ -290,6 +314,8 @@ /* render outline into bitmap */ error = render->raster_render( render->raster, ¶ms ); + if ( error ) + goto Exit; /* expand it horizontally */ if ( hmul ) @@ -341,25 +367,35 @@ #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ - FT_Outline_Translate( outline, x_shift, y_shift ); - /* * XXX: on 16bit system, we return an error for huge bitmap * to prevent an overflow. */ if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX ) - return Smooth_Err_Invalid_Pixel_Size; - - if ( error ) + { + error = Smooth_Err_Invalid_Pixel_Size; goto Exit; + } slot->format = FT_GLYPH_FORMAT_BITMAP; slot->bitmap_left = (FT_Int)x_left; slot->bitmap_top = (FT_Int)y_top; + /* everything is fine; don't deallocate buffer */ + have_buffer = FALSE; + + error = Smooth_Err_Ok; + Exit: - if ( outline && origin ) + if ( have_outline_shifted ) + FT_Outline_Translate( outline, x_shift, y_shift ); + if ( have_translated_origin ) FT_Outline_Translate( outline, -origin->x, -origin->y ); + if ( have_buffer ) + { + FT_FREE( bitmap->buffer ); + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; + } return error; } @@ -416,10 +452,10 @@ } - FT_DEFINE_RENDERER(ft_smooth_renderer_class, + FT_DEFINE_RENDERER( ft_smooth_renderer_class, FT_MODULE_RENDERER, - sizeof( FT_RendererRec ), + sizeof ( FT_RendererRec ), "smooth", 0x10000L, @@ -443,10 +479,10 @@ ) - FT_DEFINE_RENDERER(ft_smooth_lcd_renderer_class, - + FT_DEFINE_RENDERER( ft_smooth_lcd_renderer_class, + FT_MODULE_RENDERER, - sizeof( FT_RendererRec ), + sizeof ( FT_RendererRec ), "smooth-lcd", 0x10000L, @@ -469,10 +505,10 @@ (FT_Raster_Funcs*) &FT_GRAYS_RASTER_GET ) - FT_DEFINE_RENDERER(ft_smooth_lcdv_renderer_class, + FT_DEFINE_RENDERER( ft_smooth_lcdv_renderer_class, FT_MODULE_RENDERER, - sizeof( FT_RendererRec ), + sizeof ( FT_RendererRec ), "smooth-lcdv", 0x10000L, Index: src/smooth/ftspic.c =================================================================== --- src/smooth/ftspic.c (revision 58178) +++ src/smooth/ftspic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for smooth module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,21 +20,27 @@ #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #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*); + void + FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs ); void - ft_smooth_renderer_class_pic_free( FT_Library library ) + ft_smooth_renderer_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->smooth ) { - SmoothPIC* container = (SmoothPIC*)pic_container->smooth; - if(--container->ref_count) + SmoothPIC* container = (SmoothPIC*)pic_container->smooth; + + + if ( --container->ref_count ) return; FT_FREE( container ); pic_container->smooth = NULL; @@ -47,13 +53,13 @@ { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = Smooth_Err_Ok; - SmoothPIC* container; + SmoothPIC* container = NULL; FT_Memory memory = library->memory; - /* since this function also serve smooth_lcd and smooth_lcdv renderers, + /* since this function also serve smooth_lcd and smooth_lcdv renderers, it implements reference counting */ - if(pic_container->smooth) + if ( pic_container->smooth ) { ((SmoothPIC*)pic_container->smooth)->ref_count++; return error; @@ -62,34 +68,37 @@ /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + 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 */ - FT_Init_Class_ft_grays_raster(&container->ft_grays_raster); + FT_Init_Class_ft_grays_raster( &container->ft_grays_raster ); /*Exit:*/ - if(error) - ft_smooth_renderer_class_pic_free(library); + 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); + 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_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); + 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); + ft_smooth_renderer_class_pic_free( library ); } #endif /* FT_CONFIG_OPTION_PIC */ Index: src/smooth/ftspic.h =================================================================== --- src/smooth/ftspic.h (revision 58178) +++ src/smooth/ftspic.h (working copy) @@ -19,7 +19,7 @@ #ifndef __FTSPIC_H__ #define __FTSPIC_H__ - + FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H @@ -38,6 +38,25 @@ #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 + ft_smooth_renderer_class_pic_free( FT_Library library ); + + void + ft_smooth_lcd_renderer_class_pic_free( FT_Library library ); + + void + ft_smooth_lcdv_renderer_class_pic_free( FT_Library library ); + + FT_Error + ft_smooth_renderer_class_pic_init( FT_Library library ); + + FT_Error + ft_smooth_lcd_renderer_class_pic_init( FT_Library library ); + + FT_Error + ft_smooth_lcdv_renderer_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: src/smooth/rules.mk =================================================================== --- src/smooth/rules.mk (revision 58178) +++ src/smooth/rules.mk (working copy) @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003 by +# Copyright 1996-2000, 2001, 2003, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -25,7 +25,8 @@ # smooth driver sources (i.e., C files) # SMOOTH_DRV_SRC := $(SMOOTH_DIR)/ftgrays.c \ - $(SMOOTH_DIR)/ftsmooth.c + $(SMOOTH_DIR)/ftsmooth.c \ + $(SMOOTH_DIR)/ftspic.c # smooth driver headers Index: src/tools/apinames.c =================================================================== --- src/tools/apinames.c (revision 58178) +++ src/tools/apinames.c (working copy) @@ -10,7 +10,7 @@ * accepted if you are using GCC for compilation (and probably by * other compilers too). * - * Author: David Turner, 2005, 2006, 2008, 2009, 2010 + * Author: David Turner, 2005, 2006, 2008-2012 * * This code is explicitly placed into the public domain. * @@ -59,8 +59,9 @@ names_add( const char* name, const char* end ) { - int nn, len, h; - Name nm; + unsigned int h; + int nn, len; + Name nm; if ( end <= name ) return; @@ -86,7 +87,8 @@ if ( num_names >= max_names ) { max_names += (max_names >> 1) + 4; - the_names = (NameRec*)realloc( the_names, sizeof(the_names[0])*max_names ); + the_names = (NameRec*)realloc( the_names, + sizeof ( the_names[0] ) * max_names ); if ( the_names == NULL ) panic( "not enough memory" ); } @@ -115,7 +117,8 @@ static void names_sort( void ) { - qsort( the_names, (size_t)num_names, sizeof(the_names[0]), name_compare ); + qsort( the_names, (size_t)num_names, + sizeof ( the_names[0] ), name_compare ); } @@ -169,7 +172,7 @@ int len = dot - dll_name; - if ( len > (int)( sizeof( temp ) - 1 ) ) + if ( len > (int)( sizeof ( temp ) - 1 ) ) len = sizeof ( temp ) - 1; memcpy( temp, dll_name, len ); @@ -205,7 +208,7 @@ static int read_header_file( FILE* file, int verbose ) { - static char buff[ LINEBUFF_SIZE+1 ]; + static char buff[LINEBUFF_SIZE + 1]; State state = STATE_START; while ( !feof( file ) ) Index: src/tools/docmaker/content.py =================================================================== --- src/tools/docmaker/content.py (revision 58178) +++ src/tools/docmaker/content.py (working copy) @@ -1,4 +1,4 @@ -# Content (c) 2002, 2004, 2006, 2007, 2008, 2009 +# Content (c) 2002, 2004, 2006-2009, 2012 # David Turner <david@freetype.org> # # This file contains routines used to parse the content of documentation @@ -32,7 +32,7 @@ # this regular expression is used to isolate identifiers from # other text # -re_identifier = re.compile( r'(\w*)' ) +re_identifier = re.compile( r'((?:\w|-)*)' ) # we collect macros ending in `_H'; while outputting the object data, we use Index: src/tools/docmaker/sources.py =================================================================== --- src/tools/docmaker/sources.py (revision 58178) +++ src/tools/docmaker/sources.py (working copy) @@ -1,4 +1,4 @@ -# Sources (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009 +# Sources (c) 2002-2004, 2006-2009, 2012 # David Turner <david@freetype.org> # # @@ -120,8 +120,8 @@ # # notice how each markup tag _must_ begin a new line # -re_markup_tag1 = re.compile( r'''\s*<(\w*)>''' ) # <xxxx> format -re_markup_tag2 = re.compile( r'''\s*@(\w*):''' ) # @xxxx: format +re_markup_tag1 = re.compile( r'''\s*<((?:\w|-)*)>''' ) # <xxxx> format +re_markup_tag2 = re.compile( r'''\s*@((?:\w|-)*):''' ) # @xxxx: format # # the list of supported markup tags, we could add new ones relatively @@ -132,7 +132,7 @@ # # used to detect a cross-reference, after markup tags have been stripped # -re_crossref = re.compile( r'@(\w*)(.*)' ) +re_crossref = re.compile( r'@((?:\w|-)*)(.*)' ) # # used to detect italic and bold styles in paragraph text Index: src/tools/glnames.py =================================================================== --- src/tools/glnames.py (revision 58178) +++ src/tools/glnames.py (working copy) @@ -6,7 +6,7 @@ # -# Copyright 1996-2000, 2003, 2005, 2007, 2008 by +# Copyright 1996-2000, 2003, 2005, 2007, 2008, 2011 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -151,7 +151,7 @@ # The list of standard `SID' glyph names. For the official list, # see Annex A of document at # -# http://partners.adobe.com/asn/developer/pdfs/tn/5176.CFF.pdf. +# http://partners.adobe.com/public/developer/en/font/5176.CFF.pdf . # sid_standard_names = \ [ @@ -412,11 +412,10 @@ ] -# This data has been taken literally from the file `glyphlist.txt', -# version 2.0, 22 Sept 2002. It is available from +# This data has been taken literally from the files `glyphlist.txt' +# and `zapfdingbats.txt' version 2.0, Sept 2002. It is available from # -# http://partners.adobe.com/asn/developer/typeforum/unicodegn.html -# http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt +# http://sourceforge.net/adobe/aglfn/ # adobe_glyph_list = """\ A;0041 @@ -4700,6 +4699,207 @@ zstroke;01B6 zuhiragana;305A zukatakana;30BA +a100;275E +a101;2761 +a102;2762 +a103;2763 +a104;2764 +a105;2710 +a106;2765 +a107;2766 +a108;2767 +a109;2660 +a10;2721 +a110;2665 +a111;2666 +a112;2663 +a117;2709 +a118;2708 +a119;2707 +a11;261B +a120;2460 +a121;2461 +a122;2462 +a123;2463 +a124;2464 +a125;2465 +a126;2466 +a127;2467 +a128;2468 +a129;2469 +a12;261E +a130;2776 +a131;2777 +a132;2778 +a133;2779 +a134;277A +a135;277B +a136;277C +a137;277D +a138;277E +a139;277F +a13;270C +a140;2780 +a141;2781 +a142;2782 +a143;2783 +a144;2784 +a145;2785 +a146;2786 +a147;2787 +a148;2788 +a149;2789 +a14;270D +a150;278A +a151;278B +a152;278C +a153;278D +a154;278E +a155;278F +a156;2790 +a157;2791 +a158;2792 +a159;2793 +a15;270E +a160;2794 +a161;2192 +a162;27A3 +a163;2194 +a164;2195 +a165;2799 +a166;279B +a167;279C +a168;279D +a169;279E +a16;270F +a170;279F +a171;27A0 +a172;27A1 +a173;27A2 +a174;27A4 +a175;27A5 +a176;27A6 +a177;27A7 +a178;27A8 +a179;27A9 +a17;2711 +a180;27AB +a181;27AD +a182;27AF +a183;27B2 +a184;27B3 +a185;27B5 +a186;27B8 +a187;27BA +a188;27BB +a189;27BC +a18;2712 +a190;27BD +a191;27BE +a192;279A +a193;27AA +a194;27B6 +a195;27B9 +a196;2798 +a197;27B4 +a198;27B7 +a199;27AC +a19;2713 +a1;2701 +a200;27AE +a201;27B1 +a202;2703 +a203;2750 +a204;2752 +a205;276E +a206;2770 +a20;2714 +a21;2715 +a22;2716 +a23;2717 +a24;2718 +a25;2719 +a26;271A +a27;271B +a28;271C +a29;2722 +a2;2702 +a30;2723 +a31;2724 +a32;2725 +a33;2726 +a34;2727 +a35;2605 +a36;2729 +a37;272A +a38;272B +a39;272C +a3;2704 +a40;272D +a41;272E +a42;272F +a43;2730 +a44;2731 +a45;2732 +a46;2733 +a47;2734 +a48;2735 +a49;2736 +a4;260E +a50;2737 +a51;2738 +a52;2739 +a53;273A +a54;273B +a55;273C +a56;273D +a57;273E +a58;273F +a59;2740 +a5;2706 +a60;2741 +a61;2742 +a62;2743 +a63;2744 +a64;2745 +a65;2746 +a66;2747 +a67;2748 +a68;2749 +a69;274A +a6;271D +a70;274B +a71;25CF +a72;274D +a73;25A0 +a74;274F +a75;2751 +a76;25B2 +a77;25BC +a78;25C6 +a79;2756 +a7;271E +a81;25D7 +a82;2758 +a83;2759 +a84;275A +a85;276F +a86;2771 +a87;2772 +a88;2773 +a89;2768 +a8;271F +a90;2769 +a91;276C +a92;276D +a93;276A +a94;276B +a95;2774 +a96;2775 +a97;275B +a98;275C +a99;275D +a9;2720 """ @@ -5067,7 +5267,7 @@ write( "/* */\n" ) write( "/* PostScript glyph names. */\n" ) write( "/* */\n" ) - write( "/* Copyright 2005, 2008 by */\n" ) + write( "/* Copyright 2005, 2008, 2011 by */\n" ) write( "/* David Turner, Robert Wilhelm, and Werner Lemberg. */\n" ) write( "/* */\n" ) write( "/* This file is part of the FreeType project, and may only be used, */\n" ) Index: src/truetype/rules.mk =================================================================== --- src/truetype/rules.mk (revision 58178) +++ src/truetype/rules.mk (working copy) @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2001, 2003, 2004 by +# Copyright 1996-2001, 2003-2004, 2011-2012 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -25,12 +25,14 @@ # TrueType driver sources (i.e., C files) # -TT_DRV_SRC := $(TT_DIR)/ttobjs.c \ - $(TT_DIR)/ttpload.c \ +TT_DRV_SRC := $(TT_DIR)/ttdriver.c \ $(TT_DIR)/ttgload.c \ + $(TT_DIR)/ttgxvar.c \ $(TT_DIR)/ttinterp.c \ - $(TT_DIR)/ttgxvar.c \ - $(TT_DIR)/ttdriver.c + $(TT_DIR)/ttobjs.c \ + $(TT_DIR)/ttpic.c \ + $(TT_DIR)/ttpload.c \ + $(TT_DIR)/ttsubpix.c # TrueType driver headers # Index: src/truetype/truetype.c =================================================================== --- src/truetype/truetype.c (revision 58178) +++ src/truetype/truetype.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType TrueType driver component (body only). */ /* */ -/* Copyright 1996-2001, 2004, 2006 by */ +/* Copyright 1996-2001, 2004, 2006, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -27,6 +27,7 @@ #ifdef TT_USE_BYTECODE_INTERPRETER #include "ttinterp.c" +#include "ttsubpix.c" #endif #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT Index: src/truetype/ttdriver.c =================================================================== --- src/truetype/ttdriver.c (revision 58178) +++ src/truetype/ttdriver.c (working copy) @@ -4,8 +4,7 @@ /* */ /* TrueType font driver implementation (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -135,8 +134,6 @@ { FT_UInt nn; TT_Face face = (TT_Face) ttface; - FT_Bool check = FT_BOOL( - !( flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) ); /* XXX: TODO: check for sbits */ @@ -149,7 +146,7 @@ FT_UShort ah; - TT_Get_VMetrics( face, start + nn, check, &tsb, &ah ); + TT_Get_VMetrics( face, start + nn, &tsb, &ah ); advances[nn] = ah; } } @@ -161,7 +158,7 @@ FT_UShort aw; - TT_Get_HMetrics( face, start + nn, check, &lsb, &aw ); + TT_Get_HMetrics( face, start + nn, &lsb, &aw ); advances[nn] = aw; } } @@ -249,7 +246,10 @@ FT_Request_Metrics( size->face, req ); if ( FT_IS_SCALABLE( size->face ) ) + { error = tt_size_reset( ttsize ); + ttsize->root.metrics = ttsize->metrics; + } return error; } @@ -258,7 +258,7 @@ /*************************************************************************/ /* */ /* <Function> */ - /* Load_Glyph */ + /* tt_glyph_load */ /* */ /* <Description> */ /* A driver method used to load a glyph within a given glyph slot. */ @@ -282,10 +282,10 @@ /* FreeType error code. 0 means success. */ /* */ static FT_Error - Load_Glyph( FT_GlyphSlot ttslot, /* TT_GlyphSlot */ - FT_Size ttsize, /* TT_Size */ - FT_UInt glyph_index, - FT_Int32 load_flags ) + tt_glyph_load( FT_GlyphSlot ttslot, /* TT_GlyphSlot */ + FT_Size ttsize, /* TT_Size */ + FT_UInt glyph_index, + FT_Int32 load_flags ) { TT_GlyphSlot slot = (TT_GlyphSlot)ttslot; TT_Size size = (TT_Size)ttsize; @@ -313,7 +313,7 @@ if ( load_flags & FT_LOAD_NO_HINTING ) { /* both FT_LOAD_NO_HINTING and FT_LOAD_NO_AUTOHINT */ - /* are necessary to disable hinting for tricky fonts */ + /* are necessary to disable hinting for tricky fonts */ if ( FT_IS_TRICKY( face ) ) load_flags &= ~FT_LOAD_NO_HINTING; @@ -353,13 +353,13 @@ /*************************************************************************/ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICE_MULTIMASTERSREC(tt_service_gx_multi_masters, + FT_DEFINE_SERVICE_MULTIMASTERSREC( + tt_service_gx_multi_masters, (FT_Get_MM_Func) NULL, (FT_Set_MM_Design_Func) NULL, (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, (FT_Get_MM_Var_Func) TT_Get_MM_Var, - (FT_Set_Var_Design_Func)TT_Set_Var_Design - ) + (FT_Set_Var_Design_Func)TT_Set_Var_Design ) #endif static const FT_Service_TrueTypeEngineRec tt_service_truetype_engine = @@ -379,42 +379,59 @@ #endif /* TT_USE_BYTECODE_INTERPRETER */ }; - FT_DEFINE_SERVICE_TTGLYFREC(tt_service_truetype_glyf, - (TT_Glyf_GetLocationFunc)tt_face_get_location - ) + FT_DEFINE_SERVICE_TTGLYFREC( + tt_service_truetype_glyf, + (TT_Glyf_GetLocationFunc)tt_face_get_location ) #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_DEFINE_SERVICEDESCREC4(tt_services, + FT_DEFINE_SERVICEDESCREC4( + tt_services, FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_TRUETYPE, - FT_SERVICE_ID_MULTI_MASTERS, &FT_TT_SERVICE_GX_MULTI_MASTERS_GET, + 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, &FT_TT_SERVICE_TRUETYPE_GLYF_GET - ) + FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET ) #else - FT_DEFINE_SERVICEDESCREC3(tt_services, + FT_DEFINE_SERVICEDESCREC3( + 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, &FT_TT_SERVICE_TRUETYPE_GLYF_GET - ) + FT_SERVICE_ID_TT_GLYF, &TT_SERVICE_TRUETYPE_GLYF_GET ) #endif + FT_CALLBACK_DEF( FT_Module_Interface ) tt_get_interface( FT_Module driver, /* TT_Driver */ const char* tt_interface ) { + FT_Library library; FT_Module_Interface result; FT_Module sfntd; SFNT_Service sfnt; - result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface ); + + /* TT_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + if ( !driver ) + return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif + + result = ft_service_list_lookup( TT_SERVICES_GET, tt_interface ); if ( result != NULL ) return result; +#ifndef FT_CONFIG_OPTION_PIC if ( !driver ) return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif /* only return the default interface from the SFNT module */ - sfntd = FT_Get_Module( driver->library, "sfnt" ); + sfntd = FT_Get_Module( library, "sfnt" ); if ( sfntd ) { sfnt = (SFNT_Service)( sfntd->clazz->module_interface ); @@ -429,22 +446,21 @@ /* The FT_DriverInterface structure is defined in ftdriver.h. */ #ifdef TT_USE_BYTECODE_INTERPRETER -#define TT_HINTER_FLAG FT_MODULE_DRIVER_HAS_HINTER +#define TT_HINTER_FLAG FT_MODULE_DRIVER_HAS_HINTER #else -#define TT_HINTER_FLAG 0 +#define TT_HINTER_FLAG 0 #endif #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS -#define TT_SIZE_SELECT tt_size_select +#define TT_SIZE_SELECT tt_size_select #else -#define TT_SIZE_SELECT 0 +#define TT_SIZE_SELECT 0 #endif - FT_DEFINE_DRIVER(tt_driver_class, - - - FT_MODULE_FONT_DRIVER | - FT_MODULE_DRIVER_SCALABLE | + FT_DEFINE_DRIVER( tt_driver_class, + + FT_MODULE_FONT_DRIVER | + FT_MODULE_DRIVER_SCALABLE | TT_HINTER_FLAG, sizeof ( TT_DriverRec ), @@ -468,15 +484,15 @@ tt_size_init, tt_size_done, tt_slot_init, - 0, /* FT_Slot_DoneFunc */ + 0, /* FT_Slot_DoneFunc */ - ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ + ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */ - Load_Glyph, + tt_glyph_load, tt_get_kerning, - 0, /* FT_Face_AttachFunc */ + 0, /* FT_Face_AttachFunc */ tt_get_advances, tt_size_request, Index: src/truetype/tterrors.h =================================================================== --- src/truetype/tterrors.h (revision 58178) +++ src/truetype/tterrors.h (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueType error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX TT_Err_ #define FT_ERR_BASE FT_Mod_Err_TrueType Index: src/truetype/ttgload.c =================================================================== --- src/truetype/ttgload.c (revision 58178) +++ src/truetype/ttgload.c (working copy) @@ -4,8 +4,7 @@ /* */ /* TrueType Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -33,6 +32,7 @@ #endif #include "tterrors.h" +#include "ttsubpix.h" /*************************************************************************/ @@ -47,7 +47,7 @@ /*************************************************************************/ /* */ - /* Composite font flags. */ + /* Composite glyph flags. */ /* */ #define ARGS_ARE_WORDS 0x0001 #define ARGS_ARE_XY_VALUES 0x0002 @@ -66,22 +66,16 @@ /*************************************************************************/ /* */ - /* Returns the horizontal metrics in font units for a given glyph. If */ - /* `check' is true, take care of monospaced fonts by returning the */ - /* advance width maximum. */ + /* Return the horizontal metrics in font units for a given glyph. */ /* */ FT_LOCAL_DEF( void ) TT_Get_HMetrics( TT_Face face, FT_UInt idx, - FT_Bool check, FT_Short* lsb, FT_UShort* aw ) { ( (SFNT_Service)face->sfnt )->get_metrics( face, 0, idx, lsb, aw ); - if ( check && face->postscript.isFixedPitch ) - *aw = face->horizontal.advance_Width_Max; - FT_TRACE5(( " advance width (font units): %d\n", *aw )); FT_TRACE5(( " left side bearing (font units): %d\n", *lsb )); } @@ -89,7 +83,7 @@ /*************************************************************************/ /* */ - /* Returns the vertical metrics in font units for a given glyph. */ + /* Return the vertical metrics in font units for a given glyph. */ /* Greg Hitchcock from Microsoft told us that if there were no `vmtx' */ /* table, typoAscender/Descender from the `OS/2' table would be used */ /* instead, and if there were no `OS/2' table, use ascender/descender */ @@ -97,18 +91,12 @@ /* apparently does: It uses the ppem value as the advance height, and */ /* sets the top side bearing to be zero. */ /* */ - /* The monospace `check' is probably not meaningful here, but we leave */ - /* it in for a consistent interface. */ - /* */ FT_LOCAL_DEF( void ) TT_Get_VMetrics( TT_Face face, FT_UInt idx, - FT_Bool check, FT_Short* tsb, FT_UShort* ah ) { - FT_UNUSED( check ); - if ( face->vertical_info ) ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, idx, tsb, ah ); @@ -151,13 +139,9 @@ TT_Get_HMetrics( face, glyph_index, - (FT_Bool)!( loader->load_flags & - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ), &left_bearing, &advance_width ); TT_Get_VMetrics( face, glyph_index, - (FT_Bool)!( loader->load_flags & - FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ), &top_bearing, &advance_height ); @@ -166,6 +150,15 @@ loader->top_bearing = top_bearing; loader->vadvance = advance_height; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + 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 ); +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + if ( !loader->linear_def ) { loader->linear_def = 1; @@ -269,10 +262,6 @@ } -#undef IS_HINTED -#define IS_HINTED( flags ) ( ( flags & FT_LOAD_NO_HINTING ) == 0 ) - - /*************************************************************************/ /* */ /* The following functions are used by default with TrueType fonts. */ @@ -379,19 +368,21 @@ if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit ) goto Invalid_Outline; - prev_cont = FT_NEXT_USHORT( p ); + prev_cont = FT_NEXT_SHORT( p ); if ( n_contours > 0 ) cont[0] = prev_cont; + if ( prev_cont < 0 ) + goto Invalid_Outline; + for ( cont++; cont < cont_limit; cont++ ) { - cont[0] = FT_NEXT_USHORT( p ); + cont[0] = FT_NEXT_SHORT( p ); if ( cont[0] <= prev_cont ) { /* unordered contours: this is invalid */ - error = TT_Err_Invalid_Table; - goto Fail; + goto Invalid_Outline; } prev_cont = cont[0]; } @@ -409,13 +400,6 @@ if ( error ) goto Fail; - /* we'd better check the contours table right now */ - outline = &gloader->current.outline; - - for ( cont = outline->contours + 1; cont < cont_limit; cont++ ) - if ( cont[-1] >= cont[0] ) - goto Invalid_Outline; - /* reading the bytecode instructions */ load->glyph->control_len = 0; load->glyph->control_data = 0; @@ -456,6 +440,8 @@ p += n_ins; + outline = &gloader->current.outline; + /* reading the point tags */ flag = (FT_Byte*)outline->tags; flag_limit = flag + n_points; @@ -833,6 +819,13 @@ loader->pp4 = zone->cur[zone->n_points - 1]; } +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + 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; } @@ -855,7 +848,15 @@ 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; @@ -909,13 +910,40 @@ 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 */ for ( ; vec < limit; vec++ ) @@ -1656,24 +1684,8 @@ /* get the device-independent horizontal advance; it is scaled later */ /* by the base layer. */ - { - FT_Pos advance = loader->linear; + glyph->linearHoriAdvance = loader->linear; - - /* the flag FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH was introduced to */ - /* correctly support DynaLab fonts, which have an incorrect */ - /* `advance_Width_Max' field! It is used, to my knowledge, */ - /* exclusively in the X-TrueType font server. */ - /* */ - if ( face->postscript.isFixedPitch && - ( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 ) - advance = face->horizontal.advance_Width_Max; - - /* we need to return the advance in font units in linearHoriAdvance, */ - /* it will be scaled later by the base layer. */ - glyph->linearHoriAdvance = advance; - } - glyph->metrics.horiBearingX = bbox.xMin; glyph->metrics.horiBearingY = bbox.yMax; glyph->metrics.horiAdvance = loader->pp2.x - loader->pp1.x; @@ -1684,12 +1696,26 @@ { 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 ) +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ glyph->metrics.horiAdvance = *widthp << 6; } @@ -1869,6 +1895,9 @@ { TT_Face face; FT_Stream stream; +#ifdef TT_USE_BYTECODE_INTERPRETER + FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC ); +#endif face = (TT_Face)glyph->face; @@ -1883,11 +1912,23 @@ { TT_ExecContext exec; FT_Bool grayscale; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + FT_Bool subpixel_hinting; + FT_Bool grayscale_hinting; +#if 0 + FT_Bool compatible_widths; + FT_Bool symmetrical_smoothing; + FT_Bool bgr; + FT_Bool subpixel_positioned; +#endif +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ if ( !size->cvt_ready ) { - FT_Error error = tt_size_ready_bytecode( size ); + FT_Error error = tt_size_ready_bytecode( size, pedantic ); + + if ( error ) return error; } @@ -1898,13 +1939,92 @@ if ( !exec ) return TT_Err_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 ) + { + grayscale = grayscale_hinting = TRUE; + subpixel_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; + +#if 1 + 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 ); +#endif /* 0 */ + +#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) != FT_RENDER_MODE_MONO ); +#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + 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 ) + { + FT_UInt i; + + + exec->subpixel_hinting = subpixel_hinting; + + 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 ); + } + /* 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; + + + exec->grayscale_hinting = grayscale_hinting; + + 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 ); + } + +#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 ) { FT_UInt i; @@ -1917,9 +2037,11 @@ for ( i = 0; i < size->cvt_size; i++ ) size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); - tt_size_run_prep( size ); + 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; @@ -2016,13 +2138,11 @@ FT_UInt glyph_index, FT_Int32 load_flags ) { - TT_Face face; FT_Error error; TT_LoaderRec loader; - face = (TT_Face)glyph->face; - error = TT_Err_Ok; + error = TT_Err_Ok; #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS @@ -2036,10 +2156,7 @@ error = load_sbit_image( size, glyph, glyph_index, load_flags ); if ( !error ) { - FT_Face root = &face->root; - - - if ( FT_IS_SCALABLE( root ) ) + if ( FT_IS_SCALABLE( glyph->face ) ) { /* for the bbox we need the header only */ (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE ); @@ -2047,9 +2164,6 @@ glyph->linearHoriAdvance = loader.linear; glyph->linearVertAdvance = loader.top_bearing + loader.bbox.yMax - loader.vadvance; - if ( face->postscript.isFixedPitch && - ( load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 ) - glyph->linearHoriAdvance = face->horizontal.advance_Width_Max; } return TT_Err_Ok; Index: src/truetype/ttgload.h =================================================================== --- src/truetype/ttgload.h (revision 58178) +++ src/truetype/ttgload.h (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueType Glyph Loader (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008 by */ +/* Copyright 1996-2006, 2008, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -37,14 +37,12 @@ FT_LOCAL( void ) TT_Get_HMetrics( TT_Face face, FT_UInt idx, - FT_Bool check, FT_Short* lsb, FT_UShort* aw ); FT_LOCAL( void ) TT_Get_VMetrics( TT_Face face, FT_UInt idx, - FT_Bool check, FT_Short* tsb, FT_UShort* ah ); Index: src/truetype/ttgxvar.c =================================================================== --- src/truetype/ttgxvar.c (revision 58178) +++ src/truetype/ttgxvar.c (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueType GX Font Variation loader */ /* */ -/* Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2004-2012 by */ /* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -91,7 +91,7 @@ /* indicates that there is a delta for every point without needing to */ /* enumerate all of them. */ /* */ -#define ALL_POINTS (FT_UShort*)( -1 ) +#define ALL_POINTS (FT_UShort*)( ~0 ) #define GX_PT_POINTS_ARE_WORDS 0x80 @@ -123,7 +123,7 @@ ft_var_readpackedpoints( FT_Stream stream, FT_UInt *point_cnt ) { - FT_UShort *points; + FT_UShort *points = NULL; FT_Int n; FT_Int runcnt; FT_Int i; @@ -501,11 +501,9 @@ FT_Fixed* im_end_coords ) { FT_UInt i; - FT_Fixed apply; - FT_Fixed temp; + FT_Fixed apply = 0x10000L; - apply = 0x10000L; for ( i = 0; i < blend->num_axis; ++i ) { if ( tuple_coords[i] == 0 ) @@ -525,11 +523,10 @@ else if ( !( tupleIndex & GX_TI_INTERMEDIATE_TUPLE ) ) /* not an intermediate tuple */ - apply = FT_MulDiv( apply, + apply = FT_MulFix( apply, blend->normalizedcoords[i] > 0 ? blend->normalizedcoords[i] - : -blend->normalizedcoords[i], - 0x10000L ); + : -blend->normalizedcoords[i] ); else if ( blend->normalizedcoords[i] <= im_start_coords[i] || blend->normalizedcoords[i] >= im_end_coords[i] ) @@ -539,20 +536,14 @@ } else if ( blend->normalizedcoords[i] < tuple_coords[i] ) - { - temp = FT_MulDiv( blend->normalizedcoords[i] - im_start_coords[i], - 0x10000L, - tuple_coords[i] - im_start_coords[i]); - apply = FT_MulDiv( apply, temp, 0x10000L ); - } + apply = FT_MulDiv( apply, + blend->normalizedcoords[i] - im_start_coords[i], + tuple_coords[i] - im_start_coords[i] ); else - { - temp = FT_MulDiv( im_end_coords[i] - blend->normalizedcoords[i], - 0x10000L, - im_end_coords[i] - tuple_coords[i] ); - apply = FT_MulDiv( apply, temp, 0x10000L ); - } + apply = FT_MulDiv( apply, + im_end_coords[i] - blend->normalizedcoords[i], + im_end_coords[i] - tuple_coords[i] ); } return apply; @@ -622,7 +613,7 @@ FT_Error error = TT_Err_Ok; FT_ULong fvar_start; FT_Int i, j; - FT_MM_Var* mmvar; + FT_MM_Var* mmvar = NULL; FT_Fixed* next_coords; FT_String* next_name; FT_Var_Axis* a; @@ -712,7 +703,7 @@ mmvar->num_axis = fvar_head.axisCount; mmvar->num_designs = - (FT_UInt)-1; /* meaningless in this context; each glyph */ + ~0; /* meaningless in this context; each glyph */ /* may have a different number of designs */ /* (or tuples, as called by Apple) */ mmvar->num_namedstyles = @@ -1034,19 +1025,11 @@ } if ( coords[i] < a->def ) - { - normalized[i] = -FT_MulDiv( coords[i] - a->def, - 0x10000L, - a->minimum - a->def ); - } + normalized[i] = -FT_DivFix( coords[i] - a->def, a->minimum - a->def ); else if ( a->maximum == a->def ) normalized[i] = 0; else - { - normalized[i] = FT_MulDiv( coords[i] - a->def, - 0x10000L, - a->maximum - a->def ); - } + normalized[i] = FT_DivFix( coords[i] - a->def, a->maximum - a->def ); } if ( !blend->avar_checked ) @@ -1061,15 +1044,11 @@ if ( normalized[i] < av->correspondence[j].fromCoord ) { normalized[i] = - FT_MulDiv( - FT_MulDiv( - normalized[i] - av->correspondence[j - 1].fromCoord, - 0x10000L, - av->correspondence[j].fromCoord - - av->correspondence[j - 1].fromCoord ), - av->correspondence[j].toCoord - - av->correspondence[j - 1].toCoord, - 0x10000L ) + + FT_MulDiv( normalized[i] - av->correspondence[j - 1].fromCoord, + av->correspondence[j].toCoord - + av->correspondence[j - 1].toCoord, + av->correspondence[j].fromCoord - + av->correspondence[j - 1].fromCoord ) + av->correspondence[j - 1].toCoord; break; } @@ -1325,7 +1304,7 @@ FT_Stream stream = face->root.stream; FT_Memory memory = stream->memory; GX_Blend blend = face->blend; - FT_Vector* delta_xy; + FT_Vector* delta_xy = NULL; FT_Error error; FT_ULong glyph_start; @@ -1474,6 +1453,9 @@ { for ( j = 0; j < point_count; ++j ) { + if ( localpoints[j] >= n_points ) + continue; + delta_xy[localpoints[j]].x += FT_MulFix( deltas_x[j], apply ); delta_xy[localpoints[j]].y += FT_MulFix( deltas_y[j], apply ); } Index: src/truetype/ttinterp.c =================================================================== --- src/truetype/ttinterp.c (revision 58178) +++ src/truetype/ttinterp.c (working copy) @@ -4,8 +4,7 @@ /* */ /* TrueType bytecode interpreter (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 */ +/* Copyright 1996-2012 */ /* by David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -17,6 +16,10 @@ /***************************************************************************/ +/* Greg Hitchcock from Microsoft has helped a lot in resolving unclear */ +/* issues; many thanks! */ + + #include <ft2build.h> #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_CALC_H @@ -24,16 +27,15 @@ #include FT_SYSTEM_H #include "ttinterp.h" - #include "tterrors.h" +#include "ttsubpix.h" #ifdef TT_USE_BYTECODE_INTERPRETER -#define TT_MULFIX FT_MulFix -#define TT_MULDIV FT_MulDiv -#define TT_MULDIV_NO_ROUND FT_MulDiv_No_Round +#define xxxSPH_DEBUG +#define xxxSPH_DEBUG_MORE_VERBOSE /*************************************************************************/ @@ -49,7 +51,7 @@ /* */ /* In order to detect infinite loops in the code, we set up a counter */ /* within the run loop. A single stroke of interpretation is now */ - /* limited to a maximal number of opcodes defined below. */ + /* limited to a maximum number of opcodes defined below. */ /* */ #define MAX_RUNNABLE_OPCODES 1000000L @@ -229,6 +231,14 @@ #define BOUNDS( x, n ) ( (FT_UInt)(x) >= (FT_UInt)(n) ) #define BOUNDSL( x, n ) ( (FT_ULong)(x) >= (FT_ULong)(n) ) + /*************************************************************************/ + /* */ + /* This macro computes (a*2^14)/b and complements TT_MulFix14. */ + /* */ +#define TT_DivFix14( a, b ) \ + FT_DivFix( a, (b) << 2 ) + + #undef SUCCESS #define SUCCESS 0 @@ -665,9 +675,9 @@ FT_Int i; - /* XXXX: Will probably disappear soon with all the code range */ - /* management, which is now rather obsolete. */ - /* */ + /* XXX: Will probably disappear soon with all the code range */ + /* management, which is now rather obsolete. */ + /* */ size->num_function_defs = exec->numFDefs; size->num_instruction_defs = exec->numIDefs; @@ -712,7 +722,7 @@ FT_Error error; - if ( ( error = TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ) ) + if ( ( error = TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ) ) != TT_Err_Ok ) return error; @@ -986,8 +996,8 @@ /* INS_$83 */ PACK( 0, 0 ), /* INS_$84 */ PACK( 0, 0 ), /* ScanCTRL */ PACK( 1, 0 ), - /* SDVPTL[0] */ PACK( 2, 0 ), - /* SDVPTL[1] */ PACK( 2, 0 ), + /* SDPVTL[0] */ PACK( 2, 0 ), + /* SDPVTL[1] */ PACK( 2, 0 ), /* GetINFO */ PACK( 1, 1 ), /* IDEF */ PACK( 1, 0 ), /* ROLL */ PACK( 3, 3 ), @@ -1460,7 +1470,7 @@ #else - /* compute (a*b)/2^14 with maximal accuracy and rounding */ + /* compute (a*b)/2^14 with maximum accuracy and rounding */ static FT_Int32 TT_MulFix14( FT_Int32 a, FT_Int b ) @@ -1490,7 +1500,7 @@ #endif - /* compute (ax*bx+ay*by)/2^14 with maximal accuracy and rounding */ + /* compute (ax*bx+ay*by)/2^14 with maximum accuracy and rounding */ static FT_Int32 TT_DotFix14( FT_Int32 ax, FT_Int32 ay, @@ -1658,13 +1668,13 @@ else { - FT_Long x, y; + FT_F26Dot6 x, y; - x = TT_MULDIV( CUR.GS.projVector.x, - CUR.tt_metrics.x_ratio, 0x4000 ); - y = TT_MULDIV( CUR.GS.projVector.y, - CUR.tt_metrics.y_ratio, 0x4000 ); + x = TT_MulFix14( CUR.tt_metrics.x_ratio, + CUR.GS.projVector.x ); + y = TT_MulFix14( CUR.tt_metrics.y_ratio, + CUR.GS.projVector.y ); CUR.tt_metrics.ratio = TT_VecLen( x, y ); } } @@ -1676,7 +1686,7 @@ static FT_Long Current_Ppem( EXEC_OP ) { - return TT_MULFIX( CUR.tt_metrics.ppem, CURRENT_Ratio() ); + return FT_MulFix( CUR.tt_metrics.ppem, CURRENT_Ratio() ); } @@ -1697,7 +1707,7 @@ FT_CALLBACK_DEF( FT_F26Dot6 ) Read_CVT_Stretched( EXEC_OP_ FT_ULong idx ) { - return TT_MULFIX( CUR.cvt[idx], CURRENT_Ratio() ); + return FT_MulFix( CUR.cvt[idx], CURRENT_Ratio() ); } @@ -1797,7 +1807,7 @@ /* NOTE: Because the last instruction of a program may be a CALL */ /* which will return to the first byte *after* the code */ - /* range, we test for AIP <= Size, instead of AIP < Size. */ + /* range, we test for aIP <= Size, instead of aIP < Size. */ if ( aIP > range->size ) { @@ -1847,9 +1857,11 @@ if ( v != 0 ) { - zone->cur[point].x += TT_MULDIV( distance, - v * 0x10000L, - CUR.F_dot_P ); +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( !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->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -1858,9 +1870,7 @@ if ( v != 0 ) { - zone->cur[point].y += TT_MULDIV( distance, - v * 0x10000L, - CUR.F_dot_P ); + zone->cur[point].y += FT_MulDiv( distance, v, CUR.F_dot_P ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } @@ -1899,16 +1909,12 @@ v = CUR.GS.freeVector.x; if ( v != 0 ) - zone->org[point].x += TT_MULDIV( distance, - v * 0x10000L, - CUR.F_dot_P ); + zone->org[point].x += FT_MulDiv( distance, v, CUR.F_dot_P ); v = CUR.GS.freeVector.y; if ( v != 0 ) - zone->org[point].y += TT_MULDIV( distance, - v * 0x10000L, - CUR.F_dot_P ); + zone->org[point].y += FT_MulDiv( distance, v, CUR.F_dot_P ); } @@ -1929,6 +1935,10 @@ { FT_UNUSED_EXEC; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( !CUR.ignore_x_mode || + ( CUR.sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVEX ) ) +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ zone->cur[point].x += distance; zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -2190,7 +2200,7 @@ } else { - val = - FT_PIX_CEIL( compensation - distance ); + val = -FT_PIX_CEIL( compensation - distance ); if ( val > 0 ) val = 0; } @@ -2401,9 +2411,10 @@ /* Sets Super Round parameters. */ /* */ /* <Input> */ - /* GridPeriod :: Grid period */ - /* selector :: SROUND opcode */ + /* GridPeriod :: The grid period. */ /* */ + /* selector :: The SROUND opcode. */ + /* */ static void SetSuperRound( EXEC_OP_ FT_F26Dot6 GridPeriod, FT_Long selector ) @@ -2614,13 +2625,10 @@ if ( CUR.GS.dualVector.x == 0x4000 ) CUR.func_dualproj = Project_x; + else if ( CUR.GS.dualVector.y == 0x4000 ) + CUR.func_dualproj = Project_y; else - { - if ( CUR.GS.dualVector.y == 0x4000 ) - CUR.func_dualproj = Project_y; - else - CUR.func_dualproj = Dual_Project; - } + CUR.func_dualproj = Dual_Project; /* Force recalculation of cached aspect ratio */ CUR.tt_metrics.ratio = 0; @@ -2630,61 +2638,50 @@ #endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */ if ( CUR.GS.freeVector.x == 0x4000 ) - CUR.F_dot_P = CUR.GS.projVector.x * 0x10000L; + CUR.F_dot_P = CUR.GS.projVector.x; + else if ( CUR.GS.freeVector.y == 0x4000 ) + CUR.F_dot_P = CUR.GS.projVector.y; else - { - if ( CUR.GS.freeVector.y == 0x4000 ) - CUR.F_dot_P = CUR.GS.projVector.y * 0x10000L; - else - CUR.F_dot_P = (FT_Long)CUR.GS.projVector.x * CUR.GS.freeVector.x * 4 + - (FT_Long)CUR.GS.projVector.y * CUR.GS.freeVector.y * 4; - } + CUR.F_dot_P = ( (FT_Long)CUR.GS.projVector.x * CUR.GS.freeVector.x + + (FT_Long)CUR.GS.projVector.y * CUR.GS.freeVector.y ) >> + 14; if ( CUR.GS.projVector.x == 0x4000 ) CUR.func_project = (TT_Project_Func)Project_x; + else if ( CUR.GS.projVector.y == 0x4000 ) + CUR.func_project = (TT_Project_Func)Project_y; else - { - if ( CUR.GS.projVector.y == 0x4000 ) - CUR.func_project = (TT_Project_Func)Project_y; - else - CUR.func_project = (TT_Project_Func)Project; - } + CUR.func_project = (TT_Project_Func)Project; if ( CUR.GS.dualVector.x == 0x4000 ) CUR.func_dualproj = (TT_Project_Func)Project_x; + else if ( CUR.GS.dualVector.y == 0x4000 ) + CUR.func_dualproj = (TT_Project_Func)Project_y; else - { - if ( CUR.GS.dualVector.y == 0x4000 ) - CUR.func_dualproj = (TT_Project_Func)Project_y; - else - CUR.func_dualproj = (TT_Project_Func)Dual_Project; - } + CUR.func_dualproj = (TT_Project_Func)Dual_Project; CUR.func_move = (TT_Move_Func)Direct_Move; CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig; - if ( CUR.F_dot_P == 0x40000000L ) + if ( CUR.F_dot_P == 0x4000L ) { if ( CUR.GS.freeVector.x == 0x4000 ) { CUR.func_move = (TT_Move_Func)Direct_Move_X; CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_X; } - else + else if ( CUR.GS.freeVector.y == 0x4000 ) { - if ( CUR.GS.freeVector.y == 0x4000 ) - { - CUR.func_move = (TT_Move_Func)Direct_Move_Y; - CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y; - } + CUR.func_move = (TT_Move_Func)Direct_Move_Y; + CUR.func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y; } } /* at small sizes, F_dot_P can become too small, resulting */ /* in overflows and `spikes' in a number of glyphs like `w'. */ - if ( FT_ABS( CUR.F_dot_P ) < 0x4000000L ) - CUR.F_dot_P = 0x40000000L; + if ( FT_ABS( CUR.F_dot_P ) < 0x400L ) + CUR.F_dot_P = 0x4000L; /* Disable cached aspect ratio */ CUR.tt_metrics.ratio = 0; @@ -2740,21 +2737,21 @@ return SUCCESS; } - R->x = (FT_F2Dot14)FT_MulDiv( Vx, 0x4000L, W ); - R->y = (FT_F2Dot14)FT_MulDiv( Vy, 0x4000L, W ); + R->x = (FT_F2Dot14)TT_DivFix14( Vx, W ); + R->y = (FT_F2Dot14)TT_DivFix14( Vy, W ); return SUCCESS; } W = TT_VecLen( Vx, Vy ); - Vx = FT_MulDiv( Vx, 0x4000L, W ); - Vy = FT_MulDiv( Vy, 0x4000L, W ); + 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 */ + /* Or 0x10000000 <= W < 0x10004000 */ if ( Vx < 0 ) { @@ -2842,6 +2839,17 @@ A = p1->x - p2->x; B = p1->y - p2->y; + /* If p1 == p2, SPVTL and SFVTL behave the same as */ + /* SPVTCA[X] and SFVTCA[X], respectively. */ + /* */ + /* Confirmed by Greg Hitchcock. */ + + if ( A == 0 && B == 0 ) + { + A = 0x4000; + aOpc = 0; + } + if ( ( aOpc & 1 ) != 0 ) { C = B; /* counter clockwise rotation */ @@ -3096,14 +3104,9 @@ CUR.GS.single_width_cutin = (FT_F26Dot6)args[0]; - /* XXX: UNDOCUMENTED! or bug in the Windows engine? */ - /* */ - /* It seems that the value that is read here is */ - /* expressed in 16.16 format rather than in font */ - /* units. */ - /* */ -#define DO_SSW \ - CUR.GS.single_width_value = (FT_F26Dot6)( args[0] >> 10 ); +#define DO_SSW \ + CUR.GS.single_width_value = FT_MulFix( args[0], \ + CUR.tt_metrics.scale ); #define DO_FLIPON \ @@ -3167,44 +3170,60 @@ args[0] = CUR.top; -#define DO_CINDEX \ - { \ - FT_Long L; \ - \ - \ - L = args[0]; \ - \ - if ( L <= 0 || L > CUR.args ) \ - CUR.error = TT_Err_Invalid_Reference; \ - 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 = TT_Err_Invalid_Reference; \ + args[0] = 0; \ + } \ + else \ + args[0] = CUR.stack[CUR.args - L]; \ } -#define DO_JROT \ - if ( args[1] != 0 ) \ - { \ - CUR.IP += args[0]; \ - if ( CUR.IP < 0 ) \ - CUR.error = TT_Err_Bad_Argument; \ - CUR.step_ins = FALSE; \ +#define DO_JROT \ + if ( args[1] != 0 ) \ + { \ + if ( args[0] == 0 && CUR.args == 0 ) \ + CUR.error = TT_Err_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.step_ins = FALSE; \ } -#define DO_JMPR \ - CUR.IP += args[0]; \ - if ( CUR.IP < 0 ) \ - CUR.error = TT_Err_Bad_Argument; \ +#define DO_JMPR \ + if ( args[0] == 0 && CUR.args == 0 ) \ + CUR.error = TT_Err_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.step_ins = FALSE; -#define DO_JROF \ - if ( args[1] == 0 ) \ - { \ - CUR.IP += args[0]; \ - if ( CUR.IP < 0 ) \ - CUR.error = TT_Err_Bad_Argument; \ - CUR.step_ins = FALSE; \ +#define DO_JROF \ + if ( args[1] == 0 ) \ + { \ + if ( args[0] == 0 && CUR.args == 0 ) \ + CUR.error = TT_Err_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.step_ins = FALSE; \ } @@ -3264,11 +3283,11 @@ if ( args[1] == 0 ) \ CUR.error = TT_Err_Divide_By_Zero; \ else \ - args[0] = TT_MULDIV_NO_ROUND( args[0], 64L, args[1] ); + args[0] = FT_MulDiv_No_Round( args[0], 64L, args[1] ); #define DO_MUL \ - args[0] = TT_MULDIV( args[0], args[1], 64L ); + args[0] = FT_MulDiv( args[0], args[1], 64L ); #define DO_ABS \ @@ -3286,7 +3305,35 @@ #define DO_CEILING \ args[0] = FT_PIX_CEIL( args[0] ); +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING +#define DO_RS \ + { \ + FT_ULong I = (FT_ULong)args[0]; \ + \ + \ + if ( BOUNDSL( I, CUR.storeSize ) ) \ + { \ + if ( CUR.pedantic_hinting ) \ + ARRAY_BOUND_ERROR; \ + else \ + args[0] = 0; \ + } \ + else \ + { \ + /* subpixel hinting - avoid Typeman Dstroke and */ \ + /* IStroke and Vacuform rounds */ \ + \ + if ( CUR.compatibility_mode && \ + ( I == 24 || I == 22 || I == 8 ) ) \ + args[0] = 0; \ + else \ + args[0] = CUR.storage[I]; \ + } \ + } + +#else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + #define DO_RS \ { \ FT_ULong I = (FT_ULong)args[0]; \ @@ -3305,7 +3352,9 @@ args[0] = CUR.storage[I]; \ } +#endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + #define DO_WS \ { \ FT_ULong I = (FT_ULong)args[0]; \ @@ -3372,7 +3421,7 @@ } \ } \ else \ - CUR.cvt[I] = TT_MULFIX( args[1], CUR.tt_metrics.scale ); \ + CUR.cvt[I] = FT_MulFix( args[1], CUR.tt_metrics.scale ); \ } @@ -4386,17 +4435,19 @@ if ( L <= 0 || L > CUR.args ) { - CUR.error = TT_Err_Invalid_Reference; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Invalid_Reference; } + else + { + K = CUR.stack[CUR.args - L]; - K = CUR.stack[CUR.args - L]; + FT_ARRAY_MOVE( &CUR.stack[CUR.args - L ], + &CUR.stack[CUR.args - L + 1], + ( L - 1 ) ); - FT_ARRAY_MOVE( &CUR.stack[CUR.args - L ], - &CUR.stack[CUR.args - L + 1], - ( L - 1 ) ); - - CUR.stack[CUR.args - 1] = K; + CUR.stack[CUR.args - 1] = K; + } } @@ -4445,7 +4496,7 @@ CUR.length = opcode_length[CUR.opcode]; if ( CUR.length < 0 ) { - if ( CUR.IP + 1 > CUR.codeSize ) + if ( CUR.IP + 1 >= CUR.codeSize ) goto Fail_Overflow; CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1]; } @@ -4560,7 +4611,28 @@ TT_DefRecord* rec; TT_DefRecord* limit; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* arguments to opcodes are skipped by `SKIP_Code' */ + FT_Byte opcode_pattern[1][12] = { + /* #0 TTFautohint bytecode (old) */ + { + 0x20, /* DUP */ + 0x64, /* ABS */ + 0xB0, /* PUSHB_1 */ + /* 32 */ + 0x60, /* ADD */ + 0x66, /* FLOOR */ + 0x23, /* SWAP */ + 0xB0 /* PUSHB_1 */ + }, + }; + FT_UShort opcode_patterns = 1; + FT_UShort opcode_pointer[1] = { 0, }; + FT_UShort opcode_size[1] = { 7, }; + FT_UShort i; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + /* some font programs are broken enough to redefine functions! */ /* We will then parse the current table. */ @@ -4593,10 +4665,11 @@ return; } - rec->range = CUR.curRange; - rec->opc = (FT_UInt16)n; - rec->start = CUR.IP + 1; - rec->active = TRUE; + rec->range = CUR.curRange; + rec->opc = (FT_UInt16)n; + rec->start = CUR.IP + 1; + rec->active = TRUE; + rec->inline_delta = FALSE; if ( n > CUR.maxFunc ) CUR.maxFunc = (FT_UInt16)n; @@ -4606,6 +4679,46 @@ while ( SKIP_Code() == SUCCESS ) { +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + +#ifdef SPH_DEBUG_MORE_VERBOSE + printf ( "Opcode: %d ", CUR.opcode ); +#endif + + for ( i = 0; i < opcode_patterns; i++ ) + { + if ( opcode_pointer[i] < opcode_size[i] && + CUR.opcode == opcode_pattern[i][opcode_pointer[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] ) + { +#ifdef SPH_DEBUG + printf( "Function signature %d detected in FDEF %d\n", i, n); +#endif + + switch ( i ) + { + case 0: + CUR.size->ttfautohinted = TRUE; + break; + } + opcode_pointer[i] = 0; + } + } + + else + opcode_pointer[i] = 0; + } + +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + switch ( CUR.opcode ) { case 0x89: /* IDEF */ @@ -4614,6 +4727,7 @@ return; case 0x2D: /* ENDF */ + rec->end = CUR.IP; return; } } @@ -4648,6 +4762,15 @@ 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++; @@ -4718,6 +4841,7 @@ if ( !def->active ) goto Fail; + /* check the call stack */ if ( CUR.callTop >= CUR.callSize ) { @@ -4731,6 +4855,7 @@ pCrec->Caller_IP = CUR.IP + 1; pCrec->Cur_Count = 1; pCrec->Cur_Restart = def->start; + pCrec->Cur_End = def->end; CUR.callTop++; @@ -4809,6 +4934,7 @@ pCrec->Caller_IP = CUR.IP + 1; pCrec->Cur_Count = (FT_Int)args[0]; pCrec->Cur_Restart = def->start; + pCrec->Cur_End = def->end; CUR.callTop++; @@ -4816,6 +4942,7 @@ CUR.step_ins = FALSE; } + return; Fail: @@ -5024,8 +5151,8 @@ /* Opcode range: 0x46-0x47 */ /* Stack: uint32 --> f26.6 */ /* */ - /* BULLSHIT: Measures from the original glyph must be taken along the */ - /* dual projection vector! */ + /* XXX: UNDOCUMENTED: Measures from the original glyph must be taken */ + /* along the dual projection vector! */ /* */ static void Ins_GC( INS_ARG ) @@ -5039,12 +5166,8 @@ if ( BOUNDSL( L, CUR.zp2.n_points ) ) { if ( CUR.pedantic_hinting ) - { CUR.error = TT_Err_Invalid_Reference; - return; - } - else - R = 0; + R = 0; } else { @@ -5088,8 +5211,8 @@ CUR_Func_move( &CUR.zp2, L, args[1] - K ); - /* not part of the specs, but here for safety */ - + /* UNDOCUMENTED! The MS rasterizer does that with */ + /* twilight points (confirmed by Greg Hitchcock) */ if ( CUR.GS.gep2 == 0 ) CUR.zp2.org[L] = CUR.zp2.cur[L]; } @@ -5101,14 +5224,14 @@ /* Opcode range: 0x49-0x4A */ /* Stack: uint32 uint32 --> f26.6 */ /* */ - /* BULLSHIT: Measure taken in the original glyph must be along the dual */ - /* projection vector. */ + /* XXX: UNDOCUMENTED: Measure taken in the original glyph must be along */ + /* the dual projection vector. */ /* */ - /* Second BULLSHIT: Flag attributes are inverted! */ - /* 0 => measure distance in original outline */ - /* 1 => measure distance in grid-fitted outline */ + /* XXX: UNDOCUMENTED: Flag attributes are inverted! */ + /* 0 => measure distance in original outline */ + /* 1 => measure distance in grid-fitted outline */ /* */ - /* Third one: `zp0 - zp1', and not `zp2 - zp1! */ + /* XXX: UNDOCUMENTED: `zp0 - zp1', and not `zp2 - zp1! */ /* */ static void Ins_MD( INS_ARG ) @@ -5124,10 +5247,7 @@ BOUNDS( K, CUR.zp1.n_points ) ) { if ( CUR.pedantic_hinting ) - { CUR.error = TT_Err_Invalid_Reference; - return; - } D = 0; } else @@ -5136,29 +5256,48 @@ D = CUR_Func_project( CUR.zp0.cur + L, CUR.zp1.cur + K ); else { - FT_Vector* vec1 = CUR.zp0.orus + L; - FT_Vector* vec2 = CUR.zp1.orus + K; + /* XXX: UNDOCUMENTED: twilight zone special case */ + if ( CUR.GS.gep0 == 0 || CUR.GS.gep1 == 0 ) + { + FT_Vector* vec1 = CUR.zp0.org + L; + FT_Vector* vec2 = CUR.zp1.org + K; - if ( CUR.metrics.x_scale == CUR.metrics.y_scale ) - { - /* this should be faster */ + D = CUR_Func_dualproj( vec1, vec2 ); - D = TT_MULFIX( D, CUR.metrics.x_scale ); } else { - FT_Vector vec; + FT_Vector* vec1 = CUR.zp0.orus + L; + FT_Vector* vec2 = CUR.zp1.orus + K; - vec.x = TT_MULFIX( vec1->x - vec2->x, CUR.metrics.x_scale ); - vec.y = TT_MULFIX( vec1->y - vec2->y, CUR.metrics.y_scale ); + if ( CUR.metrics.x_scale == CUR.metrics.y_scale ) + { + /* this should be faster */ + D = CUR_Func_dualproj( vec1, vec2 ); + D = FT_MulFix( D, CUR.metrics.x_scale ); + } + else + { + FT_Vector vec; - D = CUR_fast_dualproj( &vec ); + + vec.x = FT_MulFix( vec1->x - vec2->x, CUR.metrics.x_scale ); + vec.y = FT_MulFix( vec1->y - vec2->y, CUR.metrics.y_scale ); + + D = CUR_fast_dualproj( &vec ); + } } } } +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* Disable Type 2 Vacuform Rounds - e.g. Arial Narrow */ + if ( CUR.ignore_x_mode && FT_ABS( D ) == 64 ) + D += 1; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + args[0] = D; } @@ -5173,7 +5312,8 @@ Ins_SDPVTL( INS_ARG ) { FT_Long A, B, C; - FT_UShort p1, p2; /* was FT_Int in pas type ERROR */ + FT_UShort p1, p2; /* was FT_Int in pas type ERROR */ + FT_Int aOpc = CUR.opcode; p1 = (FT_UShort)args[1]; @@ -5194,9 +5334,20 @@ A = v1->x - v2->x; B = v1->y - v2->y; + + /* If v1 == v2, SDPVTL behaves the same as */ + /* SVTCA[X], respectively. */ + /* */ + /* Confirmed by Greg Hitchcock. */ + + if ( A == 0 && B == 0 ) + { + A = 0x4000; + aOpc = 0; + } } - if ( ( CUR.opcode & 1 ) != 0 ) + if ( ( aOpc & 1 ) != 0 ) { C = B; /* counter clockwise rotation */ B = A; @@ -5214,7 +5365,7 @@ B = v1->y - v2->y; } - if ( ( CUR.opcode & 1 ) != 0 ) + if ( ( aOpc & 1 ) != 0 ) { C = B; /* counter clockwise rotation */ B = A; @@ -5465,8 +5616,9 @@ if ( CUR.top < CUR.GS.loop ) { - CUR.error = TT_Err_Too_Few_Arguments; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Too_Few_Arguments; + goto Fail; } while ( CUR.GS.loop > 0 ) @@ -5489,6 +5641,7 @@ CUR.GS.loop--; } + Fail: CUR.GS.loop = 1; CUR.new_top = CUR.args; } @@ -5602,12 +5755,8 @@ else #endif { - *x = TT_MULDIV( d, - (FT_Long)CUR.GS.freeVector.x * 0x10000L, - CUR.F_dot_P ); - *y = TT_MULDIV( d, - (FT_Long)CUR.GS.freeVector.y * 0x10000L, - CUR.F_dot_P ); + *x = FT_MulDiv( d, (FT_Long)CUR.GS.freeVector.x, CUR.F_dot_P ); + *y = FT_MulDiv( d, (FT_Long)CUR.GS.freeVector.y, CUR.F_dot_P ); } return SUCCESS; @@ -5641,7 +5790,12 @@ if ( CUR.GS.freeVector.x != 0 ) { - CUR.zp2.cur[point].x += dx; +#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; if ( touch ) CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_X; } @@ -5676,8 +5830,9 @@ if ( CUR.top < CUR.GS.loop ) { - CUR.error = TT_Err_Invalid_Reference; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Invalid_Reference; + goto Fail; } if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) ) @@ -5697,12 +5852,12 @@ } } else - /* XXX: UNDOCUMENTED! SHP touches the points */ MOVE_Zp2_Point( point, dx, dy, TRUE ); CUR.GS.loop--; } + Fail: CUR.GS.loop = 1; CUR.new_top = CUR.args; } @@ -5714,21 +5869,25 @@ /* Opcode range: 0x34-35 */ /* Stack: uint32 --> */ /* */ + /* UNDOCUMENTED: According to Greg Hitchcock, there is one (virtual) */ + /* contour in the twilight zone, namely contour number */ + /* zero which includes all points of it. */ + /* */ static void Ins_SHC( INS_ARG ) { - TT_GlyphZoneRec zp; - FT_UShort refp; - FT_F26Dot6 dx, - dy; + TT_GlyphZoneRec zp; + FT_UShort refp; + FT_F26Dot6 dx, dy; - FT_Short contour; - FT_UShort first_point, last_point, i; + FT_Short contour, bounds; + FT_UShort start, limit, i; contour = (FT_UShort)args[0]; + bounds = ( CUR.GS.gep2 == 0 ) ? 1 : CUR.zp2.n_contours; - if ( BOUNDS( contour, CUR.pts.n_contours ) ) + if ( BOUNDS( contour, bounds ) ) { if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; @@ -5739,27 +5898,20 @@ return; if ( contour == 0 ) - first_point = 0; + start = 0; else - first_point = (FT_UShort)( CUR.pts.contours[contour - 1] + 1 - - CUR.pts.first_point ); + start = (FT_UShort)( CUR.zp2.contours[contour - 1] + 1 - + CUR.zp2.first_point ); - last_point = (FT_UShort)( CUR.pts.contours[contour] - - CUR.pts.first_point ); + /* we use the number of points if in the twilight zone */ + if ( CUR.GS.gep2 == 0 ) + limit = CUR.zp2.n_points; + else + limit = (FT_UShort)( CUR.zp2.contours[contour] - + CUR.zp2.first_point + 1 ); - /* XXX: this is probably wrong... at least it prevents memory */ - /* corruption when zp2 is the twilight zone */ - if ( BOUNDS( last_point, CUR.zp2.n_points ) ) + for ( i = start; i < limit; i++ ) { - if ( CUR.zp2.n_points > 0 ) - last_point = (FT_UShort)(CUR.zp2.n_points - 1); - else - last_point = 0; - } - - /* XXX: UNDOCUMENTED! SHC touches the points */ - for ( i = first_point; i <= last_point; i++ ) - { if ( zp.cur != CUR.zp2.cur || refp != i ) MOVE_Zp2_Point( i, dx, dy, TRUE ); } @@ -5780,7 +5932,7 @@ FT_F26Dot6 dx, dy; - FT_UShort last_point, i; + FT_UShort limit, i; if ( BOUNDS( args[0], 2 ) ) @@ -5793,28 +5945,19 @@ if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) ) return; - /* XXX: UNDOCUMENTED! SHZ doesn't move the phantom points. */ - /* Twilight zone has no contours, so use `n_points'. */ - /* Normal zone's `n_points' includes phantoms, so must */ - /* use end of last contour. */ - if ( CUR.GS.gep2 == 0 && CUR.zp2.n_points > 0 ) - last_point = (FT_UShort)( CUR.zp2.n_points - 1 ); + /* XXX: UNDOCUMENTED! SHZ doesn't move the phantom points. */ + /* Twilight zone has no real contours, so use `n_points'. */ + /* Normal zone's `n_points' includes phantoms, so must */ + /* use end of last contour. */ + if ( CUR.GS.gep2 == 0 ) + limit = (FT_UShort)CUR.zp2.n_points; else if ( CUR.GS.gep2 == 1 && CUR.zp2.n_contours > 0 ) - { - last_point = (FT_UShort)( CUR.zp2.contours[CUR.zp2.n_contours - 1] ); - - if ( BOUNDS( last_point, CUR.zp2.n_points ) ) - { - if ( CUR.pedantic_hinting ) - CUR.error = TT_Err_Invalid_Reference; - return; - } - } + limit = (FT_UShort)( CUR.zp2.contours[CUR.zp2.n_contours - 1] + 1 ); else - last_point = 0; + limit = 0; /* XXX: UNDOCUMENTED! SHZ doesn't touch the points */ - for ( i = 0; i <= last_point; i++ ) + for ( i = 0; i < limit; i++ ) { if ( zp.cur != CUR.zp2.cur || refp != i ) MOVE_Zp2_Point( i, dx, dy, FALSE ); @@ -5833,12 +5976,16 @@ { FT_F26Dot6 dx, dy; FT_UShort point; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + FT_Int B1, B2; +#endif if ( CUR.top < CUR.GS.loop + 1 ) { - CUR.error = TT_Err_Invalid_Reference; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Invalid_Reference; + goto Fail; } #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING @@ -5846,13 +5993,13 @@ { if ( CUR.GS.both_x_axis ) { - dx = TT_MulFix14( (FT_UInt32)args[0], 0x4000 ); + dx = (FT_UInt32)args[0]; dy = 0; } else { dx = 0; - dy = TT_MulFix14( (FT_UInt32)args[0], 0x4000 ); + dy = (FT_UInt32)args[0]; } } else @@ -5877,11 +6024,85 @@ } } else +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + { + /* 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 */ + /* - 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 ) + { + /* save point for later comparison */ + if ( CUR.GS.freeVector.y != 0 ) + B1 = CUR.zp2.cur[point].y; + 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 ) + MOVE_Zp2_Point( point, dx, dy, TRUE ); + + else if ( CUR.ignore_x_mode && CUR.compatibility_mode ) + { + if ( CUR.ignore_x_mode && + ( CUR.sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) ) + { + dx = FT_PIX_ROUND( B1 + dx ) - B1; + dy = FT_PIX_ROUND( B1 + dy ) - B1; + } + + 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 ); + } + + /* 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 ); + } + } + else + MOVE_Zp2_Point( point, dx, dy, TRUE ); + } + Skip: +#else MOVE_Zp2_Point( point, dx, dy, TRUE ); +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ CUR.GS.loop--; } + Fail: CUR.GS.loop = 1; CUR.new_top = CUR.args; } @@ -5898,8 +6119,18 @@ { FT_UShort point; FT_F26Dot6 distance; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + FT_F26Dot6 control_value_cutin; + 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; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + point = (FT_UShort)args[0]; if ( BOUNDS( point, CUR.zp1.n_points ) || @@ -5910,9 +6141,9 @@ return; } - /* XXX: UNDOCUMENTED! behaviour */ - if ( CUR.GS.gep1 == 0 ) /* if the point that is to be moved */ - /* is in twilight zone */ + /* UNDOCUMENTED! The MS rasterizer does that with */ + /* twilight points (confirmed by Greg Hitchcock) */ + if ( CUR.GS.gep1 == 0 ) { CUR.zp1.org[point] = CUR.zp0.org[CUR.GS.rp0]; CUR_Func_move_orig( &CUR.zp1, point, args[1] ); @@ -5922,6 +6153,14 @@ distance = CUR_Func_project( CUR.zp1.cur + point, CUR.zp0.cur + CUR.GS.rp0 ); +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* subpixel hinting - make MSIRP respect CVT cut-in; */ + if ( CUR.ignore_x_mode && + CUR.GS.freeVector.x != 0 && + FT_ABS( distance - args[1] ) >= control_value_cutin ) + distance = args[1]; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + CUR_Func_move( &CUR.zp1, point, args[1] - distance ); CUR.GS.rp1 = CUR.GS.rp0; @@ -5942,8 +6181,8 @@ Ins_MDAP( INS_ARG ) { FT_UShort point; - FT_F26Dot6 cur_dist, - distance; + FT_F26Dot6 cur_dist; + FT_F26Dot6 distance; point = (FT_UShort)args[0]; @@ -5955,13 +6194,20 @@ return; } - /* XXX: Is there some undocumented feature while in the */ - /* twilight zone? ? */ if ( ( CUR.opcode & 1 ) != 0 ) { cur_dist = CUR_fast_project( &CUR.zp0.cur[point] ); - distance = CUR_Func_round( cur_dist, - CUR.tt_metrics.compensations[0] ) - cur_dist; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode && + CUR.GS.freeVector.x != 0 ) + distance = ROUND_None( + cur_dist, + CUR.tt_metrics.compensations[0] ) - cur_dist; + else +#endif + distance = CUR_Func_round( + cur_dist, + CUR.tt_metrics.compensations[0] ) - cur_dist; } else distance = 0; @@ -5984,64 +6230,92 @@ { FT_ULong cvtEntry; FT_UShort point; - FT_F26Dot6 distance, - org_dist; + FT_F26Dot6 distance; + FT_F26Dot6 org_dist; + FT_F26Dot6 control_value_cutin; - cvtEntry = (FT_ULong)args[1]; - point = (FT_UShort)args[0]; + control_value_cutin = CUR.GS.control_value_cutin; + cvtEntry = (FT_ULong)args[1]; + point = (FT_UShort)args[0]; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + 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 */ + if ( BOUNDS( point, CUR.zp0.n_points ) || BOUNDSL( cvtEntry, CUR.cvtSize ) ) { if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; - return; + goto Fail; } - /* XXX: UNDOCUMENTED! */ - /* */ - /* The behaviour of an MIAP instruction is quite */ - /* different when used in the twilight zone. */ - /* */ - /* First, no control value cut-in test is performed */ - /* as it would fail anyway. Second, the original */ - /* point, i.e. (org_x,org_y) of zp0.point, is set */ - /* to the absolute, unrounded distance found in */ - /* the CVT. */ - /* */ - /* This is used in the CVT programs of the Microsoft */ - /* fonts Arial, Times, etc., in order to re-adjust */ - /* some key font heights. It allows the use of the */ - /* IP instruction in the twilight zone, which */ - /* otherwise would be `illegal' according to the */ - /* specification. */ - /* */ - /* We implement it with a special sequence for the */ - /* twilight zone. This is a bad hack, but it seems */ - /* to work. */ + /* UNDOCUMENTED! */ + /* */ + /* The behaviour of an MIAP instruction is quite different when used */ + /* in the twilight zone. */ + /* */ + /* First, no control value cut-in test is performed as it would fail */ + /* anyway. Second, the original point, i.e. (org_x,org_y) of */ + /* zp0.point, is set to the absolute, unrounded distance found in the */ + /* CVT. */ + /* */ + /* This is used in the CVT programs of the Microsoft fonts Arial, */ + /* Times, etc., in order to re-adjust some key font heights. It */ + /* allows the use of the IP instruction in the twilight zone, which */ + /* otherwise would be invalid according to the specification. */ + /* */ + /* We implement it with a special sequence for the twilight zone. */ + /* This is a bad hack, but it seems to work. */ + /* */ + /* Confirmed by Greg Hitchcock. */ distance = CUR_Func_read_cvt( cvtEntry ); if ( CUR.GS.gep0 == 0 ) /* If in twilight zone */ { - CUR.zp0.org[point].x = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.x ); - CUR.zp0.org[point].y = TT_MulFix14( (FT_UInt32)distance, CUR.GS.freeVector.y ), +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /* only adjust legacy fonts x otherwise breaks Calibri italic */ + if ( CUR.compatibility_mode ) +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + CUR.zp0.org[point].x = TT_MulFix14( (FT_UInt32)distance, + CUR.GS.freeVector.x ); + CUR.zp0.org[point].y = TT_MulFix14( (FT_UInt32)distance, + CUR.GS.freeVector.y ), CUR.zp0.cur[point] = CUR.zp0.org[point]; } +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( ( CUR.sph_tweak_flags & SPH_TWEAK_MIAP_HACK ) && + distance > 0 && + CUR.GS.freeVector.y != 0 ) + distance = 0; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ org_dist = CUR_fast_project( &CUR.zp0.cur[point] ); - if ( ( CUR.opcode & 1 ) != 0 ) /* rounding and control cutin flag */ + if ( ( CUR.opcode & 1 ) != 0 ) /* rounding and control cut-in flag */ { - if ( FT_ABS( distance - org_dist ) > CUR.GS.control_value_cutin ) + if ( FT_ABS( distance - org_dist ) > control_value_cutin ) distance = org_dist; - distance = CUR_Func_round( distance, CUR.tt_metrics.compensations[0] ); +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode && + CUR.GS.freeVector.x != 0 ) + distance = ROUND_None( distance, + CUR.tt_metrics.compensations[0] ); + else +#endif + distance = CUR_Func_round( distance, + CUR.tt_metrics.compensations[0] ); } CUR_Func_move( &CUR.zp0, point, distance - org_dist ); + Fail: CUR.GS.rp0 = point; CUR.GS.rp1 = point; } @@ -6057,9 +6331,19 @@ Ins_MDRP( INS_ARG ) { FT_UShort point; - FT_F26Dot6 org_dist, distance; + FT_F26Dot6 org_dist, distance, minimum_distance; + minimum_distance = CUR.GS.minimum_distance; + +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( 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 ) || @@ -6067,7 +6351,7 @@ { if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; - return; + goto Fail; } /* XXX: Is there some undocumented feature while in the */ @@ -6093,15 +6377,15 @@ { /* this should be faster */ org_dist = CUR_Func_dualproj( vec1, vec2 ); - org_dist = TT_MULFIX( org_dist, CUR.metrics.x_scale ); + org_dist = FT_MulFix( org_dist, CUR.metrics.x_scale ); } else { FT_Vector vec; - vec.x = TT_MULFIX( vec1->x - vec2->x, CUR.metrics.x_scale ); - vec.y = TT_MULFIX( vec1->y - vec2->y, CUR.metrics.y_scale ); + vec.x = FT_MulFix( vec1->x - vec2->x, CUR.metrics.x_scale ); + vec.y = FT_MulFix( vec1->y - vec2->y, CUR.metrics.y_scale ); org_dist = CUR_fast_dualproj( &vec ); } @@ -6121,9 +6405,18 @@ /* round flag */ if ( ( CUR.opcode & 4 ) != 0 ) + { +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode && CUR.GS.freeVector.x != 0 ) + distance = ROUND_None( + org_dist, + CUR.tt_metrics.compensations[CUR.opcode & 3] ); + else +#endif distance = CUR_Func_round( org_dist, CUR.tt_metrics.compensations[CUR.opcode & 3] ); + } else distance = ROUND_None( org_dist, @@ -6135,13 +6428,13 @@ { if ( org_dist >= 0 ) { - if ( distance < CUR.GS.minimum_distance ) - distance = CUR.GS.minimum_distance; + if ( distance < minimum_distance ) + distance = minimum_distance; } else { - if ( distance > -CUR.GS.minimum_distance ) - distance = -CUR.GS.minimum_distance; + if ( distance > -minimum_distance ) + distance = -minimum_distance; } } @@ -6152,6 +6445,7 @@ CUR_Func_move( &CUR.zp1, point, distance - org_dist ); + Fail: CUR.GS.rp1 = CUR.GS.rp0; CUR.GS.rp2 = point; @@ -6175,12 +6469,28 @@ FT_F26Dot6 cvt_dist, distance, cur_dist, - org_dist; + org_dist, + control_value_cutin, + minimum_distance; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + FT_Int B1; + FT_Int B2; + FT_Bool reverse_move = FALSE; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ - point = (FT_UShort)args[0]; - cvtEntry = (FT_ULong)( args[1] + 1 ); + minimum_distance = CUR.GS.minimum_distance; + control_value_cutin = CUR.GS.control_value_cutin; + point = (FT_UShort)args[0]; + cvtEntry = (FT_ULong)( args[1] + 1 ); +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode && + CUR.GS.freeVector.x != 0 && + !( CUR.sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) + control_value_cutin = minimum_distance = 0; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + /* XXX: UNDOCUMENTED! cvt[-1] = 0 always */ if ( BOUNDS( point, CUR.zp1.n_points ) || @@ -6189,13 +6499,17 @@ { if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; - return; + goto Fail; } if ( !cvtEntry ) 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 */ @@ -6208,19 +6522,17 @@ cvt_dist = -CUR.GS.single_width_value; } - /* XXX: UNDOCUMENTED! -- twilight zone */ - + /* UNDOCUMENTED! The MS rasterizer does that with */ + /* twilight points (confirmed by Greg Hitchcock) */ if ( CUR.GS.gep1 == 0 ) { CUR.zp1.org[point].x = CUR.zp0.org[CUR.GS.rp0].x + TT_MulFix14( (FT_UInt32)cvt_dist, CUR.GS.freeVector.x ); - CUR.zp1.org[point].y = CUR.zp0.org[CUR.GS.rp0].y + TT_MulFix14( (FT_UInt32)cvt_dist, CUR.GS.freeVector.y ); - - CUR.zp1.cur[point] = CUR.zp0.cur[point]; + CUR.zp1.cur[point] = CUR.zp1.org[point]; } org_dist = CUR_Func_dualproj( &CUR.zp1.org[point], @@ -6235,17 +6547,40 @@ if ( ( org_dist ^ cvt_dist ) < 0 ) cvt_dist = -cvt_dist; } +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.GS.freeVector.y != 0 && + ( CUR.sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) ) + { + if ( cur_dist < -64 ) + cvt_dist -= 16; + else if ( cur_dist > 64 && cur_dist < 84 ) + cvt_dist += 32; + } +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + /* control value cut-in and round */ - /* control value cutin and round */ - if ( ( CUR.opcode & 4 ) != 0 ) { /* XXX: UNDOCUMENTED! Only perform cut-in test when both points */ /* refer to the same zone. */ if ( CUR.GS.gep0 == CUR.GS.gep1 ) - if ( FT_ABS( cvt_dist - org_dist ) >= CUR.GS.control_value_cutin ) + { + /* XXX: According to Greg Hitchcock, the following wording is */ + /* the right one: */ + /* */ + /* When the absolute difference between the value in */ + /* the table [CVT] and the measurement directly from */ + /* the outline is _greater_ than the cut_in value, the */ + /* outline measurement is used. */ + /* */ + /* This is from `instgly.doc'. The description in */ + /* `ttinst2.doc', version 1.66, is thus incorrect since */ + /* it implies `>=' instead of `>'. */ + + if ( FT_ABS( cvt_dist - org_dist ) > control_value_cutin ) cvt_dist = org_dist; + } distance = CUR_Func_round( cvt_dist, @@ -6262,24 +6597,71 @@ { if ( org_dist >= 0 ) { - if ( distance < CUR.GS.minimum_distance ) - distance = CUR.GS.minimum_distance; + if ( distance < minimum_distance ) + distance = minimum_distance; } else { - if ( distance > -CUR.GS.minimum_distance ) - distance = -CUR.GS.minimum_distance; + if ( distance > -minimum_distance ) + distance = -minimum_distance; } } +#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; +#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 ( ( 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; + + 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; + + 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 ) ); + +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + Fail: CUR.GS.rp1 = CUR.GS.rp0; if ( ( CUR.opcode & 16 ) != 0 ) CUR.GS.rp0 = point; - /* XXX: UNDOCUMENTED! */ CUR.GS.rp2 = point; } @@ -6299,12 +6681,22 @@ FT_UNUSED_ARG; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode && + CUR.iup_called && + ( CUR.sph_tweak_flags & SPH_TWEAK_NO_ALIGNRP_AFTER_IUP ) ) + { + CUR.error = TT_Err_Invalid_Reference; + goto Fail; + } +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + if ( CUR.top < CUR.GS.loop || BOUNDS( CUR.GS.rp0, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; - return; + goto Fail; } while ( CUR.GS.loop > 0 ) @@ -6332,6 +6724,7 @@ CUR.GS.loop--; } + Fail: CUR.GS.loop = 1; CUR.new_top = CUR.args; } @@ -6350,7 +6743,7 @@ a0, a1, b0, b1; - FT_F26Dot6 discriminant; + FT_F26Dot6 discriminant, dotproduct; FT_F26Dot6 dx, dy, dax, day, @@ -6379,6 +6772,8 @@ return; } + /* Cramer's rule */ + dbx = CUR.zp0.cur[b1].x - CUR.zp0.cur[b0].x; dby = CUR.zp0.cur[b1].y - CUR.zp0.cur[b0].y; @@ -6390,15 +6785,25 @@ CUR.zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH; - discriminant = TT_MULDIV( dax, -dby, 0x40 ) + - TT_MULDIV( day, dbx, 0x40 ); + discriminant = FT_MulDiv( dax, -dby, 0x40 ) + + FT_MulDiv( day, dbx, 0x40 ); + dotproduct = FT_MulDiv( dax, dbx, 0x40 ) + + FT_MulDiv( day, dby, 0x40 ); - if ( FT_ABS( discriminant ) >= 0x40 ) + /* The discriminant above is actually a cross product of vectors */ + /* da and db. Together with the dot product, they can be used as */ + /* surrogates for sine and cosine of the angle between the vectors. */ + /* Indeed, */ + /* dotproduct = |da||db|cos(angle) */ + /* discriminant = |da||db|sin(angle) . */ + /* We use these equations to reject grazing intersections by */ + /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */ + if ( 19 * FT_ABS( discriminant ) > FT_ABS( dotproduct ) ) { - val = TT_MULDIV( dx, -dby, 0x40 ) + TT_MULDIV( dy, dbx, 0x40 ); + val = FT_MulDiv( dx, -dby, 0x40 ) + FT_MulDiv( dy, dbx, 0x40 ); - R.x = TT_MULDIV( val, dax, discriminant ); - R.y = TT_MULDIV( val, day, discriminant ); + R.x = FT_MulDiv( val, dax, discriminant ); + R.y = FT_MulDiv( val, day, discriminant ); CUR.zp2.cur[point].x = CUR.zp1.cur[a0].x + R.x; CUR.zp2.cur[point].y = CUR.zp1.cur[a0].y + R.y; @@ -6473,8 +6878,9 @@ if ( CUR.top < CUR.GS.loop ) { - CUR.error = TT_Err_Invalid_Reference; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Invalid_Reference; + goto Fail; } /* @@ -6488,7 +6894,7 @@ { if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; - return; + goto Fail; } if ( twilight ) @@ -6513,10 +6919,22 @@ if ( twilight ) old_range = CUR_Func_dualproj( &CUR.zp1.org[CUR.GS.rp2], orus_base ); - else + else if ( CUR.metrics.x_scale == CUR.metrics.y_scale ) old_range = CUR_Func_dualproj( &CUR.zp1.orus[CUR.GS.rp2], orus_base ); + else + { + FT_Vector vec; + + vec.x = FT_MulFix( CUR.zp1.orus[CUR.GS.rp2].x - orus_base->x, + CUR.metrics.x_scale ); + vec.y = FT_MulFix( CUR.zp1.orus[CUR.GS.rp2].y - orus_base->y, + CUR.metrics.y_scale ); + + old_range = CUR_fast_dualproj( &vec ); + } + cur_range = CUR_Func_project ( &CUR.zp1.cur[CUR.GS.rp2], cur_base ); } @@ -6539,20 +6957,34 @@ if ( twilight ) org_dist = CUR_Func_dualproj( &CUR.zp2.org[point], orus_base ); + else if ( CUR.metrics.x_scale == CUR.metrics.y_scale ) + org_dist = CUR_Func_dualproj( &CUR.zp2.orus[point], orus_base ); else - org_dist = CUR_Func_dualproj( &CUR.zp2.orus[point], orus_base ); + { + FT_Vector vec; + + vec.x = FT_MulFix( CUR.zp2.orus[point].x - orus_base->x, + CUR.metrics.x_scale ); + vec.y = FT_MulFix( CUR.zp2.orus[point].y - orus_base->y, + CUR.metrics.y_scale ); + + org_dist = CUR_fast_dualproj( &vec ); + } + cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base ); if ( org_dist ) new_dist = ( old_range != 0 ) - ? TT_MULDIV( org_dist, cur_range, old_range ) + ? FT_MulDiv( org_dist, cur_range, old_range ) : cur_dist; else new_dist = 0; CUR_Func_move( &CUR.zp2, (FT_UShort)point, new_dist - cur_dist ); } + + Fail: CUR.GS.loop = 1; CUR.new_top = CUR.args; } @@ -6705,12 +7137,12 @@ if ( !scale_valid ) { scale_valid = 1; - scale = TT_MULDIV( org2 + delta2 - ( org1 + delta1 ), - 0x10000L, orus2 - orus1 ); + scale = FT_DivFix( org2 + delta2 - ( org1 + delta1 ), + orus2 - orus1 ); } x = ( org1 + delta1 ) + - TT_MULFIX( worker->orus[i].x - orus1, scale ); + FT_MulFix( worker->orus[i].x - orus1, scale ); } worker->curs[i].x = x; } @@ -6765,6 +7197,15 @@ contour = 0; point = 0; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode ) + { + CUR.iup_called = 1; + if ( CUR.sph_tweak_flags & SPH_TWEAK_SKIP_IUP ) + return; + } +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + do { end_point = CUR.pts.contours[contour] - CUR.pts.first_point; @@ -6834,6 +7275,9 @@ FT_UShort A; FT_ULong C; FT_Long B; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + FT_UShort B1, B2; +#endif #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING @@ -6845,8 +7289,9 @@ if ( CUR.args < n ) { - CUR.error = TT_Err_Too_Few_Arguments; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Too_Few_Arguments; + n = CUR.args; } CUR.args -= n; @@ -6862,8 +7307,10 @@ { if ( CUR.args < 2 ) { - CUR.error = TT_Err_Too_Few_Arguments; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Too_Few_Arguments; + CUR.args = 0; + goto Fail; } CUR.args -= 2; @@ -6904,7 +7351,69 @@ B++; 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 ( 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 ) + 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 ) ) + { + /* 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 ) ) + 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.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 ); + } +#else CUR_Func_move( &CUR.zp0, A, B ); +#endif /* *TT_CONFIG_OPTION_SUBPIXEL_HINTING */ } } else @@ -6912,6 +7421,7 @@ CUR.error = TT_Err_Invalid_Reference; } + Fail: CUR.new_top = CUR.args; } @@ -6939,8 +7449,9 @@ if ( CUR.args < n ) { - CUR.error = TT_Err_Too_Few_Arguments; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Too_Few_Arguments; + n = CUR.args; } CUR.args -= n; @@ -6955,8 +7466,10 @@ { if ( CUR.args < 2 ) { - CUR.error = TT_Err_Too_Few_Arguments; - return; + if ( CUR.pedantic_hinting ) + CUR.error = TT_Err_Too_Few_Arguments; + CUR.args = 0; + goto Fail; } CUR.args -= 2; @@ -7004,6 +7517,7 @@ } } + Fail: CUR.new_top = CUR.args; } @@ -7029,22 +7543,113 @@ K = 0; - /* We return MS rasterizer version 1.7 for the font scaler. */ - if ( ( args[0] & 1 ) != 0 ) - K = 35; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /********************************/ + /* RASTERIZER VERSION */ + /* Selector Bit: 0 */ + /* Return Bit(s): 0-7 */ + /* */ + if ( ( 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 + } + else +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + if ( ( args[0] & 1 ) != 0 ) + K = 35; - /* Has the glyph been rotated? */ + /********************************/ + /* GLYPH ROTATED */ + /* Selector Bit: 1 */ + /* Return Bit(s): 8 */ + /* */ if ( ( args[0] & 2 ) != 0 && CUR.tt_metrics.rotated ) K |= 0x80; - /* Has the glyph been stretched? */ + /********************************/ + /* GLYPH STRETCHED */ + /* Selector Bit: 2 */ + /* Return Bit(s): 9 */ + /* */ if ( ( args[0] & 4 ) != 0 && CUR.tt_metrics.stretched ) K |= 1 << 8; - /* Are we hinting for grayscale? */ + /********************************/ + /* HINTING FOR GRAYSCALE */ + /* Selector Bit: 5 */ + /* Return Bit(s): 12 */ + /* */ if ( ( args[0] & 32 ) != 0 && CUR.grayscale ) K |= 1 << 12; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode && CUR.rasterizer_version >= 35 ) + { + /********************************/ + /* HINTING FOR GRAYSCALE */ + /* Selector Bit: 5 */ + /* Return Bit(s): 12 */ + /* */ + if ( ( args[0] & 32 ) != 0 && CUR.grayscale_hinting ) + K |= 1 << 12; + + /********************************/ + /* HINTING FOR SUBPIXEL */ + /* Selector Bit: 6 */ + /* Return Bit(s): 13 */ + /* */ + if ( ( args[0] & 64 ) != 0 && + CUR.subpixel_hinting && + CUR.rasterizer_version >= 37 ) + { + K |= 1 << 13; + + /* the stuff below is irrelevant if subpixel_hinting is not set */ + + /********************************/ + /* COMPATIBLE WIDTHS ENABLED */ + /* Selector Bit: 7 */ + /* Return Bit(s): 14 */ + /* */ + /* Functionality still needs to be added */ + if ( ( args[0] & 128 ) != 0 && CUR.compatible_widths ) + K |= 1 << 14; + + /********************************/ + /* SYMMETRICAL SMOOTHING */ + /* Selector Bit: 8 */ + /* Return Bit(s): 15 */ + /* */ + /* Functionality still needs to be added */ + if ( ( args[0] & 256 ) != 0 && CUR.symmetrical_smoothing ) + K |= 1 << 15; + + /********************************/ + /* HINTING FOR BGR? */ + /* Selector Bit: 9 */ + /* Return Bit(s): 16 */ + /* */ + /* Functionality still needs to be added */ + if ( ( args[0] & 512 ) != 0 && CUR.bgr ) + K |= 1 << 16; + + if ( CUR.rasterizer_version >= 38 ) + { + /********************************/ + /* SUBPIXEL POSITIONED? */ + /* Selector Bit: 10 */ + /* Return Bit(s): 17 */ + /* */ + /* Functionality still needs to be added */ + if ( ( args[0] & 1024 ) != 0 && CUR.subpixel_positioned ) + K |= 1 << 17; + } + } + } +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ args[0] = K; } @@ -7077,6 +7682,7 @@ call->Caller_IP = CUR.IP + 1; call->Cur_Count = 1; call->Cur_Restart = def->start; + call->Cur_End = def->end; INS_Goto_CodeRange( def->range, def->start ); @@ -7419,6 +8025,11 @@ cur = *exc; #endif +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + if ( CUR.ignore_x_mode ) + CUR.iup_called = FALSE; +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + /* set CVT functions */ CUR.tt_metrics.ratio = 0; if ( CUR.metrics.x_ppem != CUR.metrics.y_ppem ) @@ -7449,7 +8060,7 @@ if ( ( CUR.length = opcode_length[CUR.opcode] ) < 0 ) { - if ( CUR.IP + 1 > CUR.codeSize ) + if ( CUR.IP + 1 >= CUR.codeSize ) goto LErrorCodeOverflow_; CUR.length = 2 - CUR.length * CUR.code[CUR.IP + 1]; @@ -7465,8 +8076,19 @@ /* One can also interpret it as the index of the last argument. */ if ( CUR.args < 0 ) { - CUR.error = TT_Err_Too_Few_Arguments; - goto LErrorLabel_; + FT_UShort i; + + + if ( CUR.pedantic_hinting ) + { + CUR.error = TT_Err_Too_Few_Arguments; + goto LErrorLabel_; + } + + /* push zeroes onto the stack */ + for ( i = 0; i < Pop_Push_Count[CUR.opcode] >> 4; i++ ) + CUR.stack[i] = 0; + CUR.args = 0; } CUR.new_top = CUR.args + ( Pop_Push_Count[CUR.opcode] & 15 ); @@ -7503,7 +8125,7 @@ case 0x04: /* SFvTCA y */ case 0x05: /* SFvTCA x */ { - FT_Short AA, BB; + FT_Short AA, BB; AA = (FT_Short)( ( opcode & 1 ) << 14 ); @@ -7679,7 +8301,13 @@ break; case 0x2B: /* CALL */ - Ins_CALL( EXEC_ARG_ args ); +#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 ); break; case 0x2C: /* FDEF */ @@ -7695,10 +8323,13 @@ Ins_MDAP( EXEC_ARG_ args ); break; - case 0x30: /* IUP */ case 0x31: /* IUP */ - Ins_IUP( EXEC_ARG_ args ); +#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 ); break; case 0x32: /* SHP */ @@ -7857,7 +8488,13 @@ break; case 0x5D: /* DELTAP1 */ - Ins_DELTAP( EXEC_ARG_ args ); +#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 ); break; case 0x5E: /* SDB */ @@ -8074,6 +8711,7 @@ callrec->Caller_IP = CUR.IP + 1; callrec->Cur_Count = 1; callrec->Cur_Restart = def->start; + callrec->Cur_End = def->end; if ( INS_Goto_CodeRange( def->range, def->start ) == FAILURE ) goto LErrorLabel_; @@ -8147,7 +8785,7 @@ if ( CUR.error && !CUR.instruction_trap ) { FT_TRACE1(( " The interpreter returned error 0x%x\n", CUR.error )); - exc->size->cvt_ready = FALSE; + exc->size->cvt_ready = FALSE; } return CUR.error; Index: src/truetype/ttinterp.h =================================================================== --- src/truetype/ttinterp.h (revision 58178) +++ src/truetype/ttinterp.h (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueType bytecode interpreter (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 by */ +/* Copyright 1996-2007, 2010, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -102,12 +102,55 @@ FT_Long Caller_IP; FT_Long Cur_Count; FT_Long Cur_Restart; + FT_Long Cur_End; } TT_CallRec, *TT_CallStack; +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + /*************************************************************************/ /* */ + /* These structures define rules used to tweak subpixel hinting for */ + /* various fonts. "", 0, "", NULL value indicates to match any value. */ + /* */ + +#define MAX_NAME_SIZE 32 +#define MAX_CLASS_MEMBERS 100 + + typedef struct SPH_TweakRule_ + { + const char family[MAX_NAME_SIZE]; + const FT_UInt ppem; + const char style[MAX_NAME_SIZE]; + const FT_ULong glyph; + + } SPH_TweakRule; + + + typedef struct SPH_ScaleRule_ + { + const char family[MAX_NAME_SIZE]; + const FT_UInt ppem; + const char style[MAX_NAME_SIZE]; + const FT_ULong glyph; + const FT_ULong scale; + + } SPH_ScaleRule; + + + typedef struct Font_Class_ + { + const char name[MAX_NAME_SIZE]; + const char member[MAX_CLASS_MEMBERS][MAX_NAME_SIZE]; + + } Font_Class; + +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + + /*************************************************************************/ + /* */ /* The main structure for the interpreter which collects all necessary */ /* variables and states. */ /* */ @@ -217,12 +260,43 @@ FT_Bool grayscale; /* are we hinting for grayscale? */ +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + TT_Round_Func func_round_sphn; /* subpixel rounding function */ + + FT_Bool grayscale_hinting; /* Using grayscale hinting? */ + FT_Bool subpixel_hinting; /* Using subpixel hinting? */ + FT_Bool native_hinting; /* Using native hinting? */ + 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. */ + FT_Bool compatible_widths; /* compatible widths? */ + FT_Bool symmetrical_smoothing; /* symmetrical_smoothing? */ + FT_Bool bgr; /* bgr instead of rgb? */ + FT_Bool subpixel_positioned; /* subpixel positioned */ + /* (DirectWrite ClearType)? */ + + FT_Int rasterizer_version; /* MS rasterizer version */ + + FT_Bool iup_called; /* IUP called for glyph? */ + + FT_ULong sph_tweak_flags; /* flags to control */ + /* hint tweaks */ +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + } TT_ExecContextRec; extern const TT_GraphicsState tt_default_graphics_state; +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER FT_LOCAL( FT_Error ) TT_Goto_CodeRange( TT_ExecContext exec, FT_Int range, @@ -245,6 +319,7 @@ FT_Long multiplier, void* _pbuff, FT_ULong new_max ); +#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ /*************************************************************************/ @@ -269,6 +344,8 @@ FT_EXPORT( TT_ExecContext ) TT_New_Context( TT_Driver driver ); + +#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER FT_LOCAL( FT_Error ) TT_Done_Context( TT_ExecContext exec ); @@ -284,6 +361,7 @@ FT_LOCAL( FT_Error ) TT_Run_Context( TT_ExecContext exec, FT_Bool debug ); +#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ /*************************************************************************/ Index: src/truetype/ttobjs.c =================================================================== --- src/truetype/ttobjs.c (revision 58178) +++ src/truetype/ttobjs.c (working copy) @@ -4,8 +4,7 @@ /* */ /* Objects manager (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -214,16 +213,18 @@ tt_get_sfnt_checksum( TT_Face face, FT_UShort i ) { +#if 0 /* if we believe the written value, use following part. */ if ( face->dir_tables[i].CheckSum ) return face->dir_tables[i].CheckSum; +#endif - else if ( !face->goto_table ) + if ( !face->goto_table ) return 0; - else if ( !face->goto_table( face, - face->dir_tables[i].Tag, - face->root.stream, - NULL ) ) + if ( face->goto_table( face, + face->dir_tables[i].Tag, + face->root.stream, + NULL ) ) return 0; return (FT_ULong)tt_synth_sfnt_checksum( face->root.stream, @@ -243,7 +244,7 @@ tt_check_trickyness_sfnt_ids( TT_Face face ) { #define TRICK_SFNT_IDS_PER_FACE 3 -#define TRICK_SFNT_IDS_NUM_FACES 5 +#define TRICK_SFNT_IDS_NUM_FACES 17 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] [TRICK_SFNT_IDS_PER_FACE] = { @@ -276,16 +277,81 @@ { 0xfffbfffc, 0x00000008 }, /* cvt */ { 0x0a5a0483, 0x00017c39 }, /* fpgm */ { 0x70020112, 0x00000008 } /* prep */ + }, + { /* NEC fadpop7.ttf */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x40c92555, 0x000000e5 }, /* fpgm */ + { 0xa39b58e3, 0x0000117c } /* prep */ + }, + { /* NEC fadrei5.ttf */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x33c41652, 0x000000e5 }, /* fpgm */ + { 0x26d6c52a, 0x00000f6a } /* prep */ + }, + { /* NEC fangot7.ttf */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x6db1651d, 0x0000019d }, /* fpgm */ + { 0x6c6e4b03, 0x00002492 } /* prep */ + }, + { /* NEC fangyo5.ttf */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x40c92555, 0x000000e5 }, /* fpgm */ + { 0xde51fad0, 0x0000117c } /* prep */ + }, + { /* NEC fankyo5.ttf */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x85e47664, 0x000000e5 }, /* fpgm */ + { 0xa6c62831, 0x00001caa } /* prep */ + }, + { /* NEC fanrgo5.ttf */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x2d891cfd, 0x0000019d }, /* fpgm */ + { 0xa0604633, 0x00001de8 } /* prep */ + }, + { /* NEC fangot5.ttc */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x40aa774c, 0x000001cb }, /* fpgm */ + { 0x9b5caa96, 0x00001f9a } /* prep */ + }, + { /* NEC fanmin3.ttc */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x0d3de9cb, 0x00000141 }, /* fpgm */ + { 0xd4127766, 0x00002280 } /* prep */ + }, + { /* NEC FA-Gothic, 1996 */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x4a692698, 0x000001f0 }, /* fpgm */ + { 0x340d4346, 0x00001fca } /* prep */ + }, + { /* NEC FA-Minchou, 1996 */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0xcd34c604, 0x00000166 }, /* fpgm */ + { 0x6cf31046, 0x000022b0 } /* prep */ + }, + { /* NEC FA-RoundGothicB, 1996 */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0x5da75315, 0x0000019d }, /* fpgm */ + { 0x40745a5f, 0x000022e0 } /* prep */ + }, + { /* NEC FA-RoundGothicM, 1996 */ + { 0x00000000, 0x00000000 }, /* cvt */ + { 0xf055fc48, 0x000001c2 }, /* fpgm */ + { 0x3900ded3, 0x00001e18 } /* prep */ } }; - FT_ULong checksum; - int num_matched_ids[TRICK_SFNT_IDS_NUM_FACES]; - int i, j, k; + FT_ULong checksum; + int num_matched_ids[TRICK_SFNT_IDS_NUM_FACES]; + FT_Bool has_cvt, has_fpgm, has_prep; + FT_UShort i; + int j, k; FT_MEM_SET( num_matched_ids, 0, - sizeof( int ) * TRICK_SFNT_IDS_NUM_FACES ); + sizeof ( int ) * TRICK_SFNT_IDS_NUM_FACES ); + has_cvt = FALSE; + has_fpgm = FALSE; + has_prep = FALSE; for ( i = 0; i < face->num_tables; i++ ) { @@ -295,14 +361,17 @@ { case TTAG_cvt: k = TRICK_SFNT_ID_cvt; + has_cvt = TRUE; break; case TTAG_fpgm: k = TRICK_SFNT_ID_fpgm; + has_fpgm = TRUE; break; case TTAG_prep: k = TRICK_SFNT_ID_prep; + has_prep = TRUE; break; default: @@ -323,6 +392,18 @@ } } + for ( j = 0; j < TRICK_SFNT_IDS_NUM_FACES; j++ ) + { + if ( !has_cvt && !sfnt_id[j][TRICK_SFNT_ID_cvt].Length ) + num_matched_ids[j] ++; + if ( !has_fpgm && !sfnt_id[j][TRICK_SFNT_ID_fpgm].Length ) + num_matched_ids[j] ++; + if ( !has_prep && !sfnt_id[j][TRICK_SFNT_ID_prep].Length ) + num_matched_ids[j] ++; + if ( num_matched_ids[j] == TRICK_SFNT_IDS_PER_FACE ) + return TRUE; + } + return FALSE; } @@ -333,14 +414,10 @@ if ( !face ) return FALSE; - /* First, check the face name. */ - if ( face->family_name ) - { - if ( tt_check_trickyness_family( face->family_name ) ) - return TRUE; - else - return FALSE; - } + /* For first, check the face name for quick check. */ + if ( face->family_name && + tt_check_trickyness_family( face->family_name ) ) + return TRUE; /* Type42 fonts may lack `name' tables, we thus try to identify */ /* tricky fonts by checking the checksums of Type42-persistent */ @@ -352,6 +429,54 @@ } + /* Check whether `.notdef' is the only glyph in the `loca' table. */ + static FT_Bool + tt_check_single_notdef( FT_Face ttface ) + { + FT_Bool result = FALSE; + + TT_Face face = (TT_Face)ttface; + FT_UInt asize; + FT_ULong i; + FT_ULong glyph_index = 0; + FT_UInt count = 0; + + + for( i = 0; i < face->num_locations; i++ ) + { + tt_face_get_location( face, i, &asize ); + if ( asize > 0 ) + { + count += 1; + if ( count > 1 ) + break; + glyph_index = i; + } + } + + /* Only have a single outline. */ + if ( count == 1 ) + { + if ( glyph_index == 0 ) + result = TRUE; + else + { + /* FIXME: Need to test glyphname == .notdef ? */ + FT_Error error; + char buf[8]; + + + error = FT_Get_Glyph_Name( ttface, glyph_index, buf, 8 ); + if ( !error && + buf[0] == '.' && !ft_strncmp( buf, ".notdef", 8 ) ) + result = TRUE; + } + } + + return result; + } + + /*************************************************************************/ /* */ /* <Function> */ @@ -388,10 +513,17 @@ TT_Face face = (TT_Face)ttface; + FT_TRACE2(( "TTF driver\n" )); + library = ttface->driver->root.library; - sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); + + sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) - goto Bad_Format; + { + FT_ERROR(( "tt_face_init: cannot access `sfnt' module\n" )); + error = TT_Err_Missing_Module; + goto Exit; + } /* create input stream from resource */ if ( FT_STREAM_SEEK( 0 ) ) @@ -409,7 +541,7 @@ face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ face->format_tag != TTAG_true ) /* Mac fonts */ { - FT_TRACE2(( "[not a valid TTF font]\n" )); + FT_TRACE2(( " not a TTF font\n" )); goto Bad_Format; } @@ -447,6 +579,20 @@ if ( !error ) error = tt_face_load_prep( face, stream ); + /* Check the scalable flag based on `loca'. */ + if ( !ttface->internal->incremental_interface && + ttface->num_fixed_sizes && + face->glyph_locations && + tt_check_single_notdef( ttface ) ) + { + FT_TRACE5(( "tt_face_init:" + " Only the `.notdef' glyph has an outline.\n" + " " + " Resetting scalable flag to FALSE.\n" )); + + ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE; + } + #else if ( !error ) @@ -458,6 +604,19 @@ if ( !error ) error = tt_face_load_prep( face, stream ); + /* Check the scalable flag based on `loca'. */ + if ( ttface->num_fixed_sizes && + face->glyph_locations && + tt_check_single_notdef( ttface ) ) + { + FT_TRACE5(( "tt_face_init:" + " Only the `.notdef' glyph has an outline.\n" + " " + " Resetting scalable flag to FALSE.\n" )); + + ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE; + } + #endif } @@ -570,13 +729,16 @@ /* Run the font program. */ /* */ /* <Input> */ - /* size :: A handle to the size object. */ + /* size :: A handle to the size object. */ /* */ + /* pedantic :: Set if bytecode execution should be pedantic. */ + /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - tt_size_run_fpgm( TT_Size size ) + tt_size_run_fpgm( TT_Size size, + FT_Bool pedantic ) { TT_Face face = (TT_Face)size->root.face; TT_ExecContext exec; @@ -594,16 +756,18 @@ TT_Load_Context( exec, face, size ); - exec->callTop = 0; - exec->top = 0; + exec->callTop = 0; + exec->top = 0; exec->period = 64; exec->phase = 0; exec->threshold = 0; exec->instruction_trap = FALSE; - exec->F_dot_P = 0x10000L; + exec->F_dot_P = 0x4000L; + exec->pedantic_hinting = pedantic; + { FT_Size_Metrics* metrics = &exec->metrics; TT_Size_Metrics* tt_metrics = &exec->tt_metrics; @@ -659,13 +823,16 @@ /* Run the control value program. */ /* */ /* <Input> */ - /* size :: A handle to the size object. */ + /* size :: A handle to the size object. */ /* */ + /* pedantic :: Set if bytecode execution should be pedantic. */ + /* */ /* <Return> */ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - tt_size_run_prep( TT_Size size ) + tt_size_run_prep( TT_Size size, + FT_Bool pedantic ) { TT_Face face = (TT_Face)size->root.face; TT_ExecContext exec; @@ -688,6 +855,8 @@ exec->instruction_trap = FALSE; + exec->pedantic_hinting = pedantic; + TT_Set_CodeRange( exec, tt_coderange_cvt, face->cvt_program, @@ -766,7 +935,8 @@ /* Initialize bytecode-related fields in the size object. */ /* We do this only if bytecode interpretation is really needed. */ static FT_Error - tt_size_init_bytecode( FT_Size ftsize ) + tt_size_init_bytecode( FT_Size ftsize, + FT_Bool pedantic ) { FT_Error error; TT_Size size = (TT_Size)ftsize; @@ -839,7 +1009,7 @@ } /* Fine, now run the font program! */ - error = tt_size_run_fpgm( size ); + error = tt_size_run_fpgm( size, pedantic ); Exit: if ( error ) @@ -850,14 +1020,15 @@ FT_LOCAL_DEF( FT_Error ) - tt_size_ready_bytecode( TT_Size size ) + tt_size_ready_bytecode( TT_Size size, + FT_Bool pedantic ) { FT_Error error = TT_Err_Ok; if ( !size->bytecode_ready ) { - error = tt_size_init_bytecode( (FT_Size)size ); + error = tt_size_init_bytecode( (FT_Size)size, pedantic ); if ( error ) goto Exit; } @@ -889,7 +1060,7 @@ size->GS = tt_default_graphics_state; - error = tt_size_run_prep( size ); + error = tt_size_run_prep( size, pedantic ); if ( !error ) size->cvt_ready = 1; } @@ -1019,16 +1190,14 @@ size->ttmetrics.scale = metrics->x_scale; size->ttmetrics.ppem = metrics->x_ppem; size->ttmetrics.x_ratio = 0x10000L; - size->ttmetrics.y_ratio = FT_MulDiv( metrics->y_ppem, - 0x10000L, + size->ttmetrics.y_ratio = FT_DivFix( metrics->y_ppem, metrics->x_ppem ); } else { size->ttmetrics.scale = metrics->y_scale; size->ttmetrics.ppem = metrics->y_ppem; - size->ttmetrics.x_ratio = FT_MulDiv( metrics->x_ppem, - 0x10000L, + size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem, metrics->y_ppem ); size->ttmetrics.y_ratio = 0x10000L; } Index: src/truetype/ttobjs.h =================================================================== --- src/truetype/ttobjs.h (revision 58178) +++ src/truetype/ttobjs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Objects manager (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 1996-2009, 2011-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -173,10 +173,12 @@ /* */ typedef struct TT_DefRecord_ { - FT_Int range; /* in which code range is it located? */ - FT_Long start; /* where does it start? */ - FT_UInt opc; /* function #, or instruction code */ - FT_Bool active; /* is it active? */ + 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? */ } TT_DefRecord, *TT_DefArray; @@ -189,7 +191,7 @@ { FT_Fixed xx, xy; /* transformation matrix coefficients */ FT_Fixed yx, yy; - FT_F26Dot6 ox, oy; /* offsets */ + FT_F26Dot6 ox, oy; /* offsets */ } TT_Transform; @@ -332,6 +334,7 @@ FT_Bool bytecode_ready; FT_Bool cvt_ready; + FT_Bool ttfautohinted; #endif /* TT_USE_BYTECODE_INTERPRETER */ @@ -390,13 +393,16 @@ #ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( FT_Error ) - tt_size_run_fpgm( TT_Size size ); + tt_size_run_fpgm( TT_Size size, + FT_Bool pedantic ); FT_LOCAL( FT_Error ) - tt_size_run_prep( TT_Size size ); + tt_size_run_prep( TT_Size size, + FT_Bool pedantic ); FT_LOCAL( FT_Error ) - tt_size_ready_bytecode( TT_Size size ); + tt_size_ready_bytecode( TT_Size size, + FT_Bool pedantic ); #endif /* TT_USE_BYTECODE_INTERPRETER */ @@ -423,6 +429,10 @@ tt_slot_init( FT_GlyphSlot slot ); + /* auxiliary */ +#define IS_HINTED( flags ) ( ( flags & FT_LOAD_NO_HINTING ) == 0 ) + + FT_END_HEADER #endif /* __TTOBJS_H__ */ Index: src/truetype/ttpic.c =================================================================== --- src/truetype/ttpic.c (revision 58178) +++ src/truetype/ttpic.c (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009, 2010 by */ +/* Copyright 2009, 2010, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,25 +20,42 @@ #include FT_FREETYPE_H #include FT_INTERNAL_OBJECTS_H #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, FT_ServiceDescRec**); - void FT_Destroy_Class_tt_services( FT_Library, FT_ServiceDescRec*); - void FT_Init_Class_tt_service_gx_multi_masters(FT_Service_MultiMastersRec*); - void FT_Init_Class_tt_service_truetype_glyf(FT_Service_TTGlyfRec*); + FT_Error + FT_Create_Class_tt_services( FT_Library library, + FT_ServiceDescRec** output_class ); void - tt_driver_class_pic_free( FT_Library library ) + 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 ); + + + void + tt_driver_class_pic_free( FT_Library library ) { - FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_PIC_Container* pic_container = &library->pic_container; + FT_Memory memory = library->memory; + + if ( pic_container->truetype ) { - TTModulePIC* container = (TTModulePIC*)pic_container->truetype; - if(container->tt_services) - FT_Destroy_Class_tt_services(library, container->tt_services); + TTModulePIC* container = (TTModulePIC*)pic_container->truetype; + + + if ( container->tt_services ) + FT_Destroy_Class_tt_services( library, container->tt_services ); container->tt_services = NULL; FT_FREE( container ); pic_container->truetype = NULL; @@ -51,27 +68,32 @@ { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = TT_Err_Ok; - TTModulePIC* container; + TTModulePIC* container = NULL; FT_Memory memory = library->memory; /* allocate pointer, clear and set global container pointer */ if ( FT_ALLOC ( container, sizeof ( *container ) ) ) return error; - FT_MEM_SET( container, 0, sizeof(*container) ); + FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->truetype = container; - /* initialize pointer table - this is how the module usually expects this data */ - error = FT_Create_Class_tt_services(library, &container->tt_services); - if(error) + /* initialize pointer table - this is how the module usually */ + /* expects this data */ + error = FT_Create_Class_tt_services( library, + &container->tt_services ); + if ( error ) goto Exit; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - FT_Init_Class_tt_service_gx_multi_masters(&container->tt_service_gx_multi_masters); + FT_Init_Class_tt_service_gx_multi_masters( + &container->tt_service_gx_multi_masters ); #endif - FT_Init_Class_tt_service_truetype_glyf(&container->tt_service_truetype_glyf); + FT_Init_Class_tt_service_truetype_glyf( + &container->tt_service_truetype_glyf ); + Exit: - if(error) - tt_driver_class_pic_free(library); + if ( error ) + tt_driver_class_pic_free( library ); return error; } Index: src/truetype/ttpic.h =================================================================== --- src/truetype/ttpic.h (revision 58178) +++ src/truetype/ttpic.h (working copy) @@ -4,7 +4,7 @@ /* */ /* The FreeType position independent code services for truetype module. */ /* */ -/* Copyright 2009 by */ +/* Copyright 2009, 2012 by */ /* Oran Agra and Mickey Gabel. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -19,34 +19,50 @@ #ifndef __TTPIC_H__ #define __TTPIC_H__ - + FT_BEGIN_HEADER #ifndef FT_CONFIG_OPTION_PIC -#define FT_TT_SERVICES_GET tt_services -#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET tt_service_gx_multi_masters -#define FT_TT_SERVICE_TRUETYPE_GLYF_GET tt_service_truetype_glyf +#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 + #else /* FT_CONFIG_OPTION_PIC */ #include FT_MULTIPLE_MASTERS_H #include FT_SERVICE_MULTIPLE_MASTERS_H #include FT_SERVICE_TRUETYPE_GLYF_H - typedef struct TTModulePIC_ + + 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; #endif - FT_Service_TTGlyfRec tt_service_truetype_glyf; + FT_Service_TTGlyfRec tt_service_truetype_glyf; + } TTModulePIC; -#define GET_PIC(lib) ((TTModulePIC*)((lib)->pic_container.truetype)) -#define FT_TT_SERVICES_GET (GET_PIC(library)->tt_services) -#define FT_TT_SERVICE_GX_MULTI_MASTERS_GET (GET_PIC(library)->tt_service_gx_multi_masters) -#define FT_TT_SERVICE_TRUETYPE_GLYF_GET (GET_PIC(library)->tt_service_truetype_glyf) +#define GET_PIC( lib ) \ + ( (TTModulePIC*)((lib)->pic_container.truetype) ) +#define TT_SERVICES_GET \ + ( GET_PIC( library )->tt_services ) +#define TT_SERVICE_GX_MULTI_MASTERS_GET \ + ( GET_PIC( library )->tt_service_gx_multi_masters ) +#define TT_SERVICE_TRUETYPE_GLYF_GET \ + ( GET_PIC( library )->tt_service_truetype_glyf ) + + + /* see ttpic.c for the implementation */ + void + tt_driver_class_pic_free( FT_Library library ); + + FT_Error + tt_driver_class_pic_init( FT_Library library ); + #endif /* FT_CONFIG_OPTION_PIC */ /* */ Index: src/truetype/ttpload.c =================================================================== --- src/truetype/ttpload.c (revision 58178) +++ src/truetype/ttpload.c (working copy) @@ -4,7 +4,7 @@ /* */ /* TrueType-specific tables loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 1996-2002, 2004-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -110,15 +110,16 @@ face->num_locations = table_len >> shift; } - if ( face->num_locations != (FT_ULong)face->root.num_glyphs ) + if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 ) { FT_TRACE2(( "glyph count mismatch! loca: %d, maxp: %d\n", - face->num_locations, face->root.num_glyphs )); + face->num_locations - 1, face->root.num_glyphs )); /* we only handle the case where `maxp' gives a larger value */ - if ( face->num_locations < (FT_ULong)face->root.num_glyphs ) + if ( face->num_locations <= (FT_ULong)face->root.num_glyphs ) { - FT_Long new_loca_len = (FT_Long)face->root.num_glyphs << shift; + FT_Long new_loca_len = + ( (FT_Long)( face->root.num_glyphs ) + 1 ) << shift; TT_Table entry = face->dir_tables; TT_Table limit = entry + face->num_tables; @@ -145,7 +146,7 @@ if ( new_loca_len <= dist ) { - face->num_locations = face->root.num_glyphs; + face->num_locations = face->root.num_glyphs + 1; table_len = new_loca_len; FT_TRACE2(( "adjusting num_locations to %d\n", @@ -210,22 +211,22 @@ } /* Check broken location data */ - if ( pos1 >= face->glyf_len ) + if ( pos1 > face->glyf_len ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset=0x%08lx found for gid=0x%04lx," - " exceeding the end of glyf table (0x%08lx)\n", - pos1, gindex, face->glyf_len )); + " too large offset=0x%08lx found for gid=0x%04lx," + " exceeding the end of glyf table (0x%08lx)\n", + pos1, gindex, face->glyf_len )); *asize = 0; return 0; } - if ( pos2 >= face->glyf_len ) + if ( pos2 > face->glyf_len ) { FT_TRACE1(( "tt_face_get_location:" - " too large offset=0x%08lx found for gid=0x%04lx," - " truncate at the end of glyf table (0x%08lx)\n", - pos2, gindex + 1, face->glyf_len )); + " too large offset=0x%08lx found for gid=0x%04lx," + " truncate at the end of glyf table (0x%08lx)\n", + pos2, gindex + 1, face->glyf_len )); pos2 = face->glyf_len; } Index: src/truetype/ttsubpix.c =================================================================== --- src/truetype/ttsubpix.c (revision 0) +++ src/truetype/ttsubpix.c (working copy) @@ -0,0 +1,265 @@ +/***************************************************************************/ +/* */ +/* ttsubpix.c */ +/* */ +/* TrueType Subpixel Hinting. */ +/* */ +/* Copyright 2010-2012 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +#include <ft2build.h> +#include FT_INTERNAL_DEBUG_H +#include FT_INTERNAL_CALC_H +#include FT_INTERNAL_STREAM_H +#include FT_INTERNAL_SFNT_H +#include FT_TRUETYPE_TAGS_H +#include FT_OUTLINE_H + +#include "ttsubpix.h" + + +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + + FT_LOCAL_DEF( FT_Bool ) + is_member_of_family_class( const FT_String* detected_font_name, + const FT_String* rule_font_name ) + { + FT_UInt i, j; + + + /* Does font name match rule family? */ + if ( strcmp( detected_font_name, rule_font_name ) == 0 ) + return TRUE; + + /* Is font name a wildcard ""? */ + if ( strcmp( rule_font_name, "" ) == 0 ) + return TRUE; + + /* Is font name contained in a class list? */ + for ( i = 0; i < FAMILY_CLASS_RULES_SIZE; i++ ) + { + if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) + { + for ( j = 0; j < MAX_CLASS_MEMBERS; j++ ) + { + if ( strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) + continue; + if ( strcmp( FAMILY_CLASS_Rules[i].member[j], + detected_font_name ) == 0 ) + return TRUE; + } + } + } + + return FALSE; + } + + + FT_LOCAL_DEF( FT_Bool ) + is_member_of_style_class( const FT_String* detected_font_style, + const FT_String* rule_font_style ) + { + FT_UInt i, j; + + + /* Does font style match rule style? */ + if ( strcmp( detected_font_style, rule_font_style ) == 0 ) + return TRUE; + + /* Is font style a wildcard ""? */ + if ( strcmp( rule_font_style, "" ) == 0 ) + return TRUE; + + /* Is font style contained in a class list? */ + for ( i = 0; i < STYLE_CLASS_RULES_SIZE; i++ ) + { + if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) + { + for ( j = 0; j < MAX_CLASS_MEMBERS; j++ ) + { + if ( strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) + continue; + if ( strcmp( STYLE_CLASS_Rules[i].member[j], + detected_font_style ) == 0 ) + return TRUE; + } + } + } + + return FALSE; + } + + + 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 ) + { + FT_UInt i; + + + /* rule checks may be able to be optimized further */ + for ( i = 0; i < num_rules; i++ ) + { + if ( family && + ( is_member_of_family_class ( family, rule[i].family ) ) ) + if ( rule[i].ppem == 0 || + rule[i].ppem == ppem ) + if ( style && + is_member_of_style_class ( style, rule[i].style ) ) + if ( rule[i].glyph == 0 || + FT_Get_Char_Index( (FT_Face)face, + rule[i].glyph ) == glyph_index ) + return TRUE; + } + + return FALSE; + } + + + 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 ) + { + FT_UInt i; + + + /* rule checks may be able to be optimized further */ + for ( i = 0; i < num_rules; i++ ) + { + if ( family && + ( is_member_of_family_class ( family, rule[i].family ) ) ) + if ( rule[i].ppem == 0 || + rule[i].ppem == ppem ) + if ( style && + is_member_of_style_class( style, rule[i].style ) ) + if ( rule[i].glyph == 0 || + FT_Get_Char_Index( (FT_Face)face, + rule[i].glyph ) == glyph_index ) + return rule[i].scale; + } + + return 1000; + } + + +#define TWEAK_RULES( x ) \ + if ( sph_test_tweak( face, family, ppem, style, glyph_index, \ + x##_Rules, x##_RULES_SIZE ) ) \ + loader->exec->sph_tweak_flags |= SPH_TWEAK_##x; + +#define TWEAK_RULES_EXCEPTIONS( x ) \ + if ( sph_test_tweak( face, family, ppem, style, glyph_index, \ + x##_Rules_Exceptions, x##_RULES_EXCEPTIONS_SIZE ) ) \ + loader->exec->sph_tweak_flags &= ~SPH_TWEAK_##x; + + + FT_LOCAL_DEF( void ) + sph_set_tweaks( TT_Loader loader, + FT_UInt glyph_index ) + { + TT_Face face = (TT_Face)loader->face; + FT_String* family = face->root.family_name; + int ppem = loader->size->metrics.x_ppem; + FT_String* style = face->root.style_name; + + + /* don't apply rules if style isn't set */ + if ( !face->root.style_name ) + return; + +#ifdef SPH_DEBUG_MORE_VERBOSE + printf( "%s,%d,%s,%c=%d ", + family, ppem, style, glyph_index, glyph_index ); +#endif + + TWEAK_RULES( PIXEL_HINTING ); + + if ( loader->exec->sph_tweak_flags & SPH_TWEAK_PIXEL_HINTING ) + { + loader->exec->ignore_x_mode = FALSE; + return; + } + + 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 ); + TWEAK_RULES( NORMAL_ROUND ); + TWEAK_RULES( NO_ALIGNRP_AFTER_IUP ); + 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 ); + TWEAK_RULES_EXCEPTIONS( SKIP_NONPIXEL_Y_MOVES ); + + TWEAK_RULES( ROUND_NONPIXEL_Y_MOVES ); + TWEAK_RULES_EXCEPTIONS( ROUND_NONPIXEL_Y_MOVES ); + + if ( loader->exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 ) + loader->exec->rasterizer_version = 35; + else + loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION; + + /* 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 ) ); + + if ( IS_HINTED( loader->load_flags ) ) + { + TWEAK_RULES( TIMES_NEW_ROMAN_HACK ); + TWEAK_RULES( COURIER_NEW_2_HACK ); + } + + 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; + + if ( IS_HINTED( loader->load_flags ) ) + { + if ( sph_test_tweak( face, family, ppem, style, glyph_index, + COMPATIBLE_WIDTHS_Rules, COMPATIBLE_WIDTHS_RULES_SIZE ) ) + loader->exec->compatible_widths |= TRUE; + } + } + +#endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */ + + +/* END */ Index: src/truetype/ttsubpix.h =================================================================== --- src/truetype/ttsubpix.h (revision 0) +++ src/truetype/ttsubpix.h (working copy) @@ -0,0 +1,908 @@ +/***************************************************************************/ +/* */ +/* ttsubpix.h */ +/* */ +/* TrueType Subpixel Hinting. */ +/* */ +/* Copyright 2010-2012 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 __TTSUBPIX_H__ +#define __TTSUBPIX_H__ + +#include <ft2build.h> +#include "ttobjs.h" +#include "ttinterp.h" + + +FT_BEGIN_HEADER + + +#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + + /*************************************************************************/ + /* */ + /* 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 + + + 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 ); + + 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 +#define SPH_OPTION_SET_GRAYSCALE FALSE +#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 */ + + +FT_END_HEADER + +#endif /* __TTSUBPIX_H__ */ + +/* END */ Index: src/type1/t1afm.c =================================================================== --- src/type1/t1afm.c (revision 58178) +++ src/type1/t1afm.c (working copy) @@ -4,8 +4,7 @@ /* */ /* AFM support for Type 1 fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -252,7 +251,7 @@ fi->Descender = t1_font->font_bbox.yMin; psaux = (PSAux_Service)( (T1_Face)t1_face )->psaux; - if ( psaux && psaux->afm_parser_funcs ) + if ( psaux->afm_parser_funcs ) { error = psaux->afm_parser_funcs->init( &parser, stream->memory, Index: src/type1/t1driver.c =================================================================== --- src/type1/t1driver.c (revision 58178) +++ src/type1/t1driver.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 1 driver interface (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2009 by */ +/* Copyright 1996-2004, 2006, 2007, 2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -171,12 +171,408 @@ } + static FT_Long + t1_ps_get_font_value( FT_Face face, + PS_Dict_Keys key, + FT_UInt idx, + void *value, + FT_Long value_len ) + { + FT_Long retval = -1; + T1_Face t1face = (T1_Face)face; + T1_Font type1 = &t1face->type1; + + + switch ( key ) + { + case PS_DICT_FONT_TYPE: + retval = sizeof ( type1->font_type ); + if ( value && value_len >= retval ) + *((FT_Byte *)value) = type1->font_type; + break; + + case PS_DICT_FONT_MATRIX: + if ( idx < sizeof ( type1->font_matrix ) / + sizeof ( type1->font_matrix.xx ) ) + { + FT_Fixed val = 0; + + + retval = sizeof ( val ); + if ( value && value_len >= retval ) + { + switch ( idx ) + { + case 0: + val = type1->font_matrix.xx; + break; + case 1: + val = type1->font_matrix.xy; + break; + case 2: + val = type1->font_matrix.yx; + break; + case 3: + val = type1->font_matrix.yy; + break; + } + *((FT_Fixed *)value) = val; + } + } + break; + + case PS_DICT_FONT_BBOX: + if ( idx < sizeof ( type1->font_bbox ) / + sizeof ( type1->font_bbox.xMin ) ) + { + FT_Fixed val = 0; + + + retval = sizeof ( val ); + if ( value && value_len >= retval ) + { + switch ( idx ) + { + case 0: + val = type1->font_bbox.xMin; + break; + case 1: + val = type1->font_bbox.yMin; + break; + case 2: + val = type1->font_bbox.xMax; + break; + case 3: + val = type1->font_bbox.yMax; + break; + } + *((FT_Fixed *)value) = val; + } + } + break; + + case PS_DICT_PAINT_TYPE: + retval = sizeof ( type1->paint_type ); + if ( value && value_len >= retval ) + *((FT_Byte *)value) = type1->paint_type; + break; + + case PS_DICT_FONT_NAME: + retval = ft_strlen( type1->font_name ) + 1; + if ( value && value_len >= retval ) + ft_memcpy( value, (void *)( type1->font_name ), retval ); + break; + + case PS_DICT_UNIQUE_ID: + retval = sizeof ( type1->private_dict.unique_id ); + if ( value && value_len >= retval ) + *((FT_Int *)value) = type1->private_dict.unique_id; + break; + + case PS_DICT_NUM_CHAR_STRINGS: + retval = sizeof ( type1->num_glyphs ); + if ( value && value_len >= retval ) + *((FT_Int *)value) = type1->num_glyphs; + break; + + case PS_DICT_CHAR_STRING_KEY: + if ( idx < (FT_UInt)type1->num_glyphs ) + { + retval = ft_strlen( type1->glyph_names[idx] ) + 1; + if ( value && value_len >= retval ) + { + ft_memcpy( value, (void *)( type1->glyph_names[idx] ), retval ); + ((FT_Char *)value)[retval - 1] = (FT_Char)'\0'; + } + } + break; + + case PS_DICT_CHAR_STRING: + if ( idx < (FT_UInt)type1->num_glyphs ) + { + retval = type1->charstrings_len[idx] + 1; + if ( value && value_len >= retval ) + { + ft_memcpy( value, (void *)( type1->charstrings[idx] ), + retval - 1 ); + ((FT_Char *)value)[retval - 1] = (FT_Char)'\0'; + } + } + break; + + case PS_DICT_ENCODING_TYPE: + retval = sizeof ( type1->encoding_type ); + if ( value && value_len >= retval ) + *((T1_EncodingType *)value) = type1->encoding_type; + break; + + case PS_DICT_ENCODING_ENTRY: + if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY && + idx < (FT_UInt)type1->encoding.num_chars ) + { + retval = ft_strlen( type1->encoding.char_name[idx] ) + 1; + if ( value && value_len >= retval ) + { + ft_memcpy( value, (void *)( type1->encoding.char_name[idx] ), + retval - 1 ); + ((FT_Char *)value)[retval - 1] = (FT_Char)'\0'; + } + } + break; + + case PS_DICT_NUM_SUBRS: + retval = sizeof ( type1->num_subrs ); + if ( value && value_len >= retval ) + *((FT_Int *)value) = type1->num_subrs; + break; + + case PS_DICT_SUBR: + if ( idx < (FT_UInt)type1->num_subrs ) + { + retval = type1->subrs_len[idx] + 1; + if ( value && value_len >= retval ) + { + ft_memcpy( value, (void *)( type1->subrs[idx] ), retval - 1 ); + ((FT_Char *)value)[retval - 1] = (FT_Char)'\0'; + } + } + break; + + case PS_DICT_STD_HW: + retval = sizeof ( type1->private_dict.standard_width[0] ); + if ( value && value_len >= retval ) + *((FT_UShort *)value) = type1->private_dict.standard_width[0]; + break; + + case PS_DICT_STD_VW: + retval = sizeof ( type1->private_dict.standard_height[0] ); + if ( value && value_len >= retval ) + *((FT_UShort *)value) = type1->private_dict.standard_height[0]; + break; + + case PS_DICT_NUM_BLUE_VALUES: + retval = sizeof ( type1->private_dict.num_blue_values ); + if ( value && value_len >= retval ) + *((FT_Byte *)value) = type1->private_dict.num_blue_values; + break; + + case PS_DICT_BLUE_VALUE: + if ( idx < type1->private_dict.num_blue_values ) + { + retval = sizeof ( type1->private_dict.blue_values[idx] ); + if ( value && value_len >= retval ) + *((FT_Short *)value) = type1->private_dict.blue_values[idx]; + } + break; + + case PS_DICT_BLUE_SCALE: + retval = sizeof ( type1->private_dict.blue_scale ); + if ( value && value_len >= retval ) + *((FT_Fixed *)value) = type1->private_dict.blue_scale; + break; + + case PS_DICT_BLUE_FUZZ: + retval = sizeof ( type1->private_dict.blue_fuzz ); + if ( value && value_len >= retval ) + *((FT_Int *)value) = type1->private_dict.blue_fuzz; + break; + + case PS_DICT_BLUE_SHIFT: + retval = sizeof ( type1->private_dict.blue_shift ); + if ( value && value_len >= retval ) + *((FT_Int *)value) = type1->private_dict.blue_shift; + break; + + case PS_DICT_NUM_OTHER_BLUES: + retval = sizeof ( type1->private_dict.num_other_blues ); + if ( value && value_len >= retval ) + *((FT_Byte *)value) = type1->private_dict.num_other_blues; + break; + + case PS_DICT_OTHER_BLUE: + if ( idx < type1->private_dict.num_other_blues ) + { + retval = sizeof ( type1->private_dict.other_blues[idx] ); + if ( value && value_len >= retval ) + *((FT_Short *)value) = type1->private_dict.other_blues[idx]; + } + break; + + case PS_DICT_NUM_FAMILY_BLUES: + retval = sizeof ( type1->private_dict.num_family_blues ); + if ( value && value_len >= retval ) + *((FT_Byte *)value) = type1->private_dict.num_family_blues; + break; + + case PS_DICT_FAMILY_BLUE: + if ( idx < type1->private_dict.num_family_blues ) + { + retval = sizeof ( type1->private_dict.family_blues[idx] ); + if ( value && value_len >= retval ) + *((FT_Short *)value) = type1->private_dict.family_blues[idx]; + } + break; + + case PS_DICT_NUM_FAMILY_OTHER_BLUES: + retval = sizeof ( type1->private_dict.num_family_other_blues ); + if ( value && value_len >= retval ) + *((FT_Byte *)value) = type1->private_dict.num_family_other_blues; + break; + + case PS_DICT_FAMILY_OTHER_BLUE: + if ( idx < type1->private_dict.num_family_other_blues ) + { + retval = sizeof ( type1->private_dict.family_other_blues[idx] ); + if ( value && value_len >= retval ) + *((FT_Short *)value) = type1->private_dict.family_other_blues[idx]; + } + break; + + case PS_DICT_NUM_STEM_SNAP_H: + retval = sizeof ( type1->private_dict.num_snap_widths ); + if ( value && value_len >= retval ) + *((FT_Byte *)value) = type1->private_dict.num_snap_widths; + break; + + case PS_DICT_STEM_SNAP_H: + if ( idx < type1->private_dict.num_snap_widths ) + { + retval = sizeof ( type1->private_dict.snap_widths[idx] ); + if ( value && value_len >= retval ) + *((FT_Short *)value) = type1->private_dict.snap_widths[idx]; + } + break; + + case PS_DICT_NUM_STEM_SNAP_V: + retval = sizeof ( type1->private_dict.num_snap_heights ); + if ( value && value_len >= retval ) + *((FT_Byte *)value) = type1->private_dict.num_snap_heights; + break; + + case PS_DICT_STEM_SNAP_V: + if ( idx < type1->private_dict.num_snap_heights ) + { + retval = sizeof ( type1->private_dict.snap_heights[idx] ); + if ( value && value_len >= retval ) + *((FT_Short *)value) = type1->private_dict.snap_heights[idx]; + } + break; + + case PS_DICT_RND_STEM_UP: + retval = sizeof ( type1->private_dict.round_stem_up ); + if ( value && value_len >= retval ) + *((FT_Bool *)value) = type1->private_dict.round_stem_up; + break; + + case PS_DICT_FORCE_BOLD: + retval = sizeof ( type1->private_dict.force_bold ); + if ( value && value_len >= retval ) + *((FT_Bool *)value) = type1->private_dict.force_bold; + break; + + case PS_DICT_MIN_FEATURE: + if ( idx < sizeof ( type1->private_dict.min_feature ) / + sizeof ( type1->private_dict.min_feature[0] ) ) + { + retval = sizeof ( type1->private_dict.min_feature[idx] ); + if ( value && value_len >= retval ) + *((FT_Short *)value) = type1->private_dict.min_feature[idx]; + } + break; + + case PS_DICT_LEN_IV: + retval = sizeof ( type1->private_dict.lenIV ); + if ( value && value_len >= retval ) + *((FT_Int *)value) = type1->private_dict.lenIV; + break; + + case PS_DICT_PASSWORD: + retval = sizeof ( type1->private_dict.password ); + if ( value && value_len >= retval ) + *((FT_Long *)value) = type1->private_dict.password; + break; + + case PS_DICT_LANGUAGE_GROUP: + retval = sizeof ( type1->private_dict.language_group ); + if ( value && value_len >= retval ) + *((FT_Long *)value) = type1->private_dict.language_group; + break; + + case PS_DICT_IS_FIXED_PITCH: + retval = sizeof ( type1->font_info.is_fixed_pitch ); + if ( value && value_len >= retval ) + *((FT_Bool *)value) = type1->font_info.is_fixed_pitch; + break; + + case PS_DICT_UNDERLINE_POSITION: + retval = sizeof ( type1->font_info.underline_position ); + if ( value && value_len >= retval ) + *((FT_Short *)value) = type1->font_info.underline_position; + break; + + case PS_DICT_UNDERLINE_THICKNESS: + retval = sizeof ( type1->font_info.underline_thickness ); + if ( value && value_len >= retval ) + *((FT_UShort *)value) = type1->font_info.underline_thickness; + break; + + case PS_DICT_FS_TYPE: + retval = sizeof ( type1->font_extra.fs_type ); + if ( value && value_len >= retval ) + *((FT_UShort *)value) = type1->font_extra.fs_type; + break; + + case PS_DICT_VERSION: + retval = 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; + 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; + 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; + 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; + if ( value && value_len >= retval ) + ft_memcpy( value, (void *)( type1->font_info.weight ), retval ); + break; + + case PS_DICT_ITALIC_ANGLE: + retval = sizeof ( type1->font_info.italic_angle ); + if ( value && value_len >= retval ) + *((FT_Long *)value) = type1->font_info.italic_angle; + break; + + default: + break; + } + + return retval; + } + + static const FT_Service_PsInfoRec t1_service_ps_info = { (PS_GetFontInfoFunc) t1_ps_get_font_info, (PS_GetFontExtraFunc) t1_ps_get_font_extra, (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names, (PS_GetFontPrivateFunc)t1_ps_get_font_private, + (PS_GetFontValueFunc) t1_ps_get_font_value, }; @@ -211,11 +607,11 @@ }; - static FT_Module_Interface - Get_Interface( FT_Driver driver, + FT_CALLBACK_DEF( FT_Module_Interface ) + Get_Interface( FT_Module module, const FT_String* t1_interface ) { - FT_UNUSED( driver ); + FT_UNUSED( module ); return ft_service_list_lookup( t1_services, t1_interface ); } @@ -256,11 +652,14 @@ /* They can be implemented by format-specific interfaces. */ /* */ static FT_Error - Get_Kerning( T1_Face face, + Get_Kerning( FT_Face t1face, /* T1_Face */ FT_UInt left_glyph, FT_UInt right_glyph, FT_Vector* kerning ) { + T1_Face face = (T1_Face)t1face; + + kerning->x = 0; kerning->y = 0; @@ -285,7 +684,7 @@ FT_MODULE_DRIVER_SCALABLE | FT_MODULE_DRIVER_HAS_HINTER, - sizeof( FT_DriverRec ), + sizeof ( FT_DriverRec ), "type1", 0x10000L, @@ -293,38 +692,38 @@ 0, /* format interface */ - (FT_Module_Constructor)T1_Driver_Init, - (FT_Module_Destructor) T1_Driver_Done, - (FT_Module_Requester) Get_Interface, + T1_Driver_Init, + T1_Driver_Done, + Get_Interface, }, - sizeof( T1_FaceRec ), - sizeof( T1_SizeRec ), - sizeof( T1_GlyphSlotRec ), + sizeof ( T1_FaceRec ), + sizeof ( T1_SizeRec ), + sizeof ( T1_GlyphSlotRec ), - (FT_Face_InitFunc) T1_Face_Init, - (FT_Face_DoneFunc) T1_Face_Done, - (FT_Size_InitFunc) T1_Size_Init, - (FT_Size_DoneFunc) T1_Size_Done, - (FT_Slot_InitFunc) T1_GlyphSlot_Init, - (FT_Slot_DoneFunc) T1_GlyphSlot_Done, + T1_Face_Init, + T1_Face_Done, + T1_Size_Init, + T1_Size_Done, + T1_GlyphSlot_Init, + T1_GlyphSlot_Done, #ifdef FT_CONFIG_OPTION_OLD_INTERNALS ft_stub_set_char_sizes, ft_stub_set_pixel_sizes, #endif - (FT_Slot_LoadFunc) T1_Load_Glyph, + T1_Load_Glyph, #ifdef T1_CONFIG_OPTION_NO_AFM - (FT_Face_GetKerningFunc) 0, - (FT_Face_AttachFunc) 0, + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ #else - (FT_Face_GetKerningFunc) Get_Kerning, - (FT_Face_AttachFunc) T1_Read_Metrics, + Get_Kerning, + T1_Read_Metrics, #endif - (FT_Face_GetAdvancesFunc) T1_Get_Advances, - (FT_Size_RequestFunc) T1_Size_Request, - (FT_Size_SelectFunc) 0 + T1_Get_Advances, + T1_Size_Request, + 0 /* FT_Size_SelectFunc */ }; Index: src/type1/t1driver.h =================================================================== --- src/type1/t1driver.h (revision 58178) +++ src/type1/t1driver.h (working copy) @@ -28,7 +28,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Driver_ClassRec ) t1_driver_class; Index: src/type1/t1errors.h =================================================================== --- src/type1/t1errors.h (revision 58178) +++ src/type1/t1errors.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 1 error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX T1_Err_ #define FT_ERR_BASE FT_Mod_Err_Type1 Index: src/type1/t1gload.c =================================================================== --- src/type1/t1gload.c (revision 58178) +++ src/type1/t1gload.c (working copy) @@ -208,12 +208,13 @@ FT_LOCAL_DEF( FT_Error ) - T1_Get_Advances( T1_Face face, + T1_Get_Advances( FT_Face t1face, /* T1_Face */ FT_UInt first, FT_UInt count, - FT_ULong load_flags, + FT_Int32 load_flags, FT_Fixed* advances ) { + T1_Face face = (T1_Face)t1face; T1_DecoderRec decoder; T1_Font type1 = &face->type1; PSAux_Service psaux = (PSAux_Service)face->psaux; @@ -265,14 +266,15 @@ FT_LOCAL_DEF( FT_Error ) - T1_Load_Glyph( T1_GlyphSlot glyph, - T1_Size size, + T1_Load_Glyph( FT_GlyphSlot t1glyph, /* T1_GlyphSlot */ + FT_Size t1size, /* T1_Size */ FT_UInt glyph_index, FT_Int32 load_flags ) { + T1_GlyphSlot glyph = (T1_GlyphSlot)t1glyph; FT_Error error; T1_DecoderRec decoder; - T1_Face face = (T1_Face)glyph->root.face; + T1_Face face = (T1_Face)t1glyph->face; FT_Bool hinting; T1_Font type1 = &face->type1; PSAux_Service psaux = (PSAux_Service)face->psaux; @@ -303,10 +305,10 @@ if ( load_flags & FT_LOAD_NO_RECURSE ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; - if ( size ) + if ( t1size ) { - glyph->x_scale = size->root.metrics.x_scale; - glyph->y_scale = size->root.metrics.y_scale; + glyph->x_scale = t1size->metrics.x_scale; + glyph->y_scale = t1size->metrics.y_scale; } else { @@ -314,18 +316,18 @@ glyph->y_scale = 0x10000L; } - glyph->root.outline.n_points = 0; - glyph->root.outline.n_contours = 0; + t1glyph->outline.n_points = 0; + t1glyph->outline.n_contours = 0; hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); - glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; + t1glyph->format = FT_GLYPH_FORMAT_OUTLINE; error = decoder_funcs->init( &decoder, - (FT_Face)face, - (FT_Size)size, - (FT_GlyphSlot)glyph, + t1glyph->face, + t1size, + t1glyph, (FT_Byte**)type1->glyph_names, face->blend, FT_BOOL( hinting ), @@ -368,19 +370,19 @@ /* bearing the yMax */ if ( !error ) { - glyph->root.outline.flags &= FT_OUTLINE_OWNER; - glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL; + t1glyph->outline.flags &= FT_OUTLINE_OWNER; + t1glyph->outline.flags |= FT_OUTLINE_REVERSE_FILL; /* for composite glyphs, return only left side bearing and */ /* advance width */ if ( load_flags & FT_LOAD_NO_RECURSE ) { - FT_Slot_Internal internal = glyph->root.internal; + FT_Slot_Internal internal = t1glyph->internal; - glyph->root.metrics.horiBearingX = + t1glyph->metrics.horiBearingX = FIXED_TO_INT( decoder.builder.left_bearing.x ); - glyph->root.metrics.horiAdvance = + t1glyph->metrics.horiAdvance = FIXED_TO_INT( decoder.builder.advance.x ); internal->glyph_matrix = font_matrix; @@ -390,45 +392,45 @@ else { FT_BBox cbox; - FT_Glyph_Metrics* metrics = &glyph->root.metrics; + FT_Glyph_Metrics* metrics = &t1glyph->metrics; FT_Vector advance; /* copy the _unscaled_ advance width */ metrics->horiAdvance = FIXED_TO_INT( decoder.builder.advance.x ); - glyph->root.linearHoriAdvance = + t1glyph->linearHoriAdvance = FIXED_TO_INT( decoder.builder.advance.x ); - glyph->root.internal->glyph_transformed = 0; + t1glyph->internal->glyph_transformed = 0; - if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { /* make up vertical ones */ metrics->vertAdvance = ( face->type1.font_bbox.yMax - face->type1.font_bbox.yMin ) >> 16; - glyph->root.linearVertAdvance = metrics->vertAdvance; + t1glyph->linearVertAdvance = metrics->vertAdvance; } else { metrics->vertAdvance = FIXED_TO_INT( decoder.builder.advance.y ); - glyph->root.linearVertAdvance = + t1glyph->linearVertAdvance = FIXED_TO_INT( decoder.builder.advance.y ); } - glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; + t1glyph->format = FT_GLYPH_FORMAT_OUTLINE; - if ( size && size->root.metrics.y_ppem < 24 ) - glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION; + if ( t1size && t1size->metrics.y_ppem < 24 ) + t1glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION; #if 1 /* apply the font matrix, if any */ if ( font_matrix.xx != 0x10000L || font_matrix.yy != font_matrix.xx || font_matrix.xy != 0 || font_matrix.yx != 0 ) - FT_Outline_Transform( &glyph->root.outline, &font_matrix ); + FT_Outline_Transform( &t1glyph->outline, &font_matrix ); if ( font_offset.x || font_offset.y ) - FT_Outline_Translate( &glyph->root.outline, + FT_Outline_Translate( &t1glyph->outline, font_offset.x, font_offset.y ); @@ -466,7 +468,7 @@ } /* compute the other metrics */ - FT_Outline_Get_CBox( &glyph->root.outline, &cbox ); + FT_Outline_Get_CBox( &t1glyph->outline, &cbox ); metrics->width = cbox.xMax - cbox.xMin; metrics->height = cbox.yMax - cbox.yMin; @@ -474,7 +476,7 @@ metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; - if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { /* make up vertical ones */ ft_synthesize_vertical_metrics( metrics, @@ -484,8 +486,8 @@ /* Set control data to the glyph charstrings. Note that this is */ /* _not_ zero-terminated. */ - glyph->root.control_data = (FT_Byte*)glyph_data.pointer; - glyph->root.control_len = glyph_data.length; + t1glyph->control_data = (FT_Byte*)glyph_data.pointer; + t1glyph->control_len = glyph_data.length; } @@ -500,8 +502,8 @@ /* Set the control data to null - it is no longer available if */ /* loaded incrementally. */ - glyph->root.control_data = 0; - glyph->root.control_len = 0; + t1glyph->control_data = 0; + t1glyph->control_len = 0; } #endif Index: src/type1/t1gload.h =================================================================== --- src/type1/t1gload.h (revision 58178) +++ src/type1/t1gload.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2008 by */ +/* Copyright 1996-2001, 2002, 2003, 2008, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -32,15 +32,15 @@ FT_Pos* max_advance ); FT_LOCAL( FT_Error ) - T1_Get_Advances( T1_Face face, + T1_Get_Advances( FT_Face face, FT_UInt first, FT_UInt count, - FT_ULong load_flags, + FT_Int32 load_flags, FT_Fixed* advances ); FT_LOCAL( FT_Error ) - T1_Load_Glyph( T1_GlyphSlot glyph, - T1_Size size, + T1_Load_Glyph( FT_GlyphSlot glyph, + FT_Size size, FT_UInt glyph_index, FT_Int32 load_flags ); Index: src/type1/t1load.c =================================================================== --- src/type1/t1load.c (revision 58178) +++ src/type1/t1load.c (working copy) @@ -4,8 +4,7 @@ /* */ /* Type 1 font loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ -/* 2010 by */ +/* Copyright 1996-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -72,6 +71,13 @@ #include "t1errors.h" +#ifdef FT_CONFIG_OPTION_INCREMENTAL +#define IS_INCREMENTAL ( face->root.internal->incremental_interface != 0 ) +#else +#define IS_INCREMENTAL 0 +#endif + + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -233,18 +239,11 @@ for ( j = 1; j < axismap->num_points; ++j ) { if ( ncv <= axismap->blend_points[j] ) - { - FT_Fixed t = FT_MulDiv( ncv - axismap->blend_points[j - 1], - 0x10000L, - axismap->blend_points[j] - - axismap->blend_points[j - 1] ); - return INT_TO_FIXED( axismap->design_points[j - 1] ) + - FT_MulDiv( t, - axismap->design_points[j] - - axismap->design_points[j - 1], - 1L ); - } + ( axismap->design_points[j] - axismap->design_points[j - 1] ) * + FT_DivFix( ncv - axismap->blend_points[j - 1], + axismap->blend_points[j] - + axismap->blend_points[j - 1] ); } return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] ); @@ -303,7 +302,7 @@ FT_MM_Var* *master ) { FT_Memory memory = face->root.memory; - FT_MM_Var *mmvar; + FT_MM_Var *mmvar = NULL; FT_Multi_Master mmaster; FT_Error error; FT_UInt i; @@ -321,7 +320,7 @@ mmvar->num_axis = mmaster.num_axis; mmvar->num_designs = mmaster.num_designs; - mmvar->num_namedstyles = (FT_UInt)-1; /* Does not apply */ + mmvar->num_namedstyles = ~0; /* Does not apply */ mmvar->axis = (FT_Var_Axis*)&mmvar[1]; /* Point to axes after MM_Var struct */ mmvar->namedstyle = NULL; @@ -334,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 = (FT_UInt)-1; /* Does not apply */ - mmvar->axis[i].tag = (FT_ULong)-1; /* Does not apply */ + mmvar->axis[i].strid = ~0; /* Does not apply */ + mmvar->axis[i].tag = ~0; /* Does not apply */ if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 ) mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' ); @@ -616,7 +615,7 @@ goto Exit; } - if ( FT_ALLOC( blend->axis_names[n], len + 1 ) ) + if ( FT_ALLOC( blend->axis_names[n], (FT_Long)( len + 1 ) ) ) goto Exit; name = (FT_Byte*)blend->axis_names[n]; @@ -897,7 +896,7 @@ } -#endif /* T1_CONFIG_OPTION_NO_MM_SUPPORT */ +#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */ @@ -922,6 +921,9 @@ PS_Blend blend = face->blend; + if ( blend && blend->num_designs == 0 ) + blend = NULL; + /* if the keyword has a dedicated callback, call it */ if ( field->type == T1_FIELD_TYPE_CALLBACK ) { @@ -1002,13 +1004,24 @@ max_objects = 0; } - if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY || - field->type == T1_FIELD_TYPE_FIXED_ARRAY ) - error = T1_Load_Field_Table( &loader->parser, field, - objects, max_objects, 0 ); + if ( *objects ) + { + if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY || + field->type == T1_FIELD_TYPE_FIXED_ARRAY ) + error = T1_Load_Field_Table( &loader->parser, field, + objects, max_objects, 0 ); + else + error = T1_Load_Field( &loader->parser, field, + objects, max_objects, 0 ); + } else - error = T1_Load_Field( &loader->parser, field, - objects, max_objects, 0 ); + { + FT_TRACE1(( "t1_load_keyword: ignoring keyword `%s'" + " which is not valid at this point\n" + " (probably due to missing keywords)\n", + field->ident )); + error = T1_Err_Ok; + } Exit: return error; @@ -1028,7 +1041,8 @@ static int read_binary_data( T1_Parser parser, FT_Long* size, - FT_Byte** base ) + FT_Byte** base, + FT_Bool incremental ) { FT_Byte* cur; FT_Byte* limit = parser->root.limit; @@ -1063,8 +1077,12 @@ } } - FT_ERROR(( "read_binary_data: invalid size field\n" )); - parser->root.error = T1_Err_Invalid_File_Format; + if( !incremental ) + { + FT_ERROR(( "read_binary_data: invalid size field\n" )); + parser->root.error = T1_Err_Invalid_File_Format; + } + return 0; } @@ -1073,8 +1091,8 @@ /* and `/CharStrings' dictionaries. */ static void - parse_font_matrix( T1_Face face, - T1_Loader loader ) + t1_parse_font_matrix( T1_Face face, + T1_Loader loader ) { T1_Parser parser = &loader->parser; FT_Matrix* matrix = &face->type1.font_matrix; @@ -1097,7 +1115,7 @@ if ( temp_scale == 0 ) { - FT_ERROR(( "parse_font_matrix: invalid font matrix\n" )); + FT_ERROR(( "t1_parse_font_matrix: invalid font matrix\n" )); parser->root.error = T1_Err_Invalid_File_Format; return; } @@ -1106,8 +1124,7 @@ /* 1000 / temp_scale, because temp_scale was already multiplied by */ /* 1000 (in t1_tofixed, from psobjs.c). */ - root->units_per_EM = (FT_UShort)( FT_DivFix( 1000 * 0x10000L, - temp_scale ) >> 16 ); + root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); /* we need to scale the values by 1.0/temp_scale */ if ( temp_scale != 0x10000L ) @@ -1259,7 +1276,7 @@ cur = parser->root.cursor; - if ( *cur == '/' && cur + 2 < limit && n < count ) + if ( cur + 2 < limit && *cur == '/' && n < count ) { FT_PtrDist len; @@ -1268,6 +1285,8 @@ parser->root.cursor = cur; T1_Skip_PS_Token( parser ); + if ( parser->root.cursor >= limit ) + return; if ( parser->root.error ) return; @@ -1385,15 +1404,17 @@ FT_Byte* base; - /* If the next token isn't `dup' we are done. */ - if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) + /* If we are out of data, or if the next token isn't `dup', */ + /* we are done. */ + if ( parser->root.cursor + 4 >= parser->root.limit || + ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) break; T1_Skip_PS_Token( parser ); /* `dup' */ idx = T1_ToInt( parser ); - if ( !read_binary_data( parser, &size, &base ) ) + if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) return; /* The binary string is followed by one token, e.g. `NP' */ @@ -1405,7 +1426,8 @@ return; T1_Skip_Spaces ( parser ); - if ( ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) + if ( parser->root.cursor + 4 < parser->root.limit && + ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) { T1_Skip_PS_Token( parser ); /* skip `put' */ T1_Skip_Spaces ( parser ); @@ -1484,6 +1506,12 @@ num_glyphs = (FT_Int)T1_ToInt( parser ); + if ( num_glyphs < 0 ) + { + error = T1_Err_Invalid_File_Format; + goto Fail; + } + /* some fonts like Optima-Oblique not only define the /CharStrings */ /* array but access it also */ if ( num_glyphs == 0 || parser->root.error ) @@ -1578,7 +1606,7 @@ cur++; /* skip `/' */ len = parser->root.cursor - cur; - if ( !read_binary_data( parser, &size, &base ) ) + if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) return; /* for some non-standard fonts like `Optima' which provides */ @@ -1770,7 +1798,7 @@ #include "t1tokens.h" /* now add the special functions... */ - T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix, + T1_FIELD_CALLBACK( "FontMatrix", t1_parse_font_matrix, T1_FIELD_DICT_FONTDICT ) T1_FIELD_CALLBACK( "Encoding", parse_encoding, T1_FIELD_DICT_FONTDICT ) @@ -1867,7 +1895,7 @@ parser->root.cursor = start_binary; - if ( !read_binary_data( parser, &s, &b ) ) + if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) return T1_Err_Invalid_File_Format; have_integer = 0; } @@ -1880,7 +1908,7 @@ parser->root.cursor = start_binary; - if ( !read_binary_data( parser, &s, &b ) ) + if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) ) return T1_Err_Invalid_File_Format; have_integer = 0; } @@ -1953,8 +1981,8 @@ if ( !( dict & keyword->dict ) ) { - FT_TRACE1(( "parse_dict: found %s but ignoring it " - "since it is in the wrong dictionary\n", + FT_TRACE1(( "parse_dict: found `%s' but ignoring it" + " since it is in the wrong dictionary\n", keyword->ident )); break; } @@ -2138,8 +2166,10 @@ } } } + else + face->len_buildchar = 0; -#endif /* T1_CONFIG_OPTION_NO_MM_SUPPORT */ +#endif /* !T1_CONFIG_OPTION_NO_MM_SUPPORT */ /* now, propagate the subrs, charstrings, and glyphnames tables */ /* to the Type1 data */ @@ -2154,9 +2184,7 @@ type1->subrs_len = loader.subrs.lengths; } -#ifdef FT_CONFIG_OPTION_INCREMENTAL - if ( !face->root.internal->incremental_interface ) -#endif + if ( !IS_INCREMENTAL ) if ( !loader.charstrings.init ) { FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" )); Index: src/type1/t1objs.c =================================================================== --- src/type1/t1objs.c (revision 58178) +++ src/type1/t1objs.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ +/* Copyright 1996-2009, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -72,8 +72,11 @@ FT_LOCAL_DEF( void ) - T1_Size_Done( T1_Size size ) + T1_Size_Done( FT_Size t1size ) /* T1_Size */ { + T1_Size size = (T1_Size)t1size; + + if ( size->root.internal ) { PSH_Globals_Funcs funcs; @@ -89,8 +92,9 @@ FT_LOCAL_DEF( FT_Error ) - T1_Size_Init( T1_Size size ) + T1_Size_Init( FT_Size t1size ) /* T1_Size */ { + T1_Size size = (T1_Size)t1size; FT_Error error = T1_Err_Ok; PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); @@ -112,9 +116,10 @@ FT_LOCAL_DEF( FT_Error ) - T1_Size_Request( T1_Size size, + T1_Size_Request( FT_Size t1size, /* T1_Size */ FT_Size_Request req ) { + T1_Size size = (T1_Size)t1size; PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); @@ -137,20 +142,20 @@ /*************************************************************************/ FT_LOCAL_DEF( void ) - T1_GlyphSlot_Done( T1_GlyphSlot slot ) + T1_GlyphSlot_Done( FT_GlyphSlot slot ) { - slot->root.internal->glyph_hints = 0; + slot->internal->glyph_hints = 0; } FT_LOCAL_DEF( FT_Error ) - T1_GlyphSlot_Init( T1_GlyphSlot slot ) + T1_GlyphSlot_Init( FT_GlyphSlot slot ) { T1_Face face; PSHinter_Service pshinter; - face = (T1_Face)slot->root.face; + face = (T1_Face)slot->face; pshinter = (PSHinter_Service)face->pshinter; if ( pshinter ) @@ -158,15 +163,18 @@ FT_Module module; - module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" ); - if (module) + module = FT_Get_Module( slot->face->driver->root.library, + "pshinter" ); + if ( module ) { T1_Hints_Funcs funcs; + funcs = pshinter->get_t1_funcs( module ); - slot->root.internal->glyph_hints = (void*)funcs; + slot->internal->glyph_hints = (void*)funcs; } } + return 0; } @@ -190,8 +198,9 @@ /* face :: A typeless pointer to the face object to destroy. */ /* */ FT_LOCAL_DEF( void ) - T1_Face_Done( T1_Face face ) + T1_Face_Done( FT_Face t1face ) /* T1_Face */ { + T1_Face face = (T1_Face)t1face; FT_Memory memory; T1_Font type1; @@ -289,11 +298,12 @@ /* */ FT_LOCAL_DEF( FT_Error ) T1_Face_Init( FT_Stream stream, - T1_Face face, + FT_Face t1face, /* T1_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { + T1_Face face = (T1_Face)t1face; FT_Error error; FT_Service_PsCMaps psnames; PSAux_Service psaux; @@ -313,10 +323,18 @@ face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); psaux = (PSAux_Service)face->psaux; + if ( !psaux ) + { + FT_ERROR(( "T1_Face_Init: cannot access `psaux' module\n" )); + error = T1_Err_Missing_Module; + goto Exit; + } face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "pshinter" ); + FT_TRACE2(( "Type 1 driver\n" )); + /* open the tokenizer; this will also check the font format */ error = T1_Open_Face( face ); if ( error ) @@ -447,7 +465,7 @@ root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFF ) >> 16; root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFF ) >> 16; - /* Set units_per_EM if we didn't set it in parse_font_matrix. */ + /* Set units_per_EM if we didn't set it in t1_parse_font_matrix. */ if ( !root->units_per_EM ) root->units_per_EM = 1000; @@ -484,7 +502,7 @@ FT_Face root = &face->root; - if ( psnames && psaux ) + if ( psnames ) { FT_CharMapRec charmap; T1_CMap_Classes cmap_classes = psaux->t1_cmap_classes; @@ -568,7 +586,7 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - T1_Driver_Init( T1_Driver driver ) + T1_Driver_Init( FT_Module driver ) { FT_UNUSED( driver ); @@ -588,7 +606,7 @@ /* driver :: A handle to the target Type 1 driver. */ /* */ FT_LOCAL_DEF( void ) - T1_Driver_Done( T1_Driver driver ) + T1_Driver_Done( FT_Module driver ) { FT_UNUSED( driver ); } Index: src/type1/t1objs.h =================================================================== --- src/type1/t1objs.h (revision 58178) +++ src/type1/t1objs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 1 objects manager (specification). */ /* */ -/* Copyright 1996-2001, 2002, 2006 by */ +/* Copyright 1996-2001, 2002, 2006, 2011 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -37,17 +37,6 @@ /*************************************************************************/ /* */ /* <Type> */ - /* T1_Driver */ - /* */ - /* <Description> */ - /* A handle to a Type 1 driver object. */ - /* */ - typedef struct T1_DriverRec_ *T1_Driver; - - - /*************************************************************************/ - /* */ - /* <Type> */ /* T1_Size */ /* */ /* <Description> */ @@ -106,14 +95,14 @@ FT_LOCAL( void ) - T1_Size_Done( T1_Size size ); + T1_Size_Done( FT_Size size ); FT_LOCAL( FT_Error ) - T1_Size_Request( T1_Size size, + T1_Size_Request( FT_Size size, FT_Size_Request req ); FT_LOCAL( FT_Error ) - T1_Size_Init( T1_Size size ); + T1_Size_Init( FT_Size size ); /*************************************************************************/ @@ -142,25 +131,25 @@ FT_LOCAL( FT_Error ) T1_Face_Init( FT_Stream stream, - T1_Face face, + FT_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ); FT_LOCAL( void ) - T1_Face_Done( T1_Face face ); + T1_Face_Done( FT_Face face ); FT_LOCAL( FT_Error ) - T1_GlyphSlot_Init( T1_GlyphSlot slot ); + T1_GlyphSlot_Init( FT_GlyphSlot slot ); FT_LOCAL( void ) - T1_GlyphSlot_Done( T1_GlyphSlot slot ); + T1_GlyphSlot_Done( FT_GlyphSlot slot ); FT_LOCAL( FT_Error ) - T1_Driver_Init( T1_Driver driver ); + T1_Driver_Init( FT_Module driver ); FT_LOCAL( void ) - T1_Driver_Done( T1_Driver driver ); + T1_Driver_Done( FT_Module driver ); FT_END_HEADER Index: src/type1/t1parse.c =================================================================== --- src/type1/t1parse.c (revision 58178) +++ src/type1/t1parse.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 1 parser (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2008, 2009 by */ +/* Copyright 1996-2005, 2008, 2009, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -164,7 +164,7 @@ error = check_type1_format( stream, "%!FontType", 10 ); if ( error ) { - FT_TRACE2(( "[not a Type1 font]\n" )); + FT_TRACE2(( " not a Type 1 font\n" )); goto Exit; } } @@ -342,7 +342,7 @@ { c = cur[0]; if ( c == 'e' && cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */ - /* newline + 4 chars */ + /* whitespace + 4 chars */ { if ( cur[1] == 'e' && cur[2] == 'x' && @@ -364,7 +364,8 @@ /* or string (as e.g. in u003043t.gsf from ghostscript) */ parser->root.cursor = parser->base_dict; - parser->root.limit = cur + 9; + /* set limit to `eexec' + whitespace + 4 characters */ + parser->root.limit = cur + 10; cur = parser->root.cursor; limit = parser->root.limit; @@ -396,7 +397,8 @@ parser->root.limit = parser->base_dict + parser->base_len; T1_Skip_PS_Token( parser ); - cur = parser->root.cursor; + cur = parser->root.cursor; + limit = parser->root.limit; /* according to the Type1 spec, the first cipher byte must not be */ /* an ASCII whitespace character code (blank, tab, carriage return */ @@ -404,7 +406,7 @@ /* characters... So skip now all whitespace character codes. */ while ( cur < limit && ( *cur == ' ' || - *cur == '\t' || + *cur == '\t' || *cur == '\r' || *cur == '\n' ) ) ++cur; @@ -437,11 +439,12 @@ /* now determine whether the private dictionary is encoded in binary */ /* or hexadecimal ASCII format -- decode it accordingly */ - /* we need to access the next 4 bytes (after the final \r following */ - /* the `eexec' keyword); if they all are hexadecimal digits, then */ - /* we have a case of ASCII storage */ + /* we need to access the next 4 bytes (after the final whitespace */ + /* following the `eexec' keyword); if they all are hexadecimal */ + /* digits, then we have a case of ASCII storage */ - if ( ft_isxdigit( cur[0] ) && ft_isxdigit( cur[1] ) && + if ( cur + 3 < limit && + ft_isxdigit( cur[0] ) && ft_isxdigit( cur[1] ) && ft_isxdigit( cur[2] ) && ft_isxdigit( cur[3] ) ) { /* ASCII hexadecimal encoding */ @@ -467,6 +470,14 @@ /* we now decrypt the encoded binary private dictionary */ psaux->t1_decrypt( parser->private_dict, parser->private_len, 55665U ); + if ( parser->private_len < 4 ) + { + FT_ERROR(( "T1_Get_Private_Dict:" + " invalid private dictionary section\n" )); + error = T1_Err_Invalid_File_Format; + goto Fail; + } + /* replace the four random bytes at the beginning with whitespace */ parser->private_dict[0] = ' '; parser->private_dict[1] = ' '; Index: src/type1/t1tokens.h =================================================================== --- src/type1/t1tokens.h (revision 58178) +++ src/type1/t1tokens.h (working copy) @@ -96,8 +96,8 @@ T1_FIELD_DICT_PRIVATE ) T1_FIELD_BOOL ( "ForceBold", force_bold, T1_FIELD_DICT_PRIVATE ) - + #undef FT_STRUCTURE #define FT_STRUCTURE T1_FontRec #undef T1CODE Index: src/type42/t42drivr.c =================================================================== --- src/type42/t42drivr.c (revision 58178) +++ src/type42/t42drivr.c (working copy) @@ -4,7 +4,7 @@ /* */ /* High-level Type 42 driver interface (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2006, 2007, 2009 by Roberto Alameda. */ +/* Copyright 2002-2004, 2006, 2007, 2009, 2011 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 */ @@ -161,9 +161,10 @@ static const FT_Service_PsInfoRec t42_service_ps_info = { (PS_GetFontInfoFunc) t42_ps_get_font_info, - (PS_GetFontExtraFunc) t42_ps_get_font_extra, + (PS_GetFontExtraFunc) t42_ps_get_font_extra, (PS_HasGlyphNamesFunc) t42_ps_has_glyph_names, - (PS_GetFontPrivateFunc)t42_ps_get_font_private + (PS_GetFontPrivateFunc)t42_ps_get_font_private, + (PS_GetFontValueFunc) NULL /* not implemented */ }; @@ -183,11 +184,11 @@ }; - static FT_Module_Interface - T42_Get_Interface( FT_Driver driver, + FT_CALLBACK_DEF( FT_Module_Interface ) + T42_Get_Interface( FT_Module module, const FT_String* t42_interface ) { - FT_UNUSED( driver ); + FT_UNUSED( module ); return ft_service_list_lookup( t42_services, t42_interface ); } @@ -212,34 +213,34 @@ 0, /* format interface */ - (FT_Module_Constructor)T42_Driver_Init, - (FT_Module_Destructor) T42_Driver_Done, - (FT_Module_Requester) T42_Get_Interface, + T42_Driver_Init, + T42_Driver_Done, + T42_Get_Interface, }, sizeof ( T42_FaceRec ), sizeof ( T42_SizeRec ), sizeof ( T42_GlyphSlotRec ), - (FT_Face_InitFunc) T42_Face_Init, - (FT_Face_DoneFunc) T42_Face_Done, - (FT_Size_InitFunc) T42_Size_Init, - (FT_Size_DoneFunc) T42_Size_Done, - (FT_Slot_InitFunc) T42_GlyphSlot_Init, - (FT_Slot_DoneFunc) T42_GlyphSlot_Done, + T42_Face_Init, + T42_Face_Done, + T42_Size_Init, + T42_Size_Done, + T42_GlyphSlot_Init, + T42_GlyphSlot_Done, #ifdef FT_CONFIG_OPTION_OLD_INTERNALS ft_stub_set_char_sizes, ft_stub_set_pixel_sizes, #endif - (FT_Slot_LoadFunc) T42_GlyphSlot_Load, + T42_GlyphSlot_Load, - (FT_Face_GetKerningFunc) 0, - (FT_Face_AttachFunc) 0, + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ - (FT_Face_GetAdvancesFunc) 0, - (FT_Size_RequestFunc) T42_Size_Request, - (FT_Size_SelectFunc) T42_Size_Select + 0, /* FT_Face_GetAdvancesFunc */ + T42_Size_Request, + T42_Size_Select }; Index: src/type42/t42drivr.h =================================================================== --- src/type42/t42drivr.h (revision 58178) +++ src/type42/t42drivr.h (working copy) @@ -27,7 +27,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif FT_EXPORT_VAR( const FT_Driver_ClassRec ) t42_driver_class; Index: src/type42/t42error.h =================================================================== --- src/type42/t42error.h (revision 58178) +++ src/type42/t42error.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 42 error codes (specification only). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -29,6 +29,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX T42_Err_ #define FT_ERR_BASE FT_Mod_Err_Type42 Index: src/type42/t42objs.c =================================================================== --- src/type42/t42objs.c (revision 58178) +++ src/type42/t42objs.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 */ +/* Copyright 2002-2009, 2011 */ /* by Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,7 +21,7 @@ #include "t42error.h" #include FT_INTERNAL_DEBUG_H #include FT_LIST_H -#include FT_TRUETYPE_IDS_H +#include FT_TRUETYPE_IDS_H #undef FT_COMPONENT @@ -61,6 +61,8 @@ if ( type1->font_type != 42 ) { + FT_ERROR(( "T42_Open_Face: cannot handle FontType %d\n", + type1->font_type )); error = T42_Err_Unknown_File_Format; goto Exit; } @@ -152,11 +154,12 @@ FT_LOCAL_DEF( FT_Error ) T42_Face_Init( FT_Stream stream, - T42_Face face, + FT_Face t42face, /* T42_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { + T42_Face face = (T42_Face)t42face; FT_Error error; FT_Service_PsCMaps psnames; PSAux_Service psaux; @@ -179,7 +182,15 @@ face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); psaux = (PSAux_Service)face->psaux; + if ( !psaux ) + { + FT_ERROR(( "T42_Face_Init: cannot access `psaux' module\n" )); + error = T42_Err_Missing_Module; + goto Exit; + } + FT_TRACE2(( "Type 42 driver\n" )); + /* open the tokenizer, this will also check the font format */ error = T42_Open_Face( face ); if ( error ) @@ -321,7 +332,7 @@ root->face_flags |= FT_FACE_FLAG_VERTICAL; { - if ( psnames && psaux ) + if ( psnames ) { FT_CharMapRec charmap; T1_CMap_Classes cmap_classes = psaux->t1_cmap_classes; @@ -390,8 +401,9 @@ FT_LOCAL_DEF( void ) - T42_Face_Done( T42_Face face ) + T42_Face_Done( FT_Face t42face ) { + T42_Face face = (T42_Face)t42face; T1_Font type1; PS_FontInfo info; FT_Memory memory; @@ -459,12 +471,19 @@ /* FreeType error code. 0 means success. */ /* */ FT_LOCAL_DEF( FT_Error ) - T42_Driver_Init( T42_Driver driver ) + T42_Driver_Init( FT_Module module ) /* T42_Driver */ { - FT_Module ttmodule; + T42_Driver driver = (T42_Driver)module; + FT_Module ttmodule; - ttmodule = FT_Get_Module( FT_MODULE(driver)->library, "truetype" ); + ttmodule = FT_Get_Module( module->library, "truetype" ); + if ( !ttmodule ) + { + FT_ERROR(( "T42_Driver_Init: cannot access `truetype' module\n" )); + return T42_Err_Missing_Module; + } + driver->ttclazz = (FT_Driver_Class)ttmodule->clazz; return T42_Err_Ok; @@ -472,23 +491,24 @@ FT_LOCAL_DEF( void ) - T42_Driver_Done( T42_Driver driver ) + T42_Driver_Done( FT_Module module ) { - FT_UNUSED( driver ); + FT_UNUSED( module ); } FT_LOCAL_DEF( FT_Error ) - T42_Size_Init( T42_Size size ) + T42_Size_Init( FT_Size size ) /* T42_Size */ { - FT_Face face = size->root.face; + T42_Size t42size = (T42_Size)size; + FT_Face face = size->face; T42_Face t42face = (T42_Face)face; FT_Size ttsize; FT_Error error = T42_Err_Ok; error = FT_New_Size( t42face->ttf_face, &ttsize ); - size->ttsize = ttsize; + t42size->ttsize = ttsize; FT_Activate_Size( ttsize ); @@ -497,10 +517,11 @@ FT_LOCAL_DEF( FT_Error ) - T42_Size_Request( T42_Size size, + T42_Size_Request( FT_Size t42size, /* T42_Size */ FT_Size_Request req ) { - T42_Face face = (T42_Face)size->root.face; + T42_Size size = (T42_Size)t42size; + T42_Face face = (T42_Face)t42size->face; FT_Error error; @@ -508,17 +529,18 @@ error = FT_Request_Size( face->ttf_face, req ); if ( !error ) - ( (FT_Size)size )->metrics = face->ttf_face->size->metrics; + t42size->metrics = face->ttf_face->size->metrics; return error; } FT_LOCAL_DEF( FT_Error ) - T42_Size_Select( T42_Size size, + T42_Size_Select( FT_Size t42size, /* T42_Size */ FT_ULong strike_index ) { - T42_Face face = (T42_Face)size->root.face; + T42_Size size = (T42_Size)t42size; + T42_Face face = (T42_Face)t42size->face; FT_Error error; @@ -526,7 +548,7 @@ error = FT_Select_Size( face->ttf_face, (FT_Int)strike_index ); if ( !error ) - ( (FT_Size)size )->metrics = face->ttf_face->size->metrics; + t42size->metrics = face->ttf_face->size->metrics; return error; @@ -534,9 +556,10 @@ FT_LOCAL_DEF( void ) - T42_Size_Done( T42_Size size ) + T42_Size_Done( FT_Size t42size ) /* T42_Size */ { - FT_Face face = size->root.face; + T42_Size size = (T42_Size)t42size; + FT_Face face = t42size->face; T42_Face t42face = (T42_Face)face; FT_ListNode node; @@ -551,12 +574,13 @@ FT_LOCAL_DEF( FT_Error ) - T42_GlyphSlot_Init( T42_GlyphSlot slot ) + T42_GlyphSlot_Init( FT_GlyphSlot t42slot ) /* T42_GlyphSlot */ { - FT_Face face = slot->root.face; - T42_Face t42face = (T42_Face)face; - FT_GlyphSlot ttslot; - FT_Error error = T42_Err_Ok; + T42_GlyphSlot slot = (T42_GlyphSlot)t42slot; + FT_Face face = t42slot->face; + T42_Face t42face = (T42_Face)face; + FT_GlyphSlot ttslot; + FT_Error error = T42_Err_Ok; if ( face->glyph == NULL ) @@ -575,8 +599,11 @@ FT_LOCAL_DEF( void ) - T42_GlyphSlot_Done( T42_GlyphSlot slot ) + T42_GlyphSlot_Done( FT_GlyphSlot t42slot ) /* T42_GlyphSlot */ { + T42_GlyphSlot slot = (T42_GlyphSlot)t42slot; + + FT_Done_GlyphSlot( slot->ttslot ); } Index: src/type42/t42objs.h =================================================================== --- src/type42/t42objs.h (revision 58178) +++ src/type42/t42objs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 42 objects manager (specification). */ /* */ -/* Copyright 2002, 2003, 2006, 2007 by Roberto Alameda. */ +/* Copyright 2002, 2003, 2006, 2007, 2011 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 */ @@ -65,36 +65,36 @@ FT_LOCAL( FT_Error ) T42_Face_Init( FT_Stream stream, - T42_Face face, + FT_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ); FT_LOCAL( void ) - T42_Face_Done( T42_Face face ); + T42_Face_Done( FT_Face face ); FT_LOCAL( FT_Error ) - T42_Size_Init( T42_Size size ); + T42_Size_Init( FT_Size size ); FT_LOCAL( FT_Error ) - T42_Size_Request( T42_Size size, + T42_Size_Request( FT_Size size, FT_Size_Request req ); FT_LOCAL( FT_Error ) - T42_Size_Select( T42_Size size, + T42_Size_Select( FT_Size size, FT_ULong strike_index ); FT_LOCAL( void ) - T42_Size_Done( T42_Size size ); + T42_Size_Done( FT_Size size ); FT_LOCAL( FT_Error ) - T42_GlyphSlot_Init( T42_GlyphSlot slot ); + T42_GlyphSlot_Init( FT_GlyphSlot slot ); FT_LOCAL( FT_Error ) @@ -104,14 +104,14 @@ FT_Int32 load_flags ); FT_LOCAL( void ) - T42_GlyphSlot_Done( T42_GlyphSlot slot ); + T42_GlyphSlot_Done( FT_GlyphSlot slot ); FT_LOCAL( FT_Error ) - T42_Driver_Init( T42_Driver driver ); + T42_Driver_Init( FT_Module module ); FT_LOCAL( void ) - T42_Driver_Done( T42_Driver driver ); + T42_Driver_Done( FT_Module module ); /* */ Index: src/type42/t42parse.c =================================================================== --- src/type42/t42parse.c (revision 58178) +++ src/type42/t42parse.c (working copy) @@ -4,7 +4,7 @@ /* */ /* Type 42 font parser (body). */ /* */ -/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 2002-2012 by */ /* Roberto Alameda. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -175,7 +175,7 @@ if ( ft_memcmp( stream->cursor, "%!PS-TrueTypeFont", 17 ) != 0 ) { - FT_TRACE2(( "not a Type42 font\n" )); + FT_TRACE2(( " not a Type42 font\n" )); error = T42_Err_Unknown_File_Format; } @@ -265,8 +265,7 @@ /* 1000 / temp_scale, because temp_scale was already multiplied by */ /* 1000 (in t1_tofixed, from psobjs.c). */ - root->units_per_EM = (FT_UShort)( FT_DivFix( 1000 * 0x10000L, - temp_scale ) >> 16 ); + root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); /* we need to scale the values by 1.0/temp_scale */ if ( temp_scale != 0x10000L ) @@ -607,8 +606,9 @@ goto Fail; } - /* A string can have a trailing zero byte for padding. Ignore it. */ - if ( string_buf[string_size - 1] == 0 && ( string_size % 2 == 1 ) ) + /* A string can have a trailing zero (odd) byte for padding. */ + /* Ignore it. */ + if ( ( string_size & 1 ) && string_buf[string_size - 1] == 0 ) string_size--; if ( !string_size ) Index: src/winfonts/fnterrs.h =================================================================== --- src/winfonts/fnterrs.h (revision 58178) +++ src/winfonts/fnterrs.h (working copy) @@ -4,7 +4,7 @@ /* */ /* Win FNT/FON error codes (specification only). */ /* */ -/* Copyright 2001 by */ +/* Copyright 2001, 2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -30,6 +30,7 @@ #undef __FTERRORS_H__ +#undef FT_ERR_PREFIX #define FT_ERR_PREFIX FNT_Err_ #define FT_ERR_BASE FT_Mod_Err_Winfonts Index: src/winfonts/winfnt.c =================================================================== --- src/winfonts/winfnt.c (revision 58178) +++ src/winfonts/winfnt.c (working copy) @@ -4,7 +4,7 @@ /* */ /* FreeType font driver for Windows FNT/FON files */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 by */ +/* Copyright 1996-2004, 2006-2012 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* Copyright 2003 Huw D M Davies for Codeweavers */ /* Copyright 2007 Dmitry Timoshkov for Codeweavers */ @@ -23,7 +23,7 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_OBJECTS_H -#include FT_TRUETYPE_IDS_H +#include FT_TRUETYPE_IDS_H #include "winfnt.h" #include "fnterrs.h" @@ -224,7 +224,7 @@ if ( header->version != 0x200 && header->version != 0x300 ) { - FT_TRACE2(( "[not a valid FNT file]\n" )); + FT_TRACE2(( " not a Windows FNT file\n" )); error = FNT_Err_Unknown_File_Format; goto Exit; } @@ -234,7 +234,7 @@ if ( header->file_size < size ) { - FT_TRACE2(( "[not a valid FNT file]\n" )); + FT_TRACE2(( " not a Windows FNT file\n" )); error = FNT_Err_Unknown_File_Format; goto Exit; } @@ -665,8 +665,9 @@ static void - FNT_Face_Done( FNT_Face face ) + FNT_Face_Done( FT_Face fntface ) /* FNT_Face */ { + FNT_Face face = (FNT_Face)fntface; FT_Memory memory; @@ -677,18 +678,19 @@ fnt_font_done( face ); - FT_FREE( face->root.available_sizes ); - face->root.num_fixed_sizes = 0; + FT_FREE( fntface->available_sizes ); + fntface->num_fixed_sizes = 0; } static FT_Error FNT_Face_Init( FT_Stream stream, - FNT_Face face, + FT_Face fntface, /* FNT_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { + FNT_Face face = (FNT_Face)fntface; FT_Error error; FT_Memory memory = FT_FACE_MEMORY( face ); @@ -696,6 +698,8 @@ FT_UNUSED( params ); + FT_TRACE2(( "Windows FNT driver\n" )); + /* try to load font from a DLL */ error = fnt_face_get_dll_font( face, face_index ); if ( !error && face_index < 0 ) @@ -709,7 +713,7 @@ if ( FT_NEW( face->font ) ) goto Exit; - face->root.num_faces = 1; + fntface->num_faces = 1; font = face->font; font->offset = 0; @@ -827,8 +831,15 @@ root->charmap = root->charmaps[0]; } - /* setup remaining flags */ + /* set up remaining flags */ + if ( font->header.last_char < font->header.first_char ) + { + FT_TRACE2(( "invalid number of glyphs\n" )); + error = FNT_Err_Invalid_File_Format; + goto Fail; + } + /* reserve one slot for the .notdef glyph at index 0 */ root->num_glyphs = font->header.last_char - font->header.first_char + 1 + 1; @@ -874,7 +885,7 @@ goto Exit; Fail: - FNT_Face_Done( face ); + FNT_Face_Done( fntface ); Exit: return error; @@ -882,12 +893,15 @@ static FT_Error - FNT_Size_Select( FT_Size size ) + FNT_Size_Select( FT_Size size, + FT_ULong strike_index ) { FNT_Face face = (FNT_Face)size->face; FT_WinFNT_Header header = &face->font->header; + FT_UNUSED( strike_index ); + FT_Select_Metrics( size->face, 0 ); size->metrics.ascender = header->ascent * 64; @@ -933,7 +947,7 @@ if ( error ) return error; else - return FNT_Size_Select( size ); + return FNT_Size_Select( size, 0 ); } @@ -1086,10 +1100,10 @@ static FT_Module_Interface - winfnt_get_service( FT_Driver driver, + winfnt_get_service( FT_Module module, const FT_String* service_id ) { - FT_UNUSED( driver ); + FT_UNUSED( module ); return ft_service_list_lookup( winfnt_services, service_id ); } @@ -1111,34 +1125,34 @@ 0, - (FT_Module_Constructor)0, - (FT_Module_Destructor) 0, - (FT_Module_Requester) winfnt_get_service + 0, /* FT_Module_Constructor */ + 0, /* FT_Module_Destructor */ + winfnt_get_service }, - sizeof( FNT_FaceRec ), - sizeof( FT_SizeRec ), - sizeof( FT_GlyphSlotRec ), + sizeof ( FNT_FaceRec ), + sizeof ( FT_SizeRec ), + sizeof ( FT_GlyphSlotRec ), - (FT_Face_InitFunc) FNT_Face_Init, - (FT_Face_DoneFunc) FNT_Face_Done, - (FT_Size_InitFunc) 0, - (FT_Size_DoneFunc) 0, - (FT_Slot_InitFunc) 0, - (FT_Slot_DoneFunc) 0, + FNT_Face_Init, + FNT_Face_Done, + 0, /* FT_Size_InitFunc */ + 0, /* FT_Size_DoneFunc */ + 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 - (FT_Slot_LoadFunc) FNT_Load_Glyph, + FNT_Load_Glyph, - (FT_Face_GetKerningFunc) 0, - (FT_Face_AttachFunc) 0, - (FT_Face_GetAdvancesFunc) 0, + 0, /* FT_Face_GetKerningFunc */ + 0, /* FT_Face_AttachFunc */ + 0, /* FT_Face_GetAdvancesFunc */ - (FT_Size_RequestFunc) FNT_Size_Request, - (FT_Size_SelectFunc) FNT_Size_Select + FNT_Size_Request, + FNT_Size_Select }; Index: src/winfonts/winfnt.h =================================================================== --- src/winfonts/winfnt.h (revision 58178) +++ src/winfonts/winfnt.h (working copy) @@ -30,7 +30,7 @@ #ifdef FT_CONFIG_OPTION_PIC #error "this module does not support PIC yet" -#endif +#endif typedef struct WinMZ_HeaderRec_ {