[aat] Add Class subtable thingy
authorBehdad Esfahbod <behdad@behdad.org>
Wed, 10 Jan 2018 10:09:53 +0000 (11:09 +0100)
committerBehdad Esfahbod <behdad@behdad.org>
Wed, 10 Jan 2018 12:58:41 +0000 (13:58 +0100)
From old 'mort' table.

src/hb-aat-layout-common-private.hh

index c3058682dee4292abc776bcab2f06d3cd940d464..4b96ee6c9b3db41a57225b6d0a1e2824656917e8 100644 (file)
@@ -424,6 +424,30 @@ struct Lookup
 };
 
 
+struct Class
+{
+  inline unsigned int get_class (hb_codepoint_t glyph_id) const
+  {
+    return firstGlyph <= glyph_id && glyph_id - firstGlyph < glyphCount ? classArrayZ[glyph_id - firstGlyph] : 1;
+  }
+
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this) && classArrayZ.sanitize (c, glyphCount));
+  }
+
+  protected:
+  GlyphID      firstGlyph;     /* First glyph index included in the trimmed array. */
+  HBUINT16     glyphCount;     /* Total number of glyphs (equivalent to the last
+                                * glyph minus the value of firstGlyph plus 1). */
+  UnsizedArrayOf<HBUINT8>
+               classArrayZ;    /* The class codes (indexed by glyph index minus
+                                * firstGlyph). */
+  public:
+  DEFINE_SIZE_ARRAY (4, classArrayZ);
+};
+
 } /* namespace AAT */