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

Unified Diff: src/ports/SkFontMgr_android.cpp

Issue 694533006: Allow all font weights on Android and respect overrides. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add expectations. Created 6 years, 1 month 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 | « src/ports/SkFontConfigParser_android.cpp ('k') | tests/FontConfigParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontMgr_android.cpp
diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp
index 4677a1f86d0a2a7e32f2450e3d0dc9b943c2f09d..508ad4c9c13f3415bd11cd1e50ef198e430f61b3 100644
--- a/src/ports/SkFontMgr_android.cpp
+++ b/src/ports/SkFontMgr_android.cpp
@@ -44,7 +44,7 @@ public:
SkTypeface_Android(int index,
const SkFontStyle& style,
bool isFixedPitch,
- const SkString familyName)
+ const SkString& familyName)
: INHERITED(style, SkTypefaceCache::NewFontID(), isFixedPitch)
, fIndex(index)
, fFamilyName(familyName) { }
@@ -63,11 +63,11 @@ private:
class SkTypeface_AndroidSystem : public SkTypeface_Android {
public:
- SkTypeface_AndroidSystem(const SkString pathName,
+ SkTypeface_AndroidSystem(const SkString& pathName,
int index,
const SkFontStyle& style,
bool isFixedPitch,
- const SkString familyName,
+ const SkString& familyName,
const SkLanguage& lang,
FontVariant variantStyle)
: INHERITED(index, style, isFixedPitch, familyName)
@@ -102,7 +102,7 @@ public:
int index,
const SkFontStyle& style,
bool isFixedPitch,
- const SkString familyName)
+ const SkString& familyName)
: INHERITED(index, style, isFixedPitch, familyName)
, fStream(SkRef(stream)) { }
@@ -167,6 +167,10 @@ public:
continue;
}
+ if (fontFile.fWeight != 0) {
+ style = SkFontStyle(fontFile.fWeight, style.width(), style.slant());
+ }
+
const SkLanguage& lang = family.fLanguage;
uint32_t variant = family.fVariant;
if (kDefault_FontVariant == variant) {
@@ -231,16 +235,7 @@ public:
private:
SkFontStyle style(int index) {
- return SkFontStyle(this->weight(index), SkFontStyle::kNormal_Width,
- this->slant(index));
- }
- SkFontStyle::Weight weight(int index) {
- if (fStyles[index]->isBold()) return SkFontStyle::kBold_Weight;
- return SkFontStyle::kNormal_Weight;
- }
- SkFontStyle::Slant slant(int index) {
- if (fStyles[index]->isItalic()) return SkFontStyle::kItalic_Slant;
- return SkFontStyle::kUpright_Slant;
+ return fStyles[index]->fontStyle();
}
static int match_score(const SkFontStyle& pattern, const SkFontStyle& candidate) {
int score = 0;
« no previous file with comments | « src/ports/SkFontConfigParser_android.cpp ('k') | tests/FontConfigParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698