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 17 matching lines...) Expand all Loading... |
28 #define HB_OT_HMTX_TABLE_HH | 28 #define HB_OT_HMTX_TABLE_HH |
29 | 29 |
30 #include "hb-open-type-private.hh" | 30 #include "hb-open-type-private.hh" |
31 | 31 |
32 | 32 |
33 namespace OT { | 33 namespace OT { |
34 | 34 |
35 | 35 |
36 /* | 36 /* |
37 * hmtx -- The Horizontal Metrics Table | 37 * hmtx -- The Horizontal Metrics Table |
| 38 * vmtx -- The Vertical Metrics Table |
38 */ | 39 */ |
39 | 40 |
40 #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') |
41 | 43 |
42 | 44 |
43 struct LongHorMetric | 45 struct LongMetric |
44 { | 46 { |
45 USHORT» advanceWidth; | 47 USHORT» advance; /* Advance width/height. */ |
46 SHORT»» lsb; | 48 SHORT»» lsb; /* Leading (left/top) side bearing. */ |
47 public: | 49 public: |
48 DEFINE_SIZE_STATIC (4); | 50 DEFINE_SIZE_STATIC (4); |
49 }; | 51 }; |
50 | 52 |
51 struct hmtx | 53 struct _mtx |
52 { | 54 { |
53 static const hb_tag_t tableTag» = HB_OT_TAG_hmtx; | 55 static const hb_tag_t tableTag = HB_TAG('_','m','t','x'); |
| 56 |
| 57 static const hb_tag_t hmtxTag»= HB_OT_TAG_hmtx; |
| 58 static const hb_tag_t vmtxTag»= HB_OT_TAG_vmtx; |
54 | 59 |
55 inline bool sanitize (hb_sanitize_context_t *c) { | 60 inline bool sanitize (hb_sanitize_context_t *c) { |
56 TRACE_SANITIZE (this); | 61 TRACE_SANITIZE (this); |
57 /* We don't check for anything specific here. The users of the | 62 /* We don't check for anything specific here. The users of the |
58 * struct do all the hard work... */ | 63 * struct do all the hard work... */ |
59 return TRACE_RETURN (true); | 64 return TRACE_RETURN (true); |
60 } | 65 } |
61 | 66 |
62 public: | 67 public: |
63 LongHorMetric»longHorMetric[VAR];» /* Paired advance width and left side | 68 LongMetric» longMetric[VAR];» /* Paired advance width and leading |
64 * bearing values for each glyph. The | 69 * bearing values for each glyph. The |
65 * value numOfHMetrics comes from | 70 * value numOfHMetrics comes from |
66 * the 'hhea' table. If the font is | 71 * the 'hhea' table. If the font is |
67 * monospaced, only one entry need | 72 * monospaced, only one entry need |
68 * be in the array, but that entry is | 73 * be in the array, but that entry is |
69 * required. The last entry applies to | 74 * required. The last entry applies to |
70 * all subsequent glyphs. */ | 75 * all subsequent glyphs. */ |
71 SHORT»» leftSideBearingX[VAR];» /* Here the advanceWidth is assumed | 76 SHORT»» leadingBearingX[VAR];» /* Here the advance is assumed |
72 » » » » » * to be the same as the advanceWidth | 77 » » » » » * to be the same as the advance |
73 * for the last entry above. The | 78 * for the last entry above. The |
74 * number of entries in this array is | 79 * number of entries in this array is |
75 * derived from numGlyphs (from 'maxp' | 80 * derived from numGlyphs (from 'maxp' |
76 » » » » » * table) minus numberOfHMetrics. This | 81 » » » » » * table) minus numberOfLongMetrics. |
77 » » » » » * generally is used with a run of | 82 » » » » » * This generally is used with a run |
78 » » » » » * monospaced glyphs (e.g., Kanji | 83 » » » » » * of monospaced glyphs (e.g., Kanji |
79 * fonts or Courier fonts). Only one | 84 * fonts or Courier fonts). Only one |
80 * run is allowed and it must be at | 85 * run is allowed and it must be at |
81 * the end. This allows a monospaced | 86 * the end. This allows a monospaced |
82 » » » » » * font to vary the left side bearing | 87 » » » » » * font to vary the side bearing |
83 * values for each glyph. */ | 88 * values for each glyph. */ |
84 public: | 89 public: |
85 DEFINE_SIZE_ARRAY2 (0, longHorMetric, leftSideBearingX); | 90 DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX); |
86 }; | 91 }; |
87 | 92 |
| 93 struct hmtx : _mtx { |
| 94 static const hb_tag_t tableTag = HB_OT_TAG_hmtx; |
| 95 }; |
| 96 struct vmtx : _mtx { |
| 97 static const hb_tag_t tableTag = HB_OT_TAG_vmtx; |
| 98 }; |
88 | 99 |
89 } /* namespace OT */ | 100 } /* namespace OT */ |
90 | 101 |
91 | 102 |
92 #endif /* HB_OT_HMTX_TABLE_HH */ | 103 #endif /* HB_OT_HMTX_TABLE_HH */ |
OLD | NEW |