add simple docs for textencoding in SkPaint
Bug: skia: Change-Id: Id7cd721dc3d3e6297b2653c26cc35eca8dba0ec8 Reviewed-on: https://skia-review.googlesource.com/c/174591 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Cary Clark <caryclark@google.com>
This commit is contained in:
parent
5ce38d3927
commit
c86ec97ca4
@ -3041,7 +3041,7 @@ void draw(SkCanvas* canvas) {
|
||||
}
|
||||
##
|
||||
|
||||
#Method TextEncoding getTextEncoding() const
|
||||
#Method SkTextEncoding getTextEncoding() const
|
||||
|
||||
#In Text_Encoding
|
||||
#Line # returns character or glyph encoded size ##
|
||||
@ -3064,7 +3064,7 @@ void draw(SkCanvas* canvas) {
|
||||
##
|
||||
|
||||
|
||||
#Method void setTextEncoding(TextEncoding encoding)
|
||||
#Method void setTextEncoding(SkTextEncoding encoding)
|
||||
|
||||
#In Text_Encoding
|
||||
#Line # sets character or glyph encoded size ##
|
||||
@ -3072,8 +3072,8 @@ void draw(SkCanvas* canvas) {
|
||||
|
||||
#Example
|
||||
SkPaint paint;
|
||||
paint.setTextEncoding((SkPaint::TextEncoding) 4);
|
||||
SkDebugf("4 %c= text encoding\n", (SkPaint::TextEncoding) 4 == paint.getTextEncoding() ? '=' : '!');
|
||||
paint.setTextEncoding((SkTextEncoding) 4);
|
||||
SkDebugf("4 %c= text encoding\n", (SkTextEncoding) 4 == paint.getTextEncoding() ? '=' : '!');
|
||||
|
||||
#StdOut
|
||||
4 != text encoding
|
||||
|
@ -26,7 +26,7 @@ fonts and text rendering are used by run.
|
||||
uint16_t glyphs[len];
|
||||
SkPaint paint;
|
||||
paint.textToGlyphs(bunny, len, glyphs);
|
||||
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
|
||||
paint.setTextEncoding(kGlyphID_SkTextEncoding);
|
||||
SkFont font;
|
||||
int runs[] = { 3, 1, 3 };
|
||||
SkPoint textPos = { 20, 50 };
|
||||
@ -65,7 +65,7 @@ for (int index = 0; index < 2; ++index) {
|
||||
uint16_t glyphs[len];
|
||||
SkPaint paint;
|
||||
paint.textToGlyphs(bunny, len, glyphs);
|
||||
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
|
||||
paint.setTextEncoding(kGlyphID_SkTextEncoding);
|
||||
paint.setTextScaleX(0.5);
|
||||
SkFont font;
|
||||
font.setScaleX(0.5);
|
||||
@ -101,7 +101,7 @@ for (int index = 0; index < 2; ++index) {
|
||||
#In Constructors
|
||||
#Line # constructs Text_Blob with one run ##
|
||||
|
||||
Creates Text_Blob with a single run. text meaning depends on Paint_Text_Encoding;
|
||||
Creates Text_Blob with a single run. text meaning depends on Text_Encoding;
|
||||
by default, text is encoded as UTF-8.
|
||||
|
||||
font contains attributes used to define the run text: #paint_font_metrics#.
|
||||
|
@ -875,12 +875,20 @@ public:
|
||||
*/
|
||||
void setTextSkewX(SkScalar skewX);
|
||||
|
||||
// Experimental
|
||||
/**
|
||||
* Returns the text encoding. Text encoding describes how to interpret the text bytes pass
|
||||
* to methods like measureText() and drawText().
|
||||
* @return the text encoding
|
||||
*/
|
||||
SkTextEncoding getTextEncoding() const {
|
||||
return (SkTextEncoding)fBitfields.fTextEncoding;
|
||||
}
|
||||
|
||||
// Experimental
|
||||
/**
|
||||
* Sets the text encoding. Text encoding describes how to interpret the text bytes pass
|
||||
* to methods like measureText() and drawText().
|
||||
* @param encoding the new text encoding
|
||||
*/
|
||||
void setTextEncoding(SkTextEncoding encoding);
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTMEASURE
|
||||
@ -1169,7 +1177,7 @@ public:
|
||||
and text size, fake bold, and SkPathEffect to scale and modify the glyph paths.
|
||||
Uses run array to position intervals.
|
||||
|
||||
SkTextEncoding must be set to SkPaint::kGlyphID_TextEncoding.
|
||||
SkTextEncoding must be set to kGlyphID_SkTextEncoding.
|
||||
|
||||
Pass nullptr for intervals to determine the size of the interval array.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user