1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "gm/gm.h" 9 #include "include/core/SkFont.h" 10 #include "include/core/SkPaint.h" 11 #include "include/utils/SkTextUtils.h" 12 13 #include <initializer_list> 14 15 class SkCanvas; 16 17 // http://bug.skia.org/7315 18 DEF_SIMPLE_GM(text_scale_skew, canvas, 256, 128) { 19 SkPaint p; 20 p.setAntiAlias(true); 21 SkFont font; 22 font.setSize(18.0f); 23 float y = 10.0f; 24 for (float scale : { 0.5f, 0.71f, 1.0f, 1.41f, 2.0f }) { 25 font.setScaleX(scale); 26 y += font.getSpacing(); 27 float x = 50.0f; 28 for (float skew : { -0.5f, 0.0f, 0.5f }) { 29 font.setSkewX(skew); 30 SkTextUtils::DrawString(canvas, "Skia", x, y, font, p, SkTextUtils::kCenter_Align); 31 x += 78.0f; 32 } 33 } 34 } 35