[SkParagraph] Copy font features to the Skia layout engine text style (flutter/engine#15562)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user