2#ifndef TextStyle_DEFINED
3#define TextStyle_DEFINED
19#define DEFAULT_FONT_FAMILY "sans-serif"
78 return this->fType == other.
fType &&
79 this->fMode == other.
fMode &&
80 this->fColor == other.
fColor &&
81 this->fStyle == other.
fStyle &&
170 const SkPaint*
paint = std::get_if<SkPaint>(&fForeground);
177 fHasForeground =
true;
178 fForeground = std::move(
paint);
186 fHasForeground =
true;
187 fForeground = paintID;
193 const SkPaint*
paint = std::get_if<SkPaint>(&fBackground);
200 fHasBackground =
true;
201 fBackground = std::move(
paint);
206 fHasBackground =
true;
207 fBackground = paintID;
232 std::vector<TextShadow>
getShadows()
const {
return fTextShadows; }
240 { fFontFeatures.emplace_back(fontFeature,
value); }
254 fFontFamilies = std::move(families);
291 static const std::vector<SkString>* kDefaultFontFamilies;
305 std::vector<SkString> fFontFamilies = *kDefaultFontFamilies;
309 bool fHeightOverride =
false;
313 bool fHalfLeading =
false;
321 bool fHasBackground =
false;
323 bool fHasForeground =
false;
326 std::vector<TextShadow> fTextShadows;
329 bool fIsPlaceholder =
false;
331 std::vector<FontFeature> fFontFeatures;
333 std::optional<FontArguments> fFontArguments;
constexpr SkColor SK_ColorTRANSPARENT
constexpr SkColor SK_ColorWHITE
static bool SkIsFinite(T x, Pack... values)
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
#define SK_ScalarNearlyZero
std::variant< SkPaint, PaintID > SkPaintOrID
sk_sp< SkTypeface > refTypeface() const
void setTypeface(sk_sp< SkTypeface > typeface)
void setDecorationStyle(TextDecorationStyle style)
void addShadow(TextShadow shadow)
ParagraphPainter::SkPaintOrID getBackgroundPaintOrID() const
SkColor getDecorationColor() const
void setFontFamilies(std::vector< SkString > families)
TextDecorationMode getDecorationMode() const
bool hasForeground() const
size_t getShadowNumber() const
SkPaint getBackground() const
void setForegroundPaint(SkPaint paint)
SkTypeface * getTypeface() const
std::vector< FontFeature > getFontFeatures() const
SkString getLocale() const
void setHeight(SkScalar height)
TextStyle cloneForPlaceholder()
bool isPlaceholder() const
bool getHeightOverride() const
void setLetterSpacing(SkScalar letterSpacing)
bool getHalfLeading() const
void setWordSpacing(SkScalar wordSpacing)
TextStyle & operator=(const TextStyle &other)=default
TextDecorationStyle getDecorationStyle() const
const std::vector< SkString > & getFontFamilies() const
std::vector< TextShadow > getShadows() const
SkScalar getDecorationThicknessMultiplier() const
SkFontStyle getFontStyle() const
bool matchOneAttribute(StyleType styleType, const TextStyle &other) const
void clearBackgroundColor()
void setColor(SkColor color)
SkScalar getHeight() const
Decoration getDecoration() const
void setHeightOverride(bool heightOverride)
bool equals(const TextStyle &other) const
void setBackgroundPaint(SkPaint paint)
SkScalar getBaselineShift() const
void getFontMetrics(SkFontMetrics *metrics) const
void setTextBaseline(TextBaseline baseline)
SkScalar getLetterSpacing() const
void clearForegroundColor()
void setFontStyle(SkFontStyle fontStyle)
void setBackgroundColor(SkPaint paint)
ParagraphPainter::SkPaintOrID getForegroundPaintOrID() const
void setLocale(const SkString &locale)
TextDecoration getDecorationType() const
bool equalsByFonts(const TextStyle &that) const
void setHalfLeading(bool halfLeading)
size_t getFontFeatureNumber() const
void setFontSize(SkScalar size)
void setFontArguments(const std::optional< SkFontArguments > &args)
void setForegroundColor(SkPaint paint)
void addFontFeature(const SkString &fontFeature, int value)
void setForegroundPaintID(ParagraphPainter::PaintID paintID)
SkScalar getWordSpacing() const
const std::optional< FontArguments > & getFontArguments() const
void setDecorationColor(SkColor color)
void setDecoration(TextDecoration decoration)
TextBaseline getTextBaseline() const
void setDecorationMode(TextDecorationMode mode)
void setDecorationThicknessMultiplier(SkScalar m)
TextStyle(const TextStyle &other)=default
void setBaselineShift(SkScalar baselineShift)
SkPaint getForeground() const
SkScalar getFontSize() const
bool operator==(const TextStyle &rhs) const
bool hasBackground() const
void setBackgroundPaintID(ParagraphPainter::PaintID paintID)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const SkRange< size_t > EMPTY_BLOCKS
const SkRange< size_t > EMPTY_TEXT
PlaceholderAlignment
Where to vertically align the placeholder relative to the surrounding text.
@ kBaseline
Match the baseline of the placeholder with the baseline.
const SkRange< size_t > EMPTY_RANGE
SkRange< size_t > TextRange
constexpr TextDecoration AllTextDecorations[]
SkRange< size_t > BlockRange
static bool nearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
static bool nearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Block(TextRange textRange, const TextStyle &style)
Block(size_t start, size_t end, const TextStyle &style)
bool operator==(const Decoration &other) const
SkScalar fThicknessMultiplier
TextDecorationStyle fStyle
FontFeature(SkString name, int value)
bool operator==(const FontFeature &that) const
PlaceholderAlignment fAlignment
bool equals(const PlaceholderStyle &) const
PlaceholderStyle()=default
PlaceholderStyle(SkScalar width, SkScalar height, PlaceholderAlignment alignment, TextBaseline baseline, SkScalar offset)
Placeholder(size_t start, size_t end, const PlaceholderStyle &style, const TextStyle &textStyle, BlockRange blocksBefore, TextRange textBefore)