diff --git a/docs/SkFont_Reference.bmh b/docs/SkFont_Reference.bmh index 1d69f3488d..516da21777 100644 --- a/docs/SkFont_Reference.bmh +++ b/docs/SkFont_Reference.bmh @@ -691,7 +691,28 @@ Whether edge pixels draw opaque or with partial transparency. #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 diff --git a/docs/SkPaint_Reference.bmh b/docs/SkPaint_Reference.bmh index f8427b67d7..50f2dee7ee 100644 --- a/docs/SkPaint_Reference.bmh +++ b/docs/SkPaint_Reference.bmh @@ -3286,27 +3286,8 @@ void draw(SkCanvas* canvas) { #Line # returns text that fits in a width ## #Populate -#Example - #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; - int partialBytes = paint.breakText(str, count, 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); - } - ## +#NoExample +## ## diff --git a/docs/spelling.txt b/docs/spelling.txt index 796637b535..b1a304a803 100644 --- a/docs/spelling.txt +++ b/docs/spelling.txt @@ -211,7 +211,7 @@ specifies specify specifying speed speeds spirit square squared squares stack st standard standards stands start started starting starts state states stationary stay stays std step steps still stock stop stops storage store stored stores storing straight straight-line streams strength stretched strictly strikeout strings stripe stripes -striping stroke stroked strokes stroking struct studio style stylistic sub-pixel subclass +striping stroke stroked strokes stroking struct studio style stylistic subclass submitting subsequent subsequently subset substitution subtle subtract subtracted subtracts succeed succeeded succeeds success successful successfully successive such sufficient suggests sum summing supplied supplies supply supplying support supported supports