OLD | NEW |
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 paint.setTypeface(nullptr); | 95 paint.setTypeface(nullptr); |
96 (void)drawString(canvas, familyName, 20, y, paint); | 96 (void)drawString(canvas, familyName, 20, y, paint); |
97 | 97 |
98 SkScalar x = 220; | 98 SkScalar x = 220; |
99 | 99 |
100 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); | 100 SkAutoTUnref<SkFontStyleSet> set(fm->createStyleSet(i)); |
101 for (int j = 0; j < set->count(); ++j) { | 101 for (int j = 0; j < set->count(); ++j) { |
102 SkString sname; | 102 SkString sname; |
103 SkFontStyle fs; | 103 SkFontStyle fs; |
104 set->getStyle(j, &fs, &sname); | 104 set->getStyle(j, &fs, &sname); |
105 sname.appendf(" [%d %d %d]", fs.weight(), fs.width(), fs.isItali
c()); | 105 sname.appendf(" [%d %d %d]", fs.weight(), fs.width(), fs.slant()
); |
106 | 106 |
107 SkSafeUnref(paint.setTypeface(set->createTypeface(j))); | 107 SkSafeUnref(paint.setTypeface(set->createTypeface(j))); |
108 x = drawString(canvas, sname, x, y, paint) + 20; | 108 x = drawString(canvas, sname, x, y, paint) + 20; |
109 | 109 |
110 // check to see that we get different glyphs in japanese and chi
nese | 110 // check to see that we get different glyphs in japanese and chi
nese |
111 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_
str(), &zh, 1, fs); | 111 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_
str(), &zh, 1, fs); |
112 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_
str(), &ja, 1, fs); | 112 x = drawCharacter(canvas, 0x5203, x, y, paint, fm, familyName.c_
str(), &ja, 1, fs); |
113 // check that emoji characters are found | 113 // check that emoji characters are found |
114 x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, familyName.c
_str(), nullptr,0, fs); | 114 x = drawCharacter(canvas, 0x1f601, x, y, paint, fm, familyName.c
_str(), nullptr,0, fs); |
115 } | 115 } |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 DEF_GM(return new FontMgrGM;) | 303 DEF_GM(return new FontMgrGM;) |
304 DEF_GM(return new FontMgrMatchGM;) | 304 DEF_GM(return new FontMgrMatchGM;) |
305 DEF_GM(return new FontMgrBoundsGM(1.0, 0);) | 305 DEF_GM(return new FontMgrBoundsGM(1.0, 0);) |
306 DEF_GM(return new FontMgrBoundsGM(0.75, 0);) | 306 DEF_GM(return new FontMgrBoundsGM(0.75, 0);) |
307 DEF_GM(return new FontMgrBoundsGM(1.0, -0.25);) | 307 DEF_GM(return new FontMgrBoundsGM(1.0, -0.25);) |
308 | 308 |
309 #ifdef SK_BUILD_FOR_WIN | 309 #ifdef SK_BUILD_FOR_WIN |
310 DEF_GM(return new FontMgrGM(SkFontMgr_New_DirectWrite());) | 310 DEF_GM(return new FontMgrGM(SkFontMgr_New_DirectWrite());) |
311 #endif | 311 #endif |
OLD | NEW |