| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 // We use an underscore to avoid confusion with the standard math.h library. | 5 // We use an underscore to avoid confusion with the standard math.h library. |
| 6 #include "math_.h" | 6 #include "math_.h" |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 } | 441 } |
| 442 | 442 |
| 443 bool ParseMathGlyphConstructionSequence(const ots::Font *font, | 443 bool ParseMathGlyphConstructionSequence(const ots::Font *font, |
| 444 ots::Buffer* subtable, | 444 ots::Buffer* subtable, |
| 445 const uint8_t *data, | 445 const uint8_t *data, |
| 446 size_t length, | 446 size_t length, |
| 447 const uint16_t num_glyphs, | 447 const uint16_t num_glyphs, |
| 448 uint16_t offset_coverage, | 448 uint16_t offset_coverage, |
| 449 uint16_t glyph_count, | 449 uint16_t glyph_count, |
| 450 const unsigned sequence_end) { | 450 const unsigned sequence_end) { |
| 451 // Zero glyph count, nothing to parse. |
| 452 if (!glyph_count) { |
| 453 return true; |
| 454 } |
| 455 |
| 451 // Check coverage table. | 456 // Check coverage table. |
| 452 if (offset_coverage < sequence_end || offset_coverage >= length) { | 457 if (offset_coverage < sequence_end || offset_coverage >= length) { |
| 453 return OTS_FAILURE(); | 458 return OTS_FAILURE(); |
| 454 } | 459 } |
| 455 if (!ots::ParseCoverageTable(font, data + offset_coverage, | 460 if (!ots::ParseCoverageTable(font, data + offset_coverage, |
| 456 length - offset_coverage, | 461 length - offset_coverage, |
| 457 num_glyphs, glyph_count)) { | 462 num_glyphs, glyph_count)) { |
| 458 return OTS_FAILURE(); | 463 return OTS_FAILURE(); |
| 459 } | 464 } |
| 460 | 465 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 } | 610 } |
| 606 | 611 |
| 607 void ots_math_free(Font *font) { | 612 void ots_math_free(Font *font) { |
| 608 delete font->math; | 613 delete font->math; |
| 609 } | 614 } |
| 610 | 615 |
| 611 } // namespace ots | 616 } // namespace ots |
| 612 | 617 |
| 613 #undef TABLE_NAME | 618 #undef TABLE_NAME |
| 614 #undef DROP_THIS_TABLE | 619 #undef DROP_THIS_TABLE |
| OLD | NEW |