skia2/docs/SkTextBlobBuilder_Reference.bmh
Cary Clark 77b3f3aeee Check every word in docs
This enables checking all text to see if it
either represents a valid reference or is a
word in docs/spelling.txt . Expressions are
checked for validity as well.

There are a few shortcuts (marked with TODO):
- typedefs aren't resolved, so cheats are
added for SkVector and SkIVector.
- operator overload detection is incomplete
- constructor detection is incomplete
- formula definitions aren't detected

Found and fixed a bunch of spelling, usage,
and incorrect or obsolete references.

A few comment changes are needed in
include/core to get this to work, mostly
centered around recent SkPaint/SkFont edits.

TBR=reed@google.com
Docs-Preview: https://skia.org/?cl=167541
Bug: skia:
Change-Id: I2e0d5990105c5a8482b0c0d3e50fd0b330996dd6
Reviewed-on: https://skia-review.googlesource.com/c/167541
Reviewed-by: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
2018-11-08 13:27:57 +00:00

223 lines
6.0 KiB
Plaintext

#Topic Text_Blob_Builder
#Alias Text_Blob_Builder_Reference ##
#Class SkTextBlobBuilder
#Code
#Populate
##
Helper class for constructing SkTextBlob.
# ------------------------------------------------------------------------------
#Struct RunBuffer
#Line # storage for Glyphs and Glyph positions ##
#Code
struct RunBuffer {
SkGlyphID* glyphs;
SkScalar* pos;
char* utf8text;
uint32_t* clusters;
};
##
RunBuffer supplies storage for Glyphs and positions within a run.
A run is a sequence of Glyphs sharing Paint_Font_Metrics and positioning.
Each run may position its Glyphs in one of three ways:
by specifying where the first Glyph is drawn, and allowing Paint_Font_Metrics to
determine the advance to subsequent Glyphs; by specifying a baseline, and
the position on that baseline for each Glyph in run; or by providing Point
array, one per Glyph.
#Member SkGlyphID* glyphs
#Line # storage for Glyphs in run ##
glyphs points to memory for one or more Glyphs. glyphs memory must be
written to by the caller.
##
#Member SkScalar* pos
#Line # storage for positions in run ##
pos points to memory for Glyph positions. Depending on how RunBuffer
is allocated, pos may point to zero bytes per Glyph, one Scalar per Glyph,
or one Point per Glyph.
##
#Member char* utf8text
#Line # reserved for future use ##
Reserved for future use. utf8text should not be read or written.
##
#Member uint32_t* clusters
#Line # reserved for future use ##
Reserved for future use. clusters should not be read or written.
##
#SeeAlso allocRun allocRunPos allocRunPosH
#Struct RunBuffer ##
# ------------------------------------------------------------------------------
#Method SkTextBlobBuilder()
#In Constructors
#Line # constructs with default values ##
#Populate
#Example
SkTextBlobBuilder builder;
sk_sp<SkTextBlob> blob = builder.make();
SkDebugf("blob " "%s" " nullptr", blob == nullptr ? "equals" : "does not equal");
#StdOut
blob equals nullptr
##
##
#SeeAlso make SkTextBlob::MakeFromText
#Method ##
# ------------------------------------------------------------------------------
#Method ~SkTextBlobBuilder()
#In Constructors
#Line # deletes storage ##
#Populate
#NoExample
##
#SeeAlso SkTextBlobBuilder()
#Method ##
# ------------------------------------------------------------------------------
#Method sk_sp<SkTextBlob> make()
#In Constructors
#Line # constructs Text_Blob from bulider ##
#Populate
#Example
SkTextBlobBuilder builder;
sk_sp<SkTextBlob> blob = builder.make();
SkDebugf("blob " "%s" " nullptr\n", blob == nullptr ? "equals" : "does not equal");
SkPaint paint;
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
paint.textToGlyphs("x", 1, builder.allocRun(paint, 1, 20, 20).glyphs);
blob = builder.make();
SkDebugf("blob " "%s" " nullptr\n", blob == nullptr ? "equals" : "does not equal");
blob = builder.make();
SkDebugf("blob " "%s" " nullptr\n", blob == nullptr ? "equals" : "does not equal");
#StdOut
blob equals nullptr
blob does not equal nullptr
blob equals nullptr
##
##
#SeeAlso SkTextBlob::MakeFromText
#Method ##
# ------------------------------------------------------------------------------
#Method const RunBuffer& allocRun(const SkFont& font, int count, SkScalar x, SkScalar y,
const SkRect* bounds = nullptr)
#In Allocator
#Line # returns writable glyph buffer at Point ##
#Populate
#Example
#Height 60
SkTextBlobBuilder builder;
SkFont font;
SkPaint paint;
const SkTextBlobBuilder::RunBuffer& run = builder.allocRun(font, 5, 20, 20);
paint.textToGlyphs("hello", 5, run.glyphs);
canvas->drawRect({20, 20, 30, 30}, paint);
canvas->drawTextBlob(builder.make(), 20, 20, paint);
##
#SeeAlso allocRunPosH allocRunPos
#Method ##
# ------------------------------------------------------------------------------
#Method const RunBuffer& allocRunPosH(const SkFont& font, int count, SkScalar y,
const SkRect* bounds = nullptr)
#In Allocator
#Line # returns writable glyph and x-axis position buffers ##
#Populate
#Example
#Height 60
SkTextBlobBuilder builder;
SkPaint paint;
SkFont font;
const SkTextBlobBuilder::RunBuffer& run = builder.allocRunPosH(font, 5, 20);
paint.textToGlyphs("hello", 5, run.glyphs);
SkScalar positions[] = {0, 10, 20, 40, 80};
memcpy(run.pos, positions, sizeof(positions));
canvas->drawTextBlob(builder.make(), 20, 20, paint);
##
#SeeAlso allocRunPos allocRun
#Method ##
# ------------------------------------------------------------------------------
#Method const RunBuffer& allocRunPos(const SkFont& font, int count,
const SkRect* bounds = nullptr)
#In Allocator
#Line # returns writable glyph and Point buffers ##
#Populate
#Example
#Height 90
SkTextBlobBuilder builder;
SkPaint paint;
SkFont font;
const SkTextBlobBuilder::RunBuffer& run = builder.allocRunPos(font, 5);
paint.textToGlyphs("hello", 5, run.glyphs);
SkPoint positions[] = {{0, 0}, {10, 10}, {20, 20}, {40, 40}, {80, 80}};
memcpy(run.pos, positions, sizeof(positions));
canvas->drawTextBlob(builder.make(), 20, 20, paint);
##
#SeeAlso allocRunPosH allocRun
#Method ##
# ------------------------------------------------------------------------------
#Method const RunBuffer& allocRun(const SkPaint& font, int count, SkScalar x, SkScalar y,
const SkRect* bounds = nullptr)
#Deprecated
#Method ##
# ------------------------------------------------------------------------------
#Method const RunBuffer& allocRunPosH(const SkPaint& font, int count, SkScalar y,
const SkRect* bounds = nullptr)
#Deprecated
#Method ##
# ------------------------------------------------------------------------------
#Method const RunBuffer& allocRunPos(const SkPaint& font, int count,
const SkRect* bounds = nullptr)
#Deprecated
#Method ##
#Class SkTextBlobBuilder ##
#Topic Text_Blob_Builder ##