diff --git a/ChangeLog b/ChangeLog index 2238497e0..79398369d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2013-12-30 Werner Lemberg + + [autofit] Don't combine multiple features into one set. + + Combining them, as originally envisioned, would lead to much more + complicated code, as investigations have shown meanwhile. The major + drawback is that we run out of available style slots much earlier. + However, this is only a theoretical issue since we don't support a + large number of scripts currently. + + * src/autofit/afcover.h: Replace `COVERAGE_{1,2,3}' macros with + a single-element `COVERAGE' macro, sort the elements by the feature + tags, and add entry for `ruby'. + + * src/autofit/aftypes.h: Updated. + * src/autofit/hbshim.c: Updated. + 2013-12-28 Werner Lemberg [autofit] Code shuffling to reduce use of cpp macros. @@ -93,7 +110,7 @@ http://lists.gnu.org/archive/html/freetype-devel/2013-12/msg00027.html * src/base/ftrfork.c (FT_Raccess_Get_DataOffsets): Add a switch - `sort_by_res_id' to control the fragmented resource ordering. + `sort_by_res_id' to control the fragmented resource ordering. * include/internal/ftrfork.h: Declare new switch. * src/base/ftobjs.c (IsMacResource): Enable the sorting for `POST' resource, and disable the sorting for `sfnt' resource. diff --git a/src/autofit/afcover.h b/src/autofit/afcover.h index 13dbecb21..c150b042e 100644 --- a/src/autofit/afcover.h +++ b/src/autofit/afcover.h @@ -17,50 +17,79 @@ /* This header file can be included multiple times. */ - /* Define `COVERAGE_{1,2,3}' as needed. */ + /* Define `COVERAGE' as needed. */ /* Add new coverages here. The first and second arguments are the */ /* coverage name in lowercase and uppercase, respectively, followed */ - /* by a description string. The remaining arguments the */ - /* corresponding OpenType features (with four characters a feature). */ + /* by a description string. The last four arguments are the four */ + /* characters defining the corresponding OpenType feature. */ - COVERAGE_1( oldstyle_figures, OLDSTYLE_FIGURES, - "oldstyle figures", - 'o', 'n', 'u', 'm' ) /* Oldstyle Figures */ + COVERAGE( alternative_fractions, ALTERNATIVE_FRACTIONS, + "alternative fractions", + 'a', 'f', 'r', 'c' ) - COVERAGE_2( petite_capitals, PETITE_CAPITALS, - "petite capitals", - 'c', '2', 'c', 'p', /* Petite Capitals from Capitals */ - 'p', 'c', 'a', 'p' ) /* Petite Capitals */ + COVERAGE( petite_capitals_from_capitals, PETITE_CAPITALS_FROM_CAPITALS, + "petite capitals from capitals", + 'c', '2', 'c', 'p' ) - COVERAGE_2( small_capitals, SMALL_CAPITALS, - "small capitals", - 'c', '2', 's', 'c', /* Small Capitals from Capitals */ - 's', 'm', 'c', 'p' ) /* Small Capitals */ + COVERAGE( small_capitals_from_capitals, SMALL_CAPITALS_FROM_CAPITALS, + "small capitals from capitals", + 'c', '2', 's', 'c' ) - COVERAGE_1( titling, TITLING, - "titling", - 't', 'i', 't', 'l' ) /* Titling */ + COVERAGE( denominators, DENOMINATORS, + "denominators", + 'd', 'n', 'o', 'm' ) - COVERAGE_2( sub_superscript_1, SUB_SUPERSCRIPT_1, - "sub- and superscripts group 1", - 's', 'u', 'b', 's', /* Subscript */ - 's', 'u', 'p', 's' ) /* Superscript */ + COVERAGE( fractions, FRACTIONS, + "fractions", + 'f', 'r', 'a', 'c' ) - COVERAGE_2( sub_superscript_2, SUB_SUPERSCRIPT_2, - "sub- and superscripts group 2", - 'o', 'r', 'd', 'n', /* Ordinals */ - 's', 'i', 'n', 'f' ) /* Scientific Inferiors */ + COVERAGE( numerators, NUMERATORS, + "numerators", + 'n', 'u', 'm', 'r' ) - COVERAGE_3( fractions, FRACTIONS, - "fractions", - 'd', 'n', 'o', 'm', /* Denominators */ - 'f', 'r', 'a', 'c', /* Fractions */ - 'n', 'u', 'm', 'r' ) /* Numerators */ + COVERAGE( oldstyle_figures, OLDSTYLE_FIGURES, + "oldstyle figures", + 'o', 'n', 'u', 'm' ) + + COVERAGE( ordinals, ORDINALS, + "ordinals", + 'o', 'r', 'd', 'n' ) + + COVERAGE( petite_capitals, PETITE_CAPITALS, + "petite capitals", + 'p', 'c', 'a', 'p' ) + + COVERAGE( ruby, RUBY, + "ruby", + 'r', 'u', 'b', 'y' ) + + COVERAGE( scientific_inferiors, SCIENTIFIC_INFERIORS, + "scientific inferiors", + 's', 'i', 'n', 'f' ) + + COVERAGE( small_capitals, SMALL_CAPITALS, + "small capitals", + 's', 'm', 'c', 'p' ) + + COVERAGE( subscript, SUBSCRIPT, + "subscript", + 's', 'u', 'b', 's' ) + + COVERAGE( superscript, SUPERSCRIPT, + "superscript", + 's', 'u', 'p', 's' ) + + COVERAGE( titling, TITLING, + "titling", + 't', 'i', 't', 'l' ) + +#if 0 + /* to be always excluded */ + COVERAGE(nalt, 'n', 'a', 'l', 't'); /* Alternate Annotation Forms (?) */ + COVERAGE(ornm, 'o', 'r', 'n', 'm'); /* Ornaments (?) */ +#endif - COVERAGE_1( alternative_fractions, ALTERNATIVE_FRACTIONS, - "alternative fractions", - 'a', 'f', 'r', 'c' ) /* Alternative Fractions */ /* END */ diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h index b6a365b3e..76512a93f 100644 --- a/src/autofit/aftypes.h +++ b/src/autofit/aftypes.h @@ -370,12 +370,11 @@ extern void* _af_debug_hints; * representation forms. How this mapping happens is completely * uninteresting to us. * - * For the auto-hinter, a `coverage' represents all glyphs of one or more - * OpenType features collected in a set (as listed below) that can be - * hinted together. To continue the above example, superscript glyphs - * must not be hinted together with normal glyphs because the blue zones - * completely differ. On the other hand, superscripts and subscripts - * don't overlap, so they can be combined into a single set. + * For the auto-hinter, a `coverage' represents all glyphs of an OpenType + * feature collected in a set (as listed below) that can be hinted + * together. To continue the above example, superscript glyphs must not + * be hinted together with normal glyphs because the blue zones + * completely differ. * * Note that FreeType itself doesn't compute coverages; it only provides * the glyphs addressable by the default Unicode character map. Instead, @@ -389,22 +388,9 @@ extern void* _af_debug_hints; * */ -#undef COVERAGE_1 -#define COVERAGE_1( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4 ) \ - AF_COVERAGE_ ## NAME, - -#undef COVERAGE_2 -#define COVERAGE_2( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4, \ - tag_b1, tag_b2, tag_b3, tag_b4 ) \ - AF_COVERAGE_ ## NAME, - -#undef COVERAGE_3 -#define COVERAGE_3( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4, \ - tag_b1, tag_b2, tag_b3, tag_b4, \ - tag_c1, tag_c2, tag_c3, tag_c4 ) \ +#undef COVERAGE +#define COVERAGE( name, NAME, description, \ + tag1, tag2, tag3, tag4 ) \ AF_COVERAGE_ ## NAME, diff --git a/src/autofit/hbshim.c b/src/autofit/hbshim.c index 451636ef7..c9e21cb9a 100644 --- a/src/autofit/hbshim.c +++ b/src/autofit/hbshim.c @@ -38,10 +38,10 @@ * usual mathematical meaning) to manage both lookups and glyph indices. * * 1. For each coverage, collect lookup IDs in a set. Note that an - * auto-hinter `coverage' is represented by one or more `feature's, and - * a feature consists of an arbitrary number of (font specific) - * `lookup's that actually do the mapping job. Please check the - * OpenType specification for more details on features and lookups. + * auto-hinter `coverage' is represented by one `feature', and a + * feature consists of an arbitrary number of (font specific) `lookup's + * that actually do the mapping job. Please check the OpenType + * specification for more details on features and lookups. * * 2. Create glyph ID sets from the corresponding lookup sets. * @@ -54,36 +54,12 @@ /* load coverage tags */ -#undef COVERAGE_1 -#define COVERAGE_1( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4 ) \ +#undef COVERAGE +#define COVERAGE( name, NAME, description, \ + tag1, tag2, tag3, tag4 ) \ static const hb_tag_t name ## _coverage[] = \ { \ - HB_TAG( tag_a1, tag_a2, tag_a3, tag_a4 ), \ - HB_TAG_NONE \ - }; - -#undef COVERAGE_2 -#define COVERAGE_2( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4, \ - tag_b1, tag_b2, tag_b3, tag_b4 ) \ - static const hb_tag_t name ## _coverage[] = \ - { \ - HB_TAG( tag_a1, tag_a2, tag_a3, tag_a4 ), \ - HB_TAG( tag_b1, tag_b2, tag_b3, tag_b4 ), \ - HB_TAG_NONE \ - }; - -#undef COVERAGE_3 -#define COVERAGE_3( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4, \ - tag_b1, tag_b2, tag_b3, tag_b4, \ - tag_c1, tag_c2, tag_c3, tag_c4 ) \ - static const hb_tag_t name ## _coverage[] = \ - { \ - HB_TAG( tag_a1, tag_a2, tag_a3, tag_a4 ), \ - HB_TAG( tag_b1, tag_b2, tag_b3, tag_b4 ), \ - HB_TAG( tag_c1, tag_c2, tag_c3, tag_c4 ), \ + HB_TAG( tag1, tag2, tag3, tag4 ), \ HB_TAG_NONE \ }; @@ -92,22 +68,9 @@ /* define mapping between coverage tags and AF_Coverage */ -#undef COVERAGE_1 -#define COVERAGE_1( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4 ) \ - name ## _coverage, - -#undef COVERAGE_2 -#define COVERAGE_2( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4, \ - tag_b1, tag_b2, tag_b3, tag_b4 ) \ - name ## _coverage, - -#undef COVERAGE_3 -#define COVERAGE_3( name, NAME, description, \ - tag_a1, tag_a2, tag_a3, tag_a4, \ - tag_b1, tag_b2, tag_b3, tag_b4, \ - tag_c1, tag_c2, tag_c3, tag_c4 ) \ +#undef COVERAGE +#define COVERAGE( name, NAME, description, \ + tag1, tag2, tag3, tag4 ) \ name ## _coverage, @@ -283,14 +246,6 @@ } -#if 0 - /* to be always excluded */ - COVERAGE(nalt, 'n', 'a', 'l', 't'); /* Alternate Annotation Forms (?) */ - COVERAGE(ornm, 'o', 'r', 'n', 'm'); /* Ornaments (?) */ - /* COVERAGE(ruby, 'r', 'u', 'b', 'y') */ /* (only for Japanese) */ -#endif - - #else /* !FT_CONFIG_OPTION_USE_HARDBUZZ */