aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-11-28 15:10:13 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-28 20:48:37 +0000
commit9b491b23bbc2aae8ec4ac7ddbcbcf0c2407ff1d8 (patch)
tree3f8160cbf47c88fb37c8cc6b26f8395b60d416d0
parent725d9dbfa59d6804b157f876a7e5d4c0553c6455 (diff)
SkPDF: fix fTextScaleX error
BUG=skia:7315 Change-Id: Ic613cb6fb8faed5b0840db4f500940bd6823de66 Reviewed-on: https://skia-review.googlesource.com/76981 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
-rw-r--r--gm/text_scale_skew.cpp27
-rw-r--r--gn/gm.gni1
-rw-r--r--src/pdf/SkPDFDevice.cpp2
3 files changed, 29 insertions, 1 deletions
diff --git a/gm/text_scale_skew.cpp b/gm/text_scale_skew.cpp
new file mode 100644
index 0000000000..31b6e0359b
--- /dev/null
+++ b/gm/text_scale_skew.cpp
@@ -0,0 +1,27 @@
+/*
+ * 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"
+
+// http://bug.skia.org/7315
+DEF_SIMPLE_GM(text_scale_skew, canvas, 256, 128) {
+ SkPaint p;
+ p.setTextSize(18.0f);
+ p.setAntiAlias(true);
+ p.setTextAlign(SkPaint::kCenter_Align);
+ float y = 10.0f;
+ for (float scale : { 0.5f, 0.71f, 1.0f, 1.41f, 2.0f }) {
+ p.setTextScaleX(scale);
+ y += p.getFontSpacing();
+ float x = 50.0f;
+ for (float skew : { -0.5f, 0.0f, 0.5f }) {
+ p.setTextSkewX(skew);
+ canvas->drawString("Skia", x, y, p);
+ x += 78.0f;
+ }
+ }
+}
diff --git a/gn/gm.gni b/gn/gm.gni
index ad542fb976..6892406edb 100644
--- a/gn/gm.gni
+++ b/gn/gm.gni
@@ -306,6 +306,7 @@ gm_sources = [
"$_gm/textblobtransforms.cpp",
"$_gm/textblobuseaftergpufree.cpp",
"$_gm/texteffects.cpp",
+ "$_gm/text_scale_skew.cpp",
"$_gm/texturedomaineffect.cpp",
"$_gm/thinconcavepaths.cpp",
"$_gm/thinrects.cpp",
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 10ec6911a2..aae792bb8b 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -414,7 +414,7 @@ void GraphicStackState::updateDrawingState(const SkPDFDevice::GraphicStateEntry&
if (state.fTextScaleX) {
if (state.fTextScaleX != currentEntry()->fTextScaleX) {
- SkScalar pdfScale = state.fTextScaleX * 1000;
+ SkScalar pdfScale = state.fTextScaleX * 100;
SkPDFUtils::AppendScalar(pdfScale, fContentStream);
fContentStream->writeText(" Tz\n");
currentEntry()->fTextScaleX = state.fTextScaleX;