OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "ots.h" | 5 #include "ots.h" |
6 | 6 |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <zlib.h> | 8 #include <zlib.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 // mixing outline formats is not recommended | 682 // mixing outline formats is not recommended |
683 return OTS_FAILURE_MSG_HDR("font contains both PS and TT glyphs"); | 683 return OTS_FAILURE_MSG_HDR("font contains both PS and TT glyphs"); |
684 } | 684 } |
685 } else { | 685 } else { |
686 if (!font->glyf || !font->loca) { | 686 if (!font->glyf || !font->loca) { |
687 // No TrueType glyph found. | 687 // No TrueType glyph found. |
688 #define PASSTHRU_TABLE(tag_) (table_map.find(tag_) != table_map.end() && \ | 688 #define PASSTHRU_TABLE(tag_) (table_map.find(tag_) != table_map.end() && \ |
689 GetTableAction(header, tag_) == ots::TABLE_ACTION_
PASSTHRU) | 689 GetTableAction(header, tag_) == ots::TABLE_ACTION_
PASSTHRU) |
690 // We don't sanitise bitmap table, but don't reject bitmap-only fonts if | 690 // We don't sanitise bitmap table, but don't reject bitmap-only fonts if |
691 // we keep the tables. | 691 // we keep the tables. |
692 if (!PASSTHRU_TABLE(OTS_TAG('C','B','D','T')) || | 692 if ((!PASSTHRU_TABLE(OTS_TAG('C','B','D','T')) || |
693 !PASSTHRU_TABLE(OTS_TAG('C','B','L','C'))) { | 693 !PASSTHRU_TABLE(OTS_TAG('C','B','L','C'))) && |
| 694 !PASSTHRU_TABLE(OTS_TAG('s','b','i','x'))) { |
694 return OTS_FAILURE_MSG_HDR("no supported glyph shapes table(s) present")
; | 695 return OTS_FAILURE_MSG_HDR("no supported glyph shapes table(s) present")
; |
695 } | 696 } |
696 #undef PASSTHRU_TABLE | 697 #undef PASSTHRU_TABLE |
697 } | 698 } |
698 } | 699 } |
699 | 700 |
700 uint16_t num_output_tables = 0; | 701 uint16_t num_output_tables = 0; |
701 for (std::map<uint32_t, OpenTypeTable>::const_iterator it = table_map.begin(); | 702 for (std::map<uint32_t, OpenTypeTable>::const_iterator it = table_map.begin(); |
702 it != table_map.end(); ++it) { | 703 it != table_map.end(); ++it) { |
703 ots::TableAction action = GetTableAction(header, it->first); | 704 ots::TableAction action = GetTableAction(header, it->first); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 } else if (data[0] == 't' && data[1] == 't' && data[2] == 'c' && data[3] == 'f
') { | 898 } else if (data[0] == 't' && data[1] == 't' && data[2] == 'c' && data[3] == 'f
') { |
898 result = ProcessTTC(&header, output, data, length, index); | 899 result = ProcessTTC(&header, output, data, length, index); |
899 } else { | 900 } else { |
900 result = ProcessTTF(&header, &font, output, data, length); | 901 result = ProcessTTF(&header, &font, output, data, length); |
901 } | 902 } |
902 | 903 |
903 return result; | 904 return result; |
904 } | 905 } |
905 | 906 |
906 } // namespace ots | 907 } // namespace ots |
OLD | NEW |