OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Resources.h" | 8 #include "Resources.h" |
9 #include "SkEndian.h" | 9 #include "SkEndian.h" |
10 #include "SkFontStream.h" | 10 #include "SkFontStream.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 int count = SkFontStream::CountTTCEntries(stream); | 147 int count = SkFontStream::CountTTCEntries(stream); |
148 #ifdef DUMP_TTC_TABLES | 148 #ifdef DUMP_TTC_TABLES |
149 SkDebugf("CountTTCEntries %d\n", count); | 149 SkDebugf("CountTTCEntries %d\n", count); |
150 #endif | 150 #endif |
151 for (int i = 0; i < count; ++i) { | 151 for (int i = 0; i < count; ++i) { |
152 test_fontstream(reporter, stream, i); | 152 test_fontstream(reporter, stream, i); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
| 156 static void test_symbolfont(skiatest::Reporter* reporter) { |
| 157 SkAutoTUnref<SkTypeface> typeface(GetResourceAsTypeface("/fonts/SpiderSymbol
.ttf")); |
| 158 if (!typeface) { |
| 159 SkDebugf("Skipping FontHostTest::test_symbolfont\n"); |
| 160 return; |
| 161 } |
| 162 |
| 163 SkUnichar c = 0xf021; |
| 164 uint16_t g; |
| 165 SkPaint paint; |
| 166 paint.setTypeface(typeface); |
| 167 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); |
| 168 paint.textToGlyphs(&c, 4, &g); |
| 169 REPORTER_ASSERT(reporter, g == 3); |
| 170 } |
| 171 |
156 static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) { | 172 static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) { |
157 if (false) { // avoid bit rot, suppress warning | 173 if (false) { // avoid bit rot, suppress warning |
158 SkFontID fontID = face->uniqueID(); | 174 SkFontID fontID = face->uniqueID(); |
159 REPORTER_ASSERT(reporter, fontID); | 175 REPORTER_ASSERT(reporter, fontID); |
160 } | 176 } |
161 | 177 |
162 int count = face->countTables(); | 178 int count = face->countTables(); |
163 | 179 |
164 SkAutoTMalloc<SkFontTableTag> storage(count); | 180 SkAutoTMalloc<SkFontTableTag> storage(count); |
165 SkFontTableTag* tags = storage.get(); | 181 SkFontTableTag* tags = storage.get(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 REPORTER_ASSERT(reporter, width1 == width2); | 304 REPORTER_ASSERT(reporter, width1 == width2); |
289 } | 305 } |
290 } | 306 } |
291 } | 307 } |
292 } | 308 } |
293 | 309 |
294 DEF_TEST(FontHost, reporter) { | 310 DEF_TEST(FontHost, reporter) { |
295 test_tables(reporter); | 311 test_tables(reporter); |
296 test_fontstream(reporter); | 312 test_fontstream(reporter); |
297 test_advances(reporter); | 313 test_advances(reporter); |
| 314 test_symbolfont(reporter); |
298 } | 315 } |
299 | 316 |
300 // need tests for SkStrSearch | 317 // need tests for SkStrSearch |
OLD | NEW |