[svg] Parse text attributes
Convert font-family, font-size, font-style and font-weight to
presentation attributes, and add parsing utils.
Bug: skia:10840
Change-Id: I1acdb59bc95fe46e67ed0f499dd0732420016663
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/328436
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
diff --git a/modules/svg/src/SkSVGNode.cpp b/modules/svg/src/SkSVGNode.cpp
index d634722..ce05aa5 100644
--- a/modules/svg/src/SkSVGNode.cpp
+++ b/modules/svg/src/SkSVGNode.cpp
@@ -169,6 +169,26 @@
this->setFillRule(*fillRule);
}
break;
+ case SkSVGAttribute::kFontFamily:
+ if (const SkSVGFontFamilyValue* family = v.as<SkSVGFontFamilyValue>()) {
+ this->setFontFamily(*family);
+ }
+ break;
+ case SkSVGAttribute::kFontSize:
+ if (const SkSVGFontSizeValue* size = v.as<SkSVGFontSizeValue>()) {
+ this->setFontSize(*size);
+ }
+ break;
+ case SkSVGAttribute::kFontStyle:
+ if (const SkSVGFontStyleValue* style = v.as<SkSVGFontStyleValue>()) {
+ this->setFontStyle(*style);
+ }
+ break;
+ case SkSVGAttribute::kFontWeight:
+ if (const SkSVGFontWeightValue* style = v.as<SkSVGFontWeightValue>()) {
+ this->setFontWeight(*style);
+ }
+ break;
case SkSVGAttribute::kOpacity:
if (const SkSVGNumberValue* opacity = v.as<SkSVGNumberValue>()) {
this->setOpacity(*opacity);