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 27 matching lines...) Expand all Loading... |
38 /* | 38 /* |
39 * head -- Font Header | 39 * head -- Font Header |
40 */ | 40 */ |
41 | 41 |
42 #define HB_OT_TAG_head HB_TAG('h','e','a','d') | 42 #define HB_OT_TAG_head HB_TAG('h','e','a','d') |
43 | 43 |
44 struct head | 44 struct head |
45 { | 45 { |
46 static const hb_tag_t tableTag = HB_OT_TAG_head; | 46 static const hb_tag_t tableTag = HB_OT_TAG_head; |
47 | 47 |
48 inline unsigned int get_upem (void) const { | 48 inline unsigned int get_upem (void) const |
| 49 { |
49 unsigned int upem = unitsPerEm; | 50 unsigned int upem = unitsPerEm; |
50 /* If no valid head table found, assume 1000, which matches typical Type1 us
age. */ | 51 /* If no valid head table found, assume 1000, which matches typical Type1 us
age. */ |
51 return 16 <= upem && upem <= 16384 ? upem : 1000; | 52 return 16 <= upem && upem <= 16384 ? upem : 1000; |
52 } | 53 } |
53 | 54 |
54 inline bool sanitize (hb_sanitize_context_t *c) { | 55 inline bool sanitize (hb_sanitize_context_t *c) const |
| 56 { |
55 TRACE_SANITIZE (this); | 57 TRACE_SANITIZE (this); |
56 return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); | 58 return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); |
57 } | 59 } |
58 | 60 |
59 protected: | 61 protected: |
60 FixedVersion version; /* Version of the head table--currently | 62 FixedVersion version; /* Version of the head table--currently |
61 * 0x00010000u for version 1.0. */ | 63 * 0x00010000u for version 1.0. */ |
62 FixedVersion fontRevision; /* Set by font manufacturer. */ | 64 FixedVersion fontRevision; /* Set by font manufacturer. */ |
63 ULONG checkSumAdjustment; /* To compute: set it to 0, sum the | 65 ULONG checkSumAdjustment; /* To compute: set it to 0, sum the |
64 * entire font as ULONG, then store | 66 * entire font as ULONG, then store |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 SHORT glyphDataFormat; /* 0 for current format. */ | 142 SHORT glyphDataFormat; /* 0 for current format. */ |
141 public: | 143 public: |
142 DEFINE_SIZE_STATIC (54); | 144 DEFINE_SIZE_STATIC (54); |
143 }; | 145 }; |
144 | 146 |
145 | 147 |
146 } /* namespace OT */ | 148 } /* namespace OT */ |
147 | 149 |
148 | 150 |
149 #endif /* HB_OT_HEAD_TABLE_HH */ | 151 #endif /* HB_OT_HEAD_TABLE_HH */ |
OLD | NEW |