26 , fTextRange(firstChar +
info.utf8Range.
begin(), firstChar +
info.utf8Range.
end())
29 , fClusterStart(firstChar)
30 , fGlyphData(
std::make_shared<GlyphData>())
31 , fGlyphs(fGlyphData->
glyphs)
32 , fPositions(fGlyphData->positions)
34 , fClusterIndexes(fGlyphData->clusterIndexes)
35 , fHeightMultiplier(heightMultiplier)
36 , fUseHalfLeading(useHalfLeading)
37 , fBaselineShift(baselineShift)
39 fBidiLevel =
info.fBidiLevel;
40 fAdvance =
info.fAdvance;
42 fUtf8Range =
info.utf8Range;
49 info.fFont.getMetrics(&fFontMetrics);
54 fPositions[
info.glyphCount] = fOffset + fAdvance;
55 fOffsets[
info.glyphCount] = {0, 0};
68 const auto runHeight = fHeightMultiplier * fFont.
getSize();
69 const auto fontIntrinsicHeight = fCorrectDescent - fCorrectAscent;
70 if (fUseHalfLeading) {
71 const auto extraLeading = (runHeight - fontIntrinsicHeight) / 2;
72 fCorrectAscent -= extraLeading;
73 fCorrectDescent += extraLeading;
75 const auto multiplier = runHeight / fontIntrinsicHeight;
76 fCorrectAscent *= multiplier;
77 fCorrectDescent *= multiplier;
80 fCorrectAscent += fBaselineShift;
81 fCorrectDescent += fBaselineShift;
85 return {fGlyphs.
data(), fPositions.
data(), fOffsets.
data(), fClusterIndexes.
data(), fOffset};
93 for (
size_t i = 0;
i <
size; ++
i) {
94 auto point = fPositions[
i +
pos];
95 if (!fJustificationShifts.
empty()) {
96 point.fX += fJustificationShifts[
i +
pos].fX;
98 point += fOffsets[
i +
pos];
99 blobBuffer.points()[
i] = point;
107 if (
text.width() == 0) {
109 if (
text.end > this->fTextRange.start) {
113 return std::make_tuple(
false, 0, 0);
134 return std::make_tuple(
143 return std::make_tuple(
true,
start,
end);
152 return std::make_tuple(
true,
start,
end);
159 auto cluster = &fOwner->
cluster(correctIndex);
166 fAdvance.
fX += space;
168 cluster->
space(space);
173 for (
size_t i = 0;
i < this->
size(); ++
i) {
174 fPositions[
i].fX +=
shift;
185 for (
size_t i = cluster->
startPos(); i < cluster->endPos(); ++
i) {
186 fPositions[
i].fX +=
shift;
206 for (
size_t i = cluster->
startPos(); i < cluster->endPos(); ++
i) {
247 fFontMetrics.
fDescent = baselineAdjustment;
251 fFontMetrics.
fAscent = baselineAdjustment;
273 endlineMetrics->
add(
this);
277 if (ch < fTextRange.start || ch >= fTextRange.
end) {
280 auto shift = ch - fTextRange.
start;
281 auto ratio = shift * 1.0 / fTextRange.
width();
287 if (ch < fTextRange.start || ch >= fTextRange.
end) {
290 auto shift = fTextRange.
end - ch - 1;
291 auto ratio = shift * 1.0 / fTextRange.
width();
297 auto ratio = (
s * 1.0) / fWidth;
304 auto&
run = fOwner->
run(fRunIndex);
309 return posX(
pos) + (fJustificationShifts.
empty() ? 0 : fJustificationShifts[
pos].fY);
314 return &fOwner->
placeholders()[fPlaceholderIndex].fStyle;
321 for (
auto& glyph :fGlyphs) {
330 if (fRunIndex >= fOwner->
runs().size()) {
333 return &fOwner->
run(fRunIndex);
338 return fOwner->
run(fRunIndex);
343 return fOwner->
run(fRunIndex).
font();
348 SkUnicode::CodeUnitFlags::kSoftLineBreakBefore);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define sk_double_floor2int(x)
static void * sk_careful_memcpy(void *dst, const void *src, size_t len)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
#define SkDoubleToScalar(x)
constexpr int SkToInt(S x)
SkScalar trimmedWidth(size_t pos) const
size_t roundPos(SkScalar s) const
SkScalar sizeFromChar(TextIndex ch) const
bool isGraphemeBreak() const
SkScalar sizeToChar(TextIndex ch) const
void space(SkScalar shift)
void setHalfLetterSpacing(SkScalar halfLetterSpacing)
SkScalar deltaBaselines() const
Run & run(RunIndex runIndex)
ClusterIndex clusterIndex(TextIndex textIndex)
bool codeUnitHasProperty(size_t index, SkUnicode::CodeUnitFlags property) const
TextIndex findNextGlyphClusterBoundary(TextIndex utf8) const
Cluster & cluster(ClusterIndex clusterIndex)
SkSpan< Placeholder > placeholders()
TextIndex findPreviousGlyphClusterBoundary(TextIndex utf8) const
TextIndex findPreviousGraphemeBoundary(TextIndex utf8) const
TextIndex findNextGraphemeBoundary(TextIndex utf8) const
void updateMetrics(InternalLineMetrics *endlineMetrics)
void copyTo(SkTextBlobBuilder &builder, size_t pos, size_t size) const
ClusterRange clusterRange() const
bool isPlaceholder() const
SkShaper::RunHandler::Buffer newRunBuffer()
std::tuple< bool, TextIndex, TextIndex > findLimitingGlyphClusters(TextRange text) const
SkScalar positionX(size_t pos) const
void shift(SkScalar shiftX, SkScalar shiftY)
std::tuple< bool, TextIndex, TextIndex > findLimitingGraphemes(TextRange text) const
std::tuple< bool, ClusterIndex, ClusterIndex > findLimitingClusters(TextRange text) const
const SkFont & font() const
std::function< void(Cluster *cluster)> ClusterVisitor
Run(ParagraphImpl *owner, const SkShaper::RunHandler::RunInfo &info, size_t firstChar, SkScalar heightMultiplier, bool useHalfLeading, SkScalar baselineShift, size_t index, SkScalar shiftX)
void addSpacesAtTheEnd(SkScalar space, Cluster *cluster)
void extend(const Cluster *cluster, SkScalar offset)
void iterateThroughClusters(const ClusterVisitor &visitor)
PlaceholderStyle * placeholderStyle() const
SkScalar addSpacesEvenly(SkScalar space, Cluster *cluster)
SkScalar posX(size_t index) const
static const char * begin(const StringSlice &s)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
const SkRange< size_t > EMPTY_CLUSTERS
@ kBaseline
Match the baseline of the placeholder with the baseline.
SkScalar fLeading
distance to add between lines, typically positive or zero
SkScalar fAscent
distance to reserve above baseline, typically negative
SkScalar fDescent
distance to reserve below baseline, typically positive
static constexpr SkPoint Make(float x, float y)
constexpr size_t end() const
PlaceholderAlignment fAlignment