OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. All Rights Reserved. | 2 * Copyright 2011 Google Inc. All Rights Reserved. |
3 * | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with the License. | 5 * you may not use this file except in compliance with the License. |
6 * You may obtain a copy of the License at | 6 * You may obtain a copy of the License at |
7 * | 7 * |
8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
9 * | 9 * |
10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 UnicodeString font_string = UnicodeString::fromUTF8(font_name); | 147 UnicodeString font_string = UnicodeString::fromUTF8(font_name); |
148 if (font_string.isEmpty()) | 148 if (font_string.isEmpty()) |
149 return false; | 149 return false; |
150 UnicodeString regular_suffix = UnicodeString::fromUTF8(" Regular"); | 150 UnicodeString regular_suffix = UnicodeString::fromUTF8(" Regular"); |
151 UnicodeString alt_font_string = font_string; | 151 UnicodeString alt_font_string = font_string; |
152 alt_font_string += regular_suffix; | 152 alt_font_string += regular_suffix; |
153 | 153 |
154 typedef std::map<int32_t, UnicodeString> NameMap; | 154 typedef std::map<int32_t, UnicodeString> NameMap; |
155 NameMap names; | 155 NameMap names; |
156 NameTablePtr name_table = down_cast<NameTable*>(font->GetTable(Tag::name)); | 156 NameTablePtr name_table = down_cast<NameTable*>(font->GetTable(Tag::name)); |
| 157 if (name_table == NULL) { |
| 158 return false; |
| 159 } |
157 | 160 |
158 for (int32_t i = 0; i < name_table->NameCount(); ++i) { | 161 for (int32_t i = 0; i < name_table->NameCount(); ++i) { |
159 switch(name_table->NameId(i)) { | 162 switch(name_table->NameId(i)) { |
160 case NameId::kFontFamilyName: | 163 case NameId::kFontFamilyName: |
161 case NameId::kFontSubfamilyName: | 164 case NameId::kFontSubfamilyName: |
162 case NameId::kFullFontName: | 165 case NameId::kFullFontName: |
163 case NameId::kPreferredFamily: | 166 case NameId::kPreferredFamily: |
164 case NameId::kPreferredSubfamily: | 167 case NameId::kPreferredSubfamily: |
165 case NameId::kWWSFamilyName: | 168 case NameId::kWWSFamilyName: |
166 case NameId::kWWSSubfamilyName: { | 169 case NameId::kWWSSubfamilyName: { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 TableBuilderPtr dereference; | 331 TableBuilderPtr dereference; |
329 dereference.Attach( | 332 dereference.Attach( |
330 font_builder->NewTableBuilder(i->first, i->second->ReadFontData())); | 333 font_builder->NewTableBuilder(i->first, i->second->ReadFontData())); |
331 } | 334 } |
332 } | 335 } |
333 | 336 |
334 return font_builder->Build(); | 337 return font_builder->Build(); |
335 } | 338 } |
336 | 339 |
337 } // namespace sfntly | 340 } // namespace sfntly |
OLD | NEW |