OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gdef.h" | 5 #include "gdef.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "gpos.h" | 10 #include "gpos.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 !table.ReadU16(&offset_mark_attach_class_def)) { | 283 !table.ReadU16(&offset_mark_attach_class_def)) { |
284 return OTS_FAILURE(); | 284 return OTS_FAILURE(); |
285 } | 285 } |
286 uint16_t offset_mark_glyph_sets_def = 0; | 286 uint16_t offset_mark_glyph_sets_def = 0; |
287 if (gdef->version_2) { | 287 if (gdef->version_2) { |
288 if (!table.ReadU16(&offset_mark_glyph_sets_def)) { | 288 if (!table.ReadU16(&offset_mark_glyph_sets_def)) { |
289 return OTS_FAILURE(); | 289 return OTS_FAILURE(); |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 unsigned gdef_header_end = 8; | 293 unsigned gdef_header_end = 4 + 4 * 2; |
294 if (gdef->version_2) | 294 if (gdef->version_2) |
295 gdef_header_end += 2; | 295 gdef_header_end += 2; |
296 | 296 |
297 // Parse subtables | 297 // Parse subtables |
298 if (offset_glyph_class_def) { | 298 if (offset_glyph_class_def) { |
299 if (offset_glyph_class_def >= length || | 299 if (offset_glyph_class_def >= length || |
300 offset_glyph_class_def < gdef_header_end) { | 300 offset_glyph_class_def < gdef_header_end) { |
301 return OTS_FAILURE(); | 301 return OTS_FAILURE(); |
302 } | 302 } |
303 if (!ParseGlyphClassDefTable(file, data + offset_glyph_class_def, | 303 if (!ParseGlyphClassDefTable(file, data + offset_glyph_class_def, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 return true; | 385 return true; |
386 } | 386 } |
387 | 387 |
388 void ots_gdef_free(OpenTypeFile *file) { | 388 void ots_gdef_free(OpenTypeFile *file) { |
389 delete file->gdef; | 389 delete file->gdef; |
390 } | 390 } |
391 | 391 |
392 } // namespace ots | 392 } // namespace ots |
393 | 393 |
OLD | NEW |