15 result.fFontSize = fFontSize;
16 result.fFontFamilies = fFontFamilies;
17 result.fDecoration = fDecoration;
18 result.fHasBackground = fHasBackground;
19 result.fHasForeground = fHasForeground;
20 result.fBackground = fBackground;
21 result.fForeground = fForeground;
22 result.fHeightOverride = fHeightOverride;
23 result.fIsPlaceholder =
true;
24 result.fFontFeatures = fFontFeatures;
25 result.fHalfLeading = fHalfLeading;
26 result.fBaselineShift = fBaselineShift;
27 result.fFontArguments = fFontArguments;
33 if (fIsPlaceholder || other.fIsPlaceholder) {
37 if (fColor != other.fColor) {
40 if (!(fDecoration == other.fDecoration)) {
43 if (!(fFontStyle == other.fFontStyle)) {
46 if (fFontFamilies != other.fFontFamilies) {
49 if (fLetterSpacing != other.fLetterSpacing) {
52 if (fWordSpacing != other.fWordSpacing) {
55 if (fHeight != other.fHeight) {
58 if (fHeightOverride != other.fHeightOverride) {
61 if (fHalfLeading != other.fHalfLeading) {
64 if (fBaselineShift != other.fBaselineShift) {
67 if (fFontSize != other.fFontSize) {
70 if (fLocale != other.fLocale) {
73 if (fHasForeground != other.fHasForeground || fForeground != other.fForeground) {
76 if (fHasBackground != other.fHasBackground || fBackground != other.fBackground) {
79 if (fTextShadows.size() != other.fTextShadows.size()) {
82 for (
size_t i = 0; i < fTextShadows.size(); ++i) {
83 if (fTextShadows[i] != other.fTextShadows[i]) {
87 if (fFontFeatures.size() != other.fFontFeatures.size()) {
90 for (
size_t i = 0; i < fFontFeatures.size(); ++i) {
91 if (!(fFontFeatures[i] == other.fFontFeatures[i])) {
95 if (fFontArguments != other.fFontArguments) {
104 return !fIsPlaceholder && !that.fIsPlaceholder &&
105 fFontStyle == that.fFontStyle &&
106 fFontFamilies == that.fFontFamilies &&
107 fFontFeatures == that.fFontFeatures &&
109 nearlyEqual(fLetterSpacing, that.fLetterSpacing) &&
112 nearlyEqual(fBaselineShift, that.fBaselineShift) &&
114 fLocale == that.fLocale;
120 return (!fHasForeground && !other.fHasForeground && fColor == other.fColor) ||
121 ( fHasForeground && other.fHasForeground && fForeground == other.fForeground);
124 return (!fHasBackground && !other.fHasBackground) ||
125 ( fHasBackground && other.fHasBackground && fBackground == other.fBackground);
128 if (fTextShadows.size() != other.fTextShadows.size()) {
132 for (int32_t i = 0; i <
SkToInt(fTextShadows.size()); ++i) {
133 if (fTextShadows[i] != other.fTextShadows[i]) {
140 return this->fDecoration == other.fDecoration;
143 return fLetterSpacing == other.fLetterSpacing;
146 return fWordSpacing == other.fWordSpacing;
149 return this->
equals(other);
153 return fFontStyle == other.fFontStyle &&
154 fLocale == other.fLocale &&
155 fFontFamilies == other.fFontFamilies &&
156 fFontSize == other.fFontSize &&
157 fHeight == other.fHeight &&
158 fHalfLeading == other.fHalfLeading &&
159 fBaselineShift == other.fBaselineShift &&
160 fFontArguments == other.fFontArguments;
#define DEFAULT_FONT_FAMILY
TextStyle cloneForPlaceholder()
bool matchOneAttribute(StyleType styleType, const TextStyle &other) const
bool equals(const TextStyle &other) const
void getFontMetrics(SkFontMetrics *metrics) const
bool equalsByFonts(const TextStyle &that) const
void setFontArguments(const std::optional< SkFontArguments > &args)
const std::optional< FontArguments > & getFontArguments() const
@ kBaseline
Match the baseline of the placeholder with the baseline.
static bool nearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
PlaceholderAlignment fAlignment
bool equals(const PlaceholderStyle &) const