OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkString.h" | 10 #include "SkString.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 public: | 96 public: |
97 TypefaceStylesGM(bool applyKerning) | 97 TypefaceStylesGM(bool applyKerning) |
98 : fApplyKerning(applyKerning) { | 98 : fApplyKerning(applyKerning) { |
99 memset(fFaces, 0, sizeof(fFaces)); | 99 memset(fFaces, 0, sizeof(fFaces)); |
100 } | 100 } |
101 | 101 |
102 protected: | 102 protected: |
103 void onOnceBeforeDraw() override { | 103 void onOnceBeforeDraw() override { |
104 for (int i = 0; i < gFaceStylesCount; i++) { | 104 for (int i = 0; i < gFaceStylesCount; i++) { |
105 fFaces[i] = SkTypeface::MakeFromName( | 105 fFaces[i] = SkTypeface::MakeFromName( |
106 sk_tool_utils::platform_font_name(gFaceStyles[i].fName), gFa
ceStyles[i].fStyle); | 106 sk_tool_utils::platform_font_name( |
| 107 gFaceStyles[i].fName), SkFontStyle::FromOldStyle(gFaceSt
yles[i].fStyle)); |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
110 SkString onShortName() override { | 111 SkString onShortName() override { |
111 SkString name("typefacestyles"); | 112 SkString name("typefacestyles"); |
112 if (fApplyKerning) { | 113 if (fApplyKerning) { |
113 name.append("_kerning"); | 114 name.append("_kerning"); |
114 } | 115 } |
115 name.append(sk_tool_utils::major_platform_os_name()); | 116 name.append(sk_tool_utils::major_platform_os_name()); |
116 return name; | 117 return name; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 149 } |
149 | 150 |
150 private: | 151 private: |
151 typedef skiagm::GM INHERITED; | 152 typedef skiagm::GM INHERITED; |
152 }; | 153 }; |
153 | 154 |
154 /////////////////////////////////////////////////////////////////////////////// | 155 /////////////////////////////////////////////////////////////////////////////// |
155 | 156 |
156 DEF_GM( return new TypefaceStylesGM(false); ) | 157 DEF_GM( return new TypefaceStylesGM(false); ) |
157 DEF_GM( return new TypefaceStylesGM(true); ) | 158 DEF_GM( return new TypefaceStylesGM(true); ) |
OLD | NEW |