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

Side by Side Diff: gm/fontmgr.cpp

Issue 1107283003: Remove system call in DW for default font. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | src/ports/SkFontMgr_win_dw.cpp » ('j') | 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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkFontMgr.h" 10 #include "SkFontMgr.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 SkPaint paint; 81 SkPaint paint;
82 paint.setAntiAlias(true); 82 paint.setAntiAlias(true);
83 paint.setLCDRenderText(true); 83 paint.setLCDRenderText(true);
84 paint.setSubpixelText(true); 84 paint.setSubpixelText(true);
85 paint.setTextSize(17); 85 paint.setTextSize(17);
86 86
87 SkFontMgr* fm = fFM; 87 SkFontMgr* fm = fFM;
88 int count = SkMin32(fm->countFamilies(), MAX_FAMILIES); 88 int count = SkMin32(fm->countFamilies(), MAX_FAMILIES);
89 89
90 for (int i = 0; i < count; ++i) { 90 for (int i = 0; i < count; ++i) {
91 SkString fname; 91 SkString familyName;
92 fm->getFamilyName(i, &fname); 92 fm->getFamilyName(i, &familyName);
93 paint.setTypeface(NULL); 93 paint.setTypeface(NULL);
94 (void)drawString(canvas, fname, 20, y, paint); 94 (void)drawString(canvas, familyName, 20, y, paint);
95 95
96 SkScalar x = 220; 96 SkScalar x = 220;
97 97
98 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); 98 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i));
99 for (int j = 0; j < set->count(); ++j) { 99 for (int j = 0; j < set->count(); ++j) {
100 SkString sname; 100 SkString sname;
101 SkFontStyle fs; 101 SkFontStyle fs;
102 set->getStyle(j, &fs, &sname); 102 set->getStyle(j, &fs, &sname);
103 sname.appendf(" [%d %d %d]", fs.weight(), fs.width(), fs.isItali c()); 103 sname.appendf(" [%d %d %d]", fs.weight(), fs.width(), fs.isItali c());
104 104
105 SkSafeUnref(paint.setTypeface(set->createTypeface(j))); 105 SkSafeUnref(paint.setTypeface(set->createTypeface(j)));
106 x = drawString(canvas, sname, x, y, paint) + 20; 106 x = drawString(canvas, sname, x, y, paint) + 20;
107 107
108 // check to see that we get different glyphs in japanese and chi nese 108 // check to see that we get different glyphs in japanese and chi nese
109 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str() , &zh, 1, fs); 109 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_ str(), &zh, 1, fs);
bungeman-skia 2015/04/29 15:05:40 Note that fname is the family name, but fName is t
110 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, fName.c_str() , &ja, 1, fs); 110 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_ str(), &ja, 1, fs);
111 // check that emoji characters are found 111 // check that emoji characters are found
112 x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, fName.c_str( ), NULL, 0, fs); 112 x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, familyName.c _str(), NULL,0, fs);
113 } 113 }
114 y += 24; 114 y += 24;
115 } 115 }
116 } 116 }
117 117
118 private: 118 private:
119 SkAutoTUnref<SkFontMgr> fFM; 119 SkAutoTUnref<SkFontMgr> fFM;
120 SkString fName; 120 SkString fName;
121 typedef GM INHERITED; 121 typedef GM INHERITED;
122 }; 122 };
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 DEF_GM( return SkNEW(FontMgrGM); ) 296 DEF_GM( return SkNEW(FontMgrGM); )
297 DEF_GM( return SkNEW(FontMgrMatchGM); ) 297 DEF_GM( return SkNEW(FontMgrMatchGM); )
298 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); ) 298 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, 0)); )
299 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); ) 299 DEF_GM( return SkNEW(FontMgrBoundsGM(0.75, 0)); )
300 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); ) 300 DEF_GM( return SkNEW(FontMgrBoundsGM(1.0, -0.25)); )
301 301
302 #ifdef SK_BUILD_FOR_WIN 302 #ifdef SK_BUILD_FOR_WIN
303 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); ) 303 DEF_GM( return SkNEW_ARGS(FontMgrGM, (SkFontMgr_New_DirectWrite())); )
304 #endif 304 #endif
OLDNEW
« no previous file with comments | « no previous file | src/ports/SkFontMgr_win_dw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698