add drawString to ease the pain of converting to skfont
Bug: skia:
Change-Id: I88418f87883b66204427fbdab471e74c78835ac4
Reviewed-on: https://skia-review.googlesource.com/c/181407
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
diff --git a/gm/convexpolyclip.cpp b/gm/convexpolyclip.cpp
index af073c6..2ab41ca 100644
--- a/gm/convexpolyclip.cpp
+++ b/gm/convexpolyclip.cpp
@@ -57,18 +57,19 @@
mat.postScale(SK_Scalar1 / 3, SK_Scalar1 / 3);
}
- paint.setAntiAlias(true);
- sk_tool_utils::set_portable_typeface(&paint);
- paint.setTextSize(wScalar / 2.2f);
+ SkFont font(sk_tool_utils::create_portable_typeface(), wScalar / 2.2f);
+
paint.setShader(nullptr);
paint.setColor(SK_ColorLTGRAY);
constexpr char kTxt[] = "Skia";
- SkPoint texPos = { wScalar / 17, hScalar / 2 + paint.getTextSize() / 2.5f };
- canvas.drawText(kTxt, SK_ARRAY_COUNT(kTxt)-1, texPos.fX, texPos.fY, paint);
+ SkPoint texPos = { wScalar / 17, hScalar / 2 + font.getSize() / 2.5f };
+ canvas.drawSimpleText(kTxt, SK_ARRAY_COUNT(kTxt)-1, kUTF8_SkTextEncoding,
+ texPos.fX, texPos.fY, font, paint);
paint.setColor(SK_ColorBLACK);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(SK_Scalar1);
- canvas.drawText(kTxt, SK_ARRAY_COUNT(kTxt)-1, texPos.fX, texPos.fY, paint);
+ canvas.drawSimpleText(kTxt, SK_ARRAY_COUNT(kTxt)-1, kUTF8_SkTextEncoding,
+ texPos.fX, texPos.fY, font, paint);
return bmp;
}