src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-kern-table.hh
changeset 50352 25db2c8f3cf8
parent 48274 51772bf1fb0c
child 50826 f5b95be8b6e2
--- a/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-kern-table.hh	Wed May 30 08:10:41 2018 -0700
+++ b/src/java.desktop/share/native/libfontmanager/harfbuzz/hb-ot-kern-table.hh	Wed May 30 12:20:00 2018 -0700
@@ -104,8 +104,8 @@
   }
 
   protected:
-  USHORT                firstGlyph;     /* First glyph in class range. */
-  ArrayOf<USHORT>       classes;        /* Glyph classes. */
+  HBUINT16              firstGlyph;     /* First glyph in class range. */
+  ArrayOf<HBUINT16>     classes;        /* Glyph classes. */
   public:
   DEFINE_SIZE_ARRAY (4, classes);
 };
@@ -115,7 +115,7 @@
   inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right, const char *end) const
   {
     unsigned int l = (this+leftClassTable).get_class (left);
-    unsigned int r = (this+leftClassTable).get_class (left);
+    unsigned int r = (this+rightClassTable).get_class (right);
     unsigned int offset = l * rowWidth + r * sizeof (FWORD);
     const FWORD *arr = &(this+array);
     if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
@@ -136,7 +136,7 @@
   }
 
   protected:
-  USHORT        rowWidth;       /* The width, in bytes, of a row in the table. */
+  HBUINT16      rowWidth;       /* The width, in bytes, of a row in the table. */
   OffsetTo<KernClassTable>
                 leftClassTable; /* Offset from beginning of this subtable to
                                  * left-hand class table. */
@@ -275,19 +275,19 @@
     };
 
     protected:
-    USHORT      versionZ;       /* Unused. */
-    USHORT      length;         /* Length of the subtable (including this header). */
-    BYTE        format;         /* Subtable format. */
-    BYTE        coverage;       /* Coverage bits. */
+    HBUINT16    versionZ;       /* Unused. */
+    HBUINT16    length;         /* Length of the subtable (including this header). */
+    HBUINT8     format;         /* Subtable format. */
+    HBUINT8     coverage;       /* Coverage bits. */
     KernSubTable subtable;      /* Subtable data. */
     public:
     DEFINE_SIZE_MIN (6);
   };
 
   protected:
-  USHORT        version;        /* Version--0x0000u */
-  USHORT        nTables;        /* Number of subtables in the kerning table. */
-  BYTE          data[VAR];
+  HBUINT16      version;        /* Version--0x0000u */
+  HBUINT16      nTables;        /* Number of subtables in the kerning table. */
+  HBUINT8               data[VAR];
   public:
   DEFINE_SIZE_ARRAY (4, data);
 };
@@ -314,10 +314,10 @@
     };
 
     protected:
-    ULONG       length;         /* Length of the subtable (including this header). */
-    BYTE        coverage;       /* Coverage bits. */
-    BYTE        format;         /* Subtable format. */
-    USHORT      tupleIndex;     /* The tuple index (used for variations fonts).
+    HBUINT32    length;         /* Length of the subtable (including this header). */
+    HBUINT8     coverage;       /* Coverage bits. */
+    HBUINT8     format;         /* Subtable format. */
+    HBUINT16    tupleIndex;     /* The tuple index (used for variations fonts).
                                  * This value specifies which tuple this subtable covers. */
     KernSubTable subtable;      /* Subtable data. */
     public:
@@ -325,9 +325,9 @@
   };
 
   protected:
-  ULONG         version;        /* Version--0x00010000u */
-  ULONG         nTables;        /* Number of subtables in the kerning table. */
-  BYTE          data[VAR];
+  HBUINT32              version;        /* Version--0x00010000u */
+  HBUINT32              nTables;        /* Number of subtables in the kerning table. */
+  HBUINT8               data[VAR];
   public:
   DEFINE_SIZE_ARRAY (8, data);
 };
@@ -358,24 +358,29 @@
 
   struct accelerator_t
   {
-    inline void init (const kern *table_, unsigned int table_length_)
+    inline void init (hb_face_t *face)
     {
-      table = table_;
-      table_length = table_length_;
+      blob = Sanitizer<kern>().sanitize (face->reference_table (HB_OT_TAG_kern));
+      table = Sanitizer<kern>::lock_instance (blob);
+      table_length = hb_blob_get_length (blob);
     }
-    inline void fini (void) {}
+    inline void fini (void)
+    {
+      hb_blob_destroy (blob);
+    }
 
     inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
     { return table->get_h_kerning (left, right, table_length); }
 
     private:
+    hb_blob_t *blob;
     const kern *table;
     unsigned int table_length;
   };
 
   protected:
   union {
-  USHORT                major;
+  HBUINT16              major;
   KernOT                ot;
   KernAAT               aat;
   } u;