Skia
2D Graphics Library
|
Helper class for constructing SkTextBlob. More...
#include <SkTextBlob.h>
Classes | |
struct | RunBuffer |
RunBuffer supplies storage for glyphs and positions within a run. More... | |
Public Member Functions | |
SkTextBlobBuilder () | |
Constructs empty SkTextBlobBuilder. More... | |
~SkTextBlobBuilder () | |
Deletes data allocated internally by SkTextBlobBuilder. More... | |
sk_sp< SkTextBlob > | make () |
Returns SkTextBlob built from runs of glyphs added by builder. More... | |
const RunBuffer & | allocRun (const SkFont &font, int count, SkScalar x, SkScalar y, const SkRect *bounds=nullptr) |
Returns run with storage for glyphs. More... | |
const RunBuffer & | allocRunPosH (const SkFont &font, int count, SkScalar y, const SkRect *bounds=nullptr) |
Returns run with storage for glyphs and positions along baseline. More... | |
const RunBuffer & | allocRunPos (const SkFont &font, int count, const SkRect *bounds=nullptr) |
Returns run with storage for glyphs and SkPoint positions. More... | |
const RunBuffer & | allocRunRSXform (const SkFont &font, int count) |
const RunBuffer & | allocRunText (const SkFont &font, int count, SkScalar x, SkScalar y, int textByteCount, const SkRect *bounds=nullptr) |
Returns run with storage for glyphs, text, and clusters. More... | |
const RunBuffer & | allocRunTextPosH (const SkFont &font, int count, SkScalar y, int textByteCount, const SkRect *bounds=nullptr) |
Returns run with storage for glyphs, positions along baseline, text, and clusters. More... | |
const RunBuffer & | allocRunTextPos (const SkFont &font, int count, int textByteCount, const SkRect *bounds=nullptr) |
Returns run with storage for glyphs, SkPoint positions, text, and clusters. More... | |
const RunBuffer & | allocRunTextRSXform (const SkFont &font, int count, int textByteCount, const SkRect *bounds=nullptr) |
Friends | |
class | SkTextBlobPriv |
class | SkTextBlobBuilderPriv |
Helper class for constructing SkTextBlob.
SkTextBlobBuilder::SkTextBlobBuilder | ( | ) |
Constructs empty SkTextBlobBuilder.
By default, SkTextBlobBuilder has no runs.
example: https://fiddle.skia.org/c/@TextBlobBuilder_empty_constructor
SkTextBlobBuilder::~SkTextBlobBuilder | ( | ) |
Deletes data allocated internally by SkTextBlobBuilder.
const RunBuffer& SkTextBlobBuilder::allocRun | ( | const SkFont & | font, |
int | count, | ||
SkScalar | x, | ||
SkScalar | y, | ||
const SkRect * | bounds = nullptr |
||
) |
Returns run with storage for glyphs.
Caller must write count glyphs to RunBuffer::glyphs before next call to SkTextBlobBuilder.
RunBuffer::pos, RunBuffer::utf8text, and RunBuffer::clusters should be ignored.
Glyphs share metrics in font.
Glyphs are positioned on a baseline at (x, y), using font metrics to determine their relative placement.
bounds defines an optional bounding box, used to suppress drawing when SkTextBlob bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds is computed from (x, y) and RunBuffer::glyphs metrics.
font | SkFont used for this run |
count | number of glyphs |
x | horizontal offset within the blob |
y | vertical offset within the blob |
bounds | optional run bounding box |
const RunBuffer& SkTextBlobBuilder::allocRunPos | ( | const SkFont & | font, |
int | count, | ||
const SkRect * | bounds = nullptr |
||
) |
Returns run with storage for glyphs and SkPoint positions.
Caller must write count glyphs to RunBuffer::glyphs and count SkPoint to RunBuffer::pos before next call to SkTextBlobBuilder.
RunBuffer::utf8text and RunBuffer::clusters should be ignored.
Glyphs share metrics in font.
Glyphs are positioned using SkPoint written by caller to RunBuffer::pos, using two scalar values for each SkPoint.
bounds defines an optional bounding box, used to suppress drawing when SkTextBlob bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds is computed from RunBuffer::pos, and RunBuffer::glyphs metrics.
font | SkFont used for this run |
count | number of glyphs |
bounds | optional run bounding box |
const RunBuffer& SkTextBlobBuilder::allocRunPosH | ( | const SkFont & | font, |
int | count, | ||
SkScalar | y, | ||
const SkRect * | bounds = nullptr |
||
) |
Returns run with storage for glyphs and positions along baseline.
Caller must write count glyphs to RunBuffer::glyphs and count scalars to RunBuffer::pos before next call to SkTextBlobBuilder.
RunBuffer::utf8text and RunBuffer::clusters should be ignored.
Glyphs share metrics in font.
Glyphs are positioned on a baseline at y, using x-axis positions written by caller to RunBuffer::pos.
bounds defines an optional bounding box, used to suppress drawing when SkTextBlob bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds is computed from y, RunBuffer::pos, and RunBuffer::glyphs metrics.
font | SkFont used for this run |
count | number of glyphs |
y | vertical offset within the blob |
bounds | optional run bounding box |
const RunBuffer& SkTextBlobBuilder::allocRunText | ( | const SkFont & | font, |
int | count, | ||
SkScalar | x, | ||
SkScalar | y, | ||
int | textByteCount, | ||
const SkRect * | bounds = nullptr |
||
) |
Returns run with storage for glyphs, text, and clusters.
Caller must write count glyphs to RunBuffer::glyphs, textByteCount UTF-8 code units into RunBuffer::utf8text, and count monotonic indexes into utf8text into RunBuffer::clusters before next call to SkTextBlobBuilder.
RunBuffer::pos should be ignored.
Glyphs share metrics in font.
Glyphs are positioned on a baseline at (x, y), using font metrics to determine their relative placement.
bounds defines an optional bounding box, used to suppress drawing when SkTextBlob bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds is computed from (x, y) and RunBuffer::glyphs metrics.
font | SkFont used for this run |
count | number of glyphs |
x | horizontal offset within the blob |
y | vertical offset within the blob |
textByteCount | number of UTF-8 code units |
bounds | optional run bounding box |
const RunBuffer& SkTextBlobBuilder::allocRunTextPos | ( | const SkFont & | font, |
int | count, | ||
int | textByteCount, | ||
const SkRect * | bounds = nullptr |
||
) |
Returns run with storage for glyphs, SkPoint positions, text, and clusters.
Caller must write count glyphs to RunBuffer::glyphs, count SkPoint to RunBuffer::pos, textByteCount UTF-8 code units into RunBuffer::utf8text, and count monotonic indexes into utf8text into RunBuffer::clusters before next call to SkTextBlobBuilder.
Glyphs share metrics in font.
Glyphs are positioned using SkPoint written by caller to RunBuffer::pos, using two scalar values for each SkPoint.
bounds defines an optional bounding box, used to suppress drawing when SkTextBlob bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds is computed from RunBuffer::pos, and RunBuffer::glyphs metrics.
font | SkFont used for this run |
count | number of glyphs |
textByteCount | number of UTF-8 code units |
bounds | optional run bounding box |
const RunBuffer& SkTextBlobBuilder::allocRunTextPosH | ( | const SkFont & | font, |
int | count, | ||
SkScalar | y, | ||
int | textByteCount, | ||
const SkRect * | bounds = nullptr |
||
) |
Returns run with storage for glyphs, positions along baseline, text, and clusters.
Caller must write count glyphs to RunBuffer::glyphs, count scalars to RunBuffer::pos, textByteCount UTF-8 code units into RunBuffer::utf8text, and count monotonic indexes into utf8text into RunBuffer::clusters before next call to SkTextBlobBuilder.
Glyphs share metrics in font.
Glyphs are positioned on a baseline at y, using x-axis positions written by caller to RunBuffer::pos.
bounds defines an optional bounding box, used to suppress drawing when SkTextBlob bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds is computed from y, RunBuffer::pos, and RunBuffer::glyphs metrics.
font | SkFont used for this run |
count | number of glyphs |
y | vertical offset within the blob |
textByteCount | number of UTF-8 code units |
bounds | optional run bounding box |
const RunBuffer& SkTextBlobBuilder::allocRunTextRSXform | ( | const SkFont & | font, |
int | count, | ||
int | textByteCount, | ||
const SkRect * | bounds = nullptr |
||
) |
sk_sp<SkTextBlob> SkTextBlobBuilder::make | ( | ) |
Returns SkTextBlob built from runs of glyphs added by builder.
Returned SkTextBlob is immutable; it may be copied, but its contents may not be altered. Returns nullptr if no runs of glyphs were added by builder.
Resets SkTextBlobBuilder to its initial empty state, allowing it to be reused to build a new set of runs.
|
friend |
|
friend |