Skip to content

Commit e954b9d

Browse files
Cary ClarkSkia Commit-Bot
authored andcommitted
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>
1 parent f5bbf66 commit e954b9d

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

docs/SkFont_Reference.bmh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,28 @@ Whether edge pixels draw opaque or with partial transparency.
691691
#Populate
692692

693693
#Example
694-
// incomplete
694+
#Description
695+
Line under "Breakfast" shows desired width, shorter than available characters.
696+
Line under "Bre" shows measured width after breaking text.
697+
##
698+
#Height 128
699+
#Width 280
700+
void draw(SkCanvas* canvas) {
701+
SkPaint paint;
702+
paint.setAntiAlias(true);
703+
paint.setTextSize(50);
704+
const char str[] = "Breakfast";
705+
const int count = sizeof(str) - 1;
706+
canvas->drawText(str, count, 25, 50, paint);
707+
SkScalar measuredWidth;
708+
SkFont font;
709+
font.setSize(50);
710+
int partialBytes = font.breakText(str, count, kUTF8_SkTextEncoding,
711+
100, &measuredWidth);
712+
canvas->drawText(str, partialBytes, 25, 100, paint);
713+
canvas->drawLine(25, 60, 25 + 100, 60, paint);
714+
canvas->drawLine(25, 110, 25 + measuredWidth, 110, paint);
715+
}
695716
##
696717

697718
#SeeAlso incomplete

docs/SkPaint_Reference.bmh

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,27 +3286,8 @@ void draw(SkCanvas* canvas) {
32863286
#Line # returns text that fits in a width ##
32873287
#Populate
32883288

3289-
#Example
3290-
#Description
3291-
Line under "Breakfast" shows desired width, shorter than available characters.
3292-
Line under "Bre" shows measured width after breaking text.
3293-
##
3294-
#Height 128
3295-
#Width 280
3296-
void draw(SkCanvas* canvas) {
3297-
SkPaint paint;
3298-
paint.setAntiAlias(true);
3299-
paint.setTextSize(50);
3300-
const char str[] = "Breakfast";
3301-
const int count = sizeof(str) - 1;
3302-
canvas->drawText(str, count, 25, 50, paint);
3303-
SkScalar measuredWidth;
3304-
int partialBytes = paint.breakText(str, count, 100, &measuredWidth);
3305-
canvas->drawText(str, partialBytes, 25, 100, paint);
3306-
canvas->drawLine(25, 60, 25 + 100, 60, paint);
3307-
canvas->drawLine(25, 110, 25 + measuredWidth, 110, paint);
3308-
}
3309-
##
3289+
#NoExample
3290+
##
33103291

33113292
##
33123293

docs/spelling.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ specifies specify specifying speed speeds spirit square squared squares stack st
211211
standard standards stands start started starting starts state states stationary stay
212212
stays std step steps still stock stop stops storage store stored stores storing straight
213213
straight-line streams strength stretched strictly strikeout strings stripe stripes
214-
striping stroke stroked strokes stroking struct studio style stylistic sub-pixel subclass
214+
striping stroke stroked strokes stroking struct studio style stylistic subclass
215215
submitting subsequent subsequently subset substitution subtle subtract subtracted subtracts
216216
succeed succeeded succeeds success successful successfully successive such sufficient
217217
suggests sum summing supplied supplies supply supplying support supported supports

0 commit comments

Comments
 (0)