[SkParagraph] Copy font features to the Skia layout engine text style (flutter/engine#15562)

This commit is contained in:
Jason Simmons
2020-01-13 15:47:31 -08:00
committed by GitHub
parent 353d4aa572
commit bb39a8050a
3 changed files with 11 additions and 0 deletions

View File

@@ -114,6 +114,11 @@ skt::TextStyle TxtToSkia(const TextStyle& txt) {
skia.setForegroundColor(txt.foreground);
}
skia.resetFontFeatures();
for (const auto& ff : txt.font_features.GetFontFeatures()) {
skia.addFontFeature(SkString(ff.first.c_str()), ff.second);
}
skia.resetShadows();
for (const txt::TextShadow& txt_shadow : txt.text_shadows) {
skt::TextShadow shadow;

View File

@@ -40,4 +40,8 @@ std::string FontFeatures::GetFeatureSettings() const {
return stream.str();
}
const std::map<std::string, int>& FontFeatures::GetFontFeatures() const {
return feature_map_;
}
} // namespace txt

View File

@@ -31,6 +31,8 @@ class FontFeatures {
std::string GetFeatureSettings() const;
const std::map<std::string, int>& GetFontFeatures() const;
private:
std::map<std::string, int> feature_map_;
};