| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2007,2008,2009 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009 Red Hat, Inc. |
| 3 * Copyright © 2010,2011,2012 Google, Inc. | 3 * Copyright © 2010,2011,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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const | 275 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const |
| 276 { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; } | 276 { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; } |
| 277 | 277 |
| 278 inline bool sanitize (hb_sanitize_context_t *c) { | 278 inline bool sanitize (hb_sanitize_context_t *c) { |
| 279 TRACE_SANITIZE (this); | 279 TRACE_SANITIZE (this); |
| 280 return TRACE_RETURN (coverage.sanitize (c, this)); | 280 return TRACE_RETURN (coverage.sanitize (c, this)); |
| 281 } | 281 } |
| 282 | 282 |
| 283 protected: | 283 protected: |
| 284 USHORT format; /* Format identifier--format = 1 */ | 284 USHORT format; /* Format identifier--format = 1 */ |
| 285 LongOffsetArrayOf<Coverage> | 285 ArrayOf<OffsetTo<Coverage, ULONG> > |
| 286 coverage; /* Array of long offsets to mark set | 286 coverage; /* Array of long offsets to mark set |
| 287 * coverage tables */ | 287 * coverage tables */ |
| 288 public: | 288 public: |
| 289 DEFINE_SIZE_ARRAY (4, coverage); | 289 DEFINE_SIZE_ARRAY (4, coverage); |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 struct MarkGlyphSets | 292 struct MarkGlyphSets |
| 293 { | 293 { |
| 294 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const | 294 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const |
| 295 { | 295 { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 inline bool has_lig_carets (void) const { return ligCaretList != 0; } | 354 inline bool has_lig_carets (void) const { return ligCaretList != 0; } |
| 355 inline unsigned int get_lig_carets (hb_font_t *font, | 355 inline unsigned int get_lig_carets (hb_font_t *font, |
| 356 hb_direction_t direction, | 356 hb_direction_t direction, |
| 357 hb_codepoint_t glyph_id, | 357 hb_codepoint_t glyph_id, |
| 358 unsigned int start_offset, | 358 unsigned int start_offset, |
| 359 unsigned int *caret_count /* IN/OUT */, | 359 unsigned int *caret_count /* IN/OUT */, |
| 360 hb_position_t *caret_array /* OUT */) cons
t | 360 hb_position_t *caret_array /* OUT */) cons
t |
| 361 { return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_
offset, caret_count, caret_array); } | 361 { return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_
offset, caret_count, caret_array); } |
| 362 | 362 |
| 363 inline bool has_mark_sets (void) const { return version.to_int () >= 0x0001000
2 && markGlyphSetsDef[0] != 0; } | 363 inline bool has_mark_sets (void) const { return version.to_int () >= 0x0001000
2u && markGlyphSetsDef[0] != 0; } |
| 364 inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id)
const | 364 inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id)
const |
| 365 { return version.to_int () >= 0x00010002 && (this+markGlyphSetsDef[0]).covers
(set_index, glyph_id); } | 365 { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef[0]).covers
(set_index, glyph_id); } |
| 366 | 366 |
| 367 inline bool sanitize (hb_sanitize_context_t *c) { | 367 inline bool sanitize (hb_sanitize_context_t *c) { |
| 368 TRACE_SANITIZE (this); | 368 TRACE_SANITIZE (this); |
| 369 return TRACE_RETURN (version.sanitize (c) && | 369 return TRACE_RETURN (version.sanitize (c) && |
| 370 likely (version.major == 1) && | 370 likely (version.major == 1) && |
| 371 glyphClassDef.sanitize (c, this) && | 371 glyphClassDef.sanitize (c, this) && |
| 372 attachList.sanitize (c, this) && | 372 attachList.sanitize (c, this) && |
| 373 ligCaretList.sanitize (c, this) && | 373 ligCaretList.sanitize (c, this) && |
| 374 markAttachClassDef.sanitize (c, this) && | 374 markAttachClassDef.sanitize (c, this) && |
| 375 » » » (version.to_int () < 0x00010002 || markGlyphSetsDef[0].
sanitize (c, this))); | 375 » » » (version.to_int () < 0x00010002u || markGlyphSetsDef[0]
.sanitize (c, this))); |
| 376 } | 376 } |
| 377 | 377 |
| 378 | 378 |
| 379 /* glyph_props is a 16-bit integer where the lower 8-bit have bits representin
g | 379 /* glyph_props is a 16-bit integer where the lower 8-bit have bits representin
g |
| 380 * glyph class and other bits, and high 8-bit gthe mark attachment type (if an
y). | 380 * glyph class and other bits, and high 8-bit gthe mark attachment type (if an
y). |
| 381 * Not to be confused with lookup_props which is very similar. */ | 381 * Not to be confused with lookup_props which is very similar. */ |
| 382 inline unsigned int get_glyph_props (hb_codepoint_t glyph) const | 382 inline unsigned int get_glyph_props (hb_codepoint_t glyph) const |
| 383 { | 383 { |
| 384 unsigned int klass = get_glyph_class (glyph); | 384 unsigned int klass = get_glyph_class (glyph); |
| 385 | 385 |
| 386 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH == (unsign
ed int) LookupFlag::IgnoreBaseGlyphs); | 386 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH == (unsign
ed int) LookupFlag::IgnoreBaseGlyphs); |
| 387 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE == (unsigned
int) LookupFlag::IgnoreLigatures); | 387 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE == (unsigned
int) LookupFlag::IgnoreLigatures); |
| 388 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_MARK == (unsigned int
) LookupFlag::IgnoreMarks); | 388 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_MARK == (unsigned int
) LookupFlag::IgnoreMarks); |
| 389 | 389 |
| 390 switch (klass) { | 390 switch (klass) { |
| 391 default: return 0; | 391 default: return 0; |
| 392 case BaseGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH; | 392 case BaseGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH; |
| 393 case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE; | 393 case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE; |
| 394 case MarkGlyph: | 394 case MarkGlyph: |
| 395 klass = get_mark_attachment_type (glyph); | 395 klass = get_mark_attachment_type (glyph); |
| 396 return HB_OT_LAYOUT_GLYPH_PROPS_MARK | (klass << 8); | 396 return HB_OT_LAYOUT_GLYPH_PROPS_MARK | (klass << 8); |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 | 399 |
| 400 | 400 |
| 401 protected: | 401 protected: |
| 402 FixedVersion version; /* Version of the GDEF table--currently | 402 FixedVersion version; /* Version of the GDEF table--currently |
| 403 » » » » » * 0x00010002 */ | 403 » » » » » * 0x00010002u */ |
| 404 OffsetTo<ClassDef> | 404 OffsetTo<ClassDef> |
| 405 glyphClassDef; /* Offset to class definition table | 405 glyphClassDef; /* Offset to class definition table |
| 406 * for glyph type--from beginning of | 406 * for glyph type--from beginning of |
| 407 * GDEF header (may be Null) */ | 407 * GDEF header (may be Null) */ |
| 408 OffsetTo<AttachList> | 408 OffsetTo<AttachList> |
| 409 attachList; /* Offset to list of glyphs with | 409 attachList; /* Offset to list of glyphs with |
| 410 * attachment points--from beginning | 410 * attachment points--from beginning |
| 411 * of GDEF header (may be Null) */ | 411 * of GDEF header (may be Null) */ |
| 412 OffsetTo<LigCaretList> | 412 OffsetTo<LigCaretList> |
| 413 ligCaretList; /* Offset to list of positioning points | 413 ligCaretList; /* Offset to list of positioning points |
| (...skipping 10 matching lines...) Expand all Loading... |
| 424 * in version 00010002. */ | 424 * in version 00010002. */ |
| 425 public: | 425 public: |
| 426 DEFINE_SIZE_ARRAY (12, markGlyphSetsDef); | 426 DEFINE_SIZE_ARRAY (12, markGlyphSetsDef); |
| 427 }; | 427 }; |
| 428 | 428 |
| 429 | 429 |
| 430 } /* namespace OT */ | 430 } /* namespace OT */ |
| 431 | 431 |
| 432 | 432 |
| 433 #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */ | 433 #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */ |
| OLD | NEW |