OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 /* Tests text vertical text rendering with different fonts and centering. | 10 /* Tests text vertical text rendering with different fonts and centering. |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 virtual ~VertText2GM() { | 26 virtual ~VertText2GM() { |
27 SkSafeUnref(fProp); | 27 SkSafeUnref(fProp); |
28 SkSafeUnref(fMono); | 28 SkSafeUnref(fMono); |
29 } | 29 } |
30 | 30 |
31 protected: | 31 protected: |
32 void onOnceBeforeDraw() override { | 32 void onOnceBeforeDraw() override { |
33 const int pointSize = 24; | 33 const int pointSize = 24; |
34 textHeight = SkIntToScalar(pointSize); | 34 textHeight = SkIntToScalar(pointSize); |
35 fProp = sk_tool_utils::create_portable_typeface("Helvetica", SkTypeface:
:kNormal); | 35 fProp = SkTypeface::CreateFromName(sk_tool_utils::platform_font_name("sa
ns-serif"), |
36 fMono = sk_tool_utils::create_portable_typeface("Courier New", SkTypefac
e::kNormal); | 36 SkTypeface::kNormal); |
| 37 fMono = SkTypeface::CreateFromName(sk_tool_utils::platform_font_name("mo
nospace"), |
| 38 SkTypeface::kNormal); |
37 } | 39 } |
38 | 40 |
39 SkString onShortName() override { | 41 SkString onShortName() override { |
40 return SkString("verttext2"); | 42 SkString name("verttext2"); |
| 43 name.append(sk_tool_utils::major_platform_os_name()); |
| 44 return name; |
41 } | 45 } |
42 | 46 |
43 SkISize onISize() override { return SkISize::Make(640, 480); } | 47 SkISize onISize() override { return SkISize::Make(640, 480); } |
44 | 48 |
45 void onDraw(SkCanvas* canvas) override { | 49 void onDraw(SkCanvas* canvas) override { |
46 for (int i = 0; i < 3; ++i) { | 50 for (int i = 0; i < 3; ++i) { |
47 SkPaint paint; | 51 SkPaint paint; |
48 paint.setColor(SK_ColorRED); | 52 paint.setColor(SK_ColorRED); |
49 paint.setAntiAlias(true); | 53 paint.setAntiAlias(true); |
50 y = textHeight; | 54 y = textHeight; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 SkTypeface* fProp; | 96 SkTypeface* fProp; |
93 SkTypeface* fMono; | 97 SkTypeface* fMono; |
94 }; | 98 }; |
95 | 99 |
96 /////////////////////////////////////////////////////////////////////////////// | 100 /////////////////////////////////////////////////////////////////////////////// |
97 | 101 |
98 static GM* MyFactory(void*) { return new VertText2GM; } | 102 static GM* MyFactory(void*) { return new VertText2GM; } |
99 static GMRegistry reg(MyFactory); | 103 static GMRegistry reg(MyFactory); |
100 | 104 |
101 } | 105 } |
OLD | NEW |