Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tests/FontHostTest.cpp

Issue 1163833003: Add cmap 3,0 (symbol) as Unicode fallback. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_FreeType.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698