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

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

Issue 1005693006: Roll harfbuzz-ng to 0.9.40 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 * Organization of an OpenType Font 46 * Organization of an OpenType Font
47 */ 47 */
48 48
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) { 56 inline bool sanitize (hb_sanitize_context_t *c) const
57 {
57 TRACE_SANITIZE (this); 58 TRACE_SANITIZE (this);
58 return TRACE_RETURN (c->check_struct (this)); 59 return TRACE_RETURN (c->check_struct (this));
59 } 60 }
60 61
61 Tag tag; /* 4-byte identifier. */ 62 Tag tag; /* 4-byte identifier. */
62 CheckSum checkSum; /* CheckSum for this table. */ 63 CheckSum checkSum; /* CheckSum for this table. */
63 ULONG offset; /* Offset from beginning of TrueType font 64 ULONG offset; /* Offset from beginning of TrueType font
64 * file. */ 65 * file. */
65 ULONG length; /* Length of this table. */ 66 ULONG length; /* Length of this table. */
66 public: 67 public:
(...skipping 28 matching lines...) Expand all
95 return false; 96 return false;
96 } 97 }
97 inline const TableRecord& get_table_by_tag (hb_tag_t tag) const 98 inline const TableRecord& get_table_by_tag (hb_tag_t tag) const
98 { 99 {
99 unsigned int table_index; 100 unsigned int table_index;
100 find_table_index (tag, &table_index); 101 find_table_index (tag, &table_index);
101 return get_table (table_index); 102 return get_table (table_index);
102 } 103 }
103 104
104 public: 105 public:
105 inline bool sanitize (hb_sanitize_context_t *c) { 106 inline bool sanitize (hb_sanitize_context_t *c) const
107 {
106 TRACE_SANITIZE (this); 108 TRACE_SANITIZE (this);
107 return TRACE_RETURN (c->check_struct (this) && c->check_array (tables, Table Record::static_size, numTables)); 109 return TRACE_RETURN (c->check_struct (this) && c->check_array (tables, Table Record::static_size, numTables));
108 } 110 }
109 111
110 protected: 112 protected:
111 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 */
112 USHORT numTables; /* Number of tables. */ 114 USHORT numTables; /* Number of tables. */
113 USHORT searchRangeZ; /* (Maximum power of 2 <= numTables) x 16 */ 115 USHORT searchRangeZ; /* (Maximum power of 2 <= numTables) x 16 */
114 USHORT entrySelectorZ; /* Log2(maximum power of 2 <= numTables). */ 116 USHORT entrySelectorZ; /* Log2(maximum power of 2 <= numTables). */
115 USHORT rangeShiftZ; /* NumTables x 16-searchRange. */ 117 USHORT rangeShiftZ; /* NumTables x 16-searchRange. */
116 TableRecord tables[VAR]; /* TableRecord entries. numTables items */ 118 TableRecord tables[VAR]; /* TableRecord entries. numTables items */
117 public: 119 public:
118 DEFINE_SIZE_ARRAY (12, tables); 120 DEFINE_SIZE_ARRAY (12, tables);
119 } OpenTypeFontFace; 121 } OpenTypeFontFace;
120 122
121 123
122 /* 124 /*
123 * TrueType Collections 125 * TrueType Collections
124 */ 126 */
125 127
126 struct TTCHeaderVersion1 128 struct TTCHeaderVersion1
127 { 129 {
128 friend struct TTCHeader; 130 friend struct TTCHeader;
129 131
130 inline unsigned int get_face_count (void) const { return table.len; } 132 inline unsigned int get_face_count (void) const { return table.len; }
131 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]; }
132 134
133 inline bool sanitize (hb_sanitize_context_t *c) { 135 inline bool sanitize (hb_sanitize_context_t *c) const
136 {
134 TRACE_SANITIZE (this); 137 TRACE_SANITIZE (this);
135 return TRACE_RETURN (table.sanitize (c, this)); 138 return TRACE_RETURN (table.sanitize (c, this));
136 } 139 }
137 140
138 protected: 141 protected:
139 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ 142 Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
140 FixedVersion version; /* Version of the TTC Header (1.0), 143 FixedVersion version; /* Version of the TTC Header (1.0),
141 * 0x00010000u */ 144 * 0x00010000u */
142 ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG> 145 ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
143 table; /* Array of offsets to the OffsetTable for each font 146 table; /* Array of offsets to the OffsetTable for each font
(...skipping 18 matching lines...) Expand all
162 } 165 }
163 inline const OpenTypeFontFace& get_face (unsigned int i) const 166 inline const OpenTypeFontFace& get_face (unsigned int i) const
164 { 167 {
165 switch (u.header.version.major) { 168 switch (u.header.version.major) {
166 case 2: /* version 2 is compatible with version 1 */ 169 case 2: /* version 2 is compatible with version 1 */
167 case 1: return u.version1.get_face (i); 170 case 1: return u.version1.get_face (i);
168 default:return Null(OpenTypeFontFace); 171 default:return Null(OpenTypeFontFace);
169 } 172 }
170 } 173 }
171 174
172 inline bool sanitize (hb_sanitize_context_t *c) { 175 inline bool sanitize (hb_sanitize_context_t *c) const
176 {
173 TRACE_SANITIZE (this); 177 TRACE_SANITIZE (this);
174 if (unlikely (!u.header.version.sanitize (c))) return TRACE_RETURN (false); 178 if (unlikely (!u.header.version.sanitize (c))) return TRACE_RETURN (false);
175 switch (u.header.version.major) { 179 switch (u.header.version.major) {
176 case 2: /* version 2 is compatible with version 1 */ 180 case 2: /* version 2 is compatible with version 1 */
177 case 1: return TRACE_RETURN (u.version1.sanitize (c)); 181 case 1: return TRACE_RETURN (u.version1.sanitize (c));
178 default:return TRACE_RETURN (true); 182 default:return TRACE_RETURN (true);
179 } 183 }
180 } 184 }
181 185
182 protected: 186 protected:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 * non-TTC, but the index is more than zero. */ 230 * non-TTC, but the index is more than zero. */
227 case CFFTag: /* All the non-collection tags */ 231 case CFFTag: /* All the non-collection tags */
228 case TrueTag: 232 case TrueTag:
229 case Typ1Tag: 233 case Typ1Tag:
230 case TrueTypeTag: return u.fontFace; 234 case TrueTypeTag: return u.fontFace;
231 case TTCTag: return u.ttcHeader.get_face (i); 235 case TTCTag: return u.ttcHeader.get_face (i);
232 default: return Null(OpenTypeFontFace); 236 default: return Null(OpenTypeFontFace);
233 } 237 }
234 } 238 }
235 239
236 inline bool sanitize (hb_sanitize_context_t *c) { 240 inline bool sanitize (hb_sanitize_context_t *c) const
241 {
237 TRACE_SANITIZE (this); 242 TRACE_SANITIZE (this);
238 if (unlikely (!u.tag.sanitize (c))) return TRACE_RETURN (false); 243 if (unlikely (!u.tag.sanitize (c))) return TRACE_RETURN (false);
239 switch (u.tag) { 244 switch (u.tag) {
240 case CFFTag: /* All the non-collection tags */ 245 case CFFTag: /* All the non-collection tags */
241 case TrueTag: 246 case TrueTag:
242 case Typ1Tag: 247 case Typ1Tag:
243 case TrueTypeTag: return TRACE_RETURN (u.fontFace.sanitize (c)); 248 case TrueTypeTag: return TRACE_RETURN (u.fontFace.sanitize (c));
244 case TTCTag: return TRACE_RETURN (u.ttcHeader.sanitize (c)); 249 case TTCTag: return TRACE_RETURN (u.ttcHeader.sanitize (c));
245 default: return TRACE_RETURN (true); 250 default: return TRACE_RETURN (true);
246 } 251 }
247 } 252 }
248 253
249 protected: 254 protected:
250 union { 255 union {
251 Tag tag; /* 4-byte identifier. */ 256 Tag tag; /* 4-byte identifier. */
252 OpenTypeFontFace fontFace; 257 OpenTypeFontFace fontFace;
253 TTCHeader ttcHeader; 258 TTCHeader ttcHeader;
254 } u; 259 } u;
255 public: 260 public:
256 DEFINE_SIZE_UNION (4, tag); 261 DEFINE_SIZE_UNION (4, tag);
257 }; 262 };
258 263
259 264
260 } /* namespace OT */ 265 } /* namespace OT */
261 266
262 267
263 #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-ft.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