OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2010 Red Hat, Inc. | 2 * Copyright © 2010 Red Hat, Inc. |
3 * Copyright © 2012 Google, Inc. | 3 * Copyright © 2012 Google, Inc. |
4 * | 4 * |
5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 14 matching lines...) Expand all Loading... |
25 * Red Hat Author(s): Behdad Esfahbod | 25 * Red Hat Author(s): Behdad Esfahbod |
26 * Google Author(s): Behdad Esfahbod | 26 * Google Author(s): Behdad Esfahbod |
27 */ | 27 */ |
28 | 28 |
29 #ifndef HB_OT_HEAD_TABLE_HH | 29 #ifndef HB_OT_HEAD_TABLE_HH |
30 #define HB_OT_HEAD_TABLE_HH | 30 #define HB_OT_HEAD_TABLE_HH |
31 | 31 |
32 #include "hb-open-type-private.hh" | 32 #include "hb-open-type-private.hh" |
33 | 33 |
34 | 34 |
| 35 namespace OT { |
| 36 |
35 | 37 |
36 /* | 38 /* |
37 * head -- Font Header | 39 * head -- Font Header |
38 */ | 40 */ |
39 | 41 |
40 #define HB_OT_TAG_head HB_TAG('h','e','a','d') | 42 #define HB_OT_TAG_head HB_TAG('h','e','a','d') |
41 | 43 |
42 struct head | 44 struct head |
43 { | 45 { |
44 static const hb_tag_t Tag = HB_OT_TAG_head; | 46 static const hb_tag_t Tag = HB_OT_TAG_head; |
45 | 47 |
46 inline unsigned int get_upem (void) const { | 48 inline unsigned int get_upem (void) const { |
47 unsigned int upem = unitsPerEm; | 49 unsigned int upem = unitsPerEm; |
48 /* If no valid head table found, assume 1000, which matches typicaly Type1 u
sage. */ | 50 /* If no valid head table found, assume 1000, which matches typicaly Type1 u
sage. */ |
49 return 16 <= upem && upem <= 16384 ? upem : 1000; | 51 return 16 <= upem && upem <= 16384 ? upem : 1000; |
50 } | 52 } |
51 | 53 |
52 inline bool sanitize (hb_sanitize_context_t *c) { | 54 inline bool sanitize (hb_sanitize_context_t *c) { |
53 TRACE_SANITIZE (); | 55 TRACE_SANITIZE (); |
54 return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); | 56 return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); |
55 } | 57 } |
56 | 58 |
57 private: | 59 protected: |
58 FixedVersion version; /* Version of the head table--currently | 60 FixedVersion version; /* Version of the head table--currently |
59 * 0x00010000 for version 1.0. */ | 61 * 0x00010000 for version 1.0. */ |
60 FixedVersion fontRevision; /* Set by font manufacturer. */ | 62 FixedVersion fontRevision; /* Set by font manufacturer. */ |
61 ULONG checkSumAdjustment; /* To compute: set it to 0, sum the | 63 ULONG checkSumAdjustment; /* To compute: set it to 0, sum the |
62 * entire font as ULONG, then store | 64 * entire font as ULONG, then store |
63 * 0xB1B0AFBA - sum. */ | 65 * 0xB1B0AFBA - sum. */ |
64 ULONG magicNumber; /* Set to 0x5F0F3CF5. */ | 66 ULONG magicNumber; /* Set to 0x5F0F3CF5. */ |
65 USHORT flags; /* Bit 0: Baseline for font at y=0; | 67 USHORT flags; /* Bit 0: Baseline for font at y=0; |
66 * Bit 1: Left sidebearing point at x=0; | 68 * Bit 1: Left sidebearing point at x=0; |
67 * Bit 2: Instructions may depend on poi
nt size; | 69 * Bit 2: Instructions may depend on poi
nt size; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 * 2: Like 1 but also contains neutrals; | 136 * 2: Like 1 but also contains neutrals; |
135 * -1: Only strongly right to left; | 137 * -1: Only strongly right to left; |
136 * -2: Like -1 but also contains neutral
s. */ | 138 * -2: Like -1 but also contains neutral
s. */ |
137 SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */ | 139 SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */ |
138 SHORT glyphDataFormat; /* 0 for current format. */ | 140 SHORT glyphDataFormat; /* 0 for current format. */ |
139 public: | 141 public: |
140 DEFINE_SIZE_STATIC (54); | 142 DEFINE_SIZE_STATIC (54); |
141 }; | 143 }; |
142 | 144 |
143 | 145 |
| 146 } // namespace OT |
| 147 |
144 | 148 |
145 #endif /* HB_OT_HEAD_TABLE_HH */ | 149 #endif /* HB_OT_HEAD_TABLE_HH */ |
OLD | NEW |