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

Side by Side Diff: gm/fontmgr.cpp

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Dont update bzl file now. Created 4 years, 8 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 | include/core/SkFontStyle.h » ('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 27 matching lines...) Expand all
38 38
39 if (nullptr == typeface) { 39 if (nullptr == typeface) {
40 return x; 40 return x;
41 } 41 }
42 42
43 // repeat the process, but this time use the family name of the typeface 43 // repeat the process, but this time use the family name of the typeface
44 // from the first pass. This emulates the behavior in Blink where it 44 // from the first pass. This emulates the behavior in Blink where it
45 // it expects to get the same glyph when following this pattern. 45 // it expects to get the same glyph when following this pattern.
46 SkString familyName; 46 SkString familyName;
47 typeface->getFamilyName(&familyName); 47 typeface->getFamilyName(&familyName);
48 #ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
48 SkTypeface* typefaceCopy = fm->legacyCreateTypeface(familyName.c_str(), type face->style()); 49 SkTypeface* typefaceCopy = fm->legacyCreateTypeface(familyName.c_str(), type face->style());
50 #else
51 SkTypeface* typefaceCopy = fm->legacyCreateTypeface(familyName.c_str(), type face->fontStyle());
52 #endif
49 SkSafeUnref(paint.setTypeface(typefaceCopy)); 53 SkSafeUnref(paint.setTypeface(typefaceCopy));
50 return drawString(canvas, ch, x, y, paint) + 20; 54 return drawString(canvas, ch, x, y, paint) + 20;
51 } 55 }
52 56
53 static const char* zh = "zh"; 57 static const char* zh = "zh";
54 static const char* ja = "ja"; 58 static const char* ja = "ja";
55 59
56 class FontMgrGM : public skiagm::GM { 60 class FontMgrGM : public skiagm::GM {
57 public: 61 public:
58 FontMgrGM(SkFontMgr* fontMgr = nullptr) { 62 FontMgrGM(SkFontMgr* fontMgr = nullptr) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 306
303 DEF_GM(return new FontMgrGM;) 307 DEF_GM(return new FontMgrGM;)
304 DEF_GM(return new FontMgrMatchGM;) 308 DEF_GM(return new FontMgrMatchGM;)
305 DEF_GM(return new FontMgrBoundsGM(1.0, 0);) 309 DEF_GM(return new FontMgrBoundsGM(1.0, 0);)
306 DEF_GM(return new FontMgrBoundsGM(0.75, 0);) 310 DEF_GM(return new FontMgrBoundsGM(0.75, 0);)
307 DEF_GM(return new FontMgrBoundsGM(1.0, -0.25);) 311 DEF_GM(return new FontMgrBoundsGM(1.0, -0.25);)
308 312
309 #ifdef SK_BUILD_FOR_WIN 313 #ifdef SK_BUILD_FOR_WIN
310 DEF_GM(return new FontMgrGM(SkFontMgr_New_DirectWrite());) 314 DEF_GM(return new FontMgrGM(SkFontMgr_New_DirectWrite());)
311 #endif 315 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkFontStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698