aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/fontmgr.cpp
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-02-15 10:20:04 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-28 20:14:44 +0000
commit97182cc8f611dd8c05dad6fe99d0e073af10ac2e (patch)
treef21e02e5121728998e6cd13fbb7440936ad22aeb /gm/fontmgr.cpp
parenta11bfe5a21af7fe5e92b88b76f533c74684f97d3 (diff)
Add color fonts.
BUG=skia:7624 Change-Id: I68a6bb4c6fa541ffad565d970438d93ff1bd8ed6 Reviewed-on: https://skia-review.googlesource.com/109521 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Herb Derby <herb@google.com> Reviewed-on: https://skia-review.googlesource.com/116541 Reviewed-on: https://skia-review.googlesource.com/116984 Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'gm/fontmgr.cpp')
-rw-r--r--gm/fontmgr.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/gm/fontmgr.cpp b/gm/fontmgr.cpp
index a0b2f5b44a..58c569c300 100644
--- a/gm/fontmgr.cpp
+++ b/gm/fontmgr.cpp
@@ -9,6 +9,7 @@
#include "sk_tool_utils.h"
#include "SkCanvas.h"
#include "SkFontMgr.h"
+#include "SkPath.h"
#include "SkGraphics.h"
#include "SkTypeface.h"
@@ -224,6 +225,7 @@ public:
fontBounds.offset(x, y);
SkPaint boundsPaint(glyphPaint);
boundsPaint.setColor(boundsColor);
+ boundsPaint.setStyle(SkPaint::kStroke_Style);
canvas->drawRect(fontBounds, boundsPaint);
SkPaint::FontMetrics fm;
@@ -264,6 +266,10 @@ public:
}
SkGlyphID str[] = { left, right, top, bottom };
for (size_t i = 0; i < SK_ARRAY_COUNT(str); ++i) {
+ SkPath path;
+ glyphPaint.getTextPath(&str[i], sizeof(str[0]), x, y, &path);
+ SkPaint::Style style = path.isEmpty() ? SkPaint::kFill_Style : SkPaint::kStroke_Style;
+ glyphPaint.setStyle(style);
canvas->drawText(&str[i], sizeof(str[0]), x, y, glyphPaint);
}
}
@@ -282,7 +288,6 @@ protected:
paint.setAntiAlias(true);
paint.setSubpixelText(true);
paint.setTextSize(100);
- paint.setStyle(SkPaint::kStroke_Style);
paint.setTextScaleX(fScaleX);
paint.setTextSkewX(fSkewX);