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

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

Issue 1408003004: Roll harfbuzz-ng to 1.0.5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2526
Patch Set: Created 5 years, 2 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 struct OpenTypeFontFile; 49 struct OpenTypeFontFile;
50 struct OffsetTable; 50 struct OffsetTable;
51 struct TTCHeader; 51 struct TTCHeader;
52 52
53 53
54 typedef struct TableRecord 54 typedef struct TableRecord
55 { 55 {
56 inline bool sanitize (hb_sanitize_context_t *c) const 56 inline bool sanitize (hb_sanitize_context_t *c) const
57 { 57 {
58 TRACE_SANITIZE (this); 58 TRACE_SANITIZE (this);
59 return TRACE_RETURN (c->check_struct (this)); 59 return_trace (c->check_struct (this));
60 } 60 }
61 61
62 Tag tag; /* 4-byte identifier. */ 62 Tag tag; /* 4-byte identifier. */
63 CheckSum checkSum; /* CheckSum for this table. */ 63 CheckSum checkSum; /* CheckSum for this table. */
64 ULONG offset; /* Offset from beginning of TrueType font 64 ULONG offset; /* Offset from beginning of TrueType font
65 * file. */ 65 * file. */
66 ULONG length; /* Length of this table. */ 66 ULONG length; /* Length of this table. */
67 public: 67 public:
68 DEFINE_SIZE_STATIC (16); 68 DEFINE_SIZE_STATIC (16);
69 } OpenTypeTable; 69 } OpenTypeTable;
(...skipping 29 matching lines...) Expand all
99 { 99 {
100 unsigned int table_index; 100 unsigned int table_index;
101 find_table_index (tag, &table_index); 101 find_table_index (tag, &table_index);
102 return get_table (table_index); 102 return get_table (table_index);
103 } 103 }
104 104
105 public: 105 public:
106 inline bool sanitize (hb_sanitize_context_t *c) const 106 inline bool sanitize (hb_sanitize_context_t *c) const
107 { 107 {
108 TRACE_SANITIZE (this); 108 TRACE_SANITIZE (this);
109 return TRACE_RETURN (c->check_struct (this) && c->check_array (tables, Table Record::static_size, numTables)); 109 return_trace (c->check_struct (this) && c->check_array (tables, TableRecord: :static_size, numTables));
110 } 110 }
111 111
112 protected: 112 protected:
113 Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */ 113 Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */
114 USHORT numTables; /* Number of tables. */ 114 USHORT numTables; /* Number of tables. */
115 USHORT searchRangeZ; /* (Maximum power of 2 <= numTables) x 16 */ 115 USHORT searchRangeZ; /* (Maximum power of 2 <= numTables) x 16 */
116 USHORT entrySelectorZ; /* Log2(maximum power of 2 <= numTables). */ 116 USHORT entrySelectorZ; /* Log2(maximum power of 2 <= numTables). */
117 USHORT rangeShiftZ; /* NumTables x 16-searchRange. */ 117 USHORT rangeShiftZ; /* NumTables x 16-searchRange. */
118 TableRecord tables[VAR]; /* TableRecord entries. numTables items */ 118 TableRecord tables[VAR]; /* TableRecord entries. numTables items */
119 public: 119 public:
120 DEFINE_SIZE_ARRAY (12, tables); 120 DEFINE_SIZE_ARRAY (12, tables);
121 } OpenTypeFontFace; 121 } OpenTypeFontFace;
122 122
123 123
124 /* 124 /*
125 * TrueType Collections 125 * TrueType Collections
126 */ 126 */
127 127
128 struct TTCHeaderVersion1 128 struct TTCHeaderVersion1
129 { 129 {
130 friend struct TTCHeader; 130 friend struct TTCHeader;
131 131
132 inline unsigned int get_face_count (void) const { return table.len; } 132 inline unsigned int get_face_count (void) const { return table.len; }
133 inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+t able[i]; } 133 inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+t able[i]; }
134 134
135 inline bool sanitize (hb_sanitize_context_t *c) const 135 inline bool sanitize (hb_sanitize_context_t *c) const
136 { 136 {
137 TRACE_SANITIZE (this); 137 TRACE_SANITIZE (this);
138 return TRACE_RETURN (table.sanitize (c, this)); 138 return_trace (table.sanitize (c, this));
139 } 139 }
140 140
141 protected: 141 protected:
142 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ 142 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
143 FixedVersion version; /* Version of the TTC Header (1.0), 143 FixedVersion version; /* Version of the TTC Header (1.0),
144 * 0x00010000u */ 144 * 0x00010000u */
145 ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG> 145 ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
146 table; /* Array of offsets to the OffsetTable for each font 146 table; /* Array of offsets to the OffsetTable for each font
147 * from the beginning of the file */ 147 * from the beginning of the file */
148 public: 148 public:
(...skipping 19 matching lines...) Expand all
168 switch (u.header.version.major) { 168 switch (u.header.version.major) {
169 case 2: /* version 2 is compatible with version 1 */ 169 case 2: /* version 2 is compatible with version 1 */
170 case 1: return u.version1.get_face (i); 170 case 1: return u.version1.get_face (i);
171 default:return Null(OpenTypeFontFace); 171 default:return Null(OpenTypeFontFace);
172 } 172 }
173 } 173 }
174 174
175 inline bool sanitize (hb_sanitize_context_t *c) const 175 inline bool sanitize (hb_sanitize_context_t *c) const
176 { 176 {
177 TRACE_SANITIZE (this); 177 TRACE_SANITIZE (this);
178 if (unlikely (!u.header.version.sanitize (c))) return TRACE_RETURN (false); 178 if (unlikely (!u.header.version.sanitize (c))) return_trace (false);
179 switch (u.header.version.major) { 179 switch (u.header.version.major) {
180 case 2: /* version 2 is compatible with version 1 */ 180 case 2: /* version 2 is compatible with version 1 */
181 case 1: return TRACE_RETURN (u.version1.sanitize (c)); 181 case 1: return_trace (u.version1.sanitize (c));
182 default:return TRACE_RETURN (true); 182 default:return_trace (true);
183 } 183 }
184 } 184 }
185 185
186 protected: 186 protected:
187 union { 187 union {
188 struct { 188 struct {
189 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ 189 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
190 FixedVersion version; /* Version of the TTC Header (1.0 or 2.0), 190 FixedVersion version; /* Version of the TTC Header (1.0 or 2.0),
191 * 0x00010000u or 0x00020000u */ 191 * 0x00010000u or 0x00020000u */
192 } header; 192 } header;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 case Typ1Tag: 233 case Typ1Tag:
234 case TrueTypeTag: return u.fontFace; 234 case TrueTypeTag: return u.fontFace;
235 case TTCTag: return u.ttcHeader.get_face (i); 235 case TTCTag: return u.ttcHeader.get_face (i);
236 default: return Null(OpenTypeFontFace); 236 default: return Null(OpenTypeFontFace);
237 } 237 }
238 } 238 }
239 239
240 inline bool sanitize (hb_sanitize_context_t *c) const 240 inline bool sanitize (hb_sanitize_context_t *c) const
241 { 241 {
242 TRACE_SANITIZE (this); 242 TRACE_SANITIZE (this);
243 if (unlikely (!u.tag.sanitize (c))) return TRACE_RETURN (false); 243 if (unlikely (!u.tag.sanitize (c))) return_trace (false);
244 switch (u.tag) { 244 switch (u.tag) {
245 case CFFTag: /* All the non-collection tags */ 245 case CFFTag: /* All the non-collection tags */
246 case TrueTag: 246 case TrueTag:
247 case Typ1Tag: 247 case Typ1Tag:
248 case TrueTypeTag:» return TRACE_RETURN (u.fontFace.sanitize (c)); 248 case TrueTypeTag:» return_trace (u.fontFace.sanitize (c));
249 case TTCTag:» return TRACE_RETURN (u.ttcHeader.sanitize (c)); 249 case TTCTag:» return_trace (u.ttcHeader.sanitize (c));
250 default:» » return TRACE_RETURN (true); 250 default:» » return_trace (true);
251 } 251 }
252 } 252 }
253 253
254 protected: 254 protected:
255 union { 255 union {
256 Tag tag; /* 4-byte identifier. */ 256 Tag tag; /* 4-byte identifier. */
257 OpenTypeFontFace fontFace; 257 OpenTypeFontFace fontFace;
258 TTCHeader ttcHeader; 258 TTCHeader ttcHeader;
259 } u; 259 } u;
260 public: 260 public:
261 DEFINE_SIZE_UNION (4, tag); 261 DEFINE_SIZE_UNION (4, tag);
262 }; 262 };
263 263
264 264
265 } /* namespace OT */ 265 } /* namespace OT */
266 266
267 267
268 #endif /* HB_OPEN_FILE_PRIVATE_HH */ 268 #endif /* HB_OPEN_FILE_PRIVATE_HH */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-object-private.hh ('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