skia2/gm/text_scale_skew.cpp
Mike Reed 919191365b use font instead of paint for text
Bug: skia:
Change-Id: I508ecbd6c4dad41f67f5f2ce6da6c0065dacba6c
Reviewed-on: https://skia-review.googlesource.com/c/180365
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-01-02 17:45:30 +00:00

29 lines
741 B
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkTextUtils.h"
// http://bug.skia.org/7315
DEF_SIMPLE_GM(text_scale_skew, canvas, 256, 128) {
SkPaint p;
p.setAntiAlias(true);
SkFont font;
font.setSize(18.0f);
float y = 10.0f;
for (float scale : { 0.5f, 0.71f, 1.0f, 1.41f, 2.0f }) {
font.setScaleX(scale);
y += font.getSpacing();
float x = 50.0f;
for (float skew : { -0.5f, 0.0f, 0.5f }) {
font.setSkewX(skew);
SkTextUtils::DrawString(canvas, "Skia", x, y, font, p, SkTextUtils::kCenter_Align);
x += 78.0f;
}
}
}