| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007,2008,2009 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009 Red Hat, 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. |
| 11 * | 11 * |
| 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
| 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | 14 * 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 | 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 16 * DAMAGE. | 16 * DAMAGE. |
| 17 * | 17 * |
| 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
| 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
| 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 23 * | 23 * |
| 24 * Red Hat Author(s): Behdad Esfahbod | 24 * Red Hat Author(s): Behdad Esfahbod |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #ifndef HB_OPEN_FILE_PRIVATE_HH | 27 #ifndef HB_OPEN_FILE_PRIVATE_HH |
| 28 #define HB_OPEN_FILE_PRIVATE_HH | 28 #define HB_OPEN_FILE_PRIVATE_HH |
| 29 | 29 |
| 30 #include "hb-open-type-private.hh" | 30 #include "hb-open-type-private.hh" |
| 31 | 31 |
| 32 HB_BEGIN_DECLS | |
| 33 | 32 |
| 34 | 33 |
| 35 /* | 34 /* |
| 36 * | 35 * |
| 37 * The OpenType Font File | 36 * The OpenType Font File |
| 38 * | 37 * |
| 39 */ | 38 */ |
| 40 | 39 |
| 41 | 40 |
| 42 /* | 41 /* |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 }; | 144 }; |
| 146 | 145 |
| 147 struct TTCHeader | 146 struct TTCHeader |
| 148 { | 147 { |
| 149 friend struct OpenTypeFontFile; | 148 friend struct OpenTypeFontFile; |
| 150 | 149 |
| 151 private: | 150 private: |
| 152 | 151 |
| 153 inline unsigned int get_face_count (void) const | 152 inline unsigned int get_face_count (void) const |
| 154 { | 153 { |
| 155 switch (u.header.version) { | 154 switch (u.header.version.major) { |
| 156 case 2: /* version 2 is compatible with version 1 */ | 155 case 2: /* version 2 is compatible with version 1 */ |
| 157 case 1: return u.version1.get_face_count (); | 156 case 1: return u.version1.get_face_count (); |
| 158 default:return 0; | 157 default:return 0; |
| 159 } | 158 } |
| 160 } | 159 } |
| 161 inline const OpenTypeFontFace& get_face (unsigned int i) const | 160 inline const OpenTypeFontFace& get_face (unsigned int i) const |
| 162 { | 161 { |
| 163 switch (u.header.version) { | 162 switch (u.header.version.major) { |
| 164 case 2: /* version 2 is compatible with version 1 */ | 163 case 2: /* version 2 is compatible with version 1 */ |
| 165 case 1: return u.version1.get_face (i); | 164 case 1: return u.version1.get_face (i); |
| 166 default:return Null(OpenTypeFontFace); | 165 default:return Null(OpenTypeFontFace); |
| 167 } | 166 } |
| 168 } | 167 } |
| 169 | 168 |
| 170 inline bool sanitize (hb_sanitize_context_t *c) { | 169 inline bool sanitize (hb_sanitize_context_t *c) { |
| 171 TRACE_SANITIZE (); | 170 TRACE_SANITIZE (); |
| 172 if (unlikely (!u.header.version.sanitize (c))) return false; | 171 if (unlikely (!u.header.version.sanitize (c))) return false; |
| 173 switch (u.header.version) { | 172 switch (u.header.version.major) { |
| 174 case 2: /* version 2 is compatible with version 1 */ | 173 case 2: /* version 2 is compatible with version 1 */ |
| 175 case 1: return u.version1.sanitize (c); | 174 case 1: return u.version1.sanitize (c); |
| 176 default:return true; | 175 default:return true; |
| 177 } | 176 } |
| 178 } | 177 } |
| 179 | 178 |
| 180 private: | 179 private: |
| 181 union { | 180 union { |
| 182 struct { | 181 struct { |
| 183 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ | 182 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 union { | 245 union { |
| 247 Tag tag; /* 4-byte identifier. */ | 246 Tag tag; /* 4-byte identifier. */ |
| 248 OpenTypeFontFace fontFace; | 247 OpenTypeFontFace fontFace; |
| 249 TTCHeader ttcHeader; | 248 TTCHeader ttcHeader; |
| 250 } u; | 249 } u; |
| 251 public: | 250 public: |
| 252 DEFINE_SIZE_UNION (4, tag); | 251 DEFINE_SIZE_UNION (4, tag); |
| 253 }; | 252 }; |
| 254 | 253 |
| 255 | 254 |
| 256 HB_END_DECLS | |
| 257 | 255 |
| 258 #endif /* HB_OPEN_FILE_PRIVATE_HH */ | 256 #endif /* HB_OPEN_FILE_PRIVATE_HH */ |
| OLD | NEW |