| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 /* Tests text vertical text rendering with different fonts and centering. | 9 /* Tests text vertical text rendering with different fonts and centering. |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 #include "gm.h" | 12 #include "gm.h" |
| 13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
| 14 #include "SkTypeface.h" | 14 #include "SkTypeface.h" |
| 15 | 15 |
| 16 namespace skiagm { | 16 namespace skiagm { |
| 17 | 17 |
| 18 class VertText2GM : public GM { | 18 class VertText2GM : public GM { |
| 19 public: | 19 public: |
| 20 VertText2GM() {} | 20 VertText2GM() {} |
| 21 | 21 |
| 22 protected: | 22 protected: |
| 23 void onOnceBeforeDraw() override { | 23 void onOnceBeforeDraw() override { |
| 24 const int pointSize = 24; | 24 const int pointSize = 24; |
| 25 textHeight = SkIntToScalar(pointSize); | 25 textHeight = SkIntToScalar(pointSize); |
| 26 fProp = SkTypeface::MakeFromName(sk_tool_utils::platform_font_name("sans
-serif"), | 26 fProp = SkTypeface::MakeFromName(sk_tool_utils::platform_font_name("sans
-serif"), |
| 27 SkTypeface::kNormal); | 27 SkFontStyle()); |
| 28 fMono = SkTypeface::MakeFromName(sk_tool_utils::platform_font_name("mono
space"), | 28 fMono = SkTypeface::MakeFromName(sk_tool_utils::platform_font_name("mono
space"), |
| 29 SkTypeface::kNormal); | 29 SkFontStyle()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 SkString onShortName() override { | 32 SkString onShortName() override { |
| 33 SkString name("verttext2"); | 33 SkString name("verttext2"); |
| 34 name.append(sk_tool_utils::major_platform_os_name()); | 34 name.append(sk_tool_utils::major_platform_os_name()); |
| 35 return name; | 35 return name; |
| 36 } | 36 } |
| 37 | 37 |
| 38 SkISize onISize() override { return SkISize::Make(640, 480); } | 38 SkISize onISize() override { return SkISize::Make(640, 480); } |
| 39 | 39 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 sk_sp<SkTypeface> fProp; | 87 sk_sp<SkTypeface> fProp; |
| 88 sk_sp<SkTypeface> fMono; | 88 sk_sp<SkTypeface> fMono; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 /////////////////////////////////////////////////////////////////////////////// | 91 /////////////////////////////////////////////////////////////////////////////// |
| 92 | 92 |
| 93 static GM* MyFactory(void*) { return new VertText2GM; } | 93 static GM* MyFactory(void*) { return new VertText2GM; } |
| 94 static GMRegistry reg(MyFactory); | 94 static GMRegistry reg(MyFactory); |
| 95 | 95 |
| 96 } | 96 } |
| OLD | NEW |