[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
diff --git a/ChangeLog b/ChangeLog
index 2238497..7939836 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2013-12-30 Werner Lemberg <wl@gnu.org>
+
+ [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 <wl@gnu.org>
[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 13dbecb..c150b04 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). */
-
- COVERAGE_1( oldstyle_figures, OLDSTYLE_FIGURES,
- "oldstyle figures",
- 'o', 'n', 'u', 'm' ) /* Oldstyle Figures */
-
- COVERAGE_2( petite_capitals, PETITE_CAPITALS,
- "petite capitals",
- 'c', '2', 'c', 'p', /* Petite Capitals from Capitals */
- 'p', 'c', 'a', 'p' ) /* Petite Capitals */
-
- COVERAGE_2( small_capitals, SMALL_CAPITALS,
- "small capitals",
- 'c', '2', 's', 'c', /* Small Capitals from Capitals */
- 's', 'm', 'c', 'p' ) /* Small Capitals */
-
- COVERAGE_1( titling, TITLING,
- "titling",
- 't', 'i', 't', 'l' ) /* Titling */
-
- COVERAGE_2( sub_superscript_1, SUB_SUPERSCRIPT_1,
- "sub- and superscripts group 1",
- 's', 'u', 'b', 's', /* Subscript */
- 's', 'u', 'p', 's' ) /* Superscript */
-
- 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_3( fractions, FRACTIONS,
- "fractions",
- 'd', 'n', 'o', 'm', /* Denominators */
- 'f', 'r', 'a', 'c', /* Fractions */
- 'n', 'u', 'm', 'r' ) /* Numerators */
-
- COVERAGE_1( alternative_fractions, ALTERNATIVE_FRACTIONS,
- "alternative fractions",
- 'a', 'f', 'r', 'c' ) /* Alternative Fractions */
+ /* by a description string. The last four arguments are the four */
+ /* characters defining the corresponding OpenType feature. */
+
+ COVERAGE( alternative_fractions, ALTERNATIVE_FRACTIONS,
+ "alternative fractions",
+ 'a', 'f', 'r', 'c' )
+
+ COVERAGE( petite_capitals_from_capitals, PETITE_CAPITALS_FROM_CAPITALS,
+ "petite capitals from capitals",
+ 'c', '2', 'c', 'p' )
+
+ COVERAGE( small_capitals_from_capitals, SMALL_CAPITALS_FROM_CAPITALS,
+ "small capitals from capitals",
+ 'c', '2', 's', 'c' )
+
+ COVERAGE( denominators, DENOMINATORS,
+ "denominators",
+ 'd', 'n', 'o', 'm' )
+
+ COVERAGE( fractions, FRACTIONS,
+ "fractions",
+ 'f', 'r', 'a', 'c' )
+
+ COVERAGE( numerators, NUMERATORS,
+ "numerators",
+ 'n', 'u', 'm', 'r' )
+
+ 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
+
/* END */
diff --git a/src/autofit/aftypes.h b/src/autofit/aftypes.h
index b6a365b..76512a9 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 451636e..c9e21cb 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 */