OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009,2010 Red Hat, Inc. |
3 * Copyright © 2010,2012 Google, Inc. | 3 * Copyright © 2010,2012 Google, Inc. |
4 * | 4 * |
5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include "hb-buffer-private.hh" | 32 #include "hb-buffer-private.hh" |
33 #include "hb-ot-layout-gdef-table.hh" | 33 #include "hb-ot-layout-gdef-table.hh" |
34 #include "hb-set-private.hh" | 34 #include "hb-set-private.hh" |
35 | 35 |
36 | 36 |
37 namespace OT { | 37 namespace OT { |
38 | 38 |
39 | 39 |
40 | 40 |
41 #define TRACE_DISPATCH(this) \ | 41 #define TRACE_DISPATCH(this, format) \ |
42 hb_auto_trace_t<context_t::max_debug_depth, typename context_t::return_t
> trace \ | 42 hb_auto_trace_t<context_t::max_debug_depth, typename context_t::return_t
> trace \ |
43 (&c->debug_depth, c->get_name (), this, HB_FUNC, \ | 43 (&c->debug_depth, c->get_name (), this, HB_FUNC, \ |
44 » ""); | 44 » "format %d", (int) format); |
45 | 45 |
46 #ifndef HB_DEBUG_CLOSURE | 46 #ifndef HB_DEBUG_CLOSURE |
47 #define HB_DEBUG_CLOSURE (HB_DEBUG+0) | 47 #define HB_DEBUG_CLOSURE (HB_DEBUG+0) |
48 #endif | 48 #endif |
49 | 49 |
50 #define TRACE_CLOSURE(this) \ | 50 #define TRACE_CLOSURE(this) \ |
51 hb_auto_trace_t<HB_DEBUG_CLOSURE, hb_void_t> trace \ | 51 hb_auto_trace_t<HB_DEBUG_CLOSURE, hb_void_t> trace \ |
52 (&c->debug_depth, c->get_name (), this, HB_FUNC, \ | 52 (&c->debug_depth, c->get_name (), this, HB_FUNC, \ |
53 ""); | 53 ""); |
54 | 54 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 * | 161 * |
162 * Note further, that the above is not exactly correct. A recursed lookup | 162 * Note further, that the above is not exactly correct. A recursed lookup |
163 * is allowed to match input that is not matched in the context, but that's | 163 * is allowed to match input that is not matched in the context, but that's |
164 * not how most fonts are built. It's possible to relax that and recurse | 164 * not how most fonts are built. It's possible to relax that and recurse |
165 * with all sets here if it proves to be an issue. | 165 * with all sets here if it proves to be an issue. |
166 */ | 166 */ |
167 | 167 |
168 if (output == hb_set_get_empty ()) | 168 if (output == hb_set_get_empty ()) |
169 return HB_VOID; | 169 return HB_VOID; |
170 | 170 |
| 171 /* Return if new lookup was recursed to before. */ |
| 172 if (recursed_lookups.has (lookup_index)) |
| 173 return HB_VOID; |
| 174 |
171 hb_set_t *old_before = before; | 175 hb_set_t *old_before = before; |
172 hb_set_t *old_input = input; | 176 hb_set_t *old_input = input; |
173 hb_set_t *old_after = after; | 177 hb_set_t *old_after = after; |
174 before = input = after = hb_set_get_empty (); | 178 before = input = after = hb_set_get_empty (); |
175 | 179 |
176 nesting_level_left--; | 180 nesting_level_left--; |
177 recurse_func (this, lookup_index); | 181 recurse_func (this, lookup_index); |
178 nesting_level_left++; | 182 nesting_level_left++; |
179 | 183 |
180 before = old_before; | 184 before = old_before; |
181 input = old_input; | 185 input = old_input; |
182 after = old_after; | 186 after = old_after; |
183 | 187 |
| 188 recursed_lookups.add (lookup_index); |
| 189 |
184 return HB_VOID; | 190 return HB_VOID; |
185 } | 191 } |
186 | 192 |
187 hb_face_t *face; | 193 hb_face_t *face; |
188 hb_set_t *before; | 194 hb_set_t *before; |
189 hb_set_t *input; | 195 hb_set_t *input; |
190 hb_set_t *after; | 196 hb_set_t *after; |
191 hb_set_t *output; | 197 hb_set_t *output; |
192 recurse_func_t recurse_func; | 198 recurse_func_t recurse_func; |
| 199 hb_set_t recursed_lookups; |
193 unsigned int nesting_level_left; | 200 unsigned int nesting_level_left; |
194 unsigned int debug_depth; | 201 unsigned int debug_depth; |
195 | 202 |
196 hb_collect_glyphs_context_t (hb_face_t *face_, | 203 hb_collect_glyphs_context_t (hb_face_t *face_, |
197 hb_set_t *glyphs_before, /* OUT. May be NULL */ | 204 hb_set_t *glyphs_before, /* OUT. May be NULL */ |
198 hb_set_t *glyphs_input, /* OUT. May be NULL */ | 205 hb_set_t *glyphs_input, /* OUT. May be NULL */ |
199 hb_set_t *glyphs_after, /* OUT. May be NULL */ | 206 hb_set_t *glyphs_after, /* OUT. May be NULL */ |
200 hb_set_t *glyphs_output, /* OUT. May be NULL */ | 207 hb_set_t *glyphs_output, /* OUT. May be NULL */ |
201 unsigned int nesting_level_left_ = MAX_NESTING_LE
VEL) : | 208 unsigned int nesting_level_left_ = MAX_NESTING_LE
VEL) : |
202 face (face_), | 209 face (face_), |
203 before (glyphs_before ? glyphs_before : hb_set_get
_empty ()), | 210 before (glyphs_before ? glyphs_before : hb_set_get
_empty ()), |
204 input (glyphs_input ? glyphs_input : hb_set_get
_empty ()), | 211 input (glyphs_input ? glyphs_input : hb_set_get
_empty ()), |
205 after (glyphs_after ? glyphs_after : hb_set_get
_empty ()), | 212 after (glyphs_after ? glyphs_after : hb_set_get
_empty ()), |
206 output (glyphs_output ? glyphs_output : hb_set_get
_empty ()), | 213 output (glyphs_output ? glyphs_output : hb_set_get
_empty ()), |
207 recurse_func (NULL), | 214 recurse_func (NULL), |
| 215 recursed_lookups (), |
208 nesting_level_left (nesting_level_left_), | 216 nesting_level_left (nesting_level_left_), |
209 » » » debug_depth (0) {} | 217 » » » debug_depth (0) |
| 218 { |
| 219 recursed_lookups.init (); |
| 220 } |
| 221 ~hb_collect_glyphs_context_t (void) |
| 222 { |
| 223 recursed_lookups.fini (); |
| 224 } |
210 | 225 |
211 void set_recurse_func (recurse_func_t func) { recurse_func = func; } | 226 void set_recurse_func (recurse_func_t func) { recurse_func = func; } |
212 }; | 227 }; |
213 | 228 |
214 | 229 |
215 | 230 |
| 231 #ifndef HB_DEBUG_GET_COVERAGE |
| 232 #define HB_DEBUG_GET_COVERAGE (HB_DEBUG+0) |
| 233 #endif |
| 234 |
216 struct hb_get_coverage_context_t | 235 struct hb_get_coverage_context_t |
217 { | 236 { |
218 inline const char *get_name (void) { return "GET_COVERAGE"; } | 237 inline const char *get_name (void) { return "GET_COVERAGE"; } |
219 static const unsigned int max_debug_depth = 0; | 238 static const unsigned int max_debug_depth = HB_DEBUG_GET_COVERAGE; |
220 typedef const Coverage &return_t; | 239 typedef const Coverage &return_t; |
221 template <typename T> | 240 template <typename T> |
222 inline return_t dispatch (const T &obj) { return obj.get_coverage (); } | 241 inline return_t dispatch (const T &obj) { return obj.get_coverage (); } |
223 static return_t default_return_value (void) { return Null(Coverage); } | 242 static return_t default_return_value (void) { return Null(Coverage); } |
224 | 243 |
225 hb_get_coverage_context_t (void) : | 244 hb_get_coverage_context_t (void) : |
226 debug_depth (0) {} | 245 debug_depth (0) {} |
227 | 246 |
228 unsigned int debug_depth; | 247 unsigned int debug_depth; |
229 }; | 248 }; |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 inputCount, match_positions, | 1129 inputCount, match_positions, |
1111 lookupCount, lookupRecord, | 1130 lookupCount, lookupRecord, |
1112 match_length); | 1131 match_length); |
1113 } | 1132 } |
1114 | 1133 |
1115 struct Rule | 1134 struct Rule |
1116 { | 1135 { |
1117 inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &loo
kup_context) const | 1136 inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &loo
kup_context) const |
1118 { | 1137 { |
1119 TRACE_CLOSURE (this); | 1138 TRACE_CLOSURE (this); |
1120 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, inp
ut[0].static_size * (inputCount ? inputCount - 1 : 0)); | 1139 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (inputZ, in
putZ[0].static_size * (inputCount ? inputCount - 1 : 0)); |
1121 context_closure_lookup (c, | 1140 context_closure_lookup (c, |
1122 » » » inputCount, input, | 1141 » » » inputCount, inputZ, |
1123 lookupCount, lookupRecord, | 1142 lookupCount, lookupRecord, |
1124 lookup_context); | 1143 lookup_context); |
1125 } | 1144 } |
1126 | 1145 |
1127 inline void collect_glyphs (hb_collect_glyphs_context_t *c, ContextCollectGlyp
hsLookupContext &lookup_context) const | 1146 inline void collect_glyphs (hb_collect_glyphs_context_t *c, ContextCollectGlyp
hsLookupContext &lookup_context) const |
1128 { | 1147 { |
1129 TRACE_COLLECT_GLYPHS (this); | 1148 TRACE_COLLECT_GLYPHS (this); |
1130 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, inp
ut[0].static_size * (inputCount ? inputCount - 1 : 0)); | 1149 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (inputZ, in
putZ[0].static_size * (inputCount ? inputCount - 1 : 0)); |
1131 context_collect_glyphs_lookup (c, | 1150 context_collect_glyphs_lookup (c, |
1132 » » » » inputCount, input, | 1151 » » » » inputCount, inputZ, |
1133 lookupCount, lookupRecord, | 1152 lookupCount, lookupRecord, |
1134 lookup_context); | 1153 lookup_context); |
1135 } | 1154 } |
1136 | 1155 |
1137 inline bool would_apply (hb_would_apply_context_t *c, ContextApplyLookupContex
t &lookup_context) const | 1156 inline bool would_apply (hb_would_apply_context_t *c, ContextApplyLookupContex
t &lookup_context) const |
1138 { | 1157 { |
1139 TRACE_WOULD_APPLY (this); | 1158 TRACE_WOULD_APPLY (this); |
1140 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, inp
ut[0].static_size * (inputCount ? inputCount - 1 : 0)); | 1159 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (inputZ, in
putZ[0].static_size * (inputCount ? inputCount - 1 : 0)); |
1141 return TRACE_RETURN (context_would_apply_lookup (c, inputCount, input, looku
pCount, lookupRecord, lookup_context)); | 1160 return TRACE_RETURN (context_would_apply_lookup (c, inputCount, inputZ, look
upCount, lookupRecord, lookup_context)); |
1142 } | 1161 } |
1143 | 1162 |
1144 inline bool apply (hb_apply_context_t *c, ContextApplyLookupContext &lookup_co
ntext) const | 1163 inline bool apply (hb_apply_context_t *c, ContextApplyLookupContext &lookup_co
ntext) const |
1145 { | 1164 { |
1146 TRACE_APPLY (this); | 1165 TRACE_APPLY (this); |
1147 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (input, inp
ut[0].static_size * (inputCount ? inputCount - 1 : 0)); | 1166 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (inputZ, in
putZ[0].static_size * (inputCount ? inputCount - 1 : 0)); |
1148 return TRACE_RETURN (context_apply_lookup (c, inputCount, input, lookupCount
, lookupRecord, lookup_context)); | 1167 return TRACE_RETURN (context_apply_lookup (c, inputCount, inputZ, lookupCoun
t, lookupRecord, lookup_context)); |
1149 } | 1168 } |
1150 | 1169 |
1151 public: | 1170 public: |
1152 inline bool sanitize (hb_sanitize_context_t *c) { | 1171 inline bool sanitize (hb_sanitize_context_t *c) { |
1153 TRACE_SANITIZE (this); | 1172 TRACE_SANITIZE (this); |
1154 return inputCount.sanitize (c) | 1173 return inputCount.sanitize (c) |
1155 && lookupCount.sanitize (c) | 1174 && lookupCount.sanitize (c) |
1156 » && c->check_range (input, | 1175 » && c->check_range (inputZ, |
1157 » » » input[0].static_size * inputCount | 1176 » » » inputZ[0].static_size * inputCount |
1158 + lookupRecordX[0].static_size * lookupCount); | 1177 + lookupRecordX[0].static_size * lookupCount); |
1159 } | 1178 } |
1160 | 1179 |
1161 protected: | 1180 protected: |
1162 USHORT inputCount; /* Total number of glyphs in input | 1181 USHORT inputCount; /* Total number of glyphs in input |
1163 * glyph sequence--includes the first | 1182 * glyph sequence--includes the first |
1164 * glyph */ | 1183 * glyph */ |
1165 USHORT lookupCount; /* Number of LookupRecords */ | 1184 USHORT lookupCount; /* Number of LookupRecords */ |
1166 USHORT» input[VAR];» » /* Array of match inputs--start with | 1185 USHORT» inputZ[VAR];» » /* Array of match inputs--start with |
1167 * second glyph */ | 1186 * second glyph */ |
1168 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in | 1187 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in |
1169 * design order */ | 1188 * design order */ |
1170 public: | 1189 public: |
1171 DEFINE_SIZE_ARRAY2 (4, input, lookupRecordX); | 1190 DEFINE_SIZE_ARRAY2 (4, inputZ, lookupRecordX); |
1172 }; | 1191 }; |
1173 | 1192 |
1174 struct RuleSet | 1193 struct RuleSet |
1175 { | 1194 { |
1176 inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &loo
kup_context) const | 1195 inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &loo
kup_context) const |
1177 { | 1196 { |
1178 TRACE_CLOSURE (this); | 1197 TRACE_CLOSURE (this); |
1179 unsigned int num_rules = rule.len; | 1198 unsigned int num_rules = rule.len; |
1180 for (unsigned int i = 0; i < num_rules; i++) | 1199 for (unsigned int i = 0; i < num_rules; i++) |
1181 (this+rule[i]).closure (c, lookup_context); | 1200 (this+rule[i]).closure (c, lookup_context); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 public: | 1425 public: |
1407 DEFINE_SIZE_ARRAY (8, ruleSet); | 1426 DEFINE_SIZE_ARRAY (8, ruleSet); |
1408 }; | 1427 }; |
1409 | 1428 |
1410 | 1429 |
1411 struct ContextFormat3 | 1430 struct ContextFormat3 |
1412 { | 1431 { |
1413 inline void closure (hb_closure_context_t *c) const | 1432 inline void closure (hb_closure_context_t *c) const |
1414 { | 1433 { |
1415 TRACE_CLOSURE (this); | 1434 TRACE_CLOSURE (this); |
1416 if (!(this+coverage[0]).intersects (c->glyphs)) | 1435 if (!(this+coverageZ[0]).intersects (c->glyphs)) |
1417 return; | 1436 return; |
1418 | 1437 |
1419 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage,
coverage[0].static_size * glyphCount); | 1438 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverageZ,
coverageZ[0].static_size * glyphCount); |
1420 struct ContextClosureLookupContext lookup_context = { | 1439 struct ContextClosureLookupContext lookup_context = { |
1421 {intersects_coverage}, | 1440 {intersects_coverage}, |
1422 this | 1441 this |
1423 }; | 1442 }; |
1424 context_closure_lookup (c, | 1443 context_closure_lookup (c, |
1425 » » » glyphCount, (const USHORT *) (coverage + 1), | 1444 » » » glyphCount, (const USHORT *) (coverageZ + 1), |
1426 lookupCount, lookupRecord, | 1445 lookupCount, lookupRecord, |
1427 lookup_context); | 1446 lookup_context); |
1428 } | 1447 } |
1429 | 1448 |
1430 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const | 1449 inline void collect_glyphs (hb_collect_glyphs_context_t *c) const |
1431 { | 1450 { |
1432 TRACE_COLLECT_GLYPHS (this); | 1451 TRACE_COLLECT_GLYPHS (this); |
1433 (this+coverage[0]).add_coverage (c->input); | 1452 (this+coverageZ[0]).add_coverage (c->input); |
1434 | 1453 |
1435 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage,
coverage[0].static_size * glyphCount); | 1454 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverageZ,
coverageZ[0].static_size * glyphCount); |
1436 struct ContextCollectGlyphsLookupContext lookup_context = { | 1455 struct ContextCollectGlyphsLookupContext lookup_context = { |
1437 {collect_coverage}, | 1456 {collect_coverage}, |
1438 this | 1457 this |
1439 }; | 1458 }; |
1440 | 1459 |
1441 context_collect_glyphs_lookup (c, | 1460 context_collect_glyphs_lookup (c, |
1442 » » » » glyphCount, (const USHORT *) (coverage + 1), | 1461 » » » » glyphCount, (const USHORT *) (coverageZ + 1), |
1443 lookupCount, lookupRecord, | 1462 lookupCount, lookupRecord, |
1444 lookup_context); | 1463 lookup_context); |
1445 } | 1464 } |
1446 | 1465 |
1447 inline bool would_apply (hb_would_apply_context_t *c) const | 1466 inline bool would_apply (hb_would_apply_context_t *c) const |
1448 { | 1467 { |
1449 TRACE_WOULD_APPLY (this); | 1468 TRACE_WOULD_APPLY (this); |
1450 | 1469 |
1451 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage,
coverage[0].static_size * glyphCount); | 1470 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverageZ,
coverageZ[0].static_size * glyphCount); |
1452 struct ContextApplyLookupContext lookup_context = { | 1471 struct ContextApplyLookupContext lookup_context = { |
1453 {match_coverage}, | 1472 {match_coverage}, |
1454 this | 1473 this |
1455 }; | 1474 }; |
1456 return TRACE_RETURN (context_would_apply_lookup (c, glyphCount, (const USHOR
T *) (coverage + 1), lookupCount, lookupRecord, lookup_context)); | 1475 return TRACE_RETURN (context_would_apply_lookup (c, glyphCount, (const USHOR
T *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); |
1457 } | 1476 } |
1458 | 1477 |
1459 inline const Coverage &get_coverage (void) const | 1478 inline const Coverage &get_coverage (void) const |
1460 { | 1479 { |
1461 return this+coverage[0]; | 1480 return this+coverageZ[0]; |
1462 } | 1481 } |
1463 | 1482 |
1464 inline bool apply (hb_apply_context_t *c) const | 1483 inline bool apply (hb_apply_context_t *c) const |
1465 { | 1484 { |
1466 TRACE_APPLY (this); | 1485 TRACE_APPLY (this); |
1467 unsigned int index = (this+coverage[0]).get_coverage (c->buffer->cur().codep
oint); | 1486 unsigned int index = (this+coverageZ[0]).get_coverage (c->buffer->cur().code
point); |
1468 if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); | 1487 if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); |
1469 | 1488 |
1470 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage,
coverage[0].static_size * glyphCount); | 1489 const LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverageZ,
coverageZ[0].static_size * glyphCount); |
1471 struct ContextApplyLookupContext lookup_context = { | 1490 struct ContextApplyLookupContext lookup_context = { |
1472 {match_coverage}, | 1491 {match_coverage}, |
1473 this | 1492 this |
1474 }; | 1493 }; |
1475 return TRACE_RETURN (context_apply_lookup (c, glyphCount, (const USHORT *) (
coverage + 1), lookupCount, lookupRecord, lookup_context)); | 1494 return TRACE_RETURN (context_apply_lookup (c, glyphCount, (const USHORT *) (
coverageZ + 1), lookupCount, lookupRecord, lookup_context)); |
1476 } | 1495 } |
1477 | 1496 |
1478 inline bool sanitize (hb_sanitize_context_t *c) { | 1497 inline bool sanitize (hb_sanitize_context_t *c) { |
1479 TRACE_SANITIZE (this); | 1498 TRACE_SANITIZE (this); |
1480 if (!c->check_struct (this)) return TRACE_RETURN (false); | 1499 if (!c->check_struct (this)) return TRACE_RETURN (false); |
1481 unsigned int count = glyphCount; | 1500 unsigned int count = glyphCount; |
1482 if (!count) return TRACE_RETURN (false); /* We want to access coverage[0] fr
eely. */ | 1501 if (!count) return TRACE_RETURN (false); /* We want to access coverageZ[0] f
reely. */ |
1483 if (!c->check_array (coverage, coverage[0].static_size, count)) return TRACE
_RETURN (false); | 1502 if (!c->check_array (coverageZ, coverageZ[0].static_size, count)) return TRA
CE_RETURN (false); |
1484 for (unsigned int i = 0; i < count; i++) | 1503 for (unsigned int i = 0; i < count; i++) |
1485 if (!coverage[i].sanitize (c, this)) return TRACE_RETURN (false); | 1504 if (!coverageZ[i].sanitize (c, this)) return TRACE_RETURN (false); |
1486 LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, covera
ge[0].static_size * count); | 1505 LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverageZ, cover
ageZ[0].static_size * count); |
1487 return TRACE_RETURN (c->check_array (lookupRecord, lookupRecord[0].static_si
ze, lookupCount)); | 1506 return TRACE_RETURN (c->check_array (lookupRecord, lookupRecord[0].static_si
ze, lookupCount)); |
1488 } | 1507 } |
1489 | 1508 |
1490 protected: | 1509 protected: |
1491 USHORT format; /* Format identifier--format = 3 */ | 1510 USHORT format; /* Format identifier--format = 3 */ |
1492 USHORT glyphCount; /* Number of glyphs in the input glyph | 1511 USHORT glyphCount; /* Number of glyphs in the input glyph |
1493 * sequence */ | 1512 * sequence */ |
1494 USHORT lookupCount; /* Number of LookupRecords */ | 1513 USHORT lookupCount; /* Number of LookupRecords */ |
1495 OffsetTo<Coverage> | 1514 OffsetTo<Coverage> |
1496 » » coverage[VAR];» » /* Array of offsets to Coverage | 1515 » » coverageZ[VAR];»» /* Array of offsets to Coverage |
1497 * table in glyph sequence order */ | 1516 * table in glyph sequence order */ |
1498 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in | 1517 LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in |
1499 * design order */ | 1518 * design order */ |
1500 public: | 1519 public: |
1501 DEFINE_SIZE_ARRAY2 (6, coverage, lookupRecordX); | 1520 DEFINE_SIZE_ARRAY2 (6, coverageZ, lookupRecordX); |
1502 }; | 1521 }; |
1503 | 1522 |
1504 struct Context | 1523 struct Context |
1505 { | 1524 { |
1506 template <typename context_t> | 1525 template <typename context_t> |
1507 inline typename context_t::return_t dispatch (context_t *c) const | 1526 inline typename context_t::return_t dispatch (context_t *c) const |
1508 { | 1527 { |
1509 TRACE_DISPATCH (this); | 1528 TRACE_DISPATCH (this, u.format); |
1510 switch (u.format) { | 1529 switch (u.format) { |
1511 case 1: return TRACE_RETURN (c->dispatch (u.format1)); | 1530 case 1: return TRACE_RETURN (c->dispatch (u.format1)); |
1512 case 2: return TRACE_RETURN (c->dispatch (u.format2)); | 1531 case 2: return TRACE_RETURN (c->dispatch (u.format2)); |
1513 case 3: return TRACE_RETURN (c->dispatch (u.format3)); | 1532 case 3: return TRACE_RETURN (c->dispatch (u.format3)); |
1514 default:return TRACE_RETURN (c->default_return_value ()); | 1533 default:return TRACE_RETURN (c->default_return_value ()); |
1515 } | 1534 } |
1516 } | 1535 } |
1517 | 1536 |
1518 inline bool sanitize (hb_sanitize_context_t *c) { | 1537 inline bool sanitize (hb_sanitize_context_t *c) { |
1519 TRACE_SANITIZE (this); | 1538 TRACE_SANITIZE (this); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 * design order) */ | 2136 * design order) */ |
2118 public: | 2137 public: |
2119 DEFINE_SIZE_MIN (10); | 2138 DEFINE_SIZE_MIN (10); |
2120 }; | 2139 }; |
2121 | 2140 |
2122 struct ChainContext | 2141 struct ChainContext |
2123 { | 2142 { |
2124 template <typename context_t> | 2143 template <typename context_t> |
2125 inline typename context_t::return_t dispatch (context_t *c) const | 2144 inline typename context_t::return_t dispatch (context_t *c) const |
2126 { | 2145 { |
2127 TRACE_DISPATCH (this); | 2146 TRACE_DISPATCH (this, u.format); |
2128 switch (u.format) { | 2147 switch (u.format) { |
2129 case 1: return TRACE_RETURN (c->dispatch (u.format1)); | 2148 case 1: return TRACE_RETURN (c->dispatch (u.format1)); |
2130 case 2: return TRACE_RETURN (c->dispatch (u.format2)); | 2149 case 2: return TRACE_RETURN (c->dispatch (u.format2)); |
2131 case 3: return TRACE_RETURN (c->dispatch (u.format3)); | 2150 case 3: return TRACE_RETURN (c->dispatch (u.format3)); |
2132 default:return TRACE_RETURN (c->default_return_value ()); | 2151 default:return TRACE_RETURN (c->default_return_value ()); |
2133 } | 2152 } |
2134 } | 2153 } |
2135 | 2154 |
2136 inline bool sanitize (hb_sanitize_context_t *c) { | 2155 inline bool sanitize (hb_sanitize_context_t *c) { |
2137 TRACE_SANITIZE (this); | 2156 TRACE_SANITIZE (this); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2291 lookupList; /* LookupList table */ | 2310 lookupList; /* LookupList table */ |
2292 public: | 2311 public: |
2293 DEFINE_SIZE_STATIC (10); | 2312 DEFINE_SIZE_STATIC (10); |
2294 }; | 2313 }; |
2295 | 2314 |
2296 | 2315 |
2297 } /* namespace OT */ | 2316 } /* namespace OT */ |
2298 | 2317 |
2299 | 2318 |
2300 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */ | 2319 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */ |
OLD | NEW |