Imported Upstream version 0.9.40
[platform/upstream/harfbuzz.git] / src / hb-ot-hmtx-table.hh
index e918e3b..a0e3855 100644 (file)
@@ -35,24 +35,30 @@ namespace OT {
 
 /*
  * hmtx -- The Horizontal Metrics Table
+ * vmtx -- The Vertical Metrics Table
  */
 
 #define HB_OT_TAG_hmtx HB_TAG('h','m','t','x')
+#define HB_OT_TAG_vmtx HB_TAG('v','m','t','x')
 
 
-struct LongHorMetric
+struct LongMetric
 {
-  USHORT       advanceWidth;
-  SHORT                lsb;
+  USHORT       advance; /* Advance width/height. */
+  SHORT                lsb; /* Leading (left/top) side bearing. */
   public:
   DEFINE_SIZE_STATIC (4);
 };
 
-struct hmtx
+struct _mtx
 {
-  static const hb_tag_t tableTag       = HB_OT_TAG_hmtx;
+  static const hb_tag_t tableTag = HB_TAG('_','m','t','x');
+
+  static const hb_tag_t hmtxTag        = HB_OT_TAG_hmtx;
+  static const hb_tag_t vmtxTag        = HB_OT_TAG_vmtx;
 
-  inline bool sanitize (hb_sanitize_context_t *c) {
+  inline bool sanitize (hb_sanitize_context_t *c) const
+  {
     TRACE_SANITIZE (this);
     /* We don't check for anything specific here.  The users of the
      * struct do all the hard work... */
@@ -60,7 +66,7 @@ struct hmtx
   }
 
   public:
-  LongHorMetric        longHorMetric[VAR];     /* Paired advance width and left side
+  LongMetric   longMetric[VAR];        /* Paired advance width and leading
                                         * bearing values for each glyph. The
                                         * value numOfHMetrics comes from
                                         * the 'hhea' table. If the font is
@@ -68,23 +74,29 @@ struct hmtx
                                         * be in the array, but that entry is
                                         * required. The last entry applies to
                                         * all subsequent glyphs. */
-  SHORT                leftSideBearingX[VAR];  /* Here the advanceWidth is assumed
-                                        * to be the same as the advanceWidth
+  SHORT                leadingBearingX[VAR];   /* Here the advance is assumed
+                                        * to be the same as the advance
                                         * for the last entry above. The
                                         * number of entries in this array is
                                         * derived from numGlyphs (from 'maxp'
-                                        * table) minus numberOfHMetrics. This
-                                        * generally is used with a run of
-                                        * monospaced glyphs (e.g., Kanji
+                                        * table) minus numberOfLongMetrics.
+                                        * This generally is used with a run
+                                        * of monospaced glyphs (e.g., Kanji
                                         * fonts or Courier fonts). Only one
                                         * run is allowed and it must be at
                                         * the end. This allows a monospaced
-                                        * font to vary the left side bearing
+                                        * font to vary the side bearing
                                         * values for each glyph. */
   public:
-  DEFINE_SIZE_ARRAY2 (0, longHorMetric, leftSideBearingX);
+  DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX);
 };
 
+struct hmtx : _mtx {
+  static const hb_tag_t tableTag       = HB_OT_TAG_hmtx;
+};
+struct vmtx : _mtx {
+  static const hb_tag_t tableTag       = HB_OT_TAG_vmtx;
+};
 
 } /* namespace OT */