Flutter Engine
The Flutter Engine
|
#include <SkTextBlob.h>
Classes | |
class | Iter |
Public Types | |
enum | GlyphPositioning : uint8_t |
Public Member Functions | |
const SkRect & | bounds () const |
uint32_t | uniqueID () const |
int | getIntercepts (const SkScalar bounds[2], SkScalar intervals[], const SkPaint *paint=nullptr) const |
size_t | serialize (const SkSerialProcs &procs, void *memory, size_t memory_size) const |
sk_sp< SkData > | serialize (const SkSerialProcs &procs) const |
Public Member Functions inherited from SkNVRefCnt< SkTextBlob > | |
SkNVRefCnt () | |
~SkNVRefCnt () | |
bool | unique () const |
void | ref () const |
void | unref () const |
void | deref () const |
bool | refCntGreaterThan (int32_t threadIsolatedTestCnt) const |
Static Public Member Functions | |
static sk_sp< SkTextBlob > | MakeFromText (const void *text, size_t byteLength, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8) |
static sk_sp< SkTextBlob > | MakeFromString (const char *string, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8) |
static sk_sp< SkTextBlob > | MakeFromPosTextH (const void *text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8) |
static sk_sp< SkTextBlob > | MakeFromPosText (const void *text, size_t byteLength, const SkPoint pos[], const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8) |
static sk_sp< SkTextBlob > | MakeFromRSXform (const void *text, size_t byteLength, const SkRSXform xform[], const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8) |
static sk_sp< SkTextBlob > | Deserialize (const void *data, size_t size, const SkDeserialProcs &procs) |
Friends | |
class | SkNVRefCnt< SkTextBlob > |
class | sktext::GlyphRunList |
class | SkTextBlobBuilder |
class | SkTextBlobPriv |
class | SkTextBlobRunIterator |
SkTextBlob combines multiple text runs into an immutable container. Each text run consists of glyphs, SkPaint, and position. Only parts of SkPaint related to fonts and text rendering are used by run.
Definition at line 41 of file SkTextBlob.h.
enum SkTextBlob::GlyphPositioning : uint8_t |
Definition at line 192 of file SkTextBlob.cpp.
|
inline |
Returns conservative bounding box. Uses SkPaint associated with each glyph to determine glyph bounds, and unions all bounds. Returned bounds may be larger than the bounds of all glyphs in runs.
Definition at line 53 of file SkTextBlob.h.
|
static |
Recreates SkTextBlob that was serialized into data. Returns constructed SkTextBlob if successful; otherwise, returns nullptr. Fails if size is smaller than required data length, or if data does not permit constructing valid SkTextBlob.
procs.fTypefaceProc permits supplying a custom function to decode SkTypeface. If procs.fTypefaceProc is nullptr, default decoding is used. procs.fTypefaceCtx may be used to provide user context to procs.fTypefaceProc; procs.fTypefaceProc is called with a pointer to SkTypeface data, data byte length, and user context.
data | pointer for serial data |
size | size of data |
procs | custom serial data decoders; may be nullptr |
Definition at line 855 of file SkTextBlob.cpp.
int SkTextBlob::getIntercepts | ( | const SkScalar | bounds[2], |
SkScalar | intervals[], | ||
const SkPaint * | paint = nullptr |
||
) | const |
Returns the number of intervals that intersect bounds. bounds describes a pair of lines parallel to the text advance. The return count is zero or a multiple of two, and is at most twice the number of glyphs in the the blob.
Pass nullptr for intervals to determine the size of the interval array.
Runs within the blob that contain SkRSXform are ignored when computing intercepts.
bounds | lower and upper line parallel to the advance |
intervals | returned intersections; may be nullptr |
paint | specifies stroking, SkPathEffect that affects the result; may be nullptr |
Definition at line 927 of file SkTextBlob.cpp.
|
static |
Returns a textblob built from a single run of text with positions. This is equivalent to using SkTextBlobBuilder and calling allocRunPos(). Returns nullptr if byteLength is zero.
text | character code points or glyphs drawn (based on encoding) |
byteLength | byte length of text array |
pos | array of positions, must contain values for all of the character points. |
font | SkFont used for this run |
encoding | specifies the encoding of the text array. |
Definition at line 803 of file SkTextBlob.cpp.
|
static |
Returns a textblob built from a single run of text with x-positions and a single y value. This is equivalent to using SkTextBlobBuilder and calling allocRunPosH(). Returns nullptr if byteLength is zero.
text | character code points or glyphs drawn (based on encoding) |
byteLength | byte length of text array |
xpos | array of x-positions, must contain values for all of the character points. |
constY | shared y-position for each character point, to be paired with each xpos. |
font | SkFont used for this run |
encoding | specifies the encoding of the text array. |
Definition at line 817 of file SkTextBlob.cpp.
|
static |
Definition at line 831 of file SkTextBlob.cpp.
|
inlinestatic |
Creates SkTextBlob with a single run. string meaning depends on SkTextEncoding; by default, string is encoded as UTF-8.
font contains attributes used to define the run text.
When encoding is SkTextEncoding::kUTF8, SkTextEncoding::kUTF16, or SkTextEncoding::kUTF32, this function uses the default character-to-glyph mapping from the SkTypeface in font. It does not perform typeface fallback for characters not found in the SkTypeface. It does not perform kerning or other complex shaping; glyphs are positioned based on their default advances.
string | character code points or glyphs drawn |
font | text size, typeface, text scale, and so on, used to draw |
encoding | text encoding used in the text array |
Definition at line 115 of file SkTextBlob.h.
|
static |
Creates SkTextBlob with a single run.
font contains attributes used to define the run text.
When encoding is SkTextEncoding::kUTF8, SkTextEncoding::kUTF16, or SkTextEncoding::kUTF32, this function uses the default character-to-glyph mapping from the SkTypeface in font. It does not perform typeface fallback for characters not found in the SkTypeface. It does not perform kerning or other complex shaping; glyphs are positioned based on their default advances.
text | character code points or glyphs drawn |
byteLength | byte length of text array |
font | text size, typeface, text scale, and so on, used to draw |
encoding | text encoding used in the text array |
Definition at line 788 of file SkTextBlob.cpp.
sk_sp< SkData > SkTextBlob::serialize | ( | const SkSerialProcs & | procs | ) | const |
Returns storage containing SkData describing SkTextBlob, using optional custom encoders.
procs.fTypefaceProc permits supplying a custom function to encode SkTypeface. If procs.fTypefaceProc is nullptr, default encoding is used. procs.fTypefaceCtx may be used to provide user context to procs.fTypefaceProc; procs.fTypefaceProc is called with a pointer to SkTypeface and user context.
procs | custom serial data encoders; may be nullptr |
example: https://fiddle.skia.org/c/@TextBlob_serialize_2
Definition at line 845 of file SkTextBlob.cpp.
size_t SkTextBlob::serialize | ( | const SkSerialProcs & | procs, |
void * | memory, | ||
size_t | memory_size | ||
) | const |
Writes data to allow later reconstruction of SkTextBlob. memory points to storage to receive the encoded data, and memory_size describes the size of storage. Returns bytes used if provided storage is large enough to hold all data; otherwise, returns zero.
procs.fTypefaceProc permits supplying a custom function to encode SkTypeface. If procs.fTypefaceProc is nullptr, default encoding is used. procs.fTypefaceCtx may be used to provide user context to procs.fTypefaceProc; procs.fTypefaceProc is called with a pointer to SkTypeface and user context.
procs | custom serial data encoders; may be nullptr |
memory | storage for data |
memory_size | size of storage |
example: https://fiddle.skia.org/c/@TextBlob_serialize
Definition at line 864 of file SkTextBlob.cpp.
|
inline |
Returns a non-zero value unique among all text blobs.
Definition at line 59 of file SkTextBlob.h.
|
friend |
Definition at line 209 of file SkTextBlob.h.
|
friend |
Definition at line 269 of file SkTextBlob.h.
|
friend |
Definition at line 270 of file SkTextBlob.h.
|
friend |
Definition at line 271 of file SkTextBlob.h.
|
friend |
Definition at line 272 of file SkTextBlob.h.