aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/using_skia_and_harfbuzz.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-08-03 10:43:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-03 10:43:55 -0700
commit13cba49982ea3a4032dc78f2b61d7c1968d4b8eb (patch)
tree506ff4cd66448e3ef1ccae3e76a75914023e8edf /tools/using_skia_and_harfbuzz.cpp
parentbc20a701d8bd3df9d8cf8a20eeb17c3f90c99364 (diff)
SkShaper: optionally disable harfbuzz
also, re-enable warnings. motivation: used by me for PDF testing. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2201153002 Review-Url: https://codereview.chromium.org/2201153002
Diffstat (limited to 'tools/using_skia_and_harfbuzz.cpp')
-rw-r--r--tools/using_skia_and_harfbuzz.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/using_skia_and_harfbuzz.cpp b/tools/using_skia_and_harfbuzz.cpp
index 782103465e..f17a26d12b 100644
--- a/tools/using_skia_and_harfbuzz.cpp
+++ b/tools/using_skia_and_harfbuzz.cpp
@@ -134,7 +134,7 @@ public:
glyph_paint.setColor(SK_ColorBLACK);
glyph_paint.setFlags(SkPaint::kAntiAlias_Flag |
SkPaint::kSubpixelText_Flag);
- glyph_paint.setTextSize(config->font_size.value);
+ glyph_paint.setTextSize(SkDoubleToScalar(config->font_size.value));
}
void WriteLine(const SkShaper& shaper, const char *text, size_t textBytes) {
@@ -142,8 +142,9 @@ public:
if (pageCanvas) {
document->endPage();
}
- pageCanvas = document->beginPage(config->page_width.value,
- config->page_height.value);
+ pageCanvas = document->beginPage(
+ SkDoubleToScalar(config->page_width.value),
+ SkDoubleToScalar(config->page_height.value));
pageCanvas->drawPaint(white_paint);
current_x = config->left_margin.value;
current_y = config->line_spacing_ratio.value * config->font_size.value;
@@ -151,8 +152,9 @@ public:
SkTextBlobBuilder textBlobBuilder;
shaper.shape(&textBlobBuilder, glyph_paint, text, textBytes, SkPoint{0, 0});
sk_sp<const SkTextBlob> blob(textBlobBuilder.build());
- pageCanvas->drawTextBlob(blob.get(), current_x, current_y, glyph_paint);
-
+ pageCanvas->drawTextBlob(
+ blob.get(), SkDoubleToScalar(current_x),
+ SkDoubleToScalar(current_y), glyph_paint);
// Advance to the next line.
current_y += config->line_spacing_ratio.value * config->font_size.value;
}