124bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod/* 20ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod * Copyright © 2011,2012 Google, Inc. 324bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * 424bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * This is part of HarfBuzz, a text shaping library. 524bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * 624bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * Permission is hereby granted, without written agreement and without 724bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this 824bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * software and its documentation for any purpose, provided that the 924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * above copyright notice and the following two paragraphs appear in 1024bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * all copies of this software. 1124bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * 1224bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 1324bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 1424bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN 1524bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 1624bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * DAMAGE. 1724bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * 1824bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, 1924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 2024bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS 2124bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO 2224bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 2324bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * 2424bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * Google Author(s): Behdad Esfahbod 2524bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod */ 2624bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 2724bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod#ifndef HB_OT_HMTX_TABLE_HH 2824bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod#define HB_OT_HMTX_TABLE_HH 2924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 3024bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod#include "hb-open-type-private.hh" 3124bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 3224bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 337c8e844d92aa604fc4b396343721ea90eb83adb8Behdad Esfahbodnamespace OT { 347c8e844d92aa604fc4b396343721ea90eb83adb8Behdad Esfahbod 3524bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 3624bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod/* 3724bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * hmtx -- The Horizontal Metrics Table 38d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod * vmtx -- The Vertical Metrics Table 3924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod */ 4024bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 4124bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod#define HB_OT_TAG_hmtx HB_TAG('h','m','t','x') 42d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod#define HB_OT_TAG_vmtx HB_TAG('v','m','t','x') 4324bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 4424bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 45d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbodstruct LongMetric 4624bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod{ 47d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod USHORT advance; /* Advance width/height. */ 48d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod SHORT lsb; /* Leading (left/top) side bearing. */ 4924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod public: 5024bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod DEFINE_SIZE_STATIC (4); 5124bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod}; 5224bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 53d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbodstruct _mtx 5424bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod{ 55153beebba9b76901b8b62b90ba0dc69462ae2090Behdad Esfahbod static const hb_tag_t tableTag = HB_TAG('_','m','t','x'); 56153beebba9b76901b8b62b90ba0dc69462ae2090Behdad Esfahbod 57d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod static const hb_tag_t hmtxTag = HB_OT_TAG_hmtx; 58d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod static const hb_tag_t vmtxTag = HB_OT_TAG_vmtx; 5924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 6024bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod inline bool sanitize (hb_sanitize_context_t *c) { 61be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod TRACE_SANITIZE (this); 6224bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod /* We don't check for anything specific here. The users of the 6324bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * struct do all the hard work... */ 640ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod return TRACE_RETURN (true); 6524bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod } 6624bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 67903648437c180c7b039801cdb0672e0f8e14afd4Behdad Esfahbod public: 68be1cca270257bfdfee3fbe821175269713acf408Behdad Esfahbod LongMetric longMetric[VAR]; /* Paired advance width and leading 6924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * bearing values for each glyph. The 7024bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * value numOfHMetrics comes from 7124bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * the 'hhea' table. If the font is 7224bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * monospaced, only one entry need 7324bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * be in the array, but that entry is 7424bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * required. The last entry applies to 7524bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * all subsequent glyphs. */ 76d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod SHORT leadingBearingX[VAR]; /* Here the advance is assumed 77d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod * to be the same as the advance 7824bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * for the last entry above. The 7924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * number of entries in this array is 8024bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * derived from numGlyphs (from 'maxp' 81d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod * table) minus numberOfLongMetrics. 82d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod * This generally is used with a run 83d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod * of monospaced glyphs (e.g., Kanji 8424bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * fonts or Courier fonts). Only one 8524bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * run is allowed and it must be at 8624bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * the end. This allows a monospaced 87d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod * font to vary the side bearing 8824bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod * values for each glyph. */ 8924bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod public: 90be1cca270257bfdfee3fbe821175269713acf408Behdad Esfahbod DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX); 9124bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod}; 9224bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod 93d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbodstruct hmtx : _mtx { 94d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod static const hb_tag_t tableTag = HB_OT_TAG_hmtx; 95d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod}; 96d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbodstruct vmtx : _mtx { 97d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod static const hb_tag_t tableTag = HB_OT_TAG_vmtx; 98d41b809e9d21e655129a97c600d28f278fd7e62cBehdad Esfahbod}; 997c8e844d92aa604fc4b396343721ea90eb83adb8Behdad Esfahbod 1007d52e6601f0e695690cd168a288466746cf25300Behdad Esfahbod} /* namespace OT */ 1017c8e844d92aa604fc4b396343721ea90eb83adb8Behdad Esfahbod 1027c8e844d92aa604fc4b396343721ea90eb83adb8Behdad Esfahbod 10324bcdbcc0639ca9e9c0fde1a71cbbf1c3d2ef98dBehdad Esfahbod#endif /* HB_OT_HMTX_TABLE_HH */ 104