Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: src/svg/SkSVGDevice.cpp

Issue 940283002: [SVGDevice] Text whitespace unittest (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: more win warnings Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/xml/SkDOM.h ('k') | src/xml/SkDOM.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/svg/SkSVGDevice.cpp
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index 4b9f48983296837c24b6ea9e2838d84215e187d0..af05d44f882ffe195dfaac72f6d77dc80e0128a2 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -458,14 +458,6 @@ void SkSVGDevice::AutoElement::addPathAttributes(const SkPath& path) {
void SkSVGDevice::AutoElement::addTextAttributes(const SkPaint& paint) {
this->addAttribute("font-size", paint.getTextSize());
- SkTypeface::Style style = paint.getTypeface()->style();
- if (style & SkTypeface::kItalic) {
- this->addAttribute("font-style", "italic");
- }
- if (style & SkTypeface::kBold) {
- this->addAttribute("font-weight", "bold");
- }
-
if (const char* textAlign = svg_text_align(paint.getTextAlign())) {
this->addAttribute("text-anchor", textAlign);
}
@@ -473,7 +465,17 @@ void SkSVGDevice::AutoElement::addTextAttributes(const SkPaint& paint) {
SkString familyName;
SkTHashSet<SkString, hash_family_string> familySet;
SkAutoTUnref<const SkTypeface> tface(paint.getTypeface() ?
- SkRef(paint.getTypeface()) : SkTypeface::RefDefault(style));
+ SkRef(paint.getTypeface()) : SkTypeface::RefDefault());
+
+ SkASSERT(tface);
+ SkTypeface::Style style = tface->style();
+ if (style & SkTypeface::kItalic) {
+ this->addAttribute("font-style", "italic");
+ }
+ if (style & SkTypeface::kBold) {
+ this->addAttribute("font-weight", "bold");
+ }
+
SkAutoTUnref<SkTypeface::LocalizedStrings> familyNameIter(tface->createFamilyNameIterator());
SkTypeface::LocalizedString familyString;
while (familyNameIter->next(&familyString)) {
« no previous file with comments | « include/xml/SkDOM.h ('k') | src/xml/SkDOM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698