278 ligGlyph; /* Array of LigGlyph tables
279 * in Coverage Index order */
280 public:
281 DEFINE_SIZE_ARRAY (4, ligGlyph);
282 };
283
284
285 struct MarkGlyphSetsFormat1
286 {
287 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
288 { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
289
290 inline bool sanitize (hb_sanitize_context_t *c) const
291 {
292 TRACE_SANITIZE (this);
293 return_trace (coverage.sanitize (c, this));
294 }
295
296 protected:
297 USHORT format; /* Format identifier--format = 1 */
298 ArrayOf<OffsetTo<Coverage, ULONG> >
299 coverage; /* Array of long offsets to mark set
300 * coverage tables */
301 public:
302 DEFINE_SIZE_ARRAY (4, coverage);
303 };
304
305 struct MarkGlyphSets
306 {
307 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
308 {
309 switch (u.format) {
310 case 1: return u.format1.covers (set_index, glyph_id);
311 default:return false;
312 }
313 }
314
315 inline bool sanitize (hb_sanitize_context_t *c) const
316 {
317 TRACE_SANITIZE (this);
318 if (!u.format.sanitize (c)) return_trace (false);
387 inline bool sanitize (hb_sanitize_context_t *c) const
388 {
389 TRACE_SANITIZE (this);
390 return_trace (version.sanitize (c) &&
391 likely (version.major == 1) &&
392 glyphClassDef.sanitize (c, this) &&
393 attachList.sanitize (c, this) &&
394 ligCaretList.sanitize (c, this) &&
395 markAttachClassDef.sanitize (c, this) &&
396 (version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this)) &&
397 (version.to_int () < 0x00010003u || varStore.sanitize (c, this)));
398 }
399
400 /* glyph_props is a 16-bit integer where the lower 8-bit have bits representing
401 * glyph class and other bits, and high 8-bit gthe mark attachment type (if any).
402 * Not to be confused with lookup_props which is very similar. */
403 inline unsigned int get_glyph_props (hb_codepoint_t glyph) const
404 {
405 unsigned int klass = get_glyph_class (glyph);
406
407 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH == (unsigned int) LookupFlag::IgnoreBaseGlyphs);
408 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE == (unsigned int) LookupFlag::IgnoreLigatures);
409 ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_MARK == (unsigned int) LookupFlag::IgnoreMarks);
410
411 switch (klass) {
412 default: return 0;
413 case BaseGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH;
414 case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
415 case MarkGlyph:
416 klass = get_mark_attachment_type (glyph);
417 return HB_OT_LAYOUT_GLYPH_PROPS_MARK | (klass << 8);
418 }
419 }
420
421
422 protected:
423 FixedVersion<>version; /* Version of the GDEF table--currently
424 * 0x00010003u */
425 OffsetTo<ClassDef>
426 glyphClassDef; /* Offset to class definition table
427 * for glyph type--from beginning of
428 * GDEF header (may be Null) */
429 OffsetTo<AttachList>
430 attachList; /* Offset to list of glyphs with
431 * attachment points--from beginning
432 * of GDEF header (may be Null) */
433 OffsetTo<LigCaretList>
434 ligCaretList; /* Offset to list of positioning points
435 * for ligature carets--from beginning
436 * of GDEF header (may be Null) */
437 OffsetTo<ClassDef>
438 markAttachClassDef; /* Offset to class definition table for
439 * mark attachment type--from beginning
440 * of GDEF header (may be Null) */
441 OffsetTo<MarkGlyphSets>
442 markGlyphSetsDef; /* Offset to the table of mark set
443 * definitions--from beginning of GDEF
444 * header (may be NULL). Introduced
445 * in version 0x00010002. */
446 OffsetTo<VariationStore, ULONG>
447 varStore; /* Offset to the table of Item Variation
448 * Store--from beginning of GDEF
449 * header (may be NULL). Introduced
450 * in version 0x00010003. */
451 public:
452 DEFINE_SIZE_MIN (12);
453 };
454
455
456 } /* namespace OT */
457
458
459 #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */
|
278 ligGlyph; /* Array of LigGlyph tables
279 * in Coverage Index order */
280 public:
281 DEFINE_SIZE_ARRAY (4, ligGlyph);
282 };
283
284
285 struct MarkGlyphSetsFormat1
286 {
287 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
288 { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
289
290 inline bool sanitize (hb_sanitize_context_t *c) const
291 {
292 TRACE_SANITIZE (this);
293 return_trace (coverage.sanitize (c, this));
294 }
295
296 protected:
297 USHORT format; /* Format identifier--format = 1 */
298 ArrayOf<LOffsetTo<Coverage> >
299 coverage; /* Array of long offsets to mark set
300 * coverage tables */
301 public:
302 DEFINE_SIZE_ARRAY (4, coverage);
303 };
304
305 struct MarkGlyphSets
306 {
307 inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
308 {
309 switch (u.format) {
310 case 1: return u.format1.covers (set_index, glyph_id);
311 default:return false;
312 }
313 }
314
315 inline bool sanitize (hb_sanitize_context_t *c) const
316 {
317 TRACE_SANITIZE (this);
318 if (!u.format.sanitize (c)) return_trace (false);
387 inline bool sanitize (hb_sanitize_context_t *c) const
388 {
389 TRACE_SANITIZE (this);
390 return_trace (version.sanitize (c) &&
391 likely (version.major == 1) &&
392 glyphClassDef.sanitize (c, this) &&
393 attachList.sanitize (c, this) &&
394 ligCaretList.sanitize (c, this) &&
395 markAttachClassDef.sanitize (c, this) &&
396 (version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this)) &&
397 (version.to_int () < 0x00010003u || varStore.sanitize (c, this)));
398 }
399
400 /* glyph_props is a 16-bit integer where the lower 8-bit have bits representing
401 * glyph class and other bits, and high 8-bit gthe mark attachment type (if any).
402 * Not to be confused with lookup_props which is very similar. */
403 inline unsigned int get_glyph_props (hb_codepoint_t glyph) const
404 {
405 unsigned int klass = get_glyph_class (glyph);
406
407 static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH == (unsigned int) LookupFlag::IgnoreBaseGlyphs), "");
408 static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE == (unsigned int) LookupFlag::IgnoreLigatures), "");
409 static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_MARK == (unsigned int) LookupFlag::IgnoreMarks), "");
410
411 switch (klass) {
412 default: return 0;
413 case BaseGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH;
414 case LigatureGlyph: return HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
415 case MarkGlyph:
416 klass = get_mark_attachment_type (glyph);
417 return HB_OT_LAYOUT_GLYPH_PROPS_MARK | (klass << 8);
418 }
419 }
420
421
422 protected:
423 FixedVersion<>version; /* Version of the GDEF table--currently
424 * 0x00010003u */
425 OffsetTo<ClassDef>
426 glyphClassDef; /* Offset to class definition table
427 * for glyph type--from beginning of
428 * GDEF header (may be Null) */
429 OffsetTo<AttachList>
430 attachList; /* Offset to list of glyphs with
431 * attachment points--from beginning
432 * of GDEF header (may be Null) */
433 OffsetTo<LigCaretList>
434 ligCaretList; /* Offset to list of positioning points
435 * for ligature carets--from beginning
436 * of GDEF header (may be Null) */
437 OffsetTo<ClassDef>
438 markAttachClassDef; /* Offset to class definition table for
439 * mark attachment type--from beginning
440 * of GDEF header (may be Null) */
441 OffsetTo<MarkGlyphSets>
442 markGlyphSetsDef; /* Offset to the table of mark set
443 * definitions--from beginning of GDEF
444 * header (may be NULL). Introduced
445 * in version 0x00010002. */
446 LOffsetTo<VariationStore>
447 varStore; /* Offset to the table of Item Variation
448 * Store--from beginning of GDEF
449 * header (may be NULL). Introduced
450 * in version 0x00010003. */
451 public:
452 DEFINE_SIZE_MIN (12);
453 };
454
455
456 } /* namespace OT */
457
458
459 #endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */
|