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

Unified Diff: src/ports/SkFontMgr_android.cpp

Issue 1092093002: Respect declared font style on Android. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Explicitly default the style to Auto. Created 5 years, 8 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
Index: src/ports/SkFontMgr_android.cpp
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 49ca08194be77cb7044779abce2b07b0d87cdeb7..4251b10ae84e9b7a6f52f1c8fc4b2ececf558164 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -145,9 +145,15 @@ public:
continue;
}
- if (fontFile.fWeight != 0) {
- style = SkFontStyle(fontFile.fWeight, style.width(), style.slant());
+ int weight = fontFile.fWeight != 0 ? fontFile.fWeight : style.weight();
+ SkFontStyle::Slant slant;
+ switch (fontFile.fStyle) {
+ case FontFileInfo::Style::Auto: slant = style.slant(); break;
+ case FontFileInfo::Style::Normal: slant = SkFontStyle::kUpright_Slant; break;
+ case FontFileInfo::Style::Italic: slant = SkFontStyle::kItalic_Slant; break;
+ default: SkASSERT(false); break;
}
+ style = SkFontStyle(weight, style.width(), slant);
const SkLanguage& lang = family.fLanguage;
uint32_t variant = family.fVariant;
« src/ports/SkFontConfigParser_android.h ('K') | « src/ports/SkFontConfigParser_android.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698