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 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 {match_coverage}, | 1472 {match_coverage}, |
1473 this | 1473 this |
1474 }; | 1474 }; |
1475 return TRACE_RETURN (context_apply_lookup (c, glyphCount, (const USHORT *) (
coverage + 1), lookupCount, lookupRecord, lookup_context)); | 1475 return TRACE_RETURN (context_apply_lookup (c, glyphCount, (const USHORT *) (
coverage + 1), lookupCount, lookupRecord, lookup_context)); |
1476 } | 1476 } |
1477 | 1477 |
1478 inline bool sanitize (hb_sanitize_context_t *c) { | 1478 inline bool sanitize (hb_sanitize_context_t *c) { |
1479 TRACE_SANITIZE (this); | 1479 TRACE_SANITIZE (this); |
1480 if (!c->check_struct (this)) return TRACE_RETURN (false); | 1480 if (!c->check_struct (this)) return TRACE_RETURN (false); |
1481 unsigned int count = glyphCount; | 1481 unsigned int count = glyphCount; |
| 1482 if (!count) return TRACE_RETURN (false); /* We want to access coverage[0] fr
eely. */ |
1482 if (!c->check_array (coverage, coverage[0].static_size, count)) return TRACE
_RETURN (false); | 1483 if (!c->check_array (coverage, coverage[0].static_size, count)) return TRACE
_RETURN (false); |
1483 for (unsigned int i = 0; i < count; i++) | 1484 for (unsigned int i = 0; i < count; i++) |
1484 if (!coverage[i].sanitize (c, this)) return TRACE_RETURN (false); | 1485 if (!coverage[i].sanitize (c, this)) return TRACE_RETURN (false); |
1485 LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, covera
ge[0].static_size * count); | 1486 LookupRecord *lookupRecord = &StructAtOffset<LookupRecord> (coverage, covera
ge[0].static_size * count); |
1486 return TRACE_RETURN (c->check_array (lookupRecord, lookupRecord[0].static_si
ze, lookupCount)); | 1487 return TRACE_RETURN (c->check_array (lookupRecord, lookupRecord[0].static_si
ze, lookupCount)); |
1487 } | 1488 } |
1488 | 1489 |
1489 protected: | 1490 protected: |
1490 USHORT format; /* Format identifier--format = 3 */ | 1491 USHORT format; /* Format identifier--format = 3 */ |
1491 USHORT glyphCount; /* Number of glyphs in the input glyph | 1492 USHORT glyphCount; /* Number of glyphs in the input glyph |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 input.len, (const USHORT *)
input.array + 1, | 2084 input.len, (const USHORT *)
input.array + 1, |
2084 lookahead.len, (const USHOR
T *) lookahead.array, | 2085 lookahead.len, (const USHOR
T *) lookahead.array, |
2085 lookup.len, lookup.array, l
ookup_context)); | 2086 lookup.len, lookup.array, l
ookup_context)); |
2086 } | 2087 } |
2087 | 2088 |
2088 inline bool sanitize (hb_sanitize_context_t *c) { | 2089 inline bool sanitize (hb_sanitize_context_t *c) { |
2089 TRACE_SANITIZE (this); | 2090 TRACE_SANITIZE (this); |
2090 if (!backtrack.sanitize (c, this)) return TRACE_RETURN (false); | 2091 if (!backtrack.sanitize (c, this)) return TRACE_RETURN (false); |
2091 OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (back
track); | 2092 OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (back
track); |
2092 if (!input.sanitize (c, this)) return TRACE_RETURN (false); | 2093 if (!input.sanitize (c, this)) return TRACE_RETURN (false); |
| 2094 if (!input.len) return TRACE_RETURN (false); /* To be consistent with Contex
t. */ |
2093 OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (
input); | 2095 OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (
input); |
2094 if (!lookahead.sanitize (c, this)) return TRACE_RETURN (false); | 2096 if (!lookahead.sanitize (c, this)) return TRACE_RETURN (false); |
2095 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahe
ad); | 2097 ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahe
ad); |
2096 return TRACE_RETURN (lookup.sanitize (c)); | 2098 return TRACE_RETURN (lookup.sanitize (c)); |
2097 } | 2099 } |
2098 | 2100 |
2099 protected: | 2101 protected: |
2100 USHORT format; /* Format identifier--format = 3 */ | 2102 USHORT format; /* Format identifier--format = 3 */ |
2101 OffsetArrayOf<Coverage> | 2103 OffsetArrayOf<Coverage> |
2102 backtrack; /* Array of coverage tables | 2104 backtrack; /* Array of coverage tables |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2289 lookupList; /* LookupList table */ | 2291 lookupList; /* LookupList table */ |
2290 public: | 2292 public: |
2291 DEFINE_SIZE_STATIC (10); | 2293 DEFINE_SIZE_STATIC (10); |
2292 }; | 2294 }; |
2293 | 2295 |
2294 | 2296 |
2295 } /* namespace OT */ | 2297 } /* namespace OT */ |
2296 | 2298 |
2297 | 2299 |
2298 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */ | 2300 #endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */ |
OLD | NEW |