Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-open-file-private.hh

Issue 10915172: harfbuzz-ng roll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright © 2007,2008,2009 Red Hat, Inc. 2 * Copyright © 2007,2008,2009 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
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_OPEN_FILE_PRIVATE_HH 29 #ifndef HB_OPEN_FILE_PRIVATE_HH
30 #define HB_OPEN_FILE_PRIVATE_HH 30 #define HB_OPEN_FILE_PRIVATE_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 * 39 *
38 * The OpenType Font File 40 * The OpenType Font File
39 * 41 *
40 */ 42 */
41 43
42 44
43 /* 45 /*
44 * Organization of an OpenType Font 46 * Organization of an OpenType Font
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 find_table_index (tag, &table_index); 100 find_table_index (tag, &table_index);
99 return get_table (table_index); 101 return get_table (table_index);
100 } 102 }
101 103
102 public: 104 public:
103 inline bool sanitize (hb_sanitize_context_t *c) { 105 inline bool sanitize (hb_sanitize_context_t *c) {
104 TRACE_SANITIZE (); 106 TRACE_SANITIZE ();
105 return TRACE_RETURN (c->check_struct (this) && c->check_array (tables, Table Record::static_size, numTables)); 107 return TRACE_RETURN (c->check_struct (this) && c->check_array (tables, Table Record::static_size, numTables));
106 } 108 }
107 109
108 private: 110 protected:
109 Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */ 111 Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */
110 USHORT numTables; /* Number of tables. */ 112 USHORT numTables; /* Number of tables. */
111 USHORT searchRange; /* (Maximum power of 2 <= numTables) x 16 */ 113 USHORT searchRange; /* (Maximum power of 2 <= numTables) x 16 */
112 USHORT entrySelector; /* Log2(maximum power of 2 <= numTables). */ 114 USHORT entrySelector; /* Log2(maximum power of 2 <= numTables). */
113 USHORT rangeShift; /* NumTables x 16-searchRange. */ 115 USHORT rangeShift; /* NumTables x 16-searchRange. */
114 TableRecord tables[VAR]; /* TableRecord entries. numTables items */ 116 TableRecord tables[VAR]; /* TableRecord entries. numTables items */
115 public: 117 public:
116 DEFINE_SIZE_ARRAY (12, tables); 118 DEFINE_SIZE_ARRAY (12, tables);
117 } OpenTypeFontFace; 119 } OpenTypeFontFace;
118 120
119 121
120 /* 122 /*
121 * TrueType Collections 123 * TrueType Collections
122 */ 124 */
123 125
124 struct TTCHeaderVersion1 126 struct TTCHeaderVersion1
125 { 127 {
126 friend struct TTCHeader; 128 friend struct TTCHeader;
127 129
128 inline unsigned int get_face_count (void) const { return table.len; } 130 inline unsigned int get_face_count (void) const { return table.len; }
129 inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+t able[i]; } 131 inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+t able[i]; }
130 132
131 inline bool sanitize (hb_sanitize_context_t *c) { 133 inline bool sanitize (hb_sanitize_context_t *c) {
132 TRACE_SANITIZE (); 134 TRACE_SANITIZE ();
133 return TRACE_RETURN (table.sanitize (c, this)); 135 return TRACE_RETURN (table.sanitize (c, this));
134 } 136 }
135 137
136 private: 138 protected:
137 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ 139 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
138 FixedVersion version; /* Version of the TTC Header (1.0), 140 FixedVersion version; /* Version of the TTC Header (1.0),
139 * 0x00010000 */ 141 * 0x00010000 */
140 LongOffsetLongArrayOf<OffsetTable> 142 LongOffsetLongArrayOf<OffsetTable>
141 table; /* Array of offsets to the OffsetTable for each font 143 table; /* Array of offsets to the OffsetTable for each font
142 * from the beginning of the file */ 144 * from the beginning of the file */
143 public: 145 public:
144 DEFINE_SIZE_ARRAY (12, table); 146 DEFINE_SIZE_ARRAY (12, table);
145 }; 147 };
146 148
(...skipping 23 matching lines...) Expand all
170 inline bool sanitize (hb_sanitize_context_t *c) { 172 inline bool sanitize (hb_sanitize_context_t *c) {
171 TRACE_SANITIZE (); 173 TRACE_SANITIZE ();
172 if (unlikely (!u.header.version.sanitize (c))) return TRACE_RETURN (false); 174 if (unlikely (!u.header.version.sanitize (c))) return TRACE_RETURN (false);
173 switch (u.header.version.major) { 175 switch (u.header.version.major) {
174 case 2: /* version 2 is compatible with version 1 */ 176 case 2: /* version 2 is compatible with version 1 */
175 case 1: return TRACE_RETURN (u.version1.sanitize (c)); 177 case 1: return TRACE_RETURN (u.version1.sanitize (c));
176 default:return TRACE_RETURN (true); 178 default:return TRACE_RETURN (true);
177 } 179 }
178 } 180 }
179 181
180 private: 182 protected:
181 union { 183 union {
182 struct { 184 struct {
183 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ 185 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
184 FixedVersion version; /* Version of the TTC Header (1.0 or 2.0), 186 FixedVersion version; /* Version of the TTC Header (1.0 or 2.0),
185 * 0x00010000 or 0x00020000 */ 187 * 0x00010000 or 0x00020000 */
186 } header; 188 } header;
187 TTCHeaderVersion1 version1; 189 TTCHeaderVersion1 version1;
188 } u; 190 } u;
189 }; 191 };
190 192
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 switch (u.tag) { 237 switch (u.tag) {
236 case CFFTag: /* All the non-collection tags */ 238 case CFFTag: /* All the non-collection tags */
237 case TrueTag: 239 case TrueTag:
238 case Typ1Tag: 240 case Typ1Tag:
239 case TrueTypeTag: return TRACE_RETURN (u.fontFace.sanitize (c)); 241 case TrueTypeTag: return TRACE_RETURN (u.fontFace.sanitize (c));
240 case TTCTag: return TRACE_RETURN (u.ttcHeader.sanitize (c)); 242 case TTCTag: return TRACE_RETURN (u.ttcHeader.sanitize (c));
241 default: return TRACE_RETURN (true); 243 default: return TRACE_RETURN (true);
242 } 244 }
243 } 245 }
244 246
245 private: 247 protected:
246 union { 248 union {
247 Tag tag; /* 4-byte identifier. */ 249 Tag tag; /* 4-byte identifier. */
248 OpenTypeFontFace fontFace; 250 OpenTypeFontFace fontFace;
249 TTCHeader ttcHeader; 251 TTCHeader ttcHeader;
250 } u; 252 } u;
251 public: 253 public:
252 DEFINE_SIZE_UNION (4, tag); 254 DEFINE_SIZE_UNION (4, tag);
253 }; 255 };
254 256
255 257
258 } // namespace OT
259
256 260
257 #endif /* HB_OPEN_FILE_PRIVATE_HH */ 261 #endif /* HB_OPEN_FILE_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-old.cc ('k') | third_party/harfbuzz-ng/src/hb-open-type-private.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698