OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2010 Red Hat, Inc. | 2 * Copyright © 2010 Red Hat, Inc. |
| 3 * Copyright © 2012 Google, Inc. |
3 * | 4 * |
4 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
5 * | 6 * |
6 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 11 * all copies of this software. |
11 * | 12 * |
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | 13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | 14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | 15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | 16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
16 * DAMAGE. | 17 * DAMAGE. |
17 * | 18 * |
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | 19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | 20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | 21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | 22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
23 * | 24 * |
24 * Red Hat Author(s): Behdad Esfahbod | 25 * Red Hat Author(s): Behdad Esfahbod |
| 26 * Google Author(s): Behdad Esfahbod |
25 */ | 27 */ |
26 | 28 |
27 #ifndef HB_OT_HEAD_TABLE_HH | 29 #ifndef HB_OT_HEAD_TABLE_HH |
28 #define HB_OT_HEAD_TABLE_HH | 30 #define HB_OT_HEAD_TABLE_HH |
29 | 31 |
30 #include "hb-open-type-private.hh" | 32 #include "hb-open-type-private.hh" |
31 | 33 |
32 | 34 |
33 | 35 |
34 /* | 36 /* |
35 * head -- Font Header | 37 * head -- Font Header |
36 */ | 38 */ |
37 | 39 |
38 #define HB_OT_TAG_head HB_TAG('h','e','a','d') | 40 #define HB_OT_TAG_head HB_TAG('h','e','a','d') |
39 | 41 |
40 struct head | 42 struct head |
41 { | 43 { |
42 static const hb_tag_t Tag = HB_OT_TAG_head; | 44 static const hb_tag_t Tag = HB_OT_TAG_head; |
43 | 45 |
44 inline unsigned int get_upem (void) const { | 46 inline unsigned int get_upem (void) const { |
45 unsigned int upem = unitsPerEm; | 47 unsigned int upem = unitsPerEm; |
46 /* If no valid head table found, assume 1000, which matches typicaly Type1 u
sage. */ | 48 /* If no valid head table found, assume 1000, which matches typicaly Type1 u
sage. */ |
47 return 16 <= upem && upem <= 16384 ? upem : 1000; | 49 return 16 <= upem && upem <= 16384 ? upem : 1000; |
48 } | 50 } |
49 | 51 |
50 inline bool sanitize (hb_sanitize_context_t *c) { | 52 inline bool sanitize (hb_sanitize_context_t *c) { |
51 TRACE_SANITIZE (); | 53 TRACE_SANITIZE (); |
52 return c->check_struct (this) && likely (version.major == 1); | 54 return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); |
53 } | 55 } |
54 | 56 |
55 private: | 57 private: |
56 FixedVersion version; /* Version of the head table--currently | 58 FixedVersion version; /* Version of the head table--currently |
57 * 0x00010000 for version 1.0. */ | 59 * 0x00010000 for version 1.0. */ |
58 FixedVersion fontRevision; /* Set by font manufacturer. */ | 60 FixedVersion fontRevision; /* Set by font manufacturer. */ |
59 ULONG checkSumAdjustment; /* To compute: set it to 0, sum the | 61 ULONG checkSumAdjustment; /* To compute: set it to 0, sum the |
60 * entire font as ULONG, then store | 62 * entire font as ULONG, then store |
61 * 0xB1B0AFBA - sum. */ | 63 * 0xB1B0AFBA - sum. */ |
62 ULONG magicNumber; /* Set to 0x5F0F3CF5. */ | 64 ULONG magicNumber; /* Set to 0x5F0F3CF5. */ |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 * -2: Like -1 but also contains neutral
s. */ | 136 * -2: Like -1 but also contains neutral
s. */ |
135 SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */ | 137 SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */ |
136 SHORT glyphDataFormat; /* 0 for current format. */ | 138 SHORT glyphDataFormat; /* 0 for current format. */ |
137 public: | 139 public: |
138 DEFINE_SIZE_STATIC (54); | 140 DEFINE_SIZE_STATIC (54); |
139 }; | 141 }; |
140 | 142 |
141 | 143 |
142 | 144 |
143 #endif /* HB_OT_HEAD_TABLE_HH */ | 145 #endif /* HB_OT_HEAD_TABLE_HH */ |
OLD | NEW |