2017-11-28 20:10:13 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "gm/gm.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkFont.h"
|
|
|
|
#include "include/core/SkPaint.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/utils/SkTextUtils.h"
|
2017-11-28 20:10:13 +00:00
|
|
|
|
2019-05-01 21:28:53 +00:00
|
|
|
#include <initializer_list>
|
|
|
|
|
|
|
|
class SkCanvas;
|
|
|
|
|
2017-11-28 20:10:13 +00:00
|
|
|
// http://bug.skia.org/7315
|
|
|
|
DEF_SIMPLE_GM(text_scale_skew, canvas, 256, 128) {
|
|
|
|
SkPaint p;
|
|
|
|
p.setAntiAlias(true);
|
2019-01-02 17:21:01 +00:00
|
|
|
SkFont font;
|
|
|
|
font.setSize(18.0f);
|
2017-11-28 20:10:13 +00:00
|
|
|
float y = 10.0f;
|
|
|
|
for (float scale : { 0.5f, 0.71f, 1.0f, 1.41f, 2.0f }) {
|
2019-01-02 17:21:01 +00:00
|
|
|
font.setScaleX(scale);
|
|
|
|
y += font.getSpacing();
|
2017-11-28 20:10:13 +00:00
|
|
|
float x = 50.0f;
|
|
|
|
for (float skew : { -0.5f, 0.0f, 0.5f }) {
|
2019-01-02 17:21:01 +00:00
|
|
|
font.setSkewX(skew);
|
|
|
|
SkTextUtils::DrawString(canvas, "Skia", x, y, font, p, SkTextUtils::kCenter_Align);
|
2017-11-28 20:10:13 +00:00
|
|
|
x += 78.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|