Placeholders implementation + unit tests
Change-Id: I4e87a6927cbd6ef087b72aaa4b2155c1859589b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235677
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
diff --git a/modules/skparagraph/src/TextStyle.cpp b/modules/skparagraph/src/TextStyle.cpp
index 5f82452..0487aa1 100644
--- a/modules/skparagraph/src/TextStyle.cpp
+++ b/modules/skparagraph/src/TextStyle.cpp
@@ -26,9 +26,25 @@
fHasForeground = false;
fTextBaseline = TextBaseline::kAlphabetic;
fLocale = "";
+ fIsPlaceholder = false;
+}
+
+TextStyle:: TextStyle(const TextStyle& other, bool placeholder) {
+ fColor = other.fColor;
+ fDecoration = other.fDecoration;
+ fHasBackground = other.fHasBackground;
+ fHasForeground = other.fHasForeground;
+ fBackground = other.fBackground;
+ fForeground = other.fForeground;
+ fIsPlaceholder = placeholder;
}
bool TextStyle::equals(const TextStyle& other) const {
+
+ if (fIsPlaceholder || other.fIsPlaceholder) {
+ return false;
+ }
+
if (fColor != other.fColor) {
return false;
}
@@ -124,6 +140,9 @@
void TextStyle::getFontMetrics(SkFontMetrics* metrics) const {
SkFont font(fTypeface, fFontSize);
+ font.setEdging(SkFont::Edging::kAntiAlias);
+ font.setSubpixel(true);
+ font.setHinting(SkFontHinting::kSlight);
font.getMetrics(metrics);
if (fHeightOverride) {
auto multiplier = fHeight * fFontSize;