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 27 matching lines...) Expand all Loading... |
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 Loading... |
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 |
OLD | NEW |