6 #include "flutter/display_list/geometry/dl_path.h"
7 #include "fml/status.h"
20 : runs_(
std::move(runs)),
22 has_color_(has_color),
23 path_creator_(path_creator) {}
49 constexpr uint32_t kDenominator = 200;
50 constexpr int32_t kMaximumTextScale = 48;
56 if (scale > kMaximumTextScale) {
57 return Rational(kMaximumTextScale * kDenominator, kDenominator);
71 return std::clamp(result,
Rational(0, kDenominator),
72 Rational(kMaximumTextScale * kDenominator, kDenominator));
116 return path_creator_();
118 return fml::Status(fml::StatusCode::kCancelled,
"no path creator specified.");
122 return runs_[0].GetFont();
126 if (runs_.size() == 1 && runs_[0].GetGlyphCount() == 1) {
127 return runs_[0].GetGlyphPositions()[0].glyph;
Describes a typeface along with any modifications to its intrinsic properties.
Type
Describes how the glyphs are represented in the texture.
int32_t GetNumerator() const
uint32_t GetDenominator() const
static Rational RoundScaledFontSize(Scalar scale)
Rect GetBounds() const
The conservative bounding box for this text frame.
GlyphAtlas::Type GetAtlasType() const
The type of atlas this run should be place in.
std::optional< Glyph > AsSingleGlyph() const
If this text frame contains a single glyph (such as for an Icon), then return it, otherwise std::null...
bool HasColor() const
Returns whether any glyph in any run in this TextFrame is colored and so would be cached with color a...
const Font & GetFont() const
Return the font of the first glyph run.
size_t GetRunCount() const
The number of runs in this text frame.
fml::StatusOr< flutter::DlPath > GetPath() const
static SubpixelPosition ComputeSubpixelPosition(const TextRun::GlyphPosition &glyph_position, AxisAlignment alignment, const Matrix &transform)
const std::vector< TextRun > & GetRuns() const
Returns a reference to all the text runs in this frame.
AxisAlignment
Determines the axis along which there is subpixel positioning.
std::function< fml::StatusOr< flutter::DlPath >()> PathCreator
static constexpr SubpixelPosition ComputeFractionalPosition(Scalar value)
A 4x4 matrix using column-major storage.