diff options
author | Cary Clark <caryclark@skia.org> | 2017-12-01 11:49:58 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-01 17:13:39 +0000 |
commit | 3cd22cc543ba410f8b46b8b0ca22fb8580040472 (patch) | |
tree | cf5a4d8a4d024492c8f23203c6ec042f856a324c /docs/SkCanvas_Reference.bmh | |
parent | 8ceee43de49b314fff58852c2d89ed3885ae71ee (diff) |
working on skimage
working on skimage
Docs-Preview: https://skia.org/?cl=76562
Bug: skia:
Change-Id: I288d2a9bbbdf01bff9efd5f0a9d308d3c76391a4
Reviewed-on: https://skia-review.googlesource.com/76562
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'docs/SkCanvas_Reference.bmh')
-rw-r--r-- | docs/SkCanvas_Reference.bmh | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh index 55dc86ba35..efbf41f57e 100644 --- a/docs/SkCanvas_Reference.bmh +++ b/docs/SkCanvas_Reference.bmh @@ -5316,6 +5316,8 @@ Paint_Text_Align, Paint_Hinting, Anti-alias, Paint_Fake_Bold, Font_Embedded_Bitmaps, Full_Hinting_Spacing, LCD_Text, Linear_Text, Subpixel_Text, and Paint_Vertical_Text. +Paint_Text_Encoding must be set to SkPaint::kGlyphID_TextEncoding. + Elements of paint: Path_Effect, Rasterizer, Mask_Filter, Shader, Color_Filter, Image_Filter, and Draw_Looper; apply to blob. @@ -5327,25 +5329,26 @@ Image_Filter, and Draw_Looper; apply to blob. #Example #Height 120 void draw(SkCanvas* canvas) { - SkTextBlobBuilder textBlobBuilder; - const char bunny[] = "/(^x^)\\"; - const int len = sizeof(bunny) - 1; - uint16_t glyphs[len]; - SkPaint paint; - paint.textToGlyphs(bunny, len, glyphs); - int runs[] = { 3, 1, 3 }; - SkPoint textPos = { 20, 100 }; - int glyphIndex = 0; - for (auto runLen : runs) { - paint.setTextSize(1 == runLen ? 20 : 50); - const SkTextBlobBuilder::RunBuffer& run = - textBlobBuilder.allocRun(paint, runLen, textPos.fX, textPos.fY); - memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen); - textPos.fX += paint.measureText(&bunny[glyphIndex], runLen, nullptr); - glyphIndex += runLen; - } - sk_sp<const SkTextBlob> blob = textBlobBuilder.make(); - paint.reset(); + SkTextBlobBuilder textBlobBuilder;
+ const char bunny[] = "/(^x^)\\";
+ const int len = sizeof(bunny) - 1;
+ uint16_t glyphs[len];
+ SkPaint paint;
+ paint.textToGlyphs(bunny, len, glyphs);
+ paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); + int runs[] = { 3, 1, 3 };
+ SkPoint textPos = { 20, 100 };
+ int glyphIndex = 0;
+ for (auto runLen : runs) {
+ paint.setTextSize(1 == runLen ? 20 : 50);
+ const SkTextBlobBuilder::RunBuffer& run =
+ textBlobBuilder.allocRun(paint, runLen, textPos.fX, textPos.fY);
+ memcpy(run.glyphs, &glyphs[glyphIndex], sizeof(glyphs[0]) * runLen);
+ textPos.fX += paint.measureText(&glyphs[glyphIndex], sizeof(glyphs[0]) * runLen, nullptr);
+ glyphIndex += runLen;
+ }
+ sk_sp<const SkTextBlob> blob = textBlobBuilder.make();
+ paint.reset();
canvas->drawTextBlob(blob.get(), 0, 0, paint); } ## @@ -5366,6 +5369,8 @@ Paint_Text_Align, Paint_Hinting, Anti-alias, Paint_Fake_Bold, Font_Embedded_Bitmaps, Full_Hinting_Spacing, LCD_Text, Linear_Text, Subpixel_Text, and Paint_Vertical_Text. +Paint_Text_Encoding must be set to SkPaint::kGlyphID_TextEncoding. + Elements of paint: Path_Effect, Rasterizer, Mask_Filter, Shader, Color_Filter, Image_Filter, and Draw_Looper; apply to blob. @@ -5385,6 +5390,7 @@ Paint attributes related to text, like text size, have no effect on paint passed SkPaint paint; paint.setTextSize(50); paint.setColor(SK_ColorRED); + paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
const SkTextBlobBuilder::RunBuffer& run = textBlobBuilder.allocRun(paint, 1, 20, 100); run.glyphs[0] = 20; |