fix bookmaker nightly
Move breakText example to SkFont_Reference.bmh
NOTRY=true
TBR=reed@google.com
Bug: skia:
Change-Id: I2876f0ecc63eb0a50d7232d2f66dae0d81e74b2a
Reviewed-on: https://skia-review.googlesource.com/c/175983
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
diff --git a/docs/SkFont_Reference.bmh b/docs/SkFont_Reference.bmh
index 1d69f34..516da21 100644
--- a/docs/SkFont_Reference.bmh
+++ b/docs/SkFont_Reference.bmh
@@ -691,7 +691,28 @@
#Populate
#Example
-// incomplete
+ #Description
+ Line under "Breakfast" shows desired width, shorter than available characters.
+ Line under "Bre" shows measured width after breaking text.
+ ##
+ #Height 128
+ #Width 280
+ void draw(SkCanvas* canvas) {
+ SkPaint paint;
+ paint.setAntiAlias(true);
+ paint.setTextSize(50);
+ const char str[] = "Breakfast";
+ const int count = sizeof(str) - 1;
+ canvas->drawText(str, count, 25, 50, paint);
+ SkScalar measuredWidth;
+ SkFont font;
+ font.setSize(50);
+ int partialBytes = font.breakText(str, count, kUTF8_SkTextEncoding,
+ 100, &measuredWidth);
+ canvas->drawText(str, partialBytes, 25, 100, paint);
+ canvas->drawLine(25, 60, 25 + 100, 60, paint);
+ canvas->drawLine(25, 110, 25 + measuredWidth, 110, paint);
+ }
##
#SeeAlso incomplete