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

Side by Side Diff: tests/FontNamesTest.cpp

Issue 396143004: Add a working SkFontMgr_fontconfig. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove T& operator* from SkAutoTCallVProc. Created 6 years, 4 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
« src/ports/SkFontMgr_fontconfig.cpp ('K') | « tests/FontHostTest.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 2013 Google Inc. 2 * Copyright 2013 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 "SkCommandLineFlags.h" 8 #include "SkCommandLineFlags.h"
9 #include "SkFontMgr.h" 9 #include "SkFontMgr.h"
10 #include "SkOTTable_name.h" 10 #include "SkOTTable_name.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); 145 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault());
146 int count = SkMin32(fm->countFamilies(), MAX_FAMILIES); 146 int count = SkMin32(fm->countFamilies(), MAX_FAMILIES);
147 for (int i = 0; i < count; ++i) { 147 for (int i = 0; i < count; ++i) {
148 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); 148 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
149 for (int j = 0; j < set->count(); ++j) { 149 for (int j = 0; j < set->count(); ++j) {
150 SkString sname; 150 SkString sname;
151 SkFontStyle fs; 151 SkFontStyle fs;
152 set->getStyle(j, &fs, &sname); 152 set->getStyle(j, &fs, &sname);
153 153
154 SkAutoTUnref<SkTypeface> typeface(set->createTypeface(j)); 154 SkAutoTUnref<SkTypeface> typeface(set->createTypeface(j));
155 if (NULL == typeface.get()) {
156 //TODO: SkFontMgr_fontconfig always returns NULL?
157 continue;
158 }
159 155
160 SkString familyName; 156 SkString familyName;
161 typeface->getFamilyName(&familyName); 157 typeface->getFamilyName(&familyName);
162 if (verbose) { 158 if (verbose) {
163 SkDebugf("[%s]\n", familyName.c_str()); 159 SkDebugf("[%s]\n", familyName.c_str());
164 } 160 }
165 161
166 SkAutoTUnref<SkTypeface::LocalizedStrings> familyNamesIter( 162 SkAutoTUnref<SkTypeface::LocalizedStrings> familyNamesIter(
167 typeface->createFamilyNameIterator()); 163 typeface->createFamilyNameIterator());
168 SkTypeface::LocalizedString familyNameLocalized; 164 SkTypeface::LocalizedString familyNameLocalized;
169 while (familyNamesIter->next(&familyNameLocalized)) { 165 while (familyNamesIter->next(&familyNameLocalized)) {
170 if (verbose) { 166 if (verbose) {
171 SkDebugf("(%s) <%s>\n", familyNameLocalized.fString.c_str(), 167 SkDebugf("(%s) <%s>\n", familyNameLocalized.fString.c_str(),
172 familyNameLocalized.fLanguage.c_str()) ; 168 familyNameLocalized.fLanguage.c_str( ));
173 } 169 }
174 } 170 }
175 171
176 size_t nameTableSize = typeface->getTableSize(nameTag); 172 size_t nameTableSize = typeface->getTableSize(nameTag);
177 if (0 == nameTableSize) { 173 if (0 == nameTableSize) {
178 continue; 174 continue;
179 } 175 }
180 SkAutoTMalloc<uint8_t> nameTableData(nameTableSize); 176 SkAutoTMalloc<uint8_t> nameTableData(nameTableSize);
181 size_t copied = typeface->getTableData(nameTag, 0, nameTableSize, na meTableData.get()); 177 size_t copied = typeface->getTableData(nameTag, 0, nameTableSize, na meTableData.get());
182 if (copied != nameTableSize) { 178 if (copied != nameTableSize) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 210 }
215 } 211 }
216 } 212 }
217 213
218 DEFINE_bool(verboseFontNames, false, "verbose FontNames test."); 214 DEFINE_bool(verboseFontNames, false, "verbose FontNames test.");
219 215
220 DEF_TEST(FontNames, reporter) { 216 DEF_TEST(FontNames, reporter) {
221 test_synthetic(reporter, FLAGS_verboseFontNames); 217 test_synthetic(reporter, FLAGS_verboseFontNames);
222 test_systemfonts(reporter, FLAGS_verboseFontNames); 218 test_systemfonts(reporter, FLAGS_verboseFontNames);
223 } 219 }
OLDNEW
« src/ports/SkFontMgr_fontconfig.cpp ('K') | « tests/FontHostTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698