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 "layout.h" | 5 #include "layout.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "gdef.h" | 10 #include "gdef.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 return OTS_FAILURE_MSG("Failed to read lookup table header"); | 188 return OTS_FAILURE_MSG("Failed to read lookup table header"); |
189 } | 189 } |
190 | 190 |
191 if (lookup_type == 0 || lookup_type > parser->num_types) { | 191 if (lookup_type == 0 || lookup_type > parser->num_types) { |
192 return OTS_FAILURE_MSG("Bad lookup type %d", lookup_type); | 192 return OTS_FAILURE_MSG("Bad lookup type %d", lookup_type); |
193 } | 193 } |
194 | 194 |
195 // Check lookup flags. | 195 // Check lookup flags. |
196 if ((lookup_flag & kGdefRequiredFlags) && | 196 if ((lookup_flag & kGdefRequiredFlags) && |
197 (!font->gdef || !font->gdef->has_glyph_class_def)) { | 197 (!font->gdef || !font->gdef->has_glyph_class_def)) { |
198 return OTS_FAILURE_MSG("Bad lookup flags %d", lookup_flag); | 198 return OTS_FAILURE_MSG("Lookup flags require GDEF table, " |
| 199 "but none was found: %d", lookup_flag); |
199 } | 200 } |
200 if ((lookup_flag & kMarkAttachmentTypeMask) && | 201 if ((lookup_flag & kMarkAttachmentTypeMask) && |
201 (!font->gdef || !font->gdef->has_mark_attachment_class_def)) { | 202 (!font->gdef || !font->gdef->has_mark_attachment_class_def)) { |
202 return OTS_FAILURE_MSG("lookup flag asks for mark attachment that is bad %d"
, lookup_flag); | 203 return OTS_FAILURE_MSG("Lookup flags ask for mark attachment, " |
| 204 "but there is no GDEF table or it has no " |
| 205 "mark attachment classes: %d", lookup_flag); |
203 } | 206 } |
204 bool use_mark_filtering_set = false; | 207 bool use_mark_filtering_set = false; |
205 if (lookup_flag & kUseMarkFilteringSetBit) { | 208 if (lookup_flag & kUseMarkFilteringSetBit) { |
206 if (!font->gdef || !font->gdef->has_mark_glyph_sets_def) { | 209 if (!font->gdef || !font->gdef->has_mark_glyph_sets_def) { |
207 return OTS_FAILURE_MSG("lookup flag asks for mark filtering that is bad %d
", lookup_flag); | 210 return OTS_FAILURE_MSG("Lookup flags ask for mark filtering, " |
| 211 "but there is no GDEF table or it has no " |
| 212 "mark filtering sets: %d", lookup_flag); |
208 } | 213 } |
209 use_mark_filtering_set = true; | 214 use_mark_filtering_set = true; |
210 } | 215 } |
211 | 216 |
212 std::vector<uint16_t> subtables; | 217 std::vector<uint16_t> subtables; |
213 subtables.reserve(subtable_count); | 218 subtables.reserve(subtable_count); |
214 // If the |kUseMarkFilteringSetBit| of |lookup_flag| is set, | 219 // If the |kUseMarkFilteringSetBit| of |lookup_flag| is set, |
215 // extra 2 bytes will follow after subtable offset array. | 220 // extra 2 bytes will follow after subtable offset array. |
216 const unsigned lookup_table_end = 2 * static_cast<unsigned>(subtable_count) + | 221 const unsigned lookup_table_end = 2 * static_cast<unsigned>(subtable_count) + |
217 (use_mark_filtering_set ? 8 : 6); | 222 (use_mark_filtering_set ? 8 : 6); |
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1502 lookup_type)) { | 1507 lookup_type)) { |
1503 return OTS_FAILURE_MSG("Failed to parse lookup from extension lookup"); | 1508 return OTS_FAILURE_MSG("Failed to parse lookup from extension lookup"); |
1504 } | 1509 } |
1505 | 1510 |
1506 return true; | 1511 return true; |
1507 } | 1512 } |
1508 | 1513 |
1509 } // namespace ots | 1514 } // namespace ots |
1510 | 1515 |
1511 #undef TABLE_NAME | 1516 #undef TABLE_NAME |
OLD | NEW |