From e6872ee775b1fb13b2ef1eab2d969c8a7da09585 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Sat, 21 Dec 2013 19:58:19 +0100 Subject: [PATCH] - up to 2.5.2 + git fixes --- freetype-git.patch | 3276 ++++++++++++++++++++++++++++++++++++++++ freetype-nodebug.patch | 73 - freetype.spec | 12 +- 3 files changed, 3282 insertions(+), 79 deletions(-) create mode 100644 freetype-git.patch delete mode 100644 freetype-nodebug.patch diff --git a/freetype-git.patch b/freetype-git.patch new file mode 100644 index 0000000..ff2b7d6 --- /dev/null +++ b/freetype-git.patch @@ -0,0 +1,3276 @@ +diff --git a/ChangeLog b/ChangeLog +index b67e436..4a1f1ec 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,247 @@ ++2013-12-21 Werner Lemberg ++ ++ Fix Savannah bug #40975 (sort of). ++ ++ * src/truetype/ttinterp.c (Ins_IP): Fix sign typo to make FreeType ++ behave the same as the Windows TrueType engine for the invalid case. ++ ++2013-12-21 Werner Lemberg ++ ++ [autofit] Make PIC mode work actually. ++ ++ * src/autofit/afpic.h (AFModulePIC): Fix array sizes to fit the ++ enumeration values automatically generated by including `afscript.h' ++ and friends. ++ ++ * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. ++ ++2013-12-21 Werner Lemberg ++ ++ Fix PIC linking. ++ ++ * include/internal/ftrfork.h (CONST_FT_RFORK_RULE_ARRAY_BEGIN): Fix ++ generated function name. ++ ++ * src/base/basepic.c (FT_Init_Table_raccess_guess_table): Rename ++ to ... ++ (FT_Init_Table_ft_raccess_guess_table): ... this so that the ++ function name correctly corresponds to what the macro framework ++ expects. ++ ++ * src/psnames/rules.mk (PSNAMES_DRV_SRC_S): Use correct file name so ++ that PIC functions are compiled also. ++ ++2013-12-21 Werner Lemberg ++ ++ [base] Add missing dependencies to Makefile. ++ ++ * src/base/rules.mk (BASE_SRC): Add `basepic.c' and `ftpic.c'. ++ (BASE_H): Add `basepic.h'. ++ ++2013-12-20 Werner Lemberg ++ ++ [autofit] Fix PIC compilation. ++ ++ * src/autofit/afcjk.c (af_cjk_metrics_init_widths), ++ src/autofit/aflatin.c (af_latin_metrics_init_widths) ++ [FT_CONFIG_OPTION_PIC]: Declare `globals'. ++ ++ * src/autofit/afglobal.c: Always call AF_DEFINE_SCRIPT_CLASS, and ++ AF_DEFINE_STYLE_CLASS. ++ ++ * src/autofit/afpic.c: Include `afglobal.h'. ++ (autofit_module_class_pic_init): Typo. ++ ++ * src/autofit/aftypes.h (AF_DEFINE_SCRIPT_CLASS, ++ AF_DEFINE_STYLE_CLASS): Don't use the same identifier for macro ++ parameter and structure member. ++ ++2013-12-20 Werner Lemberg ++ ++ [autofit] Introduce `styles'. ++ ++ This is the new top-level structure for handling glyph input data; ++ scripts are now defined separately. ++ ++ * src/autofit/aftypes.h (SCRIPT): Updated. ++ (AF_ScriptClassRec): Move `blue_stringset' and `writing_system' ++ members to ... ++ (AF_Style_ClassRec): ... this new structure. ++ (AF_Style): New enumeration. ++ (AF_StyleMetricsRec): Replace `script' enumeration with ++ `style_class' pointer. ++ (AF_DEFINE_SCRIPT_CLASS, AF_DECLARE_SCRIPT_CLASS): Updated. ++ (AF_DEFINE_STYLE_CLASS, AF_DECLARE_STYLE_CLASS): New macros. ++ ++ * src/autofit/afstyles.h: New file, using data from `afscript.h'. ++ * src/autofit/afscript.h: Updated. ++ ++ * src/autofit/afcjk.c (af_cjk_metrics_init_widths, ++ af_cjk_metrics_init_blues, af_cjk_hint_edges): Updated. ++ ++ * src/autofit/afglobal.c (SCRIPT): Updated. ++ (STYLE): Redefine macro to load `afstyles.h'. ++ (af_script_names) [FT_DEBUG_LEVEL_TRACE]: Replace with... ++ (af_style_names): ... this array. ++ (af_face_globals_compute_script_coverage): Renamed to... ++ (af_face_globals_compute_style_coverage): ... this. ++ Updated. ++ (af_face_globals_new, af_face_globals_free, ++ af_face_globals_get_metrics): Updated. ++ ++ * src/autofit/afglobal.h (SCRIPT): Updated. ++ (STYLE): Redefine macro to load `afstyles.h'. ++ (AF_SCRIPT_FALLBACK): Update definition. This will get more ++ refinements with later on. ++ (AF_SCRIPT_UNASSIGNED): Replace with... ++ (AF_STYLE_UNASSIGNED): ... this macro. ++ (AF_FaceGlobalsRec): Updated. ++ ++ * src/autofit/aflatin.c (af_latin_metrics_init_widths, ++ af_latin_metrics_init_blues, af_latin_metrics_scale_dim, ++ af_latin_hint_edges): Updated. ++ ++ * src/autofit/aflatin2.c (af_latin2_metrics_init_widths): Updated. ++ (af_ltn2_uniranges): Removed. ++ ++ * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): ++ Updated. ++ ++ * src/autofit/afpic.c (autofit_module_class_pic_init): Updated. ++ * src/autofit/afpic.h (AF_STYLE_CLASSES_GET): New macro. ++ (AFModulePIC): Add `af_style_classes' and `af_style_classes_rec' ++ members. ++ ++ * src/autofit/afranges.h: Updated. ++ ++ * src/autofit/rules.mk (AUTOF_DRV_H): Add `afstyles.h'. ++ ++2013-12-19 Werner Lemberg ++ ++ [autofit] Factor scripts and uniranges out of writing system files. ++ ++ * src/autofit/afranges.c, src/autofit/afranges.h: New files. ++ ++ * src/autofit/afscript.h: Extend `SCRIPT' macro with more ++ parameters, taking data from the writing system files. ++ ++ * src/autofit/aftypes.h: Updated. ++ ++ * src/autofit/afglobal.c: Include `afranges.h'. ++ Load `afscript.h' to call AF_DEFINE_SCRIPT_CLASS. ++ * src/autofit/afglobal.c: Include `afranges.h'. ++ Load `afscript.h' to call AF_DECLARE_SCRIPT_CLASS. ++ ++ * src/autofit/afcjk.c, src/autofit/afcjk.h: Updated. ++ * src/autofit/afdummy.c, src/autofit/afdummy.h: Updated. ++ * src/autofit/afindic.c, src/autofit/afindic.h: Updated. ++ * src/autofit/aflatin.c, src/autofit/aflatin.h: Updated. ++ * src/autofit/aflatn2.c, src/autofit/aflatn2.h: Updated. ++ ++ * src/autofit/afpic.c: Updated. ++ ++ * src/autofir/autofit.c: Include `afranges.c'. ++ * src/autofit/rules.mk (AUTOF_DRV_SRC): Add `afranges.c'. ++ ++2013-12-18 Werner Lemberg ++ ++ [autofit] More code orthogonality. ++ ++ * src/autofit/aftypes.h (AF_StyleMetrics): Replace `script_class' ++ pointer to an `AF_ScriptClass' structure with `script' index of type ++ `AF_Script'. ++ Move some code around. ++ ++ * src/autofit/afcjk.c: Include `afpic.h'. ++ (af_cjk_metrics_init_widths, af_cjk_metrics_init_blues, ++ af_cjk_hint_edges): Updated. ++ ++ * src/autofit/aflatin.c: Include `afpic.h'. ++ (af_latin_metrics_init_widths, af_latin_metrics_init_blues, ++ af_latin_metrics_scale_dim, af_latin_hint_edges): Updated. ++ ++ * src/autofit/afglobal.c (af_face_globals_get_metrics): Updated. ++ ++ * src/autofit/afloader.c (af_loader_load_g, af_loader_load_glyph): ++ Updated. ++ ++2013-12-18 Werner Lemberg ++ ++ [autofit] s/ScriptMetrics/StyleMetrics/. ++ ++2013-12-18 Werner Lemberg ++ ++ [autofit] s/script_{metrics,hints}/style_{metrics,hints}/ ++ ++2013-12-18 Werner Lemberg ++ ++ [autofit] s/gscripts/gstyles/. ++ ++2013-12-18 Werner Lemberg ++ ++ [autofit] s/glyph_scripts/glyph_styles/. ++ ++ This is the first commit of a series to create a new top-level ++ structure (a `style') for handling scripts, writing_systems, and ++ soon-to-be-added coverages. ++ ++2013-12-17 Werner Lemberg ++ ++ [autofit] s/AF_Script_/AF_WritingSystem_/ where appropriate. ++ ++2013-12-11 Infinality ++ ++ [truetype] Simplify logic of rendering modes. ++ ++ This patch unifies the subpixel and non-subpixel cases. ++ ++ * src/truetype/ttinterp.h (TT_ExecContextRec): Remove ++ `grayscale_hinting'; all code should refer to `grayscale' instead. ++ Remove unused `native_hinting' member. ++ Rename `subpixel_hinting' member to `subpixel. ++ ++ * src/truetype/ttgload.c (TT_LOADER_SET_PP): Updated. ++ (tt_loader_init): Updated. ++ ++ * src/truetype/ttinterp.c (Ins_GETINFO): Simplify. ++ Updated. ++ ++2013-12-11 Werner Lemberg ++ ++ [documentation] Add section how to include FreeType header files. ++ Problem reported by David Kastrup . ++ ++ Surprisingly, a description how to do that was completely missing in ++ the API reference. ++ ++ * include/freetype.h, include/ftchapters.h: New documentation ++ section `header_inclusion'. ++ ++2013-12-10 Werner Lemberg ++ ++ [autofit] s/DFLT/NONE/, s/dflt/none/. ++ ++2013-12-10 Werner Lemberg ++ ++ [autofit] s/AF_SCRIPT_NONE/AF_SCRIPT_UNASSIGNED/. ++ ++2013-12-10 Werner Lemberg ++ ++ [truetype] Fix scaling of vertical phantom points. ++ ++ * src/truetype/ttgload.c (load_truetype_glyph): Scale pp3.x and ++ pp4.x also. ++ ++2013-12-10 Werner Lemberg ++ ++ [truetype] Fix positioning of composite glyphs. ++ Problem reported by Nigel Tao . ++ ++ * src/truetype/ttgload.c (TT_Hint_Glyph): Remove code that shifts ++ the glyph (component) by a fractional value computed from the LSB ++ phantom point. This is wrong, since the horizontal phantom points ++ get rounded horizontally later on. ++ + 2013-12-08 Werner Lemberg + + * Version 2.5.2 released. +diff --git a/include/freetype.h b/include/freetype.h +index 39a18af..372319a 100644 +--- a/include/freetype.h ++++ b/include/freetype.h +@@ -42,6 +42,38 @@ FT_BEGIN_HEADER + /*************************************************************************/ + /* */ + /*
*/ ++ /* header_inclusion */ ++ /* */ ++ /* */ ++ /* FreeType's header inclusion scheme */ ++ /* */ ++ /* <Abstract> */ ++ /* How client applications should include FreeType header files. */ ++ /* */ ++ /* <Description> */ ++ /* To be as flexible as possible (and for historical reasons), */ ++ /* FreeType uses a very special inclusion scheme to load header */ ++ /* files, for example */ ++ /* */ ++ /* { */ ++ /* #include <ft2build.h> */ ++ /* */ ++ /* #include FT_FREETYPE_H */ ++ /* #include FT_OUTLINE_H */ ++ /* } */ ++ /* */ ++ /* A compiler and its preprocessor only needs an include path to find */ ++ /* the file `ft2build.h'; the exact locations and names of the other */ ++ /* FreeType header files are hidden by preprocessor macro names, */ ++ /* loaded by `ft2build.h'. The API documentation always gives the */ ++ /* header macro name needed for a particular function. */ ++ /* */ ++ /*************************************************************************/ ++ ++ ++ /*************************************************************************/ ++ /* */ ++ /* <Section> */ + /* user_allocation */ + /* */ + /* <Title> */ +diff --git a/include/ftchapters.h b/include/ftchapters.h +index 4b1059a..d333761 100644 +--- a/include/ftchapters.h ++++ b/include/ftchapters.h +@@ -15,6 +15,7 @@ + /* General Remarks */ + /* */ + /* <Sections> */ ++/* header_inclusion */ + /* user_allocation */ + /* */ + /***************************************************************************/ +diff --git a/include/internal/ftrfork.h b/include/internal/ftrfork.h +index 6307f2d..fbc3283 100644 +--- a/include/internal/ftrfork.h ++++ b/include/internal/ftrfork.h +@@ -4,7 +4,7 @@ + /* */ + /* Embedded resource forks accessor (specification). */ + /* */ +-/* Copyright 2004, 2006, 2007, 2012 by */ ++/* Copyright 2004, 2006, 2007, 2012, 2013 by */ + /* Masatake YAMATO and Redhat K.K. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -94,7 +94,7 @@ FT_BEGIN_HEADER + /* 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 ) \ ++ FT_Init_Table_ ## name( type* storage ) \ + { \ + type* local = storage; \ + \ +diff --git a/src/autofit/afblue.c b/src/autofit/afblue.c +index 22ef6d5..6e214c8 100644 +--- a/src/autofit/afblue.c ++++ b/src/autofit/afblue.c +@@ -108,7 +108,7 @@ + }; + + +- /* stringsets are specific to scripts */ ++ /* stringsets are specific to styles */ + FT_LOCAL_ARRAY_DEF( AF_Blue_StringRec ) + af_blue_stringsets[] = + { +diff --git a/src/autofit/afblue.cin b/src/autofit/afblue.cin +index c693d89..c6762be 100644 +--- a/src/autofit/afblue.cin ++++ b/src/autofit/afblue.cin +@@ -27,7 +27,7 @@ + }; + + +- /* stringsets are specific to scripts */ ++ /* stringsets are specific to styles */ + FT_LOCAL_ARRAY_DEF( AF_Blue_StringRec ) + af_blue_stringsets[] = + { +diff --git a/src/autofit/afblue.h b/src/autofit/afblue.h +index 86a3649..75f60df 100644 +--- a/src/autofit/afblue.h ++++ b/src/autofit/afblue.h +@@ -130,7 +130,7 @@ FT_BEGIN_HEADER + /*************************************************************************/ + /*************************************************************************/ + +- /* The next level is to group blue strings into script-specific sets. */ ++ /* The next level is to group blue strings into style-specific sets. */ + + + /* Properties are specific to a writing system. We assume that a given */ +diff --git a/src/autofit/afblue.hin b/src/autofit/afblue.hin +index 00282c3..4fc9917 100644 +--- a/src/autofit/afblue.hin ++++ b/src/autofit/afblue.hin +@@ -90,7 +90,7 @@ FT_BEGIN_HEADER + /*************************************************************************/ + /*************************************************************************/ + +- /* The next level is to group blue strings into script-specific sets. */ ++ /* The next level is to group blue strings into style-specific sets. */ + + + /* Properties are specific to a writing system. We assume that a given */ +diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c +index 7a6f835..4cc01b6 100644 +--- a/src/autofit/afcjk.c ++++ b/src/autofit/afcjk.c +@@ -2,7 +2,7 @@ + /* */ + /* afcjk.c */ + /* */ +-/* Auto-fitter hinting routines for CJK script (body). */ ++/* Auto-fitter hinting routines for CJK writing system (body). */ + /* */ + /* Copyright 2006-2013 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ +@@ -27,6 +27,7 @@ + #include FT_INTERNAL_DEBUG_H + + #include "afglobal.h" ++#include "afpic.h" + #include "aflatin.h" + + +@@ -74,10 +75,10 @@ + + + FT_TRACE5(( "\n" +- "cjk standard widths computation (script `%s')\n" ++ "cjk standard widths computation (style `%s')\n" + "===============================================\n" + "\n", +- af_script_names[metrics->root.script_class->script] )); ++ af_style_names[metrics->root.style_class->style] )); + + af_glyph_hints_init( hints, face->memory ); + +@@ -91,15 +92,21 @@ + AF_CJKMetricsRec dummy[1]; + AF_Scaler scaler = &dummy->root.scaler; + ++#ifdef FT_CONFIG_OPTION_PIC ++ AF_FaceGlobals globals = metrics->root.globals; ++#endif ++ ++ AF_StyleClass style_class = metrics->root.style_class; ++ AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET ++ [style_class->script]; ++ + +- glyph_index = FT_Get_Char_Index( +- face, +- metrics->root.script_class->standard_char ); ++ glyph_index = FT_Get_Char_Index( face, script_class->standard_char ); + if ( glyph_index == 0 ) + goto Exit; + + FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n", +- metrics->root.script_class->standard_char, glyph_index )); ++ script_class->standard_char, glyph_index )); + + error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); + if ( error || face->glyph->outline.n_points <= 0 ) +@@ -118,7 +125,7 @@ + scaler->render_mode = FT_RENDER_MODE_NORMAL; + scaler->flags = 0; + +- af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy ); ++ af_glyph_hints_rescale( hints, (AF_StyleMetrics)dummy ); + + error = af_glyph_hints_reload( hints, &face->glyph->outline ); + if ( error ) +@@ -226,7 +233,9 @@ + AF_CJKAxis axis; + FT_Outline outline; + +- AF_Blue_Stringset bss = metrics->root.script_class->blue_stringset; ++ AF_StyleClass sc = metrics->root.style_class; ++ ++ AF_Blue_Stringset bss = sc->blue_stringset; + const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; + + #ifdef FT_DEBUG_LEVEL_TRACE +@@ -246,9 +255,9 @@ + #endif + + +- /* we walk over the blue character strings as specified in the */ +- /* script's entry in the `af_blue_stringset' array, computing its */ +- /* extremum points (depending on the string properties) */ ++ /* we walk over the blue character strings as specified in the */ ++ /* style's entry in the `af_blue_stringset' array, computing its */ ++ /* extremum points (depending on the string properties) */ + + FT_TRACE5(( "cjk blue zones computation\n" + "==========================\n" +@@ -1234,7 +1243,7 @@ + FT_UInt32 scaler_flags, other_flags; + + +- af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics ); ++ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics ); + + /* + * correct x_scale and y_scale when needed, since they may have +@@ -1665,9 +1674,9 @@ + #endif + + +- FT_TRACE5(( "cjk %s edge hinting (script `%s')\n", ++ FT_TRACE5(( "cjk %s edge hinting (style `%s')\n", + dim == AF_DIMENSION_VERT ? "horizontal" : "vertical", +- af_script_names[hints->metrics->script_class->script] )); ++ af_style_names[hints->metrics->style_class->style] )); + + /* we begin by aligning all stems relative to the blue zone */ + +@@ -2210,60 +2219,18 @@ + + sizeof ( AF_CJKMetricsRec ), + +- (AF_Script_InitMetricsFunc) af_cjk_metrics_init, +- (AF_Script_ScaleMetricsFunc)af_cjk_metrics_scale, +- (AF_Script_DoneMetricsFunc) NULL, ++ (AF_WritingSystem_InitMetricsFunc) af_cjk_metrics_init, ++ (AF_WritingSystem_ScaleMetricsFunc)af_cjk_metrics_scale, ++ (AF_WritingSystem_DoneMetricsFunc) NULL, + +- (AF_Script_InitHintsFunc) af_cjk_hints_init, +- (AF_Script_ApplyHintsFunc) af_cjk_hints_apply ++ (AF_WritingSystem_InitHintsFunc) af_cjk_hints_init, ++ (AF_WritingSystem_ApplyHintsFunc) af_cjk_hints_apply + ) + + +- /* this corresponds to Unicode 6.0 */ +- +- /* XXX: this should probably fine tuned to differentiate better between */ +- /* scripts... */ +- +- static const AF_Script_UniRangeRec af_hani_uniranges[] = +- { +- 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 */ +- AF_UNIRANGE_REC( 0x3200UL, 0x32FFUL ), /* Enclosed CJK Letters and Months */ +- AF_UNIRANGE_REC( 0x3300UL, 0x33FFUL ), /* CJK Compatibility */ +- 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 ) +- }; +- +- + #else /* !AF_CONFIG_OPTION_CJK */ + ++ + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_cjk_writing_system_class, + +@@ -2271,33 +2238,16 @@ + + sizeof ( AF_CJKMetricsRec ), + +- (AF_Script_InitMetricsFunc) NULL, +- (AF_Script_ScaleMetricsFunc)NULL, +- (AF_Script_DoneMetricsFunc) NULL, ++ (AF_WritingSystem_InitMetricsFunc) NULL, ++ (AF_WritingSystem_ScaleMetricsFunc)NULL, ++ (AF_WritingSystem_DoneMetricsFunc) NULL, + +- (AF_Script_InitHintsFunc) NULL, +- (AF_Script_ApplyHintsFunc) NULL ++ (AF_WritingSystem_InitHintsFunc) NULL, ++ (AF_WritingSystem_ApplyHintsFunc) NULL + ) + + +- static const AF_Script_UniRangeRec af_hani_uniranges[] = +- { +- AF_UNIRANGE_REC( 0UL, 0UL ) +- }; +- + #endif /* !AF_CONFIG_OPTION_CJK */ + + +- AF_DEFINE_SCRIPT_CLASS( +- af_hani_script_class, +- +- AF_SCRIPT_HANI, +- AF_BLUE_STRINGSET_HANI, +- AF_WRITING_SYSTEM_CJK, +- +- af_hani_uniranges, +- 0x7530 /* 田 */ +- ) +- +- + /* END */ +diff --git a/src/autofit/afcjk.h b/src/autofit/afcjk.h +index 6f5bdc5..a260b09 100644 +--- a/src/autofit/afcjk.h ++++ b/src/autofit/afcjk.h +@@ -2,7 +2,7 @@ + /* */ + /* afcjk.h */ + /* */ +-/* Auto-fitter hinting routines for CJK script (specification). */ ++/* Auto-fitter hinting routines for CJK writing system (specification). */ + /* */ + /* Copyright 2006, 2007, 2011-2013 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ +@@ -31,11 +31,6 @@ FT_BEGIN_HEADER + AF_DECLARE_WRITING_SYSTEM_CLASS( af_cjk_writing_system_class ) + + +- /* the CJK-specific script classes */ +- +- AF_DECLARE_SCRIPT_CLASS( af_hani_script_class ) +- +- + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ +@@ -105,9 +100,9 @@ FT_BEGIN_HEADER + + typedef struct AF_CJKMetricsRec_ + { +- AF_ScriptMetricsRec root; +- FT_UInt units_per_em; +- AF_CJKAxisRec axis[AF_DIMENSION_MAX]; ++ AF_StyleMetricsRec root; ++ FT_UInt units_per_em; ++ AF_CJKAxisRec axis[AF_DIMENSION_MAX]; + + } AF_CJKMetricsRec, *AF_CJKMetrics; + +diff --git a/src/autofit/afdummy.c b/src/autofit/afdummy.c +index aaa034d..f8702a1 100644 +--- a/src/autofit/afdummy.c ++++ b/src/autofit/afdummy.c +@@ -23,8 +23,8 @@ + + + static FT_Error +- af_dummy_hints_init( AF_GlyphHints hints, +- AF_ScriptMetrics metrics ) ++ af_dummy_hints_init( AF_GlyphHints hints, ++ AF_StyleMetrics metrics ) + { + af_glyph_hints_rescale( hints, metrics ); + +@@ -57,26 +57,14 @@ + + AF_WRITING_SYSTEM_DUMMY, + +- sizeof ( AF_ScriptMetricsRec ), ++ sizeof ( AF_StyleMetricsRec ), + +- (AF_Script_InitMetricsFunc) NULL, +- (AF_Script_ScaleMetricsFunc)NULL, +- (AF_Script_DoneMetricsFunc) NULL, ++ (AF_WritingSystem_InitMetricsFunc) NULL, ++ (AF_WritingSystem_ScaleMetricsFunc)NULL, ++ (AF_WritingSystem_DoneMetricsFunc) NULL, + +- (AF_Script_InitHintsFunc) af_dummy_hints_init, +- (AF_Script_ApplyHintsFunc) af_dummy_hints_apply +- ) +- +- +- AF_DEFINE_SCRIPT_CLASS( +- af_dflt_script_class, +- +- AF_SCRIPT_DFLT, +- (AF_Blue_Stringset)0, +- AF_WRITING_SYSTEM_DUMMY, +- +- NULL, +- '\0' ++ (AF_WritingSystem_InitHintsFunc) af_dummy_hints_init, ++ (AF_WritingSystem_ApplyHintsFunc) af_dummy_hints_apply + ) + + +diff --git a/src/autofit/afdummy.h b/src/autofit/afdummy.h +index bc34ddd..ad1b0d3 100644 +--- a/src/autofit/afdummy.h ++++ b/src/autofit/afdummy.h +@@ -25,14 +25,10 @@ + + FT_BEGIN_HEADER + +- /* A dummy writing system and script class used when no hinting should be +- * performed. +- */ ++ /* A dummy writing system used when no hinting should be performed. */ + + AF_DECLARE_WRITING_SYSTEM_CLASS( af_dummy_writing_system_class ) + +- AF_DECLARE_SCRIPT_CLASS( af_dflt_script_class ) +- + /* */ + + FT_END_HEADER +diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c +index dc62bd7..1b4721c 100644 +--- a/src/autofit/afglobal.c ++++ b/src/autofit/afglobal.c +@@ -17,6 +17,7 @@ + + + #include "afglobal.h" ++#include "afranges.h" + + /* get writing system specific header files */ + #undef WRITING_SYSTEM +@@ -27,6 +28,29 @@ + #include "afpic.h" + + ++#undef SCRIPT ++#define SCRIPT( s, S, d, dc ) \ ++ AF_DEFINE_SCRIPT_CLASS( \ ++ af_ ## s ## _script_class, \ ++ AF_SCRIPT_ ## S, \ ++ af_ ## s ## _uniranges, \ ++ dc ) ++ ++#include "afscript.h" ++ ++ ++#undef STYLE ++#define STYLE( s, S, d, ws, sc, ss ) \ ++ AF_DEFINE_STYLE_CLASS( \ ++ af_ ## s ## _style_class, \ ++ AF_STYLE_ ## S, \ ++ ws, \ ++ sc, \ ++ ss ) ++ ++#include "afstyles.h" ++ ++ + #ifndef FT_CONFIG_OPTION_PIC + + #undef WRITING_SYSTEM +@@ -44,7 +68,7 @@ + + + #undef SCRIPT +-#define SCRIPT( s, S, d ) \ ++#define SCRIPT( s, S, d, dc ) \ + &af_ ## s ## _script_class, + + FT_LOCAL_ARRAY_DEF( AF_ScriptClass ) +@@ -56,41 +80,55 @@ + NULL /* do not remove */ + }; + ++ ++#undef STYLE ++#define STYLE( s, S, d, ws, sc, ss ) \ ++ &af_ ## s ## _style_class, ++ ++ FT_LOCAL_ARRAY_DEF( AF_StyleClass ) ++ af_style_classes[] = ++ { ++ ++#include "afstyles.h" ++ ++ NULL /* do not remove */ ++ }; ++ + #endif /* !FT_CONFIG_OPTION_PIC */ + + + #ifdef FT_DEBUG_LEVEL_TRACE + +-#undef SCRIPT +-#define SCRIPT( s, S, d ) #s, ++#undef STYLE ++#define STYLE( s, S, d, ws, sc, ss ) #s, + + FT_LOCAL_ARRAY_DEF( char* ) +- af_script_names[] = ++ af_style_names[] = + { + +-#include "afscript.h" ++#include "afstyles.h" + + }; + + #endif /* FT_DEBUG_LEVEL_TRACE */ + + +- /* Compute the script index of each glyph within a given face. */ ++ /* Compute the style index of each glyph within a given face. */ + + static FT_Error +- af_face_globals_compute_script_coverage( AF_FaceGlobals globals ) ++ af_face_globals_compute_style_coverage( AF_FaceGlobals globals ) + { + FT_Error error; + FT_Face face = globals->face; + FT_CharMap old_charmap = face->charmap; +- FT_Byte* gscripts = globals->glyph_scripts; ++ FT_Byte* gstyles = globals->glyph_styles; + FT_UInt ss; + FT_UInt i; + + +- /* the value AF_SCRIPT_NONE means `uncovered glyph' */ +- FT_MEM_SET( globals->glyph_scripts, +- AF_SCRIPT_NONE, ++ /* the value AF_STYLE_UNASSIGNED means `uncovered glyph' */ ++ FT_MEM_SET( globals->glyph_styles, ++ AF_STYLE_UNASSIGNED, + globals->glyph_count ); + + error = FT_Select_Charmap( face, FT_ENCODING_UNICODE ); +@@ -104,10 +142,13 @@ + goto Exit; + } + +- /* scan each script in a Unicode charmap */ +- for ( ss = 0; AF_SCRIPT_CLASSES_GET[ss]; ss++ ) ++ /* scan each style in a Unicode charmap */ ++ for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) + { +- AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET[ss]; ++ AF_StyleClass style_class = ++ AF_STYLE_CLASSES_GET[ss]; ++ AF_ScriptClass script_class = ++ AF_SCRIPT_CLASSES_GET[style_class->script]; + AF_Script_UniRange range; + + +@@ -116,7 +157,7 @@ + + /* + * Scan all Unicode points in the range and set the corresponding +- * glyph script index. ++ * glyph style index. + */ + for ( range = script_class->script_uni_ranges; + range->first != 0; +@@ -130,8 +171,8 @@ + + if ( gindex != 0 && + gindex < (FT_ULong)globals->glyph_count && +- gscripts[gindex] == AF_SCRIPT_NONE ) +- gscripts[gindex] = (FT_Byte)ss; ++ gstyles[gindex] == AF_STYLE_UNASSIGNED ) ++ gstyles[gindex] = (FT_Byte)ss; + + for (;;) + { +@@ -141,8 +182,8 @@ + break; + + if ( gindex < (FT_ULong)globals->glyph_count && +- gscripts[gindex] == AF_SCRIPT_NONE ) +- gscripts[gindex] = (FT_Byte)ss; ++ gstyles[gindex] == AF_STYLE_UNASSIGNED ) ++ gstyles[gindex] = (FT_Byte)ss; + } + } + } +@@ -154,7 +195,7 @@ + + + if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count ) +- gscripts[gindex] |= AF_DIGIT; ++ gstyles[gindex] |= AF_DIGIT; + } + + Exit: +@@ -162,17 +203,17 @@ + * 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 ) ++ if ( globals->module->fallback_script != AF_STYLE_UNASSIGNED ) + { + FT_Long nn; + + + for ( nn = 0; nn < globals->glyph_count; nn++ ) + { +- if ( ( gscripts[nn] & ~AF_DIGIT ) == AF_SCRIPT_NONE ) ++ if ( ( gstyles[nn] & ~AF_DIGIT ) == AF_STYLE_UNASSIGNED ) + { +- gscripts[nn] &= ~AF_SCRIPT_NONE; +- gscripts[nn] |= globals->module->fallback_script; ++ gstyles[nn] &= ~AF_STYLE_UNASSIGNED; ++ gstyles[nn] |= globals->module->fallback_script; + } + } + } +@@ -198,12 +239,12 @@ + 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; ++ globals->face = face; ++ globals->glyph_count = face->num_glyphs; ++ globals->glyph_styles = (FT_Byte*)( globals + 1 ); ++ globals->module = module; + +- error = af_face_globals_compute_script_coverage( globals ); ++ error = af_face_globals_compute_style_coverage( globals ); + if ( error ) + { + af_face_globals_free( globals ); +@@ -227,26 +268,26 @@ + FT_UInt nn; + + +- for ( nn = 0; nn < AF_SCRIPT_MAX; nn++ ) ++ for ( nn = 0; nn < AF_STYLE_MAX; nn++ ) + { + if ( globals->metrics[nn] ) + { +- AF_ScriptClass script_class = +- AF_SCRIPT_CLASSES_GET[nn]; ++ AF_StyleClass style_class = ++ AF_STYLE_CLASSES_GET[nn]; + AF_WritingSystemClass writing_system_class = +- AF_WRITING_SYSTEM_CLASSES_GET[script_class->writing_system]; ++ AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + + +- if ( writing_system_class->script_metrics_done ) +- writing_system_class->script_metrics_done( globals->metrics[nn] ); ++ if ( writing_system_class->style_metrics_done ) ++ writing_system_class->style_metrics_done( globals->metrics[nn] ); + + FT_FREE( globals->metrics[nn] ); + } + } + +- globals->glyph_count = 0; +- globals->glyph_scripts = NULL; /* no need to free this one! */ +- globals->face = NULL; ++ globals->glyph_count = 0; ++ globals->glyph_styles = NULL; /* no need to free this one! */ ++ globals->face = NULL; + + FT_FREE( globals ); + } +@@ -254,16 +295,16 @@ + + + FT_LOCAL_DEF( FT_Error ) +- af_face_globals_get_metrics( AF_FaceGlobals globals, +- FT_UInt gindex, +- FT_UInt options, +- AF_ScriptMetrics *ametrics ) ++ af_face_globals_get_metrics( AF_FaceGlobals globals, ++ FT_UInt gindex, ++ FT_UInt options, ++ AF_StyleMetrics *ametrics ) + { +- AF_ScriptMetrics metrics = NULL; ++ AF_StyleMetrics metrics = NULL; + +- AF_Script script = (AF_Script)( options & 15 ); ++ AF_Style style = (AF_Style)( options & 15 ); + AF_WritingSystemClass writing_system_class; +- AF_ScriptClass script_class; ++ AF_StyleClass style_class; + + FT_Error error = FT_Err_Ok; + +@@ -274,43 +315,44 @@ + goto Exit; + } + +- /* if we have a forced script (via `options'), use it, */ +- /* otherwise look into `glyph_scripts' array */ +- if ( script == AF_SCRIPT_DFLT || script + 1 >= AF_SCRIPT_MAX ) +- script = (AF_Script)( globals->glyph_scripts[gindex] & AF_SCRIPT_NONE ); ++ /* if we have a forced style (via `options'), use it, */ ++ /* otherwise look into `glyph_styles' array */ ++ if ( style == AF_STYLE_NONE_DEFAULT || style + 1 >= AF_STYLE_MAX ) ++ style = (AF_Style)( globals->glyph_styles[gindex] & ++ AF_STYLE_UNASSIGNED ); + +- script_class = AF_SCRIPT_CLASSES_GET[script]; ++ style_class = AF_STYLE_CLASSES_GET[style]; + writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET +- [script_class->writing_system]; ++ [style_class->writing_system]; + +- metrics = globals->metrics[script]; ++ metrics = globals->metrics[style]; + if ( metrics == NULL ) + { + /* create the global metrics object if necessary */ + FT_Memory memory = globals->face->memory; + + +- if ( FT_ALLOC( metrics, writing_system_class->script_metrics_size ) ) ++ if ( FT_ALLOC( metrics, writing_system_class->style_metrics_size ) ) + goto Exit; + +- metrics->script_class = script_class; +- metrics->globals = globals; ++ metrics->style_class = style_class; ++ metrics->globals = globals; + +- if ( writing_system_class->script_metrics_init ) ++ if ( writing_system_class->style_metrics_init ) + { +- error = writing_system_class->script_metrics_init( metrics, +- globals->face ); ++ error = writing_system_class->style_metrics_init( metrics, ++ globals->face ); + if ( error ) + { +- if ( writing_system_class->script_metrics_done ) +- writing_system_class->script_metrics_done( metrics ); ++ if ( writing_system_class->style_metrics_done ) ++ writing_system_class->style_metrics_done( metrics ); + + FT_FREE( metrics ); + goto Exit; + } + } + +- globals->metrics[script] = metrics; ++ globals->metrics[style] = metrics; + } + + Exit: +@@ -325,7 +367,7 @@ + FT_UInt gindex ) + { + if ( gindex < (FT_ULong)globals->glyph_count ) +- return (FT_Bool)( globals->glyph_scripts[gindex] & AF_DIGIT ); ++ return (FT_Bool)( globals->glyph_styles[gindex] & AF_DIGIT ); + + return (FT_Bool)0; + } +diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h +index 227eee7..b0316e6 100644 +--- a/src/autofit/afglobal.h ++++ b/src/autofit/afglobal.h +@@ -31,29 +31,48 @@ FT_BEGIN_HEADER + FT_LOCAL_ARRAY( AF_WritingSystemClass ) + af_writing_system_classes[]; + ++ ++#undef SCRIPT ++#define SCRIPT( s, S, d, dc ) \ ++ AF_DECLARE_SCRIPT_CLASS( af_ ## s ## _script_class ) ++ ++#include "afscript.h" ++ + FT_LOCAL_ARRAY( AF_ScriptClass ) + af_script_classes[]; + ++ ++#undef STYLE ++#define STYLE( s, S, d, ws, sc, ss ) \ ++ AF_DECLARE_STYLE_CLASS( af_ ## s ## _style_class ) ++ ++#include "afstyles.h" ++ ++ FT_LOCAL_ARRAY( AF_StyleClass ) ++ af_style_classes[]; ++ ++ + #ifdef FT_DEBUG_LEVEL_TRACE + FT_LOCAL_ARRAY( char* ) +- af_script_names[]; ++ af_style_names[]; + #endif + ++ + /* + * 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' */ ++ /* index of fallback script in `af_style_classes' */ + #ifdef AF_CONFIG_OPTION_CJK +-#define AF_SCRIPT_FALLBACK AF_SCRIPT_HANI ++#define AF_SCRIPT_FALLBACK AF_STYLE_HANI_DEFAULT + #else +-#define AF_SCRIPT_FALLBACK AF_SCRIPT_DFLT ++#define AF_SCRIPT_FALLBACK AF_STYLE_NONE_DEFAULT + #endif + /* a bit mask indicating an uncovered glyph */ +-#define AF_SCRIPT_NONE 0x7F ++#define AF_STYLE_UNASSIGNED 0x7F + /* if this flag is set, we have an ASCII digit */ +-#define AF_DIGIT 0x80 ++#define AF_DIGIT 0x80 + + /* `increase-x-height' property */ + #define AF_PROP_INCREASE_X_HEIGHT_MIN 6 +@@ -70,29 +89,29 @@ FT_BEGIN_HEADER + + + /* +- * Note that glyph_scripts[] maps each glyph to an index into the +- * `af_script_classes' array. ++ * Note that glyph_styles[] maps each glyph to an index into the ++ * `af_style_classes' array. + * + */ + typedef struct AF_FaceGlobalsRec_ + { +- FT_Face face; +- FT_Long glyph_count; /* same as face->num_glyphs */ +- FT_Byte* glyph_scripts; ++ FT_Face face; ++ FT_Long glyph_count; /* same as face->num_glyphs */ ++ FT_Byte* glyph_styles; + + /* per-face auto-hinter properties */ +- FT_UInt increase_x_height; ++ FT_UInt increase_x_height; + +- AF_ScriptMetrics metrics[AF_SCRIPT_MAX]; ++ AF_StyleMetrics metrics[AF_STYLE_MAX]; + +- AF_Module module; /* to access global properties */ ++ AF_Module module; /* to access global properties */ + + } AF_FaceGlobalsRec; + + + /* + * model the global hints data for a given face, decomposed into +- * script-specific items ++ * style-specific items + */ + + FT_LOCAL( FT_Error ) +@@ -101,10 +120,10 @@ FT_BEGIN_HEADER + AF_Module module ); + + FT_LOCAL( FT_Error ) +- af_face_globals_get_metrics( AF_FaceGlobals globals, +- FT_UInt gindex, +- FT_UInt options, +- AF_ScriptMetrics *ametrics ); ++ af_face_globals_get_metrics( AF_FaceGlobals globals, ++ FT_UInt gindex, ++ FT_UInt options, ++ AF_StyleMetrics *ametrics ); + + FT_LOCAL( void ) + af_face_globals_free( AF_FaceGlobals globals ); +diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c +index ce504cc..dc8557e 100644 +--- a/src/autofit/afhints.c ++++ b/src/autofit/afhints.c +@@ -533,8 +533,8 @@ + /* Reset metrics. */ + + FT_LOCAL_DEF( void ) +- af_glyph_hints_rescale( AF_GlyphHints hints, +- AF_ScriptMetrics metrics ) ++ af_glyph_hints_rescale( AF_GlyphHints hints, ++ AF_StyleMetrics metrics ) + { + hints->metrics = metrics; + hints->scaler_flags = metrics->scaler.flags; +diff --git a/src/autofit/afhints.h b/src/autofit/afhints.h +index ce52325..5f1507f 100644 +--- a/src/autofit/afhints.h ++++ b/src/autofit/afhints.h +@@ -27,7 +27,7 @@ FT_BEGIN_HEADER + + /* + * The definition of outline glyph hints. These are shared by all +- * script analysis routines (until now). ++ * writing system analysis routines (until now). + */ + + typedef enum AF_Dimension_ +@@ -343,31 +343,31 @@ FT_BEGIN_HEADER + + typedef struct AF_GlyphHintsRec_ + { +- FT_Memory memory; ++ FT_Memory memory; + +- FT_Fixed x_scale; +- FT_Pos x_delta; ++ FT_Fixed x_scale; ++ FT_Pos x_delta; + +- FT_Fixed y_scale; +- FT_Pos y_delta; ++ FT_Fixed y_scale; ++ FT_Pos y_delta; + +- FT_Int max_points; /* number of allocated points */ +- FT_Int num_points; /* number of used points */ +- AF_Point points; /* points array */ ++ FT_Int max_points; /* number of allocated points */ ++ FT_Int num_points; /* number of used points */ ++ AF_Point points; /* points array */ + +- 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; /* number of allocated contours */ ++ FT_Int num_contours; /* number of used contours */ ++ AF_Point* contours; /* contours array */ + +- AF_AxisHintsRec axis[AF_DIMENSION_MAX]; ++ AF_AxisHintsRec axis[AF_DIMENSION_MAX]; + +- FT_UInt32 scaler_flags; /* copy of scaler flags */ +- FT_UInt32 other_flags; /* free for script-specific */ +- /* implementations */ +- AF_ScriptMetrics metrics; ++ FT_UInt32 scaler_flags; /* copy of scaler flags */ ++ FT_UInt32 other_flags; /* free for style-specific */ ++ /* implementations */ ++ AF_StyleMetrics metrics; + +- FT_Pos xmin_delta; /* used for warping */ +- FT_Pos xmax_delta; ++ FT_Pos xmin_delta; /* used for warping */ ++ FT_Pos xmax_delta; + + } AF_GlyphHintsRec; + +@@ -429,8 +429,8 @@ FT_BEGIN_HEADER + FT_Memory memory ); + + FT_LOCAL( void ) +- af_glyph_hints_rescale( AF_GlyphHints hints, +- AF_ScriptMetrics metrics ); ++ af_glyph_hints_rescale( AF_GlyphHints hints, ++ AF_StyleMetrics metrics ); + + FT_LOCAL( FT_Error ) + af_glyph_hints_reload( AF_GlyphHints hints, +diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c +index ef8299f..197881b 100644 +--- a/src/autofit/afindic.c ++++ b/src/autofit/afindic.c +@@ -2,7 +2,7 @@ + /* */ + /* afindic.c */ + /* */ +-/* Auto-fitter hinting routines for Indic scripts (body). */ ++/* Auto-fitter hinting routines for Indic writing system (body). */ + /* */ + /* Copyright 2007, 2011-2013 by */ + /* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */ +@@ -104,32 +104,18 @@ + + sizeof ( AF_CJKMetricsRec ), + +- (AF_Script_InitMetricsFunc) af_indic_metrics_init, +- (AF_Script_ScaleMetricsFunc)af_indic_metrics_scale, +- (AF_Script_DoneMetricsFunc) NULL, ++ (AF_WritingSystem_InitMetricsFunc) af_indic_metrics_init, ++ (AF_WritingSystem_ScaleMetricsFunc)af_indic_metrics_scale, ++ (AF_WritingSystem_DoneMetricsFunc) NULL, + +- (AF_Script_InitHintsFunc) af_indic_hints_init, +- (AF_Script_ApplyHintsFunc) af_indic_hints_apply ++ (AF_WritingSystem_InitHintsFunc) af_indic_hints_init, ++ (AF_WritingSystem_ApplyHintsFunc) af_indic_hints_apply + ) + +- /* XXX: this should probably fine tuned to differentiate better between */ +- /* scripts... */ +- +- static const AF_Script_UniRangeRec af_deva_uniranges[] = +- { +- 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 ) +- }; +- + + #else /* !AF_CONFIG_OPTION_INDIC */ + ++ + AF_DEFINE_WRITING_SYSTEM_CLASS( + af_indic_writing_system_class, + +@@ -137,33 +123,16 @@ + + sizeof ( AF_CJKMetricsRec ), + +- (AF_Script_InitMetricsFunc) NULL, +- (AF_Script_ScaleMetricsFunc)NULL, +- (AF_Script_DoneMetricsFunc) NULL, ++ (AF_WritingSystem_InitMetricsFunc) NULL, ++ (AF_WritingSystem_ScaleMetricsFunc)NULL, ++ (AF_WritingSystem_DoneMetricsFunc) NULL, + +- (AF_Script_InitHintsFunc) NULL, +- (AF_Script_ApplyHintsFunc) NULL ++ (AF_WritingSystem_InitHintsFunc) NULL, ++ (AF_WritingSystem_ApplyHintsFunc) NULL + ) + + +- static const AF_Script_UniRangeRec af_deva_uniranges[] = +- { +- AF_UNIRANGE_REC( 0UL, 0UL ) +- }; +- + #endif /* !AF_CONFIG_OPTION_INDIC */ + + +- AF_DEFINE_SCRIPT_CLASS( +- af_deva_script_class, +- +- AF_SCRIPT_DEVA, +- (AF_Blue_Stringset)0, /* XXX */ +- AF_WRITING_SYSTEM_INDIC, +- +- af_deva_uniranges, +- 'o' /* XXX */ +- ) +- +- + /* END */ +diff --git a/src/autofit/afindic.h b/src/autofit/afindic.h +index db38e96..9e13cf7 100644 +--- a/src/autofit/afindic.h ++++ b/src/autofit/afindic.h +@@ -2,7 +2,8 @@ + /* */ + /* afindic.h */ + /* */ +-/* Auto-fitter hinting routines for Indic scripts (specification). */ ++/* Auto-fitter hinting routines for Indic writing system */ ++/* (specification). */ + /* */ + /* Copyright 2007, 2012, 2013 by */ + /* Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>. */ +@@ -30,11 +31,6 @@ FT_BEGIN_HEADER + AF_DECLARE_WRITING_SYSTEM_CLASS( af_indic_writing_system_class ) + + +- /* the indic-specific script classes */ +- +- AF_DECLARE_SCRIPT_CLASS( af_deva_script_class ) +- +- + /* */ + + FT_END_HEADER +diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c +index 15a241e..518ceeb 100644 +--- a/src/autofit/aflatin.c ++++ b/src/autofit/aflatin.c +@@ -2,7 +2,7 @@ + /* */ + /* aflatin.c */ + /* */ +-/* Auto-fitter hinting routines for latin script (body). */ ++/* Auto-fitter hinting routines for latin writing system (body). */ + /* */ + /* Copyright 2003-2013 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ +@@ -21,6 +21,7 @@ + #include FT_INTERNAL_DEBUG_H + + #include "afglobal.h" ++#include "afpic.h" + #include "aflatin.h" + #include "aferrors.h" + +@@ -61,10 +62,10 @@ + + + FT_TRACE5(( "\n" +- "latin standard widths computation (script `%s')\n" +- "=================================================\n" ++ "latin standard widths computation (style `%s')\n" ++ "================================================\n" + "\n", +- af_script_names[metrics->root.script_class->script] )); ++ af_style_names[metrics->root.style_class->style] )); + + af_glyph_hints_init( hints, face->memory ); + +@@ -78,15 +79,21 @@ + AF_LatinMetricsRec dummy[1]; + AF_Scaler scaler = &dummy->root.scaler; + ++#ifdef FT_CONFIG_OPTION_PIC ++ AF_FaceGlobals globals = metrics->root.globals; ++#endif ++ ++ AF_StyleClass style_class = metrics->root.style_class; ++ AF_ScriptClass script_class = AF_SCRIPT_CLASSES_GET ++ [style_class->script]; ++ + +- glyph_index = FT_Get_Char_Index( +- face, +- metrics->root.script_class->standard_char ); ++ glyph_index = FT_Get_Char_Index( face, script_class->standard_char ); + if ( glyph_index == 0 ) + goto Exit; + + FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n", +- metrics->root.script_class->standard_char, glyph_index )); ++ script_class->standard_char, glyph_index )); + + error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE ); + if ( error || face->glyph->outline.n_points <= 0 ) +@@ -105,7 +112,7 @@ + scaler->render_mode = FT_RENDER_MODE_NORMAL; + scaler->flags = 0; + +- af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy ); ++ af_glyph_hints_rescale( hints, (AF_StyleMetrics)dummy ); + + error = af_glyph_hints_reload( hints, &face->glyph->outline ); + if ( error ) +@@ -214,12 +221,14 @@ + AF_LatinAxis axis = &metrics->axis[AF_DIMENSION_VERT]; + FT_Outline outline; + +- AF_Blue_Stringset bss = metrics->root.script_class->blue_stringset; ++ AF_StyleClass sc = metrics->root.style_class; ++ ++ AF_Blue_Stringset bss = sc->blue_stringset; + const AF_Blue_StringRec* bs = &af_blue_stringsets[bss]; + + +- /* we walk over the blue character strings as specified in the */ +- /* script's entry in the `af_blue_stringset' array */ ++ /* we walk over the blue character strings as specified in the */ ++ /* style's entry in the `af_blue_stringset' array */ + + FT_TRACE5(( "latin blue zones computation\n" + "============================\n" +@@ -879,11 +888,11 @@ + + FT_TRACE5(( + "af_latin_metrics_scale_dim:" +- " x height alignment (script `%s'):\n" ++ " x height alignment (style `%s'):\n" + " " + " vertical scaling changed from %.4f to %.4f (by %d%%)\n" + "\n", +- af_script_names[metrics->root.script_class->script], ++ af_style_names[metrics->root.style_class->style], + axis->org_scale / 65536.0, + scale / 65536.0, + ( fitted - scaled ) * 100 / scaled )); +@@ -906,9 +915,9 @@ + metrics->root.scaler.y_delta = delta; + } + +- FT_TRACE5(( "%s widths (script `%s')\n", ++ FT_TRACE5(( "%s widths (style `%s')\n", + dim == AF_DIMENSION_HORZ ? "horizontal" : "vertical", +- af_script_names[metrics->root.script_class->script] )); ++ af_style_names[metrics->root.style_class->style] )); + + /* scale the widths */ + for ( nn = 0; nn < axis->width_count; nn++ ) +@@ -933,15 +942,15 @@ + + #ifdef FT_DEBUG_LEVEL_TRACE + if ( axis->extra_light ) +- FT_TRACE5(( "`%s' script is extra light (at current resolution)\n" ++ FT_TRACE5(( "`%s' style is extra light (at current resolution)\n" + "\n", +- af_script_names[metrics->root.script_class->script] )); ++ af_style_names[metrics->root.style_class->style] )); + #endif + + if ( dim == AF_DIMENSION_VERT ) + { +- FT_TRACE5(( "blue zones (script `%s')\n", +- af_script_names[metrics->root.script_class->script] )); ++ FT_TRACE5(( "blue zones (style `%s')\n", ++ af_style_names[metrics->root.style_class->style] )); + + /* scale the blue zones */ + for ( nn = 0; nn < axis->blue_count; nn++ ) +@@ -1797,7 +1806,7 @@ + FT_Face face = metrics->root.scaler.face; + + +- af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics ); ++ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics ); + + /* + * correct x_scale and y_scale if needed, since they may have +@@ -2148,9 +2157,9 @@ + #endif + + +- FT_TRACE5(( "latin %s edge hinting (script `%s')\n", ++ FT_TRACE5(( "latin %s edge hinting (style `%s')\n", + dim == AF_DIMENSION_VERT ? "horizontal" : "vertical", +- af_script_names[hints->metrics->script_class->script] )); ++ af_style_names[hints->metrics->style_class->style] )); + + /* we begin by aligning all stems relative to the blue zone */ + /* if needed -- that's only for horizontal edges */ +@@ -2709,111 +2718,12 @@ + + sizeof ( AF_LatinMetricsRec ), + +- (AF_Script_InitMetricsFunc) af_latin_metrics_init, +- (AF_Script_ScaleMetricsFunc)af_latin_metrics_scale, +- (AF_Script_DoneMetricsFunc) NULL, +- +- (AF_Script_InitHintsFunc) af_latin_hints_init, +- (AF_Script_ApplyHintsFunc) af_latin_hints_apply +- ) +- +- +- /* XXX: this should probably fine tuned to differentiate better between */ +- /* scripts... */ +- +- static const AF_Script_UniRangeRec af_latn_uniranges[] = +- { +- AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ +- AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ +- AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ +- AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ +- AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ +- AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ +- AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ +- AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ +- AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ +- AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ +- AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ +- AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ +- AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ +- AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */ +- AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ +- AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ +- AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ +- AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ +- 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 ) +- }; +- +- static const AF_Script_UniRangeRec af_grek_uniranges[] = +- { +- AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ +- AF_UNIRANGE_REC( 0x1F00UL, 0x1FFFUL ), /* Greek Extended */ +- AF_UNIRANGE_REC( 0UL, 0UL ) +- }; +- +- static const AF_Script_UniRangeRec af_cyrl_uniranges[] = +- { +- AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ +- AF_UNIRANGE_REC( 0x0500UL, 0x052FUL ), /* Cyrillic Supplement */ +- AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */ +- AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */ +- AF_UNIRANGE_REC( 0UL, 0UL ) +- }; +- +- static const AF_Script_UniRangeRec af_hebr_uniranges[] = +- { +- AF_UNIRANGE_REC( 0x0590UL, 0x05FFUL ), /* Hebrew */ +- AF_UNIRANGE_REC( 0xFB1DUL, 0xFB4FUL ), /* Alphab. Present. Forms (Hebrew) */ +- AF_UNIRANGE_REC( 0UL, 0UL ) +- }; +- +- +- AF_DEFINE_SCRIPT_CLASS( +- af_latn_script_class, +- +- AF_SCRIPT_LATN, +- AF_BLUE_STRINGSET_LATN, +- AF_WRITING_SYSTEM_LATIN, +- +- af_latn_uniranges, +- 'o' +- ) +- +- AF_DEFINE_SCRIPT_CLASS( +- af_grek_script_class, +- +- AF_SCRIPT_GREK, +- AF_BLUE_STRINGSET_GREK, +- AF_WRITING_SYSTEM_LATIN, +- +- af_grek_uniranges, +- 0x3BF /* ο */ +- ) +- +- AF_DEFINE_SCRIPT_CLASS( +- af_cyrl_script_class, +- +- AF_SCRIPT_CYRL, +- AF_BLUE_STRINGSET_CYRL, +- AF_WRITING_SYSTEM_LATIN, +- +- af_cyrl_uniranges, +- 0x43E /* о */ +- ) +- +- AF_DEFINE_SCRIPT_CLASS( +- af_hebr_script_class, +- +- AF_SCRIPT_HEBR, +- AF_BLUE_STRINGSET_HEBR, +- AF_WRITING_SYSTEM_LATIN, ++ (AF_WritingSystem_InitMetricsFunc) af_latin_metrics_init, ++ (AF_WritingSystem_ScaleMetricsFunc)af_latin_metrics_scale, ++ (AF_WritingSystem_DoneMetricsFunc) NULL, + +- af_hebr_uniranges, +- 0x5DD /* ם */ ++ (AF_WritingSystem_InitHintsFunc) af_latin_hints_init, ++ (AF_WritingSystem_ApplyHintsFunc) af_latin_hints_apply + ) + + +diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h +index c06cbd9..a958af3 100644 +--- a/src/autofit/aflatin.h ++++ b/src/autofit/aflatin.h +@@ -2,7 +2,8 @@ + /* */ + /* aflatin.h */ + /* */ +-/* Auto-fitter hinting routines for latin script (specification). */ ++/* Auto-fitter hinting routines for latin writing system */ ++/* (specification). */ + /* */ + /* Copyright 2003-2007, 2009, 2011-2013 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ +@@ -29,17 +30,6 @@ FT_BEGIN_HEADER + AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin_writing_system_class ) + + +- /* the latin-specific script classes */ +- +- AF_DECLARE_SCRIPT_CLASS( af_cyrl_script_class ) +- AF_DECLARE_SCRIPT_CLASS( af_grek_script_class ) +- AF_DECLARE_SCRIPT_CLASS( af_latn_script_class ) +- AF_DECLARE_SCRIPT_CLASS( af_hebr_script_class ) +-#if 0 +- AF_DECLARE_SCRIPT_CLASS( af_armn_script_class ) +-#endif +- +- + /* 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 ) +@@ -56,8 +46,8 @@ FT_BEGIN_HEADER + + /* + * The following declarations could be embedded in the file `aflatin.c'; +- * they have been made semi-public to allow alternate script hinters to +- * re-use some of them. ++ * they have been made semi-public to allow alternate writing system ++ * hinters to re-use some of them. + */ + + +@@ -113,9 +103,9 @@ FT_BEGIN_HEADER + + typedef struct AF_LatinMetricsRec_ + { +- AF_ScriptMetricsRec root; +- FT_UInt units_per_em; +- AF_LatinAxisRec axis[AF_DIMENSION_MAX]; ++ AF_StyleMetricsRec root; ++ FT_UInt units_per_em; ++ AF_LatinAxisRec axis[AF_DIMENSION_MAX]; + + } AF_LatinMetricsRec, *AF_LatinMetrics; + +@@ -171,7 +161,7 @@ FT_BEGIN_HEADER + + /* + * The next functions shouldn't normally be exported. However, other +- * scripts might like to use these functions as-is. ++ * writing systems might like to use these functions as-is. + */ + FT_LOCAL( FT_Error ) + af_latin_hints_compute_segments( AF_GlyphHints hints, +diff --git a/src/autofit/aflatin2.c b/src/autofit/aflatin2.c +index a6d564a..930fa98 100644 +--- a/src/autofit/aflatin2.c ++++ b/src/autofit/aflatin2.c +@@ -2,7 +2,7 @@ + /* */ + /* aflatin2.c */ + /* */ +-/* Auto-fitter hinting routines for latin script (body). */ ++/* Auto-fitter hinting routines for latin writing system (body). */ + /* */ + /* Copyright 2003-2013 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ +@@ -78,7 +78,7 @@ + + glyph_index = FT_Get_Char_Index( + face, +- metrics->root.script_class->standard_char ); ++ metrics->root.style_class->standard_char ); + if ( glyph_index == 0 ) + goto Exit; + +@@ -95,7 +95,7 @@ + scaler->render_mode = FT_RENDER_MODE_NORMAL; + scaler->flags = 0; + +- af_glyph_hints_rescale( hints, (AF_ScriptMetrics)dummy ); ++ af_glyph_hints_rescale( hints, (AF_StyleMetrics)dummy ); + + error = af_glyph_hints_reload( hints, &face->glyph->outline ); + if ( error ) +@@ -1501,7 +1501,7 @@ + FT_Face face = metrics->root.scaler.face; + + +- af_glyph_hints_rescale( hints, (AF_ScriptMetrics)metrics ); ++ af_glyph_hints_rescale( hints, (AF_StyleMetrics)metrics ); + + /* + * correct x_scale and y_scale if needed, since they may have +@@ -2387,61 +2387,12 @@ + + sizeof ( AF_LatinMetricsRec ), + +- (AF_Script_InitMetricsFunc) af_latin2_metrics_init, +- (AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale, +- (AF_Script_DoneMetricsFunc) NULL, ++ (AF_WritingSystem_InitMetricsFunc) af_latin2_metrics_init, ++ (AF_WritingSystem_ScaleMetricsFunc)af_latin2_metrics_scale, ++ (AF_WritingSystem_DoneMetricsFunc) NULL, + +- (AF_Script_InitHintsFunc) af_latin2_hints_init, +- (AF_Script_ApplyHintsFunc) af_latin2_hints_apply +- ) +- +- +- /* XXX: this should probably fine tuned to differentiate better between */ +- /* scripts... */ +- +- static const AF_Script_UniRangeRec af_ltn2_uniranges[] = +- { +- AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ +- AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ +- AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ +- AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ +- AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ +- AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ +- AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ +- AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ +- AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ +- AF_UNIRANGE_REC( 0x0500UL, 0x052FUL ), /* Cyrillic Supplement */ +- AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ +- AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ +- AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ +- AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ +- AF_UNIRANGE_REC( 0x1F00UL, 0x1FFFUL ), /* Greek Extended */ +- AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ +- AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ +- AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */ +- AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ +- 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_ltn2_script_class, +- +- AF_SCRIPT_LTN2, +- AF_BLUE_STRINGSET_LATN, +- AF_WRITING_SYSTEM_LATIN2, +- +- af_ltn2_uniranges, +- 'o' ++ (AF_WritingSystem_InitHintsFunc) af_latin2_hints_init, ++ (AF_WritingSystem_ApplyHintsFunc) af_latin2_hints_apply + ) + + +diff --git a/src/autofit/aflatin2.h b/src/autofit/aflatin2.h +index f7f6d8d..b5d252a 100644 +--- a/src/autofit/aflatin2.h ++++ b/src/autofit/aflatin2.h +@@ -2,7 +2,8 @@ + /* */ + /* aflatin2.h */ + /* */ +-/* Auto-fitter hinting routines for latin script (specification). */ ++/* Auto-fitter hinting routines for latin writing system */ ++/* (specification). */ + /* */ + /* Copyright 2003-2007, 2012, 2013 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ +@@ -30,17 +31,6 @@ FT_BEGIN_HEADER + AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin2_writing_system_class ) + + +- /* the latin-specific script classes */ +- +- AF_DECLARE_SCRIPT_CLASS( af_ltn2_script_class ) /* XXX */ +-#if 0 +- AF_DECLARE_SCRIPT_CLASS( af_arm2_script_class ) +- AF_DECLARE_SCRIPT_CLASS( af_cyr2_script_class ) +- AF_DECLARE_SCRIPT_CLASS( af_grk2_script_class ) +- AF_DECLARE_SCRIPT_CLASS( af_hbr2_script_class ) +-#endif +- +- + /* */ + + FT_END_HEADER +diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c +index b49f8c0..80c3950 100644 +--- a/src/autofit/afloader.c ++++ b/src/autofit/afloader.c +@@ -109,7 +109,7 @@ + FT_Error error; + FT_Face face = loader->face; + FT_GlyphLoader gloader = loader->gloader; +- AF_ScriptMetrics metrics = loader->metrics; ++ AF_StyleMetrics metrics = loader->metrics; + AF_GlyphHints hints = &loader->hints; + FT_GlyphSlot slot = face->glyph; + FT_Slot_Internal internal = slot->internal; +@@ -183,17 +183,17 @@ + /* automatic hinting process */ + { + #ifdef FT_CONFIG_OPTION_PIC +- AF_FaceGlobals globals = loader->globals; ++ AF_FaceGlobals globals = loader->globals; + #endif ++ AF_StyleClass style_class = metrics->style_class; + AF_WritingSystemClass writing_system_class = +- AF_WRITING_SYSTEM_CLASSES_GET +- [metrics->script_class->writing_system]; ++ AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + + +- if ( writing_system_class->script_hints_apply ) +- writing_system_class->script_hints_apply( hints, +- &gloader->current.outline, +- metrics ); ++ if ( writing_system_class->style_hints_apply ) ++ writing_system_class->style_hints_apply( hints, ++ &gloader->current.outline, ++ metrics ); + } + + /* we now need to adjust the metrics according to the change in */ +@@ -529,14 +529,14 @@ + error = af_loader_reset( module, face ); + if ( !error ) + { +- AF_ScriptMetrics metrics; +- FT_UInt options = AF_SCRIPT_DFLT; ++ AF_StyleMetrics metrics; ++ FT_UInt options = AF_STYLE_NONE_DEFAULT; + + + #ifdef FT_OPTION_AUTOFIT2 + /* XXX: undocumented hook to activate the latin2 writing system */ + if ( load_flags & ( 1UL << 20 ) ) +- options = AF_SCRIPT_LTN2; ++ options = AF_STYLE_LTN2_DEFAULT; + #endif + + error = af_face_globals_get_metrics( loader->globals, gindex, +@@ -544,27 +544,27 @@ + if ( !error ) + { + #ifdef FT_CONFIG_OPTION_PIC +- AF_FaceGlobals globals = loader->globals; ++ AF_FaceGlobals globals = loader->globals; + #endif ++ AF_StyleClass style_class = metrics->style_class; + AF_WritingSystemClass writing_system_class = +- AF_WRITING_SYSTEM_CLASSES_GET +- [metrics->script_class->writing_system]; ++ AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system]; + + + loader->metrics = metrics; + +- if ( writing_system_class->script_metrics_scale ) +- writing_system_class->script_metrics_scale( metrics, &scaler ); ++ if ( writing_system_class->style_metrics_scale ) ++ writing_system_class->style_metrics_scale( metrics, &scaler ); + else + metrics->scaler = scaler; + + load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM; + load_flags &= ~FT_LOAD_RENDER; + +- if ( writing_system_class->script_hints_init ) ++ if ( writing_system_class->style_hints_init ) + { +- error = writing_system_class->script_hints_init( &loader->hints, +- metrics ); ++ error = writing_system_class->style_hints_init( &loader->hints, ++ metrics ); + if ( error ) + goto Exit; + } +diff --git a/src/autofit/afloader.h b/src/autofit/afloader.h +index 1f34d17..9601e24 100644 +--- a/src/autofit/afloader.h ++++ b/src/autofit/afloader.h +@@ -4,7 +4,7 @@ + /* */ + /* Auto-fitter glyph loading routines (specification). */ + /* */ +-/* Copyright 2003-2005, 2011-2012 by */ ++/* Copyright 2003-2005, 2011-2013 by */ + /* David Turner, Robert Wilhelm, and Werner Lemberg. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -44,7 +44,7 @@ FT_BEGIN_HEADER + /* current glyph data */ + FT_GlyphLoader gloader; + AF_GlyphHintsRec hints; +- AF_ScriptMetrics metrics; ++ AF_StyleMetrics metrics; + FT_Bool transformed; + FT_Matrix trans_matrix; + FT_Vector trans_delta; +diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c +index b1bb5ee..1ebe4a4 100644 +--- a/src/autofit/afmodule.c ++++ b/src/autofit/afmodule.c +@@ -60,8 +60,8 @@ + globals = (AF_FaceGlobals)face->autohint.data; + if ( !globals ) + { +- /* trigger computation of the global script data */ +- /* in case it hasn't been done yet */ ++ /* trigger computation of the global style data */ ++ /* in case it hasn't been done yet */ + error = af_face_globals_new( face, &globals, module ); + if ( !error ) + { +@@ -134,7 +134,7 @@ + + error = af_property_get_face_globals( prop->face, &globals, module ); + if ( !error ) +- prop->map = globals->glyph_scripts; ++ prop->map = globals->glyph_styles; + + return error; + } +diff --git a/src/autofit/afpic.c b/src/autofit/afpic.c +index 92d696d..eba6a89 100644 +--- a/src/autofit/afpic.c ++++ b/src/autofit/afpic.c +@@ -20,6 +20,7 @@ + #include FT_FREETYPE_H + #include FT_INTERNAL_OBJECTS_H + #include "afpic.h" ++#include "afglobal.h" + #include "aferrors.h" + + +@@ -42,7 +43,7 @@ + FT_AutoHinter_InterfaceRec* clazz ); + + +- /* forward declaration of PIC init functions from script classes */ ++ /* forward declaration of PIC init functions from writing system classes */ + #undef WRITING_SYSTEM + #define WRITING_SYSTEM( ws, WS ) /* empty */ + +@@ -97,15 +98,20 @@ + + FT_Init_Class_af_service_properties( &container->af_service_properties ); + +- for ( ss = 0; ss < AF_WRITING_SYSTEM_MAX - 1; ss++ ) ++ for ( ss = 0; ss < AF_WRITING_SYSTEM_MAX; ss++ ) + container->af_writing_system_classes[ss] = + &container->af_writing_system_classes_rec[ss]; +- container->af_writing_system_classes[AF_WRITING_SYSTEM_MAX - 1] = NULL; ++ container->af_writing_system_classes[AF_WRITING_SYSTEM_MAX] = NULL; + +- for ( ss = 0; ss < AF_SCRIPT_MAX - 1; ss++ ) ++ for ( ss = 0; ss < AF_SCRIPT_MAX; ss++ ) + container->af_script_classes[ss] = + &container->af_script_classes_rec[ss]; +- container->af_script_classes[AF_SCRIPT_MAX - 1] = NULL; ++ container->af_script_classes[AF_SCRIPT_MAX] = NULL; ++ ++ for ( ss = 0; ss < AF_STYLE_MAX; ss++ ) ++ container->af_style_classes[ss] = ++ &container->af_style_classes_rec[ss]; ++ container->af_style_classes[AF_STYLE_MAX] = NULL; + + #undef WRITING_SYSTEM + #define WRITING_SYSTEM( ws, WS ) \ +@@ -116,13 +122,21 @@ + #include "afwrtsys.h" + + #undef SCRIPT +-#define SCRIPT( s, S, d ) \ ++#define SCRIPT( s, S, d, dc ) \ + FT_Init_Class_af_ ## s ## _script_class( \ + &container->af_script_classes_rec[ss++] ); + + ss = 0; + #include "afscript.h" + ++#undef STYLE ++#define STYLE( s, S, d, ws, sc, bss ) \ ++ FT_Init_Class_af_ ## s ## _style_class( \ ++ &container->af_style_classes_rec[ss++] ); ++ ++ ss = 0; ++#include "afstyles.h" ++ + FT_Init_Class_af_autofitter_interface( + library, &container->af_autofitter_interface ); + +diff --git a/src/autofit/afpic.h b/src/autofit/afpic.h +index 09f8258..9a68b4a 100644 +--- a/src/autofit/afpic.h ++++ b/src/autofit/afpic.h +@@ -32,6 +32,7 @@ FT_BEGIN_HEADER + + #define AF_WRITING_SYSTEM_CLASSES_GET af_writing_system_classes + #define AF_SCRIPT_CLASSES_GET af_script_classes ++#define AF_STYLE_CLASSES_GET af_style_classes + #define AF_INTERFACE_GET af_autofitter_interface + + #else /* FT_CONFIG_OPTION_PIC */ +@@ -48,14 +49,19 @@ FT_BEGIN_HEADER + FT_Service_PropertiesRec af_service_properties; + + AF_WritingSystemClass af_writing_system_classes +- [AF_WRITING_SYSTEM_MAX]; ++ [AF_WRITING_SYSTEM_MAX + 1]; + AF_WritingSystemClassRec af_writing_system_classes_rec +- [AF_WRITING_SYSTEM_MAX - 1]; ++ [AF_WRITING_SYSTEM_MAX]; + + AF_ScriptClass af_script_classes +- [AF_SCRIPT_MAX]; ++ [AF_SCRIPT_MAX + 1]; + AF_ScriptClassRec af_script_classes_rec +- [AF_SCRIPT_MAX - 1]; ++ [AF_SCRIPT_MAX]; ++ ++ AF_StyleClass af_style_classes ++ [AF_STYLE_MAX + 1]; ++ AF_StyleClassRec af_style_classes_rec ++ [AF_STYLE_MAX]; + + FT_AutoHinter_InterfaceRec af_autofitter_interface; + +@@ -74,6 +80,8 @@ FT_BEGIN_HEADER + ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_writing_system_classes ) + #define AF_SCRIPT_CLASSES_GET \ + ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_script_classes ) ++#define AF_STYLE_CLASSES_GET \ ++ ( GET_PIC( FT_FACE_LIBRARY( globals->face ) )->af_style_classes ) + #define AF_INTERFACE_GET \ + ( GET_PIC( library )->af_autofitter_interface ) + +diff --git a/src/autofit/afranges.c b/src/autofit/afranges.c +new file mode 100644 +index 0000000..607733c +--- /dev/null ++++ b/src/autofit/afranges.c +@@ -0,0 +1,154 @@ ++/***************************************************************************/ ++/* */ ++/* afranges.c */ ++/* */ ++/* Auto-fitter Unicode script ranges (body). */ ++/* */ ++/* Copyright 2013 by */ ++/* David Turner, Robert Wilhelm, and Werner Lemberg. */ ++/* */ ++/* This file is part of the FreeType project, and may only be used, */ ++/* modified, and distributed under the terms of the FreeType project */ ++/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ ++/* this file you indicate that you have read the license and */ ++/* understand and accept it fully. */ ++/* */ ++/***************************************************************************/ ++ ++ ++#include "afranges.h" ++ ++ ++ /* XXX: this should probably fine tuned to differentiate better between */ ++ /* scripts... */ ++ ++ const AF_Script_UniRangeRec af_cyrl_uniranges[] = ++ { ++ AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */ ++ AF_UNIRANGE_REC( 0x0500UL, 0x052FUL ), /* Cyrillic Supplement */ ++ AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */ ++ AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */ ++ AF_UNIRANGE_REC( 0UL, 0UL ) ++ }; ++ ++#ifdef AF_CONFIG_OPTION_INDIC ++ ++ const AF_Script_UniRangeRec af_deva_uniranges[] = ++ { ++ 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 ) ++ }; ++ ++#else /* !AF_CONFIG_OPTION_INDIC */ ++ ++ const AF_Script_UniRangeRec af_deva_uniranges[] = ++ { ++ AF_UNIRANGE_REC( 0UL, 0UL ) ++ }; ++ ++#endif /* !AF_CONFIG_OPTION_INDIC */ ++ ++ const AF_Script_UniRangeRec af_grek_uniranges[] = ++ { ++ AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */ ++ AF_UNIRANGE_REC( 0x1F00UL, 0x1FFFUL ), /* Greek Extended */ ++ AF_UNIRANGE_REC( 0UL, 0UL ) ++ }; ++ ++#ifdef AF_CONFIG_OPTION_CJK ++ ++ /* this corresponds to Unicode 6.0 */ ++ ++ const AF_Script_UniRangeRec af_hani_uniranges[] = ++ { ++ 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 */ ++ AF_UNIRANGE_REC( 0x3200UL, 0x32FFUL ), /* Enclosed CJK Letters and Months */ ++ AF_UNIRANGE_REC( 0x3300UL, 0x33FFUL ), /* CJK Compatibility */ ++ 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 ) ++ }; ++ ++#else /* !AF_CONFIG_OPTION_CJK */ ++ ++ const AF_Script_UniRangeRec af_hani_uniranges[] = ++ { ++ AF_UNIRANGE_REC( 0UL, 0UL ) ++ }; ++ ++#endif /* !AF_CONFIG_OPTION_CJK */ ++ ++ const AF_Script_UniRangeRec af_hebr_uniranges[] = ++ { ++ AF_UNIRANGE_REC( 0x0590UL, 0x05FFUL ), /* Hebrew */ ++ AF_UNIRANGE_REC( 0xFB1DUL, 0xFB4FUL ), /* Alphab. Present. Forms (Hebrew) */ ++ AF_UNIRANGE_REC( 0UL, 0UL ) ++ }; ++ ++ const AF_Script_UniRangeRec af_latn_uniranges[] = ++ { ++ AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */ ++ AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */ ++ AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */ ++ AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */ ++ AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */ ++ AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */ ++ AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */ ++ AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */ ++ AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */ ++ AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */ ++ AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */ ++ AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */ ++ AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */ ++ AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */ ++ AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */ ++ AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */ ++ AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ ++ AF_UNIRANGE_REC( 0x2E00UL, 0x2E7FUL ), /* Supplemental Punctuation */ ++ 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 ) ++ }; ++ ++ const AF_Script_UniRangeRec af_none_uniranges[] = ++ { ++ AF_UNIRANGE_REC( 0UL, 0UL ) ++ }; ++ ++ ++/* END */ +diff --git a/src/autofit/afranges.h b/src/autofit/afranges.h +new file mode 100644 +index 0000000..8869695 +--- /dev/null ++++ b/src/autofit/afranges.h +@@ -0,0 +1,41 @@ ++/***************************************************************************/ ++/* */ ++/* afranges.h */ ++/* */ ++/* Auto-fitter Unicode script ranges (specification). */ ++/* */ ++/* Copyright 2013 by */ ++/* David Turner, Robert Wilhelm, and Werner Lemberg. */ ++/* */ ++/* This file is part of the FreeType project, and may only be used, */ ++/* modified, and distributed under the terms of the FreeType project */ ++/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ ++/* this file you indicate that you have read the license and */ ++/* understand and accept it fully. */ ++/* */ ++/***************************************************************************/ ++ ++ ++#ifndef __AFRANGES_H__ ++#define __AFRANGES_H__ ++ ++ ++#include "aftypes.h" ++ ++ ++FT_BEGIN_HEADER ++ ++#undef SCRIPT ++#define SCRIPT( s, S, d, dc ) \ ++ extern const AF_Script_UniRangeRec af_ ## s ## _uniranges[]; ++ ++#include "afscript.h" ++ ++ /* */ ++ ++FT_END_HEADER ++ ++#endif /* __AFRANGES_H__ */ ++ ++ ++/* END */ +diff --git a/src/autofit/afscript.h b/src/autofit/afscript.h +index be0169a..063f2af 100644 +--- a/src/autofit/afscript.h ++++ b/src/autofit/afscript.h +@@ -22,16 +22,33 @@ + + /* Add new scripts here. */ + +- SCRIPT( cyrl, CYRL, "Cyrillic" ) +- SCRIPT( deva, DEVA, "Indic scripts" ) +- SCRIPT( dflt, DFLT, "no script" ) +- SCRIPT( grek, GREK, "Greek" ) +- SCRIPT( hani, HANI, "CJKV ideographs" ) +- SCRIPT( hebr, HEBR, "Hebrew" ) +- SCRIPT( latn, LATN, "Latin" ) +-#ifdef FT_OPTION_AUTOFIT2 +- SCRIPT( ltn2, LTN2, "Latin 2" ) +-#endif ++ SCRIPT( cyrl, CYRL, ++ "Cyrillic", ++ 0x43E ) /* о */ ++ ++ SCRIPT( deva, DEVA, ++ "Indic scripts", ++ 'o' ) /* XXX */ ++ ++ SCRIPT( none, NONE, ++ "no script", ++ '\0' ) ++ ++ SCRIPT( grek, GREK, ++ "Greek", ++ 0x3BF ) /* ο */ ++ ++ SCRIPT( hani, HANI, ++ "CJKV ideographs", ++ 0x7530 ) /* 田 */ ++ ++ SCRIPT( hebr, HEBR, ++ "Hebrew", ++ 0x5DD ) /* ם */ ++ ++ SCRIPT( latn, LATN, ++ "Latin", ++ 'o' ) + + + /* END */ +diff --git a/src/autofit/afstyles.h b/src/autofit/afstyles.h +new file mode 100644 +index 0000000..ded8048 +--- /dev/null ++++ b/src/autofit/afstyles.h +@@ -0,0 +1,76 @@ ++/***************************************************************************/ ++/* */ ++/* afstyles.h */ ++/* */ ++/* Auto-fitter styles (specification only). */ ++/* */ ++/* Copyright 2013 by */ ++/* David Turner, Robert Wilhelm, and Werner Lemberg. */ ++/* */ ++/* This file is part of the FreeType project, and may only be used, */ ++/* modified, and distributed under the terms of the FreeType project */ ++/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ ++/* this file you indicate that you have read the license and */ ++/* understand and accept it fully. */ ++/* */ ++/***************************************************************************/ ++ ++ ++ /* The following part can be included multiple times. */ ++ /* Define `STYLE' as needed. */ ++ ++ ++ /* Add new styles here. */ ++ ++ STYLE( cyrl_default, CYRL_DEFAULT, ++ "Cyrillic default style", ++ AF_WRITING_SYSTEM_LATIN, ++ AF_SCRIPT_CYRL, ++ AF_BLUE_STRINGSET_CYRL ) ++ ++ STYLE( deva_default, DEVA_DEFAULT, ++ "Indic scripts default style", ++ AF_WRITING_SYSTEM_INDIC, ++ AF_SCRIPT_DEVA, ++ (AF_Blue_Stringset)0 ) /* XXX */ ++ ++ STYLE( none_default, NONE_DEFAULT, ++ "no style", ++ AF_WRITING_SYSTEM_DUMMY, ++ AF_SCRIPT_NONE, ++ (AF_Blue_Stringset)0 ) ++ ++ STYLE( grek_default, GREK_DEFAULT, ++ "Greek default style", ++ AF_WRITING_SYSTEM_LATIN, ++ AF_SCRIPT_GREK, ++ AF_BLUE_STRINGSET_GREK ) ++ ++ STYLE( hani_default, HANI_DEFAULT, ++ "CJKV ideographs default style", ++ AF_WRITING_SYSTEM_CJK, ++ AF_SCRIPT_HANI, ++ AF_BLUE_STRINGSET_HANI ) ++ ++ STYLE( hebr_default, HEBR_DEFAULT, ++ "Hebrew default style", ++ AF_WRITING_SYSTEM_LATIN, ++ AF_SCRIPT_HEBR, ++ AF_BLUE_STRINGSET_HEBR ) ++ ++ STYLE( latn_default, LATN_DEFAULT, ++ "Latin default style", ++ AF_WRITING_SYSTEM_LATIN, ++ AF_SCRIPT_LATN, ++ AF_BLUE_STRINGSET_LATN ) ++ ++#ifdef FT_OPTION_AUTOFIT2 ++ STYLE( ltn2_default, LTN2_DEFAULT, ++ "Latin 2 default style", ++ AF_WRITING_SYSTEM_LATIN2, ++ AF_SCRIPT_LATN, ++ AF_BLUE_STRINGSET_LATN ) ++#endif ++ ++ ++/* END */ +diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h +index cda1f89..70ddc7f 100644 +--- a/src/autofit/aftypes.h ++++ b/src/autofit/aftypes.h +@@ -20,7 +20,7 @@ + * + * The auto-fitter is a complete rewrite of the old auto-hinter. + * Its main feature is the ability to differentiate between different +- * writing systems in order to apply script-specific rules. ++ * writing systems and scripts in order to apply specific rules. + * + * The code has also been compartmentized into several entities that + * should make algorithmic experimentation easier than with the old +@@ -197,55 +197,31 @@ extern void* _af_debug_hints; + (a)->y_delta == (b)->y_delta ) + + +- /*************************************************************************/ +- /*************************************************************************/ +- /***** *****/ +- /***** S C R I P T M E T R I C S *****/ +- /***** *****/ +- /*************************************************************************/ +- /*************************************************************************/ +- +- /* This is the main structure which combines writing systems and script */ +- /* data (for a given face object, see below). */ +- +- typedef struct AF_WritingSystemClassRec_ const* AF_WritingSystemClass; +- typedef struct AF_ScriptClassRec_ const* AF_ScriptClass; +- typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; +- +- typedef struct AF_ScriptMetricsRec_ +- { +- AF_ScriptClass script_class; +- AF_ScalerRec scaler; +- FT_Bool digits_have_same_width; +- +- AF_FaceGlobals globals; /* to access properties */ +- +- } AF_ScriptMetricsRec, *AF_ScriptMetrics; +- ++ typedef struct AF_StyleMetricsRec_* AF_StyleMetrics; + + /* This function parses an FT_Face to compute global metrics for +- * a specific script. ++ * a specific style. + */ + typedef FT_Error +- (*AF_Script_InitMetricsFunc)( AF_ScriptMetrics metrics, +- FT_Face face ); ++ (*AF_WritingSystem_InitMetricsFunc)( AF_StyleMetrics metrics, ++ FT_Face face ); + + typedef void +- (*AF_Script_ScaleMetricsFunc)( AF_ScriptMetrics metrics, +- AF_Scaler scaler ); ++ (*AF_WritingSystem_ScaleMetricsFunc)( AF_StyleMetrics metrics, ++ AF_Scaler scaler ); + + typedef void +- (*AF_Script_DoneMetricsFunc)( AF_ScriptMetrics metrics ); ++ (*AF_WritingSystem_DoneMetricsFunc)( AF_StyleMetrics metrics ); + + + typedef FT_Error +- (*AF_Script_InitHintsFunc)( AF_GlyphHints hints, +- AF_ScriptMetrics metrics ); ++ (*AF_WritingSystem_InitHintsFunc)( AF_GlyphHints hints, ++ AF_StyleMetrics metrics ); + + typedef void +- (*AF_Script_ApplyHintsFunc)( AF_GlyphHints hints, +- FT_Outline* outline, +- AF_ScriptMetrics metrics ); ++ (*AF_WritingSystem_ApplyHintsFunc)( AF_GlyphHints hints, ++ FT_Outline* outline, ++ AF_StyleMetrics metrics ); + + + /*************************************************************************/ +@@ -257,14 +233,14 @@ extern void* _af_debug_hints; + /*************************************************************************/ + + /* +- * In FreeType, a writing system consists of multiple scripts which can ++ * In FreeType, a writing system consists of multiple scripts that can + * be handled similarly *in a typographical way*; the relationship is not + * based on history. For example, both the Greek and the unrelated + * Armenian scripts share the same features like ascender, descender, + * x-height, etc. Essentially, a writing system is covered by a + * submodule of the auto-fitter; it contains + * +- * - a specific global analyzer which computes global metrics specific to ++ * - a specific global analyzer that computes global metrics specific to + * the script (based on script-specific characters to identify ascender + * height, x-height, etc.), + * +@@ -297,16 +273,18 @@ extern void* _af_debug_hints; + { + AF_WritingSystem writing_system; + +- FT_Offset script_metrics_size; +- AF_Script_InitMetricsFunc script_metrics_init; +- AF_Script_ScaleMetricsFunc script_metrics_scale; +- AF_Script_DoneMetricsFunc script_metrics_done; ++ FT_Offset style_metrics_size; ++ AF_WritingSystem_InitMetricsFunc style_metrics_init; ++ AF_WritingSystem_ScaleMetricsFunc style_metrics_scale; ++ AF_WritingSystem_DoneMetricsFunc style_metrics_done; + +- AF_Script_InitHintsFunc script_hints_init; +- AF_Script_ApplyHintsFunc script_hints_apply; ++ AF_WritingSystem_InitHintsFunc style_hints_init; ++ AF_WritingSystem_ApplyHintsFunc style_hints_apply; + + } AF_WritingSystemClassRec; + ++ typedef const AF_WritingSystemClassRec* AF_WritingSystemClass; ++ + + /*************************************************************************/ + /*************************************************************************/ +@@ -317,15 +295,15 @@ extern void* _af_debug_hints; + /*************************************************************************/ + + /* +- * Each script is associated with a set of Unicode ranges which gets used +- * to test whether the font face supports the script. It also references +- * the writing system it belongs to. ++ * Each script is associated with a set of Unicode ranges that gets used ++ * to test whether the font face supports the script. + * +- * We use four-letter script tags from the OpenType specification. ++ * We use four-letter script tags from the OpenType specification, ++ * extended by `NONE', which indicates `no script'. + */ + + #undef SCRIPT +-#define SCRIPT( s, S, d ) \ ++#define SCRIPT( s, S, d, dc ) \ + AF_SCRIPT_ ## S, + + /* The list of known scripts. */ +@@ -353,15 +331,81 @@ extern void* _af_debug_hints; + + typedef struct AF_ScriptClassRec_ + { +- AF_Script script; +- AF_Blue_Stringset blue_stringset; +- AF_WritingSystem writing_system; ++ AF_Script script; + + AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ + FT_UInt32 standard_char; /* for default width and height */ + + } AF_ScriptClassRec; + ++ typedef const AF_ScriptClassRec* AF_ScriptClass; ++ ++ ++ /*************************************************************************/ ++ /*************************************************************************/ ++ /***** *****/ ++ /***** S T Y L E S *****/ ++ /***** *****/ ++ /*************************************************************************/ ++ /*************************************************************************/ ++ ++ /* ++ * The topmost structure for modelling the auto-hinter glyph input data ++ * is a `style class', grouping everything together. ++ */ ++ ++#undef STYLE ++#define STYLE( s, S, d, ws, sc, ss ) \ ++ AF_STYLE_ ## S, ++ ++ /* The list of known styles. */ ++ typedef enum AF_Style_ ++ { ++ ++#include "afstyles.h" ++ ++ AF_STYLE_MAX /* do not remove */ ++ ++ } AF_Style; ++ ++ ++ typedef struct AF_StyleClassRec_ ++ { ++ AF_Style style; ++ ++ AF_WritingSystem writing_system; ++ AF_Script script; ++ AF_Blue_Stringset blue_stringset; ++ ++ } AF_StyleClassRec; ++ ++ typedef const AF_StyleClassRec* AF_StyleClass; ++ ++ ++ /*************************************************************************/ ++ /*************************************************************************/ ++ /***** *****/ ++ /***** S T Y L E M E T R I C S *****/ ++ /***** *****/ ++ /*************************************************************************/ ++ /*************************************************************************/ ++ ++ typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals; ++ ++ /* This is the main structure that combines everything. Autofit modules */ ++ /* specific to writing systems derive their structures from it, for */ ++ /* example `AF_LatinMetrics'. */ ++ ++ typedef struct AF_StyleMetricsRec_ ++ { ++ AF_StyleClass style_class; ++ AF_ScalerRec scaler; ++ FT_Bool digits_have_same_width; ++ ++ AF_FaceGlobals globals; /* to access properties */ ++ ++ } AF_StyleMetricsRec; ++ + + /* Declare and define vtables for classes */ + #ifndef FT_CONFIG_OPTION_PIC +@@ -401,21 +445,37 @@ extern void* _af_debug_hints; + + #define AF_DEFINE_SCRIPT_CLASS( \ + script_class, \ +- script_, \ +- blue_stringset_, \ +- writing_system_, \ ++ script, \ + ranges, \ + std_char ) \ + FT_CALLBACK_TABLE_DEF \ + const AF_ScriptClassRec script_class = \ + { \ +- script_, \ +- blue_stringset_, \ +- writing_system_, \ ++ script, \ + ranges, \ + std_char \ + }; + ++ ++#define AF_DECLARE_STYLE_CLASS( style_class ) \ ++ FT_CALLBACK_TABLE const AF_StyleClassRec \ ++ style_class; ++ ++#define AF_DEFINE_STYLE_CLASS( \ ++ style_class, \ ++ style, \ ++ writing_system, \ ++ script, \ ++ blue_stringset ) \ ++ FT_CALLBACK_TABLE_DEF \ ++ const AF_StyleClassRec style_class = \ ++ { \ ++ style, \ ++ writing_system, \ ++ script, \ ++ blue_stringset \ ++ }; ++ + #else /* FT_CONFIG_OPTION_PIC */ + + #define AF_DECLARE_WRITING_SYSTEM_CLASS( writing_system_class ) \ +@@ -434,16 +494,16 @@ extern void* _af_debug_hints; + FT_LOCAL_DEF( void ) \ + FT_Init_Class_ ## writing_system_class( AF_WritingSystemClassRec* ac ) \ + { \ +- ac->writing_system = system; \ ++ ac->writing_system = system; \ + \ +- ac->script_metrics_size = m_size; \ ++ ac->style_metrics_size = m_size; \ + \ +- ac->script_metrics_init = m_init; \ +- ac->script_metrics_scale = m_scale; \ +- ac->script_metrics_done = m_done; \ ++ ac->style_metrics_init = m_init; \ ++ ac->style_metrics_scale = m_scale; \ ++ ac->style_metrics_done = m_done; \ + \ +- ac->script_hints_init = h_init; \ +- ac->script_hints_apply = h_apply; \ ++ ac->style_hints_init = h_init; \ ++ ac->style_hints_apply = h_apply; \ + } + + +@@ -454,20 +514,36 @@ extern void* _af_debug_hints; + #define AF_DEFINE_SCRIPT_CLASS( \ + script_class, \ + script_, \ +- blue_string_set_, \ +- writing_system_, \ + ranges, \ + std_char ) \ + FT_LOCAL_DEF( void ) \ + FT_Init_Class_ ## script_class( AF_ScriptClassRec* ac ) \ + { \ + ac->script = script_; \ +- ac->blue_stringset = blue_stringset_; \ +- ac->writing_system = writing_system_; \ + ac->script_uni_ranges = ranges; \ + ac->standard_char = std_char; \ + } + ++ ++#define AF_DECLARE_STYLE_CLASS( style_class ) \ ++ FT_LOCAL( void ) \ ++ FT_Init_Class_ ## style_class( AF_StyleClassRec* ac ); ++ ++#define AF_DEFINE_STYLE_CLASS( \ ++ style_class, \ ++ style_, \ ++ writing_system_, \ ++ script_, \ ++ blue_stringset_ ) \ ++ FT_LOCAL_DEF( void ) \ ++ FT_Init_Class_ ## style_class( AF_StyleClassRec* ac ) \ ++ { \ ++ ac->style = style_; \ ++ ac->writing_system = writing_system_; \ ++ ac->script = script_; \ ++ ac->blue_stringset = blue_stringset_; \ ++ } ++ + #endif /* FT_CONFIG_OPTION_PIC */ + + +diff --git a/src/autofit/autofit.c b/src/autofit/autofit.c +index b23374a..930387c 100644 +--- a/src/autofit/autofit.c ++++ b/src/autofit/autofit.c +@@ -24,6 +24,8 @@ + #include "afglobal.c" + #include "afhints.c" + ++#include "afranges.c" ++ + #include "afdummy.c" + #include "aflatin.c" + #ifdef FT_OPTION_AUTOFIT2 +diff --git a/src/autofit/rules.mk b/src/autofit/rules.mk +index 745adab..5bf3893 100644 +--- a/src/autofit/rules.mk ++++ b/src/autofit/rules.mk +@@ -36,6 +36,7 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ + $(AUTOF_DIR)/afloader.c \ + $(AUTOF_DIR)/afmodule.c \ + $(AUTOF_DIR)/afpic.c \ ++ $(AUTOF_DIR)/afranges.c \ + $(AUTOF_DIR)/afwarp.c + + # AUTOF driver headers +@@ -43,6 +44,7 @@ AUTOF_DRV_SRC := $(AUTOF_DIR)/afangles.c \ + AUTOF_DRV_H := $(AUTOF_DRV_SRC:%c=%h) \ + $(AUTOF_DIR)/aferrors.h \ + $(AUTOF_DIR)/afscript.h \ ++ $(AUTOF_DIR)/afstyles.h \ + $(AUTOF_DIR)/aftypes.h \ + $(AUTOF_DIR)/afwrtsys.h + +diff --git a/src/base/basepic.c b/src/base/basepic.c +index 0af770e..aeb6fd5 100644 +--- a/src/base/basepic.c ++++ b/src/base/basepic.c +@@ -4,7 +4,7 @@ + /* */ + /* The FreeType position independent code services for base. */ + /* */ +-/* Copyright 2009, 2012 by */ ++/* Copyright 2009, 2012, 2013 by */ + /* Oran Agra and Mickey Gabel. */ + /* */ + /* This file is part of the FreeType project, and may only be used, */ +@@ -35,7 +35,7 @@ + /* forward declaration of PIC init function from ftrfork.c */ + /* (not modularized) */ + void +- FT_Init_Table_raccess_guess_table( ft_raccess_guess_rec* record ); ++ FT_Init_Table_ft_raccess_guess_table( ft_raccess_guess_rec* record ); + #endif + + /* forward declaration of PIC init functions from ftinit.c */ +@@ -92,7 +92,7 @@ + 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_Init_Table_ft_raccess_guess_table( + (ft_raccess_guess_rec*)&container->ft_raccess_guess_table ); + #endif + +diff --git a/src/base/rules.mk b/src/base/rules.mk +index 8745337..cbd8107 100644 +--- a/src/base/rules.mk ++++ b/src/base/rules.mk +@@ -33,12 +33,14 @@ BASE_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SRC_DIR)/base) + # All files listed here should be included in `ftbase.c' (for a `single' + # build). + # +-BASE_SRC := $(BASE_DIR)/ftadvanc.c \ ++BASE_SRC := $(BASE_DIR)/basepic.c \ ++ $(BASE_DIR)/ftadvanc.c \ + $(BASE_DIR)/ftcalc.c \ + $(BASE_DIR)/ftdbgmem.c \ + $(BASE_DIR)/ftgloadr.c \ + $(BASE_DIR)/ftobjs.c \ + $(BASE_DIR)/ftoutln.c \ ++ $(BASE_DIR)/ftpic.c \ + $(BASE_DIR)/ftrfork.c \ + $(BASE_DIR)/ftsnames.c \ + $(BASE_DIR)/ftstream.c \ +@@ -51,8 +53,9 @@ ifneq ($(ftmac_c),) + endif + + # for simplicity, we also handle `md5.c' (which gets included by `ftobjs.h') +-BASE_H := $(BASE_DIR)/ftbase.h \ +- $(BASE_DIR)/md5.c \ ++BASE_H := $(BASE_DIR)/basepic.h \ ++ $(BASE_DIR)/ftbase.h \ ++ $(BASE_DIR)/md5.c \ + $(BASE_DIR)/md5.h + + # Base layer `extensions' sources +diff --git a/src/psnames/rules.mk b/src/psnames/rules.mk +index 4cd39a8..f321de2 100644 +--- a/src/psnames/rules.mk ++++ b/src/psnames/rules.mk +@@ -3,7 +3,7 @@ + # + + +-# Copyright 1996-2000, 2001, 2003, 2011 by ++# Copyright 1996-2001, 2003, 2011, 2013 by + # David Turner, Robert Wilhelm, and Werner Lemberg. + # + # This file is part of the FreeType project, and may only be used, modified, +@@ -46,7 +46,7 @@ PSNAMES_DRV_OBJ_S := $(OBJ_DIR)/psnames.$O + + # PSNames driver source file for single build + # +-PSNAMES_DRV_SRC_S := $(PSNAMES_DIR)/psmodule.c ++PSNAMES_DRV_SRC_S := $(PSNAMES_DIR)/psnames.c + + + # PSNames driver - single object +diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c +index 0d74248..b10e390 100644 +--- a/src/truetype/ttgload.c ++++ b/src/truetype/ttgload.c +@@ -738,7 +738,6 @@ + #endif + + TT_GlyphZone zone = &loader->zone; +- FT_Pos origin; + + #ifdef TT_USE_BYTECODE_INTERPRETER + FT_UInt n_ins; +@@ -755,14 +754,7 @@ + loader->glyph->control_len )); + } + n_ins = (FT_UInt)( loader->glyph->control_len ); +-#endif +- +- origin = zone->cur[zone->n_points - 4].x; +- origin = FT_PIX_ROUND( origin ) - origin; +- if ( origin ) +- translate_array( zone->n_points, zone->cur, origin, 0 ); + +-#ifdef TT_USE_BYTECODE_INTERPRETER + /* save original point position in org */ + if ( n_ins > 0 ) + FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points ); +@@ -1083,9 +1075,9 @@ + if ( !x && !y ) + return FT_Err_Ok; + +- /* Use a default value dependent on */ +- /* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old TT */ +- /* fonts which don't set the xxx_COMPONENT_OFFSET bit. */ ++ /* Use a default value dependent on */ ++ /* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old */ ++ /* TT fonts which don't set the xxx_COMPONENT_OFFSET bit. */ + + if ( have_scale && + #ifdef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED +@@ -1097,10 +1089,10 @@ + + #if 0 + +- /*************************************************************************/ +- /* */ +- /* This algorithm is what Apple documents. But it doesn't work. */ +- /* */ ++ /*******************************************************************/ ++ /* */ ++ /* This algorithm is what Apple documents. But it doesn't work. */ ++ /* */ + int a = subglyph->transform.xx > 0 ? subglyph->transform.xx + : -subglyph->transform.xx; + int b = subglyph->transform.yx > 0 ? subglyph->transform.yx +@@ -1120,12 +1112,12 @@ + x = FT_MulFix( x, m ); + y = FT_MulFix( y, n ); + +-#else /* 0 */ ++#else /* 1 */ + +- /*************************************************************************/ +- /* */ +- /* This algorithm is a guess and works much better than the above. */ +- /* */ ++ /*******************************************************************/ ++ /* */ ++ /* This algorithm is a guess and works much better than the above. */ ++ /* */ + FT_Fixed mac_xscale = FT_Hypot( subglyph->transform.xx, + subglyph->transform.xy ); + FT_Fixed mac_yscale = FT_Hypot( subglyph->transform.yy, +@@ -1135,7 +1127,7 @@ + x = FT_MulFix( x, mac_xscale ); + y = FT_MulFix( y, mac_yscale ); + +-#endif /* 0 */ ++#endif /* 1 */ + + } + +@@ -1286,8 +1278,8 @@ + * pp1 = (round(xmin - lsb), 0) , + * pp2 = (round(pp1 + aw), 0) . + * +- * Note that the rounding to the grid is not documented currently in the +- * specification. ++ * Note that the rounding to the grid (in the device space) is not ++ * documented currently in the specification. + * + * However, the specification lacks the precise definition of vertical + * phantom points. Greg Hitchcock provided the following explanation. +@@ -1360,12 +1352,10 @@ + #define TT_LOADER_SET_PP( loader ) \ + do \ + { \ +- FT_Bool subpixel_ = loader->exec \ +- ? loader->exec->subpixel_hinting \ +- : 0; \ +- FT_Bool grayscale_ = loader->exec \ +- ? loader->exec->grayscale_hinting \ +- : 0; \ ++ FT_Bool subpixel_ = loader->exec ? loader->exec->subpixel \ ++ : 0; \ ++ FT_Bool grayscale_ = loader->exec ? loader->exec->grayscale \ ++ : 0; \ + FT_Bool use_aw_2_ = (FT_Bool)( subpixel_ && grayscale_ ); \ + \ + \ +@@ -1373,6 +1363,7 @@ + (loader)->pp1.y = 0; \ + (loader)->pp2.x = (loader)->pp1.x + (loader)->advance; \ + (loader)->pp2.y = 0; \ ++ \ + (loader)->pp3.x = use_aw_2_ ? (loader)->advance / 2 : 0; \ + (loader)->pp3.y = (loader)->bbox.yMax + (loader)->top_bearing; \ + (loader)->pp4.x = use_aw_2_ ? (loader)->advance / 2 : 0; \ +@@ -1388,6 +1379,7 @@ + (loader)->pp1.y = 0; \ + (loader)->pp2.x = (loader)->pp1.x + (loader)->advance; \ + (loader)->pp2.y = 0; \ ++ \ + (loader)->pp3.x = 0; \ + (loader)->pp3.y = (loader)->bbox.yMax + (loader)->top_bearing; \ + (loader)->pp4.x = 0; \ +@@ -1567,21 +1559,32 @@ + if ( error ) + goto Exit; + +- loader->pp1.x += deltas[0].x; loader->pp1.y += deltas[0].y; +- loader->pp2.x += deltas[1].x; loader->pp2.y += deltas[1].y; +- loader->pp3.x += deltas[2].x; loader->pp3.y += deltas[2].y; +- loader->pp4.x += deltas[3].x; loader->pp4.y += deltas[3].y; ++ loader->pp1.x += deltas[0].x; ++ loader->pp1.y += deltas[0].y; ++ loader->pp2.x += deltas[1].x; ++ loader->pp2.y += deltas[1].y; ++ ++ loader->pp3.x += deltas[2].x; ++ loader->pp3.y += deltas[2].y; ++ loader->pp4.x += deltas[3].x; ++ loader->pp4.y += deltas[3].y; + + FT_FREE( deltas ); + } + +-#endif ++#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + ++ /* scale phantom points, if necessary; */ ++ /* they get rounded in `TT_Hint_Glyph' */ + if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) + { + loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale ); + loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); ++ /* pp1.y and pp2.y are always zero */ ++ ++ loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale ); + loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale ); ++ loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale ); + loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); + } + +@@ -1589,8 +1592,8 @@ + goto Exit; + } + +- /* must initialize points before (possibly) overriding */ +- /* glyph metrics from the incremental interface */ ++ /* must initialize phantom points before (possibly) overriding */ ++ /* glyph metrics from the incremental interface */ + TT_LOADER_SET_PP( loader ); + + #ifdef FT_CONFIG_OPTION_INCREMENTAL +@@ -1663,7 +1666,7 @@ + face, + glyph_index, + &deltas, +- gloader->current.num_subglyphs + 4 )) != 0 ) ++ gloader->current.num_subglyphs + 4 ) ) != 0 ) + goto Exit; + + subglyph = gloader->current.subglyphs + gloader->base.num_subglyphs; +@@ -1681,21 +1684,32 @@ + } + } + +- loader->pp1.x += deltas[i + 0].x; loader->pp1.y += deltas[i + 0].y; +- loader->pp2.x += deltas[i + 1].x; loader->pp2.y += deltas[i + 1].y; +- loader->pp3.x += deltas[i + 2].x; loader->pp3.y += deltas[i + 2].y; +- loader->pp4.x += deltas[i + 3].x; loader->pp4.y += deltas[i + 3].y; ++ loader->pp1.x += deltas[i + 0].x; ++ loader->pp1.y += deltas[i + 0].y; ++ loader->pp2.x += deltas[i + 1].x; ++ loader->pp2.y += deltas[i + 1].y; ++ ++ loader->pp3.x += deltas[i + 2].x; ++ loader->pp3.y += deltas[i + 2].y; ++ loader->pp4.x += deltas[i + 3].x; ++ loader->pp4.y += deltas[i + 3].y; + + FT_FREE( deltas ); + } + + #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ + ++ /* scale phantom points, if necessary; */ ++ /* they get rounded in `TT_Hint_Glyph' */ + if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ) + { + loader->pp1.x = FT_MulFix( loader->pp1.x, x_scale ); + loader->pp2.x = FT_MulFix( loader->pp2.x, x_scale ); ++ /* pp1.y and pp2.y are always zero */ ++ ++ loader->pp3.x = FT_MulFix( loader->pp3.x, x_scale ); + loader->pp3.y = FT_MulFix( loader->pp3.y, y_scale ); ++ loader->pp4.x = FT_MulFix( loader->pp4.x, x_scale ); + loader->pp4.y = FT_MulFix( loader->pp4.y, y_scale ); + } + +@@ -1755,6 +1769,7 @@ + /* restore subglyph pointer */ + subglyph = gloader->base.subglyphs + num_base_subgs + n; + ++ /* restore phantom points if necessary */ + if ( !( subglyph->flags & USE_MY_METRICS ) ) + { + loader->pp1 = pp[0]; +@@ -2091,8 +2106,7 @@ + #ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING + TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face ); + +- FT_Bool subpixel_hinting = FALSE; +- FT_Bool grayscale_hinting = TRUE; ++ FT_Bool subpixel = FALSE; + + #if 0 + /* not used yet */ +@@ -2125,24 +2139,24 @@ + + if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) + { +- subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) +- != FT_RENDER_MODE_MONO ) && +- SPH_OPTION_SET_SUBPIXEL ); ++ subpixel = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) != ++ FT_RENDER_MODE_MONO ) && ++ SPH_OPTION_SET_SUBPIXEL ); + +- if ( subpixel_hinting ) +- grayscale = grayscale_hinting = FALSE; ++ if ( subpixel ) ++ grayscale = FALSE; + else if ( SPH_OPTION_SET_GRAYSCALE ) + { +- grayscale = grayscale_hinting = TRUE; +- subpixel_hinting = FALSE; ++ grayscale = TRUE; ++ subpixel = FALSE; + } + else +- grayscale = grayscale_hinting = FALSE; ++ grayscale = FALSE; + + if ( FT_IS_TRICKY( glyph->face ) ) +- subpixel_hinting = grayscale_hinting = FALSE; ++ subpixel = FALSE; + +- exec->ignore_x_mode = subpixel_hinting || grayscale_hinting; ++ exec->ignore_x_mode = subpixel || grayscale; + exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION; + if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 ) + exec->rasterizer_version = TT_INTERPRETER_VERSION_35; +@@ -2185,24 +2199,24 @@ + { + /* a change from mono to subpixel rendering (and vice versa) */ + /* requires a re-execution of the CVT program */ +- if ( subpixel_hinting != exec->subpixel_hinting ) ++ if ( subpixel != exec->subpixel ) + { + FT_TRACE4(( "tt_loader_init: subpixel hinting change," + " re-executing `prep' table\n" )); + +- exec->subpixel_hinting = subpixel_hinting; +- reexecute = TRUE; ++ exec->subpixel = subpixel; ++ reexecute = TRUE; + } + + /* a change from mono to grayscale rendering (and vice versa) */ + /* requires a re-execution of the CVT program */ +- if ( grayscale != exec->grayscale_hinting ) ++ if ( grayscale != exec->grayscale ) + { + FT_TRACE4(( "tt_loader_init: grayscale hinting change," + " re-executing `prep' table\n" )); + +- exec->grayscale_hinting = grayscale_hinting; +- reexecute = TRUE; ++ exec->grayscale = grayscale; ++ reexecute = TRUE; + } + } + else +diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c +index 92e6d43..4c384ec 100644 +--- a/src/truetype/ttinterp.c ++++ b/src/truetype/ttinterp.c +@@ -7169,7 +7169,7 @@ + org_dist = CUR_fast_dualproj( &vec ); + } + +- cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base ); ++ cur_dist = CUR_Func_project( &CUR.zp2.cur[point], cur_base ); + + if ( org_dist ) + { +@@ -7180,14 +7180,20 @@ + /* This is the same as what MS does for the invalid case: */ + /* */ + /* delta = (Original_Pt - Original_RP1) - */ +- /* (Current_Pt - Current_RP1) */ ++ /* (Current_Pt - Current_RP1) ; */ + /* */ + /* In FreeType speak: */ + /* */ +- /* new_dist = cur_dist - */ +- /* org_dist - cur_dist; */ ++ /* delta = org_dist - cur_dist . */ ++ /* */ ++ /* We move `point' by `new_dist - cur_dist' after leaving */ ++ /* this block, thus we have */ ++ /* */ ++ /* new_dist - cur_dist = delta , */ ++ /* new_dist - cur_dist = org_dist - cur_dist , */ ++ /* new_dist = org_dist . */ + +- new_dist = -org_dist; ++ new_dist = org_dist; + } + } + else +@@ -7820,13 +7826,6 @@ + CUR.ignore_x_mode && + CUR.rasterizer_version >= TT_INTERPRETER_VERSION_35 ) + { +- /********************************/ +- /* HINTING FOR GRAYSCALE */ +- /* Selector Bit: 5 */ +- /* Return Bit(s): 12 */ +- /* */ +- if ( ( args[0] & 32 ) != 0 && CUR.grayscale_hinting ) +- K |= 1 << 12; + + if ( CUR.rasterizer_version >= 37 ) + { +@@ -7835,7 +7834,7 @@ + /* Selector Bit: 6 */ + /* Return Bit(s): 13 */ + /* */ +- if ( ( args[0] & 64 ) != 0 && CUR.subpixel_hinting ) ++ if ( ( args[0] & 64 ) != 0 && CUR.subpixel ) + K |= 1 << 13; + + /********************************/ +diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h +index b3916ac..1d8825d 100644 +--- a/src/truetype/ttinterp.h ++++ b/src/truetype/ttinterp.h +@@ -263,12 +263,10 @@ FT_BEGIN_HEADER + #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 subpixel; /* Using subpixel hinting? */ + FT_Bool ignore_x_mode; /* Standard rendering mode for */ + /* subpixel hinting. On if gray */ +- /* or subpixel hinting is on ) */ ++ /* or subpixel hinting is on. */ + + /* The following 4 aren't fully implemented but here for MS rasterizer */ + /* compatibility. */ diff --git a/freetype-nodebug.patch b/freetype-nodebug.patch deleted file mode 100644 index 659fd6d..0000000 --- a/freetype-nodebug.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- freetype-2.5.1/ft2demos-2.5.1/src/ftgrid.c.orig 2013-11-21 16:56:59.920675040 +0100 -+++ freetype-2.5.1/ft2demos-2.5.1/src/ftgrid.c 2013-11-27 20:29:23.464470407 +0100 -@@ -53,10 +53,12 @@ - struct AF_GlyphHintsRec_; - typedef struct AF_GlyphHintsRec_* AF_GlyphHints; - -+#ifdef FT_DEBUG_AUTOFIT - extern int _af_debug_disable_horz_hints; - extern int _af_debug_disable_vert_hints; - extern int _af_debug_disable_blue_hints; - extern AF_GlyphHints _af_debug_hints; -+#endif - - #ifdef __cplusplus - extern "C" { -@@ -495,19 +497,26 @@ - if ( status.do_segment ) - { - /* Force hinting first in order to collect segment info. */ -+#ifdef FT_DEBUG_AUTOFIT - _af_debug_disable_horz_hints = 0; - _af_debug_disable_vert_hints = 0; -+#endif - - if ( !FT_Load_Glyph( size->face, st->Num, - FT_LOAD_DEFAULT | - FT_LOAD_NO_BITMAP | - FT_LOAD_FORCE_AUTOHINT | - FT_LOAD_TARGET_NORMAL ) ) -- grid_hint_draw_segment( &status, _af_debug_hints ); -+#ifdef FT_DEBUG_AUTOFIT -+ grid_hint_draw_segment( &status, _af_debug_hints ) -+#endif -+ ; - } - -+#ifdef FT_DEBUG_AUTOFIT - _af_debug_disable_horz_hints = !st->do_horz_hints; - _af_debug_disable_vert_hints = !st->do_vert_hints; -+#endif - - if ( FT_Load_Glyph( size->face, st->Num, - handle->load_flags | FT_LOAD_NO_BITMAP ) ) -@@ -862,7 +871,9 @@ - - ft_trace_levels[trace_afhints] = 7; - status.header = "dumping glyph edges to stdout"; -+#ifdef FT_DEBUG_AUTOFIT - af_glyph_hints_dump_edges( _af_debug_hints ); -+#endif - ft_trace_levels[trace_afhints] = old_trace_level; - } - else -@@ -882,7 +893,9 @@ - - ft_trace_levels[trace_afhints] = 7; - status.header = "dumping glyph segments to stdout"; -+#ifdef FT_DEBUG_AUTOFIT - af_glyph_hints_dump_segments( _af_debug_hints ); -+#endif - ft_trace_levels[trace_afhints] = old_trace_level; - } - else -@@ -902,7 +915,9 @@ - - ft_trace_levels[trace_afhints] = 7; - status.header = "dumping glyph points to stdout"; -+#ifdef FT_DEBUG_AUTOFIT - af_glyph_hints_dump_points( _af_debug_hints ); -+#endif - ft_trace_levels[trace_afhints] = old_trace_level; - } - else diff --git a/freetype.spec b/freetype.spec index e721408..6123048 100644 --- a/freetype.spec +++ b/freetype.spec @@ -12,19 +12,19 @@ Summary(pt_BR.UTF-8): Biblioteca de renderização de fontes TrueType Summary(ru.UTF-8): Растеризатор шрифтов TrueType Summary(uk.UTF-8): Растеризатор шрифтів TrueType Name: freetype -Version: 2.5.1 -Release: 2 +Version: 2.5.2 +Release: 1 Epoch: 1 License: GPL v2 or FTL Group: Libraries Source0: http://download.savannah.gnu.org/releases/freetype/%{name}-%{version}.tar.bz2 -# Source0-md5: 93eba7854094f46d7d98a9a2370af4d6 +# Source0-md5: 10e8f4d6a019b124088d18bc26123a25 Source1: http://download.savannah.gnu.org/releases/freetype/%{name}-doc-%{version}.tar.bz2 -# Source1-md5: b955678d06318b32337bd7c730daa676 +# Source1-md5: cb858209b8d84860345f3f62fcae2af2 Source2: http://download.savannah.gnu.org/releases/freetype/ft2demos-%{version}.tar.bz2 -# Source2-md5: 73742ef4b13ff9f7b1d4ad2199964141 +# Source2-md5: 399d98441c6c67b5bf29c7733db27438 Patch0: %{name}-2.2.1-enable-valid.patch -Patch1: %{name}-nodebug.patch +Patch1: %{name}-git.patch URL: http://www.freetype.org/ BuildRequires: automake BuildRequires: bzip2-devel -- 2.44.0