| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2011,2012 Google, Inc. | 2 * Copyright © 2011,2012 Google, Inc. |
| 3 * | 3 * |
| 4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
| 5 * | 5 * |
| 6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
| 7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
| 8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
| 9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
| 10 * all copies of this software. | 10 * all copies of this software. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 * hmtx -- The Horizontal Metrics Table | 37 * hmtx -- The Horizontal Metrics Table |
| 38 * vmtx -- The Vertical Metrics Table | 38 * vmtx -- The Vertical Metrics Table |
| 39 */ | 39 */ |
| 40 | 40 |
| 41 #define HB_OT_TAG_hmtx HB_TAG('h','m','t','x') | 41 #define HB_OT_TAG_hmtx HB_TAG('h','m','t','x') |
| 42 #define HB_OT_TAG_vmtx HB_TAG('v','m','t','x') | 42 #define HB_OT_TAG_vmtx HB_TAG('v','m','t','x') |
| 43 | 43 |
| 44 | 44 |
| 45 struct LongMetric | 45 struct LongMetric |
| 46 { | 46 { |
| 47 USHORT» advance; /* Advance width/height. */ | 47 UFWORD» advance; /* Advance width/height. */ |
| 48 SHORT»» lsb; /* Leading (left/top) side bearing. */ | 48 FWORD»» lsb; /* Leading (left/top) side bearing. */ |
| 49 public: | 49 public: |
| 50 DEFINE_SIZE_STATIC (4); | 50 DEFINE_SIZE_STATIC (4); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 struct _mtx | 53 struct _mtx |
| 54 { | 54 { |
| 55 static const hb_tag_t tableTag = HB_TAG('_','m','t','x'); | 55 static const hb_tag_t tableTag = HB_TAG('_','m','t','x'); |
| 56 | 56 |
| 57 static const hb_tag_t hmtxTag = HB_OT_TAG_hmtx; | 57 static const hb_tag_t hmtxTag = HB_OT_TAG_hmtx; |
| 58 static const hb_tag_t vmtxTag = HB_OT_TAG_vmtx; | 58 static const hb_tag_t vmtxTag = HB_OT_TAG_vmtx; |
| 59 | 59 |
| 60 inline bool sanitize (hb_sanitize_context_t *c) const | 60 inline bool sanitize (hb_sanitize_context_t *c) const |
| 61 { | 61 { |
| 62 TRACE_SANITIZE (this); | 62 TRACE_SANITIZE (this); |
| 63 /* We don't check for anything specific here. The users of the | 63 /* We don't check for anything specific here. The users of the |
| 64 * struct do all the hard work... */ | 64 * struct do all the hard work... */ |
| 65 return_trace (true); | 65 return_trace (true); |
| 66 } | 66 } |
| 67 | 67 |
| 68 public: | 68 public: |
| 69 LongMetric longMetric[VAR]; /* Paired advance width and leading | 69 LongMetric longMetric[VAR]; /* Paired advance width and leading |
| 70 * bearing values for each glyph. The | 70 * bearing values for each glyph. The |
| 71 * value numOfHMetrics comes from | 71 * value numOfHMetrics comes from |
| 72 * the 'hhea' table. If the font is | 72 * the 'hhea' table. If the font is |
| 73 * monospaced, only one entry need | 73 * monospaced, only one entry need |
| 74 * be in the array, but that entry is | 74 * be in the array, but that entry is |
| 75 * required. The last entry applies to | 75 * required. The last entry applies to |
| 76 * all subsequent glyphs. */ | 76 * all subsequent glyphs. */ |
| 77 SHORT»» leadingBearingX[VAR];» /* Here the advance is assumed | 77 FWORD»» leadingBearingX[VAR];» /* Here the advance is assumed |
| 78 * to be the same as the advance | 78 * to be the same as the advance |
| 79 * for the last entry above. The | 79 * for the last entry above. The |
| 80 * number of entries in this array is | 80 * number of entries in this array is |
| 81 * derived from numGlyphs (from 'maxp' | 81 * derived from numGlyphs (from 'maxp' |
| 82 * table) minus numberOfLongMetrics. | 82 * table) minus numberOfLongMetrics. |
| 83 * This generally is used with a run | 83 * This generally is used with a run |
| 84 * of monospaced glyphs (e.g., Kanji | 84 * of monospaced glyphs (e.g., Kanji |
| 85 * fonts or Courier fonts). Only one | 85 * fonts or Courier fonts). Only one |
| 86 * run is allowed and it must be at | 86 * run is allowed and it must be at |
| 87 * the end. This allows a monospaced | 87 * the end. This allows a monospaced |
| 88 * font to vary the side bearing | 88 * font to vary the side bearing |
| 89 * values for each glyph. */ | 89 * values for each glyph. */ |
| 90 public: | 90 public: |
| 91 DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX); | 91 DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 struct hmtx : _mtx { | 94 struct hmtx : _mtx { |
| 95 static const hb_tag_t tableTag = HB_OT_TAG_hmtx; | 95 static const hb_tag_t tableTag = HB_OT_TAG_hmtx; |
| 96 }; | 96 }; |
| 97 struct vmtx : _mtx { | 97 struct vmtx : _mtx { |
| 98 static const hb_tag_t tableTag = HB_OT_TAG_vmtx; | 98 static const hb_tag_t tableTag = HB_OT_TAG_vmtx; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 } /* namespace OT */ | 101 } /* namespace OT */ |
| 102 | 102 |
| 103 | 103 |
| 104 #endif /* HB_OT_HMTX_TABLE_HH */ | 104 #endif /* HB_OT_HMTX_TABLE_HH */ |
| OLD | NEW |