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; |