Hal Canary | 9b491b2 | 2017-11-28 15:10:13 -0500 | [diff] [blame] | 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.h" |
Mike Reed | 71f5a0b | 2018-10-25 16:12:39 -0400 | [diff] [blame] | 9 | #include "SkTextUtils.h" |
Hal Canary | 9b491b2 | 2017-11-28 15:10:13 -0500 | [diff] [blame] | 10 | |
| 11 | // http://bug.skia.org/7315 |
| 12 | DEF_SIMPLE_GM(text_scale_skew, canvas, 256, 128) { |
| 13 | SkPaint p; |
Hal Canary | 9b491b2 | 2017-11-28 15:10:13 -0500 | [diff] [blame] | 14 | p.setAntiAlias(true); |
Mike Reed | 9191913 | 2019-01-02 12:21:01 -0500 | [diff] [blame] | 15 | SkFont font; |
| 16 | font.setSize(18.0f); |
Hal Canary | 9b491b2 | 2017-11-28 15:10:13 -0500 | [diff] [blame] | 17 | float y = 10.0f; |
| 18 | for (float scale : { 0.5f, 0.71f, 1.0f, 1.41f, 2.0f }) { |
Mike Reed | 9191913 | 2019-01-02 12:21:01 -0500 | [diff] [blame] | 19 | font.setScaleX(scale); |
| 20 | y += font.getSpacing(); |
Hal Canary | 9b491b2 | 2017-11-28 15:10:13 -0500 | [diff] [blame] | 21 | float x = 50.0f; |
| 22 | for (float skew : { -0.5f, 0.0f, 0.5f }) { |
Mike Reed | 9191913 | 2019-01-02 12:21:01 -0500 | [diff] [blame] | 23 | font.setSkewX(skew); |
| 24 | SkTextUtils::DrawString(canvas, "Skia", x, y, font, p, SkTextUtils::kCenter_Align); |
Hal Canary | 9b491b2 | 2017-11-28 15:10:13 -0500 | [diff] [blame] | 25 | x += 78.0f; |
| 26 | } |
| 27 | } |
| 28 | } |