Index: src/ports/SkFontMgr_fontconfig.cpp |
diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp |
index 6fc1f28c89bc318ce2d26622b5acf94f0da295ef..dbc64b6e47655749ab8bf2919e708f01b10eacf3 100644 |
--- a/src/ports/SkFontMgr_fontconfig.cpp |
+++ b/src/ports/SkFontMgr_fontconfig.cpp |
@@ -373,20 +373,13 @@ static void fcpattern_from_skfontstyle(SkFontStyle style, FcPattern* pattern) { |
FcPatternAddInteger(pattern, FC_SLANT, style.isItalic() ? FC_SLANT_ITALIC : FC_SLANT_ROMAN); |
} |
-static SkTypeface::Style sktypefacestyle_from_fcpattern(FcPattern* pattern) { |
- int fcweight = get_int(pattern, FC_WEIGHT, FC_WEIGHT_REGULAR); |
- int fcslant = get_int(pattern, FC_SLANT, FC_SLANT_ROMAN); |
- return (SkTypeface::Style)((fcweight >= FC_WEIGHT_BOLD ? SkTypeface::kBold : 0) | |
- (fcslant > FC_SLANT_ROMAN ? SkTypeface::kItalic : 0)); |
-} |
- |
class SkTypeface_stream : public SkTypeface_FreeType { |
public: |
/** @param stream does not take ownership of the reference, does take ownership of the stream.*/ |
- SkTypeface_stream(SkTypeface::Style style, bool fixedWidth, int ttcIndex, SkStreamAsset* stream) |
+ SkTypeface_stream(const SkFontStyle& style, bool fixedWidth, int index, SkStreamAsset* stream) |
: INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) |
, fStream(SkRef(stream)) |
- , fIndex(ttcIndex) |
+ , fIndex(index) |
{ }; |
virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE { |
@@ -447,7 +440,7 @@ public: |
private: |
/** @param pattern takes ownership of the reference. */ |
SkTypeface_fontconfig(FcPattern* pattern) |
- : INHERITED(sktypefacestyle_from_fcpattern(pattern), |
+ : INHERITED(skfontstyle_from_fcpattern(pattern), |
SkTypefaceCache::NewFontID(), |
FC_PROPORTIONAL != get_int(pattern, FC_SPACING, FC_PROPORTIONAL)) |
, fPattern(pattern) |
@@ -571,7 +564,7 @@ class SkFontMgr_fontconfig : public SkFontMgr { |
sizes.begin(), names.count()); |
} |
- static bool FindByFcPattern(SkTypeface* cached, SkTypeface::Style, void* ctx) { |
+ static bool FindByFcPattern(SkTypeface* cached, const SkFontStyle&, void* ctx) { |
SkTypeface_fontconfig* cshFace = static_cast<SkTypeface_fontconfig*>(cached); |
FcPattern* ctxPattern = static_cast<FcPattern*>(ctx); |
return FcTrue == FcPatternEqual(cshFace->fPattern, ctxPattern); |
@@ -590,7 +583,7 @@ class SkFontMgr_fontconfig : public SkFontMgr { |
FcPatternReference(pattern); |
face = SkTypeface_fontconfig::Create(pattern); |
if (face) { |
- fTFCache.add(face, SkTypeface::kNormal, true); |
+ fTFCache.add(face, SkFontStyle(), true); |
} |
} |
return face; |
@@ -818,7 +811,7 @@ protected: |
return NULL; |
} |
- SkTypeface::Style style = SkTypeface::kNormal; |
+ SkFontStyle style; |
bool isFixedWidth = false; |
if (!SkTypeface_FreeType::ScanFont(stream, ttcIndex, NULL, &style, &isFixedWidth)) { |
return NULL; |